comparison src/event/ngx_event_openssl.c @ 5754:c7ecd097b883

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>
author Piotr Sikora <piotr@cloudflare.com>
date Sun, 06 Jul 2014 16:41:13 -0700
parents 57c05ff57980
children 8df08465fcfd
comparison
equal deleted inserted replaced
5753:febce92c82f6 5754:c7ecd097b883
650 ngx_ssl_rsa512_key_callback(ngx_ssl_conn_t *ssl_conn, int is_export, 650 ngx_ssl_rsa512_key_callback(ngx_ssl_conn_t *ssl_conn, int is_export,
651 int key_length) 651 int key_length)
652 { 652 {
653 static RSA *key; 653 static RSA *key;
654 654
655 if (key_length == 512) { 655 if (key_length != 512) {
656 if (key == NULL) { 656 return NULL;
657 key = RSA_generate_key(512, RSA_F4, NULL, NULL); 657 }
658 } 658
659 if (key == NULL) {
660 key = RSA_generate_key(512, RSA_F4, NULL, NULL);
659 } 661 }
660 662
661 return key; 663 return key;
662 } 664 }
663 665