Wrong preproccessor condition fix
Fix for issue #696
Change #if defined(MBEDTLS_THREADING_PTHREAD)
to #if defined(MBEDTLS_THREADING_C)
diff --git a/ChangeLog b/ChangeLog
index 9034b42..7a72030 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,9 @@
Bugfix
* Add a check if iv_len is zero, and return an error if it is zero. reported
by roberto. #716
+ * Replace preproccessor condition from #if defined(MBEDTLS_THREADING_PTHREAD)
+ to #if defined(MBEDTLS_THREADING_C) as the library cannot assume they will
+ always be implemented by pthread support. Fix for #696
Security
* Fix authentication bypass in SSL/TLS: when auth_mode is set to optional,
diff --git a/library/x509_crt.c b/library/x509_crt.c
index 3b86141..d7b857e 100644
--- a/library/x509_crt.c
+++ b/library/x509_crt.c
@@ -1171,13 +1171,13 @@
if( dir == NULL )
return( MBEDTLS_ERR_X509_FILE_IO_ERROR );
-#if defined(MBEDTLS_THREADING_PTHREAD)
+#if defined(MBEDTLS_THREADING_C)
if( ( ret = mbedtls_mutex_lock( &mbedtls_threading_readdir_mutex ) ) != 0 )
{
closedir( dir );
return( ret );
}
-#endif
+#endif /* MBEDTLS_THREADING_C */
while( ( entry = readdir( dir ) ) != NULL )
{
@@ -1210,10 +1210,10 @@
cleanup:
closedir( dir );
-#if defined(MBEDTLS_THREADING_PTHREAD)
+#if defined(MBEDTLS_THREADING_C)
if( mbedtls_mutex_unlock( &mbedtls_threading_readdir_mutex ) != 0 )
ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR;
-#endif
+#endif /* MBEDTLS_THREADING_C */
#endif /* _WIN32 */