patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/4] crypto/openssl: fix AEAD parameters
       [not found] <20170818080728.43248-1-pablo.de.lara.guarch@intel.com>
@ 2017-08-18  8:07 ` Pablo de Lara
       [not found] ` <20170921131123.16513-1-pablo.de.lara.guarch@intel.com>
  1 sibling, 0 replies; 2+ messages in thread
From: Pablo de Lara @ 2017-08-18  8:07 UTC (permalink / raw)
  To: declan.doherty; +Cc: dev, Pablo de Lara, stable

When using AES-GCM with OpenSSL, cipher direction
and authentication operation were being set incorrectly,
as the PMD was looking at the cipher and authentication
transform, instead of the new AEAD.

Fixes: b79e4c00af0e ("cryptodev: use AES-GCM/CCM as AEAD algorithms")
Cc: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 drivers/crypto/openssl/rte_openssl_pmd.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 0bd5f98..2bc1570 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -425,8 +425,15 @@ static int
 openssl_set_session_aead_parameters(struct openssl_session *sess,
 		const struct rte_crypto_sym_xform *xform)
 {
-	/* Select cipher direction */
-	sess->cipher.direction = xform->cipher.op;
+	/* Select cipher direction and auth operation */
+	if (xform->aead.op == RTE_CRYPTO_AEAD_OP_ENCRYPT) {
+		sess->cipher.direction = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
+		sess->auth.operation = RTE_CRYPTO_AUTH_OP_GENERATE;
+	} else {
+		sess->cipher.direction = RTE_CRYPTO_CIPHER_OP_DECRYPT;
+		sess->auth.operation = RTE_CRYPTO_AUTH_OP_VERIFY;
+	}
+
 	/* Select cipher key */
 	sess->cipher.key.length = xform->aead.key.length;
 
@@ -434,10 +441,6 @@ openssl_set_session_aead_parameters(struct openssl_session *sess,
 	sess->iv.offset = xform->aead.iv.offset;
 	sess->iv.length = xform->aead.iv.length;
 
-	/* Select auth generate/verify */
-	sess->auth.operation = xform->auth.op;
-	sess->auth.algo = xform->auth.algo;
-
 	/* Select auth algo */
 	switch (xform->aead.algo) {
 	case RTE_CRYPTO_AEAD_AES_GCM:
-- 
2.9.4

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

* [dpdk-stable] [PATCH v2 4/9] crypto/openssl: fix AEAD parameters
       [not found] ` <20170921131123.16513-1-pablo.de.lara.guarch@intel.com>
@ 2017-09-21 13:11   ` Pablo de Lara
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo de Lara @ 2017-09-21 13:11 UTC (permalink / raw)
  To: declan.doherty, fiona.trahe, deepak.k.jain, john.griffin
  Cc: dev, Pablo de Lara, stable

When using AES-GCM with OpenSSL, cipher direction
and authentication operation were being set incorrectly,
as the PMD was looking at the cipher and authentication
transform, instead of the new AEAD.

Fixes: b79e4c00af0e ("cryptodev: use AES-GCM/CCM as AEAD algorithms")
Cc: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 drivers/crypto/openssl/rte_openssl_pmd.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 280148e..f89322d 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -482,8 +482,15 @@ static int
 openssl_set_session_aead_parameters(struct openssl_session *sess,
 		const struct rte_crypto_sym_xform *xform)
 {
-	/* Select cipher direction */
-	sess->cipher.direction = xform->cipher.op;
+	/* Select cipher direction and auth operation */
+	if (xform->aead.op == RTE_CRYPTO_AEAD_OP_ENCRYPT) {
+		sess->cipher.direction = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
+		sess->auth.operation = RTE_CRYPTO_AUTH_OP_GENERATE;
+	} else {
+		sess->cipher.direction = RTE_CRYPTO_CIPHER_OP_DECRYPT;
+		sess->auth.operation = RTE_CRYPTO_AUTH_OP_VERIFY;
+	}
+
 	/* Select cipher key */
 	sess->cipher.key.length = xform->aead.key.length;
 
@@ -491,10 +498,6 @@ openssl_set_session_aead_parameters(struct openssl_session *sess,
 	sess->iv.offset = xform->aead.iv.offset;
 	sess->iv.length = xform->aead.iv.length;
 
-	/* Select auth generate/verify */
-	sess->auth.operation = xform->auth.op;
-	sess->auth.algo = xform->auth.algo;
-
 	/* Select auth algo */
 	switch (xform->aead.algo) {
 	case RTE_CRYPTO_AEAD_AES_GCM:
-- 
2.9.4

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20170818080728.43248-1-pablo.de.lara.guarch@intel.com>
2017-08-18  8:07 ` [dpdk-stable] [PATCH 1/4] crypto/openssl: fix AEAD parameters Pablo de Lara
     [not found] ` <20170921131123.16513-1-pablo.de.lara.guarch@intel.com>
2017-09-21 13:11   ` [dpdk-stable] [PATCH v2 4/9] " Pablo de Lara

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