diff options
author | Geoff Thorpe <geoff@openssl.org> | 2004-04-26 15:31:35 +0000 |
---|---|---|
committer | Geoff Thorpe <geoff@openssl.org> | 2004-04-26 15:31:35 +0000 |
commit | bcfea9fb25738b007cfef48d5070376c4398675a (patch) | |
tree | 4c60cc4cb29540bf98072e95c712495a129cc646 /apps/s_server.c | |
parent | f3f52d7f45967af4f70045921dfa12e6faedcc92 (diff) | |
download | openssl-bcfea9fb25738b007cfef48d5070376c4398675a.tar.gz |
Allow RSA key-generation to specify an arbitrary public exponent. Jelte
proposed the change and submitted the patch, I jiggled it slightly and
adjusted the other parts of openssl that were affected.
PR: 867
Submitted by: Jelte Jansen
Reviewed by: Geoff Thorpe
Diffstat (limited to 'apps/s_server.c')
-rw-r--r-- | apps/s_server.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/s_server.c b/apps/s_server.c index c342a2ba66..cc2c10d10c 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -1782,17 +1782,20 @@ err: #ifndef OPENSSL_NO_RSA static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int is_export, int keylength) { + BIGNUM *bn = NULL; static RSA *rsa_tmp=NULL; - if (rsa_tmp == NULL) + if (!rsa_tmp && ((bn = BN_new()) == NULL)) + BIO_printf(bio_err,"Allocation error in generating RSA key\n"); + if (!rsa_tmp && bn) { if (!s_quiet) { BIO_printf(bio_err,"Generating temp (%d bit) RSA key...",keylength); (void)BIO_flush(bio_err); } - if(((rsa_tmp = RSA_new()) == NULL) || !RSA_generate_key_ex( - rsa_tmp, keylength,RSA_F4,NULL)) + if(!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) || + !RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) { if(rsa_tmp) RSA_free(rsa_tmp); rsa_tmp = NULL; @@ -1802,6 +1805,7 @@ static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int is_export, int keylength) BIO_printf(bio_err,"\n"); (void)BIO_flush(bio_err); } + BN_free(bn); } return(rsa_tmp); } |