From: Michael Shamis <michae...@marvell.com> The fix allows to find algorithm by folder name if the algorithm was not found from the test file header.
In order to find algorithm used the folder name if it is not defined within the file. Signed-off-by: Michael Shamis <michae...@marvell.com> --- examples/fips_validation/fips_validation.c | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index 9aa423b0f..4dde482e5 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -248,6 +248,48 @@ fips_test_parse_header(void) fprintf(info.fp_wr, "%s\n", info.vec[i]); } + /* use folder name if algorithm is not found yet*/ + if (info.algo == FIPS_TEST_ALGO_MAX) { + if (strstr(info.file_name, "AESVS")) { + info.algo = FIPS_TEST_ALGO_AES; + ret = parse_test_aes_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "GCM")) { + info.algo = FIPS_TEST_ALGO_AES_GCM; + ret = parse_test_gcm_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "CMAC")) { + info.algo = FIPS_TEST_ALGO_AES_CMAC; + ret = parse_test_cmac_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "CCM")) { + info.algo = FIPS_TEST_ALGO_AES_CCM; + ret = parse_test_ccm_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "HMAC")) { + info.algo = FIPS_TEST_ALGO_HMAC; + ret = parse_test_hmac_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "TDES")) { + info.algo = FIPS_TEST_ALGO_TDES; + ret = parse_test_tdes_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "SHA-")) { + if (info.algo != FIPS_TEST_ALGO_HMAC) { + info.algo = FIPS_TEST_ALGO_SHA; + ret = parse_test_sha_init(); + if (ret < 0) + return ret; + } + } + } + return 0; } -- 2.23.0