OpenSSL generate_key(): Use EVP_RSA_gen() when using OpenSSL 3.0 or later
Silences a bunch of deprecation warnings:
openssl.c:1523:10: warning: 'RSA_new' is deprecated [-Wdeprecated-declarations]
1523 | rsa = RSA_new();
| ^
/usr/local/include/openssl/rsa.h:201:1: note: 'RSA_new' has been explicitly marked deprecated here
201 | OSSL_DEPRECATEDIN_3_0 RSA *RSA_new(void);
| ^
/usr/local/include/openssl/macros.h:182:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
182 | # define OSSL_DEPRECATEDIN_3_0 OSSL_DEPRECATED(3.0)
| ^
/usr/local/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
62 | # define OSSL_DEPRECATED(since) __attribute__((deprecated))
| ^
openssl.c:1540:10: warning: 'RSA_generate_key_ex' is deprecated [-Wdeprecated-declarations]
1540 | ret = RSA_generate_key_ex(rsa, RSA_KEYSIZE, exp, NULL);
| ^
/usr/local/include/openssl/rsa.h:260:1: note: 'RSA_generate_key_ex' has been explicitly marked deprecated here
260 | OSSL_DEPRECATEDIN_3_0 int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e,
| ^
/usr/local/include/openssl/macros.h:182:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
182 | # define OSSL_DEPRECATEDIN_3_0 OSSL_DEPRECATED(3.0)
| ^
/usr/local/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
62 | # define OSSL_DEPRECATED(since) __attribute__((deprecated))
| ^
openssl.c:1549:9: warning: 'EVP_PKEY_set1_RSA' is deprecated [-Wdeprecated-declarations]
1549 | if (!EVP_PKEY_set1_RSA(key, rsa))
| ^
/usr/local/include/openssl/evp.h:1345:1: note: 'EVP_PKEY_set1_RSA' has been explicitly marked deprecated here
1345 | OSSL_DEPRECATEDIN_3_0
| ^
/usr/local/include/openssl/macros.h:182:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
182 | # define OSSL_DEPRECATEDIN_3_0 OSSL_DEPRECATED(3.0)
| ^
/usr/local/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
62 | # define OSSL_DEPRECATED(since) __attribute__((deprecated))
| ^
openssl.c:1592:7: warning: 'RSA_free' is deprecated [-Wdeprecated-declarations]
1592 | RSA_free(rsa);
| ^
/usr/local/include/openssl/rsa.h:293:1: note: 'RSA_free' has been explicitly marked deprecated here
293 | OSSL_DEPRECATEDIN_3_0 void RSA_free(RSA *r);
| ^
/usr/local/include/openssl/macros.h:182:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
182 | # define OSSL_DEPRECATEDIN_3_0 OSSL_DEPRECATED(3.0)
| ^
/usr/local/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
62 | # define OSSL_DEPRECATED(since) __attribute__((deprecated))
| ^