From 410322f23e16c17a6bc42b93801ade286c0ad190 Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Tue, 2 Jul 2019 13:37:12 +0100 Subject: [PATCH] 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. --- library/x509_crt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/x509_crt.c b/library/x509_crt.c index 4f33d211d..59898f724 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -193,7 +193,8 @@ int mbedtls_x509_crt_cache_provide_frame( mbedtls_x509_crt const *crt ) if( cache->frame != NULL ) { -#if !defined(MBEDTLS_X509_ALWAYS_FLUSH) +#if !defined(MBEDTLS_X509_ALWAYS_FLUSH) || \ + defined(MBEDTLS_THREADING_C) return( 0 ); #else /* 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 !defined(MBEDTLS_X509_ALWAYS_FLUSH) +#if !defined(MBEDTLS_X509_ALWAYS_FLUSH) || \ + defined(MBEDTLS_THREADING_C) return( 0 ); #else /* If MBEDTLS_X509_ALWAYS_FLUSH is set, we don't