All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] app/test: fix hexdump length of cipher/plaintexts
@ 2016-07-09 15:05 Pablo de Lara
  2016-07-10 12:55 ` Thomas Monjalon
  2016-07-10 16:16 ` [PATCH v2] " Deepak Kumar Jain
  0 siblings, 2 replies; 4+ messages in thread
From: Pablo de Lara @ 2016-07-09 15:05 UTC (permalink / raw)
  To: dev; +Cc: Pablo de Lara

Plaintexts and ciphertexts are dumped when debugging is enabled,
using TEST_HEXDUMP. For Snow3G and KASUMI, their lengths are in bits,
but TEST_HEXDUMP uses bytes, so lenghts are passed in bytes now.

Fixes: 47df73a1a62f ("app/test: use hexdump if debug log is enabled")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 app/test/test_cryptodev.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 1e1f887..db43eb1 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -2295,7 +2295,7 @@ test_snow3g_encryption(const struct snow3g_test_data *tdata)
 				plaintext_pad_len);
 	memcpy(plaintext, tdata->plaintext.data, plaintext_len);
 
-	TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len);
+	TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
 
 	/* Create SNOW3G operation */
 	retval = create_snow3g_kasumi_cipher_operation(tdata->iv.data, tdata->iv.len,
@@ -2316,7 +2316,7 @@ test_snow3g_encryption(const struct snow3g_test_data *tdata)
 	else
 		ciphertext = plaintext;
 
-	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
+	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
 
 	/* Validate obuf */
 	TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
@@ -2368,7 +2368,7 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata)
 	rte_pktmbuf_append(ut_params->obuf, plaintext_pad_len);
 	memcpy(plaintext, tdata->plaintext.data, plaintext_len);
 
-	TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len);
+	TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
 
 	/* Create SNOW3G operation */
 	retval = create_snow3g_kasumi_cipher_operation_oop(tdata->iv.data,
@@ -2390,7 +2390,7 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata)
 	else
 		ciphertext = plaintext;
 
-	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
+	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
 
 	/* Validate obuf */
 	TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
@@ -2549,7 +2549,7 @@ static int test_snow3g_decryption(const struct snow3g_test_data *tdata)
 				ciphertext_pad_len);
 	memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len);
 
-	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
+	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
 
 	/* Create SNOW3G operation */
 	retval = create_snow3g_kasumi_cipher_operation(tdata->iv.data, tdata->iv.len,
@@ -2569,7 +2569,7 @@ static int test_snow3g_decryption(const struct snow3g_test_data *tdata)
 	else
 		plaintext = ciphertext;
 
-	TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len);
+	TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
 
 	/* Validate obuf */
 	TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(plaintext,
@@ -2622,7 +2622,7 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata)
 	rte_pktmbuf_append(ut_params->obuf, ciphertext_pad_len);
 	memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len);
 
-	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
+	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
 
 	/* Create SNOW3G operation */
 	retval = create_snow3g_kasumi_cipher_operation_oop(tdata->iv.data,
@@ -2643,7 +2643,7 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata)
 	else
 		plaintext = ciphertext;
 
-	TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len);
+	TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
 
 	/* Validate obuf */
 	TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(plaintext,
@@ -2689,7 +2689,7 @@ test_snow3g_authenticated_encryption(const struct snow3g_test_data *tdata)
 				plaintext_pad_len);
 	memcpy(plaintext, tdata->plaintext.data, plaintext_len);
 
-	TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len);
+	TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
 
 	/* Create SNOW3G operation */
 	retval = create_snow3g_kasumi_cipher_hash_operation(tdata->digest.data,
@@ -2717,7 +2717,7 @@ test_snow3g_authenticated_encryption(const struct snow3g_test_data *tdata)
 	else
 		ciphertext = plaintext;
 
-	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
+	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
 
 	/* Validate obuf */
 	TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
@@ -2774,7 +2774,7 @@ test_snow3g_encrypted_authentication(const struct snow3g_test_data *tdata)
 				plaintext_pad_len);
 	memcpy(plaintext, tdata->plaintext.data, plaintext_len);
 
-	TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len);
+	TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
 
 	/* Create SNOW3G operation */
 	retval = create_snow3g_kasumi_auth_cipher_operation(
@@ -2805,7 +2805,7 @@ test_snow3g_encrypted_authentication(const struct snow3g_test_data *tdata)
 
 	ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
 			+ plaintext_pad_len + tdata->aad.len + tdata->iv.len;
-	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
+	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
 
 	/* Validate obuf */
 	TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] app/test: fix hexdump length of cipher/plaintexts
  2016-07-09 15:05 [PATCH] app/test: fix hexdump length of cipher/plaintexts Pablo de Lara
@ 2016-07-10 12:55 ` Thomas Monjalon
  2016-07-10 16:16 ` [PATCH v2] " Deepak Kumar Jain
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2016-07-10 12:55 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: dev

2016-07-09 16:05, Pablo de Lara:
> Plaintexts and ciphertexts are dumped when debugging is enabled,
> using TEST_HEXDUMP. For Snow3G and KASUMI, their lengths are in bits,
> but TEST_HEXDUMP uses bytes, so lenghts are passed in bytes now.

