DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
To: <dev@dpdk.org>
Cc: Anoob Joseph <anoobj@marvell.com>, <jerinj@marvell.com>,
	Akhil Goyal <gakhil@marvell.com>,
	Brian Dooley <brian.dooley@intel.com>,
	"Gowrishankar Muthukrishnan" <gmuthukrishn@marvell.com>
Subject: [v1, 09/10] examples/fips_validation: fix AES XTS to read seq number
Date: Mon, 6 Feb 2023 20:16:01 +0530	[thread overview]
Message-ID: <9a4bd9e1734efd66bdd4f064288db991e7dfe2e2.1675693844.git.gmuthukrishn@marvell.com> (raw)
In-Reply-To: <cover.1675693844.git.gmuthukrishn@marvell.com>

Fix AES XTS test to read sequence number correctly.

Fixes: f8e431ed8f6 ("examples/fips_validation: add parsing for AES-XTS")

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
 examples/fips_validation/fips_validation_xts.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/examples/fips_validation/fips_validation_xts.c b/examples/fips_validation/fips_validation_xts.c
index 531e3c688e..530df78ab4 100644
--- a/examples/fips_validation/fips_validation_xts.c
+++ b/examples/fips_validation/fips_validation_xts.c
@@ -34,6 +34,7 @@
 #define DATAUNITLEN_JSON_STR	"dataUnitLen"
 #define PAYLOADLEN_JSON_STR	"payloadLen"
 #define TWEAKVALUE_JSON_STR	"tweakValue"
+#define SEQNUMBER_JSON_STR	"sequenceNumber"
 #define PT_JSON_STR	"pt"
 #define CT_JSON_STR	"ct"
 
@@ -95,14 +96,17 @@ parser_xts_read_keylen(const char *key, char *src, struct fips_val *val)
 static int
 parser_xts_read_tweakval(const char *key, char *src, struct fips_val *val)
 {
+	char num_str[4] = {0};
 	int ret;
 
-	if (info.interim_info.xts_data.tweak_mode == XTS_TWEAK_MODE_HEX)
+	if (info.interim_info.xts_data.tweak_mode == XTS_TWEAK_MODE_HEX) {
 		ret = parse_uint8_hex_str(key, src, val);
-	else if (info.interim_info.xts_data.tweak_mode == XTS_TWEAK_MODE_NUMBER)
-		ret = parser_read_uint32_bit_val(key, src, val);
-	else
+	} else if (info.interim_info.xts_data.tweak_mode == XTS_TWEAK_MODE_NUMBER) {
+		snprintf(num_str, RTE_DIM(num_str), "%x", atoi(src));
+		ret = parse_uint8_hex_str(key, num_str, val);
+	} else {
 		ret = -1;
+	}
 
 	return ret;
 }
