Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverity fixes #11892

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion crypto/x509/v3_ncons.c
Expand Up @@ -197,7 +197,7 @@ static int print_nc_ipadd(BIO *bp, ASN1_OCTET_STRING *ip)
int len2 = ip->length - len1;
char *ip1 = ipaddr_to_asc(ip->data, len1);
char *ip2 = ipaddr_to_asc(ip->data + len1, len2);
int ret = ret = ip1 != NULL && ip2 != NULL
int ret = ip1 != NULL && ip2 != NULL
&& BIO_printf(bp, "IP:%s/%s", ip1, ip2) > 0;

OPENSSL_free(ip1);
Expand Down
8 changes: 5 additions & 3 deletions providers/implementations/keymgmt/rsa_kmgmt.c
Expand Up @@ -411,8 +411,8 @@ static void *gen_init(void *provctx, int selection, int rsa_type)
} else {
gctx->nbits = 2048;
gctx->primes = RSA_DEFAULT_PRIME_NUM;
gctx->rsa_type = rsa_type;
}
gctx->rsa_type = rsa_type;
}
return gctx;
}
Expand Down 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
4 changes: 2 additions & 2 deletions providers/implementations/serializers/serializer_rsa.c
Expand Up @@ -215,9 +215,9 @@ int ossl_prov_prepare_rsa_params(const void *rsa, int nid,
break;
}
if (!DER_w_RSASSA_PSS_params(&pkt, -1, pss)
|| !WPACKET_finish(&pkt))
|| !WPACKET_finish(&pkt)
|| !WPACKET_get_total_written(&pkt, &str_sz))
goto err;
WPACKET_get_total_written(&pkt, &str_sz);
WPACKET_cleanup(&pkt);

/*
Expand Down