aboutsummaryrefslogtreecommitdiff
path: root/openssl/demos/tunala/cb.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-03-30 12:36:28 +0000
committermarha <marha@users.sourceforge.net>2010-03-30 12:36:28 +0000
commitff48c0d9098080b51ea12710029135916d117806 (patch)
tree96e6af9caf170ba21a1027b24e306a07e27d7b75 /openssl/demos/tunala/cb.c
parentbb731f5ac92655c4860a41fa818a7a63005f8369 (diff)
downloadvcxsrv-ff48c0d9098080b51ea12710029135916d117806.tar.gz
vcxsrv-ff48c0d9098080b51ea12710029135916d117806.tar.bz2
vcxsrv-ff48c0d9098080b51ea12710029135916d117806.zip
svn merge -r514:HEAD ^/branches/released .
Diffstat (limited to 'openssl/demos/tunala/cb.c')
-rw-r--r--openssl/demos/tunala/cb.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/openssl/demos/tunala/cb.c b/openssl/demos/tunala/cb.c
index e64983896..f6e452ae9 100644
--- a/openssl/demos/tunala/cb.c
+++ b/openssl/demos/tunala/cb.c
@@ -134,8 +134,27 @@ RSA *cb_generate_tmp_rsa(SSL *s, int is_export, int keylength)
/* TODO: Perhaps make it so our global key can be generated on-the-fly
* after certain intervals? */
static RSA *rsa_tmp = NULL;
- if(!rsa_tmp)
- rsa_tmp = RSA_generate_key(keylength, RSA_F4, NULL, NULL);
+ BIGNUM *bn = NULL;
+ int ok = 1;
+ if(!rsa_tmp) {
+ ok = 0;
+ if(!(bn = BN_new()))
+ goto end;
+ if(!BN_set_word(bn, RSA_F4))
+ goto end;
+ if(!(rsa_tmp = RSA_new()))
+ goto end;
+ if(!RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL))
+ goto end;
+ ok = 1;
+ }
+end:
+ if(bn)
+ BN_free(bn);
+ if(!ok) {
+ RSA_free(rsa_tmp);
+ rsa_tmp = NULL;
+ }
return rsa_tmp;
}