11/*
2- * Copyright 2007-2025 The OpenSSL Project Authors. All Rights Reserved.
2+ * Copyright 2007-2026 The OpenSSL Project Authors. All Rights Reserved.
33 * Copyright Nokia 2007-2019
44 * Copyright Siemens AG 2015-2019
55 *
@@ -1421,7 +1421,10 @@ static int setup_verification_ctx(OSSL_CMP_CTX *ctx)
14211421 out_vpm = X509_STORE_get0_param (out_trusted );
14221422 X509_VERIFY_PARAM_clear_flags (out_vpm , X509_V_FLAG_USE_CHECK_TIME );
14231423
1424- (void )OSSL_CMP_CTX_set_certConf_cb_arg (ctx , out_trusted );
1424+ if (!OSSL_CMP_CTX_set_certConf_cb_arg (ctx , out_trusted )) {
1425+ X509_STORE_free (out_trusted );
1426+ return 0 ;
1427+ }
14251428 }
14261429
14271430 if (opt_disable_confirm )
@@ -3390,6 +3393,12 @@ static void print_keyspec(OSSL_CMP_ATAVS *keySpec)
33903393 int paramtype ;
33913394 const void * param ;
33923395
3396+ /* NULL check to prevent dereferencing a NULL pointer when print_keyspec is called */
3397+ if (alg == NULL ) {
3398+ BIO_puts (mem , "Key algorithm: <absent>\n" );
3399+ break ;
3400+ }
3401+
33933402 X509_ALGOR_get0 (& oid , & paramtype , & param , alg );
33943403 BIO_printf (mem , "Key algorithm: " );
33953404 i2a_ASN1_OBJECT (mem , oid );
@@ -3789,8 +3798,7 @@ int cmp_main(int argc, char **argv)
37893798 if (opt_ignore_keyusage )
37903799 (void )OSSL_CMP_CTX_set_option (cmp_ctx , OSSL_CMP_OPT_IGNORE_KEYUSAGE , 1 );
37913800 if (opt_no_cache_extracerts )
3792- (void )OSSL_CMP_CTX_set_option (cmp_ctx , OSSL_CMP_OPT_NO_CACHE_EXTRACERTS ,
3793- 1 );
3801+ (void )OSSL_CMP_CTX_set_option (cmp_ctx , OSSL_CMP_OPT_NO_CACHE_EXTRACERTS , 1 );
37943802
37953803 if (opt_reqout_only == NULL && (opt_use_mock_srv
37963804#if !defined (OPENSSL_NO_SOCK ) && !defined (OPENSSL_NO_HTTP )
@@ -3806,7 +3814,7 @@ int cmp_main(int argc, char **argv)
38063814
38073815 srv_cmp_ctx = OSSL_CMP_SRV_CTX_get0_cmp_ctx (srv_ctx );
38083816 if (!OSSL_CMP_CTX_set_log_cb (srv_cmp_ctx , print_to_bio_err )) {
3809- CMP_err1 ("cannot set up error reporting and logging for %s" , prog );
3817+ CMP_err1 ("cannot set up server-side error reporting and logging for %s" , prog );
38103818 goto err ;
38113819 }
38123820 OSSL_CMP_CTX_set_log_verbosity (srv_cmp_ctx , opt_verbosity );
0 commit comments