OpenSSL generate_key(): Check EVP_RSA_gen()'s return value master
authorFabian Keil <fk@fabiankeil.de>
Thu, 11 Jul 2024 08:21:03 +0000 (10:21 +0200)
committerFabian Keil <fk@fabiankeil.de>
Thu, 11 Jul 2024 08:21:03 +0000 (10:21 +0200)
openssl.c

index f392037..ba2fc3e 100644 (file)
--- a/openssl.c
+++ b/openssl.c
@@ -1538,6 +1538,12 @@ static int generate_key(struct client_state *csp, char **key_buf)
    }
 #else
    key = EVP_RSA_gen(RSA_KEYSIZE);
+   if (key == NULL)
+   {
+      log_error(LOG_LEVEL_ERROR, "EVP_RSA_gen() failed");
+      ret = -1;
+      goto exit;
+   }
 #endif
 
    /*