crypto/octeontx2: add support for cipher combinations
cover crypto/octeontx2: add support for cipher combinations
This series adds support for aes-cbc sha1-hmac and aes-cbc sha256-128-hmac cipher combinations in lookaside protocol offload mode. The functionality has been verified with ipsec-secgw application running in lookaside protocol offload mode.
This series should be applied after the following patch series:
http://patches.dpdk.org/project/dpdk/list/?series=14374
Ankur Dwivedi (2):
crypto/octeontx2: add support for aes-cbc sha1-hmac crypto/octeontx2: add support for aes-cbc sha256-128-hmac
doc/guides/cryptodevs/octeontx2.rst | 2 + doc/guides/rel_notes/release_21_02.rst | 5 + drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 128 +++++++++++++----- drivers/crypto/octeontx2/otx2_ipsec_po.h | 62 ++++++--- drivers/crypto/octeontx2/otx2_ipsec_po_ops.h | 2 +- drivers/crypto/octeontx2/otx2_security.h | 1 + 6 files changed, 150 insertions(+), 50 deletions(-)
Signature · 1 line
2.28.0
PATCH 1/2 crypto/octeontx2: add support for aes-cbc sha1-hmac
Support for aes-cbc sha1-hmac is added in lookaside protocol mode. The functionality is verified using ipsec-secgw application.
--- doc/guides/cryptodevs/octeontx2.rst | 1 + doc/guides/rel_notes/release_21_02.rst | 3 + drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 95 +++++++++++++------ drivers/crypto/octeontx2/otx2_ipsec_po.h | 37 +++++--- drivers/crypto/octeontx2/otx2_ipsec_po_ops.h | 2 +- 5 files changed, 93 insertions(+), 45 deletions(-)
doc/guides/cryptodevs/octeontx2.rst +1 -0
@@ -178,3 +178,4 @@ Features supported * ESN * Anti-replay * AES-128/192/256-GCM +* AES-128/192/256-CBC-SHA1-HMAC
doc/guides/rel_notes/release_21_02.rst +3 -0
@@ -60,6 +60,9 @@ New Features * Updated the OCTEON TX2 crypto PMD lookaside protocol offload for IPsec with ESN and anti-replay support. + * Added support for aes-cbc sha1-hmac cipher combination in OCTEON TX2 crypto + PMD lookaside protocol offload for IPsec. + Removed Items -------------
drivers/crypto/octeontx2/otx2_cryptodev_sec.c +64 -31
160 lines not on this page · raw message
drivers/crypto/octeontx2/otx2_ipsec_po.h +24 -13
@@ -10,10 +10,6 @@#include <rte_security.h> #define OTX2_IPSEC_PO_AES_GCM_INB_CTX_LEN 0x09 -#define OTX2_IPSEC_PO_AES_GCM_OUTB_CTX_LEN 0x28 - -#define OTX2_IPSEC_PO_MAX_INB_CTX_LEN 0x22 -#define OTX2_IPSEC_PO_MAX_OUTB_CTX_LEN 0x38#define OTX2_IPSEC_PO_PER_PKT_IV BIT(11)
@@ -171,9 +167,16 @@ struct otx2_ipsec_po_in_sa {struct otx2_ipsec_po_ip_template { RTE_STD_C11 union { - uint8_t raw[252]; -struct rte_ipv4_hdr ipv4_hdr; -struct rte_ipv6_hdr ipv6_hdr; +struct { +struct rte_ipv4_hdr ipv4_hdr; +uint16_t udp_src; +uint16_t udp_dst; + } ip4; +struct { +struct rte_ipv6_hdr ipv6_hdr; +uint16_t udp_src; +uint16_t udp_dst; + } ip6; }; };
@@ -191,10 +194,18 @@ struct otx2_ipsec_po_out_sa {uint32_t esn_hi;uint32_t esn_low; -/* w8-w39 */ -struct otx2_ipsec_po_ip_template template; -uint16_t udp_src; -uint16_t udp_dst; +/* w8-w55 */ +union { +uint8_t raw[384 ]; +struct { +struct otx2_ipsec_po_ip_template template; + } aes_gcm; +struct { +uint8_t hmac_key[24 ]; +uint8_t unused[24 ]; +struct otx2_ipsec_po_ip_template template; + } sha1; + }; }; static inline int
@@ -348,8 +359,8 @@ ipsec_po_sa_ctl_set(struct rte_security_ipsec_xform *ipsec,return -ENOTSUP ; } }else if (cipher_xform->cipher.algo ==RTE_CRYPTO_CIPHER_AES_CBC ) { - ctl->enc_type =OTX2_IPSEC_PO_SA_ENC_AES_CCM ; - aes_key_len = xform->cipher.key.length; + ctl->enc_type =OTX2_IPSEC_PO_SA_ENC_AES_CBC ; + aes_key_len = cipher_xform->cipher.key.length; }else {return -ENOTSUP ; }
drivers/crypto/octeontx2/otx2_ipsec_po_ops.h +1 -1
@@ -111,7 +111,7 @@ process_outb_sa(struct rte_crypto_op *cop,memcpy (&hdr->iv[0 ], &sa->iv.gcm.nonce,4 ); memcpy(&hdr->iv[4], rte_crypto_op_ctod_offset(cop, uint8_t *, sess->iv_offset), sess->iv_length); - }else if (ctl_wrd->auth_type ==OTX2_IPSEC_FP_SA_ENC_AES_CBC ) { + }else if (ctl_wrd->auth_type ==OTX2_IPSEC_PO_SA_AUTH_SHA1 ) { memcpy(&hdr->iv[0], rte_crypto_op_ctod_offset(cop, uint8_t *, sess->iv_offset), sess->iv_length); }
Signature · 1 line
2.28.0
PATCH 2/2 crypto/octeontx2: add support for aes-cbc sha256-128-hmac
In reply to Ankur DwivediSupport for aes-cbc sha256-128-hmac is added in lookaside protocol mode. The functionality is verified using ipsec-secgw application.
--- doc/guides/cryptodevs/octeontx2.rst | 1 + doc/guides/rel_notes/release_21_02.rst | 2 + drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 41 +++++++++++++++++-- drivers/crypto/octeontx2/otx2_ipsec_po.h | 25 ++++++++--- drivers/crypto/octeontx2/otx2_security.h | 1 + 5 files changed, 61 insertions(+), 9 deletions(-)
doc/guides/cryptodevs/octeontx2.rst +1 -0
@@ -179,3 +179,4 @@ Features supported * Anti-replay * AES-128/192/256-GCM * AES-128/192/256-CBC-SHA1-HMAC +* AES-128/192/256-CBC-SHA256-128-HMAC
doc/guides/rel_notes/release_21_02.rst +2 -0
@@ -63,6 +63,8 @@ New Features * Added support for aes-cbc sha1-hmac cipher combination in OCTEON TX2 crypto PMD lookaside protocol offload for IPsec. + * Added support for aes-cbc sha256-128-hmac cipher combination in OCTEON TX2 + crypto PMD lookaside protocol offload for IPsec. Removed Items -------------
drivers/crypto/octeontx2/otx2_cryptodev_sec.c +37 -4
72 lines not on this page · raw message
drivers/crypto/octeontx2/otx2_ipsec_po.h +20 -5
@@ -152,11 +152,18 @@ struct otx2_ipsec_po_in_sa {/* w8 */ uint8_t udp_encap[8 ]; -/* w9-w23 */ -struct { -uint8_t hmac_key[48 ]; -struct otx2_ipsec_po_traffic_selector selector; - } aes_gcm; +/* w9-w33 */ +union { +struct { +uint8_t hmac_key[48 ]; +struct otx2_ipsec_po_traffic_selector selector; + } aes_gcm; +struct { +uint8_t hmac_key[64 ]; +uint8_t hmac_iv[64 ]; +struct otx2_ipsec_po_traffic_selector selector; + } sha2; + };union {struct otx2_ipsec_replay *replay;uint64_t replay64;
@@ -205,6 +212,11 @@ struct otx2_ipsec_po_out_sa {uint8_t unused[24 ];struct otx2_ipsec_po_ip_template template; } sha1; +struct { +uint8_t hmac_key[64 ]; +uint8_t hmac_iv[64 ]; +struct otx2_ipsec_po_ip_template template; + } sha2; }; };
@@ -234,6 +246,9 @@ ipsec_po_xform_auth_verify(struct rte_crypto_sym_xform *xform)if (xform->auth.algo ==RTE_CRYPTO_AUTH_SHA1_HMAC ) {if (keylen >=20 && keylen <=64 )return 0 ; + }else if (xform->auth.algo ==RTE_CRYPTO_AUTH_SHA256_HMAC ) { +if (keylen >=32 && keylen <=64 ) +return 0 ; }return -ENOTSUP ;
drivers/crypto/octeontx2/otx2_security.h +1 -0
@@ -15,6 +15,7 @@#define OTX2_SEC_AES_GCM_MAC_LEN 16#define OTX2_SEC_AES_CBC_IV_LEN 16#define OTX2_SEC_SHA1_HMAC_LEN 12 +#define OTX2_SEC_SHA2_HMAC_LEN 16#define OTX2_SEC_AES_GCM_ROUNDUP_BYTE_LEN 4#define OTX2_SEC_AES_CBC_ROUNDUP_BYTE_LEN 16
Signature · 1 line
2.28.0
Akhil Goyal
AppliedQuoted 8 lines
This series adds support for aes-cbc sha1-hmac and aes-cbc sha256-128-hmac cipher combinations in lookaside protocol offload mode. The functionality has been verified with ipsec-secgw application running in lookaside protocol offload mode.
This series should be applied after the following patch series:
http://patches.dpdk.org/project/dpdk/list/?series=14374
Applied to dpdk-next-crypto
Thanks.