diff options
author | Pauli <paul.dale@oracle.com> | 2020-05-21 13:40:01 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2020-05-22 17:23:49 +1000 |
commit | 3f17066f5d3bf48d33a8481bd7a7cfdcc00ace97 (patch) | |
tree | d02b94347f0a817ace76a10df4776ef7d8ee97ae | |
parent | e5cb3453fba01c264636d54440ca0eb81d1fcd6e (diff) |
Coverity 1463574: Null pointer dereferences (REVERSE_INULL)
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/11892)
-rw-r--r-- | providers/implementations/keymgmt/rsa_kmgmt.c | 6 |
1 files changed, 4 insertions, 2 deletions
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; |