DPDK patches and discussions
 help / color / mirror / Atom feed
From: Marko Kovacevic <marko.kovacevic@intel.com>
To: dev@dpdk.org
Cc: john.mcnamara@intel.com, xinfengx.zhao@intel.com,
	akhil.goyal@nxp.com, Marko Kovacevic <marko.kovacevic@intel.com>,
	damianx.nowak@intel.com
Subject: [dpdk-dev] [PATCH v1 1/3] examples/fips: fix hmac test failure
Date: Thu, 11 Apr 2019 15:16:54 +0100	[thread overview]
Message-ID: <20190411141656.27720-1-marko.kovacevic@intel.com> (raw)

Application was failing as the HMAC and
Plain SHA fips request files are similar in a
way that they both have SHA- in the top section to
determine the hash algo and hash sizes. And HMAC having the
algo in the second line but the Plain SHA in the third
meant that when the HMAC files was used once it parsed the third
line Plain SHA was set as the algo and not HMAC.

USER1: Failed to get capability for cdev 0
USER1: Error -22: test block
[L=20 SHAAlg=SHA_2]
USER1: Error -22: Failed test /root/FIPS/HMAC/req/HMAC.req

Fixes: f4797bae0050 ("examples/fips_validation: support plain SHA")
Cc: damianx.nowak@intel.com

Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
---
 examples/fips_validation/fips_validation.c | 80 +++++++++++++++++-------------
 1 file changed, 45 insertions(+), 35 deletions(-)

diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c
index 2f8314fcc..a3c921e1d 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,50 @@ 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;
+			}
 		}
 
 		tmp = strstr(info.vec[i], "# Config info for ");
-- 
2.13.6

             reply	other threads:[~2019-04-11 14:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11 14:16 Marko Kovacevic [this message]
2019-04-11 14:16 ` Marko Kovacevic
2019-04-11 14:16 ` [dpdk-dev] [PATCH v1 2/3] examples/fips_validation: fix cmac " Marko Kovacevic
2019-04-11 14:16   ` Marko Kovacevic
2019-04-11 14:16 ` [dpdk-dev] [PATCH v1 3/3] cryptodev: fix uninitialized session clear Marko Kovacevic
2019-04-11 14:16   ` Marko Kovacevic
2019-04-15 15:04 ` [dpdk-dev] [PATCH v2 1/3] examples/fips: fix hmac test failure Marko Kovacevic
2019-04-15 15:04   ` Marko Kovacevic
2019-04-15 15:04   ` [dpdk-dev] [PATCH v2 2/3] examples/fips_validation: fix cmac " Marko Kovacevic
2019-04-15 15:04     ` Marko Kovacevic
2019-04-15 15:04   ` [dpdk-dev] [PATCH v2 3/3] cryptodev: fix uninitialized session clear Marko Kovacevic
2019-04-15 15:04     ` Marko Kovacevic
2019-04-15 18:06     ` Trahe, Fiona
2019-04-15 18:06       ` Trahe, Fiona

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190411141656.27720-1-marko.kovacevic@intel.com \
    --to=marko.kovacevic@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=damianx.nowak@intel.com \
    --cc=dev@dpdk.org \
    --cc=john.mcnamara@intel.com \
    --cc=xinfengx.zhao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).