DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2 0/3] Fix compability issues between crypto drivers for GCM test cases
@ 2016-09-22 10:45 Arek Kusztal
  2016-09-22 10:45 ` [dpdk-dev] [PATCH v2 1/3] crypto/aesni_gcm: move pre-counter block to GCM driver Arek Kusztal
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Arek Kusztal @ 2016-09-22 10:45 UTC (permalink / raw)
  To: dev
  Cc: fiona.trahe, deepak.k.jain, pablo.de.lara.guarch, john.griffin,
	Arek Kusztal

This patchset fix pre-counter block issues between crypto divers for AES-GCM tests.
Pre-counter block 96b computation from test file is moved into the AES-GCM PMD.
This patch set fixes too problems with verification of digest for AES-GCM.

Changes in v2:
* Added comment to AESNI GCM driver about pre-counter block generation for len(IV)=12B.

Arek Kusztal (3):
  crypto/aesni_gcm: move pre-counter block to GCM driver
  app/test: move pre-counter block computation from test files
  app/test: fix verification of digest in GCM crypto test

 app/test/test_cryptodev.c                | 20 ++++++++------------
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 11 ++++++++++-
 2 files changed, 18 insertions(+), 13 deletions(-)

-- 
2.1.0

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

* [dpdk-dev] [PATCH v2 1/3] crypto/aesni_gcm: move pre-counter block to GCM driver
  2016-09-22 10:45 [dpdk-dev] [PATCH v2 0/3] Fix compability issues between crypto drivers for GCM test cases Arek Kusztal
@ 2016-09-22 10:45 ` Arek Kusztal
  2016-09-22 10:45 ` [dpdk-dev] [PATCH v2 2/3] app/test: move pre-counter block computation from test files Arek Kusztal
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Arek Kusztal @ 2016-09-22 10:45 UTC (permalink / raw)
  To: dev
  Cc: fiona.trahe, deepak.k.jain, pablo.de.lara.guarch, john.griffin,
	Arek Kusztal

This patch moves computing of pre-counter block into the AESNI-GCM
driver so it can be moved from test files.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
---
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index dc0b033..857d74f 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -230,11 +230,20 @@ process_gcm_crypto_op(struct aesni_gcm_qp *qp, struct rte_crypto_sym_op *op,
 					op->cipher.data.offset);
 
 	/* sanity checks */
-	if (op->cipher.iv.length != 16 && op->cipher.iv.length != 0) {
+	if (op->cipher.iv.length != 16 && op->cipher.iv.length != 12 &&
+			op->cipher.iv.length != 0) {
 		GCM_LOG_ERR("iv");
 		return -1;
 	}
 
+	/*
+	 * GCM working in 12B IV mode => 16B pre-counter block we need
+	 * to set BE LSB to 1, driver expects that 16B is allocated
+	 */
+	if (op->cipher.iv.length == 12) {
+		op->cipher.iv.data[15] = 1;
+	}
+
 	if (op->auth.aad.length != 12 && op->auth.aad.length != 8 &&
 			op->auth.aad.length != 0) {
 		GCM_LOG_ERR("iv");
-- 
2.1.0

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

* [dpdk-dev] [PATCH v2 2/3] app/test: move pre-counter block computation from test files
  2016-09-22 10:45 [dpdk-dev] [PATCH v2 0/3] Fix compability issues between crypto drivers for GCM test cases Arek Kusztal
  2016-09-22 10:45 ` [dpdk-dev] [PATCH v2 1/3] crypto/aesni_gcm: move pre-counter block to GCM driver Arek Kusztal
