mirror of
https://github.com/openssl/openssl.git
synced 2024-11-23 01:54:39 +08:00
Fix wrong return value checks for some functions
- in particular in use of X509_LOOKUP_load_file, EVP_PKEY_print_params, EVP_PKEY_keygen, X509_CRL_add1_ext_i2d, EVP_PKEY_keygen_init Reviewed-by: Paul Dale <ppzgs1@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/25811)
This commit is contained in:
parent
b2b995ec2d
commit
8baf61d51b
@ -277,7 +277,7 @@ int ecparam_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (text
|
||||
&& !EVP_PKEY_print_params(out, params_key, 0, NULL)) {
|
||||
&& EVP_PKEY_print_params(out, params_key, 0, NULL) <= 0) {
|
||||
BIO_printf(bio_err, "unable to print params\n");
|
||||
goto end;
|
||||
}
|
||||
|
@ -3232,7 +3232,7 @@ int speed_main(int argc, char **argv)
|
||||
&& EVP_PKEY_CTX_set_rsa_keygen_bits(genctx, rsa_keys[testnum].bits) > 0
|
||||
&& EVP_PKEY_CTX_set1_rsa_keygen_pubexp(genctx, bn) > 0
|
||||
&& EVP_PKEY_CTX_set_rsa_keygen_primes(genctx, primes) > 0
|
||||
&& EVP_PKEY_keygen(genctx, &rsa_key);
|
||||
&& EVP_PKEY_keygen(genctx, &rsa_key) > 0;
|
||||
BN_free(bn);
|
||||
bn = NULL;
|
||||
EVP_PKEY_CTX_free(genctx);
|
||||
|
@ -2198,7 +2198,7 @@ X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer,
|
||||
}
|
||||
|
||||
/* Set base CRL number: must be critical */
|
||||
if (!X509_CRL_add1_ext_i2d(crl, NID_delta_crl, base->crl_number, 1, 0)) {
|
||||
if (X509_CRL_add1_ext_i2d(crl, NID_delta_crl, base->crl_number, 1, 0) <= 0) {
|
||||
ERR_raise(ERR_LIB_X509, ERR_R_X509_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
@ -10044,7 +10044,7 @@ static int create_cert_key(int idx, char *certfilename, char *privkeyfilename)
|
||||
int ret = 1;
|
||||
|
||||
if (!TEST_ptr(evpctx)
|
||||
|| !TEST_true(EVP_PKEY_keygen_init(evpctx))
|
||||
|| !TEST_int_gt(EVP_PKEY_keygen_init(evpctx), 0)
|
||||
|| !TEST_true(EVP_PKEY_generate(evpctx, &pkey))
|
||||
|| !TEST_ptr(pkey)
|
||||
|| !TEST_ptr(x509)
|
||||
|
@ -75,7 +75,7 @@ static int test_alt_chains_cert_forgery(void)
|
||||
lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
|
||||
if (lookup == NULL)
|
||||
goto err;
|
||||
if (!X509_LOOKUP_load_file(lookup, roots_f, X509_FILETYPE_PEM))
|
||||
if (X509_LOOKUP_load_file(lookup, roots_f, X509_FILETYPE_PEM) <= 0)
|
||||
goto err;
|
||||
|
||||
untrusted = load_certs_pem(untrusted_f);
|
||||
|
Loading…
Reference in New Issue
Block a user