Skip to content

Commit

Permalink
Coverity 1463574: Null pointer dereferences (REVERSE_INULL)
Browse files Browse the repository at this point in the history
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from #11892)
  • Loading branch information
paulidale committed May 22, 2020
1 parent e5cb345 commit 3f17066
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions providers/implementations/keymgmt/rsa_kmgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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;
Expand Down

0 comments on commit 3f17066

Please sign in to comment.