@@ -122,6 +126,7 @@ struct fips_test_callback xts_interim_json_vectors[] = {
 struct fips_test_callback xts_enc_json_vectors[] = {
 		{KEY_JSON_STR, parse_uint8_known_len_hex_str, &vec.cipher_auth.key},
 		{TWEAKVALUE_JSON_STR, parser_xts_read_tweakval, &vec.iv},
+		{SEQNUMBER_JSON_STR, parser_xts_read_tweakval, &vec.iv},
 		{PT_JSON_STR, parse_uint8_hex_str, &vec.pt},
 		{NULL, NULL, NULL} /**< end pointer */
 };
-- 
2.25.1


  parent reply	other threads:[~2023-02-06 14:47 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-06 14:45 [v1, 00/10] fips_validation application improvements Gowrishankar Muthukrishnan
2023-02-06 14:45 ` [v1, 01/10] examples/fips_validation: fix MCT output for SHA Gowrishankar Muthukrishnan
2023-02-27  9:31   ` Dooley, Brian
2023-02-06 14:45 ` [v1, 02/10] examples/fips_validation: add SHA3 validation Gowrishankar Muthukrishnan
2023-02-27  9:31   ` Dooley, Brian
2023-02-06 14:45 ` [v1, 03/10] examples/fips_validation: fix integer parse in test case Gowrishankar Muthukrishnan
2023-02-27  9:30   ` Dooley, Brian
2023-02-06 14:45 ` [v1, 04/10] examples/fips_validation: add SHAKE validation Gowrishankar Muthukrishnan
2023-02-27  9:30   ` Dooley, Brian
2023-02-06 14:45 ` [v1, 05/10] examples/fips_validation: add CCM JSON validation Gowrishankar Muthukrishnan
2023-02-27  9:29   ` Dooley, Brian
2023-02-06 14:45 ` [v1, 06/10] examples/fips_validation: add ECDSA keygen support Gowrishankar Muthukrishnan
2023-02-27  9:29   ` Dooley, Brian
2023-02-06 14:45 ` [v1, 07/10] examples/fips_validation: add SHA3 algorithms in ECDSA test Gowrishankar Muthukrishnan
2023-02-27  9:29   ` Dooley, Brian
2023-02-06 14:46 ` [v1, 08/10] examples/fips_validation: fix AES GCM validation tests Gowrishankar Muthukrishnan
2023-02-27  9:29   ` Dooley, Brian
2023-02-06 14:46 ` Gowrishankar Muthukrishnan [this message]
2023-02-27  9:28   ` [v1, 09/10] examples/fips_validation: fix AES XTS to read seq number Dooley, Brian
2023-02-06 14:46 ` [v1, 10/10] examples/fips_validation: add extra space in JSON buffer Gowrishankar Muthukrishnan
2023-02-27  9:27   ` Dooley, Brian
2023-02-27  9:32 ` [v1, 00/10] fips_validation application improvements Dooley, Brian
2023-02-27 17:27   ` Akhil Goyal
2023-02-28  7:39     ` Akhil Goyal
2023-02-28 14:42       ` Patrick Robb
2023-02-28 15:02         ` [EXT] " Akhil Goyal
2023-02-28 15:52           ` Patrick Robb
2023-03-01  4:04       ` Gowrishankar Muthukrishnan
2023-02-28 17:28 ` [v2, " Gowrishankar Muthukrishnan
2023-02-28 17:28   ` [v2, 01/10] examples/fips_validation: fix MCT output for SHA Gowrishankar Muthukrishnan
2023-02-28 17:28   ` [v2, 02/10] examples/fips_validation: add SHA3 validation Gowrishankar Muthukrishnan
2023-02-28 17:28   ` [v2, 03/10] examples/fips_validation: fix integer parse in test case Gowrishankar Muthukrishnan
2023-02-28 17:28   ` [v2, 04/10] examples/fips_validation: add SHAKE validation Gowrishankar Muthukrishnan
2023-02-28 17:28   ` [v2, 05/10] examples/fips_validation: add CCM JSON validation Gowrishankar Muthukrishnan
2023-02-28 17:28   ` [v2, 06/10] examples/fips_validation: add ECDSA keygen support Gowrishankar Muthukrishnan
2023-02-28 17:28   ` [v2, 07/10] examples/fips_validation: add SHA3 algorithms in ECDSA test Gowrishankar Muthukrishnan
2023-02-28 17:28   ` [v2, 08/10] examples/fips_validation: fix AES GCM validation tests Gowrishankar Muthukrishnan
2023-02-28 17:28   ` [v2, 09/10] examples/fips_validation: fix AES XTS to read seq number Gowrishankar Muthukrishnan
2023-02-28 17:28   ` [v2, 10/10] examples/fips_validation: add extra space in JSON buffer Gowrishankar Muthukrishnan
2023-03-01 11:11   ` [v2, 00/10] fips_validation application improvements Akhil Goyal

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=9a4bd9e1734efd66bdd4f064288db991e7dfe2e2.1675693844.git.gmuthukrishn@marvell.com \
    --to=gmuthukrishn@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=brian.dooley@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=jerinj@marvell.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).