[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] pki_crypto: Replace deprecated RSA_generate_key() with RSA_generate_key_ex()
[Thread Prev] | [Thread Next]
- Subject: [PATCH] pki_crypto: Replace deprecated RSA_generate_key() with RSA_generate_key_ex()
- From: Petar Koretic <petar.koretic@xxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Sun, 16 Mar 2014 00:04:26 +0000
- To: libssh@xxxxxxxxxx
Hi guys.
This fixes problem on platforms (like Android) where OpenSSL is compiled with
-no-deprecated option so there is no RSA_generate_key function in library.
Regards,
Petar
Signed-off-by: Petar Koretic <petar.koretic@xxxxxxxxxx>
---
src/pki_crypto.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/pki_crypto.c b/src/pki_crypto.c
index 89bb538..9ca7760 100644
--- a/src/pki_crypto.c
+++ b/src/pki_crypto.c
@@ -383,8 +383,16 @@ fail:
}
int pki_key_generate_rsa(ssh_key key, int parameter){
- key->rsa = RSA_generate_key(parameter, 65537, NULL, NULL);
- if(key->rsa == NULL)
+ BIGNUM *e;
+ e = BN_new();
+ BN_set_word(e, 65537);
+
+ RSA_generate_key_ex(key->rsa, parameter, e, NULL);
+
+ BN_free(e);
+ e = NULL;
+
+ if(key->rsa == NULL)
return SSH_ERROR;
return SSH_OK;
}
--
1.9.0
| Re: [PATCH] pki_crypto: Replace deprecated RSA_generate_key() with RSA_generate_key_ex() | Aris Adamantiadis <aris@xxxxxxxxxxxx> |