X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Ffips_validation%2Ffips_validation.c;h=a34e34d25a68a5758ca85997587a3f15c814c586;hb=8ce17d56a1f148af979c8da3e91b723b6cc19774;hp=58a3c1b60ad4058608f2bdd0e81fbd7997438b15;hpb=3d0fad56b74a02fe6c1bb2b3ee752646c34cfbc5;p=dpdk.git diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index 58a3c1b60a..a34e34d25a 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,6 +107,75 @@ fips_test_parse_header(void) return ret; for (i = 0; i < info.nb_vec_lines; i++) { + 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], "PERMUTATION")) { + 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], "VARIABLE")) { + 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], "SUBSTITUTION")) { + 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 "); if (tmp != NULL) { @@ -155,6 +225,18 @@ fips_test_parse_header(void) continue; } + tmp = strstr(info.vec[i], "\" information for \""); + if (tmp != NULL) { + char tmp_output[128] = {0}; + + strlcpy(tmp_output, info.vec[i], tmp - info.vec[i] + 1); + + fprintf(info.fp_wr, "%s%s%s\n", tmp_output, + "\" information for DPDK Cryptodev ", + info.device_name); + continue; + } + if (i == info.nb_vec_lines - 1) { /** update the time as current time, write to file */ fprintf(info.fp_wr, "%s%s\n", "# Generated on ", @@ -199,6 +281,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",