From: Pauli Date: Thu, 21 May 2020 03:40:01 +0000 (+1000) Subject: Coverity 1463574: Null pointer dereferences (REVERSE_INULL) X-Git-Tag: openssl-3.0.0-alpha3~60 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3f17066f5d3bf48d33a8481bd7a7cfdcc00ace97;p=thirdparty%2Fopenssl.git Coverity 1463574: Null pointer dereferences (REVERSE_INULL) Reviewed-by: Kurt Roeckx (Merged from https://github.com/openssl/openssl/pull/11892) --- diff --git a/providers/implementations/keymgmt/rsa_kmgmt.c b/providers/implementations/keymgmt/rsa_kmgmt.c index 295cdf61a4b..b237b2784fa 100644 --- a/providers/implementations/keymgmt/rsa_kmgmt.c +++ b/providers/implementations/keymgmt/rsa_kmgmt.c @@ -496,6 +496,9 @@ static void *rsa_gen(void *genctx, OSSL_CALLBACK *osslcb, void *cbarg) RSA *rsa = NULL, *rsa_tmp = NULL; BN_GENCB *gencb = NULL; + if (gctx == NULL) + return NULL; + switch (gctx->rsa_type) { case RSA_FLAG_TYPE_RSA: /* For plain RSA keys, PSS parameters must not be set */ @@ -513,8 +516,7 @@ static void *rsa_gen(void *genctx, OSSL_CALLBACK *osslcb, void *cbarg) return NULL; } - if (gctx == NULL - || (rsa_tmp = rsa_new_with_ctx(gctx->libctx)) == NULL) + if ((rsa_tmp = rsa_new_with_ctx(gctx->libctx)) == NULL) return NULL; gctx->cb = osslcb;