[dpdk-stable] patch 'crypto/openssl: fix out-of-place encryption' has been queued to LTS release 18.11.9

Kevin Traynor ktraynor at redhat.com
Thu May 28 18:22:26 CEST 2020


Hi,

FYI, your patch has been queued to LTS release 18.11.9

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/03/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/f9127b70ba81b91bcb20aae28cef6b82a8597735

Thanks.

Kevin.

---
>From f9127b70ba81b91bcb20aae28cef6b82a8597735 Mon Sep 17 00:00:00 2001
From: Pablo de Lara <pablo.de.lara.guarch at intel.com>
Date: Tue, 14 Apr 2020 18:25:55 +0100
Subject: [PATCH] crypto/openssl: fix out-of-place encryption

[ upstream commit 1fa538faeb962ec7f54a1cdf8cba5271de15e17d ]

When authenticating after encrypting, if the operation
is out-of-place, the destination buffer is the one
that will get authenticated.
If the cipher offset is higher than the authentication
offset, it means that part of the text to authenticate
will be plaintext, so this needs to get copied to the
destination buffer, or the result will be incorrect.

Fixes: d61f70b4c918 ("crypto/libcrypto: add driver for OpenSSL library")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
Acked-by: Akhil Goyal <akhil.goyal at nxp.com>
---
 drivers/crypto/openssl/rte_openssl_pmd.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index 7a922f5d2a..a73c92ffd3 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -1999,4 +1999,24 @@ process_asym_op(struct openssl_qp *qp, struct rte_crypto_op *op,
 }
 
+static void
+copy_plaintext(struct rte_mbuf *m_src, struct rte_mbuf *m_dst,
+		struct rte_crypto_op *op)
+{
+	uint8_t *p_src, *p_dst;
+
+	p_src = rte_pktmbuf_mtod(m_src, uint8_t *);
+	p_dst = rte_pktmbuf_mtod(m_dst, uint8_t *);
+
+	/**
+	 * Copy the content between cipher offset and auth offset
+	 * for generating correct digest.
+	 */
+	if (op->sym->cipher.data.offset > op->sym->auth.data.offset)
+		memcpy(p_dst + op->sym->auth.data.offset,
+				p_src + op->sym->auth.data.offset,
+				op->sym->cipher.data.offset -
+				op->sym->auth.data.offset);
+}
+
 /** Process crypto operation for mbuf */
 static int
@@ -2021,4 +2041,7 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
 	case OPENSSL_CHAIN_CIPHER_AUTH:
 		process_openssl_cipher_op(op, sess, msrc, mdst);
+		/* OOP */
+		if (msrc != mdst)
+			copy_plaintext(msrc, mdst, op);
 		process_openssl_auth_op(qp, op, sess, mdst, mdst);
 		break;
-- 
2.21.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-05-28 17:13:01.168641197 +0100
+++ 0039-crypto-openssl-fix-out-of-place-encryption.patch	2020-05-28 17:12:59.108556242 +0100
@@ -1 +1 @@
-From 1fa538faeb962ec7f54a1cdf8cba5271de15e17d Mon Sep 17 00:00:00 2001
+From f9127b70ba81b91bcb20aae28cef6b82a8597735 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 1fa538faeb962ec7f54a1cdf8cba5271de15e17d ]
+
@@ -15 +16,0 @@
-Cc: stable at dpdk.org
@@ -24 +25 @@
-index b820f6171d..c294f60b7d 100644
+index 7a922f5d2a..a73c92ffd3 100644
@@ -27 +28 @@
-@@ -2039,4 +2039,24 @@ process_asym_op(struct openssl_qp *qp, struct rte_crypto_op *op,
+@@ -1999,4 +1999,24 @@ process_asym_op(struct openssl_qp *qp, struct rte_crypto_op *op,
@@ -52 +53 @@
-@@ -2061,4 +2081,7 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
+@@ -2021,4 +2041,7 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,



More information about the stable mailing list