@ 2016-09-22 10:45 ` Arek Kusztal
  2016-09-22 10:45 ` [dpdk-dev] [PATCH v2 3/3] app/test: fix verification of digest in GCM crypto test Arek Kusztal
  2016-09-22 21:09 ` [dpdk-dev] [PATCH v2 0/3] Fix compability issues between crypto drivers for GCM test cases De Lara Guarch, Pablo
  3 siblings, 0 replies; 5+ messages in thread
From: Arek Kusztal @ 2016-09-22 10:45 UTC (permalink / raw)
  To: dev
  Cc: fiona.trahe, deepak.k.jain, pablo.de.lara.guarch, john.griffin,
	Arek Kusztal

This patch removes pre-counter block computation from
test_cryptodev.c file for AES GCM

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
---
 app/test/test_cryptodev.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index ae5fa1d..db5606a 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -3259,14 +3259,10 @@ create_gcm_operation(enum rte_crypto_cipher_operation op,
 
 	memset(sym_op->cipher.iv.data, 0, iv_pad_len);
 	sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
-	sym_op->cipher.iv.length = iv_pad_len;
+	sym_op->cipher.iv.length = iv_len;
 
 	rte_memcpy(sym_op->cipher.iv.data, iv, iv_len);
 
-	/* CalcY0 */
-	if (iv_len != 16)
-		sym_op->cipher.iv.data[15] = 1;
-
 	/*
 	 * Always allocate the aad up to the block size.
 	 * The cryptodev API calls out -
-- 
2.1.0

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

* [dpdk-dev] [PATCH v2 3/3] app/test: fix verification of digest in GCM crypto test
  2016-09-22 10:45 [dpdk-dev] [PATCH v2 0/3] Fix compability issues between crypto drivers for GCM test cases Arek Kusztal
  2016-09-22 10:45 ` [dpdk-dev] [PATCH v2 1/3] crypto/aesni_gcm: move pre-counter block to GCM driver Arek Kusztal
  2016-09-22 10:45 ` [dpdk-dev] [PATCH v2 2/3] app/test: move pre-counter block computation from test files Arek Kusztal
@ 2016-09-22 10:45 ` Arek Kusztal
  2016-09-22 21:09 ` [dpdk-dev] [PATCH v2 0/3] Fix compability issues between crypto drivers for GCM test cases De Lara Guarch, Pablo
  3 siblings, 0 replies; 5+ messages in thread
From: Arek Kusztal @ 2016-09-22 10:45 UTC (permalink / raw)
  To: dev
  Cc: fiona.trahe, deepak.k.jain, pablo.de.lara.guarch, john.griffin,
	Arek Kusztal

This patch fixes verification of digest in test_cryptodev.c file
for AES GCM test cases

Fixes: eec136f3c54f ("aesni_gcm: add driver for AES-GCM crypto operations")

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
---
 app/test/test_cryptodev.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index db5606a..d744b37 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -3164,13 +3164,13 @@ test_kasumi_cipher_auth_test_case_1(void)
 static int
 create_gcm_session(uint8_t dev_id, enum rte_crypto_cipher_operation op,
 		const uint8_t *key, const uint8_t key_len,
-		const uint8_t aad_len, const uint8_t auth_len)
+		const uint8_t aad_len, const uint8_t auth_len,
+		enum rte_crypto_auth_operation auth_op)
 {
 	uint8_t cipher_key[key_len];
 
 	struct crypto_unittest_params *ut_params = &unittest_params;
 
-
 	memcpy(cipher_key, key, key_len);
 
 	/* Setup Cipher Parameters */
@@ -3178,7 +3178,7 @@ create_gcm_session(uint8_t dev_id, enum rte_crypto_cipher_operation op,
 	ut_params->cipher_xform.next = NULL;
 
 	ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_GCM;
-	ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
+	ut_params->auth_xform.auth.op = auth_op;
 	ut_params->cipher_xform.cipher.op = op;
 	ut_params->cipher_xform.cipher.key.data = cipher_key;
 	ut_params->cipher_xform.cipher.key.length = key_len;
@@ -3233,8 +3233,6 @@ create_gcm_operation(enum rte_crypto_cipher_operation op,
 
 	struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
 
-
-
 	sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
 			ut_params->ibuf, auth_tag_len);
 	TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
@@ -3311,7 +3309,8 @@ test_mb_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata)
 	retval = create_gcm_session(ts_params->valid_devs[0],
 			RTE_CRYPTO_CIPHER_OP_ENCRYPT,
 			tdata->key.data, tdata->key.len,
-			tdata->aad.len, tdata->auth_tag.len);
+			tdata->aad.len, tdata->auth_tag.len,
+			RTE_CRYPTO_AUTH_OP_GENERATE);
 	if (retval < 0)
 		return retval;
 
@@ -3441,7 +3440,8 @@ test_mb_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata)
 	retval = create_gcm_session(ts_params->valid_devs[0],
 			RTE_CRYPTO_CIPHER_OP_DECRYPT,
 			tdata->key.data, tdata->key.len,
-			tdata->aad.len, tdata->auth_tag.len);
+			tdata->aad.len, tdata->auth_tag.len,
+			RTE_CRYPTO_AUTH_OP_VERIFY);
 	if (retval < 0)
 		return retval;
 
-- 
2.1.0

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

* Re: [dpdk-dev] [PATCH v2 0/3] Fix compability issues between crypto drivers for GCM test cases
  2016-09-22 10:45 [dpdk-dev] [PATCH v2 0/3] Fix compability issues between crypto drivers for GCM test cases Arek Kusztal
                   ` (2 preceding siblings ...)
  2016-09-22 10:45 ` [dpdk-dev] [PATCH v2 3/3] app/test: fix verification of digest in GCM crypto test Arek Kusztal
@ 2016-09-22 21:09 ` De Lara Guarch, Pablo
  3 siblings, 0 replies; 5+ messages in thread
