Skip to content

Commit

Permalink
SSL: speedup loading of configs with many ssl servers.
Browse files Browse the repository at this point in the history
The patch saves one EC_KEY_generate_key() call per server{} block by
informing OpenSSL about SSL_OP_SINGLE_ECDH_USE we are going to use before
the SSL_CTX_set_tmp_ecdh() call.

For a configuration file with 10k simple server{} blocks with SSL enabled
this change reduces startup time from 18s to 5s on a slow test box here.
  • Loading branch information
mdounin committed Jan 9, 2013
1 parent a6ea2f8 commit 041449a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/event/ngx_event_openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,10 +643,10 @@ ngx_ssl_ecdh_curve(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *name)
return NGX_ERROR;
}

SSL_CTX_set_tmp_ecdh(ssl->ctx, ecdh);

SSL_CTX_set_options(ssl->ctx, SSL_OP_SINGLE_ECDH_USE);

SSL_CTX_set_tmp_ecdh(ssl->ctx, ecdh);

EC_KEY_free(ecdh);
#endif
#endif
Expand Down

0 comments on commit 041449a

Please sign in to comment.