diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2011-07-20 12:59:24 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2011-07-20 12:59:24 +0000 |
| commit | e61ba26744d404a83eba0bf560b6697c453e6705 (patch) | |
| tree | 37b1666249ee15ed67ad53235db182b3be1602ff /src/event/ngx_event_openssl.c | |
| parent | 2551f4a55ddcb60460fc65fe7a3466647581d277 (diff) | |
| download | nginx-e61ba26744d404a83eba0bf560b6697c453e6705.tar.gz nginx-e61ba26744d404a83eba0bf560b6697c453e6705.tar.bz2 | |
MSIE export versions are rare now, so RSA 512 key is generated on demand
and is shared among all hosts instead of pregenerating for every HTTPS host
on configuraiton phase. This decreases start time for configuration with
large number of HTTPS hosts.
Diffstat (limited to 'src/event/ngx_event_openssl.c')
| -rw-r--r-- | src/event/ngx_event_openssl.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c index 0527c9c30..a12672583 100644 --- a/src/event/ngx_event_openssl.c +++ b/src/event/ngx_event_openssl.c @@ -371,28 +371,18 @@ ngx_ssl_info_callback(const ngx_ssl_conn_t *ssl_conn, int where, int ret) } -ngx_int_t -ngx_ssl_generate_rsa512_key(ngx_ssl_t *ssl) +RSA * +ngx_ssl_rsa512_key_callback(SSL *ssl, int is_export, int key_length) { - RSA *key; - - if (SSL_CTX_need_tmp_RSA(ssl->ctx) == 0) { - return NGX_OK; - } - - key = RSA_generate_key(512, RSA_F4, NULL, NULL); - - if (key) { - SSL_CTX_set_tmp_rsa(ssl->ctx, key); + static RSA *key; - RSA_free(key); - - return NGX_OK; + if (key_length == 512) { + if (key == NULL) { + key = RSA_generate_key(512, RSA_F4, NULL, NULL); + } } - ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0, "RSA_generate_key(512) failed"); - - return NGX_ERROR; + return key; } |