From: De Lara Guarch, Pablo @ 2016-09-22 21:09 UTC (permalink / raw)
  To: Kusztal, ArkadiuszX, dev; +Cc: Trahe, Fiona, Jain, Deepak K, Griffin, John



> -----Original Message-----
> From: Kusztal, ArkadiuszX
> Sent: Thursday, September 22, 2016 3:46 AM
> To: dev@dpdk.org
> Cc: Trahe, Fiona; Jain, Deepak K; De Lara Guarch, Pablo; Griffin, John; Kusztal,
> ArkadiuszX
> Subject: [PATCH v2 0/3] Fix compability issues between crypto drivers for
> GCM test cases
> 
> This patchset fix pre-counter block issues between crypto divers for AES-GCM
> tests.
> Pre-counter block 96b computation from test file is moved into the AES-GCM
> PMD.
> This patch set fixes too problems with verification of digest for AES-GCM.
> 
> Changes in v2:
> * Added comment to AESNI GCM driver about pre-counter block generation
> for len(IV)=12B.
> 
> Arek Kusztal (3):
>   crypto/aesni_gcm: move pre-counter block to GCM driver
>   app/test: move pre-counter block computation from test files
>   app/test: fix verification of digest in GCM crypto test
> 
>  app/test/test_cryptodev.c                | 20 ++++++++------------
>  drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 11 ++++++++++-
>  2 files changed, 18 insertions(+), 13 deletions(-)
> 
> --
> 2.1.0

Applied to dpdk-next-crypto.
Thanks,

Pablo

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

end of thread, other threads:[~2016-09-22 21:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-22 10:45 [dpdk-dev] [PATCH v2 0/3] Fix compability issues between crypto drivers for GCM test cases Arek Kusztal
2016-09-22 10:45 ` [dpdk-dev] [PATCH v2 1/3] crypto/aesni_gcm: move pre-counter block to GCM driver Arek Kusztal
2016-09-22 10:45 ` [dpdk-dev] [PATCH v2 2/3] app/test: move pre-counter block computation from test files Arek Kusztal
2016-09-22 10:45 ` [dpdk-dev] [PATCH v2 3/3] app/test: fix verification of digest in GCM crypto test Arek Kusztal
2016-09-22 21:09 ` [dpdk-dev] [PATCH v2 0/3] Fix compability issues between crypto drivers for GCM test cases De Lara Guarch, Pablo

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).