From 7aebd6dc500095c2d1fb83f301e9996a334f30b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Fri, 6 Aug 2021 14:55:12 +0200 Subject: [PATCH] Deprecate PEM_read_bio_RSAPrivateKey Deprecate PEM_read_bio_RSAPrivateKey in favour of PEM_read_bio_PrivateKey. This allows to read keys other than RSA . --- src/main.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 5df0cc98c..ee86b8841 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -432,20 +432,17 @@ void write_rsa_key(const char *filen, RSA *rsa) { EVP_PKEY * rsa_key_read(const char *filen) { EVP_PKEY * pkey = NULL; - RSA * rsa = NULL; BIO * pIn = BIO_new_file(filen,"r"); if (!pIn) { proxy_error("Error on BIO_new_file\n"); exit(EXIT_SUCCESS); // we exit gracefully to avoid being restarted } - rsa= PEM_read_bio_RSAPrivateKey( pIn , NULL, NULL, NULL); - if (rsa==NULL) { - proxy_error("Error on PEM_read_bio_RSAPrivateKey for %s\n", filen); + pkey = PEM_read_bio_PrivateKey( pIn , NULL, NULL, NULL); + if (pkey == NULL) { + proxy_error("Error on PEM_read_bio_PrivateKey for %s\n", filen); exit(EXIT_SUCCESS); // we exit gracefully to avoid being restarted } - pkey = EVP_PKEY_new(); - EVP_PKEY_assign_RSA(pkey, rsa); BIO_free(pIn); return pkey; }