SSL: return temporary RSA key only when the key length matches.

This change is mostly cosmetic, because in practice this callback
is used only for 512-bit RSA keys.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
This commit is contained in:
Piotr Sikora 2014-07-06 16:41:13 -07:00
parent f0e05f3d89
commit bd058b9d24

View File

@ -652,10 +652,12 @@ ngx_ssl_rsa512_key_callback(ngx_ssl_conn_t *ssl_conn, int is_export,
{ {
static RSA *key; static RSA *key;
if (key_length == 512) { if (key_length != 512) {
if (key == NULL) { return NULL;
key = RSA_generate_key(512, RSA_F4, NULL, NULL); }
}
if (key == NULL) {
key = RSA_generate_key(512, RSA_F4, NULL, NULL);
} }
return key; return key;