From 2eaa56006670275faf691ae26679e14dde77e7ed Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Fri, 25 Oct 2013 00:34:07 +0200 Subject: userpref: Use RSA_generate_key_ex() in favor of deprecated RSA_generate_key() The RSA_generate_key function has been deprecated in OpenSSL in favour of the newer function RSA_generate_key_ex. RSA_generate_key_ex with its current interface has been part of OpenSSL starting from version 0.9.8 (July 2005). --- common/userpref.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/userpref.c b/common/userpref.c index e9b47dc..8af4cdf 100644 --- a/common/userpref.c +++ b/common/userpref.c @@ -690,8 +690,16 @@ static userpref_error_t userpref_device_record_gen_keys_and_cert(const char* udi debug_info("generating keys and certificates"); #ifdef HAVE_OPENSSL - RSA* root_keypair = RSA_generate_key(2048, 65537, NULL, NULL); - RSA* host_keypair = RSA_generate_key(2048, 65537, NULL, NULL); + BIGNUM *e = BN_new(); + RSA* root_keypair = RSA_new(); + RSA* host_keypair = RSA_new(); + + BN_set_word(e, 65537); + + RSA_generate_key_ex(root_keypair, 2048, e, NULL); + RSA_generate_key_ex(host_keypair, 2048, e, NULL); + + BN_free(e); EVP_PKEY* root_pkey = EVP_PKEY_new(); EVP_PKEY_assign_RSA(root_pkey, root_keypair); -- cgit v1.1-32-gdbae