diff --git a/src/core/meshcop/secure_transport.cpp b/src/core/meshcop/secure_transport.cpp index 9285050407f..96171c8a233 100644 --- a/src/core/meshcop/secure_transport.cpp +++ b/src/core/meshcop/secure_transport.cpp @@ -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 } diff --git a/src/core/meshcop/secure_transport.hpp b/src/core/meshcop/secure_transport.hpp index 82e4c842c61..84acc99563c 100644 --- a/src/core/meshcop/secure_transport.hpp +++ b/src/core/meshcop/secure_transport.hpp @@ -48,7 +48,9 @@ #include #include +#if defined(MBEDTLS_SSL_SRV_C) && defined(MBEDTLS_SSL_COOKIE_C) #include +#endif #include #if OPENTHREAD_CONFIG_BLE_TCAT_ENABLE @@ -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