From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8B3E4A0350; Mon, 11 May 2020 12:19:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 341271C21F; Mon, 11 May 2020 12:19:31 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id CB51A1C1A0 for ; Mon, 11 May 2020 12:19:28 +0200 (CEST) IronPort-SDR: 6lQMxZghsXvnREEJbdZHqI1obr/O5UcK+oUvL0WkKhP9Bk8gDFEYrLLxUeTzmVsLDziOLPE1aE +K9pnySFYUiw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2020 03:19:27 -0700 IronPort-SDR: RU6RBGWJz3s77TfMen27r6Bdsw8w9LIOCgcrC29HZN95lkHZECUOLTRO4cQGSoNFs14frf25Ap YzmxhCD3hlnQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,379,1583222400"; d="scan'208";a="279741205" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 11 May 2020 03:19:26 -0700 Received: from sivswdev10.ir.intel.com (sivswdev10.ir.intel.com [10.237.217.4]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 04BAJQf2015029; Mon, 11 May 2020 11:19:26 +0100 Received: by sivswdev10.ir.intel.com (Postfix, from userid 28780) id C234018007E1; Mon, 11 May 2020 11:19:25 +0100 (IST) From: Mairtin o Loingsigh To: fiona.trahe@intel.com, akhil.goyal@nxp.com Cc: dev@dpdk.org, Mairtin o Loingsigh Date: Mon, 11 May 2020 11:19:14 +0100 Message-Id: <20200511101916.22850-1-mairtin.oloingsigh@intel.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: <1582707851-32026-1-git-send-email-mairtin.oloingsigh@intel.com> References: <1582707851-32026-1-git-send-email-mairtin.oloingsigh@intel.com> Subject: [dpdk-dev] [PATCH v3] crypto/qat: support DOCSIS AES-256 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" This patch adds support for DOCSIS AES-256 when using qat Signed-off-by: Mairtin o Loingsigh Acked-by: Fiona Trahe --- drivers/crypto/qat/qat_sym_capabilities.h | 4 ++-- drivers/crypto/qat/qat_sym_session.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/qat/qat_sym_capabilities.h b/drivers/crypto/qat/qat_sym_capabilities.h index 028a56c56..7d216dea4 100644 --- a/drivers/crypto/qat/qat_sym_capabilities.h +++ b/drivers/crypto/qat/qat_sym_capabilities.h @@ -333,8 +333,8 @@ .block_size = 16, \ .key_size = { \ .min = 16, \ - .max = 16, \ - .increment = 0 \ + .max = 32, \ + .increment = 16 \ }, \ .iv_size = { \ .min = 16, \ diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c index 4359f2f0b..d8b21bc2b 100644 --- a/drivers/crypto/qat/qat_sym_session.c +++ b/drivers/crypto/qat/qat_sym_session.c @@ -35,7 +35,7 @@ bpi_cipher_ctx_free(void *bpi_ctx) static int bpi_cipher_ctx_init(enum rte_crypto_cipher_algorithm cryptodev_algo, enum rte_crypto_cipher_operation direction __rte_unused, - const uint8_t *key, void **ctx) + const uint8_t *key, uint16_t key_length, void **ctx) { const EVP_CIPHER *algo = NULL; int ret; @@ -49,7 +49,10 @@ bpi_cipher_ctx_init(enum rte_crypto_cipher_algorithm cryptodev_algo, if (cryptodev_algo == RTE_CRYPTO_CIPHER_DES_DOCSISBPI) algo = EVP_des_ecb(); else - algo = EVP_aes_128_ecb(); + if (key_length == ICP_QAT_HW_AES_128_KEY_SZ) + algo = EVP_aes_128_ecb(); + else + algo = EVP_aes_256_ecb(); /* IV will be ECB encrypted whether direction is encrypt or decrypt*/ if (EVP_EncryptInit_ex(*ctx, algo, NULL, key, 0) != 1) { @@ -286,6 +289,7 @@ qat_sym_session_configure_cipher(struct rte_cryptodev *dev, cipher_xform->algo, cipher_xform->op, cipher_xform->key.data, + cipher_xform->key.length, &session->bpi_ctx); if (ret != 0) { QAT_LOG(ERR, "failed to create DES BPI ctx"); @@ -304,6 +308,7 @@ qat_sym_session_configure_cipher(struct rte_cryptodev *dev, cipher_xform->algo, cipher_xform->op, cipher_xform->key.data, + cipher_xform->key.length, &session->bpi_ctx); if (ret != 0) { QAT_LOG(ERR, "failed to create AES BPI ctx"); @@ -1909,6 +1914,9 @@ int qat_sym_validate_aes_docsisbpi_key(int key_len, case ICP_QAT_HW_AES_128_KEY_SZ: *alg = ICP_QAT_HW_CIPHER_ALGO_AES128; break; + case ICP_QAT_HW_AES_256_KEY_SZ: + *alg = ICP_QAT_HW_CIPHER_ALGO_AES256; + break; default: return -EINVAL; } -- 2.12.3