From 3f17066f5d3bf48d33a8481bd7a7cfdcc00ace97 Mon Sep 17 00:00:00 2001 From: Pauli Date: Thu, 21 May 2020 13:40:01 +1000 Subject: Coverity 1463574: Null pointer dereferences (REVERSE_INULL) Reviewed-by: Kurt Roeckx (Merged from https://github.com/openssl/openssl/pull/11892) --- providers/implementations/keymgmt/rsa_kmgmt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'providers') diff --git a/providers/implementations/keymgmt/rsa_kmgmt.c b/providers/implementations/keymgmt/rsa_kmgmt.c index 295cdf61a4..b237b2784f 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; -- cgit v1.2.3