crypto/snow3g: add support for digest appended ops
Subsystems (2)
PATCH 1/1 crypto/snow3g: add support for digest appended ops
This patch enable out-of-place auth-cipher operations where digest should be encrypted among with the rest of raw data. It also adds support for partially encrypted digest when using auth-cipher operations.
--- drivers/crypto/snow3g/rte_snow3g_pmd.c | 131 ++++++++++++++++++++++--- 1 file changed, 118 insertions(+), 13 deletions(-)
drivers/crypto/snow3g/rte_snow3g_pmd.c +118 -13
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright(c) 2016-2018 Intel Corporation +* Copyright(c) 2016-2021 Intel Corporation */ #include <rte_common.h>
@@ -179,6 +179,24 @@ snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op)return sess; } +/** Check if conditions are met for digest-appended operations */ +static uint8_t * +snow3g_digest_appended_in_src (struct rte_crypto_op *op) +{ +unsigned int auth_size, cipher_size; + + auth_size = (op->sym->auth.data.offset >>3 ) + + (op->sym->auth.data.length >>3 ); + cipher_size = (op->sym->cipher.data.offset >>3 ) + + (op->sym->cipher.data.length >>3 ); + +if (auth_size < cipher_size) +return rte_pktmbuf_mtod_offset (op->sym->m_src, + uint8_t *, auth_size); + +return NULL ; +} +/** Encrypt/decrypt mbufs with same cipher key. */ static uint8_t process_snow3g_cipher_op(struct snow3g_qp *qp, struct rte_crypto_op **ops,
@@ -189,20 +207,50 @@ process_snow3g_cipher_op(struct snow3g_qp *qp, struct rte_crypto_op **ops,uint8_t processed_ops =0 ;const void *src[SNOW3G_MAX_BURST ];void *dst[SNOW3G_MAX_BURST ]; +uint8_t *digest_appended[SNOW3G_MAX_BURST ];const void *iv[SNOW3G_MAX_BURST ];uint32_t num_bytes[SNOW3G_MAX_BURST ]; +uint32_t cipher_off, cipher_len; +int unencrypted_bytes =0 ;for (i =0 ; i < num_ops; i++) { - src[i] = rte_pktmbuf_mtod(ops[i]->sym->m_src, uint8_t *) + - (ops[i]->sym->cipher.data.offset >>3 ); - dst[i] = ops[i]->sym->m_dst ? - rte_pktmbuf_mtod(ops[i]->sym->m_dst, uint8_t *) + - (ops[i]->sym->cipher.data.offset >>3 ) : - rte_pktmbuf_mtod(ops[i]->sym->m_src, uint8_t *) + - (ops[i]->sym->cipher.data.offset >>3 ); + cipher_off = ops[i]->sym->cipher.data.offset >>3 ; + cipher_len = ops[i]->sym->cipher.data.length >>3 ; + src[i] =rte_pktmbuf_mtod_offset ( + ops[i]->sym->m_src, uint8_t *, cipher_off); + +/* If out-of-place operation */ +if (ops[i]->sym->m_dst && + ops[i]->sym->m_src != ops[i]->sym->m_dst) { + dst[i] =rte_pktmbuf_mtod_offset ( + ops[i]->sym->m_dst, uint8_t *, cipher_off); + +/* In case of out-of-place, auth-cipher operation +* with partial encryption of the digest, copy +* the remaining, unencrypted part. +*/ +if (session->op ==SNOW3G_OP_AUTH_CIPHER ) + unencrypted_bytes = + (ops[i]->sym->auth.data.offset >>3 ) + + (ops[i]->sym->auth.data.length >>3 ) + + (SNOW3G_DIGEST_LENGTH ) - + cipher_off - cipher_len; +if (unencrypted_bytes >0 ) +rte_memcpy ( +rte_pktmbuf_mtod_offset ( + ops[i]->sym->m_dst, uint8_t *, + cipher_off + cipher_len), +rte_pktmbuf_mtod_offset ( + ops[i]->sym->m_src, uint8_t *, + cipher_off + cipher_len), + unencrypted_bytes); + }else + dst[i] =rte_pktmbuf_mtod_offset (ops[i]->sym->m_src, + uint8_t *, cipher_off); + iv[i] = rte_crypto_op_ctod_offset(ops[i], uint8_t *, session->cipher_iv_offset); - num_bytes[i] = ops[i]->sym->cipher.data.length >>3 ; + num_bytes[i] = cipher_len; processed_ops++; }
@@ -210,6 +258,20 @@ process_snow3g_cipher_op(struct snow3g_qp *qp, struct rte_crypto_op **ops,IMB_SNOW3G_F8_N_BUFFER (qp->mgr, &session->pKeySched_cipher, iv, src, dst, num_bytes, processed_ops); +/* Take care of the raw digest data in src buffer */ +for (i =0 ; i < num_ops; i++) { +if (session->op ==SNOW3G_OP_AUTH_CIPHER && + ops[i]->sym->m_dst !=NULL ) { + digest_appended[i] = +snow3g_digest_appended_in_src (ops[i]); +/* Clear unencrypted digest from +* the src buffer +*/ +if (digest_appended[i] !=NULL ) +memset (digest_appended[i], +0 ,SNOW3G_DIGEST_LENGTH ); + } + }return processed_ops; }
@@ -222,6 +284,7 @@ process_snow3g_cipher_op_bit(struct snow3g_qp *qp,uint8_t *src, *dst;uint8_t *iv;uint32_t length_in_bits, offset_in_bits; +int unencrypted_bytes =0 ; offset_in_bits = op->sym->cipher.data.offset; src = rte_pktmbuf_mtod(op->sym->m_src, uint8_t *);
@@ -230,10 +293,30 @@ process_snow3g_cipher_op_bit(struct snow3g_qp *qp,SNOW3G_LOG (ERR ,"bit-level in-place not supported\n" );return 0 ; } + length_in_bits = op->sym->cipher.data.length; dst = rte_pktmbuf_mtod(op->sym->m_dst, uint8_t *); +/* In case of out-of-place, auth-cipher operation +* with partial encryption of the digest, copy +* the remaining, unencrypted part. +*/ +if (session->op ==SNOW3G_OP_AUTH_CIPHER ) + unencrypted_bytes = + (op->sym->auth.data.offset >>3 ) + + (op->sym->auth.data.length >>3 ) + + (SNOW3G_DIGEST_LENGTH ) - + (offset_in_bits >>3 ) - + (length_in_bits >>3 ); +if (unencrypted_bytes >0 ) +rte_memcpy ( +rte_pktmbuf_mtod_offset ( + op->sym->m_dst, uint8_t *, + (length_in_bits >>3 )), +rte_pktmbuf_mtod_offset ( + op->sym->m_src, uint8_t *, + (length_in_bits >>3 )), + unencrypted_bytes); iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->cipher_iv_offset); - length_in_bits = op->sym->cipher.data.length;IMB_SNOW3G_F8_1_BUFFER_BIT (qp->mgr, &session->pKeySched_cipher, iv, src, dst, length_in_bits, offset_in_bits);
@@ -252,6 +335,7 @@ process_snow3g_hash_op(struct snow3g_qp *qp, struct rte_crypto_op **ops,uint8_t *src, *dst;uint32_t length_in_bits;uint8_t *iv; +uint8_t digest_appended =0 ;for (i =0 ; i < num_ops; i++) {/* Data must be byte aligned */
@@ -261,6 +345,8 @@ process_snow3g_hash_op(struct snow3g_qp *qp, struct rte_crypto_op **ops,break ; } + dst =NULL ; + length_in_bits = ops[i]->sym->auth.data.length; src = rte_pktmbuf_mtod(ops[i]->sym->m_src, uint8_t *) +
@@ -271,6 +357,13 @@ process_snow3g_hash_op(struct snow3g_qp *qp, struct rte_crypto_op **ops,if (session->auth_op ==RTE_CRYPTO_AUTH_OP_VERIFY ) { dst = qp->temp_digest; +/* Handle auth cipher verify oop case*/ +if (session->op ==SNOW3G_OP_CIPHER_AUTH && + ops[i]->sym->m_dst !=NULL ) + src =rte_pktmbuf_mtod_offset ( + ops[i]->sym->m_dst, uint8_t *, + ops[i]->sym->auth.data.offset >>3 ); +IMB_SNOW3G_F9_1_BUFFER (qp->mgr, &session->pKeySched_hash, iv, src, length_in_bits, dst);
@@ -278,12 +371,23 @@ process_snow3g_hash_op(struct snow3g_qp *qp, struct rte_crypto_op **ops,if (memcmp (dst, ops[i]->sym->auth.digest.data,SNOW3G_DIGEST_LENGTH ) !=0 ) ops[i]->status =RTE_CRYPTO_OP_STATUS_AUTH_FAILED ; - }else { - dst = ops[i]->sym->auth.digest.data; + }else { +if (session->op ==SNOW3G_OP_AUTH_CIPHER ) + dst =snow3g_digest_appended_in_src (ops[i]); + +if (dst !=NULL ) + digest_appended =1 ; +else + dst = ops[i]->sym->auth.digest.data;IMB_SNOW3G_F9_1_BUFFER (qp->mgr, &session->pKeySched_hash, iv, src, length_in_bits, dst); + +/* Copy back digest from src to auth.digest.data */ +if (digest_appended) +rte_memcpy (ops[i]->sym->auth.digest.data, + dst,SNOW3G_DIGEST_LENGTH ); } processed_ops++; }
@@ -564,7 +668,8 @@ cryptodev_snow3g_create(const char *name,RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |RTE_CRYPTODEV_FF_NON_BYTE_ALIGNED_DATA |RTE_CRYPTODEV_FF_SYM_SESSIONLESS | -RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT ; +RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT | +RTE_CRYPTODEV_FF_DIGEST_ENCRYPTED ; mgr =alloc_mb_mgr (0 );if (mgr ==NULL )
Signature · 13 lines
2.17.1 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Quoted 8 lines
This patch enable out-of-place auth-cipher operations where digest should be encrypted among with the rest of raw data. It also adds support for partially encrypted digest when using auth-cipher operations.
Fixes 7c87e2d7b359 ("crypto/snow3g: use IPsec library")
I believe it is a new feature to be supported. Hence is not a Fix.
And submitting a new feature after RC2 is a bit late. I recommend to defer to next release.
The documentation update in .ini file is also missing. You may also update the release notes for supporting this feature.
Quoted 5 lines
Signed-off-by Damian Nowak <[email protected]>Signed-off-by Kai Ji <[email protected]>--- drivers/crypto/snow3g/rte_snow3g_pmd.c | 131 ++++++++++++++++++++++---
PATCH v2 1/1 crypto/snow3g: add support for digest appended ops
In reply to Kai JiThis patch enable out-of-place auth-cipher operations where digest should be encrypted among with the rest of raw data. It also adds support for partially encrypted digest when using auth-cipher operations.
---
v2:
- Documentation update
--- doc/guides/cryptodevs/features/snow3g.ini | 1 + doc/guides/cryptodevs/snow3g.rst | 2 +- drivers/crypto/snow3g/rte_snow3g_pmd.c | 131 +++++++++++++++++++--- 3 files changed, 120 insertions(+), 14 deletions(-)
doc/guides/cryptodevs/features/snow3g.ini +1 -0
@@ -8,6 +8,7 @@ Symmetric crypto = Y Sym operation chaining = Y Symmetric sessionless = Y Non-Byte aligned data = Y +Digest encrypted = Y OOP LB In LB Out = Y ;
doc/guides/cryptodevs/snow3g.rst +1 -1
@@ -77,7 +77,7 @@ and the external crypto libraries supported by them: DPDK version Crypto library version ============= ================================ 16.04 - 19.11 LibSSO SNOW3G - 20.02+ Multi-buffer library 0.53 - 0.54 + 20.02+ Multi-buffer library 0.53 - 1.0 ============= ================================
drivers/crypto/snow3g/rte_snow3g_pmd.c +118 -13
208 lines not on this page · raw message
Signature · 13 lines
2.17.1 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Quoted 8 lines
This patch enable out-of-place auth-cipher operations where digest should be encrypted among with the rest of raw data. It also adds support for partially encrypted digest when using auth-cipher operations.
Fixes 7c87e2d7b359 ("crypto/snow3g: use IPsec library")
This patch is a feature addition and not a fix. So no need for this fixes tag.
Quoted 3 lines
Signed-off-by Damian Nowak <[email protected]>Signed-off-by Kai Ji <[email protected]>
Is this patch really required now, as I see that you plan to remove this PMD?
Hi Akhil,
This is a required feature from our customer. So could you help us merging it?
And we do not plan to remove this PMD - just put it to a new folder with common code shared for all SW Intel-ipsec-mb based PMDs. From the user point of view everything will be the same including the EAL commands and the ways of accessing the driver. And sure the changes in this patch will be moved to new place then.
Regards,
Fan
Quoted 24 lines
-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Tuesday, June 29, 2021 9:15 PM
To: Ji, Kai <[email protected]>; [email protected]
Cc: Zhang, Roy Fan <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Damian Nowak <[email protected]>
Subject: RE: [EXT] [dpdk-dev] [dpdk-dev v2]crypto/snow3g: add support for digest appended opsQuoted 8 lines
This patch enable out-of-place auth-cipher operations where digest should be encrypted among with the rest of raw data. It also adds support for partially encrypted digest when using auth-cipher operations.
Fixes 7c87e2d7b359 ("crypto/snow3g: use IPsec library")This patch is a feature addition and not a fix. So no need for this fixes tag.
Quoted 3 lines
Signed-off-by Damian Nowak <[email protected]>Signed-off-by Kai Ji <[email protected]>Is this patch really required now, as I see that you plan to remove this PMD?
Quoted 11 lines
Hi Akhil,
This is a required feature from our customer. So could you help us merging it?
And we do not plan to remove this PMD - just put it to a new folder with common code shared for all SW Intel-ipsec-mb based PMDs.
From the user point of view everything will be the same including the EAL commands and the ways of accessing the driver.
And sure the changes in this patch will be moved to new place then.
This patch has a conflict with Pablo's patch. Can you rebase?
PATCH v3 1/1 crypto/snow3g: add support for digest appended ops
In reply to Kai JiThis patch enable out-of-place auth-cipher operations where digest should be encrypted among with the rest of raw data. It also adds support for partially encrypted digest when using auth-cipher operations.
---
v3:
- Code rebase
- Documentation update
--- doc/guides/cryptodevs/features/snow3g.ini | 1 + drivers/crypto/snow3g/rte_snow3g_pmd.c | 131 +++++++++++++++++++--- 2 files changed, 119 insertions(+), 13 deletions(-)
doc/guides/cryptodevs/features/snow3g.ini +1 -0
@@ -8,6 +8,7 @@ Symmetric crypto = Y Sym operation chaining = Y Symmetric sessionless = Y Non-Byte aligned data = Y +Digest encrypted = Y OOP LB In LB Out = Y ;
drivers/crypto/snow3g/rte_snow3g_pmd.c +118 -13
208 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v4 1/1 crypto/snow3g: add support for digest appended ops
From: Kai Ji <[email protected]>
This patch enable out-of-place auth-cipher operations where digest should be encrypted among with the rest of raw data. It also adds support for partially encrypted digest when using auth-cipher operations.
---
v4:
fixed compile issue.
doc/guides/cryptodevs/features/snow3g.ini | 1 + drivers/crypto/snow3g/rte_snow3g_pmd.c | 139 +++++++++++++++++++--- 2 files changed, 123 insertions(+), 17 deletions(-)
doc/guides/cryptodevs/features/snow3g.ini +1 -0
@@ -8,6 +8,7 @@ Symmetric crypto = Y Sym operation chaining = Y Symmetric sessionless = Y Non-Byte aligned data = Y +Digest encrypted = Y OOP LB In LB Out = Y ;
drivers/crypto/snow3g/rte_snow3g_pmd.c +122 -17
214 lines not on this page · raw message
Signature · 1 line
2.25.1
v3 cover drivers/crypto: introduce ipsec_mb framework
This set of patches introduces a new framework, making all common code of SW crypto PMD implementations built on top of intel-ipsec-mb library sharable. This helps to reduce future effort on the code maintenance and future updates. It also moves all SW PMD implementation specific details into single files located in the crypto/ipsec_mb folder.
A chacha20-poly1305 SW PMD is added based on this framework.
Multi-process support for the PMDs is added for intel-ipsec-mb v1.1. The minimum intel-ipsec-mb version required is bumped to 1.0.
v3:
- Added multiprocess support for v1.1 of intel-ipsec-mb.
- Fixed some formatting and comments.
- Added detail to some commit logs.
- Updated macros to use intel-ipsec-mb v1.0 supported macros.
- Added use of intel-ipsec-mb API to auto initialise IMB_MGR based on CPU vector support.
v2:
- Added qp NULL check in get stats function.
- Updated maintainers file.
- Replaced use of strlcpy with rte_strlcpy.
- Fixed enum for GCM key length.
- Updated release notes.
- Added Chacha20_poly1305 PMD documentation.
Ciara Power (2):
crypto/ipsec_mb: add multiprocess support doc/rel_notes: added note for SW Crypto PMD change
Fan Zhang (1):
drivers/crypto: introduce IPsec-mb framework
Kai Ji (1):
crypto/ipsec_mb: add chacha20-poly1305 PMD to framework
Piotr Bronowski (6):
drivers/crypto: move aesni-mb PMD to IPsec-mb framework drivers/crypto: move aesni-gcm PMD to IPsec-mb framework drivers/crypto: move kasumi PMD to IPsec-mb framework drivers/crypto: move snow3g PMD to IPsec-mb framework crypto/ipsec_mb: add snow3g digest appended ops support drivers/crypto: move zuc PMD to IPsec-mb framework
MAINTAINERS | 39 +-
app/test/test_cryptodev.c | 23 +
app/test/test_cryptodev.h | 1 +
app/test/test_cryptodev_aead_test_vectors.h | 114 +
doc/guides/cryptodevs/aesni_gcm.rst | 4 +-
doc/guides/cryptodevs/aesni_mb.rst | 4 +-
doc/guides/cryptodevs/chacha20_poly1305.rst | 99 +
.../cryptodevs/features/chacha20_poly1305.ini | 35 +
doc/guides/cryptodevs/features/snow3g.ini | 1 +
doc/guides/cryptodevs/index.rst | 1 +
doc/guides/cryptodevs/kasumi.rst | 3 +-
doc/guides/cryptodevs/snow3g.rst | 3 +-
doc/guides/cryptodevs/zuc.rst | 3 +-
doc/guides/rel_notes/release_21_11.rst | 34 +
drivers/crypto/aesni_gcm/aesni_gcm_ops.h | 104 -
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 984 ------
drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c | 333 --
.../crypto/aesni_gcm/aesni_gcm_pmd_private.h | 123 -
drivers/crypto/aesni_gcm/meson.build | 24 -
.../crypto/aesni_mb/aesni_mb_pmd_private.h | 337 --
drivers/crypto/aesni_mb/meson.build | 25 -
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 2232 ------------
.../crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 1126 -------
drivers/crypto/aesni_mb/version.map | 3 -
drivers/crypto/ipsec_mb/meson.build | 33 +
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c | 1003 ++++++
drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 2977 +++++++++++++++++
drivers/crypto/ipsec_mb/pmd_chacha_poly.c | 482 +++
drivers/crypto/ipsec_mb/pmd_kasumi.c | 556 +++
drivers/crypto/ipsec_mb/pmd_snow3g.c | 697 ++++
.../{zuc/rte_zuc_pmd.c => ipsec_mb/pmd_zuc.c} | 459 +--
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c | 172 +
.../crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c | 369 ++
.../ipsec_mb/rte_ipsec_mb_pmd_private.h | 456 +++
.../{aesni_gcm => ipsec_mb}/version.map | 2 +-
drivers/crypto/kasumi/kasumi_pmd_private.h | 81 -
drivers/crypto/kasumi/meson.build | 24 -
drivers/crypto/kasumi/rte_kasumi_pmd.c | 642 ----
drivers/crypto/kasumi/rte_kasumi_pmd_ops.c | 316 --
drivers/crypto/kasumi/version.map | 3 -
drivers/crypto/meson.build | 6 +-
drivers/crypto/snow3g/meson.build | 24 -
drivers/crypto/snow3g/rte_snow3g_pmd.c | 656 ----
drivers/crypto/snow3g/rte_snow3g_pmd_ops.c | 323 --
drivers/crypto/snow3g/snow3g_pmd_private.h | 84 -
drivers/crypto/snow3g/version.map | 3 -
drivers/crypto/zuc/meson.build | 24 -
drivers/crypto/zuc/rte_zuc_pmd_ops.c | 322 --
drivers/crypto/zuc/version.map | 3 -
drivers/crypto/zuc/zuc_pmd_private.h | 83 -
50 files changed, 7264 insertions(+), 8191 deletions(-)
create mode 100644 doc/guides/cryptodevs/chacha20_poly1305.rst
create mode 100644 doc/guides/cryptodevs/features/chacha20_poly1305.ini
delete mode 100644 drivers/crypto/aesni_gcm/aesni_gcm_ops.h
delete mode 100644 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
delete mode 100644 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
delete mode 100644 drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h
delete mode 100644 drivers/crypto/aesni_gcm/meson.build
delete mode 100644 drivers/crypto/aesni_mb/aesni_mb_pmd_private.h
delete mode 100644 drivers/crypto/aesni_mb/meson.build
delete mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
delete mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
delete mode 100644 drivers/crypto/aesni_mb/version.map
create mode 100644 drivers/crypto/ipsec_mb/meson.build
create mode 100644 drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
create mode 100644 drivers/crypto/ipsec_mb/pmd_aesni_mb.c
create mode 100644 drivers/crypto/ipsec_mb/pmd_chacha_poly.c
create mode 100644 drivers/crypto/ipsec_mb/pmd_kasumi.c
create mode 100644 drivers/crypto/ipsec_mb/pmd_snow3g.c
rename drivers/crypto/{zuc/rte_zuc_pmd.c => ipsec_mb/pmd_zuc.c} (50%)
create mode 100644 drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c
create mode 100644 drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c
create mode 100644 drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h
rename drivers/crypto/{aesni_gcm => ipsec_mb}/version.map (58%)
delete mode 100644 drivers/crypto/kasumi/kasumi_pmd_private.h
delete mode 100644 drivers/crypto/kasumi/meson.build
delete mode 100644 drivers/crypto/kasumi/rte_kasumi_pmd.c
delete mode 100644 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
delete mode 100644 drivers/crypto/kasumi/version.map
delete mode 100644 drivers/crypto/snow3g/meson.build
delete mode 100644 drivers/crypto/snow3g/rte_snow3g_pmd.c
delete mode 100644 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
delete mode 100644 drivers/crypto/snow3g/snow3g_pmd_private.h
delete mode 100644 drivers/crypto/snow3g/version.map
delete mode 100644 drivers/crypto/zuc/meson.build
delete mode 100644 drivers/crypto/zuc/rte_zuc_pmd_ops.c
delete mode 100644 drivers/crypto/zuc/version.map
delete mode 100644 drivers/crypto/zuc/zuc_pmd_private.hSignature · 1 line
2.25.1
PATCH v3 1/10 drivers/crypto: introduce IPsec-mb framework
From: Fan Zhang <[email protected]>
This patch introduces the new framework to share common code between the SW crypto PMDs that depend on the intel-ipsec-mb library. This change helps to reduce future effort on the code maintenance and feature updates.
The PMDs that will be added to this framework in subsequent patches are:
- AESNI MB
- AESNI GCM
- KASUMI
- SNOW3G
- ZUC
The use of these PMDs will not change, they will still be supported for x86, and will use the same EAL args as before.
The minimum required version for the intel-ipsec-mb library is now v1.0.
---
v3:
- Updated intel-ipsec-mb macros.
- Added use of auto init function for IMB_MGR.
- Added detail to commit log.
v2:
- Added qp NULL check in get stats function.
- Added maintainers file entry.
- Replaced strlcpy with rte_strlcpy.
--- MAINTAINERS | 4 + drivers/crypto/ipsec_mb/meson.build | 27 ++ drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c | 169 ++++++++++ .../crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c | 291 ++++++++++++++++++ .../ipsec_mb/rte_ipsec_mb_pmd_private.h | 275 +++++++++++++++++ drivers/crypto/ipsec_mb/version.map | 3 + drivers/crypto/meson.build | 1 + 7 files changed, 770 insertions(+) create mode 100644 drivers/crypto/ipsec_mb/meson.build create mode 100644 drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c create mode 100644 drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c create mode 100644 drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h create mode 100644 drivers/crypto/ipsec_mb/version.map
MAINTAINERS +4 -0
@@ -1065,6 +1065,10 @@ F: drivers/common/qat/ F: doc/guides/cryptodevs/qat.rst F: doc/guides/cryptodevs/features/qat.ini +IPsec MB +M: Fan Zhang <[email protected]> +F: drivers/crypto/ipsec_mb/ + KASUMI M: Pablo de Lara <[email protected]> F: drivers/crypto/kasumi/
drivers/crypto/ipsec_mb/meson.build new file +27 -0
@@ -0,0 +1,27 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 - 2021 Intel Corporation + +IMB_required_ver = '1.0.0' +lib = cc.find_library('IPSec_MB', required: false) +if not lib.found() + build = false + reason = 'missing dependency, "libIPSec_MB"' +else + ext_deps += lib + + # version comes with quotes, so we split based on " and take the middle + imb_ver = cc.get_define('IMB_VERSION_STR', + prefix : '#include<intel-ipsec-mb.h>').split('"')[1] + + if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver)) + reason = 'IPSec_MB version >= @0@ is required, found version @1@'.format( + IMB_required_ver, imb_ver) + build = false + endif + +endif + +sources = files('rte_ipsec_mb_pmd.c', + 'rte_ipsec_mb_pmd_ops.c', + ) +deps += ['bus_vdev', 'net', 'security']
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c new file +169 -0
169 lines not on this page · raw message
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +291 -0
291 lines not on this page · raw message
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h new file +275 -0
275 lines not on this page · raw message
drivers/crypto/ipsec_mb/version.map new file +3 -0
@@ -0,0 +1,3 @@ +DPDK_21 { + local: *; +};
drivers/crypto/meson.build +1 -0
@@ -6,6 +6,7 @@ if is_windows endif drivers = [ + 'ipsec_mb', 'aesni_gcm', 'aesni_mb', 'armv8',
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v3 01/10] drivers/crypto: introduce IPsec-mb framework
Quoted 22 lines · Ciara Power
From: Fan Zhang <[email protected]>
This patch introduces the new framework to share common code between the SW crypto PMDs that depend on the intel-ipsec-mb library. This change helps to reduce future effort on the code maintenance and feature updates.
The PMDs that will be added to this framework in subsequent patches are:
- AESNI MB
- AESNI GCM
- KASUMI
- SNOW3G
- ZUCThe use of these PMDs will not change, they will still be supported for x86, and will use the same EAL args as before.
The minimum required version for the intel-ipsec-mb library is now v1.0.
Signed-off-by Fan Zhang <[email protected]>Signed-off-by Ciara Power <[email protected]>
Quoted 10 lines
---
v3:
- Updated intel-ipsec-mb macros.
- Added use of auto init function forIMB_MGR.
- Added detail to commit log.
v2:
- Added qp NULL check in get stats function.
- Added maintainers file entry.
- Replaced strlcpy withrte_strlcpy.
---
(for the series).
Re: [dpdk-dev] [EXT] [PATCH v3 01/10] drivers/crypto: introduce IPsec-mb framework
In reply to Ciara PowerQuoted 51 lines
From: Fan Zhang <[email protected]>
This patch introduces the new framework to share common code between the SW crypto PMDs that depend on the intel-ipsec-mb library. This change helps to reduce future effort on the code maintenance and feature updates.
The PMDs that will be added to this framework in subsequent patches are:
- AESNI MB
- AESNI GCM
- KASUMI
- SNOW3G
- ZUCThe use of these PMDs will not change, they will still be supported for x86, and will use the same EAL args as before.
The minimum required version for the intel-ipsec-mb library is now v1.0.
Signed-off-by Fan Zhang <[email protected]>Signed-off-by Ciara Power <[email protected]>---
v3:
- Updated intel-ipsec-mb macros.
- Added use of auto init function forIMB_MGR.
- Added detail to commit log.
v2:
- Added qp NULL check in get stats function.
- Added maintainers file entry.
- Replaced strlcpy withrte_strlcpy.--- MAINTAINERS | 4 + drivers/crypto/ipsec_mb/meson.build | 27 ++ drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c | 169 ++++++++++ .../crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c | 291 ++++++++++++++++++ .../ipsec_mb/rte_ipsec_mb_pmd_private.h | 275 +++++++++++++++++ drivers/crypto/ipsec_mb/version.map | 3 + drivers/crypto/meson.build | 1 + 7 files changed, 770 insertions(+) create mode 100644 drivers/crypto/ipsec_mb/meson.build create mode 100644 drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c create mode 100644 drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c create mode 100644 drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h create mode 100644 drivers/crypto/ipsec_mb/version.mapMAINTAINERS +0
-0
MAINTAINERS F: drivers/common/qat/ · line 1068
Quoted 4 lines
MAINTAINERS +1
-0@@ -1065,6 +1065,10 @@ F: drivers/common/qat/ F: doc/guides/cryptodevs/qat.rst F: doc/guides/cryptodevs/features/qat.ini +IPsec MB
Not sure if the name ipsec_mb is appropriate for a crypto PMD which also support algos which are not specified for IPsec like ZUC/SNOW/KASUMI. Moreover, this is a crypto PMD and not IPsec PMD.
Quoted 13 lines
MAINTAINERS +3
-0+M: Fan Zhang <[email protected]> +F: drivers/crypto/ipsec_mb/ + KASUMI M: Pablo de Lara <[email protected]> F: drivers/crypto/kasumi/drivers/crypto/ipsec_mb/meson.build new file +0
-0
drivers/crypto/ipsec_mb/meson.build line 2
Quoted 2 lines
drivers/crypto/ipsec_mb/meson.build new file +2
-0@@ -0,0 +1,27 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 - 2021 Intel Corporation
These are new files created, IMO copyright should be of 2021 only. Check in other files also.
Quoted 248 lines
drivers/crypto/ipsec_mb/meson.build new file +10
-0+ +IMB_required_ver = '1.0.0' +lib = cc.find_library('IPSec_MB', required: false) +if not lib.found() + build = false + reason = 'missing dependency, "libIPSec_MB"' +else + ext_deps += lib + + # version comes with quotes, so we split based on " and take themiddle
drivers/crypto/ipsec_mb/meson.build new file +4
-0+ imb_ver = cc.get_define('IMB_VERSION_STR', + prefix : '#include<intel-ipsec-mb.h>').split('"')[1] + + if (imb_ver == '') or (imb_ver.version_compare('<' +
IMB_required_ver))drivers/crypto/ipsec_mb/meson.build new file +1
-0+ reason = 'IPSec_MB version >= @0@ is required, foundversion @1@'.format(
drivers/crypto/ipsec_mb/meson.build new file +10
-0+ IMB_required_ver, imb_ver) + build = false + endif + +endif + +sources = files('rte_ipsec_mb_pmd.c', + 'rte_ipsec_mb_pmd_ops.c', + ) +deps += ['bus_vdev', 'net', 'security']drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c new file +51
-0@@ -0,0 +1,169 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2021 Intel Corporation +*/ + +#include <rte_bus_vdev.h> +#include <rte_common.h> +#include <rte_cryptodev.h> + +#include "rte_ipsec_mb_pmd_private.h" + +RTE_DEFINE_PER_LCORE(IMB_MGR *, mb_mgr); + +struct ipsec_mb_pmd_data ipsec_mb_pmds[IPSEC_MB_N_PMD_TYPES ]; +int ipsec_mb_logtype_driver; +enum ipsec_mb_vector_mode vector_mode; + +/** +* Generic burst enqueue, place crypto operations on ingress queue for +* processing. +* +* @param __qp Queue Pair to process +* @param ops Crypto operations for processing +* @param nb_ops Number of crypto operations for processing +* +* @return +* - Number of crypto operations enqueued +*/ +static uint16_t +ipsec_mb_pmd_enqueue_burst (void *__qp,struct rte_crypto_op **ops, +uint16_t nb_ops) +{ +struct ipsec_mb_qp *qp = __qp; + +unsigned int nb_enqueued; + + nb_enqueued =rte_ring_enqueue_burst (qp->ingress_queue, + (void **)ops, nb_ops,NULL ); + + qp->stats.enqueued_count += nb_enqueued; + qp->stats.enqueue_err_count += nb_ops - nb_enqueued; + +return nb_enqueued; +} + +int +cryptodev_ipsec_mb_create (struct rte_vdev_device *vdev, +enum ipsec_mb_pmd_types pmd_type) +{ +struct rte_cryptodev *dev; +struct ipsec_mb_private *internals; + struct ipsec_mb_pmd_data *pmd_data =&ipsec_mb_pmds[pmd_type];
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c new file +36
-0+struct rte_cryptodev_pmd_init_params init_params = {}; +const char *name, *args; +int retval; + +if (vector_mode ==IPSEC_MB_NOT_SUPPORTED ) { +/* Check CPU for supported vector instruction set */ +if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX512F )) + vector_mode =IPSEC_MB_AVX512 ; +else if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX2 )) + vector_mode =IPSEC_MB_AVX2 ; +else if (rte_cpu_get_flag_enabled (RTE_CPUFLAG_AVX )) + vector_mode =IPSEC_MB_AVX ; +else + vector_mode =IPSEC_MB_SSE ; + } + + init_params.private_data_size =sizeof (struct ipsec_mb_private ) + + pmd_data->internals_priv_size; + init_params.max_nb_queue_pairs = +RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS ; + init_params.socket_id =rte_socket_id (); + + name =rte_vdev_device_name (vdev); +if (name ==NULL ) +return -EINVAL ; + + args =rte_vdev_device_args (vdev); + + retval =rte_cryptodev_pmd_parse_input_args (&init_params, args); +if (retval) { +IPSEC_MB_LOG ( +ERR ,"Failed to parse initialisation arguments[%s]" , args); +return -EINVAL ; + } + + dev = rte_cryptodev_pmd_create(name, &vdev->device,
&init_params);drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c new file +10
-0+if (dev ==NULL ) { +IPSEC_MB_LOG (ERR ,"driver %s: create failed" , + init_params.name); +return -ENODEV ; + } + +/* Set vector instructions mode supported */ + internals = dev->data->dev_private; + internals->pmd_type = pmd_type; + internals->max_nb_queue_pairs =init_params.max_nb_queue_pairs;
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c new file +41
-0+ + dev->driver_id =ipsec_mb_get_driver_id (pmd_type); +if (dev->driver_id ==UINT8_MAX ) { +IPSEC_MB_LOG (ERR ,"driver %s: create failed" , + init_params.name); +return -ENODEV ; + } + dev->dev_ops = ipsec_mb_pmds[pmd_type].ops; + dev->enqueue_burst = ipsec_mb_pmd_enqueue_burst; + dev->dequeue_burst = ipsec_mb_pmds[pmd_type].dequeue_burst; + +if (pmd_data->dev_config) { + retval = (*pmd_data->dev_config)(dev); +if (retval <0 ) { +IPSEC_MB_LOG (ERR , +"Failed to configure device %s" , name); +rte_cryptodev_pmd_destroy (dev); +return retval; + } + } + + dev->feature_flags = pmd_data->feature_flags; + +switch (vector_mode) { +case IPSEC_MB_AVX512 : + dev->feature_flags |=RTE_CRYPTODEV_FF_CPU_AVX512 ; +break ; +case IPSEC_MB_AVX2 : + dev->feature_flags |=RTE_CRYPTODEV_FF_CPU_AVX2 ; +break ; +case IPSEC_MB_AVX : + dev->feature_flags |=RTE_CRYPTODEV_FF_CPU_AVX ; +break ; +case IPSEC_MB_SSE : + dev->feature_flags |=RTE_CRYPTODEV_FF_CPU_SSE ; +break ; +default : +break ; + } + + IPSEC_MB_LOG(INFO, "IPSec Multi-buffer library version used:%s\n",
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c new file +31
-0+ imb_get_version_str()); + +return 0 ; +} + +int +cryptodev_ipsec_mb_remove (struct rte_vdev_device *vdev) +{ +struct rte_cryptodev *cryptodev; +const char *name; + + name =rte_vdev_device_name (vdev); +if (name ==NULL ) +return -EINVAL ; + + cryptodev =rte_cryptodev_pmd_get_named_dev (name); +if (cryptodev ==NULL ) +return -ENODEV ; + +if (RTE_PER_LCORE (mb_mgr)) { +free_mb_mgr (RTE_PER_LCORE (mb_mgr)); +RTE_PER_LCORE (mb_mgr) =NULL ; + } + +if (cryptodev->security_ctx) { +rte_free (cryptodev->security_ctx); + cryptodev->security_ctx =NULL ; + } + +return rte_cryptodev_pmd_destroy (cryptodev); +}drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +33
-0@@ -0,0 +1,291 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2021 Intel Corporation +*/ + +#include <string.h> + +#include <rte_common.h> +#include <rte_malloc.h> + +#include "rte_ipsec_mb_pmd_private.h" + +/** Configure device */ +int +ipsec_mb_pmd_config(__rte_unused struct rte_cryptodev *dev, + __rte_unused struct rte_cryptodev_config *config) +{ +return 0 ; +} + +/** Start device */ +int +ipsec_mb_pmd_start(__rte_unused struct rte_cryptodev *dev) +{ +return 0 ; +} + +/** Stop device */ +void +ipsec_mb_pmd_stop(__rte_unused struct rte_cryptodev *dev) +{ +} + +/** Close device */
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c line 43
Quoted 10 lines
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +10
-0+int +ipsec_mb_pmd_close(__rte_unused struct rte_cryptodev *dev) +{ +return 0 ; +} + +/** Get device statistics */ +void +ipsec_mb_pmd_stats_get (struct rte_cryptodev *dev, +struct rte_cryptodev_stats *stats)
I believe 1 instance of the ipsec_mb PMD will support only one kind of operation(aesni_mb/aesni_gcm/zuc/snow/kasumi). This cannot be changed during the lifetime of the process. Right?
Quoted 153 lines
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +7
-0+{ +int qp_id; + +for (qp_id =0 ; qp_id < dev->data->nb_queue_pairs; qp_id++) { +struct ipsec_mb_qp *qp = dev->data->queue_pairs[qp_id]; +if (qp ==NULL ) { + IPSEC_MB_LOG(DEBUG, "Uninitialised qp %d",
qp_id);drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +38
-0+continue ; + } + + stats->enqueued_count += qp->stats.enqueued_count; + stats->dequeued_count += qp->stats.dequeued_count; + + stats->enqueue_err_count += qp->stats.enqueue_err_count; + stats->dequeue_err_count += qp->stats.dequeue_err_count; + } +} + +/** Reset device statistics */ +void +ipsec_mb_pmd_stats_reset (struct rte_cryptodev *dev) +{ +int qp_id; + +for (qp_id =0 ; qp_id < dev->data->nb_queue_pairs; qp_id++) { +struct ipsec_mb_qp *qp = dev->data->queue_pairs[qp_id]; + +memset (&qp->stats,0 ,sizeof (qp->stats)); + } +} + +/** Get device info */ +void +ipsec_mb_pmd_info_get (struct rte_cryptodev *dev, +struct rte_cryptodev_info *dev_info) +{ +struct ipsec_mb_private *internals = dev->data->dev_private; +struct ipsec_mb_pmd_data *pmd_info = + &ipsec_mb_pmds[internals->pmd_type]; + +if (dev_info !=NULL ) { + dev_info->driver_id = dev->driver_id; + dev_info->feature_flags = dev->feature_flags; + dev_info->capabilities = pmd_info->caps; + dev_info->max_nb_queue_pairs = internals-Quoted 1 line
max_nb_queue_pairs;drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +29
-0+/* No limit of number of sessions */ + dev_info->sym.max_nb_sessions =0 ; + } +} + +/** Release queue pair */ +int +ipsec_mb_pmd_qp_release (struct rte_cryptodev *dev,uint16_t qp_id) +{ +struct ipsec_mb_qp *qp = dev->data->queue_pairs[qp_id]; +struct rte_ring *r =NULL ; + +if (qp !=NULL ) { + r =rte_ring_lookup (qp->name); +if (r) +rte_ring_free (r); +rte_free (qp); + dev->data->queue_pairs[qp_id] =NULL ; + } +return 0 ; +} + +/** Set a unique name for the queue pair */ +int +ipsec_mb_pmd_qp_set_unique_name (struct rte_cryptodev *dev, +struct ipsec_mb_qp *qp) +{ +uint32_t n = + snprintf(qp->name, sizeof(qp->name),"ipsec_mb_pmd_%u_qp_%u",
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +17
-0+ dev->data->dev_id, qp->id); + +if (n >=sizeof (qp->name)) +return -1 ; + +return 0 ; +} + +/** Create a ring to place processed operations on */ +static struct rte_ring +*ipsec_mb_pmd_qp_create_processed_ops_ring ( +struct ipsec_mb_qp *qp,unsigned int ring_size,int socket_id) +{ +struct rte_ring *r; +char ring_name[RTE_CRYPTODEV_NAME_MAX_LEN ]; + + unsigned int n = rte_strlcpy(ring_name, qp->name,
sizeof(ring_name));drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +26
-0+ +if (n >=sizeof (ring_name)) +return NULL ; + + r =rte_ring_lookup (ring_name); +if (r) { +if (rte_ring_get_size (r) >= ring_size) { +IPSEC_MB_LOG ( +INFO ,"Reusing existing ring %s for processed ops" , + ring_name); +return r; + } +IPSEC_MB_LOG ( +ERR ,"Unable to reuse existing ring %s for processed ops" , + ring_name); +return NULL ; + } + +return rte_ring_create (ring_name, ring_size, socket_id, +RING_F_SP_ENQ |RING_F_SC_DEQ ); +} + +/** Setup a queue pair */ +int +ipsec_mb_pmd_qp_setup (struct rte_cryptodev *dev,uint16_t qp_id, + const struct rte_cryptodev_qp_conf
*qp_conf,drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +30
-0+ int socket_id) +{ +struct ipsec_mb_qp *qp =NULL ; +struct ipsec_mb_private *internals = dev->data->dev_private; +struct ipsec_mb_pmd_data *pmd_data = + &ipsec_mb_pmds[internals->pmd_type]; +uint32_t qp_size; +int ret =-1 ; + +/* Free memory prior to re-allocation if needed. */ +if (dev->data->queue_pairs[qp_id] !=NULL ) +ipsec_mb_pmd_qp_release (dev, qp_id); + + qp_size =sizeof (*qp) + pmd_data->qp_priv_size; +/* Allocate the queue pair data structure. */ + qp =rte_zmalloc_socket ("IPSEC PMD Queue Pair" , qp_size, +RTE_CACHE_LINE_SIZE , socket_id); +if (qp ==NULL ) +return -ENOMEM ; + + qp->id = qp_id; + dev->data->queue_pairs[qp_id] = qp; +if (ipsec_mb_pmd_qp_set_unique_name (dev, qp)) + goto qp_setup_cleanup; + + qp->pmd_type = internals->pmd_type; + qp->sess_mp = qp_conf->mp_session; + qp->sess_mp_priv = qp_conf->mp_session_private; + + qp->ingress_queue =ipsec_mb_pmd_qp_create_processed_ops_ring(qp,
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c line 193
Quoted 3 lines
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +3
-0+ qp_conf->nb_descriptors, socket_id); +if (qp->ingress_queue ==NULL ) { + ret =-1 ;
-1??
Quoted 404 lines
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +39
-0+ goto qp_setup_cleanup; + } + + qp->mb_mgr =alloc_init_mb_mgr (); +if (!qp->mb_mgr) { + ret = -ENOMEM ; + goto qp_setup_cleanup; + } + +memset (&qp->stats,0 ,sizeof (qp->stats)); + +if (pmd_data->queue_pair_configure) { + ret = pmd_data->queue_pair_configure (qp); +if (ret <0 ) + goto qp_setup_cleanup; + } + +return 0 ; + +qp_setup_cleanup: +if (qp->mb_mgr) +free_mb_mgr (qp->mb_mgr); +if (qp) +rte_free (qp); +return ret; +} + +/** Return the size of the specific pmd session structure */ +unsigned +ipsec_mb_pmd_sym_session_get_size (struct rte_cryptodev *dev) +{ +struct ipsec_mb_private *internals = dev->data->dev_private; +struct ipsec_mb_pmd_data *pmd_data = + &ipsec_mb_pmds[internals->pmd_type]; + +return pmd_data->session_priv_size; +} + +/** Configure pmd specific multi-buffer session from a crypto xform chain */
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +4
-0+int +ipsec_mb_pmd_sym_session_configure ( +struct rte_cryptodev *dev,struct rte_crypto_sym_xform *xform, + struct rte_cryptodev_sym_session *sess, struct rte_mempool*mempool)
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +19
-0+{ +void *sess_private_data; +struct ipsec_mb_private *internals = dev->data->dev_private; +struct ipsec_mb_pmd_data *pmd_data = + &ipsec_mb_pmds[internals->pmd_type]; +IMB_MGR *mb_mgr =alloc_init_mb_mgr (); +int ret =0 ; + +if (!mb_mgr) +return -ENOMEM ; + +if (unlikely (sess ==NULL )) { +IPSEC_MB_LOG (ERR ,"invalid session struct" ); +free_mb_mgr (mb_mgr); +return -EINVAL ; + } + +if (rte_mempool_get (mempool, &sess_private_data)) { + IPSEC_MB_LOG(ERR, "Couldn't get object from sessionmempool");
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +5
-0+free_mb_mgr (mb_mgr); +return -ENOMEM ; + } + + ret = (*pmd_data->session_configure)(mb_mgr, sess_private_data,xform);
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +10
-0+if (ret !=0 ) { +IPSEC_MB_LOG (ERR ,"failed configure session parameters" ); + +/* Return session to mempool */ +rte_mempool_put (mempool, sess_private_data); +free_mb_mgr (mb_mgr); +return ret; + } + + set_sym_session_private_data(sess, dev->driver_id,
sess_private_data);drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +15
-0+ +return 0 ; +} + +/** Clear the session memory */ +void +ipsec_mb_pmd_sym_session_clear (struct rte_cryptodev *dev, +struct rte_cryptodev_sym_session *sess) +{ +uint8_t index = dev->driver_id; +void *sess_priv =get_sym_session_private_data (sess, index); + +/* Zero out the whole structure */ +if (sess_priv) { + memset(sess_priv, 0,
ipsec_mb_pmd_sym_session_get_size(dev));drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +1
-0+ struct rte_mempool *sess_mp =
rte_mempool_from_obj(sess_priv);drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c new file +5
-0+ +set_sym_session_private_data (sess, index,NULL ); +rte_mempool_put (sess_mp, sess_priv); + } +}drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h new file +38
-0@@ -0,0 +1,275 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2021 Intel Corporation +*/ + +#ifndef _IPSEC_MB_PMD_PRIVATE_H_ +#define _IPSEC_MB_PMD_PRIVATE_H_ + +#include <intel-ipsec-mb.h> +#include <cryptodev_pmd.h> +#include <rte_bus_vdev.h> + +#if defined(RTE_LIB_SECURITY ) +#define IPSEC_MB_DOCSIS_SEC_ENABLED 1 +#include <rte_security.h> +#include <rte_security_driver.h> +#endif + +/* Maximum length for digest */ +#define DIGEST_LENGTH_MAX 64 + +enum ipsec_mb_vector_mode { +IPSEC_MB_NOT_SUPPORTED =0 , +IPSEC_MB_SSE , +IPSEC_MB_AVX , +IPSEC_MB_AVX2 , +IPSEC_MB_AVX512 +}; + +extern enum ipsec_mb_vector_mode vector_mode; + +/** IMB_MGR instances, one per thread */ +extern RTE_DEFINE_PER_LCORE(IMB_MGR *, mb_mgr); + +/** PMD LOGTYPE DRIVER, common to all PMDs */ +extern int ipsec_mb_logtype_driver; +#define IPSEC_MB_LOG (level, fmt, ...) \ + rte_log(RTE_LOG_##level, ipsec_mb_logtype_driver, \ + "%s() line %u: " fmt "\n", __func__, __LINE__,##__VA_ARGS__)
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h new file +24
-0+ +/** All supported device types */ +enum ipsec_mb_pmd_types { +IPSEC_MB_N_PMD_TYPES +}; + +/** Crypto operations */ +enum ipsec_mb_operation { +IPSEC_MB_OP_ENCRYPT_THEN_HASH_GEN =0 , +IPSEC_MB_OP_HASH_VERIFY_THEN_DECRYPT , +IPSEC_MB_OP_HASH_GEN_THEN_ENCRYPT , +IPSEC_MB_OP_DECRYPT_THEN_HASH_VERIFY , +IPSEC_MB_OP_ENCRYPT_ONLY , +IPSEC_MB_OP_DECRYPT_ONLY , +IPSEC_MB_OP_HASH_GEN_ONLY , +IPSEC_MB_OP_HASH_VERIFY_ONLY , +IPSEC_MB_OP_AEAD_AUTHENTICATED_DECRYPT , +IPSEC_MB_OP_AEAD_AUTHENTICATED_ENCRYPT , +IPSEC_MB_OP_NOT_SUPPORTED +}; + +/** Helper function. Gets driver ID based on PMD type */ +static __rte_always_inline uint8_t +ipsec_mb_get_driver_id(__rte_unused enum ipsec_mb_pmd_types
pmd_type)drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h new file +109
-0+{ +return UINT8_MAX ; +} + +/** Common private data structure for each PMD */ +struct ipsec_mb_private { +enum ipsec_mb_pmd_types pmd_type; +/**< PMD type */ +uint32_t max_nb_queue_pairs; +/**< Max number of queue pairs supported by device */ + __extension__uint8_t priv[0 ]; +}; + +/** IPSEC Multi buffer queue pair common queue pair data for all PMDs */ +struct ipsec_mb_qp { +uint16_t id; +/**< Queue Pair Identifier */ +char name[RTE_CRYPTODEV_NAME_MAX_LEN ]; +struct rte_ring *ingress_queue; +/**< Ring for placing operations ready for processing */ +struct rte_mempool *sess_mp; +/**< Session Mempool */ +struct rte_mempool *sess_mp_priv; +/**< Session Private Data Mempool */ +struct rte_cryptodev_stats stats; +/**< Queue pair statistics */ +enum ipsec_mb_pmd_types pmd_type; +/**< pmd type */ +uint8_t digest_idx; +/**< Index of the next +* slot to be used in temp_digests, +* to store the digest for a given operation +*/ +IMB_MGR *mb_mgr; +/* Multi buffer manager */ + __extension__uint8_t additional_data[0 ]; +/**< Storing PMD specific additional data */ +}; + +static __rte_always_inline void * +ipsec_mb_get_qp_private_data (struct ipsec_mb_qp *qp) +{ +return (void *)qp->additional_data; +} + +/** Helper function. Allocates job manager */ +static __rte_always_inline IMB_MGR * +alloc_init_mb_mgr (void ) +{ +IMB_MGR *mb_mgr =alloc_mb_mgr (0 ); + +if (unlikely (mb_mgr ==NULL )) { +IPSEC_MB_LOG (ERR ,"Failed to allocate IMB_MGR data\n" ); +return NULL ; + } + +init_mb_mgr_auto (mb_mgr,NULL ); + +return mb_mgr; +} + +/** Helper function. Gets per thread job manager */ +static __rte_always_inline IMB_MGR * +get_per_thread_mb_mgr (void ) +{ +if (unlikely (RTE_PER_LCORE (mb_mgr) ==NULL )) +RTE_PER_LCORE (mb_mgr) =alloc_init_mb_mgr (); + +return RTE_PER_LCORE (mb_mgr); +} + +/** Device creation function */ +int +cryptodev_ipsec_mb_create (struct rte_vdev_device *vdev, +enum ipsec_mb_pmd_types pmd_type); + +/** Device remove function */ +int +cryptodev_ipsec_mb_remove (struct rte_vdev_device *vdev); + +/** Configure queue pair PMD type specific data */ +typedef int (*ipsec_mb_queue_pair_configure_t )(struct ipsec_mb_qp *qp); + +/** Configure session PMD type specific data */ +typedef int (*ipsec_mb_session_configure_t )(IMB_MGR *mbr_mgr, +void *session_private, +const struct rte_crypto_sym_xform *xform); + +/** Configure internals PMD type specific data */ +typedef int (*ipsec_mb_dev_configure_t )(struct rte_cryptodev *dev); + +/** Per PMD type operation and data */ +struct ipsec_mb_pmd_data { +uint8_t is_configured; +dequeue_pkt_burst_t dequeue_burst; +ipsec_mb_dev_configure_t dev_config; +ipsec_mb_queue_pair_configure_t queue_pair_configure; +ipsec_mb_session_configure_t session_configure; +const struct rte_cryptodev_capabilities *caps; +struct rte_cryptodev_ops *ops; +struct rte_security_ops *security_ops; +uint64_t feature_flags; +uint32_t session_priv_size; +uint32_t qp_priv_size; +uint32_t internals_priv_size; +}; + +/** Global PMD type specific data */ +extern struct ipsec_mb_pmd_dataipsec_mb_pmds[IPSEC_MB_N_PMD_TYPES];
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h new file +35
-0+ +int +ipsec_mb_pmd_config (struct rte_cryptodev *dev, +struct rte_cryptodev_config *config); + +int +ipsec_mb_pmd_start (struct rte_cryptodev *dev); + +void +ipsec_mb_pmd_stop (struct rte_cryptodev *dev); + +int +ipsec_mb_pmd_close (struct rte_cryptodev *dev); + +void +ipsec_mb_pmd_stats_get (struct rte_cryptodev *dev, +struct rte_cryptodev_stats *stats); + +void +ipsec_mb_pmd_stats_reset (struct rte_cryptodev *dev); + +void +ipsec_mb_pmd_info_get (struct rte_cryptodev *dev, +struct rte_cryptodev_info *dev_info); + +int +ipsec_mb_pmd_qp_release (struct rte_cryptodev *dev,uint16_t qp_id); + +int +ipsec_mb_pmd_qp_set_unique_name (struct rte_cryptodev *dev, +struct ipsec_mb_qp *qp); + +int +ipsec_mb_pmd_qp_setup (struct rte_cryptodev *dev,uint16_t qp_id, + const struct rte_cryptodev_qp_conf
*qp_conf,drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h new file +21
-0+ int socket_id); + +/** Returns the size of the aesni multi-buffer session structure */ +unsigned +ipsec_mb_pmd_sym_session_get_size (struct rte_cryptodev *dev); + +/** Configure an aesni multi-buffer session from a crypto xform chain */ +int ipsec_mb_pmd_sym_session_configure ( +struct rte_cryptodev *dev, +struct rte_crypto_sym_xform *xform, +struct rte_cryptodev_sym_session *sess, +struct rte_mempool *mempool); + +/** Clear the memory of session so it does not leave key material behind */ +void +ipsec_mb_pmd_sym_session_clear (struct rte_cryptodev *dev, +struct rte_cryptodev_sym_session *sess); + +/** Get session from op. If sessionless create a session */ +static __rte_always_inline void * +ipsec_mb_get_session_private(struct ipsec_mb_qp *qp, struct
rte_crypto_op*op)drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h new file +8
-0+{ +void *sess =NULL ; +uint32_t driver_id =ipsec_mb_get_driver_id (qp->pmd_type); +struct rte_crypto_sym_op *sym_op = op->sym; +uint8_t sess_type = op->sess_type; +void *_sess; +void *_sess_private_data =NULL ; + struct ipsec_mb_pmd_data *pmd_data = &ipsec_mb_pmds[qp-Quoted 1 line
pmd_type];drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h new file +5
-0+ +switch (sess_type) { +case RTE_CRYPTO_OP_WITH_SESSION : +if (likely (sym_op->session !=NULL )) + sess = get_sym_session_private_data(sym_op-Quoted 1 line
session,
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h new file +17
-0+ driver_id); +break ; +case RTE_CRYPTO_OP_SESSIONLESS : +if (!qp->sess_mp || +rte_mempool_get (qp->sess_mp, (void **)&_sess)) +return NULL ; + +if (!qp->sess_mp_priv || +rte_mempool_get (qp->sess_mp_priv, + (void **)&_sess_private_data)) +return NULL ; + + sess = _sess_private_data; +if (unlikely (pmd_data->session_configure (qp->mb_mgr, + sess, sym_op->xform) !=0 )) { +rte_mempool_put (qp->sess_mp, _sess); + rte_mempool_put(qp->sess_mp_priv,
_sess_private_data);drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h new file +4
-0+ sess =NULL ; + } + + sym_op->session = (struct rte_cryptodev_sym_session*)_sess;
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h new file +5
-0+set_sym_session_private_data (sym_op->session, driver_id, + _sess_private_data); +break ; +default : + IPSEC_MB_LOG(ERR, "Unrecognized session type %u",
sess_type);drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h new file +9
-0+ } + +if (unlikely (sess ==NULL )) + op->status =RTE_CRYPTO_OP_STATUS_INVALID_SESSION ; + +return sess; +} + +#endif /* _IPSEC_MB_PMD_PRIVATE_H_ */ drivers/crypto/ipsec_mb/version.map new file +0
-0
drivers/crypto/ipsec_mb/version.map line 3
Quoted 3 lines
drivers/crypto/ipsec_mb/version.map new file +3
-0@@ -0,0 +1,3 @@ +DPDK_21 { + local: *; +};
This should be DPDK_22
drivers/crypto/meson.build if is_windows · line 12
Quoted 12 lines
drivers/crypto/meson.build +1
-0@@ -6,6 +6,7 @@ if is_windows endif drivers = [ + 'ipsec_mb', 'aesni_gcm', 'aesni_mb', 'armv8',
Alphabetical order??
Re: [dpdk-dev] [EXT] [PATCH v3 01/10] drivers/crypto: introduce IPsec-mb framework
Hi Akhil,
Quoted 71 lines
-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Wednesday 6 October 2021 14:51
To: Power, Ciara <[email protected]>; [email protected]
Cc: Zhang, Roy Fan <[email protected]>; Bronowski, PiotrX <[email protected]>; Thomas Monjalon <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Ray Kinsella <[email protected]>
Subject: RE: [EXT] [PATCH v3 01/10]drivers/crypto: introduce IPsec-mb frameworkQuoted 51 lines
From: Fan Zhang <[email protected]>
This patch introduces the new framework to share common code between the SW crypto PMDs that depend on the intel-ipsec-mb library. This change helps to reduce future effort on the code maintenance and feature updates.
The PMDs that will be added to this framework in subsequent patches are:
- AESNI MB
- AESNI GCM
- KASUMI
- SNOW3G
- ZUCThe use of these PMDs will not change, they will still be supported for x86, and will use the same EAL args as before.
The minimum required version for the intel-ipsec-mb library is now v1.0.
Signed-off-by Fan Zhang <[email protected]>Signed-off-by Ciara Power <[email protected]>---
v3:
- Updated intel-ipsec-mb macros.
- Added use of auto init function forIMB_MGR.
- Added detail to commit log.
v2:
- Added qp NULL check in get stats function.
- Added maintainers file entry.
- Replaced strlcpy withrte_strlcpy.--- MAINTAINERS | 4 + drivers/crypto/ipsec_mb/meson.build | 27 ++ drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c | 169 ++++++++++ .../crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c | 291 ++++++++++++++++++ .../ipsec_mb/rte_ipsec_mb_pmd_private.h | 275 +++++++++++++++++ drivers/crypto/ipsec_mb/version.map | 3 + drivers/crypto/meson.build | 1 + 7 files changed, 770 insertions(+) create mode 100644 drivers/crypto/ipsec_mb/meson.build create mode 100644 drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c create mode 100644 drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c create mode 100644 drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h create mode 100644 drivers/crypto/ipsec_mb/version.mapMAINTAINERS index 1e0d303394..f1aaf7d408 renamed from MAINTAINERS +0
-0100644
MAINTAINERS F: drivers/common/qat/ · line 1068
Quoted 4 lines
MAINTAINERS +1
-0@@ -1065,6 +1065,10 @@ F: drivers/common/qat/ F: doc/guides/cryptodevs/qat.rst F: doc/guides/cryptodevs/features/qat.ini +IPsec MBNot sure if the name
ipsec_mbis appropriate for a crypto PMD which also support algos which are not specified for IPsec like ZUC/SNOW/KASUMI. Moreover, this is a crypto PMD and not IPsec PMD.
<snip>
Quoted 9 lines
MAINTAINERS
Quoted 4 lines
MAINTAINERS +4
-0+/** Get device statistics */ +void +ipsec_mb_pmd_stats_get(struct rte_cryptodev *dev, + struct rte_cryptodev_stats *stats)I believe 1 instance of the
ipsec_mbPMD will support only one kind ofoperation(aesni_mb/aesni_gcm/zuc/snow/kasumi).
This cannot be changed during the lifetime of the process. Right?
<snip>
Yes - please treat the ipsec_mb_pmd.c/pmd_ops.c as the shared code base for these existing SW crypto PMDs based on intel-ipsec-mb library. There is no new PMD called ipsec_mb as such.
Maybe to make it less misleading we could rename the file names like so:Ipsec_mb_pmd.c -> ipsec_mb_private.c
And similar change for ipsec_mb_pmd_ops.c and ipsec_mb_pmd_private.h What do you think?
Thanks,
Ciara
Re: [dpdk-dev] [EXT] [PATCH v3 01/10] drivers/crypto: introduce IPsec-mb framework
Quoted 78 lines
Hi Akhil,
Quoted 3 lines
Quoted 3 lines
From: Fan Zhang <[email protected]>
This patch introduces the new framework to share common code
between
Quoted 5 lines
Quoted 5 lines
the SW crypto PMDs that depend on the intel-ipsec-mb library. This change helps to reduce future effort on the code maintenance and feature updates.
The PMDs that will be added to this framework in subsequent patches
are:
Quoted 14 lines
Quoted 14 lines
- AESNI MB
- AESNI GCM
- KASUMI
- SNOW3G
- ZUCThe use of these PMDs will not change, they will still be supported for x86, and will use the same EAL args as before.
The minimum required version for the intel-ipsec-mb library is now v1.0.
Signed-off-by Fan Zhang <[email protected]>Signed-off-by Ciara Power <[email protected]>Quoted 14 lines
Quoted 9 lines
---
v3:
- Updated intel-ipsec-mb macros.
- Added use of auto init function forIMB_MGR.
- Added detail to commit log.
v2:
- Added qp NULL check in get stats function.
- Added maintainers file entry.
- Replaced strlcpy withrte_strlcpy.Quoted 5 lines
--- MAINTAINERS | 4 + drivers/crypto/ipsec_mb/meson.build | 27 ++ drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c | 169 ++++++++++ .../crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c | 291++++++++++++++++++
Quoted 8 lines
Quoted 8 lines
.../ipsec_mb/rte_ipsec_mb_pmd_private.h | 275 +++++++++++++++++ drivers/crypto/ipsec_mb/version.map | 3 + drivers/crypto/meson.build | 1 + 7 files changed, 770 insertions(+) create mode 100644 drivers/crypto/ipsec_mb/meson.build create mode 100644 drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c create mode 100644 drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c create mode 100644
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.hQuoted 16 lines
MAINTAINERS F: drivers/common/qat/ · line 1068
Quoted 11 lines
create mode 100644 drivers/crypto/ipsec_mb/version.mapMAINTAINERS index 1e0d303394..f1aaf7d408 renamed from MAINTAINERS +0
-0100644
MAINTAINERS +1
-0@@ -1065,6 +1065,10 @@ F: drivers/common/qat/ F: doc/guides/cryptodevs/qat.rst F: doc/guides/cryptodevs/features/qat.ini +IPsec MBNot sure if the name
ipsec_mbis appropriate for a crypto PMD which also support algos which are not specified for IPsec like ZUC/SNOW/KASUMI. Moreover, this is a crypto PMD and not IPsec PMD.<snip>
Quoted 9 lines
MAINTAINERS
Quoted 4 lines
MAINTAINERS +4
-0+/** Get device statistics */ +void +ipsec_mb_pmd_stats_get(struct rte_cryptodev *dev, + struct rte_cryptodev_stats *stats)I believe 1 instance of the
ipsec_mbPMD will support only one kind ofoperation(aesni_mb/aesni_gcm/zuc/snow/kasumi).
This cannot be changed during the lifetime of the process. Right?<snip>
Quoted 9 lines
Yes - please treat the
ipsec_mb_pmd.c/pmd_ops.cas the shared code base for these existing SW crypto PMDs based on intel-ipsec-mb library. There is no new PMD calledipsec_mbas such.Maybe to make it less misleading we could rename the file names like so:
Ipsec_mb_pmd.c->ipsec_mb_private.c
And similar change foripsec_mb_pmd_ops.candipsec_mb_pmd_private.hWhat do you think?
Ok that would be better.
PATCH v3 2/10 crypto/ipsec_mb: add multiprocess support
In reply to Ciara PowerThe ipsec_mb SW PMD now has multiprocess support.
The queue-pair IMB_MGR is stored in a memzone instead of being allocated externally by the Intel IPSec MB library, when v1.1 is used. If v1.0 is used, multi process is not supported, and allocation is done as before.
The secondary process needs to reconfigure the queue-pair to allow for IMB_MGR function pointers be updated.
Intel IPsec MB library version 1.1 is required for this support.
--- doc/guides/rel_notes/release_21_11.rst | 7 ++ .../crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c | 110 +++++++++++++++--- .../ipsec_mb/rte_ipsec_mb_pmd_private.h | 5 + 3 files changed, 106 insertions(+), 16 deletions(-)
doc/guides/rel_notes/release_21_11.rst +7 -0
@@ -62,6 +62,13 @@ New Features * Added bus-level parsing of the devargs syntax. * Kept compatibility with the legacy syntax as parsing fallback. +* **Added multi-process support for IPsec-mb PMD.** + + Added multi-process support to IPsec-mb PMD, which will add support + for PMDs that are moved to use this shared framework. + This feature makes use of an intel-ipsec-mb API found in v1.1, + which is the minimum required version to use this multi-process support. + * **Updated Marvell cnxk crypto PMD.** * Added AES-CBC SHA1-HMAC support in lookaside protocol (IPsec) for CN10K.
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c +94 -16
158 lines not on this page · raw message
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h +5 -0
@@ -18,6 +18,9 @@/* Maximum length for digest */ #define DIGEST_LENGTH_MAX 64 +/* Maximum length for memzone name */ +#define IPSEC_MB_MAX_MZ_NAME 32 +enum ipsec_mb_vector_mode {IPSEC_MB_NOT_SUPPORTED =0 ,IPSEC_MB_SSE ,
@@ -95,6 +98,8 @@ struct ipsec_mb_qp {*/ IMB_MGR *mb_mgr;/* Multi buffer manager */ +const struct rte_memzone *mb_mgr_mz; +/* Shared memzone for storing mb_mgr */ __extension__uint8_t additional_data[0 ];/**< Storing PMD specific additional data */ };
Signature · 1 line
2.25.1
Re: [dpdk-dev] [EXT] [PATCH v3 02/10] crypto/ipsec_mb: add multiprocess support
Quoted 8 lines
The
ipsec_mbSW PMD now has multiprocess support.
The queue-pairIMB_MGRis stored in a memzone instead of being allocated externally by the Intel IPSec MB library, when v1.1 is used. If v1.0 is used, multi process is not supported, and allocation is done as before.
The secondary process needs to reconfigure the queue-pair to allow forIMB_MGRfunction pointers be updated.
Quoted 7 lines
Intel IPsec MB library version 1.1 is required for this support.
Signed-off-by Ciara Power <[email protected]>--- doc/guides/rel_notes/release_21_11.rst | 7 ++ .../crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c | 110 +++++++++++++++--- .../ipsec_mb/rte_ipsec_mb_pmd_private.h | 5 +
Missed to comment on first patch.rte_ may be skipped from the internal files of the PMD. rte_ is normally added for files which are exposed to the user.
Quoted 8 lines
3 files changed, 106 insertions(+), 16 deletions(-)doc/guides/rel_notes/release_21_11.rst +0
-0
doc/guides/rel_notes/release_21_11.rst New Features · line 71
Quoted 10 lines
doc/guides/rel_notes/release_21_11.rst +7
-0@@ -62,6 +62,13 @@ New Features * Added bus-level parsing of the devargs syntax. * Kept compatibility with the legacy syntax as parsing fallback. +* **Added multi-process support for IPsec-mb PMD.** + + Added multi-process support to IPsec-mb PMD, which will add support + for PMDs that are moved to use this shared framework. + This feature makes use of an intel-ipsec-mb API found in v1.1, + which is the minimum required version to use this multi-process support. +
I believe first new PMD framework should be introduced in the release note and a sub bullet may be added to specify multi process support.
Quoted 130 lines
doc/guides/rel_notes/release_21_11.rst +0
-0* **Updated Marvell cnxk crypto PMD.** * Added AES-CBC SHA1-HMAC support in lookaside protocol (IPsec) forCN10K.
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c +13
-1@@ -9,6 +9,8 @@#include "rte_ipsec_mb_pmd_private.h" +#define IMB_MP_REQ_VER_STR "1.1.0" +/** Configure device */ int ipsec_mb_pmd_config(__rte_unused struct rte_cryptodev *dev,@@ -98,10 +100,20 @@ ipsec_mb_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)struct ipsec_mb_qp *qp = dev->data->queue_pairs[qp_id];struct rte_ring *r =NULL ; -if (qp !=NULL ) { +if (qp !=NULL &&rte_eal_process_type () ==RTE_PROC_PRIMARY ) { r =rte_ring_lookup (qp->name);if (r)rte_ring_free (r); + +#if IMB_VERSION (1 ,1 ,0 ) >IMB_VERSION_NUM +if (qp->mb_mgr) +free_mb_mgr (qp->mb_mgr); +#else +if (qp->mb_mgr_mz) { +rte_memzone_free (qp->mb_mgr_mz); + qp->mb_mgr =NULL ; + } +#endif rte_free (qp); dev->data->queue_pairs[qp_id] =NULL ;drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c +20
-0}@@ -154,6 +166,42 @@ static struct rte_ring RING_F_SP_ENQ | RING_F_SC_DEQ); } +#if IMB_VERSION (1 ,1 ,0 ) <=IMB_VERSION_NUM +static IMB_MGR * +ipsec_mb_pmd_alloc_mb_from_memzone (const struct rte_memzone **mb_mgr_mz, +const char *mb_mgr_mz_name) +{ +IMB_MGR *mb_mgr; + +if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) { + *mb_mgr_mz =rte_memzone_lookup (mb_mgr_mz_name); +if (*mb_mgr_mz ==NULL ) { + *mb_mgr_mz =rte_memzone_reserve (mb_mgr_mz_name, +imb_get_mb_mgr_size (), +rte_socket_id (),0 ); + } +if (*mb_mgr_mz ==NULL ) { + IPSEC_MB_LOG(DEBUG, "Error allocating memzone for %s", + mb_mgr_mz_name); +return NULL ; + } + mb_mgr = imb_set_pointers_mb_mgr((*mb_mgr_mz)->addr,0, 1);
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c +6
-0+init_mb_mgr_auto (mb_mgr,NULL ); + }else { + *mb_mgr_mz =rte_memzone_lookup (mb_mgr_mz_name); +if (*mb_mgr_mz ==NULL ) { + IPSEC_MB_LOG(ERR, + "Secondary can't find %s mz, did primarycreate it?",
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c +4
-0+ mb_mgr_mz_name); +return NULL ; + } + mb_mgr = imb_set_pointers_mb_mgr((*mb_mgr_mz)->addr,0, 0);
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c +9
-3+ init_mb_mgr_auto(mb_mgr, NULL); + } +return mb_mgr; +} +#endif +/** Setup a queue pair */ int ipsec_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,@@ -167,16 +215,44 @@ ipsec_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, uint32_t qp_size;int ret =-1 ; -/* Free memory prior to re-allocation if needed. */ -if (dev->data->queue_pairs[qp_id] !=NULL ) -ipsec_mb_pmd_qp_release (dev, qp_id); +if (rte_eal_process_type () ==RTE_PROC_SECONDARY ) { +#if IMB_VERSION (1 ,1 ,0 ) >IMB_VERSION_NUM + IPSEC_MB_LOG(ERR, "The intel-ipsec-mb version (%s) doesnot support multiprocess,"
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c +1
-0+ "the minimum version required for thisfeature is %s.",
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c +25
-0+ IMB_VERSION_STR, IMB_MP_REQ_VER_STR); +return -EINVAL ; +#endif +if (dev->data->queue_pairs[qp_id] !=NULL ) + qp = dev->data->queue_pairs[qp_id]; + }else { +/* Free memory prior to re-allocation if needed. */ +if (dev->data->queue_pairs[qp_id] !=NULL ) +ipsec_mb_pmd_qp_release (dev, qp_id); + + qp_size =sizeof (*qp) + pmd_data->qp_priv_size; +/* Allocate the queue pair data structure. */ + qp =rte_zmalloc_socket ("IPSEC PMD Queue Pair" , qp_size, +RTE_CACHE_LINE_SIZE , socket_id); +if (qp ==NULL ) +return -ENOMEM ; + } + +#if IMB_VERSION (1 ,1 ,0 ) >IMB_VERSION_NUM + qp->mb_mgr =alloc_init_mb_mgr (); +#else +char mz_name[IPSEC_MB_MAX_MZ_NAME ]; +snprintf (mz_name,sizeof (mz_name),"IMB_MGR_DEV_%d_QP_%d" , + dev->data->dev_id, qp_id); + qp->mb_mgr = ipsec_mb_pmd_alloc_mb_from_memzone(&(qp-Quoted 1 line
mb_mgr_mz),
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c ipsec_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, · line 247
Quoted 1 line
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c +1
-0+ mz_name);
_pmd_ may be skipped from the internal APIs. The function names are pretty long.
Quoted 83 lines
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c +7
-12+#endif +if (qp->mb_mgr ==NULL ) { + ret = -ENOMEM ; + goto qp_setup_cleanup; + } - qp_size =sizeof (*qp) + pmd_data->qp_priv_size; -/* Allocate the queue pair data structure. */ - qp =rte_zmalloc_socket ("IPSEC PMD Queue Pair" , qp_size, -RTE_CACHE_LINE_SIZE , socket_id); -if (qp ==NULL ) -return -ENOMEM ; +if (rte_eal_process_type () ==RTE_PROC_SECONDARY ) +return 0 ; qp->id = qp_id; dev->data->queue_pairs[qp_id] = qp;@@ -194,12 +270,6 @@ ipsec_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, goto qp_setup_cleanup; } - qp->mb_mgr =alloc_init_mb_mgr (); -if (!qp->mb_mgr) { - ret = -ENOMEM ; - goto qp_setup_cleanup; - } -memset (&qp->stats,0 ,sizeof (qp->stats));drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c +7
-0if (pmd_data->queue_pair_configure) {@@ -211,8 +281,15 @@ ipsec_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, return 0; qp_setup_cleanup: +#if IMB_VERSION (1 ,1 ,0 ) >IMB_VERSION_NUM if (qp->mb_mgr)free_mb_mgr (qp->mb_mgr); +#else +if (rte_eal_process_type () ==RTE_PROC_SECONDARY ) +return ret; +if (qp->mb_mgr_mz) +rte_memzone_free (qp->mb_mgr_mz); +#endif if (qp)rte_free (qp);drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_ops.c +1
-0return ret;@@ -269,6 +346,7 @@ ipsec_mb_pmd_sym_session_configure(set_sym_session_private_data (sess, dev->driver_id, sess_private_data); +free_mb_mgr (mb_mgr);return 0 ; }drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h +5
-1@@ -18,6 +18,9 @@/* Maximum length for digest */ #define DIGEST_LENGTH_MAX 64 +/* Maximum length for memzone name */ +#define IPSEC_MB_MAX_MZ_NAME 32 +enum ipsec_mb_vector_mode {IPSEC_MB_NOT_SUPPORTED =0 ,IPSEC_MB_SSE ,@@ -95,6 +98,8 @@ struct ipsec_mb_qp {*/ IMB_MGR *mb_mgr;/* Multi buffer manager */ +const struct rte_memzone *mb_mgr_mz; +/* Shared memzone for storing mb_mgr */ __extension__uint8_t additional_data[0 ];/**< Storing PMD specific additional data */ }; --2.25.1
PATCH v3 3/10 drivers/crypto: move aesni-mb PMD to IPsec-mb framework
In reply to Ciara PowerFrom: Piotr Bronowski <[email protected]>
This patch removes the crypto/aesni_mb folder and gathers all aesni-mb PMD implementation specific details into a single file, pmd_aesni_mb.c in crypto/ipsec_mb.
Now that intel-ipsec-mb v1.0 is the minimum supported version, old macros can be replaced with the newer macros supported by this version.
---
v3:
- Updated intel-ipsec-mb library macros.
- Fixed some formatting.
v2: Updated maintainers file.
--- MAINTAINERS | 10 +- doc/guides/cryptodevs/aesni_mb.rst | 4 +- .../crypto/aesni_mb/aesni_mb_pmd_private.h | 337 -- drivers/crypto/aesni_mb/meson.build | 25 - drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 2232 ------------ .../crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 1126 ------- drivers/crypto/aesni_mb/version.map | 3 - drivers/crypto/ipsec_mb/meson.build | 1 + drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 2977 +++++++++++++++++ drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c | 7 +- .../ipsec_mb/rte_ipsec_mb_pmd_private.h | 143 +- drivers/crypto/meson.build | 1 - 12 files changed, 3131 insertions(+), 3735 deletions(-) delete mode 100644 drivers/crypto/aesni_mb/aesni_mb_pmd_private.h delete mode 100644 drivers/crypto/aesni_mb/meson.build delete mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c delete mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c delete mode 100644 drivers/crypto/aesni_mb/version.map create mode 100644 drivers/crypto/ipsec_mb/pmd_aesni_mb.c
MAINTAINERS +3 -7
@@ -1049,13 +1049,6 @@ F: drivers/crypto/aesni_gcm/ F: doc/guides/cryptodevs/aesni_gcm.rst F: doc/guides/cryptodevs/features/aesni_gcm.ini -Intel AES-NI Multi-Buffer -M: Declan Doherty <[email protected]> -M: Pablo de Lara <[email protected]> -F: drivers/crypto/aesni_mb/ -F: doc/guides/cryptodevs/aesni_mb.rst -F: doc/guides/cryptodevs/features/aesni_mb.ini - Intel QuickAssist M: John Griffin <[email protected]> M: Fiona Trahe <[email protected]>
@@ -1067,7 +1060,10 @@ F: doc/guides/cryptodevs/features/qat.ini IPsec MB M: Fan Zhang <[email protected]> +M: Pablo de Lara <[email protected]> F: drivers/crypto/ipsec_mb/ +F: doc/guides/cryptodevs/aesni_mb.rst +F: doc/guides/cryptodevs/features/aesni_mb.ini KASUMI M: Pablo de Lara <[email protected]>
doc/guides/cryptodevs/aesni_mb.rst +3 -1
@@ -130,7 +130,9 @@ and the Multi-Buffer library version supported by them: 18.02 0.48 18.05 - 19.02 0.49 - 0.52 19.05 - 19.08 0.52 - 19.11+ 0.52 - 1.0* + 19.11 - 20.08 0.52 - 0.55 + 20.11 - 21.08 0.53 - 1.0* + 21.11+ 1.0* ============== ============================ \* Multi-buffer library 1.0 or newer only works for Meson but not Make build system.
drivers/crypto/aesni_mb/aesni_mb_pmd_private.h deleted +0 -337
337 lines not on this page · raw message
drivers/crypto/aesni_mb/meson.build deleted +0 -25
@@ -1,25 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2018 Intel Corporation - -IMB_required_ver = '0.52.0' -lib = cc.find_library('IPSec_MB', required: false) -if not lib.found() - build = false - reason = 'missing dependency, "libIPSec_MB"' -else - ext_deps += lib - - # version comes with quotes, so we split based on " and take the middle - imb_ver = cc.get_define('IMB_VERSION_STR', - prefix : '#include<intel-ipsec-mb.h>').split('"')[1] - - if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver)) - reason = 'IPSec_MB version >= @0@ is required, found version @1@'.format( - IMB_required_ver, imb_ver) - build = false - endif - -endif - -sources = files('rte_aesni_mb_pmd.c', 'rte_aesni_mb_pmd_ops.c') -deps += ['bus_vdev', 'net', 'security']
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c deleted +0 -2232
2,232 lines not on this page · raw message
drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c deleted +0 -1126
373 lines not on this page · raw message
drivers/crypto/aesni_mb/version.map deleted +0 -3
Lines of this file are not shown. View the raw message.
drivers/crypto/ipsec_mb/pmd_aesni_mb.c new file +2977 -0
2,977 lines not on this page · raw message
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd.c +5 -2
Lines of this file are not shown. View the raw message.
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h +142 -1
143 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.25.1
Part of the diff is not shown here. View the raw message.
Re: [dpdk-dev] [PATCH v3 03/10] drivers/crypto: move aesni-mb PMD to IPsec-mb framework
Quoted 26 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 29, 2021 5:30 PM
To: [email protected]
Cc: Zhang, Roy Fan <[email protected]>; Bronowski, PiotrX <[email protected]>; [email protected]; Power, Ciara <[email protected]>; Thomas Monjalon <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Ray Kinsella <[email protected]>
Subject: [PATCH v3 03/10]drivers/crypto: move aesni-mb PMD to IPsec-mb frameworkFrom: Piotr Bronowski <[email protected]>
This patch removes the
crypto/aesni_mbfolder and gathers all aesni-mb PMD implementation specific details into a single file,pmd_aesni_mb.cincrypto/ipsec_mb.Now that intel-ipsec-mb v1.0 is the minimum supported version, old macros can be replaced with the newer macros supported by this version.
Signed-off-by Piotr Bronowski <[email protected]>Signed-off-by Ciara Power <[email protected]>
...
Quoted 2 lines
deps += ['
bus_vdev', 'net', 'security'](quoted diff) +0
-0
...
Quoted 8 lines
drivers/crypto/ipsec_mb/pmd_aesni_mb.c new file +3
-0+ .xform_type = RTE_CRYPTO_SYM_XFORM_AEAD, + {.aead = { + .algo =
RTE_CRYPTO_AEAD_CHACHA20_POLY1305,drivers/crypto/ipsec_mb/pmd_aesni_mb.c new file +4
-0+ .block_size = 64, + .key_size = { + .min = 32, + .max = 32,
drivers/crypto/ipsec_mb/pmd_aesni_mb.c line 667
Quoted 10 lines
drivers/crypto/ipsec_mb/pmd_aesni_mb.c new file +10
-0+ .increment = 0 + }, + .digest_size = { + .min = 16, + .max = 16, + .increment =0 + }, + .aad_size = { + .min = 0, + .max = 240,
We support more than 240 bytes of AAD. I think we can support up to 1024 bytes. Could you change it here?
Quoted 11 lines
drivers/crypto/ipsec_mb/pmd_aesni_mb.c new file +11
-0+ .increment = 1 + }, + .iv_size = { + .min = 12, + .max = 12, + .increment = 0 + }, + }, } + }, } + }, +RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST ()
...
Quoted 2 lines
drivers/crypto/ipsec_mb/pmd_aesni_mb.c new file +2
-0+static int +aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr,
...
Quoted 13 lines
(quoted diff) +2
-0+ case IMB_KEY_192_BYTES: + IMB_AES192_GCM_PRE(mb_mgr, xform-Quoted 1 line
auth.key.data,
(quoted diff) +2
-0+ &sess->cipher.gcm_key); + sess->cipher.key_length_in_bytes =
IMB_KEY_192_BYTES;drivers/crypto/ipsec_mb/pmd_aesni_mb.c new file +3
-0+break ; +case IMB_KEY_256_BYTES : + IMB_AES256_GCM_PRE(mb_mgr, xform-Quoted 1 line
auth.key.data,
(quoted diff) +2
-0+ &sess->cipher.gcm_key); + sess->cipher.key_length_in_bytes =
IMB_KEY_256_BYTES;
drivers/crypto/ipsec_mb/pmd_aesni_mb.c line 1083
Quoted 3 lines
drivers/crypto/ipsec_mb/pmd_aesni_mb.c new file +3
-0+break ; +default : +RTE_LOG (ERR ,PMD ,"failed to parse test type\n" );
Wrong error message. This should say something like "Wrong authentication key length". Also, the same message is present for the cipher key length, for GCM.
Thanks,
Pablo
PATCH v3 4/10 drivers/crypto: move aesni-gcm PMD to IPsec-mb framework
In reply to Ciara PowerFrom: Piotr Bronowski <[email protected]>
This patch removes the crypto/aesni_gcm folder and gathers all aesni-gcm PMD implementation specific details into a single file, pmd_aesni_gcm.c in the crypto/ipsec_mb folder.
A redundant check for iv length is removed.
GCM ops are stored in the queue pair for multi process support, they are updated during queue pair setup for both primary and secondary processes.
GCM ops are also set per lcore for the CPU crypto mode.
---
v3:
- Moved session GCM ops to queue pair.
- Added GCM ops per lcore.
- Fixed some formatting.
v2:
- Fixed enum for GCM key length.
- Updated maintainers file.
--- MAINTAINERS | 9 +- doc/guides/cryptodevs/aesni_gcm.rst | 4 +- drivers/crypto/aesni_gcm/aesni_gcm_ops.h | 104 -- drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 984 ---------------- drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c | 333 ------ .../crypto/aesni_gcm/aesni_gcm_pmd_private.h | 123 -- drivers/crypto/aesni_gcm/meson.build | 24 - drivers/crypto/aesni_gcm/version.map | 3 - drivers/crypto/ipsec_mb/meson.build | 3 +- drivers/crypto/ipsec_mb/pmd_aesni_gcm.c | 1003 +++++++++++++++++ .../ipsec_mb/rte_ipsec_mb_pmd_private.h | 7 + drivers/crypto/meson.build | 1 - 12 files changed, 1017 insertions(+), 1581 deletions(-) delete mode 100644 drivers/crypto/aesni_gcm/aesni_gcm_ops.h delete mode 100644 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c delete mode 100644 drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c delete mode 100644 drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h delete mode 100644 drivers/crypto/aesni_gcm/meson.build delete mode 100644 drivers/crypto/aesni_gcm/version.map create mode 100644 drivers/crypto/ipsec_mb/pmd_aesni_gcm.c
MAINTAINERS +2 -7
@@ -1042,13 +1042,6 @@ M: Fan Zhang <[email protected]> F: drivers/crypto/scheduler/ F: doc/guides/cryptodevs/scheduler.rst -Intel AES-NI GCM -M: Declan Doherty <[email protected]> -M: Pablo de Lara <[email protected]> -F: drivers/crypto/aesni_gcm/ -F: doc/guides/cryptodevs/aesni_gcm.rst -F: doc/guides/cryptodevs/features/aesni_gcm.ini - Intel QuickAssist M: John Griffin <[email protected]> M: Fiona Trahe <[email protected]>
@@ -1062,7 +1055,9 @@ IPsec MB M: Fan Zhang <[email protected]> M: Pablo de Lara <[email protected]> F: drivers/crypto/ipsec_mb/ +F: doc/guides/cryptodevs/aesni_gcm.rst F: doc/guides/cryptodevs/aesni_mb.rst +F: doc/guides/cryptodevs/features/aesni_gcm.ini F: doc/guides/cryptodevs/features/aesni_mb.ini KASUMI
doc/guides/cryptodevs/aesni_gcm.rst +3 -1
@@ -83,7 +83,9 @@ and the external crypto libraries supported by them: 17.02 - 17.05 ISA-L Crypto v2.18 17.08 - 18.02 Multi-buffer library 0.46 - 0.48 18.05 - 19.02 Multi-buffer library 0.49 - 0.52 - 19.05+ Multi-buffer library 0.52 - 1.0* + 19.05 - 20.08 Multi-buffer library 0.52 - 0.55 + 20.11 - 21.08 Multi-buffer library 0.53 - 1.0* + 21.11+ Multi-buffer library 1.0* ============= ================================ \* Multi-buffer library 1.0 or newer only works for Meson but not Make build system.
drivers/crypto/aesni_gcm/aesni_gcm_ops.h deleted +0 -104
104 lines not on this page · raw message
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c deleted +0 -984
984 lines not on this page · raw message
drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c deleted +0 -333
333 lines not on this page · raw message
drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h deleted +0 -123
123 lines not on this page · raw message
drivers/crypto/aesni_gcm/meson.build deleted +0 -24
@@ -1,24 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2018 Intel Corporation - -IMB_required_ver = '0.52.0' -lib = cc.find_library('IPSec_MB', required: false) -if not lib.found() - build = false - reason = 'missing dependency, "libIPSec_MB"' -else - ext_deps += lib - - # version comes with quotes, so we split based on " and take the middle - imb_ver = cc.get_define('IMB_VERSION_STR', - prefix : '#include<intel-ipsec-mb.h>').split('"')[1] - - if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver)) - reason = 'IPSec_MB version >= @0@ is required, found version @1@'.format( - IMB_required_ver, imb_ver) - build = false - endif -endif - -sources = files('aesni_gcm_pmd.c', 'aesni_gcm_pmd_ops.c') -deps += ['bus_vdev']
drivers/crypto/aesni_gcm/version.map deleted +0 -3
@@ -1,3 +0,0 @@ -DPDK_22 { - local: *; -};
drivers/crypto/ipsec_mb/meson.build +2 -1
@@ -23,6 +23,7 @@ endif sources = files('rte_ipsec_mb_pmd.c', 'rte_ipsec_mb_pmd_ops.c', - 'pmd_aesni_mb.c' + 'pmd_aesni_mb.c', + 'pmd_aesni_gcm.c' ) deps += ['bus_vdev', 'net', 'security']
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c new file +1003 -0
1,003 lines not on this page · raw message
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h +7 -0
@@ -37,6 +37,9 @@ extern RTE_DEFINE_PER_LCORE(IMB_MGR *, mb_mgr);#define CRYPTODEV_NAME_AESNI_MB_PMD crypto_aesni_mb/**< IPSEC Multi buffer aesni_mb PMD device name */ +#define CRYPTODEV_NAME_AESNI_GCM_PMD crypto_aesni_gcm +/**< IPSEC Multi buffer PMD aesni_gcm device name */ +/** PMD LOGTYPE DRIVER, common to all PMDs */ extern int ipsec_mb_logtype_driver;#define IPSEC_MB_LOG (level, fmt, ...) \
@@ -46,6 +49,7 @@ extern int ipsec_mb_logtype_driver;/** All supported device types */ enum ipsec_mb_pmd_types {IPSEC_MB_PMD_TYPE_AESNI_MB =0 , +IPSEC_MB_PMD_TYPE_AESNI_GCM ,IPSEC_MB_N_PMD_TYPES };
@@ -65,6 +69,7 @@ enum ipsec_mb_operation { };extern uint8_t pmd_driver_id_aesni_mb; +extern uint8_t pmd_driver_id_aesni_gcm;/** Helper function. Gets driver ID based on PMD type */ static __rte_always_inline uint8_t
@@ -73,6 +78,8 @@ ipsec_mb_get_driver_id(enum ipsec_mb_pmd_types pmd_type)switch (pmd_type) {case IPSEC_MB_PMD_TYPE_AESNI_MB :return pmd_driver_id_aesni_mb; +case IPSEC_MB_PMD_TYPE_AESNI_GCM : +return pmd_driver_id_aesni_gcm;default :break ; }
drivers/crypto/meson.build +0 -1
@@ -7,7 +7,6 @@ endif drivers = [ 'ipsec_mb', - 'aesni_gcm', 'armv8', 'bcmfs', 'caam_jr',
Signature · 1 line
2.25.1
Re: [dpdk-dev] [EXT] [PATCH v3 04/10] drivers/crypto: move aesni-gcm PMD to IPsec-mb framework
Quoted 21 lines
drivers/crypto/ipsec_mb/meson.build +2
-1@@ -23,6 +23,7 @@ endif sources = files('rte_ipsec_mb_pmd.c', 'rte_ipsec_mb_pmd_ops.c', - 'pmd_aesni_mb.c' + 'pmd_aesni_mb.c', + 'pmd_aesni_gcm.c' ) deps += ['bus_vdev', 'net', 'security']drivers/crypto/ipsec_mb/pmd_aesni_gcm.c new file +0
-0
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c line 2
Quoted 2 lines
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c new file +2
-0@@ -0,0 +1,1003 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2021 Intel Corporation
Copyright years are different from the original file
Quoted 166 lines
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c new file +94
-0+*/ + +#include <intel-ipsec-mb.h> + +#if defined(RTE_LIB_SECURITY ) +#define AESNI_MB_DOCSIS_SEC_ENABLED 1 +#include <rte_ether.h> +#include <rte_security.h> +#include <rte_security_driver.h> +#endif + +#include "rte_ipsec_mb_pmd_private.h" + +#define AESNI_GCM_IV_LENGTH 12 + +static const struct rte_cryptodev_capabilities aesni_gcm_capabilities[] = { + {/* AES GMAC (AUTH) */ + .op =RTE_CRYPTO_OP_TYPE_SYMMETRIC , + {.sym = { + .xform_type =RTE_CRYPTO_SYM_XFORM_AUTH , + {.auth = { + .algo =RTE_CRYPTO_AUTH_AES_GMAC , + .block_size =16 , + .key_size = { + .min =16 , + .max =32 , + .increment =8 + }, + .digest_size = { + .min =1 , + .max =16 , + .increment =1 + }, + .iv_size = { + .min =AESNI_GCM_IV_LENGTH , + .max =AESNI_GCM_IV_LENGTH , + .increment =0 + } + }, } + }, } + }, + {/* AES GCM */ + .op =RTE_CRYPTO_OP_TYPE_SYMMETRIC , + {.sym = { + .xform_type =RTE_CRYPTO_SYM_XFORM_AEAD , + {.aead = { + .algo =RTE_CRYPTO_AEAD_AES_GCM , + .block_size =16 , + .key_size = { + .min =16 , + .max =32 , + .increment =8 + }, + .digest_size = { + .min =1 , + .max =16 , + .increment =1 + }, + .aad_size = { + .min =0 , + .max =65535 , + .increment =1 + }, + .iv_size = { + .min =AESNI_GCM_IV_LENGTH , + .max =AESNI_GCM_IV_LENGTH , + .increment =0 + } + }, } + }, } + }, +RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST () +}; + +uint8_t pmd_driver_id_aesni_gcm; + +enum aesni_gcm_key_length { +GCM_KEY_128 =0 , +GCM_KEY_192 , +GCM_KEY_256 , +GCM_NUM_KEY_TYPES +}; + +typedef void (*aesni_gcm_t )(const struct gcm_key_data *gcm_key_data, +struct gcm_context_data *gcm_ctx_data, +uint8_t *out,const uint8_t *in, +uint64_t plaintext_len,const uint8_t *iv, +const uint8_t *aad,uint64_t aad_len, +uint8_t *auth_tag,uint64_t auth_tag_len); + +typedef void (*aesni_gcm_pre_t )(const void *key, +struct gcm_key_data *gcm_data); + +typedef void (*aesni_gcm_init_t)(const struct gcm_key_data
*gcm_key_data,drivers/crypto/ipsec_mb/pmd_aesni_gcm.c new file +5
-0+struct gcm_context_data *gcm_ctx_data, + const uint8_t *iv, uint8_t const *aad, + uint64_t aad_len); + +typedef void (*aesni_gcm_update_t)(const struct gcm_key_data
*gcm_key_data,drivers/crypto/ipsec_mb/pmd_aesni_gcm.c new file +5
-0+struct gcm_context_data *gcm_ctx_data, + uint8_t *out, const uint8_t *in, + uint64_t plaintext_len); + +typedef void (*aesni_gcm_finalize_t)(const struct gcm_key_data
*gcm_key_data,drivers/crypto/ipsec_mb/pmd_aesni_gcm.c new file +4
-0+struct gcm_context_data *gcm_ctx_data, + uint8_t *auth_tag, uint64_t auth_tag_len); + +typedef void (*aesni_gmac_init_t)(const struct gcm_key_data
*gcm_key_data,drivers/crypto/ipsec_mb/pmd_aesni_gcm.c new file +4
-0+struct gcm_context_data *gcm_ctx_data, + const uint8_t *iv, const uint64_t iv_len); + +typedef void (*aesni_gmac_update_t)(const struct gcm_key_data
*gcm_key_data,drivers/crypto/ipsec_mb/pmd_aesni_gcm.c new file +5
-0+struct gcm_context_data *gcm_ctx_data, + const uint8_t *in, + const uint64_t plaintext_len); + +typedef void (*aesni_gmac_finalize_t)(const struct gcm_key_data
*gcm_key_data,drivers/crypto/ipsec_mb/pmd_aesni_gcm.c new file +20
-0+struct gcm_context_data *gcm_ctx_data, + uint8_t *auth_tag, + const uint64_t auth_tag_len); + +/** GCM operation handlers */ +struct aesni_gcm_ops { +aesni_gcm_t enc; +aesni_gcm_t dec; +aesni_gcm_pre_t pre; +aesni_gcm_init_t init; +aesni_gcm_update_t update_enc; +aesni_gcm_update_t update_dec; +aesni_gcm_finalize_t finalize_enc; +aesni_gcm_finalize_t finalize_dec; +aesni_gmac_init_t gmac_init; +aesni_gmac_update_t gmac_update; +aesni_gmac_finalize_t gmac_finalize; +}; + +RTE_DEFINE_PER_LCORE(struct aesni_gcm_ops[GCM_NUM_KEY_TYPES],
gcm_ops);drivers/crypto/ipsec_mb/pmd_aesni_gcm.c new file +22
-0+ +struct aesni_gcm_qp_data { +struct gcm_context_data gcm_ctx_data; +uint8_t temp_digest[DIGEST_LENGTH_MAX ]; +/* *< Buffers used to store the digest generated +* by the driver when verifying a digest provided +* by the user (using authentication verify operation) +*/ +struct aesni_gcm_ops ops[GCM_NUM_KEY_TYPES ]; +/**< Operation Handlers */ +}; + +/** AESNI GCM private session structure */ +struct aesni_gcm_session { +struct { +uint16_t length; +uint16_t offset; + } iv; +/**< IV parameters */ +uint16_t aad_length; +/**< AAD length */ +uint16_t req_digest_length;
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c line 171
Quoted 10 lines
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c new file +10
-0+/**< Requested digest length */ +uint16_t gen_digest_length; +/**< Generated digest length */ +enum ipsec_mb_operation op; +/**< GCM operation type */ +struct gcm_key_data gdata_key; +/**< GCM parameters */ +enum aesni_gcm_key_length key_length; +/** Key Length */ +};
Is it not better to move the above code in a header file? aesni_gcm_priv.h ?? Similarly for others also?
PATCH v3 5/10 drivers/crypto: move kasumi PMD to IPsec-mb framework
In reply to Ciara PowerFrom: Piotr Bronowski <[email protected]>
This patch removes the crypto/kasumi folder and gathers all kasumi PMD implementation specific details into a single file, pmd_kasumi.c in the crypto/ipsec_mb folder.
---
v2: Updated maintainers file.
--- MAINTAINERS | 6 +- doc/guides/cryptodevs/kasumi.rst | 3 +- drivers/crypto/ipsec_mb/meson.build | 3 +- drivers/crypto/ipsec_mb/pmd_kasumi.c | 556 +++++++++++++++ .../ipsec_mb/rte_ipsec_mb_pmd_private.h | 7 + drivers/crypto/kasumi/kasumi_pmd_private.h | 81 --- drivers/crypto/kasumi/meson.build | 24 - drivers/crypto/kasumi/rte_kasumi_pmd.c | 642 ------------------ drivers/crypto/kasumi/rte_kasumi_pmd_ops.c | 316 --------- drivers/crypto/kasumi/version.map | 3 - drivers/crypto/meson.build | 1 - 11 files changed, 568 insertions(+), 1074 deletions(-) create mode 100644 drivers/crypto/ipsec_mb/pmd_kasumi.c delete mode 100644 drivers/crypto/kasumi/kasumi_pmd_private.h delete mode 100644 drivers/crypto/kasumi/meson.build delete mode 100644 drivers/crypto/kasumi/rte_kasumi_pmd.c delete mode 100644 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c delete mode 100644 drivers/crypto/kasumi/version.map
MAINTAINERS +1 -5
@@ -1057,13 +1057,9 @@ M: Pablo de Lara <[email protected]> F: drivers/crypto/ipsec_mb/ F: doc/guides/cryptodevs/aesni_gcm.rst F: doc/guides/cryptodevs/aesni_mb.rst +F: doc/guides/cryptodevs/kasumi.rst F: doc/guides/cryptodevs/features/aesni_gcm.ini F: doc/guides/cryptodevs/features/aesni_mb.ini - -KASUMI -M: Pablo de Lara <[email protected]> -F: drivers/crypto/kasumi/ -F: doc/guides/cryptodevs/kasumi.rst F: doc/guides/cryptodevs/features/kasumi.ini Marvell cnxk crypto
doc/guides/cryptodevs/kasumi.rst +2 -1
@@ -78,7 +78,8 @@ and the external crypto libraries supported by them: DPDK version Crypto library version ============= ================================ 16.11 - 19.11 LibSSO KASUMI - 20.02+ Multi-buffer library 0.53 - 1.0* + 20.02 - 21.08 Multi-buffer library 0.53 - 1.0* + 21.11+ Multi-buffer library 1.0* ============= ================================ \* Multi-buffer library 1.0 or newer only works for Meson but not Make build system.
drivers/crypto/ipsec_mb/meson.build +2 -1
@@ -24,6 +24,7 @@ endif sources = files('rte_ipsec_mb_pmd.c', 'rte_ipsec_mb_pmd_ops.c', 'pmd_aesni_mb.c', - 'pmd_aesni_gcm.c' + 'pmd_aesni_gcm.c', + 'pmd_kasumi.c' ) deps += ['bus_vdev', 'net', 'security']
drivers/crypto/ipsec_mb/pmd_kasumi.c new file +556 -0
556 lines not on this page · raw message
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h +7 -0
@@ -40,6 +40,9 @@ extern RTE_DEFINE_PER_LCORE(IMB_MGR *, mb_mgr);#define CRYPTODEV_NAME_AESNI_GCM_PMD crypto_aesni_gcm/**< IPSEC Multi buffer PMD aesni_gcm device name */ +#define CRYPTODEV_NAME_KASUMI_PMD crypto_kasumi +/**< IPSEC Multi buffer PMD kasumi device name */ +/** PMD LOGTYPE DRIVER, common to all PMDs */ extern int ipsec_mb_logtype_driver;#define IPSEC_MB_LOG (level, fmt, ...) \
@@ -50,6 +53,7 @@ extern int ipsec_mb_logtype_driver;enum ipsec_mb_pmd_types {IPSEC_MB_PMD_TYPE_AESNI_MB =0 ,IPSEC_MB_PMD_TYPE_AESNI_GCM , +IPSEC_MB_PMD_TYPE_KASUMI ,IPSEC_MB_N_PMD_TYPES };
@@ -70,6 +74,7 @@ enum ipsec_mb_operation {extern uint8_t pmd_driver_id_aesni_mb;extern uint8_t pmd_driver_id_aesni_gcm; +extern uint8_t pmd_driver_id_kasumi;/** Helper function. Gets driver ID based on PMD type */ static __rte_always_inline uint8_t
@@ -80,6 +85,8 @@ ipsec_mb_get_driver_id(enum ipsec_mb_pmd_types pmd_type)return pmd_driver_id_aesni_mb;case IPSEC_MB_PMD_TYPE_AESNI_GCM :return pmd_driver_id_aesni_gcm; +case IPSEC_MB_PMD_TYPE_KASUMI : +return pmd_driver_id_kasumi;default :break ; }
drivers/crypto/kasumi/kasumi_pmd_private.h deleted +0 -81
81 lines not on this page · raw message
drivers/crypto/kasumi/meson.build deleted +0 -24
@@ -1,24 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2018-2020 Intel Corporation - -IMB_required_ver = '0.53.0' -lib = cc.find_library('IPSec_MB', required: false) -if not lib.found() - build = false - reason = 'missing dependency, "libIPSec_MB"' -else - # version comes with quotes, so we split based on " and take the middle - imb_ver = cc.get_define('IMB_VERSION_STR', - prefix : '#include<intel-ipsec-mb.h>').split('"')[1] - - if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver)) - reason = 'IPSec_MB version >= @0@ is required, found version @1@'.format( - IMB_required_ver, imb_ver) - build = false - endif - -endif - -ext_deps += lib -sources = files('rte_kasumi_pmd.c', 'rte_kasumi_pmd_ops.c') -deps += ['bus_vdev']
drivers/crypto/kasumi/rte_kasumi_pmd.c deleted +0 -642
642 lines not on this page · raw message
drivers/crypto/kasumi/rte_kasumi_pmd_ops.c deleted +0 -316
316 lines not on this page · raw message
drivers/crypto/kasumi/version.map deleted +0 -3
@@ -1,3 +0,0 @@ -DPDK_22 { - local: *; -};
drivers/crypto/meson.build +0 -1
@@ -14,7 +14,6 @@ drivers = [ 'cnxk', 'dpaa_sec', 'dpaa2_sec', - 'kasumi', 'mlx5', 'mvsam', 'nitrox',
Signature · 1 line
2.25.1
PATCH v3 6/10 drivers/crypto: move snow3g PMD to IPsec-mb framework
In reply to Ciara PowerFrom: Piotr Bronowski <[email protected]>
This patch removes the crypto/snow3g folder and gathers all snow3g PMD implementation specific details into a single file, pmd_snow3g.c in the crypto/ipsec_mb folder.
---
v3: Removed extra empty lines.
v2: Updated maintainers file.
---
MAINTAINERS | 8 +-
doc/guides/cryptodevs/snow3g.rst | 3 +-
drivers/crypto/ipsec_mb/meson.build | 3 +-
.../pmd_snow3g.c} | 457 ++++++++----------
.../ipsec_mb/rte_ipsec_mb_pmd_private.h | 7 +
drivers/crypto/meson.build | 1 -
drivers/crypto/snow3g/meson.build | 24 -
drivers/crypto/snow3g/rte_snow3g_pmd_ops.c | 323 -------------
drivers/crypto/snow3g/snow3g_pmd_private.h | 84 ----
drivers/crypto/snow3g/version.map | 3 -
10 files changed, 205 insertions(+), 708 deletions(-)
rename drivers/crypto/{snow3g/rte_snow3g_pmd.c => ipsec_mb/pmd_snow3g.c} (57%)
delete mode 100644 drivers/crypto/snow3g/meson.build
delete mode 100644 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c
delete mode 100644 drivers/crypto/snow3g/snow3g_pmd_private.h
delete mode 100644 drivers/crypto/snow3g/version.mapMAINTAINERS +2 -6
@@ -1058,9 +1058,11 @@ F: drivers/crypto/ipsec_mb/ F: doc/guides/cryptodevs/aesni_gcm.rst F: doc/guides/cryptodevs/aesni_mb.rst F: doc/guides/cryptodevs/kasumi.rst +F: doc/guides/cryptodevs/snow3g.rst F: doc/guides/cryptodevs/features/aesni_gcm.ini F: doc/guides/cryptodevs/features/aesni_mb.ini F: doc/guides/cryptodevs/features/kasumi.ini +F: doc/guides/cryptodevs/features/snow3g.ini Marvell cnxk crypto M: Ankur Dwivedi <[email protected]>
@@ -1131,12 +1133,6 @@ F: drivers/crypto/openssl/ F: doc/guides/cryptodevs/openssl.rst F: doc/guides/cryptodevs/features/openssl.ini -SNOW 3G -M: Pablo de Lara <[email protected]> -F: drivers/crypto/snow3g/ -F: doc/guides/cryptodevs/snow3g.rst -F: doc/guides/cryptodevs/features/snow3g.ini - Virtio M: Jay Zhou <[email protected]> F: drivers/crypto/virtio/
doc/guides/cryptodevs/snow3g.rst +2 -1
@@ -77,7 +77,8 @@ and the external crypto libraries supported by them: DPDK version Crypto library version ============= ================================ 16.04 - 19.11 LibSSO SNOW3G - 20.02+ Multi-buffer library 0.53 - 1.0* + 20.02 - 21.08 Multi-buffer library 0.53 - 1.0* + 21.11+ Multi-buffer library 1.0* ============= ================================ \* Multi-buffer library 1.0 or newer only works for Meson but not Make build system.
drivers/crypto/ipsec_mb/meson.build +2 -1
@@ -25,6 +25,7 @@ sources = files('rte_ipsec_mb_pmd.c', 'rte_ipsec_mb_pmd_ops.c', 'pmd_aesni_mb.c', 'pmd_aesni_gcm.c', - 'pmd_kasumi.c' + 'pmd_kasumi.c', + 'pmd_snow3g.c' ) deps += ['bus_vdev', 'net', 'security']
drivers/crypto/ipsec_mb/pmd_snow3g.c renamed from drivers/crypto/snow3g/rte_snow3g_pmd.c +192 -265
685 lines not on this page · raw message
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h +7 -0
@@ -43,6 +43,9 @@ extern RTE_DEFINE_PER_LCORE(IMB_MGR *, mb_mgr);#define CRYPTODEV_NAME_KASUMI_PMD crypto_kasumi/**< IPSEC Multi buffer PMD kasumi device name */ +#define CRYPTODEV_NAME_SNOW3G_PMD crypto_snow3g +/**< IPSEC Multi buffer PMD snow3g device name */ +/** PMD LOGTYPE DRIVER, common to all PMDs */ extern int ipsec_mb_logtype_driver;#define IPSEC_MB_LOG (level, fmt, ...) \
@@ -54,6 +57,7 @@ enum ipsec_mb_pmd_types {IPSEC_MB_PMD_TYPE_AESNI_MB =0 ,IPSEC_MB_PMD_TYPE_AESNI_GCM ,IPSEC_MB_PMD_TYPE_KASUMI , +IPSEC_MB_PMD_TYPE_SNOW3G , IPSEC_MB_N_PMD_TYPES };
@@ -75,6 +79,7 @@ enum ipsec_mb_operation {extern uint8_t pmd_driver_id_aesni_mb;extern uint8_t pmd_driver_id_aesni_gcm;extern uint8_t pmd_driver_id_kasumi; +extern uint8_t pmd_driver_id_snow3g;/** Helper function. Gets driver ID based on PMD type */ static __rte_always_inline uint8_t
@@ -87,6 +92,8 @@ ipsec_mb_get_driver_id(enum ipsec_mb_pmd_types pmd_type)return pmd_driver_id_aesni_gcm;case IPSEC_MB_PMD_TYPE_KASUMI :return pmd_driver_id_kasumi; +case IPSEC_MB_PMD_TYPE_SNOW3G : +return pmd_driver_id_snow3g;default :break ; }
drivers/crypto/meson.build +0 -1
@@ -22,7 +22,6 @@ drivers = [ 'octeontx2', 'openssl', 'scheduler', - 'snow3g', 'virtio', 'zuc', ]
drivers/crypto/snow3g/meson.build deleted +0 -24
@@ -1,24 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2019-2020 Intel Corporation - -IMB_required_ver = '0.53.0' -lib = cc.find_library('IPSec_MB', required: false) -if not lib.found() - build = false - reason = 'missing dependency, "libIPSec_MB"' -else - # version comes with quotes, so we split based on " and take the middle - imb_ver = cc.get_define('IMB_VERSION_STR', - prefix : '#include<intel-ipsec-mb.h>').split('"')[1] - - if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver)) - reason = 'IPSec_MB version >= @0@ is required, found version @1@'.format( - IMB_required_ver, imb_ver) - build = false - endif - -endif - -ext_deps += lib -sources = files('rte_snow3g_pmd.c', 'rte_snow3g_pmd_ops.c') -deps += ['bus_vdev', 'cryptodev']
drivers/crypto/snow3g/rte_snow3g_pmd_ops.c deleted +0 -323
323 lines not on this page · raw message
drivers/crypto/snow3g/snow3g_pmd_private.h deleted +0 -84
84 lines not on this page · raw message
drivers/crypto/snow3g/version.map deleted +0 -3
@@ -1,3 +0,0 @@ -DPDK_22 { - local: *; -};
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v3 06/10] drivers/crypto: move snow3g PMD to IPsec-mb framework
Hi Ciara,
Quoted 46 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Wednesday, September 29, 2021 5:31 PM
To: [email protected]
Cc: Zhang, Roy Fan <[email protected]>; Bronowski, PiotrX <[email protected]>; [email protected]; Power, Ciara <[email protected]>; Thomas Monjalon <[email protected]>; De Lara Guarch, Pablo <[email protected]>; Ray Kinsella <[email protected]>
Subject: [PATCH v3 06/10]drivers/crypto: move snow3g PMD to IPsec-mb frameworkFrom: Piotr Bronowski <[email protected]>
This patch removes the
crypto/snow3gfolder and gathers all snow3g PMD implementation specific details into a single file,pmd_snow3g.cin thecrypto/ipsec_mbfolder.Signed-off-by Piotr Bronowski <[email protected]>Signed-off-by Ciara Power <[email protected]>---
v3: Removed extra empty lines.
v2: Updated maintainers file.--- MAINTAINERS | 8 +- doc/guides/cryptodevs/snow3g.rst | 3 +- drivers/crypto/ipsec_mb/meson.build | 3 +- .../pmd_snow3g.c} | 457 ++++++++---------- .../ipsec_mb/rte_ipsec_mb_pmd_private.h | 7 + drivers/crypto/meson.build | 1 - drivers/crypto/snow3g/meson.build | 24 - drivers/crypto/snow3g/rte_snow3g_pmd_ops.c | 323 ------------- drivers/crypto/snow3g/snow3g_pmd_private.h | 84 ---- drivers/crypto/snow3g/version.map | 3 - 10 files changed, 205 insertions(+), 708 deletions(-) rename drivers/crypto/{snow3g/rte_snow3g_pmd.c => ipsec_mb/pmd_snow3g.c} (57%) delete mode 100644 drivers/crypto/snow3g/meson.build delete mode 100644 drivers/crypto/snow3g/rte_snow3g_pmd_ops.c delete mode 100644 drivers/crypto/snow3g/snow3g_pmd_private.h delete mode 100644 drivers/crypto/snow3g/version.mapMAINTAINERS +0
-0
...
Quoted 7 lines
MAINTAINERS +2
-1- case SNOW3G_OP_AUTH_CIPHER: + case IPSEC_MB_OP_HASH_VERIFY_THEN_DECRYPT: + case IPSEC_MB_OP_HASH_GEN_THEN_ENCRYPT: processed_ops = process_snow3g_hash_op(qp, ops, session, num_ops); process_snow3g_cipher_op(qp, ops, session, processed_ops);
MAINTAINERS process_ops(struct rte_crypto_op **ops, struct · line 348
Quoted 7 lines
MAINTAINERS +1
-1@@ -358,9 +343,9 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session, } } - enqueued_ops = rte_ring_enqueue_burst(qp->processed_ops, + enqueued_ops = rte_ring_enqueue_burst(qp->ingress_queue, (void **)ops, processed_ops, NULL);
Looks like there is a bug here. We don't need to enqueue operations back in the ring here. We used to enqueue in the ring when crypto processing was done in enqueue, but now this is part of dequeue and we already dequeued the operations from the ring.
As far as I know, the only enqueue operation in the ring should be done in enqueue_burst.
Thanks,
Pablo
PATCH v3 7/10 crypto/ipsec_mb: add snow3g digest appended ops support
In reply to Ciara PowerFrom: Piotr Bronowski <[email protected]>
This patch enables out-of-place auth-cipher operations where digest should be encrypted along with the rest of raw data. It also adds support for partially encrypted digest when using auth-cipher operations.
---
v2: Added release note.
--- doc/guides/cryptodevs/features/snow3g.ini | 1 + doc/guides/rel_notes/release_21_11.rst | 7 + drivers/crypto/ipsec_mb/pmd_snow3g.c | 148 +++++++++++++++++++--- 3 files changed, 139 insertions(+), 17 deletions(-)
doc/guides/cryptodevs/features/snow3g.ini +1 -0
@@ -8,6 +8,7 @@ Symmetric crypto = Y Sym operation chaining = Y Symmetric sessionless = Y Non-Byte aligned data = Y +Digest encrypted = Y OOP LB In LB Out = Y ;
doc/guides/rel_notes/release_21_11.rst +7 -0
@@ -69,6 +69,13 @@ New Features This feature makes use of an intel-ipsec-mb API found in v1.1, which is the minimum required version to use this multi-process support. +* **Added digest appended ops support for Snow3G PMD.** + + * Added support for out-of-place auth-cipher operations that encrypt + the digest along with the rest of the raw data. + * Added support for partially encrypted digest when using auth-cipher + operations. + * **Updated Marvell cnxk crypto PMD.** * Added AES-CBC SHA1-HMAC support in lookaside protocol (IPsec) for CN10K.
drivers/crypto/ipsec_mb/pmd_snow3g.c +131 -17
219 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 8/10 drivers/crypto: move zuc PMD to IPsec-mb framework
In reply to Ciara PowerFrom: Piotr Bronowski <[email protected]>
This patch removes the crypto/zuc folder and gathers all zuc PMD implementation specific details into a single file, pmd_zuc.c in the crypto/ipsec_mb folder.
---
v2: Updated maintainers file.
---
MAINTAINERS | 8 +-
doc/guides/cryptodevs/zuc.rst | 3 +-
drivers/crypto/ipsec_mb/meson.build | 3 +-
.../{zuc/rte_zuc_pmd.c => ipsec_mb/pmd_zuc.c} | 459 +++++++-----------
.../ipsec_mb/rte_ipsec_mb_pmd_private.h | 7 +
drivers/crypto/meson.build | 1 -
drivers/crypto/zuc/meson.build | 24 -
drivers/crypto/zuc/rte_zuc_pmd_ops.c | 322 ------------
drivers/crypto/zuc/version.map | 3 -
drivers/crypto/zuc/zuc_pmd_private.h | 83 ----
10 files changed, 199 insertions(+), 714 deletions(-)
rename drivers/crypto/{zuc/rte_zuc_pmd.c => ipsec_mb/pmd_zuc.c} (50%)
delete mode 100644 drivers/crypto/zuc/meson.build
delete mode 100644 drivers/crypto/zuc/rte_zuc_pmd_ops.c
delete mode 100644 drivers/crypto/zuc/version.map
delete mode 100644 drivers/crypto/zuc/zuc_pmd_private.hMAINTAINERS +2 -6
@@ -1059,10 +1059,12 @@ F: doc/guides/cryptodevs/aesni_gcm.rst F: doc/guides/cryptodevs/aesni_mb.rst F: doc/guides/cryptodevs/kasumi.rst F: doc/guides/cryptodevs/snow3g.rst +F: doc/guides/cryptodevs/zuc.rst F: doc/guides/cryptodevs/features/aesni_gcm.ini F: doc/guides/cryptodevs/features/aesni_mb.ini F: doc/guides/cryptodevs/features/kasumi.ini F: doc/guides/cryptodevs/features/snow3g.ini +F: doc/guides/cryptodevs/features/zuc.ini Marvell cnxk crypto M: Ankur Dwivedi <[email protected]>
@@ -1139,12 +1141,6 @@ F: drivers/crypto/virtio/ F: doc/guides/cryptodevs/virtio.rst F: doc/guides/cryptodevs/features/virtio.ini -ZUC -M: Pablo de Lara <[email protected]> -F: drivers/crypto/zuc/ -F: doc/guides/cryptodevs/zuc.rst -F: doc/guides/cryptodevs/features/zuc.ini - Compression Drivers -------------------
doc/guides/cryptodevs/zuc.rst +2 -1
@@ -77,7 +77,8 @@ and the external crypto libraries supported by them: DPDK version Crypto library version ============= ================================ 16.11 - 19.11 LibSSO ZUC - 20.02+ Multi-buffer library 0.53 - 1.0* + 20.02 - 21.08 Multi-buffer library 0.53 - 1.0* + 21.11+ Multi-buffer library 1.0* ============= ================================ \* Multi-buffer library 1.0 or newer only works for Meson but not Make build system.
drivers/crypto/ipsec_mb/meson.build +2 -1
@@ -26,6 +26,7 @@ sources = files('rte_ipsec_mb_pmd.c', 'pmd_aesni_mb.c', 'pmd_aesni_gcm.c', 'pmd_kasumi.c', - 'pmd_snow3g.c' + 'pmd_snow3g.c', + 'pmd_zuc.c' ) deps += ['bus_vdev', 'net', 'security']
drivers/crypto/ipsec_mb/pmd_zuc.c renamed from drivers/crypto/zuc/rte_zuc_pmd.c +186 -273
629 lines not on this page · raw message
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h +7 -0
@@ -46,6 +46,9 @@ extern RTE_DEFINE_PER_LCORE(IMB_MGR *, mb_mgr);#define CRYPTODEV_NAME_SNOW3G_PMD crypto_snow3g/**< IPSEC Multi buffer PMD snow3g device name */ +#define CRYPTODEV_NAME_ZUC_PMD crypto_zuc +/**< IPSEC Multi buffer PMD zuc device name */ +/** PMD LOGTYPE DRIVER, common to all PMDs */ extern int ipsec_mb_logtype_driver;#define IPSEC_MB_LOG (level, fmt, ...) \
@@ -58,6 +61,7 @@ enum ipsec_mb_pmd_types {IPSEC_MB_PMD_TYPE_AESNI_GCM ,IPSEC_MB_PMD_TYPE_KASUMI ,IPSEC_MB_PMD_TYPE_SNOW3G , +IPSEC_MB_PMD_TYPE_ZUC , IPSEC_MB_N_PMD_TYPES };
@@ -80,6 +84,7 @@ extern uint8_t pmd_driver_id_aesni_mb;extern uint8_t pmd_driver_id_aesni_gcm;extern uint8_t pmd_driver_id_kasumi;extern uint8_t pmd_driver_id_snow3g; +extern uint8_t pmd_driver_id_zuc;/** Helper function. Gets driver ID based on PMD type */ static __rte_always_inline uint8_t
@@ -94,6 +99,8 @@ ipsec_mb_get_driver_id(enum ipsec_mb_pmd_types pmd_type)return pmd_driver_id_kasumi;case IPSEC_MB_PMD_TYPE_SNOW3G :return pmd_driver_id_snow3g; +case IPSEC_MB_PMD_TYPE_ZUC : +return pmd_driver_id_zuc;default :break ; }
drivers/crypto/meson.build +0 -1
@@ -23,7 +23,6 @@ drivers = [ 'openssl', 'scheduler', 'virtio', - 'zuc', ] std_deps = ['cryptodev'] # cryptodev pulls in all other needed deps
drivers/crypto/zuc/meson.build deleted +0 -24
@@ -1,24 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2018-2020 Intel Corporation - -IMB_required_ver = '0.53.0' -lib = cc.find_library('IPSec_MB', required: false) -if not lib.found() - build = false - reason = 'missing dependency, "libIPSec_MB"' -else - # version comes with quotes, so we split based on " and take the middle - imb_ver = cc.get_define('IMB_VERSION_STR', - prefix : '#include<intel-ipsec-mb.h>').split('"')[1] - - if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver)) - reason = 'IPSec_MB version >= @0@ is required, found version @1@'.format( - IMB_required_ver, imb_ver) - build = false - endif - -endif - -ext_deps += lib -sources = files('rte_zuc_pmd.c', 'rte_zuc_pmd_ops.c') -deps += ['bus_vdev']
drivers/crypto/zuc/rte_zuc_pmd_ops.c deleted +0 -322
322 lines not on this page · raw message
drivers/crypto/zuc/version.map deleted +0 -3
@@ -1,3 +0,0 @@ -DPDK_22 { - local: *; -};
drivers/crypto/zuc/zuc_pmd_private.h deleted +0 -83
83 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 9/10 crypto/ipsec_mb: add chacha20-poly1305 PMD to framework
In reply to Ciara PowerFrom: Kai Ji <[email protected]>
Add in new chacha20_poly1305 support in ipsec_mb. Add in new chacha20_poly1305 test vector for SGL test.
---
v3:
- Fixed some formatting.
- Removed unnecessary get session function.
v2:
- Added unused tag to session configure parameter.
- Added release note.
- Added documentation for PMD.
--- app/test/test_cryptodev.c | 23 + app/test/test_cryptodev.h | 1 + app/test/test_cryptodev_aead_test_vectors.h | 114 +++++ doc/guides/cryptodevs/chacha20_poly1305.rst | 99 ++++ .../cryptodevs/features/chacha20_poly1305.ini | 35 ++ doc/guides/cryptodevs/index.rst | 1 + doc/guides/rel_notes/release_21_11.rst | 5 + drivers/crypto/ipsec_mb/meson.build | 1 + drivers/crypto/ipsec_mb/pmd_chacha_poly.c | 482 ++++++++++++++++++ .../ipsec_mb/rte_ipsec_mb_pmd_private.h | 7 + 10 files changed, 768 insertions(+) create mode 100644 doc/guides/cryptodevs/chacha20_poly1305.rst create mode 100644 doc/guides/cryptodevs/features/chacha20_poly1305.ini create mode 100644 drivers/crypto/ipsec_mb/pmd_chacha_poly.c
app/test/test_cryptodev.c +23 -0
@@ -13455,6 +13455,14 @@ test_chacha20_poly1305_decrypt_test_case_rfc8439(void)return test_authenticated_decryption (&chacha20_poly1305_case_rfc8439); } +static int +test_chacha20_poly1305_encrypt_SGL_out_of_place (void ) +{ +return test_authenticated_encryption_SGL ( + &chacha20_poly1305_case_2,OUT_OF_PLACE ,32 , + chacha20_poly1305_case_2.plaintext.len); +} +#ifdef RTE_CRYPTO_SCHEDULER /* global AESNI worker IDs for the scheduler test */
@@ -14063,6 +14071,8 @@ static struct unit_test_suite cryptodev_chacha20_poly1305_testsuite = { test_chacha20_poly1305_encrypt_test_case_rfc8439),TEST_CASE_ST (ut_setup, ut_teardown, test_chacha20_poly1305_decrypt_test_case_rfc8439), +TEST_CASE_ST (ut_setup, ut_teardown, + test_chacha20_poly1305_encrypt_SGL_out_of_place), TEST_CASES_END() } };
@@ -14629,6 +14639,17 @@ test_cryptodev_cpu_aesni_mb(void)return rc; } +static int +test_cryptodev_chacha_poly_mb (void ) +{ +int32_t rc; +enum rte_security_session_action_type at = gbl_action_type; + rc =run_cryptodev_testsuite ( +RTE_STR (CRYPTODEV_NAME_CHACHA20_POLY1305_PMD )); + gbl_action_type = at; +return rc; +} +static int test_cryptodev_openssl (void ) {
@@ -14888,6 +14909,8 @@ REGISTER_TEST_COMMAND(cryptodev_qat_autotest, test_cryptodev_qat);REGISTER_TEST_COMMAND (cryptodev_aesni_mb_autotest, test_cryptodev_aesni_mb);REGISTER_TEST_COMMAND (cryptodev_cpu_aesni_mb_autotest, test_cryptodev_cpu_aesni_mb); +REGISTER_TEST_COMMAND (cryptodev_chacha_poly_mb_autotest, + test_cryptodev_chacha_poly_mb);REGISTER_TEST_COMMAND (cryptodev_openssl_autotest, test_cryptodev_openssl);REGISTER_TEST_COMMAND (cryptodev_aesni_gcm_autotest, test_cryptodev_aesni_gcm); REGISTER_TEST_COMMAND(cryptodev_cpu_aesni_gcm_autotest,
app/test/test_cryptodev.h +1 -0
@@ -59,6 +59,7 @@#define CRYPTODEV_NAME_SNOW3G_PMD crypto_snow3g#define CRYPTODEV_NAME_KASUMI_PMD crypto_kasumi#define CRYPTODEV_NAME_ZUC_PMD crypto_zuc +#define CRYPTODEV_NAME_CHACHA20_POLY1305_PMD crypto_chacha20_poly1305#define CRYPTODEV_NAME_ARMV8_PMD crypto_armv8#define CRYPTODEV_NAME_DPAA_SEC_PMD crypto_dpaa_sec#define CRYPTODEV_NAME_DPAA2_SEC_PMD crypto_dpaa2_sec
app/test/test_cryptodev_aead_test_vectors.h +114 -0
118 lines not on this page · raw message
doc/guides/cryptodevs/chacha20_poly1305.rst new file +99 -0
99 lines not on this page · raw message
doc/guides/cryptodevs/features/chacha20_poly1305.ini new file +35 -0
@@ -0,0 +1,35 @@ +; +; Supported features of the 'chacha20_poly1305' crypto driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Symmetric crypto = Y +Sym operation chaining = Y +Symmetric sessionless = Y +Non-Byte aligned data = Y +In Place SGL = Y +OOP SGL In LB Out = Y +OOP LB In LB Out = Y +CPU crypto = Y + +; +; Supported crypto algorithms of the 'chacha20_poly1305' crypto driver. +; +[Cipher] + +; +; Supported authentication algorithms of the 'chacha20_poly1305' crypto driver. +; +[Auth] + +; +; Supported AEAD algorithms of the 'chacha20_poly1305' crypto driver. +; +[AEAD] +CHACHA20-POLY1305 = Y + +; +; Supported Asymmetric algorithms of the 'chacha20_poly1305' crypto driver. +; +[Asymmetric]
doc/guides/cryptodevs/index.rst +1 -0
@@ -16,6 +16,7 @@ Crypto Device Drivers bcmfs caam_jr ccp + chacha20_poly1305 cnxk dpaa2_sec dpaa_sec
doc/guides/rel_notes/release_21_11.rst +5 -0
@@ -76,6 +76,11 @@ New Features * Added support for partially encrypted digest when using auth-cipher operations. +* **Added Chacha20-poly1305 Crypto PMD.** + + * Added PMD to support chacha20-poly1305 algorithms to IPSec_MB PMD framework. + * Test vector added for chacha20-poly1305 SGL test. + * **Updated Marvell cnxk crypto PMD.** * Added AES-CBC SHA1-HMAC support in lookaside protocol (IPsec) for CN10K.
drivers/crypto/ipsec_mb/meson.build +1 -0
@@ -25,6 +25,7 @@ sources = files('rte_ipsec_mb_pmd.c', 'rte_ipsec_mb_pmd_ops.c', 'pmd_aesni_mb.c', 'pmd_aesni_gcm.c', + 'pmd_chacha_poly.c', 'pmd_kasumi.c', 'pmd_snow3g.c', 'pmd_zuc.c'
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +482 -0
482 lines not on this page · raw message
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h +7 -0
@@ -49,6 +49,9 @@ extern RTE_DEFINE_PER_LCORE(IMB_MGR *, mb_mgr);#define CRYPTODEV_NAME_ZUC_PMD crypto_zuc/**< IPSEC Multi buffer PMD zuc device name */ +#define CRYPTODEV_NAME_CHACHA20_POLY1305_PMD crypto_chacha20_poly1305 +/**< IPSEC Multi buffer PMD chacha20_poly1305 device name */ +/** PMD LOGTYPE DRIVER, common to all PMDs */ extern int ipsec_mb_logtype_driver;#define IPSEC_MB_LOG (level, fmt, ...) \
@@ -62,6 +65,7 @@ enum ipsec_mb_pmd_types {IPSEC_MB_PMD_TYPE_KASUMI ,IPSEC_MB_PMD_TYPE_SNOW3G ,IPSEC_MB_PMD_TYPE_ZUC , +IPSEC_MB_PMD_TYPE_CHACHA20_POLY1305 , IPSEC_MB_N_PMD_TYPES };
@@ -85,6 +89,7 @@ extern uint8_t pmd_driver_id_aesni_gcm;extern uint8_t pmd_driver_id_kasumi;extern uint8_t pmd_driver_id_snow3g;extern uint8_t pmd_driver_id_zuc; +extern uint8_t pmd_driver_id_chacha20_poly1305;/** Helper function. Gets driver ID based on PMD type */ static __rte_always_inline uint8_t
@@ -101,6 +106,8 @@ ipsec_mb_get_driver_id(enum ipsec_mb_pmd_types pmd_type)return pmd_driver_id_snow3g;case IPSEC_MB_PMD_TYPE_ZUC :return pmd_driver_id_zuc; +case IPSEC_MB_PMD_TYPE_CHACHA20_POLY1305 : +return pmd_driver_id_chacha20_poly1305;default :break ; }
Signature · 1 line
2.25.1
Re: [dpdk-dev] [EXT] [PATCH v3 09/10] crypto/ipsec_mb: add chacha20-poly1305 PMD to framework
Quoted 13 lines
From: Kai Ji <[email protected]>
Add in new
chacha20_poly1305support inipsec_mb. Add in newchacha20_poly1305test vector for SGL test.Signed-off-by Kai Ji <[email protected]>Signed-off-by Ciara Power <[email protected]>---
v3:
- Fixed some formatting.
- Removed unnecessary get session function.
Quoted 8 lines
v2:
- Added unused tag to session configure parameter.
- Added release note.
- Added documentation for PMD.--- app/test/test_cryptodev.c | 23 + app/test/test_cryptodev.h | 1 + app/test/test_cryptodev_aead_test_vectors.h | 114 +++++
Separate out test app changes from this patch.
Quoted 98 lines
doc/guides/cryptodevs/chacha20_poly1305.rst | 99 ++++ .../cryptodevs/features/chacha20_poly1305.ini | 35 ++ doc/guides/cryptodevs/index.rst | 1 + doc/guides/rel_notes/release_21_11.rst | 5 + drivers/crypto/ipsec_mb/meson.build | 1 + drivers/crypto/ipsec_mb/pmd_chacha_poly.c | 482 ++++++++++++++++++ .../ipsec_mb/rte_ipsec_mb_pmd_private.h | 7 + 10 files changed, 768 insertions(+) create mode 100644 doc/guides/cryptodevs/chacha20_poly1305.rst create mode 100644 doc/guides/cryptodevs/features/chacha20_poly1305.ini create mode 100644 drivers/crypto/ipsec_mb/pmd_chacha_poly.capp/test/test_cryptodev.c +8
-0@@ -13455,6 +13455,14 @@test_chacha20_poly1305_decrypt_test_case_rfc8439 (void ) returntest_authenticated_decryption (&chacha20_poly1305_case_rfc8439); } +static int +test_chacha20_poly1305_encrypt_SGL_out_of_place (void ) +{ +return test_authenticated_encryption_SGL ( + &chacha20_poly1305_case_2,OUT_OF_PLACE ,32 , + chacha20_poly1305_case_2.plaintext.len); +} +#ifdef RTE_CRYPTO_SCHEDULER /* global AESNI worker IDs for the scheduler test */
app/test/test_cryptodev.c +2
-0@@ -14063,6 +14071,8 @@ static struct unit_test_suite cryptodev_chacha20_poly1305_testsuite = { test_chacha20_poly1305_encrypt_test_case_rfc8439), TEST_CASE_ST(ut_setup, ut_teardown, test_chacha20_poly1305_decrypt_test_case_rfc8439), + TEST_CASE_ST(ut_setup, ut_teardown, +test_chacha20_poly1305_encrypt_SGL_out_of_place),app/test/test_cryptodev.c +11
-0TEST_CASES_END() } };@@ -14629,6 +14639,17 @@ test_cryptodev_cpu_aesni_mb(void)return rc; } +static int +test_cryptodev_chacha_poly_mb (void ) +{ +int32_t rc; +enum rte_security_session_action_type at = gbl_action_type; + rc =run_cryptodev_testsuite ( +RTE_STR (CRYPTODEV_NAME_CHACHA20_POLY1305_PMD )); + gbl_action_type = at; +return rc; +} +static int test_cryptodev_openssl (void ){
app/test/test_cryptodev.c +2
-0@@ -14888,6 +14909,8 @@REGISTER_TEST_COMMAND (cryptodev_qat_autotest, test_cryptodev_qat);REGISTER_TEST_COMMAND (cryptodev_aesni_mb_autotest, test_cryptodev_aesni_mb);REGISTER_TEST_COMMAND (cryptodev_cpu_aesni_mb_autotest, test_cryptodev_cpu_aesni_mb); +REGISTER_TEST_COMMAND (cryptodev_chacha_poly_mb_autotest, + test_cryptodev_chacha_poly_mb); REGISTER_TEST_COMMAND(cryptodev_openssl_autotest,
test_cryptodev_openssl);
REGISTER_TEST_COMMAND(cryptodev_aesni_gcm_autotest,test_cryptodev_aesni_gcm);
REGISTER_TEST_COMMAND(cryptodev_cpu_aesni_gcm_autotest,app/test/test_cryptodev.h +1
-0@@ -59,6 +59,7 @@#define CRYPTODEV_NAME_SNOW3G_PMD crypto_snow3g#define CRYPTODEV_NAME_KASUMI_PMD crypto_kasumi#define CRYPTODEV_NAME_ZUC_PMD crypto_zuc +#define CRYPTODEV_NAME_CHACHA20_POLY1305_PMD crypto_chacha20_poly1305#define CRYPTODEV_NAME_ARMV8_PMD crypto_armv8#define CRYPTODEV_NAME_DPAA_SEC_PMD crypto_dpaa_sec#define
CRYPTODEV_NAME_DPAA2_SEC_PMDcrypto_dpaa2_secapp/test/test_cryptodev_aead_test_vectors.h +0
-0
app/test/test_cryptodev_aead_test_vectors.h static const struct aead_test_data · line 3934
Quoted 5 lines
app/test/test_cryptodev_aead_test_vectors.h +1
-0@@ -3930,4 +3930,118 @@ static const struct aead_test_data chacha20_poly1305_case_rfc8439 = { .len = 16 } }; +
Any specific reason to add new vectors for chacha poly? Are the ones already present not enough?
Quoted 278 lines
app/test/test_cryptodev_aead_test_vectors.h +10
-0+static uint8_t chacha_aad_2[] = { +0xf3 ,0x33 ,0x88 ,0x86 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x4e ,0x91 +}; + +static const struct aead_test_data chacha20_poly1305_case_2 = { + .algo =RTE_CRYPTO_AEAD_CHACHA20_POLY1305 , + .key = { + .data = { +0x1c ,0x92 ,0x40 ,0xa5 ,0xeb ,0x55 ,0xd3 ,
0x8a,app/test/test_cryptodev_aead_test_vectors.h +2
-0+0xf3 ,0x33 ,0x88 ,0x86 ,0x04 ,0xf6 ,0xb5 ,0xf0 , + 0x47, 0x39, 0x17, 0xc1, 0x40, 0x2b, 0x80,
0x09,app/test/test_cryptodev_aead_test_vectors.h +7
-0+0x9d ,0xca ,0x5c ,0xbc ,0x20 ,0x70 ,0x75 ,0xc0 + }, + .len = 32 + }, + .iv = { + .data = { + 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03,
0x04,app/test/test_cryptodev_aead_test_vectors.h +11
-0+0x05 ,0x06 ,0x07 ,0x08 + }, + .len = 12 + }, + .aad = { + .data = chacha_aad_2, + .len = 12 + }, + .plaintext = { + .data = { + 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65,
0x74,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x2d, 0x44, 0x72, 0x61, 0x66, 0x74, 0x73,
0x20,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x61, 0x72, 0x65, 0x20, 0x64, 0x72, 0x61,
0x66,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x74, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d,
0x65,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x6e, 0x74, 0x73, 0x20, 0x76, 0x61, 0x6c,
0x69,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61,
0x20,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d,
0x20,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x6f, 0x66, 0x20, 0x73, 0x69, 0x78, 0x20,
0x6d,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x6f, 0x6e, 0x74, 0x68, 0x73, 0x20, 0x61,
0x6e,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x64, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62,
0x65,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
0x64,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x2c, 0x20, 0x72, 0x65, 0x70, 0x6c, 0x61,
0x63,app/test/test_cryptodev_aead_test_vectors.h +2
-0+0x65 ,0x64 ,0x2c ,0x20 ,0x6f ,0x72 ,0x20 ,0x6f , + 0x62, 0x73, 0x6f, 0x6c, 0x65, 0x74, 0x65,
0x64,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x20, 0x62, 0x79, 0x20, 0x6f, 0x74, 0x68,
0x65,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x72, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d,
0x65,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x6e, 0x74, 0x73, 0x20, 0x61, 0x74, 0x20,
0x61,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x6e, 0x79, 0x20, 0x74, 0x69, 0x6d, 0x65,
0x2e,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x20, 0x49, 0x74, 0x20, 0x69, 0x73, 0x20,
0x69,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x6e, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x70,
0x72,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x69, 0x61, 0x74, 0x65, 0x20, 0x74, 0x6f,
0x20,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x75, 0x73, 0x65, 0x20, 0x49, 0x6e, 0x74,
0x65,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x72, 0x6e, 0x65, 0x74, 0x2d, 0x44, 0x72,
0x61,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x66, 0x74, 0x73, 0x20, 0x61, 0x73, 0x20,
0x72,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
0x65,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69,
0x61,app/test/test_cryptodev_aead_test_vectors.h +2
-0+0x6c ,0x20 ,0x6f ,0x72 ,0x20 ,0x74 ,0x6f ,0x20 , + 0x63, 0x69, 0x74, 0x65, 0x20, 0x74, 0x68,
0x65,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x6d, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72,
0x20,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x74, 0x68, 0x61, 0x6e, 0x20, 0x61, 0x73,
0x20,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x2f, 0xe2, 0x80, 0x9c, 0x77, 0x6f, 0x72,
0x6b,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x20, 0x69, 0x6e, 0x20, 0x70, 0x72, 0x6f,
0x67,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x72, 0x65, 0x73, 0x73, 0x2e, 0x2f, 0xe2,
0x80,app/test/test_cryptodev_aead_test_vectors.h +7
-0+0x9d + }, + .len =265 + }, + .ciphertext = { + .data = { + 0x64, 0xa0, 0x86, 0x15, 0x75, 0x86, 0x1a,
0xf4,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x60, 0xf0, 0x62, 0xc7, 0x9b, 0xe6, 0x43,
0xbd,app/test/test_cryptodev_aead_test_vectors.h +2
-0+0x5e ,0x80 ,0x5c ,0xfd ,0x34 ,0x5c ,0xf3 ,0x89 , + 0xf1, 0x08, 0x67, 0x0a, 0xc7, 0x6c, 0x8c,
0xb2,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x4c, 0x6c, 0xfc, 0x18, 0x75, 0x5d, 0x43,
0xee,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0xa0, 0x9e, 0xe9, 0x4e, 0x38, 0x2d, 0x26,
0xb0,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0xbd, 0xb7, 0xb7, 0x3c, 0x32, 0x1b, 0x01,
0x00,app/test/test_cryptodev_aead_test_vectors.h +2
-0+0xd4 ,0xf0 ,0x3b ,0x7f ,0x35 ,0x58 ,0x94 ,0xcf , + 0x33, 0x2f, 0x83, 0x0e, 0x71, 0x0b, 0x97,
0xce,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x98, 0xc8, 0xa8, 0x4a, 0xbd, 0x0b, 0x94,
0x81,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x14, 0xad, 0x17, 0x6e, 0x00, 0x8d, 0x33,
0xbd,app/test/test_cryptodev_aead_test_vectors.h +3
-0+0x60 ,0xf9 ,0x82 ,0xb1 ,0xff ,0x37 ,0xc8 ,0x55 , +0x97 ,0x97 ,0xa0 ,0x6e ,0xf4 ,0xf0 ,0xef ,0x61 , + 0xc1, 0x86, 0x32, 0x4e, 0x2b, 0x35, 0x06,
0x38,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x36, 0x06, 0x90, 0x7b, 0x6a, 0x7c, 0x02,
0xb0,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0xf9, 0xf6, 0x15, 0x7b, 0x53, 0xc8, 0x67,
0xe4,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0xb9, 0x16, 0x6c, 0x76, 0x7b, 0x80, 0x4d,
0x46,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0xa5, 0x9b, 0x52, 0x16, 0xcd, 0xe7, 0xa4,
0xe9,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x90, 0x40, 0xc5, 0xa4, 0x04, 0x33, 0x22,
0x5e,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0xe2, 0x82, 0xa1, 0xb0, 0xa0, 0x6c, 0x52,
0x3e,app/test/test_cryptodev_aead_test_vectors.h +2
-0+0xaf ,0x45 ,0x34 ,0xd7 ,0xf8 ,0x3f ,0xa1 ,0x15 , + 0x5b, 0x00, 0x47, 0x71, 0x8c, 0xbc, 0x54,
0x6a,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x0d, 0x07, 0x2b, 0x04, 0xb3, 0x56, 0x4e,
0xea,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x1b, 0x42, 0x22, 0x73, 0xf5, 0x48, 0x27,
0x1a,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x0b, 0xb2, 0x31, 0x60, 0x53, 0xfa, 0x76,
0x99,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x19, 0x55, 0xeb, 0xd6, 0x31, 0x59, 0x43,
0x4e,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0xce, 0xbb, 0x4e, 0x46, 0x6d, 0xae, 0x5a,
0x10,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x73, 0xa6, 0x72, 0x76, 0x27, 0x09, 0x7a,
0x10,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x49, 0xe6, 0x17, 0xd9, 0x1d, 0x36, 0x10,
0x94,app/test/test_cryptodev_aead_test_vectors.h +2
-0+0xfa ,0x68 ,0xf0 ,0xff ,0x77 ,0x98 ,0x71 ,0x30 , + 0x30, 0x5b, 0xea, 0xba, 0x2e, 0xda, 0x04,
0xdf,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0x99, 0x7b, 0x71, 0x4d, 0x6c, 0x6f, 0x2c,
0x29,app/test/test_cryptodev_aead_test_vectors.h +1
-0+ 0xa6, 0xad, 0x5c, 0xb4, 0x02, 0x2b, 0x02,
0x70,app/test/test_cryptodev_aead_test_vectors.h +7
-0+0x9b + }, + .len =265 + }, + .auth_tag = { + .data = { + 0xee, 0xad, 0x9d, 0x67, 0x89, 0x0c, 0xbb,
0x22,app/test/test_cryptodev_aead_test_vectors.h +5
-0+0x39 ,0x23 ,0x36 ,0xfe ,0xa1 ,0x85 ,0x1f ,0x38 + }, + .len = 16 + } +};#endif /* TEST_CRYPTODEV_AEAD_TEST_VECTORS_H_ */ doc/guides/cryptodevs/chacha20_poly1305.rst new file +8
-0@@ -0,0 +1,99 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2016-2019 Intel Corporation. + +Chacha20-poly1305 Crypto Poll Mode Driver +========================================= + +The Chacha20-poly1305 PMD provides poll mode crypto driver support for +utilizing `Intel IPSec Multi-buffer library<https://urldefense.proofpoint.com/v2/url?u=https-
3A__github.com_01org_intel-2Dipsec- 2Dmb&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=DnL7Si2wl_PRwpZ9TWe y3eu68gBzn7DkPwuqhd6WNyo&m=cJBMpjPsWqfEmtw2rODDkdR7x3SsmW4 - 54dwxIGI6os&s=FrXg2cbYTOa7noqANBGmUQgdAVNCP8wTOBeCtjNkUH8&e=Quoted 1 line
`_.
doc/guides/cryptodevs/chacha20_poly1305.rst new file +15
-0+ +Features +-------- + +Chacha20-poly1305 PMD has support for: + +AEAD algorithms: + +* RTE_CRYPTO_AEAD_CHACHA20_POLY1305 + + +Installation +------------ + +To build DPDK with the Chacha20-poly1305 PMD the user is required todownload
+the multi-buffer library from `here
<https://urldefense.proofpoint.com/v2/url?u=https-
3A__github.com_01org_intel-2Dipsec- 2Dmb&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=DnL7Si2wl_PRwpZ9TWe y3eu68gBzn7DkPwuqhd6WNyo&m=cJBMpjPsWqfEmtw2rODDkdR7x3SsmW4 - 54dwxIGI6os&s=FrXg2cbYTOa7noqANBGmUQgdAVNCP8wTOBeCtjNkUH8&e=Quoted 1 line
`_
doc/guides/cryptodevs/chacha20_poly1305.rst new file +3
-0+and compile it on their user system before building DPDK. +The latest version of the library supported by this PMD is v1.0, which +can be downloaded from`<https://urldefense.proofpoint.com/v2/url?u=https- 3A__github.com_01org_intel-2Dipsec- 2Dmb_archive_v1.0.zip&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=DnL7Si 2wl_PRwpZ9TWey3eu68gBzn7DkPwuqhd6WNyo&m=cJBMpjPsWqfEmtw2rO DDkdR7x3SsmW4-54dwxIGI6os&s=EZeDlYo123VyTtXBBs_5FB5hrTLQTD5- OfGMKFbqRXs&e= >`_.
doc/guides/cryptodevs/chacha20_poly1305.rst new file +10
-0+ +After downloading the library, the user needs to unpack and compile it +on their system before building DPDK: + +.. code-block:: console + + make + make install + +The library requires NASM to be built. Depending on the library version, itmight
doc/guides/cryptodevs/chacha20_poly1305.rst new file +3
-0+require a minimum NASM version (e.g. v0.54 requires at least NASM 2.14). + +NASM is packaged for different OS. However, on some OS the version is tooold,
+so a manual installation is required. In that case, NASM can be downloaded from
+`NASM website <https://urldefense.proofpoint.com/v2/url?u=https-
3A__www.nasm.us_pub_nasm_releasebuilds_-3FC-3DM-3BO- 3DD&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=DnL7Si2wl_PRwpZ9TWey 3eu68gBzn7DkPwuqhd6WNyo&m=cJBMpjPsWqfEmtw2rODDkdR7x3SsmW4- 54dwxIGI6os&s=3BB7_2sRCgmORUOvnzI3Lc9AG4lq07D6K1OndgbWQVc&e=Quoted 1 line
`_.
doc/guides/cryptodevs/chacha20_poly1305.rst new file +11
-0+Once it is downloaded, extract it and follow these steps: + +.. code-block:: console + + ./configure + make + make install + +.. note:: + + Compilation of the Multi-Buffer library is broken when GCC < 5.0, if library<= v0.53.
+ If a lower GCC version than 5.0, the workaround proposed by the
following link
+ should be used: `<https://urldefense.proofpoint.com/v2/url?u=https-
3A__github.com_intel_intel-2Dipsec- 2Dmb_issues_40&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=DnL7Si2wl_P RwpZ9TWey3eu68gBzn7DkPwuqhd6WNyo&m=cJBMpjPsWqfEmtw2rODDkdR 7x3SsmW4- 54dwxIGI6os&s=3vpATFyHRB05ndE_OFBm4s0K6Z_tx8qsAiyQGSZOhOk&e=Quoted 1 line
`_.
doc/guides/cryptodevs/chacha20_poly1305.rst new file +2
-0+ +As a reference, the following table shows a mapping between the pastDPDK versions
doc/guides/cryptodevs/chacha20_poly1305.rst line 60
Quoted 3 lines
doc/guides/cryptodevs/chacha20_poly1305.rst new file +3
-0+and the external crypto libraries supported by them: + +.. _table_zuc_versions:
ZUC ????
Quoted 115 lines
doc/guides/cryptodevs/chacha20_poly1305.rst new file +10
-0+ +.. table:: DPDK and external crypto library version compatibility + + ============= ================================ + DPDK version Crypto library version + ============= ================================ + 21.11+ Multi-buffer library 1.0* + ============= ================================ + +\* Multi-buffer library 1.0 or newer only works for Meson but not Makebuild system.
doc/guides/cryptodevs/chacha20_poly1305.rst new file +13
-0+ +Initialization +-------------- + +In order to enable this virtual crypto PMD, user must: + +* Build the multi buffer library (explained in Installation section). + +To use the PMD in an application, user must: + +* Call rte_vdev_init("crypto_chacha20_poly1305") within the application. + +* Use --vdev="crypto_chacha20_poly1305" in the EAL options, which willcall
doc/guides/cryptodevs/chacha20_poly1305.rst new file +3
-0+ rte_vdev_init() internally. + +The following parameters (all optional) can be provided in the previous twocalls:
doc/guides/cryptodevs/chacha20_poly1305.rst new file +2
-0+ +* socket_id: Specify the socket where the memory for the device is going tobe allocated
+ (by default,socket_idwill be the socket where the core that is creating the PMD is running on).doc/guides/cryptodevs/chacha20_poly1305.rst new file +2
-0+ +* max_nb_queue_pairs: Specify the maximum number of queue pairs in thedevice (8 by default).
doc/guides/cryptodevs/chacha20_poly1305.rst new file +2
-0+ +* max_nb_sessions: Specify the maximum number of sessions that can becreated (2048 by default).
doc/guides/cryptodevs/chacha20_poly1305.rst new file +6
-0+ +Example: + +.. code-block:: console + + --vdev="crypto_chacha20_poly1305,socket_id=0,max_nb_sessions=128"doc/guides/cryptodevs/features/chacha20_poly1305.ini new file +22
-0@@ -0,0 +1,35 @@ +; +; Supported features of the 'chacha20_poly1305' crypto driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Symmetric crypto = Y +Sym operation chaining = Y +Symmetric sessionless = Y +Non-Byte aligned data = Y +In Place SGL = Y +OOP SGL In LB Out = Y +OOP LB In LB Out = Y +CPU crypto = Y + +; +; Supported crypto algorithms of the 'chacha20_poly1305' crypto driver. +; +[Cipher] + +; +; Supported authentication algorithms of the 'chacha20_poly1305' cryptodriver.
doc/guides/cryptodevs/features/chacha20_poly1305.ini new file +11
-0+; +[Auth] + +; +; Supported AEAD algorithms of the 'chacha20_poly1305' crypto driver. +; +[AEAD] +CHACHA20-POLY1305 = Y + +; +; Supported Asymmetric algorithms of the 'chacha20_poly1305' cryptodriver.
doc/guides/cryptodevs/features/chacha20_poly1305.ini new file +2
-0+; +[Asymmetric]doc/guides/cryptodevs/index.rst +1
-0@@ -16,6 +16,7 @@ Crypto Device Drivers bcmfs caam_jr ccp + chacha20_poly1305 cnxk dpaa2_sec dpaa_secdoc/guides/rel_notes/release_21_11.rst +3
-0@@ -76,6 +76,11 @@ New Features * Added support for partially encrypted digest when using auth-cipher operations. +* **Added Chacha20-poly1305 Crypto PMD.** + + * Added PMD to support chacha20-poly1305 algorithms to IPSec_MB PMD
Quoted 1 line
framework.
A sub-bullet may be sufficient in the ipsec-mb update.
Quoted 586 lines
doc/guides/rel_notes/release_21_11.rst +2
-0+ * Test vector added for chacha20-poly1305 SGL test. + * **Updated Marvell cnxk crypto PMD.** * Added AES-CBC SHA1-HMAC support in lookaside protocol (IPsec) forCN10K.
drivers/crypto/ipsec_mb/meson.build +1
-0@@ -25,6 +25,7 @@ sources = files('rte_ipsec_mb_pmd.c', 'rte_ipsec_mb_pmd_ops.c', 'pmd_aesni_mb.c', 'pmd_aesni_gcm.c', + 'pmd_chacha_poly.c', 'pmd_kasumi.c', 'pmd_snow3g.c', 'pmd_zuc.c'drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +27
-0@@ -0,0 +1,482 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2021 Intel Corporation +*/ + +#include <intel-ipsec-mb.h> + +#if defined(RTE_LIB_SECURITY ) +#define AESNI_MB_DOCSIS_SEC_ENABLED 1 +#include <rte_ether.h> +#include <rte_security.h> +#include <rte_security_driver.h> +#endif + +#include "rte_ipsec_mb_pmd_private.h" + +#define CHACHA20_POLY1305_IV_LENGTH 12 +#define CHACHA20_POLY1305_DIGEST_LENGTH 16 +#define CHACHA20_POLY1305_KEY_SIZE 32 + +static const +struct rte_cryptodev_capabilities chacha20_poly1305_capabilities[] = { + {/* CHACHA20-POLY1305 */ + .op =RTE_CRYPTO_OP_TYPE_SYMMETRIC , + {.sym = { + .xform_type =RTE_CRYPTO_SYM_XFORM_AEAD , + {.aead = { + .algo =
RTE_CRYPTO_AEAD_CHACHA20_POLY1305,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +45
-0+ .block_size = 64, + .key_size = { + .min = 32, + .max = 32, + .increment = 0}, + .digest_size = { + .min = 16, + .max = 16, + .increment = 0}, + .aad_size = { + .min = 0, + .max = 240, + .increment = 1}, + .iv_size = { + .min = 12, + .max = 12, + .increment = 0}, + }, + } + },} + }, + RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() +}; + +uint8_t pmd_driver_id_chacha20_poly1305; + +/** CHACHA20 POLY1305 private session structure */ +struct chacha20_poly1305_session { +struct { +uint16_t length; +uint16_t offset; + } iv; +/**< IV parameters */ +uint16_t aad_length; +/**< AAD length */ +uint16_t req_digest_length; +/**< Requested digest length */ +uint16_t gen_digest_length; +/**< Generated digest length */ +uint8_t key[CHACHA20_POLY1305_KEY_SIZE ]; +enum ipsec_mb_operation op; +} __rte_cache_aligned; + +struct chacha20_poly1305_qp_data { +struct chacha20_poly1305_context_data
chacha20_poly1305_ctx_data;drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +36
-0+uint8_t temp_digest[CHACHA20_POLY1305_DIGEST_LENGTH ]; +/**< Buffer used to store the digest generated +* by the driver when verifying a digest provided +* by the user (using authentication verify operation) +*/ +}; + +/** Parse crypto xform chain and set private session parameters. */ +static int +chacha20_poly1305_session_configure(IMB_MGR * mb_mgr __rte_unused, +void *priv_sess,const struct rte_crypto_sym_xform *xform) +{ +struct chacha20_poly1305_session *sess = priv_sess; +const struct rte_crypto_sym_xform *auth_xform; +const struct rte_crypto_sym_xform *cipher_xform; +const struct rte_crypto_sym_xform *aead_xform; + +uint8_t key_length; +const uint8_t *key; +enum ipsec_mb_operation mode; +int ret =0 ; + + ret =ipsec_mb_parse_xform (xform, &mode, &auth_xform, + &cipher_xform, &aead_xform); +if (ret) +return ret; + + sess->op = mode; + +switch (sess->op) { +case IPSEC_MB_OP_AEAD_AUTHENTICATED_ENCRYPT : +case IPSEC_MB_OP_AEAD_AUTHENTICATED_DECRYPT : +if (aead_xform->aead.algo != +RTE_CRYPTO_AEAD_CHACHA20_POLY1305 ) { + IPSEC_MB_LOG(ERR, + "The only combined operation supported isCHACHA20 POLY1305");
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +14
-0+ ret = -ENOTSUP ; + goto error_exit; + } +/* Set IV parameters */ + sess->iv.offset = aead_xform->aead.iv.offset; + sess->iv.length = aead_xform->aead.iv.length; + key_length = aead_xform->aead.key.length; + key = aead_xform->aead.key.data; + sess->aad_length = aead_xform->aead.aad_length; + sess->req_digest_length = aead_xform->aead.digest_length; +break ; +default : + IPSEC_MB_LOG( + ERR, "Wrong xform type, has to be AEAD orauthentication");
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +23
-0+ ret = -ENOTSUP ; + goto error_exit; + } + +/* IV check */ +if (sess->iv.length !=CHACHA20_POLY1305_IV_LENGTH && + sess->iv.length !=0 ) { +IPSEC_MB_LOG (ERR ,"Wrong IV length" ); + ret = -EINVAL ; + goto error_exit; + } + +/* Check key length */ +if (key_length !=CHACHA20_POLY1305_KEY_SIZE ) { +IPSEC_MB_LOG (ERR ,"Invalid key length" ); + ret = -EINVAL ; + goto error_exit; + }else { +memcpy (sess->key, key,CHACHA20_POLY1305_KEY_SIZE ); + } + +/* Digest check */ + if (sess->req_digest_length !=
CHACHA20_POLY1305_DIGEST_LENGTH) {drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +5
-0+IPSEC_MB_LOG (ERR ,"Invalid digest length" ); + ret = -EINVAL ; + goto error_exit; + }else { + sess->gen_digest_length =
CHACHA20_POLY1305_DIGEST_LENGTH;drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +19
-0+ } + +error_exit: +return ret; +} + +/** +* Process a crypto operation, calling +* the direct chacha poly API from the multi buffer library. +* +* @param qp queue pair +* @param op symmetric crypto operation +* @param session chacha poly session +* +* @return +* - Return 0 if success +*/ +static int +chacha20_poly1305_crypto_op(struct ipsec_mb_qp *qp, struct
rte_crypto_op*op,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +55
-0+ struct chacha20_poly1305_session *session) +{ +struct chacha20_poly1305_qp_data *qp_data = +ipsec_mb_get_qp_private_data (qp); +uint8_t *src, *dst; +uint8_t *iv_ptr; +struct rte_crypto_sym_op *sym_op = op->sym; +struct rte_mbuf *m_src = sym_op->m_src; +uint32_t offset, data_offset, data_length; +uint32_t part_len, data_len; +int total_len; +uint8_t *tag; +unsigned int oop =0 ; + + offset = sym_op->aead.data.offset; + data_offset = offset; + data_length = sym_op->aead.data.length; +RTE_ASSERT (m_src !=NULL ); + +while (offset >= m_src->data_len && data_length !=0 ) { + offset -= m_src->data_len; + m_src = m_src->next; + +RTE_ASSERT (m_src !=NULL ); + } + + src = rte_pktmbuf_mtod_offset(m_src, uint8_t *, offset); + + data_len = m_src->data_len - offset; + part_len = (data_len < data_length) ? data_len : + data_length; + +/* In-place */ +if (sym_op->m_dst ==NULL || (sym_op->m_dst == sym_op->m_src)) + dst = src; +/* Out-of-place */ +else { + oop =1 ; +/* Segmented destination buffer is not supported +* if operation is Out-of-place +*/ +RTE_ASSERT (rte_pktmbuf_is_contiguous (sym_op->m_dst)); + dst = rte_pktmbuf_mtod_offset(sym_op->m_dst, uint8_t *, + data_offset); + } + + iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *, + session->iv.offset); + +IMB_CHACHA20_POLY1305_INIT (qp->mb_mgr, session->key, + &qp_data->chacha20_poly1305_ctx_data, + iv_ptr, sym_op->aead.aad.data, + (uint64_t )session->aad_length); + +if (session->op ==IPSEC_MB_OP_AEAD_AUTHENTICATED_ENCRYPT ){
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +20
-0+IMB_CHACHA20_POLY1305_ENC_UPDATE (qp->mb_mgr, + session->key, + &qp_data->chacha20_poly1305_ctx_data, + dst, src, (uint64_t )part_len); + total_len = data_length - part_len; + +while (total_len) { + m_src = m_src->next; +RTE_ASSERT (m_src !=NULL ); + + src = rte_pktmbuf_mtod(m_src, uint8_t *); +if (oop) + dst += part_len; +else + dst = src; + part_len = (m_src->data_len < total_len) ? + m_src->data_len : total_len; + +if (dst ==NULL || src ==NULL ) { + IPSEC_MB_LOG(ERR, "Invalid src or dstinput");
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +3
-0+return -EINVAL ; + } + IMB_CHACHA20_POLY1305_ENC_UPDATE(qp-Quoted 1 line
mb_mgr,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +2
-0+ session->key, + &qp_data-Quoted 1 line
chacha20_poly1305_ctx_data,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +11
-0+ dst, src, (uint64_t)part_len); + total_len -= part_len; +if (total_len <0 ) { +IPSEC_MB_LOG (ERR ,"Invalid part len" ); +return -EINVAL ; + } + } + + tag = sym_op->aead.digest.data; + IMB_CHACHA20_POLY1305_ENC_FINALIZE(qp->mb_mgr, + &qp_data-Quoted 1 line
chacha20_poly1305_ctx_data,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +6
-0+ tag, session->gen_digest_length); + + }else { + IMB_CHACHA20_POLY1305_DEC_UPDATE(qp->mb_mgr, + session->key, + &qp_data-Quoted 1 line
chacha20_poly1305_ctx_data,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +19
-0+ dst, src, (uint64_t)part_len); + + total_len = data_length - part_len; + +while (total_len) { + m_src = m_src->next; + +RTE_ASSERT (m_src !=NULL ); + + src = rte_pktmbuf_mtod(m_src, uint8_t *); +if (oop) + dst += part_len; +else + dst = src; + part_len = (m_src->data_len < total_len) ? + m_src->data_len : total_len; + +if (dst ==NULL || src ==NULL ) { + IPSEC_MB_LOG(ERR, "Invalid src or dstinput");
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +3
-0+return -EINVAL ; + } + IMB_CHACHA20_POLY1305_DEC_UPDATE(qp-Quoted 1 line
mb_mgr,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +2
-0+ session->key, + &qp_data-Quoted 1 line
chacha20_poly1305_ctx_data,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +11
-0+ dst, src, (uint64_t)part_len); + total_len -= part_len; +if (total_len <0 ) { +IPSEC_MB_LOG (ERR ,"Invalid part len" ); +return -EINVAL ; + } + } + + tag = qp_data->temp_digest; + IMB_CHACHA20_POLY1305_DEC_FINALIZE(qp->mb_mgr, + &qp_data-Quoted 1 line
chacha20_poly1305_ctx_data,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +27
-0+ tag, session->gen_digest_length); + } + +return 0 ; +} + +/** +* Process a completed chacha poly op +* +* @param qp Queue Pair to process +* @param op Crypto operation +* @param sess Crypto session +* +* @return +* - void +*/ +static void +post_process_chacha20_poly1305_crypto_op (struct ipsec_mb_qp *qp, +struct rte_crypto_op *op, +struct chacha20_poly1305_session *session) +{ +struct chacha20_poly1305_qp_data *qp_data = +ipsec_mb_get_qp_private_data (qp); + + op->status =RTE_CRYPTO_OP_STATUS_SUCCESS ; +/* Verify digest if required */ + if (session->op == IPSEC_MB_OP_AEAD_AUTHENTICATED_DECRYPT||
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +11
-0+ session->op == IPSEC_MB_OP_HASH_VERIFY_ONLY) { +uint8_t *digest = op->sym->aead.digest.data; +uint8_t *tag = qp_data->temp_digest; + +#ifdef RTE_LIBRTE_PMD_CHACHA20_POLY1305_DEBUG +rte_hexdump (stdout,"auth tag (orig):" , + digest, session->req_digest_length); +rte_hexdump (stdout,"auth tag (calc):" , + tag, session->req_digest_length); +#endif + if (memcmp(tag, digest, session->req_digest_length)!= 0)
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +1
-0+ op->status =
RTE_CRYPTO_OP_STATUS_AUTH_FAILED;drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +17
-0+ + } + +} + +/** +* Process a completed Chacha20_poly1305 request +* +* @param qp Queue Pair to process +* @param op Crypto operation +* @param sess Crypto session +* +* @return +* - void +*/ +static void +handle_completed_chacha20_poly1305_crypto_op(struct ipsec_mb_qp*qp,
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +10
-0+struct rte_crypto_op *op, + struct chacha20_poly1305_session *sess) +{ +post_process_chacha20_poly1305_crypto_op (qp ,op ,sess ); + +/* Free session if a session-less crypto op */ +if (op->sess_type ==RTE_CRYPTO_OP_SESSIONLESS ) { +memset (sess,0 ,sizeof (struct chacha20_poly1305_session )); + memset(op->sym->session, 0, +rte_cryptodev_sym_get_existing_header_session_size(drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +25
-0+ op->sym->session)); +rte_mempool_put (qp->sess_mp_priv, sess); +rte_mempool_put (qp->sess_mp, op->sym->session); + op->sym->session =NULL ; + } +} + +static uint16_t +chacha20_poly1305_pmd_dequeue_burst (void *queue_pair, +struct rte_crypto_op **ops,uint16_t nb_ops) +{ +struct chacha20_poly1305_session *sess; +struct ipsec_mb_qp *qp = queue_pair; + +int retval =0 ; +unsigned int i =0 , nb_dequeued; + + nb_dequeued =rte_ring_dequeue_burst (qp->ingress_queue, + (void **)ops, nb_ops,NULL ); + +for (i =0 ; i < nb_dequeued; i++) { + + sess =ipsec_mb_get_session_private (qp, ops[i]); +if (unlikely (sess ==NULL )) { + ops[i]->status =
RTE_CRYPTO_OP_STATUS_INVALID_ARGS;drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +7
-0+ qp->stats.dequeue_err_count++; +break ; + } + + retval =chacha20_poly1305_crypto_op (qp, ops[i], sess); +if (retval <0 ) { + ops[i]->status =
RTE_CRYPTO_OP_STATUS_INVALID_ARGS;drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +5
-0+ qp->stats.dequeue_err_count++; +break ; + } + + handle_completed_chacha20_poly1305_crypto_op(qp,ops[i], sess);
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +28
-0+ } + + qp->stats.dequeued_count += i; + +return i; +} + +struct rte_cryptodev_ops chacha20_poly1305_pmd_ops = { + .dev_configure = ipsec_mb_pmd_config, + .dev_start = ipsec_mb_pmd_start, + .dev_stop = ipsec_mb_pmd_stop, + .dev_close = ipsec_mb_pmd_close, + + .stats_get = ipsec_mb_pmd_stats_get, + .stats_reset = ipsec_mb_pmd_stats_reset, + + .dev_infos_get = ipsec_mb_pmd_info_get, + + .queue_pair_setup = ipsec_mb_pmd_qp_setup, + .queue_pair_release = ipsec_mb_pmd_qp_release, + + .sym_session_get_size = ipsec_mb_pmd_sym_session_get_size, + .sym_session_configure = ipsec_mb_pmd_sym_session_configure, + .sym_session_clear = ipsec_mb_pmd_sym_session_clear +}; + +struct rte_cryptodev_ops *rte_chacha20_poly1305_pmd_ops = +&chacha20_poly1305_pmd_ops;drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +16
-0+ +static int +cryptodev_chacha20_poly1305_probe (struct rte_vdev_device *vdev) +{ +return cryptodev_ipsec_mb_create (vdev, +IPSEC_MB_PMD_TYPE_CHACHA20_POLY1305 ); +} + +static struct rte_vdev_driver cryptodev_chacha20_poly1305_pmd_drv = { + .probe = cryptodev_chacha20_poly1305_probe, + .remove = cryptodev_ipsec_mb_remove +}; + +static struct cryptodev_driver chacha20_poly1305_crypto_drv; + +RTE_PMD_REGISTER_VDEV(CRYPTODEV_NAME_CHACHA20_POLY1305_PMD,
+cryptodev_chacha20_poly1305_pmd_drv); +RTE_PMD_REGISTER_ALIAS(CRYPTODEV_NAME_CHACHA20_POLY1305_PM D, + cryptodev_chacha20_poly1305_pmd);+RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_CHACHA20_POL
Y1305_PMD,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +3
-0+ "max_nb_queue_pairs=<int> socket_id=<int>"); +RTE_PMD_REGISTER_CRYPTO_DRIVER(chacha20_poly1305_crypto_drv, +cryptodev_chacha20_poly1305_pmd_drv.driver,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +7
-0+ pmd_driver_id_chacha20_poly1305); + +/* Constructor function to register chacha20_poly1305 PMD */ +RTE_INIT (ipsec_mb_register_chacha20_poly1305) +{ +struct ipsec_mb_pmd_data *chacha_poly_data + =&ipsec_mb_pmds[IPSEC_MB_PMD_TYPE_CHACHA20_POLY1305];
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +3
-0+ + chacha_poly_data->caps = chacha20_poly1305_capabilities; + chacha_poly_data->dequeue_burst =
chacha20_poly1305_pmd_dequeue_burst;drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +17
-0+ chacha_poly_data->feature_flags = +RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | +RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | +RTE_CRYPTODEV_FF_IN_PLACE_SGL | +RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT | +RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT | +RTE_CRYPTODEV_FF_SYM_CPU_CRYPTO | +RTE_CRYPTODEV_FF_SYM_SESSIONLESS ; + chacha_poly_data->internals_priv_size =0 ; + chacha_poly_data->ops = &chacha20_poly1305_pmd_ops; + chacha_poly_data->qp_priv_size = +sizeof (struct chacha20_poly1305_qp_data ); + chacha_poly_data->session_configure = + chacha20_poly1305_session_configure; + chacha_poly_data->session_priv_size = +sizeof (struct chacha20_poly1305_session ); +}drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h +1
-0@@ -49,6 +49,9 @@ extern RTE_DEFINE_PER_LCORE(IMB_MGR *, mb_mgr);#define CRYPTODEV_NAME_ZUC_PMD crypto_zuc/**< IPSEC Multi buffer PMD zuc device name */ +#define CRYPTODEV_NAME_CHACHA20_POLY1305_PMD
crypto_chacha20_poly1305drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h +6
-0+/**< IPSEC Multi buffer PMD chacha20_poly1305 device name */ +/** PMD LOGTYPE DRIVER, common to all PMDs */ extern int ipsec_mb_logtype_driver;#define IPSEC_MB_LOG (level, fmt, ...) \@@ -62,6 +65,7 @@ enum ipsec_mb_pmd_types {IPSEC_MB_PMD_TYPE_KASUMI ,IPSEC_MB_PMD_TYPE_SNOW3G ,IPSEC_MB_PMD_TYPE_ZUC , +IPSEC_MB_PMD_TYPE_CHACHA20_POLY1305 , IPSEC_MB_N_PMD_TYPES };@@ -85,6 +89,7 @@ extern uint8_t pmd_driver_id_aesni_gcm;extern uint8_t pmd_driver_id_kasumi;extern uint8_t pmd_driver_id_snow3g;extern uint8_t pmd_driver_id_zuc; +extern uint8_t pmd_driver_id_chacha20_poly1305;/** Helper function. Gets driver ID based on PMD type */ static __rte_always_inline uint8_t@@ -101,6 +106,8 @@ ipsec_mb_get_driver_id(enum ipsec_mb_pmd_types pmd_type)return pmd_driver_id_snow3g;case IPSEC_MB_PMD_TYPE_ZUC :return pmd_driver_id_zuc; +case IPSEC_MB_PMD_TYPE_CHACHA20_POLY1305 : +return pmd_driver_id_chacha20_poly1305;default :break ;}
--
2.25.1
Re: [dpdk-dev] [EXT] [PATCH v3 09/10] crypto/ipsec_mb: add chacha20-poly1305 PMD to framework
Hi Ahkill,
The addition chacha20-poly test was added for a more robust test case to cover oop sgl test scenario.
Regards
Kai
Quoted 1,025 lines
Any specific reason to add new vectors for chacha poly? Are the ones already present not enough?
Quoted 191 lines
app/test/test_cryptodev_aead_test_vectors.h +10
-0+static uint8_t chacha_aad_2[] = { +0xf3 ,0x33 ,0x88 ,0x86 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x4e ,0x91 +}; + +static const struct aead_test_data chacha20_poly1305_case_2 = { + .algo =RTE_CRYPTO_AEAD_CHACHA20_POLY1305 , + .key = { + .data = { +0x1c ,0x92 ,0x40 ,0xa5 ,0xeb ,0x55 ,0xd3 ,
0x8a,(quoted diff) +2
-0+ 0xf3, 0x33, 0x88, 0x86, 0x04, 0xf6, 0xb5, 0xf0, + 0x47, 0x39, 0x17, 0xc1, 0x40, 0x2b, 0x80,
0x09,app/test/test_cryptodev_aead_test_vectors.h +7
-0+0x9d ,0xca ,0x5c ,0xbc ,0x20 ,0x70 ,0x75 ,0xc0 + }, + .len = 32 + }, + .iv = { + .data = { + 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03,
0x04,app/test/test_cryptodev_aead_test_vectors.h +11
-0+0x05 ,0x06 ,0x07 ,0x08 + }, + .len = 12 + }, + .aad = { + .data = chacha_aad_2, + .len = 12 + }, + .plaintext = { + .data = { + 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65,
0x74,(quoted diff) +1
-0+ 0x2d, 0x44, 0x72, 0x61, 0x66, 0x74, 0x73,
0x20,(quoted diff) +1
-0+ 0x61, 0x72, 0x65, 0x20, 0x64, 0x72, 0x61,
0x66,(quoted diff) +1
-0+ 0x74, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d,
0x65,(quoted diff) +1
-0+ 0x6e, 0x74, 0x73, 0x20, 0x76, 0x61, 0x6c,
0x69,(quoted diff) +1
-0+ 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61,
0x20,(quoted diff) +1
-0+ 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d,
0x20,(quoted diff) +1
-0+ 0x6f, 0x66, 0x20, 0x73, 0x69, 0x78, 0x20,
0x6d,(quoted diff) +1
-0+ 0x6f, 0x6e, 0x74, 0x68, 0x73, 0x20, 0x61,
0x6e,(quoted diff) +1
-0+ 0x64, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62,
0x65,(quoted diff) +1
-0+ 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
0x64,(quoted diff) +1
-0+ 0x2c, 0x20, 0x72, 0x65, 0x70, 0x6c, 0x61,
0x63,(quoted diff) +2
-0+ 0x65, 0x64, 0x2c, 0x20, 0x6f, 0x72, 0x20, 0x6f, + 0x62, 0x73, 0x6f, 0x6c, 0x65, 0x74, 0x65,
0x64,(quoted diff) +1
-0+ 0x20, 0x62, 0x79, 0x20, 0x6f, 0x74, 0x68,
0x65,(quoted diff) +1
-0+ 0x72, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d,
0x65,(quoted diff) +1
-0+ 0x6e, 0x74, 0x73, 0x20, 0x61, 0x74, 0x20,
0x61,(quoted diff) +1
-0+ 0x6e, 0x79, 0x20, 0x74, 0x69, 0x6d, 0x65,
0x2e,(quoted diff) +1
-0+ 0x20, 0x49, 0x74, 0x20, 0x69, 0x73, 0x20,
0x69,(quoted diff) +1
-0+ 0x6e, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x70,
0x72,(quoted diff) +1
-0+ 0x69, 0x61, 0x74, 0x65, 0x20, 0x74, 0x6f,
0x20,(quoted diff) +1
-0+ 0x75, 0x73, 0x65, 0x20, 0x49, 0x6e, 0x74,
0x65,(quoted diff) +1
-0+ 0x72, 0x6e, 0x65, 0x74, 0x2d, 0x44, 0x72,
0x61,(quoted diff) +1
-0+ 0x66, 0x74, 0x73, 0x20, 0x61, 0x73, 0x20,
0x72,(quoted diff) +1
-0+ 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
0x65,(quoted diff) +1
-0+ 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69,
0x61,(quoted diff) +2
-0+ 0x6c, 0x20, 0x6f, 0x72, 0x20, 0x74, 0x6f, 0x20, + 0x63, 0x69, 0x74, 0x65, 0x20, 0x74, 0x68,
0x65,(quoted diff) +1
-0+ 0x6d, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72,
0x20,(quoted diff) +1
-0+ 0x74, 0x68, 0x61, 0x6e, 0x20, 0x61, 0x73,
0x20,(quoted diff) +1
-0+ 0x2f, 0xe2, 0x80, 0x9c, 0x77, 0x6f, 0x72,
0x6b,(quoted diff) +1
-0+ 0x20, 0x69, 0x6e, 0x20, 0x70, 0x72, 0x6f,
0x67,(quoted diff) +1
-0+ 0x72, 0x65, 0x73, 0x73, 0x2e, 0x2f, 0xe2,
0x80,app/test/test_cryptodev_aead_test_vectors.h +7
-0+0x9d + }, + .len =265 + }, + .ciphertext = { + .data = { + 0x64, 0xa0, 0x86, 0x15, 0x75, 0x86, 0x1a,
0xf4,(quoted diff) +1
-0+ 0x60, 0xf0, 0x62, 0xc7, 0x9b, 0xe6, 0x43,
0xbd,(quoted diff) +2
-0+ 0x5e, 0x80, 0x5c, 0xfd, 0x34, 0x5c, 0xf3, 0x89, + 0xf1, 0x08, 0x67, 0x0a, 0xc7, 0x6c, 0x8c,
0xb2,(quoted diff) +1
-0+ 0x4c, 0x6c, 0xfc, 0x18, 0x75, 0x5d, 0x43,
0xee,(quoted diff) +1
-0+ 0xa0, 0x9e, 0xe9, 0x4e, 0x38, 0x2d, 0x26,
0xb0,(quoted diff) +1
-0+ 0xbd, 0xb7, 0xb7, 0x3c, 0x32, 0x1b, 0x01,
0x00,(quoted diff) +2
-0+ 0xd4, 0xf0, 0x3b, 0x7f, 0x35, 0x58, 0x94, 0xcf, + 0x33, 0x2f, 0x83, 0x0e, 0x71, 0x0b, 0x97,
0xce,(quoted diff) +1
-0+ 0x98, 0xc8, 0xa8, 0x4a, 0xbd, 0x0b, 0x94,
0x81,(quoted diff) +1
-0+ 0x14, 0xad, 0x17, 0x6e, 0x00, 0x8d, 0x33,
0xbd,app/test/test_cryptodev_aead_test_vectors.h +3
-0+0x60 ,0xf9 ,0x82 ,0xb1 ,0xff ,0x37 ,0xc8 ,0x55 , +0x97 ,0x97 ,0xa0 ,0x6e ,0xf4 ,0xf0 ,0xef ,0x61 , + 0xc1, 0x86, 0x32, 0x4e, 0x2b, 0x35, 0x06,
0x38,(quoted diff) +1
-0+ 0x36, 0x06, 0x90, 0x7b, 0x6a, 0x7c, 0x02,
0xb0,(quoted diff) +1
-0+ 0xf9, 0xf6, 0x15, 0x7b, 0x53, 0xc8, 0x67,
0xe4,(quoted diff) +1
-0+ 0xb9, 0x16, 0x6c, 0x76, 0x7b, 0x80, 0x4d,
0x46,(quoted diff) +1
-0+ 0xa5, 0x9b, 0x52, 0x16, 0xcd, 0xe7, 0xa4,
0xe9,(quoted diff) +1
-0+ 0x90, 0x40, 0xc5, 0xa4, 0x04, 0x33, 0x22,
0x5e,(quoted diff) +1
-0+ 0xe2, 0x82, 0xa1, 0xb0, 0xa0, 0x6c, 0x52,
0x3e,(quoted diff) +2
-0+ 0xaf, 0x45, 0x34, 0xd7, 0xf8, 0x3f, 0xa1, 0x15, + 0x5b, 0x00, 0x47, 0x71, 0x8c, 0xbc, 0x54,
0x6a,(quoted diff) +1
-0+ 0x0d, 0x07, 0x2b, 0x04, 0xb3, 0x56, 0x4e,
0xea,(quoted diff) +1
-0+ 0x1b, 0x42, 0x22, 0x73, 0xf5, 0x48, 0x27,
0x1a,(quoted diff) +1
-0+ 0x0b, 0xb2, 0x31, 0x60, 0x53, 0xfa, 0x76,
0x99,(quoted diff) +1
-0+ 0x19, 0x55, 0xeb, 0xd6, 0x31, 0x59, 0x43,
0x4e,(quoted diff) +1
-0+ 0xce, 0xbb, 0x4e, 0x46, 0x6d, 0xae, 0x5a,
0x10,(quoted diff) +1
-0+ 0x73, 0xa6, 0x72, 0x76, 0x27, 0x09, 0x7a,
0x10,(quoted diff) +1
-0+ 0x49, 0xe6, 0x17, 0xd9, 0x1d, 0x36, 0x10,
0x94,(quoted diff) +2
-0+ 0xfa, 0x68, 0xf0, 0xff, 0x77, 0x98, 0x71, 0x30, + 0x30, 0x5b, 0xea, 0xba, 0x2e, 0xda, 0x04,
0xdf,(quoted diff) +1
-0+ 0x99, 0x7b, 0x71, 0x4d, 0x6c, 0x6f, 0x2c,
0x29,(quoted diff) +1
-0+ 0xa6, 0xad, 0x5c, 0xb4, 0x02, 0x2b, 0x02,
0x70,app/test/test_cryptodev_aead_test_vectors.h +7
-0+0x9b + }, + .len =265 + }, + .auth_tag = { + .data = { + 0xee, 0xad, 0x9d, 0x67, 0x89, 0x0c, 0xbb,
0x22,app/test/test_cryptodev_aead_test_vectors.h +5
-0+0x39 ,0x23 ,0x36 ,0xfe ,0xa1 ,0x85 ,0x1f ,0x38 + }, + .len = 16 + } +}; #endif /* TEST_CRYPTODEV_AEAD_TEST_VECTORS_H_ */ diff --git
a/doc/guides/cryptodevs/chacha20_poly1305.rstb/doc/guides/cryptodevs/chacha20_poly1305.rst
new file mode 100644
index 0000000000..e5f7368d6ddoc/guides/cryptodevs/chacha20_poly1305.rst new file +8
-0@@ -0,0 +1,99 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2016-2019 Intel Corporation. + +Chacha20-poly1305 Crypto Poll Mode Driver +========================================= + +The Chacha20-poly1305 PMD provides poll mode crypto driver support +for utilizing `Intel IPSec Multi-buffer libraryQuoted 3 lines
<https://urldefense.proofpoint.com/v2/url?u=https-
3A__github.com_01org_intel-2Dipsec-2Dmb&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=DnL7Si2wl_PRwpZ9TW e
Quoted 1 line
y3eu68gBzn7DkPwuqhd6WNyo&m=cJBMpjPsWqfEmtw2rODDkdR7x3SsmW4
Quoted 2 lines
-
54dwxIGI6os&s=FrXg2cbYTOa7noqANBGmUQgdAVNCP8wTOBeCtjNkUH8&e =
Quoted 16 lines
Quoted 1 line
`_.
doc/guides/cryptodevs/chacha20_poly1305.rst new file +15
-0+ +Features +-------- + +Chacha20-poly1305 PMD has support for: + +AEAD algorithms: + +* RTE_CRYPTO_AEAD_CHACHA20_POLY1305 + + +Installation +------------ + +To build DPDK with the Chacha20-poly1305 PMD the user is required toQuoted 5 lines
download
+the multi-buffer library from `here
<https://urldefense.proofpoint.com/v2/url?u=https-
3A__github.com_01org_intel-2Dipsec-2Dmb&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=DnL7Si2wl_PRwpZ9TW e
Quoted 1 line
y3eu68gBzn7DkPwuqhd6WNyo&m=cJBMpjPsWqfEmtw2rODDkdR7x3SsmW4
Quoted 2 lines
-
54dwxIGI6os&s=FrXg2cbYTOa7noqANBGmUQgdAVNCP8wTOBeCtjNkUH8&e =
Quoted 7 lines
Quoted 1 line
`_
doc/guides/cryptodevs/chacha20_poly1305.rst new file +3
-0+and compile it on their user system before building DPDK. +The latest version of the library supported by this PMD is v1.0, +which can be downloaded from`<https://urldefense.proofpoint.com/v2/url?u=https- 3A__github.com_01org_intel-2Dipsec-
2Dmb_archive_v1.0.zip&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=DnL7S i
Quoted 1 line
2wl_PRwpZ9TWey3eu68gBzn7DkPwuqhd6WNyo&m=cJBMpjPsWqfEmtw2rO
Quoted 21 lines
DDkdR7x3SsmW4-54dwxIGI6os&s=EZeDlYo123VyTtXBBs_5FB5hrTLQTD5- OfGMKFbqRXs&e= >`_.
doc/guides/cryptodevs/chacha20_poly1305.rst new file +11
-0+ +After downloading the library, the user needs to unpack and compile +it on their system before building DPDK: + +.. code-block:: console + + make + make install + +The library requires NASM to be built. Depending on the library +version, itmight
doc/guides/cryptodevs/chacha20_poly1305.rst new file +4
-0+require a minimum NASM version (e.g. v0.54 requires at least NASM 2.14). + +NASM is packaged for different OS. However, on some OS the version is +tooold,
doc/guides/cryptodevs/chacha20_poly1305.rst new file +2
-0+so a manual installation is required. In that case, NASM can be +downloadedQuoted 4 lines
from
+`NASM website <https://urldefense.proofpoint.com/v2/url?u=https-
3A__www.nasm.us_pub_nasm_releasebuilds_-3FC-3DM-3BO-3DD&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=DnL7Si2wl_PRwpZ9TWey
Quoted 1 line
3eu68gBzn7DkPwuqhd6WNyo&m=cJBMpjPsWqfEmtw2rODDkdR7x3SsmW4-
Quoted 1 line
54dwxIGI6os&s=3BB7_2sRCgmORUOvnzI3Lc9AG4lq07D6K1OndgbWQVc&e=
Quoted 13 lines
Quoted 1 line
`_.
doc/guides/cryptodevs/chacha20_poly1305.rst new file +12
-0+Once it is downloaded, extract it and follow these steps: + +.. code-block:: console + + ./configure + make + make install + +.. note:: + + Compilation of the Multi-Buffer library is broken when GCC < 5.0, + if libraryQuoted 7 lines
<= v0.53.
+ If a lower GCC version than 5.0, the workaround proposed by the
following link
+ should be used:
+ `<https://urldefense.proofpoint.com/v2/url?u=https- 3A__github.com_intel_intel-2Dipsec-2Dmb_issues_40&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=DnL7Si2wl_P
Quoted 1 line
RwpZ9TWey3eu68gBzn7DkPwuqhd6WNyo&m=cJBMpjPsWqfEmtw2rODDkd R
doc/guides/cryptodevs/chacha20_poly1305.rst line 60
Quoted 9 lines
7x3SsmW4- 54dwxIGI6os&s=3vpATFyHRB05ndE_OFBm4s0K6Z_tx8qsAiyQGSZOhOk&e=
Quoted 1 line
`_.
doc/guides/cryptodevs/chacha20_poly1305.rst new file +2
-0+ +As a reference, the following table shows a mapping between the pastDPDK versions
doc/guides/cryptodevs/chacha20_poly1305.rst new file +3
-0+and the external crypto libraries supported by them: + +.. _table_zuc_versions:ZUC ????
Quoted 43 lines
doc/guides/cryptodevs/chacha20_poly1305.rst new file +11
-0+ +.. table:: DPDK and external crypto library version compatibility + + ============= ================================ + DPDK version Crypto library version + ============= ================================ + 21.11+ Multi-buffer library 1.0* + ============= ================================ + +\* Multi-buffer library 1.0 or newer only works for Meson but not +Makebuild system.
doc/guides/cryptodevs/chacha20_poly1305.rst new file +14
-0+ +Initialization +-------------- + +In order to enable this virtual crypto PMD, user must: + +* Build the multi buffer library (explained in Installation section). + +To use the PMD in an application, user must: + +* Call rte_vdev_init("crypto_chacha20_poly1305") within the application. + +* Use --vdev="crypto_chacha20_poly1305" in the EAL options, which +willcall
doc/guides/cryptodevs/chacha20_poly1305.rst new file +4
-0+ rte_vdev_init() internally. + +The following parameters (all optional) can be provided in the +previous twocalls:
doc/guides/cryptodevs/chacha20_poly1305.rst new file +3
-0+ +* socket_id: Specify the socket where the memory for the device is +going tobe allocated
+ (by default,socket_idwill be the socket where the core that is
+ creating the
PMD is running on).doc/guides/cryptodevs/chacha20_poly1305.rst new file +3
-0+ +* max_nb_queue_pairs: Specify the maximum number of queue pairs in +thedevice (8 by default).
doc/guides/cryptodevs/chacha20_poly1305.rst
Quoted 2 lines
doc/guides/cryptodevs/chacha20_poly1305.rst new file +2
-0+ +* max_nb_sessions: Specify the maximum number of sessions that canbe
doc/guides/cryptodevs/chacha20_poly1305.rst
Quoted 7 lines
created (2048 by default).
doc/guides/cryptodevs/chacha20_poly1305.rst new file +6
-0+ +Example: + +.. code-block:: console + + --vdev="crypto_chacha20_poly1305,socket_id=0,max_nb_sessions=128"
Quoted 63 lines
doc/guides/cryptodevs/features/chacha20_poly1305.ini new file +23
-0@@ -0,0 +1,35 @@ +; +; Supported features of the 'chacha20_poly1305' crypto driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Symmetric crypto = Y +Sym operation chaining = Y +Symmetric sessionless = Y +Non-Byte aligned data = Y +In Place SGL = Y +OOP SGL In LB Out = Y +OOP LB In LB Out = Y +CPU crypto = Y + +; +; Supported crypto algorithms of the 'chacha20_poly1305' crypto driver. +; +[Cipher] + +; +; Supported authentication algorithms of the 'chacha20_poly1305' +cryptodriver.
doc/guides/cryptodevs/features/chacha20_poly1305.ini new file +11
-0+; +[Auth] + +; +; Supported AEAD algorithms of the 'chacha20_poly1305' crypto driver. +; +[AEAD] +CHACHA20-POLY1305 = Y + +; +; Supported Asymmetric algorithms of the 'chacha20_poly1305' cryptodriver.
doc/guides/cryptodevs/features/chacha20_poly1305.ini new file +2
-0+; +[Asymmetric](quoted diff) +0
-0
b/doc/guides/cryptodevs/index.rstindex0f981c77b5..3dcc2ecd2e100644doc/guides/cryptodevs/index.rst +1
-0@@ -16,6 +16,7 @@ Crypto Device Drivers bcmfs caam_jr ccp + chacha20_poly1305 cnxk dpaa2_sec dpaa_secdoc/guides/rel_notes/release_21_11.rst +0
-0doc/guides/rel_notes/release_21_11.rst New Features · line 81
Quoted 6 lines
doc/guides/rel_notes/release_21_11.rst +3
-0@@ -76,6 +76,11 @@ New Features * Added support for partially encrypted digest when using auth-cipher operations. +* **Added Chacha20-poly1305 Crypto PMD.** + + * Added PMD to support chacha20-poly1305 algorithms to IPSec_MBPMD
Quoted 1 line
framework.
A sub-bullet may be sufficient in the ipsec-mb update.
Quoted 26 lines
doc/guides/rel_notes/release_21_11.rst +2
-0+ * Test vector added for chacha20-poly1305 SGL test. + * **Updated Marvell cnxk crypto PMD.** * Added AES-CBC SHA1-HMAC support in lookaside protocol (IPsec) forCN10K.
drivers/crypto/ipsec_mb/meson.build +1
-0@@ -25,6 +25,7 @@ sources = files('rte_ipsec_mb_pmd.c', 'rte_ipsec_mb_pmd_ops.c', 'pmd_aesni_mb.c', 'pmd_aesni_gcm.c', + 'pmd_chacha_poly.c', 'pmd_kasumi.c', 'pmd_snow3g.c', 'pmd_zuc.c'drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +0
-0drivers/crypto/ipsec_mb/pmd_chacha_poly.c line 7
Quoted 7 lines
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +7
-0@@ -0,0 +1,482 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2015-2021 Intel Corporation */ + +#include <intel-ipsec-mb.h> + +#if defined(RTE_LIB_SECURITY ) +#define AESNI_MB_DOCSIS_SEC_ENABLED 1 #include <rte_ether.h>#include
drivers/crypto/ipsec_mb/pmd_chacha_poly.c
Quoted 6 lines
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +6
-0+<rte_security.h> #include <rte_security_driver.h> #endif + +#include "rte_ipsec_mb_pmd_private.h" + +#define CHACHA20_POLY1305_IV_LENGTH 12 #define +CHACHA20_POLY1305_DIGEST_LENGTH 16 #define
CHACHA20_POLY1305_KEY_SIZEQuoted 58 lines
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +10
-0+32 + +static const +struct rte_cryptodev_capabilities chacha20_poly1305_capabilities[] = { + {/* CHACHA20-POLY1305 */ + .op =RTE_CRYPTO_OP_TYPE_SYMMETRIC , + {.sym = { + .xform_type =RTE_CRYPTO_SYM_XFORM_AEAD , + {.aead = { + .algo =
RTE_CRYPTO_AEAD_CHACHA20_POLY1305,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +45
-0+ .block_size = 64, + .key_size = { + .min = 32, + .max = 32, + .increment = 0}, + .digest_size = { + .min = 16, + .max = 16, + .increment = 0}, + .aad_size = { + .min = 0, + .max = 240, + .increment = 1}, + .iv_size = { + .min = 12, + .max = 12, + .increment = 0}, + }, + } + },} + }, + RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() +}; + +uint8_t pmd_driver_id_chacha20_poly1305; + +/** CHACHA20 POLY1305 private session structure */ struct +chacha20_poly1305_session { +struct { +uint16_t length; +uint16_t offset; + } iv; +/**< IV parameters */ +uint16_t aad_length; +/**< AAD length */ +uint16_t req_digest_length; +/**< Requested digest length */ +uint16_t gen_digest_length; +/**< Generated digest length */ +uint8_t key[CHACHA20_POLY1305_KEY_SIZE ]; +enum ipsec_mb_operation op; +} __rte_cache_aligned; + +struct chacha20_poly1305_qp_data { +struct chacha20_poly1305_context_data
chacha20_poly1305_ctx_data;drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +1
-0+uint8_t temp_digest[CHACHA20_POLY1305_DIGEST_LENGTH ];drivers/crypto/ipsec_mb/pmd_chacha_poly.c line 83
Quoted 10 lines
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +10
-0+/**< Buffer used to store the digest generated +* by the driver when verifying a digest provided +* by the user (using authentication verify operation) +*/ +}; + +/** Parse crypto xform chain and set private session parameters. */ +static int chacha20_poly1305_session_configure(IMB_MGR * mb_mgr +__rte_unused, +void *priv_sess,const struct rte_crypto_sym_xform *xform){
Quoted 259 lines
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +24
-0+struct chacha20_poly1305_session *sess = priv_sess; +const struct rte_crypto_sym_xform *auth_xform; +const struct rte_crypto_sym_xform *cipher_xform; +const struct rte_crypto_sym_xform *aead_xform; + +uint8_t key_length; +const uint8_t *key; +enum ipsec_mb_operation mode; +int ret =0 ; + + ret =ipsec_mb_parse_xform (xform, &mode, &auth_xform, + &cipher_xform, &aead_xform); +if (ret) +return ret; + + sess->op = mode; + +switch (sess->op) { +case IPSEC_MB_OP_AEAD_AUTHENTICATED_ENCRYPT : +case IPSEC_MB_OP_AEAD_AUTHENTICATED_DECRYPT : +if (aead_xform->aead.algo != +RTE_CRYPTO_AEAD_CHACHA20_POLY1305 ) { + IPSEC_MB_LOG(ERR, + "The only combined operation supported isCHACHA20 POLY1305");
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +14
-0+ ret = -ENOTSUP ; + goto error_exit; + } +/* Set IV parameters */ + sess->iv.offset = aead_xform->aead.iv.offset; + sess->iv.length = aead_xform->aead.iv.length; + key_length = aead_xform->aead.key.length; + key = aead_xform->aead.key.data; + sess->aad_length = aead_xform->aead.aad_length; + sess->req_digest_length = aead_xform->aead.digest_length; +break ; +default : + IPSEC_MB_LOG( + ERR, "Wrong xform type, has to be AEAD orauthentication");
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +23
-0+ ret = -ENOTSUP ; + goto error_exit; + } + +/* IV check */ +if (sess->iv.length !=CHACHA20_POLY1305_IV_LENGTH && + sess->iv.length !=0 ) { +IPSEC_MB_LOG (ERR ,"Wrong IV length" ); + ret = -EINVAL ; + goto error_exit; + } + +/* Check key length */ +if (key_length !=CHACHA20_POLY1305_KEY_SIZE ) { +IPSEC_MB_LOG (ERR ,"Invalid key length" ); + ret = -EINVAL ; + goto error_exit; + }else { +memcpy (sess->key, key,CHACHA20_POLY1305_KEY_SIZE ); + } + +/* Digest check */ + if (sess->req_digest_length !=
CHACHA20_POLY1305_DIGEST_LENGTH) {drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +5
-0+IPSEC_MB_LOG (ERR ,"Invalid digest length" ); + ret = -EINVAL ; + goto error_exit; + }else { + sess->gen_digest_length =
CHACHA20_POLY1305_DIGEST_LENGTH;drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +19
-0+ } + +error_exit: +return ret; +} + +/** +* Process a crypto operation, calling +* the direct chacha poly API from the multi buffer library. +* +* @param qp queue pair +* @param op symmetric crypto operation +* @param session chacha poly session +* +* @return +* - Return 0 if success +*/ +static int +chacha20_poly1305_crypto_op(struct ipsec_mb_qp *qp, struct
rte_crypto_op*op,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +33
-0+ struct chacha20_poly1305_session *session) { + struct chacha20_poly1305_qp_data *qp_data = + ipsec_mb_get_qp_private_data(qp); + uint8_t *src, *dst; + uint8_t *iv_ptr; + struct rte_crypto_sym_op *sym_op = op->sym; + struct rte_mbuf *m_src = sym_op->m_src; + uint32_t offset, data_offset, data_length; + uint32_t part_len, data_len; + int total_len; + uint8_t *tag; + unsigned int oop = 0; + + offset = sym_op->aead.data.offset; + data_offset = offset; + data_length = sym_op->aead.data.length; + RTE_ASSERT(m_src != NULL); + + while (offset >= m_src->data_len && data_length != 0) { + offset -= m_src->data_len; + m_src = m_src->next; + + RTE_ASSERT(m_src != NULL); + } + + src = rte_pktmbuf_mtod_offset(m_src, uint8_t *, offset); + + data_len = m_src->data_len - offset; + part_len = (data_len < data_length) ? data_len : + data_length; + + /* In-place */ + if (sym_op->m_dst == NULL || (sym_op->m_dst == sym_op-
m_src))drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +21
-0+ dst = src; +/* Out-of-place */ + else { + oop =1 ; +/* Segmented destination buffer is not supported +* if operation is Out-of-place +*/ +RTE_ASSERT (rte_pktmbuf_is_contiguous (sym_op->m_dst)); + dst = rte_pktmbuf_mtod_offset(sym_op->m_dst, uint8_t *, + data_offset); + } + + iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *, + session->iv.offset); + +IMB_CHACHA20_POLY1305_INIT (qp->mb_mgr, session->key, + &qp_data->chacha20_poly1305_ctx_data, + iv_ptr, sym_op->aead.aad.data, + (uint64_t )session->aad_length); + +if (session->op ==IPSEC_MB_OP_AEAD_AUTHENTICATED_ENCRYPT ){
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +20
-0+IMB_CHACHA20_POLY1305_ENC_UPDATE (qp->mb_mgr, + session->key, + &qp_data->chacha20_poly1305_ctx_data, + dst, src, (uint64_t )part_len); + total_len = data_length - part_len; + +while (total_len) { + m_src = m_src->next; +RTE_ASSERT (m_src !=NULL ); + + src = rte_pktmbuf_mtod(m_src, uint8_t *); +if (oop) + dst += part_len; +else + dst = src; + part_len = (m_src->data_len < total_len) ? + m_src->data_len : total_len; + +if (dst ==NULL || src ==NULL ) { + IPSEC_MB_LOG(ERR, "Invalid src or dstinput");
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +3
-0+return -EINVAL ; + } + IMB_CHACHA20_POLY1305_ENC_UPDATE(qp-Quoted 1 line
mb_mgr,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +2
-0+ session->key, + &qp_data-Quoted 1 line
chacha20_poly1305_ctx_data,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +11
-0+ dst, src, (uint64_t)part_len); + total_len -= part_len; +if (total_len <0 ) { +IPSEC_MB_LOG (ERR ,"Invalid part len" ); +return -EINVAL ; + } + } + + tag = sym_op->aead.digest.data; + IMB_CHACHA20_POLY1305_ENC_FINALIZE(qp->mb_mgr, + &qp_data-Quoted 1 line
chacha20_poly1305_ctx_data,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +6
-0+ tag, session->gen_digest_length); + + }else { + IMB_CHACHA20_POLY1305_DEC_UPDATE(qp->mb_mgr, + session->key, + &qp_data-Quoted 1 line
chacha20_poly1305_ctx_data,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +19
-0+ dst, src, (uint64_t)part_len); + + total_len = data_length - part_len; + +while (total_len) { + m_src = m_src->next; + +RTE_ASSERT (m_src !=NULL ); + + src = rte_pktmbuf_mtod(m_src, uint8_t *); +if (oop) + dst += part_len; +else + dst = src; + part_len = (m_src->data_len < total_len) ? + m_src->data_len : total_len; + +if (dst ==NULL || src ==NULL ) { + IPSEC_MB_LOG(ERR, "Invalid src or dstinput");
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +3
-0+return -EINVAL ; + } + IMB_CHACHA20_POLY1305_DEC_UPDATE(qp-Quoted 1 line
mb_mgr,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +2
-0+ session->key, + &qp_data-Quoted 1 line
chacha20_poly1305_ctx_data,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +11
-0+ dst, src, (uint64_t)part_len); + total_len -= part_len; +if (total_len <0 ) { +IPSEC_MB_LOG (ERR ,"Invalid part len" ); +return -EINVAL ; + } + } + + tag = qp_data->temp_digest; + IMB_CHACHA20_POLY1305_DEC_FINALIZE(qp->mb_mgr, + &qp_data-Quoted 1 line
chacha20_poly1305_ctx_data,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +26
-0+ tag, session->gen_digest_length); + } + +return 0 ; +} + +/** +* Process a completed chacha poly op +* +* @param qp Queue Pair to process +* @param op Crypto operation +* @param sess Crypto session +* +* @return +* - void +*/ +static void +post_process_chacha20_poly1305_crypto_op (struct ipsec_mb_qp *qp, +struct rte_crypto_op *op, +struct chacha20_poly1305_session *session) { +struct chacha20_poly1305_qp_data *qp_data = +ipsec_mb_get_qp_private_data (qp); + + op->status =RTE_CRYPTO_OP_STATUS_SUCCESS ; +/* Verify digest if required */ + if (session->op == IPSEC_MB_OP_AEAD_AUTHENTICATED_DECRYPT||
drivers/crypto/ipsec_mb/pmd_chacha_poly.c
Quoted 1 line
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +1
-0+ session->op == IPSEC_MB_OP_HASH_VERIFY_ONLY){
Quoted 112 lines
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +9
-0+uint8_t *digest = op->sym->aead.digest.data; +uint8_t *tag = qp_data->temp_digest; + +#ifdef RTE_LIBRTE_PMD_CHACHA20_POLY1305_DEBUG +rte_hexdump (stdout,"auth tag (orig):" , + digest, session->req_digest_length); +rte_hexdump (stdout,"auth tag (calc):" , + tag, session->req_digest_length);#endif + if (memcmp(tag, digest, session->req_digest_length)!= 0)
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +1
-0+ op->status =
RTE_CRYPTO_OP_STATUS_AUTH_FAILED;drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +17
-0+ + } + +} + +/** +* Process a completed Chacha20_poly1305 request +* +* @param qp Queue Pair to process +* @param op Crypto operation +* @param sess Crypto session +* +* @return +* - void +*/ +static void +handle_completed_chacha20_poly1305_crypto_op(struct ipsec_mb_qp*qp,
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +9
-0+struct rte_crypto_op *op, + struct chacha20_poly1305_session *sess) { +post_process_chacha20_poly1305_crypto_op (qp ,op ,sess ); + +/* Free session if a session-less crypto op */ +if (op->sess_type ==RTE_CRYPTO_OP_SESSIONLESS ) { +memset (sess,0 ,sizeof (struct chacha20_poly1305_session )); + memset(op->sym->session, 0, +rte_cryptodev_sym_get_existing_header_session_size(drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +24
-0+ op->sym->session)); +rte_mempool_put (qp->sess_mp_priv, sess); +rte_mempool_put (qp->sess_mp, op->sym->session); + op->sym->session =NULL ; + } +} + +static uint16_t +chacha20_poly1305_pmd_dequeue_burst (void *queue_pair, +struct rte_crypto_op **ops,uint16_t nb_ops) { +struct chacha20_poly1305_session *sess; +struct ipsec_mb_qp *qp = queue_pair; + +int retval =0 ; +unsigned int i =0 , nb_dequeued; + + nb_dequeued =rte_ring_dequeue_burst (qp->ingress_queue, + (void **)ops, nb_ops,NULL ); + +for (i =0 ; i < nb_dequeued; i++) { + + sess =ipsec_mb_get_session_private (qp, ops[i]); +if (unlikely (sess ==NULL )) { + ops[i]->status =
RTE_CRYPTO_OP_STATUS_INVALID_ARGS;drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +7
-0+ qp->stats.dequeue_err_count++; +break ; + } + + retval =chacha20_poly1305_crypto_op (qp, ops[i], sess); +if (retval <0 ) { + ops[i]->status =
RTE_CRYPTO_OP_STATUS_INVALID_ARGS;drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +5
-0+ qp->stats.dequeue_err_count++; +break ; + } + + handle_completed_chacha20_poly1305_crypto_op(qp,ops[i], sess);
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +27
-0+ } + + qp->stats.dequeued_count += i; + +return i; +} + +struct rte_cryptodev_ops chacha20_poly1305_pmd_ops = { + .dev_configure = ipsec_mb_pmd_config, + .dev_start = ipsec_mb_pmd_start, + .dev_stop = ipsec_mb_pmd_stop, + .dev_close = ipsec_mb_pmd_close, + + .stats_get = ipsec_mb_pmd_stats_get, + .stats_reset = ipsec_mb_pmd_stats_reset, + + .dev_infos_get = ipsec_mb_pmd_info_get, + + .queue_pair_setup = ipsec_mb_pmd_qp_setup, + .queue_pair_release = ipsec_mb_pmd_qp_release, + + .sym_session_get_size = ipsec_mb_pmd_sym_session_get_size, + .sym_session_configure = ipsec_mb_pmd_sym_session_configure, + .sym_session_clear = ipsec_mb_pmd_sym_session_clear }; + +struct rte_cryptodev_ops *rte_chacha20_poly1305_pmd_ops = +&chacha20_poly1305_pmd_ops;drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +4
-0+ +static int +cryptodev_chacha20_poly1305_probe (struct rte_vdev_device *vdev) { + return cryptodev_ipsec_mb_create(vdev,drivers/crypto/ipsec_mb/pmd_chacha_poly.c line 447
Quoted 10 lines
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +10
-0+ IPSEC_MB_PMD_TYPE_CHACHA20_POLY1305); +} + +static struct rte_vdev_driver cryptodev_chacha20_poly1305_pmd_drv = { + .probe = cryptodev_chacha20_poly1305_probe, + .remove = cryptodev_ipsec_mb_remove +}; + +static struct cryptodev_driver chacha20_poly1305_crypto_drv; ++RTE_PMD_REGISTER_VDEV(CRYPTODEV_NAME_CHACHA20_POLY1305_P M
Quoted 4 lines
D,
+cryptodev_chacha20_poly1305_pmd_drv);+RTE_PMD_REGISTER_ALIAS(CRYPTODEV_NAME_CHACHA20_POLY1305_P M
Quoted 4 lines
D,
+cryptodev_chacha20_poly1305_pmd);+RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_CHACHA20_PO L
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h extern RTE_DEFINE_PER_LCORE(IMB_MGR *,
Quoted 39 lines
Y1305_PMD,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +3
-0+ "max_nb_queue_pairs=<int> socket_id=<int>"); +RTE_PMD_REGISTER_CRYPTO_DRIVER(chacha20_poly1305_crypto_drv, +cryptodev_chacha20_poly1305_pmd_drv.driver,drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +7
-0+ pmd_driver_id_chacha20_poly1305); + +/* Constructor function to register chacha20_poly1305 PMD */ +RTE_INIT (ipsec_mb_register_chacha20_poly1305) +{ +struct ipsec_mb_pmd_data *chacha_poly_data + =&ipsec_mb_pmds[IPSEC_MB_PMD_TYPE_CHACHA20_POLY1305];
drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +3
-0+ + chacha_poly_data->caps = chacha20_poly1305_capabilities; + chacha_poly_data->dequeue_burst =
chacha20_poly1305_pmd_dequeue_burst;drivers/crypto/ipsec_mb/pmd_chacha_poly.c new file +16
-0+ chacha_poly_data->feature_flags = +RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | +RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | +RTE_CRYPTODEV_FF_IN_PLACE_SGL | +RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT | +RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT | +RTE_CRYPTODEV_FF_SYM_CPU_CRYPTO | +RTE_CRYPTODEV_FF_SYM_SESSIONLESS ; + chacha_poly_data->internals_priv_size =0 ; + chacha_poly_data->ops = &chacha20_poly1305_pmd_ops; + chacha_poly_data->qp_priv_size = +sizeof (struct chacha20_poly1305_qp_data ); + chacha_poly_data->session_configure = + chacha20_poly1305_session_configure; + chacha_poly_data->session_priv_size = +sizeof (struct chacha20_poly1305_session ); }drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h +0
-0@@ -49,6 +49,9 @@ extern RTE_DEFINE_PER_LCORE(IMB_MGR *,
mb_mgr);drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h extern RTE_DEFINE_PER_LCORE(IMB_MGR *, · line 49
Quoted 1 line
drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h +0
-0#define CRYPTODEV_NAME_ZUC_PMD crypto_zuc/**< IPSEC Multi buffer PMD
Quoted 36 lines
zuc device name */
+#define
CRYPTODEV_NAME_CHACHA20_POLY1305_PMDcrypto_chacha20_poly1305drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h +2
-0+/**< IPSEC Multi buffer PMD chacha20_poly1305 device name */ + /** PMD LOGTYPE DRIVER, common to all PMDs */ extern int
ipsec_mb_logtype_driver;
#defineIPSEC_MB_LOG(level, fmt, ...)\drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h +2
-0@@ -62,6 +65,7 @@ enum ipsec_mb_pmd_types {IPSEC_MB_PMD_TYPE_KASUMI ,IPSEC_MB_PMD_TYPE_SNOW3G ,IPSEC_MB_PMD_TYPE_ZUC , +IPSEC_MB_PMD_TYPE_CHACHA20_POLY1305 , IPSEC_MB_N_PMD_TYPES };@@ -85,6 +89,7 @@ extern uint8_t pmd_driver_id_aesni_gcm; externuint8_t pmd_driver_id_kasumi;extern uint8_t pmd_driver_id_snow3g;extern uint8_t pmd_driver_id_zuc; +extern uint8_t pmd_driver_id_chacha20_poly1305; /** Helper function. Gets driver ID based on PMD type */ static
__rte_always_inlineuint8_t@@ -101,6 +106,8 @@
ipsec_mb_get_driver_id(enumipsec_mb_pmd_typespmd_type)drivers/crypto/ipsec_mb/rte_ipsec_mb_pmd_private.h +2
-1return pmd_driver_id_snow3g;case IPSEC_MB_PMD_TYPE_ZUC :return pmd_driver_id_zuc; +case IPSEC_MB_PMD_TYPE_CHACHA20_POLY1305 : +return pmd_driver_id_chacha20_poly1305;default :break ; } --2.25.1
Re: [dpdk-dev] [EXT] [PATCH v3 09/10] crypto/ipsec_mb: add chacha20-poly1305 PMD to framework
Quoted 4 lines
The addition chacha20-poly test was added for a more robust test case to cover oop sgl test scenario.
Ok. Split the test app changes in a separate patch.
Please avoid top posting comments and delete irrelevant stuff while replying.
PATCH v3 10/10 doc/rel_notes: added note for SW Crypto PMD change
In reply to Ciara PowerThe SW Crypto PMDs were consolidated into one IPSec_MB PMD. This patch adds a release note to highlight this change.
---
v3: Modified release note wording and added CHACHA20-POLY1305.
--- doc/guides/rel_notes/release_21_11.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
doc/guides/rel_notes/release_21_11.rst +15 -0
@@ -81,6 +81,21 @@ New Features * Added PMD to support chacha20-poly1305 algorithms to IPSec_MB PMD framework. * Test vector added for chacha20-poly1305 SGL test. +* **Consolidated SW Crypto PMDs with IPSec_MB dependency.** + + Intel SW Crypto PMDS that depend on the IPSec_MB library were + consolidated into a single source folder so that common code can + be shared between them. The usage and EAL options of these PMDs + are the same as before. + This change includes: + + * AESNI_MB PMD. + * AESNI_GCM PMD. + * KASUMI PMD. + * SNOW3G PMD. + * ZUC PMD. + * CHACHA20-POLY1305 PMD. + * **Updated Marvell cnxk crypto PMD.** * Added AES-CBC SHA1-HMAC support in lookaside protocol (IPsec) for CN10K.
Signature · 1 line
2.25.1