@@ -32,8 +32,12 @@ struct CRYPTO_dynlock_value
3232 std::recursive_mutex m_Mutex;
3333};
3434
35+ // Custom random number generation. I am not sure why we are doing this.
36+ // Apparently it was important in earlier versions of OpenSSL, but I am
37+ // doubtful we still need it. It's deprecated in 3.0.
38+ #if !IsAndroid() && ( OPENSSL_VERSION_NUMBER < 0x30000000 )
39+ #define OPENSSL_CUSTOM_RAND
3540
36- #ifndef ANDROID
3741static int RAND_CryptoGenRandom_bytes ( unsigned char *buf, int num ) {
3842 CCrypto::GenerateRandomBlock ( buf, num );
3943 return 1 ;
@@ -48,6 +52,7 @@ static const RAND_METHOD RAND_CryptoGenRandom =
4852 RAND_CryptoGenRandom_bytes, // generate pseudo-random
4953 RAND_CryptoGenRandom_status // status
5054};
55+
5156#endif
5257
5358// -----------------------------------------------------------------------------
@@ -69,9 +74,9 @@ void COpenSSLWrapper::Initialize()
6974 CRYPTO_set_dynlock_destroy_callback ( COpenSSLWrapper::OpenSSLDynLockDestroyCallback );
7075 CRYPTO_set_dynlock_lock_callback ( COpenSSLWrapper::OpenSSLDynLockLockCallback );
7176
72- # ifndef ANDROID
73- RAND_set_rand_method ( &RAND_CryptoGenRandom );
74- #endif
77+ # ifdef OPENSSL_CUSTOM_RAND
78+ RAND_set_rand_method ( &RAND_CryptoGenRandom );
79+ #endif
7580
7681 iStatus = RAND_status ();
7782 AssertMsg ( iStatus == 1 , " OpenSSL random number system reports not enough entropy" );
0 commit comments