diff options
author | Dmitry S. Baikov <dsbaikov@gmail.com> | 2015-10-23 15:46:03 -0700 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-10-23 16:05:25 +0200 |
commit | 6288cb930461e3068c623dc8c075ace55474fdab (patch) | |
tree | d920a38eb985e1595f1a68a6bce836808b927b34 | |
parent | eefd5a95afca7371a65bae2ae03dfcd6766cc6ad (diff) |
mbedTLS: THREADING_SUPPORT compilation fix
Closes #505
-rw-r--r-- | lib/vtls/mbedtls.c | 14 | ||||
-rw-r--r-- | lib/vtls/polarssl_threadlock.c | 4 |
2 files changed, 10 insertions, 8 deletions
diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c index fa2add78e..4a4050f54 100644 --- a/lib/vtls/mbedtls.c +++ b/lib/vtls/mbedtls.c @@ -173,15 +173,17 @@ mbedtls_connect_step1(struct connectdata *conn, #ifdef THREADING_SUPPORT entropy_init_mutex(&entropy); + mbedtls_ctr_drbg_init(&connssl->ctr_drbg); - if((ret = mbedtls_ctr_drbg_init(&connssl->ctr_drbg, entropy_func_mutex, - &entropy, connssl->ssn.id, - connssl->ssn.length)) != 0) { + ret = mbedtls_ctr_drbg_seed(&connssl->ctr_drbg, entropy_func_mutex, + &entropy, connssl->ssn.id, + connssl->ssn.id_len); + if(ret) { #ifdef MBEDTLS_ERROR_C - mbedtls_strerror(ret, errorbuf, sizeof(errorbuf)); + mbedtls_strerror(ret, errorbuf, sizeof(errorbuf)); #endif /* MBEDTLS_ERROR_C */ - failf(data, "Failed - mbedTLS: ctr_drbg_init returned (-0x%04X) %s\n", - -ret, errorbuf); + failf(data, "Failed - mbedTLS: ctr_drbg_init returned (-0x%04X) %s\n", + -ret, errorbuf); } #else mbedtls_entropy_init(&connssl->entropy); diff --git a/lib/vtls/polarssl_threadlock.c b/lib/vtls/polarssl_threadlock.c index 62abf43b2..dd672b5cb 100644 --- a/lib/vtls/polarssl_threadlock.c +++ b/lib/vtls/polarssl_threadlock.c @@ -22,7 +22,7 @@ ***************************************************************************/ #include "curl_setup.h" -#if defined(USE_POLARSSL) && \ +#if (defined(USE_POLARSSL) || defined(USE_MBEDTLS)) && \ (defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)) #if defined(USE_THREADS_POSIX) @@ -150,4 +150,4 @@ int polarsslthreadlock_unlock_function(int n) return 1; /* OK */ } -#endif /* USE_POLARSSL */ +#endif /* USE_POLARSSL || USE_MBEDTLS */ |