From: Tejasree Kondoj <ktejasree@marvell.com>
To: Akhil Goyal <gakhil@marvell.com>
Cc: Vidya Sagar Velumuri <vvelumuri@marvell.com>,
Anoob Joseph <anoobj@marvell.com>, <dev@dpdk.org>
Subject: [PATCH 07/13] crypto/cnxk: add support for DES and MD5
Date: Wed, 19 Oct 2022 19:45:07 +0530 [thread overview]
Message-ID: <20221019141513.1969052-8-ktejasree@marvell.com> (raw)
In-Reply-To: <20221019141513.1969052-1-ktejasree@marvell.com>
From: Vidya Sagar Velumuri <vvelumuri@marvell.com>
Add supoort for cipher DES and auth MD5 for IPsec offload
Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
---
drivers/crypto/cnxk/cnxk_cryptodev.h | 2 +-
.../crypto/cnxk/cnxk_cryptodev_capabilities.c | 42 ++++++++++++++++++-
drivers/crypto/cnxk/cnxk_ipsec.h | 9 ++++
3 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev.h b/drivers/crypto/cnxk/cnxk_cryptodev.h
index 588760cfb0..48bd6e144c 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev.h
+++ b/drivers/crypto/cnxk/cnxk_cryptodev.h
@@ -11,7 +11,7 @@
#include "roc_cpt.h"
#define CNXK_CPT_MAX_CAPS 37
-#define CNXK_SEC_CRYPTO_MAX_CAPS 14
+#define CNXK_SEC_CRYPTO_MAX_CAPS 16
#define CNXK_SEC_MAX_CAPS 9
#define CNXK_AE_EC_ID_MAX 8
/**
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c
index 6a15154607..6c28f8942e 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c
@@ -946,6 +946,26 @@ static const struct rte_cryptodev_capabilities sec_caps_aes[] = {
};
static const struct rte_cryptodev_capabilities sec_caps_des[] = {
+ { /* DES */
+ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+ {.sym = {
+ .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+ {.cipher = {
+ .algo = RTE_CRYPTO_CIPHER_DES_CBC,
+ .block_size = 8,
+ .key_size = {
+ .min = 8,
+ .max = 8,
+ .increment = 0
+ },
+ .iv_size = {
+ .min = 8,
+ .max = 8,
+ .increment = 0
+ }
+ }, },
+ }, }
+ },
{ /* 3DES CBC */
.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
{.sym = {
@@ -965,7 +985,7 @@ static const struct rte_cryptodev_capabilities sec_caps_des[] = {
}
}, }
}, }
- }
+ },
};
static const struct rte_cryptodev_capabilities sec_caps_sha1_sha2[] = {
@@ -1049,6 +1069,26 @@ static const struct rte_cryptodev_capabilities sec_caps_sha1_sha2[] = {
}, }
}, }
},
+ { /* MD5 HMAC */
+ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+ {.sym = {
+ .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+ {.auth = {
+ .algo = RTE_CRYPTO_AUTH_MD5_HMAC,
+ .block_size = 64,
+ .key_size = {
+ .min = 16,
+ .max = 16,
+ .increment = 0
+ },
+ .digest_size = {
+ .min = 12,
+ .max = 12,
+ .increment = 0
+ },
+ }, }
+ }, }
+ },
};
static const struct rte_cryptodev_capabilities sec_caps_null[] = {
diff --git a/drivers/crypto/cnxk/cnxk_ipsec.h b/drivers/crypto/cnxk/cnxk_ipsec.h
index 00873ca6ac..0c471b2cfe 100644
--- a/drivers/crypto/cnxk/cnxk_ipsec.h
+++ b/drivers/crypto/cnxk/cnxk_ipsec.h
@@ -23,6 +23,10 @@ ipsec_xform_cipher_verify(struct rte_crypto_sym_xform *crypto_xform)
if (crypto_xform->cipher.algo == RTE_CRYPTO_CIPHER_NULL)
return 0;
+ if (crypto_xform->cipher.algo == RTE_CRYPTO_CIPHER_DES_CBC &&
+ crypto_xform->cipher.key.length == 8)
+ return 0;
+
if (crypto_xform->cipher.algo == RTE_CRYPTO_CIPHER_AES_CBC ||
crypto_xform->cipher.algo == RTE_CRYPTO_CIPHER_AES_CTR) {
switch (crypto_xform->cipher.key.length) {
@@ -51,6 +55,11 @@ ipsec_xform_auth_verify(struct rte_crypto_sym_xform *crypto_xform)
if (crypto_xform->auth.algo == RTE_CRYPTO_AUTH_NULL)
return 0;
+ if (crypto_xform->auth.algo == RTE_CRYPTO_AUTH_MD5_HMAC) {
+ if (keylen == 16)
+ return 0;
+ }
+
if (crypto_xform->auth.algo == RTE_CRYPTO_AUTH_SHA1_HMAC) {
if (keylen >= 20 && keylen <= 64)
return 0;
--
2.25.1
prev parent reply other threads:[~2022-10-19 14:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20221019141513.1969052-1-ktejasree@marvell.com>
2022-10-19 14:15 ` [PATCH 01/13] crypto/cnxk: fix length of AES-CMAC algo Tejasree Kondoj
2022-10-19 14:15 ` [PATCH 02/13] common/cnxk: set inplace bit of lookaside IPsec Tejasree Kondoj
2022-10-19 14:15 ` [PATCH 03/13] crypto/cnxk: change capabilities as per firmware Tejasree Kondoj
2022-10-19 14:15 ` [PATCH 04/13] common/cnxk: support 103XX CPT Tejasree Kondoj
2022-10-19 14:15 ` [PATCH 05/13] common/cnxk: support custom UDP port values Tejasree Kondoj
2022-10-19 14:15 ` [PATCH 06/13] crypto/cnxk: update rlen calculation for lookaside mode Tejasree Kondoj
2022-10-19 14:15 ` Tejasree Kondoj [this message]
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=20221019141513.1969052-8-ktejasree@marvell.com \
--to=ktejasree@marvell.com \
--cc=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=vvelumuri@marvell.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).