From: slontis Date: Thu, 7 Jul 2022 02:01:09 +0000 (+1000) Subject: Make evp_test skip mac tests if digest or ciphers are disabled. X-Git-Tag: openssl-3.2.0-alpha1~2417 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8a016cac44d5402df3106f46c9725aa1b480e40;p=thirdparty%2Fopenssl.git Make evp_test skip mac tests if digest or ciphers are disabled. Fixes test error in #18714 This only happens currently during minimal builds. Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/18737) --- diff --git a/test/evp_test.c b/test/evp_test.c index c7f76df3598..f0ca8c48ffb 100644 --- a/test/evp_test.c +++ b/test/evp_test.c @@ -1444,6 +1444,8 @@ static int mac_test_run_mac(EVP_TEST *t) expected->mac_name, expected->alg); if (expected->alg != NULL) { + int skip = 0; + /* * The underlying algorithm may be a cipher or a digest. * We don't know which it is, but we can ask the MAC what it @@ -1451,18 +1453,30 @@ static int mac_test_run_mac(EVP_TEST *t) */ if (OSSL_PARAM_locate_const(defined_params, OSSL_MAC_PARAM_CIPHER) != NULL) { - params[params_n++] = - OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_CIPHER, - expected->alg, 0); + if (is_cipher_disabled(expected->alg)) + skip = 1; + else + params[params_n++] = + OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_CIPHER, + expected->alg, 0); } else if (OSSL_PARAM_locate_const(defined_params, OSSL_MAC_PARAM_DIGEST) != NULL) { - params[params_n++] = - OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST, - expected->alg, 0); + if (is_digest_disabled(expected->alg)) + skip = 1; + else + params[params_n++] = + OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST, + expected->alg, 0); } else { t->err = "MAC_BAD_PARAMS"; goto err; } + if (skip) { + TEST_info("skipping, algorithm '%s' is disabled", expected->alg); + t->skip = 1; + t->err = NULL; + goto err; + } } if (expected->custom != NULL) params[params_n++] =