From: Piotr Sikora Date: Sun, 6 Jul 2014 23:41:13 +0000 (-0700) Subject: SSL: return temporary RSA key only when the key length matches. X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=bd058b9d2400fec147ed9717101af114eaf364ec;p=nginx.git 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 --- diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c index 50691ade7..46934b2f6 100644 --- a/src/event/ngx_event_openssl.c +++ b/src/event/ngx_event_openssl.c @@ -652,10 +652,12 @@ ngx_ssl_rsa512_key_callback(ngx_ssl_conn_t *ssl_conn, int is_export, { static RSA *key; - if (key_length == 512) { - if (key == NULL) { - key = RSA_generate_key(512, RSA_F4, NULL, NULL); - } + if (key_length != 512) { + return NULL; + } + + if (key == NULL) { + key = RSA_generate_key(512, RSA_F4, NULL, NULL); } return key;