aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2010-03-08 13:59:26 +0100
committerTobias Brunner <tobias@strongswan.org>2010-03-08 15:34:38 +0100
commitd14203b00954e828883fed0ddcc890d1ff1e02fd (patch)
treed5d733024574998ae82780eaa9e9898d8ef7d6b6 /src/libstrongswan/plugins
parent40f130dab3c42c3d2b0ab6221a91f2effa1123ed (diff)
downloadstrongswan-d14203b00954e828883fed0ddcc890d1ff1e02fd.tar.bz2
strongswan-d14203b00954e828883fed0ddcc890d1ff1e02fd.tar.xz
Replaced the deprecated RSA_generate_key with RSA_generate_key_ex.
Diffstat (limited to 'src/libstrongswan/plugins')
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c b/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c
index 078f889a6..0568b6e17 100644
--- a/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c
+++ b/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c
@@ -296,6 +296,8 @@ openssl_rsa_private_key_t *openssl_rsa_private_key_gen(key_type_t type,
{
private_openssl_rsa_private_key_t *this;
u_int key_size = 0;
+ RSA *rsa = NULL;
+ BIGNUM *e = NULL;
while (TRUE)
{
@@ -315,10 +317,31 @@ openssl_rsa_private_key_t *openssl_rsa_private_key_gen(key_type_t type,
{
return NULL;
}
+ e = BN_new();
+ if (!e || !BN_set_word(e, PUBLIC_EXPONENT))
+ {
+ goto error;
+ }
+ rsa = RSA_new();
+ if (!rsa || !RSA_generate_key_ex(rsa, key_size, e, NULL))
+ {
+ goto error;
+ }
this = create_empty();
- this->rsa = RSA_generate_key(key_size, PUBLIC_EXPONENT, NULL, NULL);
-
+ this->rsa = rsa;
+ BN_free(e);
return &this->public;
+
+error:
+ if (e)
+ {
+ BN_free(e);
+ }
+ if (rsa)
+ {
+ RSA_free(rsa);
+ }
+ return NULL;
}
/**