Skip to content

Commit

Permalink
[secure-transport] only initialize mCookieCtx on the server (openth…
Browse files Browse the repository at this point in the history
…read#10782)

`MBEDTLS_SSL_COOKIE_C` is only used on the server. There is no point
in initializing it on the client side.
  • Loading branch information
thcu-gp authored Oct 4, 2024
1 parent 7810269 commit 678d137
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/meshcop/secure_transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ SecureTransport::SecureTransport(Instance &aInstance, bool aLayerTwoSecurity, bo
ClearAllBytes(mSsl);
ClearAllBytes(mConf);

#ifdef MBEDTLS_SSL_COOKIE_C
#if defined(MBEDTLS_SSL_SRV_C) && defined(MBEDTLS_SSL_COOKIE_C)
ClearAllBytes(mCookieCtx);
#endif
}
Expand Down
4 changes: 3 additions & 1 deletion src/core/meshcop/secure_transport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@

#include <mbedtls/net_sockets.h>
#include <mbedtls/ssl.h>
#if defined(MBEDTLS_SSL_SRV_C) && defined(MBEDTLS_SSL_COOKIE_C)
#include <mbedtls/ssl_cookie.h>
#endif
#include <mbedtls/version.h>

#if OPENTHREAD_CONFIG_BLE_TCAT_ENABLE
Expand Down Expand Up @@ -624,7 +626,7 @@ class SecureTransport : public InstanceLocator
mbedtls_ssl_context mSsl;
mbedtls_ssl_config mConf;

#ifdef MBEDTLS_SSL_COOKIE_C
#if defined(MBEDTLS_SSL_SRV_C) && defined(MBEDTLS_SSL_COOKIE_C)
mbedtls_ssl_cookie_ctx mCookieCtx;
#endif

Expand Down

0 comments on commit 678d137

Please sign in to comment.