examples/fips_validation: support plain SHA
[dpdk.git] / examples / fips_validation / fips_validation.c
index 58a3c1b..2f8314f 100644 (file)
@@ -106,6 +106,42 @@ 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;
+               }
 
                tmp = strstr(info.vec[i], "# Config info for ");
                if (tmp != NULL) {
@@ -155,6 +191,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 ",