Fix guard controlling whether nested acquire calls are allowed

Resource counting as a safe-guard against nested acquire calls
is implemented if and only if MBEDTLS_X509_ALWAYS_FLUSH is disabled
_or_ MBEDTLS_THREADING_C is enabled.
This commit is contained in:
Hanno Becker 2019-07-02 13:37:12 +01:00
parent 7ab8a2e2a0
commit 410322f23e

View file

@ -193,7 +193,8 @@ int mbedtls_x509_crt_cache_provide_frame( mbedtls_x509_crt const *crt )
if( cache->frame != NULL ) if( cache->frame != NULL )
{ {
#if !defined(MBEDTLS_X509_ALWAYS_FLUSH) #if !defined(MBEDTLS_X509_ALWAYS_FLUSH) || \
defined(MBEDTLS_THREADING_C)
return( 0 ); return( 0 );
#else #else
/* If MBEDTLS_X509_ALWAYS_FLUSH is set, we don't /* If MBEDTLS_X509_ALWAYS_FLUSH is set, we don't
@ -253,7 +254,8 @@ int mbedtls_x509_crt_cache_provide_pk( mbedtls_x509_crt const *crt )
if( cache->pk != NULL ) if( cache->pk != NULL )
{ {
#if !defined(MBEDTLS_X509_ALWAYS_FLUSH) #if !defined(MBEDTLS_X509_ALWAYS_FLUSH) || \
defined(MBEDTLS_THREADING_C)
return( 0 ); return( 0 );
#else #else
/* If MBEDTLS_X509_ALWAYS_FLUSH is set, we don't /* If MBEDTLS_X509_ALWAYS_FLUSH is set, we don't