mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
openssl: fix use of deprecated calls
This commit is contained in:
parent
d6657baf29
commit
4bcf225baf
@ -236,7 +236,7 @@ open_write(ostream *dest, bool owns_dest, const string &password) {
|
||||
// Generate a random IV. It doesn't need to be cryptographically secure,
|
||||
// just unique.
|
||||
unsigned char *iv = (unsigned char *)alloca(iv_length);
|
||||
RAND_pseudo_bytes(iv, iv_length);
|
||||
RAND_bytes(iv, iv_length);
|
||||
|
||||
_write_ctx = EVP_CIPHER_CTX_new();
|
||||
nassertv(_write_ctx != NULL);
|
||||
|
@ -108,16 +108,25 @@ output_c_string(ostream &out, const string &string_name,
|
||||
*/
|
||||
EVP_PKEY *
|
||||
generate_key() {
|
||||
RSA *rsa = RSA_generate_key(1024, 7, NULL, NULL);
|
||||
|
||||
if (rsa == (RSA *)NULL) {
|
||||
RSA *rsa = RSA_new();
|
||||
BIGNUM *e = BN_new();
|
||||
if (rsa == nullptr || e == nullptr) {
|
||||
output_ssl_errors();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
BN_set_word(e, 7);
|
||||
|
||||
if (!RSA_generate_key_ex(rsa, 1024, e, nullptr)) {
|
||||
BN_free(e);
|
||||
RSA_free(rsa);
|
||||
output_ssl_errors();
|
||||
exit(1);
|
||||
}
|
||||
BN_free(e);
|
||||
|
||||
EVP_PKEY *pkey = EVP_PKEY_new();
|
||||
EVP_PKEY_assign_RSA(pkey, rsa);
|
||||
|
||||
return pkey;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user