From: Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>
To: fiona.trahe@intel.com, akhil.goyal@nxp.com
Cc: dev@dpdk.org, Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>
Subject: [dpdk-dev] [PATCH v2 1/2] crypto/qat: support DOCSIS AES-256
Date: Wed, 26 Feb 2020 09:04:10 +0000 [thread overview]
Message-ID: <1582707851-32026-1-git-send-email-mairtin.oloingsigh@intel.com> (raw)
This patch adds support for DOCSIS AES-256 when using qat
Signed-off-by: Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>
---
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.17.1
next reply other threads:[~2020-02-26 9:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-26 9:04 Mairtin o Loingsigh [this message]
2020-02-26 9:04 ` [dpdk-dev] [PATCH v2 2/2] test/crypto: Add AES-256 DOCSIS test vectors Mairtin o Loingsigh
2020-02-26 10:42 ` Trahe, Fiona
2020-02-26 10:41 ` [dpdk-dev] [PATCH v2 1/2] crypto/qat: support DOCSIS AES-256 Trahe, Fiona
2020-03-25 19:10 ` Akhil Goyal
2020-05-11 10:19 ` [dpdk-dev] [PATCH v3] " Mairtin o Loingsigh
2020-05-11 10:19 ` [dpdk-dev] [PATCH v3] test/crypto: add AES-256 DOCSIS test vectors Mairtin o Loingsigh
2020-05-11 13:10 ` Akhil Goyal
2020-05-11 10:19 ` [dpdk-dev] [PATCH v3] doc: QAT support for AES-256 DOCSIS Mairtin o Loingsigh
2020-05-11 13:12 ` Akhil Goyal
2020-05-11 13:14 ` [dpdk-dev] [PATCH v3] crypto/qat: support DOCSIS AES-256 Akhil Goyal
2020-05-11 14:03 ` O'loingsigh, Mairtin
2020-05-11 16:14 ` Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1582707851-32026-1-git-send-email-mairtin.oloingsigh@intel.com \
--to=mairtin.oloingsigh@intel.com \
--cc=akhil.goyal@nxp.com \
--cc=dev@dpdk.org \
--cc=fiona.trahe@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).