There is an error:
	app/test/test_cryptodev.c:2552:50: error: ‘plaintext_len’ undeclared

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] app/test: fix hexdump length of cipher/plaintexts
  2016-07-09 15:05 [PATCH] app/test: fix hexdump length of cipher/plaintexts Pablo de Lara
  2016-07-10 12:55 ` Thomas Monjalon
@ 2016-07-10 16:16 ` Deepak Kumar Jain
  2016-07-11 14:09   ` Thomas Monjalon
  1 sibling, 1 reply; 4+ messages in thread
From: Deepak Kumar Jain @ 2016-07-10 16:16 UTC (permalink / raw)
  To: dev; +Cc: pablo.de.lara.guarch, Deepak Kumar Jain

From: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Plaintexts and ciphertexts are dumped when debugging is enabled,
using TEST_HEXDUMP. For Snow3G and KASUMI, their lengths are in bits,
but TEST_HEXDUMP uses bytes, so lenghts are passed in bytes now.

Fixes: 47df73a1a62f ("app/test: use hexdump if debug log is enabled")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
---
 app/test/test_cryptodev.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index dac3b93..33325a8 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -2295,7 +2295,7 @@ test_snow3g_encryption(const struct snow3g_test_data *tdata)
 				plaintext_pad_len);
 	memcpy(plaintext, tdata->plaintext.data, plaintext_len);
 
-	TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len);
+	TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
 
 	/* Create SNOW3G operation */
 	retval = create_snow3g_kasumi_cipher_operation(tdata->iv.data, tdata->iv.len,
@@ -2316,7 +2316,7 @@ test_snow3g_encryption(const struct snow3g_test_data *tdata)
 	else
 		ciphertext = plaintext;
 
-	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
+	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
 
 	/* Validate obuf */
 	TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
@@ -2368,7 +2368,7 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata)
 	rte_pktmbuf_append(ut_params->obuf, plaintext_pad_len);
 	memcpy(plaintext, tdata->plaintext.data, plaintext_len);
 
-	TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len);
+	TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
 
 	/* Create SNOW3G operation */
 	retval = create_snow3g_kasumi_cipher_operation_oop(tdata->iv.data,
@@ -2390,7 +2390,7 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata)
 	else
 		ciphertext = plaintext;
 
-	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
+	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
 
 	/* Validate obuf */
 	TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
@@ -2549,7 +2549,7 @@ static int test_snow3g_decryption(const struct snow3g_test_data *tdata)
 				ciphertext_pad_len);
 	memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len);
 
-	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
+	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len);
 
 	/* Create SNOW3G operation */
 	retval = create_snow3g_kasumi_cipher_operation(tdata->iv.data, tdata->iv.len,
@@ -2569,7 +2569,7 @@ static int test_snow3g_decryption(const struct snow3g_test_data *tdata)
 	else
 		plaintext = ciphertext;
 
-	TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len);
+	TEST_HEXDUMP(stdout, "plaintext:", plaintext, ciphertext_len);
 
 	/* Validate obuf */
 	TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(plaintext,
@@ -2622,7 +2622,7 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata)
 	rte_pktmbuf_append(ut_params->obuf, ciphertext_pad_len);
 	memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len);
 
-	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
+	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, ciphertext_len);
 
 	/* Create SNOW3G operation */
 	retval = create_snow3g_kasumi_cipher_operation_oop(tdata->iv.data,
@@ -2643,7 +2643,7 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata)
 	else
 		plaintext = ciphertext;
 
-	TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len);
+	TEST_HEXDUMP(stdout, "plaintext:", plaintext, ciphertext_len);
 
 	/* Validate obuf */
 	TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(plaintext,
@@ -2689,7 +2689,7 @@ test_snow3g_authenticated_encryption(const struct snow3g_test_data *tdata)
 				plaintext_pad_len);
 	memcpy(plaintext, tdata->plaintext.data, plaintext_len);
 
-	TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len);
+	TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
 
 	/* Create SNOW3G operation */
 	retval = create_snow3g_kasumi_cipher_hash_operation(tdata->digest.data,
@@ -2717,7 +2717,7 @@ test_snow3g_authenticated_encryption(const struct snow3g_test_data *tdata)
 	else
 		ciphertext = plaintext;
 
-	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
+	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
 
 	/* Validate obuf */
 	TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
@@ -2774,7 +2774,7 @@ test_snow3g_encrypted_authentication(const struct snow3g_test_data *tdata)
 				plaintext_pad_len);
 	memcpy(plaintext, tdata->plaintext.data, plaintext_len);
 
-	TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len);
+	TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
 
 	/* Create SNOW3G operation */
 	retval = create_snow3g_kasumi_auth_cipher_operation(
@@ -2805,7 +2805,7 @@ test_snow3g_encrypted_authentication(const struct snow3g_test_data *tdata)
 
 	ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
 			+ plaintext_pad_len + tdata->aad.len + tdata->iv.len;
-	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
+	TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
 
 	/* Validate obuf */
 	TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] app/test: fix hexdump length of cipher/plaintexts
  2016-07-10 16:16 ` [PATCH v2] " Deepak Kumar Jain
@ 2016-07-11 14:09   ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2016-07-11 14:09 UTC (permalink / raw)
  To: Deepak Kumar Jain, pablo.de.lara.guarch; +Cc: dev

2016-07-10 17:16, Deepak Kumar Jain:
> From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> 
> Plaintexts and ciphertexts are dumped when debugging is enabled,
> using TEST_HEXDUMP. For Snow3G and KASUMI, their lengths are in bits,
> but TEST_HEXDUMP uses bytes, so lenghts are passed in bytes now.
> 
> Fixes: 47df73a1a62f ("app/test: use hexdump if debug log is enabled")
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> Signed-off-by: Deepak Kumar Jain <deepak.k.jain@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-11 14:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-09 15:05 [PATCH] app/test: fix hexdump length of cipher/plaintexts Pablo de Lara
2016-07-10 12:55 ` Thomas Monjalon
2016-07-10 16:16 ` [PATCH v2] " Deepak Kumar Jain
2016-07-11 14:09   ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.