[GB.OPENSSL] Replace deprecated RAND_pseudo_bytes

[GB.OPENSSL]
* NEW: Replace the deprecated (as of OpenSSL 1.1.0) function RAND_pseudo_bytes with RAND_bytes
This commit is contained in:
bgermann 2018-10-22 22:52:52 +02:00
parent 921067cd34
commit c41ebd5dda

View file

@ -321,7 +321,7 @@ BEGIN_METHOD(CipherMethod_EncryptSalted, GB_STRING plain; GB_STRING passwd;
bzero(salt, sizeof(salt));
if (MISSING(salt)) {
assert(RAND_pseudo_bytes(salt, sizeof(salt)));
assert(RAND_bytes(salt, sizeof(salt)));
} else {
bzero(salt, sizeof(salt));
memcpy(salt, STRING(salt), MIN(sizeof(salt), LENGTH(salt)));
@ -397,7 +397,7 @@ BEGIN_METHOD(CipherMethod_EncryptSalted, GB_STRING plain; GB_STRING passwd)
char key[EVP_CIPHER_key_length(_method)];
bzero(key, sizeof(key));
RAND_pseudo_bytes(salt, sizeof(salt));
RAND_bytes(salt, sizeof(salt));
PKCS5_PBKDF_HMAC_SHA1(STRING(passwd), LENGTH(passwd), salt,
sizeof(salt), ITER, sizeof(key), key);