Skip to content

Commit

Permalink
Make evp_test skip mac tests if digest or ciphers are disabled.
Browse files Browse the repository at this point in the history
Fixes test error in openssl#18714
This only happens currently during minimal builds.

Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Paul Dale <[email protected]>
(Merged from openssl#18737)
  • Loading branch information
slontis authored and paulidale committed Jul 10, 2022
1 parent e269d8a commit c8a016c
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions test/evp_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1444,25 +1444,39 @@ 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
* should be and bet on that.
*/
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++] =
Expand Down

0 comments on commit c8a016c

Please sign in to comment.