mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 03:34:39 +02:00
wolfSSL_RAND_set_rand_method: Code review feedback
This commit is contained in:
11
src/ssl.c
11
src/ssl.c
@@ -13244,6 +13244,11 @@ int wolfSSL_Cleanup(void)
|
||||
|
||||
#ifdef OPENSSL_EXTRA
|
||||
wolfSSL_RAND_Cleanup();
|
||||
|
||||
if (wc_FreeMutex(&gRandMethodMutex) != 0)
|
||||
ret = BAD_MUTEX_E;
|
||||
else
|
||||
gRandMethodsInit = 0;
|
||||
#endif
|
||||
|
||||
if (wolfCrypt_Cleanup() != 0) {
|
||||
@@ -17843,11 +17848,12 @@ size_t wolfSSL_get_client_random(const WOLFSSL* ssl, unsigned char* out,
|
||||
if (wolfSSL_RAND_InitMutex() == 0 && wc_LockMutex(&gRandMethodMutex) == 0) {
|
||||
gRandMethods = methods;
|
||||
wc_UnLockMutex(&gRandMethodMutex);
|
||||
return WOLFSSL_SUCCESS;
|
||||
}
|
||||
#else
|
||||
(void)methods;
|
||||
#endif
|
||||
return WOLFSSL_SUCCESS;
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
|
||||
/* Returns WOLFSSL_SUCCESS if the RNG has been seeded with enough data */
|
||||
@@ -17860,6 +17866,9 @@ size_t wolfSSL_get_client_random(const WOLFSSL* ssl, unsigned char* out,
|
||||
ret = gRandMethods->status();
|
||||
wc_UnLockMutex(&gRandMethodMutex);
|
||||
}
|
||||
else {
|
||||
ret = WOLFSSL_FAILURE;
|
||||
}
|
||||
#else
|
||||
/* wolfCrypt provides enough seed internally, so return success */
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user