# HG changeset patch # User Piotr Sikora # Date 1404690073 25200 # Node ID c7ecd097b8835c0cddb4433e19fafd083cc137fb # Parent febce92c82f617c2f2b3c5c1a3157eb96e4ab08d 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 --- 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 { 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;