[2/6] crypto/cnxk: add null auth
Checks
Commit Message
From: Anoob Joseph <anoobj@marvell.com>
Add null auth support with lookaside IPsec on cn10k crypto PMDs.
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
---
doc/guides/cryptodevs/cnxk.rst | 1 +
doc/guides/rel_notes/release_21_11.rst | 1 +
drivers/crypto/cnxk/cn9k_ipsec.c | 6 +++--
.../crypto/cnxk/cnxk_cryptodev_capabilities.c | 24 +++++++++++++++++++
drivers/crypto/cnxk/cnxk_ipsec.h | 3 +++
5 files changed, 33 insertions(+), 2 deletions(-)
@@ -258,4 +258,5 @@ CN10XX Features supported
* Transport mode
* UDP Encapsulation
* AES-128/192/256-GCM
+* AES-128/192/256-CBC-NULL
* AES-128/192/256-CBC-SHA1-HMAC
@@ -212,6 +212,7 @@ New Features
* Added support for ZUC algorithm with 256-bit key length for CN10K.
* Added support for CN98xx dual block.
* Added inner checksum support in lookaside protocol (IPsec) for CN10K.
+ * Added AES-CBC NULL auth support in lookaside protocol (IPsec) for CN10K.
* **Added support for event crypto adapter on Marvell CN10K and CN9K.**
@@ -316,7 +316,8 @@ cn9k_ipsec_outb_sa_create(struct cnxk_cpt_qp *qp,
if (ret)
return ret;
- if (ctl->enc_type == ROC_IE_ON_SA_ENC_AES_GCM) {
+ if (ctl->enc_type == ROC_IE_ON_SA_ENC_AES_GCM ||
+ ctl->auth_type == ROC_IE_ON_SA_AUTH_NULL) {
template = &out_sa->aes_gcm.template;
ctx_len = offsetof(struct roc_ie_on_outb_sa, aes_gcm.template);
} else if (ctl->auth_type == ROC_IE_ON_SA_AUTH_SHA1) {
@@ -449,7 +450,8 @@ cn9k_ipsec_inb_sa_create(struct cnxk_cpt_qp *qp,
if (ret)
return ret;
- if (crypto_xform->type == RTE_CRYPTO_SYM_XFORM_AEAD) {
+ if (crypto_xform->type == RTE_CRYPTO_SYM_XFORM_AEAD ||
+ auth_xform->auth.algo == RTE_CRYPTO_AUTH_NULL) {
ctx_len = offsetof(struct roc_ie_on_inb_sa,
sha1_or_gcm.hmac_key[0]);
} else {
@@ -930,6 +930,27 @@ sec_caps_add(struct rte_cryptodev_capabilities cnxk_caps[], int *cur_pos,
*cur_pos += nb_caps;
}
+static void
+cn10k_sec_crypto_caps_update(struct rte_cryptodev_capabilities cnxk_caps[],
+ int *cur_pos)
+{
+ const struct rte_cryptodev_capabilities *cap;
+ unsigned int i;
+
+ if ((CNXK_CPT_MAX_CAPS - *cur_pos) < 1)
+ return;
+
+ /* NULL auth */
+ for (i = 0; i < RTE_DIM(caps_null); i++) {
+ cap = &caps_null[i];
+ if (cap->sym.xform_type == RTE_CRYPTO_SYM_XFORM_AUTH &&
+ cap->sym.auth.algo == RTE_CRYPTO_AUTH_NULL) {
+ cnxk_caps[*cur_pos] = caps_null[i];
+ *cur_pos += 1;
+ }
+ }
+}
+
static void
sec_crypto_caps_populate(struct rte_cryptodev_capabilities cnxk_caps[],
union cpt_eng_caps *hw_caps)
@@ -939,6 +960,9 @@ sec_crypto_caps_populate(struct rte_cryptodev_capabilities cnxk_caps[],
SEC_CAPS_ADD(cnxk_caps, &cur_pos, hw_caps, aes);
SEC_CAPS_ADD(cnxk_caps, &cur_pos, hw_caps, sha1_sha2);
+ if (roc_model_is_cn10k())
+ cn10k_sec_crypto_caps_update(cnxk_caps, &cur_pos);
+
sec_caps_add(cnxk_caps, &cur_pos, caps_end, RTE_DIM(caps_end));
}
@@ -40,6 +40,9 @@ ipsec_xform_auth_verify(struct rte_crypto_sym_xform *crypto_xform)
{
uint16_t keylen = crypto_xform->auth.key.length;
+ if (crypto_xform->auth.algo == RTE_CRYPTO_AUTH_NULL)
+ return 0;
+
if (crypto_xform->auth.algo == RTE_CRYPTO_AUTH_SHA1_HMAC) {
if (keylen >= 20 && keylen <= 64)
return 0;