From patchwork Thu Sep 21 13:11:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "De Lara Guarch, Pablo" X-Patchwork-Id: 29076 X-Patchwork-Delegate: pablo.de.lara.guarch@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A4CF91B1B6; Thu, 21 Sep 2017 23:11:53 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id DC5091B1A8; Thu, 21 Sep 2017 23:11:50 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Sep 2017 14:11:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,426,1500966000"; d="scan'208";a="902703282" Received: from silpixa00399464.ir.intel.com (HELO silpixa00399464.ger.corp.intel.com) ([10.237.222.157]) by FMSMGA003.fm.intel.com with ESMTP; 21 Sep 2017 14:11:48 -0700 From: Pablo de Lara To: declan.doherty@intel.com, fiona.trahe@intel.com, deepak.k.jain@intel.com, john.griffin@intel.com Cc: dev@dpdk.org, Pablo de Lara , stable@dpdk.org Date: Thu, 21 Sep 2017 14:11:17 +0100 Message-Id: <20170921131123.16513-5-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170921131123.16513-1-pablo.de.lara.guarch@intel.com> References: <20170818080728.43248-1-pablo.de.lara.guarch@intel.com> <20170921131123.16513-1-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v2 4/9] crypto/openssl: fix AEAD parameters X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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: