mirror of https://github.com/ARMmbed/mbed-os.git
Need to protect members with MBEDTLS_PK_C and X509_CRT_PARSE flags.
This is dependency to X509_CRT_PARSE but just to make sure that also the 'mbedtls_pk_context' structure is not used if that flag is not enabled.pull/8659/head
parent
46c46019bc
commit
2229a2f2f5
|
@ -48,7 +48,9 @@ TLSSocketWrapper::TLSSocketWrapper(Socket *transport, const char *hostname, cont
|
||||||
mbedtls_entropy_init(&_entropy);
|
mbedtls_entropy_init(&_entropy);
|
||||||
mbedtls_ctr_drbg_init(&_ctr_drbg);
|
mbedtls_ctr_drbg_init(&_ctr_drbg);
|
||||||
mbedtls_ssl_init(&_ssl);
|
mbedtls_ssl_init(&_ssl);
|
||||||
|
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||||
mbedtls_pk_init(&_pkctx);
|
mbedtls_pk_init(&_pkctx);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (hostname) {
|
if (hostname) {
|
||||||
set_hostname(hostname);
|
set_hostname(hostname);
|
||||||
|
@ -63,9 +65,8 @@ TLSSocketWrapper::~TLSSocketWrapper()
|
||||||
mbedtls_entropy_free(&_entropy);
|
mbedtls_entropy_free(&_entropy);
|
||||||
mbedtls_ctr_drbg_free(&_ctr_drbg);
|
mbedtls_ctr_drbg_free(&_ctr_drbg);
|
||||||
mbedtls_ssl_free(&_ssl);
|
mbedtls_ssl_free(&_ssl);
|
||||||
|
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||||
mbedtls_pk_free(&_pkctx);
|
mbedtls_pk_free(&_pkctx);
|
||||||
|
|
||||||
#ifdef MBEDTLS_X509_CRT_PARSE_C
|
|
||||||
set_own_cert(NULL);
|
set_own_cert(NULL);
|
||||||
set_ca_chain(NULL);
|
set_ca_chain(NULL);
|
||||||
#endif
|
#endif
|
||||||
|
@ -119,7 +120,7 @@ nsapi_error_t TLSSocketWrapper::set_client_cert_key(const char *client_cert_pem,
|
||||||
nsapi_error_t TLSSocketWrapper::set_client_cert_key(const void *client_cert, size_t client_cert_len,
|
nsapi_error_t TLSSocketWrapper::set_client_cert_key(const void *client_cert, size_t client_cert_len,
|
||||||
const void *client_private_key_pem, size_t client_private_key_len)
|
const void *client_private_key_pem, size_t client_private_key_len)
|
||||||
{
|
{
|
||||||
#if !defined(MBEDTLS_X509_CRT_PARSE_C)
|
#if !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_PK_C)
|
||||||
return NSAPI_ERROR_UNSUPPORTED;
|
return NSAPI_ERROR_UNSUPPORTED;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -483,7 +484,7 @@ int TLSSocketWrapper::ssl_send(void *ctx, const unsigned char *buf, size_t len)
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MBEDTLS_X509_CRT_PARSE_C
|
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||||
|
|
||||||
mbedtls_x509_crt *TLSSocketWrapper::get_own_cert()
|
mbedtls_x509_crt *TLSSocketWrapper::get_own_cert()
|
||||||
{
|
{
|
||||||
|
|
|
@ -232,7 +232,9 @@ private:
|
||||||
static int ssl_send(void *ctx, const unsigned char *buf, size_t len);
|
static int ssl_send(void *ctx, const unsigned char *buf, size_t len);
|
||||||
|
|
||||||
mbedtls_ssl_context _ssl;
|
mbedtls_ssl_context _ssl;
|
||||||
|
#ifdef MBEDTLS_X509_CRT_PARSE_C
|
||||||
mbedtls_pk_context _pkctx;
|
mbedtls_pk_context _pkctx;
|
||||||
|
#endif
|
||||||
mbedtls_ctr_drbg_context _ctr_drbg;
|
mbedtls_ctr_drbg_context _ctr_drbg;
|
||||||
mbedtls_entropy_context _entropy;
|
mbedtls_entropy_context _entropy;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue