From: Fan Zhang Date: Mon, 21 Feb 2022 13:39:46 +0000 (+0000) Subject: crypto/ipsec_mb: support null auth/cipher for aesni_mb X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=03944ff5e3df6e46b02e7fd725e604ae57d40984;p=dpdk.git crypto/ipsec_mb: support null auth/cipher for aesni_mb Add NULL cipher and auth support to AESNI-MB PMD type. Signed-off-by: Fan Zhang Signed-off-by: Declan Doherty Signed-off-by: Radu Nicolau --- diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c index a308d42ffa..0111c6f540 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c @@ -88,6 +88,12 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr, sess->auth.operation = xform->auth.op; /* Set Authentication Parameters */ + if (xform->auth.algo == RTE_CRYPTO_AUTH_NULL) { + sess->auth.algo = IMB_AUTH_NULL; + sess->auth.gen_digest_len = 0; + return 0; + } + if (xform->auth.algo == RTE_CRYPTO_AUTH_AES_XCBC_MAC) { sess->auth.algo = IMB_AUTH_AES_XCBC; @@ -434,6 +440,12 @@ aesni_mb_set_session_cipher_parameters(const IMB_MGR *mb_mgr, sess->cipher.mode = IMB_CIPHER_KASUMI_UEA1_BITLEN; is_kasumi = 1; break; + case RTE_CRYPTO_CIPHER_NULL: + sess->cipher.mode = IMB_CIPHER_NULL; + sess->cipher.key_length_in_bytes = 0; + sess->iv.offset = xform->cipher.iv.offset; + sess->iv.length = xform->cipher.iv.length; + return 0; default: IPSEC_MB_LOG(ERR, "Unsupported cipher mode parameter"); return -ENOTSUP; @@ -1324,6 +1336,12 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, session->iv.offset); } + if (job->cipher_mode == IMB_CIPHER_NULL && oop) { + memcpy(job->dst + job->cipher_start_src_offset_in_bytes, + job->src + job->cipher_start_src_offset_in_bytes, + job->msg_len_to_cipher_in_bytes); + } + if (job->cipher_mode == IMB_CIPHER_ZUC_EEA3) job->msg_len_to_cipher_in_bytes >>= 3; else if (job->hash_alg == IMB_AUTH_KASUMI_UIA1) diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h index d177961ea5..6ddfce2285 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h @@ -275,6 +275,43 @@ static const struct rte_cryptodev_capabilities aesni_mb_capabilities[] = { }, } }, } }, + { /* NULL (AUTH) */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_NULL, + .block_size = 1, + .key_size = { + .min = 0, + .max = 0, + .increment = 0 + }, + .digest_size = { + .min = 0, + .max = 0, + .increment = 0 + }, + .iv_size = { 0 } + }, }, + }, }, + }, + { /* NULL (CIPHER) */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER, + {.cipher = { + .algo = RTE_CRYPTO_CIPHER_NULL, + .block_size = 1, + .key_size = { + .min = 0, + .max = 0, + .increment = 0 + }, + .iv_size = { 0 } + }, }, + }, } + }, { /* AES CBC */ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, {.sym = {