X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Ffips_validation%2Ffips_validation.c;h=ef24b72037ad756bb2cc6320918ff7ae918d9697;hb=dc38ae8d08269f1a7023f9f26045408f3d0e0e25;hp=2f8314fcc00cfaa0ae9fde90fdd60fff78aadc18;hpb=f4797bae00502b9fd3db0bae80cd933f69b33060;p=dpdk.git diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index 2f8314fcc0..ef24b72037 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -98,6 +98,7 @@ fips_test_parse_header(void) uint32_t i; char *tmp; int ret; + int algo_parsed = 0; time_t t = time(NULL); struct tm *tm_now = localtime(&t); @@ -106,41 +107,56 @@ fips_test_parse_header(void) return ret; for (i = 0; i < info.nb_vec_lines; i++) { - if (strstr(info.vec[i], "AESVS")) { - info.algo = FIPS_TEST_ALGO_AES; - ret = parse_test_aes_init(); - if (ret < 0) - return ret; - } else if (strstr(info.vec[i], "GCM")) { - info.algo = FIPS_TEST_ALGO_AES_GCM; - ret = parse_test_gcm_init(); - if (ret < 0) - return ret; - } else if (strstr(info.vec[i], "CMAC")) { - info.algo = FIPS_TEST_ALGO_AES_CMAC; - ret = parse_test_cmac_init(); - if (ret < 0) - return 0; - } else if (strstr(info.vec[i], "CCM")) { - info.algo = FIPS_TEST_ALGO_AES_CCM; - ret = parse_test_ccm_init(); - if (ret < 0) - return 0; - } else if (strstr(info.vec[i], "HMAC")) { - info.algo = FIPS_TEST_ALGO_HMAC; - ret = parse_test_hmac_init(); - if (ret < 0) - return ret; - } else if (strstr(info.vec[i], "TDES")) { - info.algo = FIPS_TEST_ALGO_TDES; - ret = parse_test_tdes_init(); - if (ret < 0) - return 0; - } else if (strstr(info.vec[i], "SHA-")) { - info.algo = FIPS_TEST_ALGO_SHA; - ret = parse_test_sha_init(); - if (ret < 0) - return ret; + if (!algo_parsed) { + if (strstr(info.vec[i], "AESVS")) { + algo_parsed = 1; + info.algo = FIPS_TEST_ALGO_AES; + ret = parse_test_aes_init(); + if (ret < 0) + return ret; + } else if (strstr(info.vec[i], "GCM")) { + algo_parsed = 1; + info.algo = FIPS_TEST_ALGO_AES_GCM; + ret = parse_test_gcm_init(); + if (ret < 0) + return ret; + } else if (strstr(info.vec[i], "CMAC")) { + algo_parsed = 1; + info.algo = FIPS_TEST_ALGO_AES_CMAC; + ret = parse_test_cmac_init(); + if (ret < 0) + return 0; + } else if (strstr(info.vec[i], "CCM")) { + algo_parsed = 1; + info.algo = FIPS_TEST_ALGO_AES_CCM; + ret = parse_test_ccm_init(); + if (ret < 0) + return 0; + } else if (strstr(info.vec[i], "HMAC")) { + algo_parsed = 1; + info.algo = FIPS_TEST_ALGO_HMAC; + ret = parse_test_hmac_init(); + if (ret < 0) + return ret; + } else if (strstr(info.vec[i], "TDES")) { + algo_parsed = 1; + info.algo = FIPS_TEST_ALGO_TDES; + ret = parse_test_tdes_init(); + if (ret < 0) + return 0; + } else if (strstr(info.vec[i], "SHA-")) { + algo_parsed = 1; + info.algo = FIPS_TEST_ALGO_SHA; + ret = parse_test_sha_init(); + if (ret < 0) + return ret; + } else if (strstr(info.vec[i], "XTS")) { + algo_parsed = 1; + info.algo = FIPS_TEST_ALGO_AES_XTS; + ret = parse_test_xts_init(); + if (ret < 0) + return ret; + } } tmp = strstr(info.vec[i], "# Config info for "); @@ -247,6 +263,7 @@ fips_test_init(const char *req_file_path, const char *rsp_file_path, fips_test_clear(); + strcpy(info.file_name, req_file_path); info.algo = FIPS_TEST_ALGO_MAX; if (parse_file_type(req_file_path) < 0) { RTE_LOG(ERR, USER1, "File %s type not supported\n",