ipsec: add AES-CTR and 3DES-CBC support
cover ipsec: add AES-CTR and 3DES-CBC support
This patchset adds the AES-CTR and 3DES-CBC cipher algorithms support to ipsec library. The test scripts for ipsec-secgw sample application are added too.
Fan Zhang (4):
ipsec: add AES-CTR algorithm support
ipsec-secgw: add test scripts for aes ctr
ipsec: add 3DES-CBC algorithm support
ipsec-secgw: add 3des test files
examples/ipsec-secgw/test/common_defs.sh | 4 +- examples/ipsec-secgw/test/run_test.sh | 18 ++- .../test/trs_3descbc_sha1_common_defs.sh | 73 +++++++++++ examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh | 67 ++++++++++ .../test/trs_3descbc_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh | 66 ++++++++++ .../ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh | 5 + .../test/trs_aesctr_sha1_common_defs.sh | 69 ++++++++++ examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh | 67 ++++++++++ .../test/trs_aesctr_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh | 66 ++++++++++ .../ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh | 5 + .../test/tun_3descbc_sha1_common_defs.sh | 72 +++++++++++ examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh | 70 ++++++++++ .../test/tun_3descbc_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh | 70 ++++++++++ .../ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh | 5 + .../test/tun_aesctr_sha1_common_defs.sh | 68 ++++++++++ examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh | 70 ++++++++++ .../test/tun_aesctr_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh | 70 ++++++++++ .../ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh | 5 + lib/librte_ipsec/crypto.h | 17 +++ lib/librte_ipsec/sa.c | 143 ++++++++++++++++++--- lib/librte_ipsec/sa.h | 24 ++++ 25 files changed, 1050 insertions(+), 24 deletions(-) create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh
Signature · 1 line
2.14.5
PATCH 1/4 ipsec: add AES-CTR algorithm support
This patch adds AES-CTR cipher algorithm support to ipsec library.
--- lib/librte_ipsec/crypto.h | 17 ++++++ lib/librte_ipsec/sa.c | 133 ++++++++++++++++++++++++++++++++++++++-------- lib/librte_ipsec/sa.h | 18 +++++++ 3 files changed, 147 insertions(+), 21 deletions(-)
lib/librte_ipsec/crypto.h +17 -0
@@ -11,6 +11,16 @@* by ipsec library. */ +/* +* AES-CTR counter block format. +*/ + +struct aesctr_cnt_blk { +uint32_t nonce; +uint64_t iv; +uint32_t cnt; +} __attribute__((packed)); +/* * AES-GCM devices have some specific requirements for IV and AAD formats. * Ideally that to be done by the driver itself.
@@ -41,6 +51,13 @@ struct gcm_esph_iv {uint64_t iv; } __attribute__((packed)); +static inline void +aes_ctr_cnt_blk_fill (struct aesctr_cnt_blk *ctr,uint64_t iv,uint32_t nonce) +{ + ctr->nonce = nonce; + ctr->iv = iv; + ctr->cnt =rte_cpu_to_be_32 (1 ); +}static inline void aead_gcm_iv_fill (struct aead_gcm_iv *gcm,uint64_t iv,uint32_t salt)
lib/librte_ipsec/sa.c +112 -21
226 lines not on this page · raw message
lib/librte_ipsec/sa.h +18 -0
@@ -15,10 +15,17 @@enum {IPSEC_PAD_DEFAULT =4 ,IPSEC_PAD_AES_CBC =IPSEC_MAX_IV_SIZE , +IPSEC_PAD_AES_CTR =IPSEC_PAD_DEFAULT ,IPSEC_PAD_AES_GCM =IPSEC_PAD_DEFAULT ,IPSEC_PAD_NULL =IPSEC_PAD_DEFAULT , }; +/* iv sizes for different algorithms */ +enum { +IPSEC_IV_SIZE_DEFAULT =IPSEC_MAX_IV_SIZE , +IPSEC_AES_CTR_IV_SIZE =sizeof (uint64_t ), +}; +/* these definitions probably has to be in rte_crypto_sym.h */ union sym_op_ofslen {uint64_t raw;
@@ -47,7 +54,17 @@ struct replay_sqn { __extension__uint64_t window[0 ]; }; +/*IPSEC SA supported algorithms */ +enum sa_algo_type { +ALGO_TYPE_NULL =0 , +ALGO_TYPE_AES_CBC , +ALGO_TYPE_AES_CTR , +ALGO_TYPE_AES_GCM , +ALGO_TYPE_MAX +}; +struct rte_ipsec_sa { +uint64_t type;/* type of given SA */ uint64_t udata;/* user defined */ uint32_t size;/* size of given sa object */
@@ -65,6 +82,7 @@ struct rte_ipsec_sa {union sym_op_ofslen auth; } ctp;uint32_t salt; +uint8_t algo_type;uint8_t proto;/* next proto */ uint8_t aad_len;uint8_t hdr_len;
Signature · 1 line
2.14.5
PATCH 2/4 ipsec-secgw: add test scripts for aes ctr
In reply to Fan ZhangThis patch adds the functional test scripts to ipsec-secgw sample application for both transport and tunnel working mode.
Updated a bit on common_defs to use "mktemp" instead of "tempfile" as Fedora does not like the command.
--- examples/ipsec-secgw/test/common_defs.sh | 4 +- examples/ipsec-secgw/test/run_test.sh | 10 +++- .../test/trs_aesctr_sha1_common_defs.sh | 69 +++++++++++++++++++++ examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh | 67 +++++++++++++++++++++ .../test/trs_aesctr_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh | 66 ++++++++++++++++++++ .../ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh | 5 ++ .../test/tun_aesctr_sha1_common_defs.sh | 68 +++++++++++++++++++++ examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh | 70 ++++++++++++++++++++++ .../test/tun_aesctr_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh | 70 ++++++++++++++++++++++ .../ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh | 5 ++ 12 files changed, 441 insertions(+), 3 deletions(-) create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh
examples/ipsec-secgw/test/common_defs.sh +2 -2
@@ -53,7 +53,7 @@ SGW_CMD_EAL_PRM="--lcores=${SGW_LCORE} -n 4 ${ETH_DEV}" SGW_CMD_CFG="(0,0,${SGW_LCORE}),(1,0,${SGW_LCORE})" SGW_CMD_PRM="-p 0x3 -u 1 -P --config=\"${SGW_CMD_CFG}\"" -SGW_CFG_FILE=$(tempfile) +SGW_CFG_FILE=$(mktemp) # configure local host/ifaces config_local_iface()
@@ -129,7 +129,7 @@ config6_iface() #start ipsec-secgw secgw_start() { - SGW_EXEC_FILE=$(tempfile) + SGW_EXEC_FILE=$(mktemp) cat <<EOF > ${SGW_EXEC_FILE} ${SGW_PATH} ${SGW_CMD_EAL_PRM} ${CRYPTO_DEV} \ --vdev="net_tap0,mac=fixed" \
examples/ipsec-secgw/test/run_test.sh +9 -1
@@ -32,7 +32,15 @@ trs_aesgcm_esn_atom \ tun_aescbc_sha1_old \ tun_aesgcm_old \ trs_aescbc_sha1_old \ -trs_aesgcm_old" +trs_aesgcm_old \ +tun_aesctr_sha1 \ +tun_aesctr_sha1_esn \ +tun_aesctr_sha1_esn_atom \ +tun_aesctr_sha1_old \ +trs_aesctr_sha1 \ +trs_aesctr_sha1_esn \ +trs_aesctr_sha1_esn_atom \ +trs_aesctr_sha1_old" DIR=`dirname $0`
examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.sh new file +69 -0
69 lines not on this page · raw message
examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh new file +67 -0
67 lines not on this page · raw message
examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_aesctr_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh new file +66 -0
66 lines not on this page · raw message
examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_aesctr_sha1_defs.sh + +SGW_CMD_XPRM=
examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.sh new file +68 -0
68 lines not on this page · raw message
examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_aesctr_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_aesctr_sha1_defs.sh + +SGW_CMD_XPRM=
Signature · 1 line
2.14.5
PATCH 3/4 ipsec: add 3DES-CBC algorithm support
In reply to Fan ZhangThis patch adds triple-des CBC mode cipher algorithm to ipsec library.
--- lib/librte_ipsec/sa.c | 10 ++++++++++ lib/librte_ipsec/sa.h | 6 ++++++ 2 files changed, 16 insertions(+)
lib/librte_ipsec/sa.c +10 -0
@@ -307,6 +307,13 @@ esp_sa_init(struct rte_ipsec_sa *sa, const struct rte_ipsec_sa_prm *prm, sa->algo_type =ALGO_TYPE_AES_CTR ;break ; +case RTE_CRYPTO_CIPHER_3DES_CBC : +/* RFC 1851 */ + sa->pad_align =IPSEC_PAD_3DES_CBC ; + sa->iv_len =IPSEC_3DES_IV_SIZE ; + sa->algo_type =ALGO_TYPE_3DES ; +break ; +default :return -EINVAL ; }
@@ -512,6 +519,8 @@ esp_outb_cop_prepare(struct rte_crypto_op *cop, sa->iv_ofs);aes_ctr_cnt_blk_fill (ctr, ivp[0 ], sa->salt);break ; +case ALGO_TYPE_3DES : +/* Cipher-Auth (3DES-CBC *) case */ case ALGO_TYPE_NULL :/* NULL case */ sop->cipher.data.offset = sa->ctp.cipher.offset + hlen;
@@ -873,6 +882,7 @@ esp_inb_tun_cop_prepare(struct rte_crypto_op *cop,aead_gcm_iv_fill (gcm, ivp[0 ], sa->salt);break ;case ALGO_TYPE_AES_CBC : +case ALGO_TYPE_3DES : sop->cipher.data.offset = pofs + sa->ctp.cipher.offset; sop->cipher.data.length = clen; sop->auth.data.offset = pofs + sa->ctp.auth.offset;
lib/librte_ipsec/sa.h +6 -0
@@ -14,6 +14,7 @@/* padding alignment for different algorithms */ enum {IPSEC_PAD_DEFAULT =4 , +IPSEC_PAD_3DES_CBC =IPSEC_PAD_DEFAULT ,IPSEC_PAD_AES_CBC =IPSEC_MAX_IV_SIZE ,IPSEC_PAD_AES_CTR =IPSEC_PAD_DEFAULT ,IPSEC_PAD_AES_GCM =IPSEC_PAD_DEFAULT ,
@@ -24,6 +25,10 @@ enum {enum {IPSEC_IV_SIZE_DEFAULT =IPSEC_MAX_IV_SIZE ,IPSEC_AES_CTR_IV_SIZE =sizeof (uint64_t ), +/* TripleDES supports IV size of 32bits or 64bits but he library +* only supports 64bits. +*/ +IPSEC_3DES_IV_SIZE =sizeof (uint64_t ), };/* these definitions probably has to be in rte_crypto_sym.h */
@@ -57,6 +62,7 @@ struct replay_sqn {/*IPSEC SA supported algorithms */ enum sa_algo_type {ALGO_TYPE_NULL =0 , +ALGO_TYPE_3DES ,ALGO_TYPE_AES_CBC ,ALGO_TYPE_AES_CTR ,ALGO_TYPE_AES_GCM ,
Signature · 1 line
2.14.5
PATCH 4/4 ipsec-secgw: add 3des test files
In reply to Fan ZhangThis patch adds the functional test scripts to ipsec-secgw sample application for both transport and tunnel working mode.
--- examples/ipsec-secgw/test/run_test.sh | 10 ++- .../test/trs_3descbc_sha1_common_defs.sh | 73 ++++++++++++++++++++++ examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh | 67 ++++++++++++++++++++ .../test/trs_3descbc_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh | 66 +++++++++++++++++++ .../ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh | 5 ++ .../test/tun_3descbc_sha1_common_defs.sh | 72 +++++++++++++++++++++ examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh | 70 +++++++++++++++++++++ .../test/tun_3descbc_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh | 70 +++++++++++++++++++++ .../ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh | 5 ++ 11 files changed, 447 insertions(+), 1 deletion(-) create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh
examples/ipsec-secgw/test/run_test.sh +9 -1
@@ -40,7 +40,15 @@ tun_aesctr_sha1_old \ trs_aesctr_sha1 \ trs_aesctr_sha1_esn \ trs_aesctr_sha1_esn_atom \ -trs_aesctr_sha1_old" +trs_aesctr_sha1_old \ +tun_3descbc_sha1 \ +tun_3descbc_sha1_esn \ +tun_3descbc_sha1_esn_atom \ +tun_3descbc_sha1_old \ +trs_3descbc_sha1 \ +trs_3descbc_sha1_esn \ +trs_3descbc_sha1_esn_atom \ +trs_3descbc_sha1_old" DIR=`dirname $0`
examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.sh new file +73 -0
73 lines not on this page · raw message
examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh new file +67 -0
67 lines not on this page · raw message
examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_3descbc_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh new file +66 -0
66 lines not on this page · raw message
examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_3descbc_sha1_defs.sh + +SGW_CMD_XPRM=
examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.sh new file +72 -0
72 lines not on this page · raw message
examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_3descbc_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_3descbc_sha1_defs.sh + +SGW_CMD_XPRM=
Signature · 1 line
2.14.5
v2 cover ipsec: add AES-CTR and 3DES-CBC support
In reply to Fan ZhangThis patchset adds the AES-CTR and 3DES-CBC cipher algorithms support to ipsec library. The test scripts for ipsec-secgw sample application are added too.
v2:
- removed unsupported tests.
Fan Zhang (4):
ipsec: add AES-CTR algorithm support
ipsec-secgw: add test scripts for aes ctr
ipsec: add 3DES-CBC algorithm support
ipsec-secgw: add 3des test files
examples/ipsec-secgw/test/common_defs.sh | 4 +- examples/ipsec-secgw/test/run_test.sh | 14 +- .../test/trs_3descbc_sha1_common_defs.sh | 73 +++++++++++ examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh | 67 ++++++++++ .../test/trs_3descbc_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh | 66 ++++++++++ .../ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh | 5 + .../test/trs_aesctr_sha1_common_defs.sh | 69 ++++++++++ examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh | 67 ++++++++++ .../test/trs_aesctr_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh | 66 ++++++++++ .../ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh | 5 + .../test/tun_3descbc_sha1_common_defs.sh | 72 +++++++++++ examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh | 70 ++++++++++ .../test/tun_3descbc_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh | 70 ++++++++++ .../ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh | 5 + .../test/tun_aesctr_sha1_common_defs.sh | 68 ++++++++++ examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh | 70 ++++++++++ .../test/tun_aesctr_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh | 70 ++++++++++ .../ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh | 5 + lib/librte_ipsec/crypto.h | 17 +++ lib/librte_ipsec/sa.c | 143 ++++++++++++++++++--- lib/librte_ipsec/sa.h | 24 ++++ 25 files changed, 1046 insertions(+), 24 deletions(-) create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh
Signature · 1 line
2.14.5
PATCH v2 1/4 ipsec: add AES-CTR algorithm support
This patch adds AES-CTR cipher algorithm support to ipsec library.
--- lib/librte_ipsec/crypto.h | 17 ++++++ lib/librte_ipsec/sa.c | 133 ++++++++++++++++++++++++++++++++++++++-------- lib/librte_ipsec/sa.h | 18 +++++++ 3 files changed, 147 insertions(+), 21 deletions(-)
lib/librte_ipsec/crypto.h +17 -0
@@ -11,6 +11,16 @@* by ipsec library. */ +/* +* AES-CTR counter block format. +*/ + +struct aesctr_cnt_blk { +uint32_t nonce; +uint64_t iv; +uint32_t cnt; +} __attribute__((packed)); +/* * AES-GCM devices have some specific requirements for IV and AAD formats. * Ideally that to be done by the driver itself.
@@ -41,6 +51,13 @@ struct gcm_esph_iv {uint64_t iv; } __attribute__((packed)); +static inline void +aes_ctr_cnt_blk_fill (struct aesctr_cnt_blk *ctr,uint64_t iv,uint32_t nonce) +{ + ctr->nonce = nonce; + ctr->iv = iv; + ctr->cnt =rte_cpu_to_be_32 (1 ); +}static inline void aead_gcm_iv_fill (struct aead_gcm_iv *gcm,uint64_t iv,uint32_t salt)
lib/librte_ipsec/sa.c +112 -21
226 lines not on this page · raw message
lib/librte_ipsec/sa.h +18 -0
@@ -15,10 +15,17 @@enum {IPSEC_PAD_DEFAULT =4 ,IPSEC_PAD_AES_CBC =IPSEC_MAX_IV_SIZE , +IPSEC_PAD_AES_CTR =IPSEC_PAD_DEFAULT ,IPSEC_PAD_AES_GCM =IPSEC_PAD_DEFAULT ,IPSEC_PAD_NULL =IPSEC_PAD_DEFAULT , }; +/* iv sizes for different algorithms */ +enum { +IPSEC_IV_SIZE_DEFAULT =IPSEC_MAX_IV_SIZE , +IPSEC_AES_CTR_IV_SIZE =sizeof (uint64_t ), +}; +/* these definitions probably has to be in rte_crypto_sym.h */ union sym_op_ofslen {uint64_t raw;
@@ -47,7 +54,17 @@ struct replay_sqn { __extension__uint64_t window[0 ]; }; +/*IPSEC SA supported algorithms */ +enum sa_algo_type { +ALGO_TYPE_NULL =0 , +ALGO_TYPE_AES_CBC , +ALGO_TYPE_AES_CTR , +ALGO_TYPE_AES_GCM , +ALGO_TYPE_MAX +}; +struct rte_ipsec_sa { +uint64_t type;/* type of given SA */ uint64_t udata;/* user defined */ uint32_t size;/* size of given sa object */
@@ -65,6 +82,7 @@ struct rte_ipsec_sa {union sym_op_ofslen auth; } ctp;uint32_t salt; +uint8_t algo_type;uint8_t proto;/* next proto */ uint8_t aad_len;uint8_t hdr_len;
Signature · 1 line
2.14.5
Re: [PATCH v2 1/4] ipsec: add AES-CTR algorithm support
Quoted 5 lines
This patch adds AES-CTR cipher algorithm support to ipsec library.
Quoted 8 lines
Signed-off-by Fan Zhang <[email protected]>--- lib/librte_ipsec/crypto.h | 17 ++++++ lib/librte_ipsec/sa.c | 133 ++++++++++++++++++++++++++++++++++++++-------- lib/librte_ipsec/sa.h | 18 +++++++ 3 files changed, 147 insertions(+), 21 deletions(-)--
Quoted 1 line
2.14.5
Re: [PATCH v2 1/4] ipsec: add AES-CTR algorithm support
In reply to Fan ZhangHi Fan,
title should be ipsec: support aes-ctr
Quoted 18 lines · Fan Zhang
This patch adds AES-CTR cipher algorithm support to ipsec library.
Signed-off-by Fan Zhang <[email protected]>--- lib/librte_ipsec/crypto.h | 17 ++++++ lib/librte_ipsec/sa.c | 133 ++++++++++++++++++++++++++++++++++++++-------- lib/librte_ipsec/sa.h | 18 +++++++ 3 files changed, 147 insertions(+), 21 deletions(-)lib/librte_ipsec/crypto.h +0
-0@@ -11,6 +11,16 @@* by ipsec library. */
lib/librte_ipsec/crypto.h line 23
Quoted 10 lines
lib/librte_ipsec/crypto.h +10
-0+/* +* AES-CTR counter block format. +*/ + +struct aesctr_cnt_blk { +uint32_t nonce; +uint64_t iv; +uint32_t cnt; +} __attribute__((packed)); +
I believe cnt should be above iv.
lib/librte_ipsec/crypto.h struct gcm_esph_iv { · line 54
Quoted 8 lines
lib/librte_ipsec/crypto.h +0
-0/* * AES-GCM devices have some specific requirements for IV and AAD formats. * Ideally that to be done by the driver itself. @@ -41,6 +51,13 @@ struct gcm_esph_iv {uint64_t iv; } __attribute__((packed));
Apart from that,
PATCH v2 2/4 ipsec-secgw: add test scripts for aes ctr
In reply to Fan ZhangThis patch adds the functional test scripts to ipsec-secgw sample application for both transport and tunnel working mode.
Updated a bit on common_defs to use "mktemp" instead of "tempfile" as Fedora does not like the command.
--- examples/ipsec-secgw/test/common_defs.sh | 4 +- examples/ipsec-secgw/test/run_test.sh | 8 ++- .../test/trs_aesctr_sha1_common_defs.sh | 69 +++++++++++++++++++++ examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh | 67 +++++++++++++++++++++ .../test/trs_aesctr_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh | 66 ++++++++++++++++++++ .../ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh | 5 ++ .../test/tun_aesctr_sha1_common_defs.sh | 68 +++++++++++++++++++++ examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh | 70 ++++++++++++++++++++++ .../test/tun_aesctr_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh | 70 ++++++++++++++++++++++ .../ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh | 5 ++ 12 files changed, 439 insertions(+), 3 deletions(-) create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh
examples/ipsec-secgw/test/common_defs.sh +2 -2
@@ -53,7 +53,7 @@ SGW_CMD_EAL_PRM="--lcores=${SGW_LCORE} -n 4 ${ETH_DEV}" SGW_CMD_CFG="(0,0,${SGW_LCORE}),(1,0,${SGW_LCORE})" SGW_CMD_PRM="-p 0x3 -u 1 -P --config=\"${SGW_CMD_CFG}\"" -SGW_CFG_FILE=$(tempfile) +SGW_CFG_FILE=$(mktemp) # configure local host/ifaces config_local_iface()
@@ -129,7 +129,7 @@ config6_iface() #start ipsec-secgw secgw_start() { - SGW_EXEC_FILE=$(tempfile) + SGW_EXEC_FILE=$(mktemp) cat <<EOF > ${SGW_EXEC_FILE} ${SGW_PATH} ${SGW_CMD_EAL_PRM} ${CRYPTO_DEV} \ --vdev="net_tap0,mac=fixed" \
examples/ipsec-secgw/test/run_test.sh +7 -1
@@ -32,7 +32,13 @@ trs_aesgcm_esn_atom \ tun_aescbc_sha1_old \ tun_aesgcm_old \ trs_aescbc_sha1_old \ -trs_aesgcm_old" +trs_aesgcm_old \ +tun_aesctr_sha1 \ +tun_aesctr_sha1_esn \ +tun_aesctr_sha1_esn_atom \ +trs_aesctr_sha1 \ +trs_aesctr_sha1_esn \ +trs_aesctr_sha1_esn_atom" DIR=`dirname $0`
examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.sh new file +69 -0
69 lines not on this page · raw message
examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh new file +67 -0
67 lines not on this page · raw message
examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_aesctr_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh new file +66 -0
66 lines not on this page · raw message
examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_aesctr_sha1_defs.sh + +SGW_CMD_XPRM=
examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.sh new file +68 -0
68 lines not on this page · raw message
examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_aesctr_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_aesctr_sha1_defs.sh + +SGW_CMD_XPRM=
Signature · 1 line
2.14.5
Re: [PATCH v2 2/4] ipsec-secgw: add test scripts for aes ctr
Quoted 24 lines
This patch adds the functional test scripts to ipsec-secgw sample application for both transport and tunnel working mode.
Updated a bit on
common_defsto use "mktemp" instead of "tempfile" as Fedora does not like the command.Signed-off-by Fan Zhang <[email protected]>--- examples/ipsec-secgw/test/common_defs.sh | 4 +- examples/ipsec-secgw/test/run_test.sh | 8 ++- .../test/trs_aesctr_sha1_common_defs.sh | 69 +++++++++++++++++++++ examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh | 67 +++++++++++++++++++++ .../test/trs_aesctr_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh | 66 ++++++++++++++++++++ .../ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh | 5 ++ .../test/tun_aesctr_sha1_common_defs.sh | 68 +++++++++++++++++++++ examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh | 70 ++++++++++++++++++++++ .../test/tun_aesctr_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh | 70 ++++++++++++++++++++++ .../ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh | 5 ++ 12 files changed, 439 insertions(+), 3 deletions(-) create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh
Quoted 9 lines
create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh
Quoted 2 lines
--
2.14.5
PATCH v2 3/4 ipsec: add 3DES-CBC algorithm support
In reply to Fan ZhangThis patch adds triple-des CBC mode cipher algorithm to ipsec library.
--- lib/librte_ipsec/sa.c | 10 ++++++++++ lib/librte_ipsec/sa.h | 6 ++++++ 2 files changed, 16 insertions(+)
lib/librte_ipsec/sa.c +10 -0
@@ -307,6 +307,13 @@ esp_sa_init(struct rte_ipsec_sa *sa, const struct rte_ipsec_sa_prm *prm, sa->algo_type =ALGO_TYPE_AES_CTR ;break ; +case RTE_CRYPTO_CIPHER_3DES_CBC : +/* RFC 1851 */ + sa->pad_align =IPSEC_PAD_3DES_CBC ; + sa->iv_len =IPSEC_3DES_IV_SIZE ; + sa->algo_type =ALGO_TYPE_3DES ; +break ; +default :return -EINVAL ; }
@@ -512,6 +519,8 @@ esp_outb_cop_prepare(struct rte_crypto_op *cop, sa->iv_ofs);aes_ctr_cnt_blk_fill (ctr, ivp[0 ], sa->salt);break ; +case ALGO_TYPE_3DES : +/* Cipher-Auth (3DES-CBC *) case */ case ALGO_TYPE_NULL :/* NULL case */ sop->cipher.data.offset = sa->ctp.cipher.offset + hlen;
@@ -873,6 +882,7 @@ esp_inb_tun_cop_prepare(struct rte_crypto_op *cop,aead_gcm_iv_fill (gcm, ivp[0 ], sa->salt);break ;case ALGO_TYPE_AES_CBC : +case ALGO_TYPE_3DES : sop->cipher.data.offset = pofs + sa->ctp.cipher.offset; sop->cipher.data.length = clen; sop->auth.data.offset = pofs + sa->ctp.auth.offset;
lib/librte_ipsec/sa.h +6 -0
@@ -14,6 +14,7 @@/* padding alignment for different algorithms */ enum {IPSEC_PAD_DEFAULT =4 , +IPSEC_PAD_3DES_CBC =IPSEC_PAD_DEFAULT ,IPSEC_PAD_AES_CBC =IPSEC_MAX_IV_SIZE ,IPSEC_PAD_AES_CTR =IPSEC_PAD_DEFAULT ,IPSEC_PAD_AES_GCM =IPSEC_PAD_DEFAULT ,
@@ -24,6 +25,10 @@ enum {enum {IPSEC_IV_SIZE_DEFAULT =IPSEC_MAX_IV_SIZE ,IPSEC_AES_CTR_IV_SIZE =sizeof (uint64_t ), +/* TripleDES supports IV size of 32bits or 64bits but he library +* only supports 64bits. +*/ +IPSEC_3DES_IV_SIZE =sizeof (uint64_t ), };/* these definitions probably has to be in rte_crypto_sym.h */
@@ -57,6 +62,7 @@ struct replay_sqn {/*IPSEC SA supported algorithms */ enum sa_algo_type {ALGO_TYPE_NULL =0 , +ALGO_TYPE_3DES ,ALGO_TYPE_AES_CBC ,ALGO_TYPE_AES_CTR ,ALGO_TYPE_AES_GCM ,
Signature · 1 line
2.14.5
Re: [PATCH v2 3/4] ipsec: add 3DES-CBC algorithm support
Quoted 57 lines
This patch adds triple-des CBC mode cipher algorithm to ipsec library.
Signed-off-by Fan Zhang <[email protected]>--- lib/librte_ipsec/sa.c | 10 ++++++++++ lib/librte_ipsec/sa.h | 6 ++++++ 2 files changed, 16 insertions(+)lib/librte_ipsec/sa.c +10
-0@@ -307,6 +307,13 @@ esp_sa_init(struct rte_ipsec_sa *sa, const struct rte_ipsec_sa_prm *prm, sa->algo_type =ALGO_TYPE_AES_CTR ;break ; +case RTE_CRYPTO_CIPHER_3DES_CBC : +/* RFC 1851 */ + sa->pad_align =IPSEC_PAD_3DES_CBC ; + sa->iv_len =IPSEC_3DES_IV_SIZE ; + sa->algo_type =ALGO_TYPE_3DES ; +break ; +default :return -EINVAL ; }@@ -512,6 +519,8 @@ esp_outb_cop_prepare(struct rte_crypto_op *cop, sa->iv_ofs);aes_ctr_cnt_blk_fill (ctr, ivp[0 ], sa->salt);break ; +case ALGO_TYPE_3DES : +/* Cipher-Auth (3DES-CBC *) case */ case ALGO_TYPE_NULL :/* NULL case */ sop->cipher.data.offset = sa->ctp.cipher.offset + hlen;@@ -873,6 +882,7 @@ esp_inb_tun_cop_prepare(struct rte_crypto_op *cop,aead_gcm_iv_fill (gcm, ivp[0 ], sa->salt);break ;case ALGO_TYPE_AES_CBC : +case ALGO_TYPE_3DES : sop->cipher.data.offset = pofs + sa->ctp.cipher.offset; sop->cipher.data.length = clen; sop->auth.data.offset = pofs + sa->ctp.auth.offset;lib/librte_ipsec/sa.h +1
-0@@ -14,6 +14,7 @@/* padding alignment for different algorithms */ enum {IPSEC_PAD_DEFAULT =4 , +IPSEC_PAD_3DES_CBC =IPSEC_PAD_DEFAULT ,IPSEC_PAD_AES_CBC =IPSEC_MAX_IV_SIZE ,IPSEC_PAD_AES_CTR =IPSEC_PAD_DEFAULT ,IPSEC_PAD_AES_GCM =IPSEC_PAD_DEFAULT ,
lib/librte_ipsec/sa.h enum { · line 28
Quoted 4 lines
lib/librte_ipsec/sa.h +1
-0@@ -24,6 +25,10 @@ enum {enum {IPSEC_IV_SIZE_DEFAULT =IPSEC_MAX_IV_SIZE ,IPSEC_AES_CTR_IV_SIZE =sizeof (uint64_t ), +/* TripleDES supports IV size of 32bits or 64bits but he library
Typo: 's/ he / the /'
Quoted 7 lines
lib/librte_ipsec/sa.h +3
-0+* only supports 64bits. +*/ + IPSEC_3DES_IV_SIZE = sizeof(uint64_t), };/* these definitions probably has to be in rte_crypto_sym.h */
lib/librte_ipsec/sa.h struct replay_sqn {
Quoted 8 lines
lib/librte_ipsec/sa.h +1
-1@@ -57,6 +62,7 @@ struct replay_sqn {/*IPSEC SA supported algorithms */ enum sa_algo_type {ALGO_TYPE_NULL =0 , +ALGO_TYPE_3DES ,ALGO_TYPE_AES_CBC ,ALGO_TYPE_AES_CTR ,ALGO_TYPE_AES_GCM , --
Quoted 1 line
2.14.5
Re: [PATCH v2 3/4] ipsec: add 3DES-CBC algorithm support
In reply to Fan ZhangQuoted 68 lines · Fan Zhang
This patch adds triple-des CBC mode cipher algorithm to ipsec library.
Signed-off-by Fan Zhang <[email protected]>--- lib/librte_ipsec/sa.c | 10 ++++++++++ lib/librte_ipsec/sa.h | 6 ++++++ 2 files changed, 16 insertions(+)lib/librte_ipsec/sa.c +10
-0@@ -307,6 +307,13 @@ esp_sa_init(struct rte_ipsec_sa *sa, const struct rte_ipsec_sa_prm *prm, sa->algo_type =ALGO_TYPE_AES_CTR ;break ; +case RTE_CRYPTO_CIPHER_3DES_CBC : +/* RFC 1851 */ + sa->pad_align =IPSEC_PAD_3DES_CBC ; + sa->iv_len =IPSEC_3DES_IV_SIZE ; + sa->algo_type =ALGO_TYPE_3DES ; +break ; +default :return -EINVAL ; }@@ -512,6 +519,8 @@ esp_outb_cop_prepare(struct rte_crypto_op *cop, sa->iv_ofs);aes_ctr_cnt_blk_fill (ctr, ivp[0 ], sa->salt);break ; +case ALGO_TYPE_3DES : +/* Cipher-Auth (3DES-CBC *) case */ case ALGO_TYPE_NULL :/* NULL case */ sop->cipher.data.offset = sa->ctp.cipher.offset + hlen;@@ -873,6 +882,7 @@ esp_inb_tun_cop_prepare(struct rte_crypto_op *cop,aead_gcm_iv_fill (gcm, ivp[0 ], sa->salt);break ;case ALGO_TYPE_AES_CBC : +case ALGO_TYPE_3DES : sop->cipher.data.offset = pofs + sa->ctp.cipher.offset; sop->cipher.data.length = clen; sop->auth.data.offset = pofs + sa->ctp.auth.offset;lib/librte_ipsec/sa.h +5
-0@@ -14,6 +14,7 @@/* padding alignment for different algorithms */ enum {IPSEC_PAD_DEFAULT =4 , +IPSEC_PAD_3DES_CBC =IPSEC_PAD_DEFAULT ,IPSEC_PAD_AES_CBC =IPSEC_MAX_IV_SIZE ,IPSEC_PAD_AES_CTR =IPSEC_PAD_DEFAULT ,IPSEC_PAD_AES_GCM =IPSEC_PAD_DEFAULT ,@@ -24,6 +25,10 @@ enum {enum {IPSEC_IV_SIZE_DEFAULT =IPSEC_MAX_IV_SIZE ,IPSEC_AES_CTR_IV_SIZE =sizeof (uint64_t ), +/* TripleDES supports IV size of 32bits or 64bits but he library +* only supports 64bits. +*/ +IPSEC_3DES_IV_SIZE =sizeof (uint64_t ), };/* these definitions probably has to be in rte_crypto_sym.h */
lib/librte_ipsec/sa.h struct replay_sqn { · line 65
Quoted 4 lines
lib/librte_ipsec/sa.h +1
-0@@ -57,6 +62,7 @@ struct replay_sqn {/*IPSEC SA supported algorithms */ enum sa_algo_type {ALGO_TYPE_NULL =0 , +ALGO_TYPE_3DES ,
this should be 3des_cbc
Quoted 3 lines
lib/librte_ipsec/sa.h +0
-0ALGO_TYPE_AES_CBC ,ALGO_TYPE_AES_CTR , ALGO_TYPE_AES_GCM,
PATCH v2 4/4 ipsec-secgw: add 3des test files
In reply to Fan ZhangThis patch adds the functional test scripts to ipsec-secgw sample application for both transport and tunnel working mode.
--- examples/ipsec-secgw/test/run_test.sh | 8 ++- .../test/trs_3descbc_sha1_common_defs.sh | 73 ++++++++++++++++++++++ examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh | 67 ++++++++++++++++++++ .../test/trs_3descbc_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh | 66 +++++++++++++++++++ .../ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh | 5 ++ .../test/tun_3descbc_sha1_common_defs.sh | 72 +++++++++++++++++++++ examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh | 70 +++++++++++++++++++++ .../test/tun_3descbc_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh | 70 +++++++++++++++++++++ .../ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh | 5 ++ 11 files changed, 445 insertions(+), 1 deletion(-) create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh
examples/ipsec-secgw/test/run_test.sh +7 -1
@@ -38,7 +38,13 @@ tun_aesctr_sha1_esn \ tun_aesctr_sha1_esn_atom \ trs_aesctr_sha1 \ trs_aesctr_sha1_esn \ -trs_aesctr_sha1_esn_atom" +trs_aesctr_sha1_esn_atom \ +tun_3descbc_sha1 \ +tun_3descbc_sha1_esn \ +tun_3descbc_sha1_esn_atom \ +trs_3descbc_sha1 \ +trs_3descbc_sha1_esn \ +trs_3descbc_sha1_esn_atom" DIR=`dirname $0`
examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.sh new file +73 -0
73 lines not on this page · raw message
examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh new file +67 -0
67 lines not on this page · raw message
examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_3descbc_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh new file +66 -0
66 lines not on this page · raw message
examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_3descbc_sha1_defs.sh + +SGW_CMD_XPRM=
examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.sh new file +72 -0
72 lines not on this page · raw message
examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_3descbc_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_3descbc_sha1_defs.sh + +SGW_CMD_XPRM=
Signature · 1 line
2.14.5
Re: [PATCH v2 4/4] ipsec-secgw: add 3des test files
Quoted 38 lines
-----Original Message-----
From: Zhang, Roy Fan
Sent: Tuesday, February 19, 2019 3:33 PM
To: [email protected]
Cc: [email protected]; Ananyev, Konstantin <[email protected]>; Zhang, Roy Fan <[email protected]>
Subject: [PATCH v2 4/4] ipsec-secgw: add 3des test filesThis patch adds the functional test scripts to ipsec-secgw sample application for both transport and tunnel working mode.
Signed-off-by Fan Zhang <[email protected]>--- examples/ipsec-secgw/test/run_test.sh | 8 ++- .../test/trs_3descbc_sha1_common_defs.sh | 73 ++++++++++++++++++++++ examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh | 67 ++++++++++++++++++++ .../test/trs_3descbc_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh | 66 +++++++++++++++++++ .../ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh | 5 ++ .../test/tun_3descbc_sha1_common_defs.sh | 72 +++++++++++++++++++++ examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh | 70 +++++++++++++++++++++ .../test/tun_3descbc_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh | 70 +++++++++++++++++++++ .../ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh | 5 ++ 11 files changed, 445 insertions(+), 1 deletion(-) create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh
Quoted 1 line
--
Quoted 1 line
2.14.5
v3 cover ipsec: add AES-CTR and 3DES-CBC support
In reply to Fan ZhangThis patchset adds the AES-CTR and 3DES-CBC cipher algorithms support to ipsec library. The test scripts for ipsec-secgw sample application are added too.
v3:
- fixed a bug in 3DES.
v2:
- removed unsupported tests.
Fan Zhang (4):
ipsec: add AES-CTR algorithm support
ipsec-secgw: add test scripts for aes ctr
ipsec: add 3DES-CBC algorithm support
ipsec-secgw: add 3des test files
examples/ipsec-secgw/test/common_defs.sh | 4 +- examples/ipsec-secgw/test/run_test.sh | 14 ++- .../test/trs_3descbc_sha1_common_defs.sh | 73 +++++++++++ examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh | 67 ++++++++++ .../test/trs_3descbc_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh | 66 ++++++++++ .../ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh | 5 + .../test/trs_aesctr_sha1_common_defs.sh | 69 +++++++++++ examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh | 67 ++++++++++ .../test/trs_aesctr_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh | 66 ++++++++++ .../ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh | 5 + .../test/tun_3descbc_sha1_common_defs.sh | 72 +++++++++++ examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh | 70 +++++++++++ .../test/tun_3descbc_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh | 70 +++++++++++ .../ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh | 5 + .../test/tun_aesctr_sha1_common_defs.sh | 68 ++++++++++ examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh | 70 +++++++++++ .../test/tun_aesctr_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh | 70 +++++++++++ .../ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh | 5 + lib/librte_ipsec/crypto.h | 17 +++ lib/librte_ipsec/sa.c | 137 +++++++++++++++++---- lib/librte_ipsec/sa.h | 24 ++++ 25 files changed, 1040 insertions(+), 24 deletions(-) create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh
Signature · 1 line
2.14.5
PATCH v3 1/4 ipsec: add AES-CTR algorithm support
This patch adds AES-CTR cipher algorithm support to ipsec library.
--- lib/librte_ipsec/crypto.h | 17 ++++++ lib/librte_ipsec/sa.c | 133 ++++++++++++++++++++++++++++++++++++++-------- lib/librte_ipsec/sa.h | 18 +++++++ 3 files changed, 147 insertions(+), 21 deletions(-)
lib/librte_ipsec/crypto.h +17 -0
@@ -11,6 +11,16 @@* by ipsec library. */ +/* +* AES-CTR counter block format. +*/ + +struct aesctr_cnt_blk { +uint32_t nonce; +uint64_t iv; +uint32_t cnt; +} __attribute__((packed)); +/* * AES-GCM devices have some specific requirements for IV and AAD formats. * Ideally that to be done by the driver itself.
@@ -41,6 +51,13 @@ struct gcm_esph_iv {uint64_t iv; } __attribute__((packed)); +static inline void +aes_ctr_cnt_blk_fill (struct aesctr_cnt_blk *ctr,uint64_t iv,uint32_t nonce) +{ + ctr->nonce = nonce; + ctr->iv = iv; + ctr->cnt =rte_cpu_to_be_32 (1 ); +}static inline void aead_gcm_iv_fill (struct aead_gcm_iv *gcm,uint64_t iv,uint32_t salt)
lib/librte_ipsec/sa.c +112 -21
226 lines not on this page · raw message
lib/librte_ipsec/sa.h +18 -0
@@ -15,10 +15,17 @@enum {IPSEC_PAD_DEFAULT =4 ,IPSEC_PAD_AES_CBC =IPSEC_MAX_IV_SIZE , +IPSEC_PAD_AES_CTR =IPSEC_PAD_DEFAULT ,IPSEC_PAD_AES_GCM =IPSEC_PAD_DEFAULT ,IPSEC_PAD_NULL =IPSEC_PAD_DEFAULT , }; +/* iv sizes for different algorithms */ +enum { +IPSEC_IV_SIZE_DEFAULT =IPSEC_MAX_IV_SIZE , +IPSEC_AES_CTR_IV_SIZE =sizeof (uint64_t ), +}; +/* these definitions probably has to be in rte_crypto_sym.h */ union sym_op_ofslen {uint64_t raw;
@@ -47,7 +54,17 @@ struct replay_sqn { __extension__uint64_t window[0 ]; }; +/*IPSEC SA supported algorithms */ +enum sa_algo_type { +ALGO_TYPE_NULL =0 , +ALGO_TYPE_AES_CBC , +ALGO_TYPE_AES_CTR , +ALGO_TYPE_AES_GCM , +ALGO_TYPE_MAX +}; +struct rte_ipsec_sa { +uint64_t type;/* type of given SA */ uint64_t udata;/* user defined */ uint32_t size;/* size of given sa object */
@@ -65,6 +82,7 @@ struct rte_ipsec_sa {union sym_op_ofslen auth; } ctp;uint32_t salt; +uint8_t algo_type;uint8_t proto;/* next proto */ uint8_t aad_len;uint8_t hdr_len;
Signature · 1 line
2.14.5
PATCH v3 2/4 ipsec-secgw: add test scripts for aes ctr
In reply to Fan ZhangThis patch adds the functional test scripts to ipsec-secgw sample application for both transport and tunnel working mode.
Updated a bit on common_defs to use "mktemp" instead of "tempfile" as Fedora does not like the command.
--- examples/ipsec-secgw/test/common_defs.sh | 4 +- examples/ipsec-secgw/test/run_test.sh | 8 ++- .../test/trs_aesctr_sha1_common_defs.sh | 69 +++++++++++++++++++++ examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh | 67 +++++++++++++++++++++ .../test/trs_aesctr_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh | 66 ++++++++++++++++++++ .../ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh | 5 ++ .../test/tun_aesctr_sha1_common_defs.sh | 68 +++++++++++++++++++++ examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh | 70 ++++++++++++++++++++++ .../test/tun_aesctr_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh | 70 ++++++++++++++++++++++ .../ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh | 5 ++ 12 files changed, 439 insertions(+), 3 deletions(-) create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh
examples/ipsec-secgw/test/common_defs.sh +2 -2
@@ -53,7 +53,7 @@ SGW_CMD_EAL_PRM="--lcores=${SGW_LCORE} -n 4 ${ETH_DEV}" SGW_CMD_CFG="(0,0,${SGW_LCORE}),(1,0,${SGW_LCORE})" SGW_CMD_PRM="-p 0x3 -u 1 -P --config=\"${SGW_CMD_CFG}\"" -SGW_CFG_FILE=$(tempfile) +SGW_CFG_FILE=$(mktemp) # configure local host/ifaces config_local_iface()
@@ -129,7 +129,7 @@ config6_iface() #start ipsec-secgw secgw_start() { - SGW_EXEC_FILE=$(tempfile) + SGW_EXEC_FILE=$(mktemp) cat <<EOF > ${SGW_EXEC_FILE} ${SGW_PATH} ${SGW_CMD_EAL_PRM} ${CRYPTO_DEV} \ --vdev="net_tap0,mac=fixed" \
examples/ipsec-secgw/test/run_test.sh +7 -1
@@ -32,7 +32,13 @@ trs_aesgcm_esn_atom \ tun_aescbc_sha1_old \ tun_aesgcm_old \ trs_aescbc_sha1_old \ -trs_aesgcm_old" +trs_aesgcm_old \ +tun_aesctr_sha1 \ +tun_aesctr_sha1_esn \ +tun_aesctr_sha1_esn_atom \ +trs_aesctr_sha1 \ +trs_aesctr_sha1_esn \ +trs_aesctr_sha1_esn_atom" DIR=`dirname $0`
examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.sh new file +69 -0
69 lines not on this page · raw message
examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh new file +67 -0
67 lines not on this page · raw message
examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_aesctr_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh new file +66 -0
66 lines not on this page · raw message
examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_aesctr_sha1_defs.sh + +SGW_CMD_XPRM=
examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.sh new file +68 -0
68 lines not on this page · raw message
examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_aesctr_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_aesctr_sha1_defs.sh + +SGW_CMD_XPRM=
Signature · 1 line
2.14.5
PATCH v3 3/4 ipsec: add 3DES-CBC algorithm support
In reply to Fan ZhangThis patch adds triple-des CBC mode cipher algorithm to ipsec library.
--- lib/librte_ipsec/sa.c | 40 ++++++++++++++++++++++------------------ lib/librte_ipsec/sa.h | 6 ++++++ 2 files changed, 28 insertions(+), 18 deletions(-)
lib/librte_ipsec/sa.c +22 -18
@@ -238,6 +238,7 @@ esp_outb_init(struct rte_ipsec_sa *sa, uint32_t hlen) sa->ctp.cipher.length =0 ;break ;case ALGO_TYPE_AES_CBC : +case ALGO_TYPE_3DES : sa->ctp.cipher.offset = sa->hdr_len +sizeof (struct esp_hdr ); sa->ctp.cipher.length = sa->iv_len;break ;
@@ -307,6 +308,13 @@ esp_sa_init(struct rte_ipsec_sa *sa, const struct rte_ipsec_sa_prm *prm, sa->algo_type =ALGO_TYPE_AES_CTR ;break ; +case RTE_CRYPTO_CIPHER_3DES_CBC : +/* RFC 1851 */ + sa->pad_align =IPSEC_PAD_3DES_CBC ; + sa->iv_len =IPSEC_3DES_IV_SIZE ; + sa->algo_type =ALGO_TYPE_3DES ; +break ; +default :return -EINVAL ; }
@@ -476,6 +484,19 @@ esp_outb_cop_prepare(struct rte_crypto_op *cop, sop = cop->sym;switch (algo_type) { +case ALGO_TYPE_AES_CBC : +/* Cipher-Auth (AES-CBC *) case */ +case ALGO_TYPE_3DES : +/* Cipher-Auth (3DES-CBC *) case */ +case ALGO_TYPE_NULL : +/* NULL case */ + sop->cipher.data.offset = sa->ctp.cipher.offset + hlen; + sop->cipher.data.length = sa->ctp.cipher.length + plen; + sop->auth.data.offset = sa->ctp.auth.offset + hlen; + sop->auth.data.length = sa->ctp.auth.length + plen; + sop->auth.digest.data = icv->va; + sop->auth.digest.phys_addr = icv->pa; +break ;case ALGO_TYPE_AES_GCM :/* AEAD (AES_GCM) case */ sop->aead.data.offset = sa->ctp.cipher.offset + hlen;
@@ -490,15 +511,6 @@ esp_outb_cop_prepare(struct rte_crypto_op *cop, sa->iv_ofs);aead_gcm_iv_fill (gcm, ivp[0 ], sa->salt);break ; -case ALGO_TYPE_AES_CBC : -/* Cipher-Auth (AES-CBC *) case */ - sop->cipher.data.offset = sa->ctp.cipher.offset + hlen; - sop->cipher.data.length = sa->ctp.cipher.length + plen; - sop->auth.data.offset = sa->ctp.auth.offset + hlen; - sop->auth.data.length = sa->ctp.auth.length + plen; - sop->auth.digest.data = icv->va; - sop->auth.digest.phys_addr = icv->pa; -break ;case ALGO_TYPE_AES_CTR :/* Cipher-Auth (AES-CTR *) case */ sop->cipher.data.offset = sa->ctp.cipher.offset + hlen;
@@ -512,15 +524,6 @@ esp_outb_cop_prepare(struct rte_crypto_op *cop, sa->iv_ofs);aes_ctr_cnt_blk_fill (ctr, ivp[0 ], sa->salt);break ; -case ALGO_TYPE_NULL : -/* NULL case */ - sop->cipher.data.offset = sa->ctp.cipher.offset + hlen; - sop->cipher.data.length = sa->ctp.cipher.length + plen; - sop->auth.data.offset = sa->ctp.auth.offset + hlen; - sop->auth.data.length = sa->ctp.auth.length + plen; - sop->auth.digest.data = icv->va; - sop->auth.digest.phys_addr = icv->pa; -break ;default :break ; }
@@ -873,6 +876,7 @@ esp_inb_tun_cop_prepare(struct rte_crypto_op *cop,aead_gcm_iv_fill (gcm, ivp[0 ], sa->salt);break ;case ALGO_TYPE_AES_CBC : +case ALGO_TYPE_3DES : sop->cipher.data.offset = pofs + sa->ctp.cipher.offset; sop->cipher.data.length = clen; sop->auth.data.offset = pofs + sa->ctp.auth.offset;
lib/librte_ipsec/sa.h +6 -0
@@ -14,6 +14,7 @@/* padding alignment for different algorithms */ enum {IPSEC_PAD_DEFAULT =4 , +IPSEC_PAD_3DES_CBC =8 ,IPSEC_PAD_AES_CBC =IPSEC_MAX_IV_SIZE ,IPSEC_PAD_AES_CTR =IPSEC_PAD_DEFAULT ,IPSEC_PAD_AES_GCM =IPSEC_PAD_DEFAULT ,
@@ -24,6 +25,10 @@ enum {enum {IPSEC_IV_SIZE_DEFAULT =IPSEC_MAX_IV_SIZE ,IPSEC_AES_CTR_IV_SIZE =sizeof (uint64_t ), +/* TripleDES supports IV size of 32bits or 64bits but he library +* only supports 64bits. +*/ +IPSEC_3DES_IV_SIZE =sizeof (uint64_t ), };/* these definitions probably has to be in rte_crypto_sym.h */
@@ -57,6 +62,7 @@ struct replay_sqn {/*IPSEC SA supported algorithms */ enum sa_algo_type {ALGO_TYPE_NULL =0 , +ALGO_TYPE_3DES ,ALGO_TYPE_AES_CBC ,ALGO_TYPE_AES_CTR ,ALGO_TYPE_AES_GCM ,
Signature · 1 line
2.14.5
PATCH v3 4/4 ipsec-secgw: add 3des test files
In reply to Fan ZhangThis patch adds the functional test scripts to ipsec-secgw sample application for both transport and tunnel working mode.
--- examples/ipsec-secgw/test/run_test.sh | 8 ++- .../test/trs_3descbc_sha1_common_defs.sh | 73 ++++++++++++++++++++++ examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh | 67 ++++++++++++++++++++ .../test/trs_3descbc_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh | 66 +++++++++++++++++++ .../ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh | 5 ++ .../test/tun_3descbc_sha1_common_defs.sh | 72 +++++++++++++++++++++ examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh | 70 +++++++++++++++++++++ .../test/tun_3descbc_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh | 70 +++++++++++++++++++++ .../ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh | 5 ++ 11 files changed, 445 insertions(+), 1 deletion(-) create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh
examples/ipsec-secgw/test/run_test.sh +7 -1
@@ -38,7 +38,13 @@ tun_aesctr_sha1_esn \ tun_aesctr_sha1_esn_atom \ trs_aesctr_sha1 \ trs_aesctr_sha1_esn \ -trs_aesctr_sha1_esn_atom" +trs_aesctr_sha1_esn_atom \ +tun_3descbc_sha1 \ +tun_3descbc_sha1_esn \ +tun_3descbc_sha1_esn_atom \ +trs_3descbc_sha1 \ +trs_3descbc_sha1_esn \ +trs_3descbc_sha1_esn_atom" DIR=`dirname $0`
examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.sh new file +73 -0
73 lines not on this page · raw message
examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh new file +67 -0
67 lines not on this page · raw message
examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_3descbc_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh new file +66 -0
66 lines not on this page · raw message
examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_3descbc_sha1_defs.sh + +SGW_CMD_XPRM=
examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.sh new file +72 -0
72 lines not on this page · raw message
examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_3descbc_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_3descbc_sha1_defs.sh + +SGW_CMD_XPRM=
Signature · 1 line
2.14.5
Quoted 66 lines
This patchset adds the AES-CTR and 3DES-CBC cipher algorithms support to ipsec library. The test scripts for ipsec-secgw sample application are added too.
v3:
- fixed a bug in 3DES.v2:
- removed unsupported tests.Fan Zhang (4):
ipsec: add AES-CTR algorithm support
ipsec-secgw: add test scripts for aes ctr
ipsec: add 3DES-CBC algorithm support
ipsec-secgw: add 3des test filesexamples/ipsec-secgw/test/common_defs.sh | 4 +- examples/ipsec-secgw/test/run_test.sh | 14 ++- .../test/trs_3descbc_sha1_common_defs.sh | 73 +++++++++++ examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh | 67 ++++++++++ .../test/trs_3descbc_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh | 66 ++++++++++ .../ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh | 5 + .../test/trs_aesctr_sha1_common_defs.sh | 69 +++++++++++ examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh | 67 ++++++++++ .../test/trs_aesctr_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh | 66 ++++++++++ .../ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh | 5 + .../test/tun_3descbc_sha1_common_defs.sh | 72 +++++++++++ examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh | 70 +++++++++++ .../test/tun_3descbc_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh | 70 +++++++++++ .../ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh | 5 + .../test/tun_aesctr_sha1_common_defs.sh | 68 ++++++++++ examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh | 70 +++++++++++ .../test/tun_aesctr_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh | 70 +++++++++++ .../ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh | 5 + lib/librte_ipsec/crypto.h | 17 +++ lib/librte_ipsec/sa.c | 137 +++++++++++++++++---- lib/librte_ipsec/sa.h | 24 ++++ 25 files changed, 1040 insertions(+), 24 deletions(-) create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh
Quoted 1 line
--
Quoted 1 line
2.14.5
v4 cover ipsec: support AES-CTR and 3DES-CBC
In reply to Fan ZhangThis patchset adds the AES-CTR and 3DES-CBC cipher algorithms support to ipsec library. The test scripts for ipsec-secgw sample application are added.
v4:
- changed patch titles.
- changed ALGO_TYPE naming for 3DES-CBC
v3:
- fixed a bug in 3DES.
v2:
- removed unsupported tests.
Fan Zhang (4):
ipsec: support AES-CTR
ipsec-secgw: add test scripts for aes ctr
ipsec: support 3DES-CBC
ipsec-secgw: add 3des test files
examples/ipsec-secgw/test/common_defs.sh | 4 +- examples/ipsec-secgw/test/run_test.sh | 14 ++- .../test/trs_3descbc_sha1_common_defs.sh | 73 +++++++++++ examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh | 67 ++++++++++ .../test/trs_3descbc_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh | 66 ++++++++++ .../ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh | 5 + .../test/trs_aesctr_sha1_common_defs.sh | 69 +++++++++++ examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh | 67 ++++++++++ .../test/trs_aesctr_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh | 66 ++++++++++ .../ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh | 5 + .../test/tun_3descbc_sha1_common_defs.sh | 72 +++++++++++ examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh | 70 +++++++++++ .../test/tun_3descbc_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh | 70 +++++++++++ .../ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh | 5 + .../test/tun_aesctr_sha1_common_defs.sh | 68 ++++++++++ examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh | 70 +++++++++++ .../test/tun_aesctr_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh | 70 +++++++++++ .../ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh | 5 + lib/librte_ipsec/crypto.h | 17 +++ lib/librte_ipsec/sa.c | 137 +++++++++++++++++---- lib/librte_ipsec/sa.h | 24 ++++ 25 files changed, 1040 insertions(+), 24 deletions(-) create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh
Signature · 1 line
2.14.5
PATCH v4 1/4 ipsec: support AES-CTR
This patch adds AES-CTR cipher algorithm support to ipsec library.
--- lib/librte_ipsec/crypto.h | 17 ++++++ lib/librte_ipsec/sa.c | 133 ++++++++++++++++++++++++++++++++++++++-------- lib/librte_ipsec/sa.h | 18 +++++++ 3 files changed, 147 insertions(+), 21 deletions(-)
lib/librte_ipsec/crypto.h +17 -0
@@ -11,6 +11,16 @@* by ipsec library. */ +/* +* AES-CTR counter block format. +*/ + +struct aesctr_cnt_blk { +uint32_t nonce; +uint64_t iv; +uint32_t cnt; +} __attribute__((packed)); +/* * AES-GCM devices have some specific requirements for IV and AAD formats. * Ideally that to be done by the driver itself.
@@ -41,6 +51,13 @@ struct gcm_esph_iv {uint64_t iv; } __attribute__((packed)); +static inline void +aes_ctr_cnt_blk_fill (struct aesctr_cnt_blk *ctr,uint64_t iv,uint32_t nonce) +{ + ctr->nonce = nonce; + ctr->iv = iv; + ctr->cnt =rte_cpu_to_be_32 (1 ); +}static inline void aead_gcm_iv_fill (struct aead_gcm_iv *gcm,uint64_t iv,uint32_t salt)
lib/librte_ipsec/sa.c +112 -21
226 lines not on this page · raw message
lib/librte_ipsec/sa.h +18 -0
@@ -15,10 +15,17 @@enum {IPSEC_PAD_DEFAULT =4 ,IPSEC_PAD_AES_CBC =IPSEC_MAX_IV_SIZE , +IPSEC_PAD_AES_CTR =IPSEC_PAD_DEFAULT ,IPSEC_PAD_AES_GCM =IPSEC_PAD_DEFAULT ,IPSEC_PAD_NULL =IPSEC_PAD_DEFAULT , }; +/* iv sizes for different algorithms */ +enum { +IPSEC_IV_SIZE_DEFAULT =IPSEC_MAX_IV_SIZE , +IPSEC_AES_CTR_IV_SIZE =sizeof (uint64_t ), +}; +/* these definitions probably has to be in rte_crypto_sym.h */ union sym_op_ofslen {uint64_t raw;
@@ -47,7 +54,17 @@ struct replay_sqn { __extension__uint64_t window[0 ]; }; +/*IPSEC SA supported algorithms */ +enum sa_algo_type { +ALGO_TYPE_NULL =0 , +ALGO_TYPE_AES_CBC , +ALGO_TYPE_AES_CTR , +ALGO_TYPE_AES_GCM , +ALGO_TYPE_MAX +}; +struct rte_ipsec_sa { +uint64_t type;/* type of given SA */ uint64_t udata;/* user defined */ uint32_t size;/* size of given sa object */
@@ -65,6 +82,7 @@ struct rte_ipsec_sa {union sym_op_ofslen auth; } ctp;uint32_t salt; +uint8_t algo_type;uint8_t proto;/* next proto */ uint8_t aad_len;uint8_t hdr_len;
Signature · 1 line
2.14.5
PATCH v4 2/4 ipsec-secgw: add test scripts for aes ctr
In reply to Fan ZhangThis patch adds the functional test scripts to ipsec-secgw sample application for both transport and tunnel working mode.
Updated a bit on common_defs to use "mktemp" instead of "tempfile" as Fedora does not like the command.
--- examples/ipsec-secgw/test/common_defs.sh | 4 +- examples/ipsec-secgw/test/run_test.sh | 8 ++- .../test/trs_aesctr_sha1_common_defs.sh | 69 +++++++++++++++++++++ examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh | 67 +++++++++++++++++++++ .../test/trs_aesctr_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh | 66 ++++++++++++++++++++ .../ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh | 5 ++ .../test/tun_aesctr_sha1_common_defs.sh | 68 +++++++++++++++++++++ examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh | 70 ++++++++++++++++++++++ .../test/tun_aesctr_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh | 70 ++++++++++++++++++++++ .../ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh | 5 ++ 12 files changed, 439 insertions(+), 3 deletions(-) create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh
examples/ipsec-secgw/test/common_defs.sh +2 -2
@@ -53,7 +53,7 @@ SGW_CMD_EAL_PRM="--lcores=${SGW_LCORE} -n 4 ${ETH_DEV}" SGW_CMD_CFG="(0,0,${SGW_LCORE}),(1,0,${SGW_LCORE})" SGW_CMD_PRM="-p 0x3 -u 1 -P --config=\"${SGW_CMD_CFG}\"" -SGW_CFG_FILE=$(tempfile) +SGW_CFG_FILE=$(mktemp) # configure local host/ifaces config_local_iface()
@@ -129,7 +129,7 @@ config6_iface() #start ipsec-secgw secgw_start() { - SGW_EXEC_FILE=$(tempfile) + SGW_EXEC_FILE=$(mktemp) cat <<EOF > ${SGW_EXEC_FILE} ${SGW_PATH} ${SGW_CMD_EAL_PRM} ${CRYPTO_DEV} \ --vdev="net_tap0,mac=fixed" \
examples/ipsec-secgw/test/run_test.sh +7 -1
@@ -32,7 +32,13 @@ trs_aesgcm_esn_atom \ tun_aescbc_sha1_old \ tun_aesgcm_old \ trs_aescbc_sha1_old \ -trs_aesgcm_old" +trs_aesgcm_old \ +tun_aesctr_sha1 \ +tun_aesctr_sha1_esn \ +tun_aesctr_sha1_esn_atom \ +trs_aesctr_sha1 \ +trs_aesctr_sha1_esn \ +trs_aesctr_sha1_esn_atom" DIR=`dirname $0`
examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.sh new file +69 -0
69 lines not on this page · raw message
examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh new file +67 -0
67 lines not on this page · raw message
examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_aesctr_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh new file +66 -0
66 lines not on this page · raw message
examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_aesctr_sha1_defs.sh + +SGW_CMD_XPRM=
examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.sh new file +68 -0
68 lines not on this page · raw message
examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_aesctr_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_aesctr_sha1_defs.sh + +SGW_CMD_XPRM=
Signature · 1 line
2.14.5
PATCH v4 3/4 ipsec: support 3DES-CBC
In reply to Fan ZhangThis patch adds triple-des CBC mode cipher algorithm to ipsec library.
--- lib/librte_ipsec/sa.c | 40 ++++++++++++++++++++++------------------ lib/librte_ipsec/sa.h | 6 ++++++ 2 files changed, 28 insertions(+), 18 deletions(-)
lib/librte_ipsec/sa.c +22 -18
@@ -238,6 +238,7 @@ esp_outb_init(struct rte_ipsec_sa *sa, uint32_t hlen) sa->ctp.cipher.length =0 ;break ;case ALGO_TYPE_AES_CBC : +case ALGO_TYPE_3DES_CBC : sa->ctp.cipher.offset = sa->hdr_len +sizeof (struct esp_hdr ); sa->ctp.cipher.length = sa->iv_len;break ;
@@ -307,6 +308,13 @@ esp_sa_init(struct rte_ipsec_sa *sa, const struct rte_ipsec_sa_prm *prm, sa->algo_type =ALGO_TYPE_AES_CTR ;break ; +case RTE_CRYPTO_CIPHER_3DES_CBC : +/* RFC 1851 */ + sa->pad_align =IPSEC_PAD_3DES_CBC ; + sa->iv_len =IPSEC_3DES_IV_SIZE ; + sa->algo_type =ALGO_TYPE_3DES_CBC ; +break ; +default :return -EINVAL ; }
@@ -476,6 +484,19 @@ esp_outb_cop_prepare(struct rte_crypto_op *cop, sop = cop->sym;switch (algo_type) { +case ALGO_TYPE_AES_CBC : +/* Cipher-Auth (AES-CBC *) case */ +case ALGO_TYPE_3DES_CBC : +/* Cipher-Auth (3DES-CBC *) case */ +case ALGO_TYPE_NULL : +/* NULL case */ + sop->cipher.data.offset = sa->ctp.cipher.offset + hlen; + sop->cipher.data.length = sa->ctp.cipher.length + plen; + sop->auth.data.offset = sa->ctp.auth.offset + hlen; + sop->auth.data.length = sa->ctp.auth.length + plen; + sop->auth.digest.data = icv->va; + sop->auth.digest.phys_addr = icv->pa; +break ;case ALGO_TYPE_AES_GCM :/* AEAD (AES_GCM) case */ sop->aead.data.offset = sa->ctp.cipher.offset + hlen;
@@ -490,15 +511,6 @@ esp_outb_cop_prepare(struct rte_crypto_op *cop, sa->iv_ofs);aead_gcm_iv_fill (gcm, ivp[0 ], sa->salt);break ; -case ALGO_TYPE_AES_CBC : -/* Cipher-Auth (AES-CBC *) case */ - sop->cipher.data.offset = sa->ctp.cipher.offset + hlen; - sop->cipher.data.length = sa->ctp.cipher.length + plen; - sop->auth.data.offset = sa->ctp.auth.offset + hlen; - sop->auth.data.length = sa->ctp.auth.length + plen; - sop->auth.digest.data = icv->va; - sop->auth.digest.phys_addr = icv->pa; -break ;case ALGO_TYPE_AES_CTR :/* Cipher-Auth (AES-CTR *) case */ sop->cipher.data.offset = sa->ctp.cipher.offset + hlen;
@@ -512,15 +524,6 @@ esp_outb_cop_prepare(struct rte_crypto_op *cop, sa->iv_ofs);aes_ctr_cnt_blk_fill (ctr, ivp[0 ], sa->salt);break ; -case ALGO_TYPE_NULL : -/* NULL case */ - sop->cipher.data.offset = sa->ctp.cipher.offset + hlen; - sop->cipher.data.length = sa->ctp.cipher.length + plen; - sop->auth.data.offset = sa->ctp.auth.offset + hlen; - sop->auth.data.length = sa->ctp.auth.length + plen; - sop->auth.digest.data = icv->va; - sop->auth.digest.phys_addr = icv->pa; -break ;default :break ; }
@@ -873,6 +876,7 @@ esp_inb_tun_cop_prepare(struct rte_crypto_op *cop,aead_gcm_iv_fill (gcm, ivp[0 ], sa->salt);break ;case ALGO_TYPE_AES_CBC : +case ALGO_TYPE_3DES_CBC : sop->cipher.data.offset = pofs + sa->ctp.cipher.offset; sop->cipher.data.length = clen; sop->auth.data.offset = pofs + sa->ctp.auth.offset;
lib/librte_ipsec/sa.h +6 -0
@@ -14,6 +14,7 @@/* padding alignment for different algorithms */ enum {IPSEC_PAD_DEFAULT =4 , +IPSEC_PAD_3DES_CBC =8 ,IPSEC_PAD_AES_CBC =IPSEC_MAX_IV_SIZE ,IPSEC_PAD_AES_CTR =IPSEC_PAD_DEFAULT ,IPSEC_PAD_AES_GCM =IPSEC_PAD_DEFAULT ,
@@ -24,6 +25,10 @@ enum {enum {IPSEC_IV_SIZE_DEFAULT =IPSEC_MAX_IV_SIZE ,IPSEC_AES_CTR_IV_SIZE =sizeof (uint64_t ), +/* TripleDES supports IV size of 32bits or 64bits but he library +* only supports 64bits. +*/ +IPSEC_3DES_IV_SIZE =sizeof (uint64_t ), };/* these definitions probably has to be in rte_crypto_sym.h */
@@ -57,6 +62,7 @@ struct replay_sqn {/*IPSEC SA supported algorithms */ enum sa_algo_type {ALGO_TYPE_NULL =0 , +ALGO_TYPE_3DES_CBC ,ALGO_TYPE_AES_CBC ,ALGO_TYPE_AES_CTR ,ALGO_TYPE_AES_GCM ,
Signature · 1 line
2.14.5
PATCH v4 4/4 ipsec-secgw: add 3des test files
In reply to Fan ZhangThis patch adds the functional test scripts to ipsec-secgw sample application for both transport and tunnel working mode.
--- examples/ipsec-secgw/test/run_test.sh | 8 ++- .../test/trs_3descbc_sha1_common_defs.sh | 73 ++++++++++++++++++++++ examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh | 67 ++++++++++++++++++++ .../test/trs_3descbc_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh | 66 +++++++++++++++++++ .../ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh | 5 ++ .../test/tun_3descbc_sha1_common_defs.sh | 72 +++++++++++++++++++++ examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh | 70 +++++++++++++++++++++ .../test/tun_3descbc_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh | 70 +++++++++++++++++++++ .../ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh | 5 ++ 11 files changed, 445 insertions(+), 1 deletion(-) create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh
examples/ipsec-secgw/test/run_test.sh +7 -1
@@ -38,7 +38,13 @@ tun_aesctr_sha1_esn \ tun_aesctr_sha1_esn_atom \ trs_aesctr_sha1 \ trs_aesctr_sha1_esn \ -trs_aesctr_sha1_esn_atom" +trs_aesctr_sha1_esn_atom \ +tun_3descbc_sha1 \ +tun_3descbc_sha1_esn \ +tun_3descbc_sha1_esn_atom \ +trs_3descbc_sha1 \ +trs_3descbc_sha1_esn \ +trs_3descbc_sha1_esn_atom" DIR=`dirname $0`
examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.sh new file +73 -0
73 lines not on this page · raw message
examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh new file +67 -0
67 lines not on this page · raw message
examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_3descbc_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh new file +66 -0
66 lines not on this page · raw message
examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_3descbc_sha1_defs.sh + +SGW_CMD_XPRM=
examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.sh new file +72 -0
72 lines not on this page · raw message
examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_3descbc_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_3descbc_sha1_defs.sh + +SGW_CMD_XPRM=
Signature · 1 line
2.14.5
v5 cover ipsec: support AES-CTR and 3DES-CBC
In reply to Fan ZhangThis patchset adds the AES-CTR and 3DES-CBC cipher algorithms support to ipsec library. The test scripts for ipsec-secgw sample application are added.
v5:
- updated ipsec-secgw run_test.sh script
- updated release note
v4:
- changed patch titles.
- changed ALGO_TYPE naming for 3DES-CBC
v3:
- fixed a bug in 3DES.
v2:
- removed unsupported tests.
Fan Zhang (5):
ipsec: support AES-CTR
ipsec-secgw: add test scripts for aes ctr
ipsec: support 3DES-CBC
ipsec-secgw: add 3des test files
doc: update release note
doc/guides/rel_notes/release_19_05.rst | 6 + examples/ipsec-secgw/test/common_defs.sh | 4 +- examples/ipsec-secgw/test/run_test.sh | 18 ++- .../test/trs_3descbc_sha1_common_defs.sh | 73 +++++++++++ examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh | 67 ++++++++++ .../test/trs_3descbc_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh | 66 ++++++++++ .../ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh | 5 + .../test/trs_aesctr_sha1_common_defs.sh | 69 +++++++++++ examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh | 67 ++++++++++ .../test/trs_aesctr_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh | 66 ++++++++++ .../ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh | 5 + .../test/tun_3descbc_sha1_common_defs.sh | 72 +++++++++++ examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh | 70 +++++++++++ .../test/tun_3descbc_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh | 70 +++++++++++ .../ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh | 5 + .../test/tun_aesctr_sha1_common_defs.sh | 68 ++++++++++ examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh | 70 +++++++++++ .../test/tun_aesctr_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh | 70 +++++++++++ .../ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh | 5 + lib/librte_ipsec/crypto.h | 17 +++ lib/librte_ipsec/sa.c | 137 +++++++++++++++++---- lib/librte_ipsec/sa.h | 24 ++++ 26 files changed, 1050 insertions(+), 24 deletions(-) create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh
Signature · 1 line
2.14.5
PATCH v5 1/5 ipsec: support AES-CTR
This patch adds AES-CTR cipher algorithm support to ipsec library.
--- lib/librte_ipsec/crypto.h | 17 ++++++ lib/librte_ipsec/sa.c | 133 ++++++++++++++++++++++++++++++++++++++-------- lib/librte_ipsec/sa.h | 18 +++++++ 3 files changed, 147 insertions(+), 21 deletions(-)
lib/librte_ipsec/crypto.h +17 -0
@@ -11,6 +11,16 @@* by ipsec library. */ +/* +* AES-CTR counter block format. +*/ + +struct aesctr_cnt_blk { +uint32_t nonce; +uint64_t iv; +uint32_t cnt; +} __attribute__((packed)); +/* * AES-GCM devices have some specific requirements for IV and AAD formats. * Ideally that to be done by the driver itself.
@@ -41,6 +51,13 @@ struct gcm_esph_iv {uint64_t iv; } __attribute__((packed)); +static inline void +aes_ctr_cnt_blk_fill (struct aesctr_cnt_blk *ctr,uint64_t iv,uint32_t nonce) +{ + ctr->nonce = nonce; + ctr->iv = iv; + ctr->cnt =rte_cpu_to_be_32 (1 ); +}static inline void aead_gcm_iv_fill (struct aead_gcm_iv *gcm,uint64_t iv,uint32_t salt)
lib/librte_ipsec/sa.c +112 -21
226 lines not on this page · raw message
lib/librte_ipsec/sa.h +18 -0
@@ -15,10 +15,17 @@enum {IPSEC_PAD_DEFAULT =4 ,IPSEC_PAD_AES_CBC =IPSEC_MAX_IV_SIZE , +IPSEC_PAD_AES_CTR =IPSEC_PAD_DEFAULT ,IPSEC_PAD_AES_GCM =IPSEC_PAD_DEFAULT ,IPSEC_PAD_NULL =IPSEC_PAD_DEFAULT , }; +/* iv sizes for different algorithms */ +enum { +IPSEC_IV_SIZE_DEFAULT =IPSEC_MAX_IV_SIZE , +IPSEC_AES_CTR_IV_SIZE =sizeof (uint64_t ), +}; +/* these definitions probably has to be in rte_crypto_sym.h */ union sym_op_ofslen {uint64_t raw;
@@ -47,7 +54,17 @@ struct replay_sqn { __extension__uint64_t window[0 ]; }; +/*IPSEC SA supported algorithms */ +enum sa_algo_type { +ALGO_TYPE_NULL =0 , +ALGO_TYPE_AES_CBC , +ALGO_TYPE_AES_CTR , +ALGO_TYPE_AES_GCM , +ALGO_TYPE_MAX +}; +struct rte_ipsec_sa { +uint64_t type;/* type of given SA */ uint64_t udata;/* user defined */ uint32_t size;/* size of given sa object */
@@ -65,6 +82,7 @@ struct rte_ipsec_sa {union sym_op_ofslen auth; } ctp;uint32_t salt; +uint8_t algo_type;uint8_t proto;/* next proto */ uint8_t aad_len;uint8_t hdr_len;
Signature · 1 line
2.14.5
Re: [PATCH v5 1/5] ipsec: support AES-CTR
Hi Fan,
Quoted 20 lines · Fan Zhang
This patch adds AES-CTR cipher algorithm support to ipsec library.
Signed-off-by Fan Zhang <[email protected]>Acked-by Akhil Goyal <[email protected]>--- lib/librte_ipsec/crypto.h | 17 ++++++ lib/librte_ipsec/sa.c | 133 ++++++++++++++++++++++++++++++++++++++-------- lib/librte_ipsec/sa.h | 18 +++++++ 3 files changed, 147 insertions(+), 21 deletions(-)lib/librte_ipsec/crypto.h +0
-0@@ -11,6 +11,16 @@* by ipsec library. */
lib/librte_ipsec/crypto.h line 23
Quoted 10 lines
lib/librte_ipsec/crypto.h +10
-0+/* +* AES-CTR counter block format. +*/ + +struct aesctr_cnt_blk { +uint32_t nonce; +uint64_t iv; +uint32_t cnt; +} __attribute__((packed)); +
In the v3 I gave a comment on this structure. It is not fixed. I believe cnt should be before iv.
Quoted 305 lines
lib/librte_ipsec/crypto.h +7
-0/* * AES-GCM devices have some specific requirements for IV and AAD formats. * Ideally that to be done by the driver itself. @@ -41,6 +51,13 @@ struct gcm_esph_iv {uint64_t iv; } __attribute__((packed)); +static inline void +aes_ctr_cnt_blk_fill (struct aesctr_cnt_blk *ctr,uint64_t iv,uint32_t nonce) +{ + ctr->nonce = nonce; + ctr->iv = iv; + ctr->cnt =rte_cpu_to_be_32 (1 ); +}static inline void aead_gcm_iv_fill (struct aead_gcm_iv *gcm,uint64_t iv,uint32_t salt)lib/librte_ipsec/sa.c +112
-21@@ -219,18 +219,28 @@ esp_inb_tun_init(struct rte_ipsec_sa *sa, const struct rte_ipsec_sa_prm *prm)static void esp_outb_init (struct rte_ipsec_sa *sa,uint32_t hlen) { +uint8_t algo_type; + sa->sqn.outb.raw =1 ;/* these params may differ with new algorithms support */ sa->ctp.auth.offset = hlen; sa->ctp.auth.length =sizeof (struct esp_hdr ) + sa->iv_len + sa->sqh_len; -if (sa->aad_len !=0 ) { + + algo_type = sa->algo_type; + +switch (algo_type) { +case ALGO_TYPE_AES_GCM : +case ALGO_TYPE_AES_CTR : +case ALGO_TYPE_NULL : sa->ctp.cipher.offset = hlen +sizeof (struct esp_hdr ) + sa->iv_len; sa->ctp.cipher.length =0 ; - }else { +break ; +case ALGO_TYPE_AES_CBC : sa->ctp.cipher.offset = sa->hdr_len +sizeof (struct esp_hdr ); sa->ctp.cipher.length = sa->iv_len; +break ; } }@@ -259,26 +269,47 @@ esp_sa_init(struct rte_ipsec_sa *sa, const struct rte_ipsec_sa_prm *prm,RTE_IPSEC_SATP_MODE_MASK ;if (cxf->aead !=NULL ) { -/* RFC 4106 */ -if (cxf->aead->algo !=RTE_CRYPTO_AEAD_AES_GCM ) +switch (cxf->aead->algo) { +case RTE_CRYPTO_AEAD_AES_GCM : +/* RFC 4106 */ + sa->aad_len =sizeof (struct aead_gcm_aad ); + sa->icv_len = cxf->aead->digest_length; + sa->iv_ofs = cxf->aead->iv.offset; + sa->iv_len =sizeof (uint64_t ); + sa->pad_align =IPSEC_PAD_AES_GCM ; + sa->algo_type =ALGO_TYPE_AES_GCM ; +break ; +default :return -EINVAL ; - sa->aad_len =sizeof (struct aead_gcm_aad ); - sa->icv_len = cxf->aead->digest_length; - sa->iv_ofs = cxf->aead->iv.offset; - sa->iv_len =sizeof (uint64_t ); - sa->pad_align =IPSEC_PAD_AES_GCM ; + } }else { sa->icv_len = cxf->auth->digest_length; sa->iv_ofs = cxf->cipher->iv.offset; sa->sqh_len =IS_ESN (sa) ?sizeof (uint32_t ) :0 ; -if (cxf->cipher->algo ==RTE_CRYPTO_CIPHER_NULL ) { + +switch (cxf->cipher->algo) { +case RTE_CRYPTO_CIPHER_NULL : sa->pad_align =IPSEC_PAD_NULL ; sa->iv_len =0 ; - }else if (cxf->cipher->algo ==RTE_CRYPTO_CIPHER_AES_CBC ) { + sa->algo_type =ALGO_TYPE_NULL ; +break ; + +case RTE_CRYPTO_CIPHER_AES_CBC : sa->pad_align =IPSEC_PAD_AES_CBC ; sa->iv_len =IPSEC_MAX_IV_SIZE ; - }else + sa->algo_type =ALGO_TYPE_AES_CBC ; +break ; + +case RTE_CRYPTO_CIPHER_AES_CTR : +/* RFC 3686 */ + sa->pad_align =IPSEC_PAD_AES_CTR ; + sa->iv_len =IPSEC_AES_CTR_IV_SIZE ; + sa->algo_type =ALGO_TYPE_AES_CTR ; +break ; + +default :return -EINVAL ; + } } sa->udata = prm->userdata;@@ -438,12 +469,15 @@ esp_outb_cop_prepare(struct rte_crypto_op *cop, {struct rte_crypto_sym_op *sop;struct aead_gcm_iv *gcm; +struct aesctr_cnt_blk *ctr; +uint8_t algo_type = sa->algo_type;/* fill sym op fields */ sop = cop->sym; -/* AEAD (AES_GCM) case */ -if (sa->aad_len !=0 ) { +switch (algo_type) { +case ALGO_TYPE_AES_GCM : +/* AEAD (AES_GCM) case */ sop->aead.data.offset = sa->ctp.cipher.offset + hlen; sop->aead.data.length = sa->ctp.cipher.length + plen; sop->aead.digest.data = icv->va;@@ -455,14 +489,40 @@ esp_outb_cop_prepare(struct rte_crypto_op *cop, gcm = rte_crypto_op_ctod_offset(cop, struct aead_gcm_iv *, sa->iv_ofs);aead_gcm_iv_fill (gcm, ivp[0 ], sa->salt); -/* CRYPT+AUTH case */ - }else { +break ; +case ALGO_TYPE_AES_CBC : +/* Cipher-Auth (AES-CBC *) case */ + sop->cipher.data.offset = sa->ctp.cipher.offset + hlen; + sop->cipher.data.length = sa->ctp.cipher.length + plen; + sop->auth.data.offset = sa->ctp.auth.offset + hlen; + sop->auth.data.length = sa->ctp.auth.length + plen; + sop->auth.digest.data = icv->va; + sop->auth.digest.phys_addr = icv->pa; +break ; +case ALGO_TYPE_AES_CTR : +/* Cipher-Auth (AES-CTR *) case */ + sop->cipher.data.offset = sa->ctp.cipher.offset + hlen; + sop->cipher.data.length = sa->ctp.cipher.length + plen; + sop->auth.data.offset = sa->ctp.auth.offset + hlen; + sop->auth.data.length = sa->ctp.auth.length + plen; + sop->auth.digest.data = icv->va; + sop->auth.digest.phys_addr = icv->pa; + + ctr = rte_crypto_op_ctod_offset(cop, struct aesctr_cnt_blk *, + sa->iv_ofs); +aes_ctr_cnt_blk_fill (ctr, ivp[0 ], sa->salt); +break ; +case ALGO_TYPE_NULL : +/* NULL case */ sop->cipher.data.offset = sa->ctp.cipher.offset + hlen; sop->cipher.data.length = sa->ctp.cipher.length + plen; sop->auth.data.offset = sa->ctp.auth.offset + hlen; sop->auth.data.length = sa->ctp.auth.length + plen; sop->auth.digest.data = icv->va; sop->auth.digest.phys_addr = icv->pa; +break ; +default : +break ; } }@@ -561,6 +621,7 @@ outb_pkt_xprepare(const struct rte_ipsec_sa *sa, rte_be64_t sqc, {uint32_t *psqh;struct aead_gcm_aad *aad; +uint8_t algo_type = sa->algo_type;/* insert SQN.hi between ESP trailer and ICV */ if (sa->sqh_len !=0 ) {@@ -572,7 +633,7 @@ outb_pkt_xprepare(const struct rte_ipsec_sa *sa, rte_be64_t sqc,* fill IV and AAD fields, if any (aad fields are placed after icv), * right now we support only one AEAD algorithm: AES-GCM . */ -if (sa->aad_len !=0 ) { +if (algo_type ==ALGO_TYPE_AES_GCM ) { aad = (struct aead_gcm_aad *)(icv->va + sa->icv_len);aead_gcm_aad_fill (aad, sa->spi, sqc,IS_ESN (sa)); }@@ -783,8 +844,10 @@ esp_inb_tun_cop_prepare(struct rte_crypto_op *cop, {struct rte_crypto_sym_op *sop;struct aead_gcm_iv *gcm; +struct aesctr_cnt_blk *ctr;uint64_t *ivc, *ivp;uint32_t clen; +uint8_t algo_type = sa->algo_type; clen = plen - sa->ctp.cipher.length;if ((int32_t )clen <0 || (clen & (sa->pad_align -1 )) !=0 )@@ -793,8 +856,8 @@ esp_inb_tun_cop_prepare(struct rte_crypto_op *cop,/* fill sym op fields */ sop = cop->sym; -/* AEAD (AES_GCM) case */ -if (sa->aad_len !=0 ) { +switch (algo_type) { +case ALGO_TYPE_AES_GCM : sop->aead.data.offset = pofs + sa->ctp.cipher.offset; sop->aead.data.length = clen; sop->aead.digest.data = icv->va;@@ -808,8 +871,8 @@ esp_inb_tun_cop_prepare(struct rte_crypto_op *cop, ivp = rte_pktmbuf_mtod_offset(mb, uint64_t *, pofs +sizeof (struct esp_hdr ));aead_gcm_iv_fill (gcm, ivp[0 ], sa->salt); -/* CRYPT+AUTH case */ - }else { +break ; +case ALGO_TYPE_AES_CBC : sop->cipher.data.offset = pofs + sa->ctp.cipher.offset; sop->cipher.data.length = clen; sop->auth.data.offset = pofs + sa->ctp.auth.offset;@@ -822,7 +885,35 @@ esp_inb_tun_cop_prepare(struct rte_crypto_op *cop, ivp = rte_pktmbuf_mtod_offset(mb, uint64_t *, pofs +sizeof (struct esp_hdr ));copy_iv (ivc, ivp, sa->iv_len); +break ; +case ALGO_TYPE_AES_CTR : + sop->cipher.data.offset = pofs + sa->ctp.cipher.offset; + sop->cipher.data.length = clen; + sop->auth.data.offset = pofs + sa->ctp.auth.offset; + sop->auth.data.length = plen - sa->ctp.auth.length; + sop->auth.digest.data = icv->va; + sop->auth.digest.phys_addr = icv->pa; + +/* copy iv from the input packet to the cop */ + ctr = rte_crypto_op_ctod_offset(cop, struct aesctr_cnt_blk *, + sa->iv_ofs); + ivp = rte_pktmbuf_mtod_offset(mb, uint64_t *, + pofs +sizeof (struct esp_hdr )); +aes_ctr_cnt_blk_fill (ctr, ivp[0 ], sa->salt); +break ; +case ALGO_TYPE_NULL : + sop->cipher.data.offset = pofs + sa->ctp.cipher.offset; + sop->cipher.data.length = clen; + sop->auth.data.offset = pofs + sa->ctp.auth.offset; + sop->auth.data.length = plen - sa->ctp.auth.length; + sop->auth.digest.data = icv->va; + sop->auth.digest.phys_addr = icv->pa; +break ; + +default : +return -EINVAL ; } +return 0 ; }lib/librte_ipsec/sa.h +18
-0@@ -15,10 +15,17 @@enum {IPSEC_PAD_DEFAULT =4 ,IPSEC_PAD_AES_CBC =IPSEC_MAX_IV_SIZE , +IPSEC_PAD_AES_CTR =IPSEC_PAD_DEFAULT ,IPSEC_PAD_AES_GCM =IPSEC_PAD_DEFAULT ,IPSEC_PAD_NULL =IPSEC_PAD_DEFAULT , }; +/* iv sizes for different algorithms */ +enum { +IPSEC_IV_SIZE_DEFAULT =IPSEC_MAX_IV_SIZE , +IPSEC_AES_CTR_IV_SIZE =sizeof (uint64_t ), +}; +/* these definitions probably has to be in rte_crypto_sym.h */ union sym_op_ofslen {uint64_t raw;@@ -47,7 +54,17 @@ struct replay_sqn { __extension__uint64_t window[0 ]; }; +/*IPSEC SA supported algorithms */ +enum sa_algo_type { +ALGO_TYPE_NULL =0 , +ALGO_TYPE_AES_CBC , +ALGO_TYPE_AES_CTR , +ALGO_TYPE_AES_GCM , +ALGO_TYPE_MAX +}; +struct rte_ipsec_sa { +uint64_t type;/* type of given SA */ uint64_t udata;/* user defined */ uint32_t size;/* size of given sa object */ @@ -65,6 +82,7 @@ struct rte_ipsec_sa {union sym_op_ofslen auth; } ctp;uint32_t salt; +uint8_t algo_type;uint8_t proto;/* next proto */ uint8_t aad_len;uint8_t hdr_len;
Re: [PATCH v5 1/5] ipsec: support AES-CTR
Hi Akhil,
Quoted 22 lines · Fan Zhang
Quoted 20 lines
This patch adds AES-CTR cipher algorithm support to ipsec library.
Signed-off-by Fan Zhang <[email protected]>Acked-by Akhil Goyal <[email protected]>--- lib/librte_ipsec/crypto.h | 17 ++++++ lib/librte_ipsec/sa.c | 133 ++++++++++++++++++++++++++++++++++++++-------- lib/librte_ipsec/sa.h | 18 +++++++ 3 files changed, 147 insertions(+), 21 deletions(-)lib/librte_ipsec/crypto.h +0
-0@@ -11,6 +11,16 @@* by ipsec library. */
Quoted 12 lines
lib/librte_ipsec/crypto.h line 23
Quoted 10 lines
lib/librte_ipsec/crypto.h +10
-0+/* +* AES-CTR counter block format. +*/ + +struct aesctr_cnt_blk { +uint32_t nonce; +uint64_t iv; +uint32_t cnt; +} __attribute__((packed)); +In the v3 I gave a comment on this structure. It is not fixed. I believe cnt should be before iv.
Could you explain, what makes you think that way?
https://tools.ietf.org/html/rfc3686#section-4
clearly stays that format of the counter block should be the following:
nonce; IV; counter.
Original ipsec-secgw app uses the same format:
struct cnt_blk {
uint32_t salt;
uint64_t iv;
uint32_t cnt;
} __attribute__((packed));So I believe format above is correct one.
Again this series introduces new test-case specially for CTR algo:examples/ipsec-secgw/test/*ctr*.sh
and they do pass on both aesni_mb and QAT device. Konstantin
Re: [PATCH v5 1/5] ipsec: support AES-CTR
Hi Konstantin,
Quoted 46 lines · Konstantin
Hi Akhil,
Quoted 21 lines · Fan Zhang
Quoted 20 lines
This patch adds AES-CTR cipher algorithm support to ipsec library.
Signed-off-by Fan Zhang <[email protected]>Acked-by Akhil Goyal <[email protected]>--- lib/librte_ipsec/crypto.h | 17 ++++++ lib/librte_ipsec/sa.c | 133 ++++++++++++++++++++++++++++++++++++++-------- lib/librte_ipsec/sa.h | 18 +++++++ 3 files changed, 147 insertions(+), 21 deletions(-)lib/librte_ipsec/crypto.h +0
-0@@ -11,6 +11,16 @@* by ipsec library. */ Quoted 12 lines
lib/librte_ipsec/crypto.h line 23
Quoted 10 lines
lib/librte_ipsec/crypto.h +10
-0+/* +* AES-CTR counter block format. +*/ + +struct aesctr_cnt_blk { +uint32_t nonce; +uint64_t iv; +uint32_t cnt; +} __attribute__((packed)); +In the v3 I gave a comment on this structure. It is not fixed. I believe cnt should be before iv.
Could you explain, what makes you think that way?
https://tools.ietf.org/html/rfc3686#section-4
clearly stays that format of the counter block should be the following:
nonce; IV; counter.
Original ipsec-secgw app uses the same format:struct cnt_blk { uint32_t salt; uint64_t iv; uint32_t cnt; } __attribute__((packed));
Quoted 5 lines
So I believe format above is correct one.
Again this series introduces new test-case specially for CTR algo:examples/ipsec-secgw/test/*ctr*.sh
and they do pass on bothaesni_mband QAT device. Konstantin
Got it. Thanks for correcting me.
PATCH v5 2/5 ipsec-secgw: add test scripts for aes ctr
In reply to Fan ZhangThis patch adds the functional test scripts to ipsec-secgw sample application for both transport and tunnel working mode.
Updated a bit on common_defs to use "mktemp" instead of "tempfile" as Fedora does not like the command.
--- examples/ipsec-secgw/test/common_defs.sh | 4 +- examples/ipsec-secgw/test/run_test.sh | 10 +++- .../test/trs_aesctr_sha1_common_defs.sh | 69 +++++++++++++++++++++ examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh | 67 +++++++++++++++++++++ .../test/trs_aesctr_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh | 66 ++++++++++++++++++++ .../ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh | 5 ++ .../test/tun_aesctr_sha1_common_defs.sh | 68 +++++++++++++++++++++ examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh | 70 ++++++++++++++++++++++ .../test/tun_aesctr_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh | 70 ++++++++++++++++++++++ .../ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh | 5 ++ 12 files changed, 441 insertions(+), 3 deletions(-) create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh
examples/ipsec-secgw/test/common_defs.sh +2 -2
@@ -53,7 +53,7 @@ SGW_CMD_EAL_PRM="--lcores=${SGW_LCORE} -n 4 ${ETH_DEV}" SGW_CMD_CFG="(0,0,${SGW_LCORE}),(1,0,${SGW_LCORE})" SGW_CMD_PRM="-p 0x3 -u 1 -P --config=\"${SGW_CMD_CFG}\"" -SGW_CFG_FILE=$(tempfile) +SGW_CFG_FILE=$(mktemp) # configure local host/ifaces config_local_iface()
@@ -129,7 +129,7 @@ config6_iface() #start ipsec-secgw secgw_start() { - SGW_EXEC_FILE=$(tempfile) + SGW_EXEC_FILE=$(mktemp) cat <<EOF > ${SGW_EXEC_FILE} ${SGW_PATH} ${SGW_CMD_EAL_PRM} ${CRYPTO_DEV} \ --vdev="net_tap0,mac=fixed" \
examples/ipsec-secgw/test/run_test.sh +9 -1
@@ -32,7 +32,15 @@ trs_aesgcm_esn_atom \ tun_aescbc_sha1_old \ tun_aesgcm_old \ trs_aescbc_sha1_old \ -trs_aesgcm_old" +trs_aesgcm_old \ +tun_aesctr_sha1 \ +tun_aesctr_sha1_old \ +tun_aesctr_sha1_esn \ +tun_aesctr_sha1_esn_atom \ +trs_aesctr_sha1 \ +trs_aesctr_sha1_old \ +trs_aesctr_sha1_esn \ +trs_aesctr_sha1_esn_atom" DIR=`dirname $0`
examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.sh new file +69 -0
69 lines not on this page · raw message
examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh new file +67 -0
67 lines not on this page · raw message
examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_aesctr_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh new file +66 -0
66 lines not on this page · raw message
examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_aesctr_sha1_defs.sh + +SGW_CMD_XPRM=
examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.sh new file +68 -0
68 lines not on this page · raw message
examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_aesctr_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_aesctr_sha1_defs.sh + +SGW_CMD_XPRM=
Signature · 1 line
2.14.5
PATCH v5 3/5 ipsec: support 3DES-CBC
In reply to Fan ZhangThis patch adds triple-des CBC mode cipher algorithm to ipsec library.
--- lib/librte_ipsec/sa.c | 40 ++++++++++++++++++++++------------------ lib/librte_ipsec/sa.h | 6 ++++++ 2 files changed, 28 insertions(+), 18 deletions(-)
lib/librte_ipsec/sa.c +22 -18
@@ -238,6 +238,7 @@ esp_outb_init(struct rte_ipsec_sa *sa, uint32_t hlen) sa->ctp.cipher.length =0 ;break ;case ALGO_TYPE_AES_CBC : +case ALGO_TYPE_3DES_CBC : sa->ctp.cipher.offset = sa->hdr_len +sizeof (struct esp_hdr ); sa->ctp.cipher.length = sa->iv_len;break ;
@@ -307,6 +308,13 @@ esp_sa_init(struct rte_ipsec_sa *sa, const struct rte_ipsec_sa_prm *prm, sa->algo_type =ALGO_TYPE_AES_CTR ;break ; +case RTE_CRYPTO_CIPHER_3DES_CBC : +/* RFC 1851 */ + sa->pad_align =IPSEC_PAD_3DES_CBC ; + sa->iv_len =IPSEC_3DES_IV_SIZE ; + sa->algo_type =ALGO_TYPE_3DES_CBC ; +break ; +default :return -EINVAL ; }
@@ -476,6 +484,19 @@ esp_outb_cop_prepare(struct rte_crypto_op *cop, sop = cop->sym;switch (algo_type) { +case ALGO_TYPE_AES_CBC : +/* Cipher-Auth (AES-CBC *) case */ +case ALGO_TYPE_3DES_CBC : +/* Cipher-Auth (3DES-CBC *) case */ +case ALGO_TYPE_NULL : +/* NULL case */ + sop->cipher.data.offset = sa->ctp.cipher.offset + hlen; + sop->cipher.data.length = sa->ctp.cipher.length + plen; + sop->auth.data.offset = sa->ctp.auth.offset + hlen; + sop->auth.data.length = sa->ctp.auth.length + plen; + sop->auth.digest.data = icv->va; + sop->auth.digest.phys_addr = icv->pa; +break ;case ALGO_TYPE_AES_GCM :/* AEAD (AES_GCM) case */ sop->aead.data.offset = sa->ctp.cipher.offset + hlen;
@@ -490,15 +511,6 @@ esp_outb_cop_prepare(struct rte_crypto_op *cop, sa->iv_ofs);aead_gcm_iv_fill (gcm, ivp[0 ], sa->salt);break ; -case ALGO_TYPE_AES_CBC : -/* Cipher-Auth (AES-CBC *) case */ - sop->cipher.data.offset = sa->ctp.cipher.offset + hlen; - sop->cipher.data.length = sa->ctp.cipher.length + plen; - sop->auth.data.offset = sa->ctp.auth.offset + hlen; - sop->auth.data.length = sa->ctp.auth.length + plen; - sop->auth.digest.data = icv->va; - sop->auth.digest.phys_addr = icv->pa; -break ;case ALGO_TYPE_AES_CTR :/* Cipher-Auth (AES-CTR *) case */ sop->cipher.data.offset = sa->ctp.cipher.offset + hlen;
@@ -512,15 +524,6 @@ esp_outb_cop_prepare(struct rte_crypto_op *cop, sa->iv_ofs);aes_ctr_cnt_blk_fill (ctr, ivp[0 ], sa->salt);break ; -case ALGO_TYPE_NULL : -/* NULL case */ - sop->cipher.data.offset = sa->ctp.cipher.offset + hlen; - sop->cipher.data.length = sa->ctp.cipher.length + plen; - sop->auth.data.offset = sa->ctp.auth.offset + hlen; - sop->auth.data.length = sa->ctp.auth.length + plen; - sop->auth.digest.data = icv->va; - sop->auth.digest.phys_addr = icv->pa; -break ;default :break ; }
@@ -873,6 +876,7 @@ esp_inb_tun_cop_prepare(struct rte_crypto_op *cop,aead_gcm_iv_fill (gcm, ivp[0 ], sa->salt);break ;case ALGO_TYPE_AES_CBC : +case ALGO_TYPE_3DES_CBC : sop->cipher.data.offset = pofs + sa->ctp.cipher.offset; sop->cipher.data.length = clen; sop->auth.data.offset = pofs + sa->ctp.auth.offset;
lib/librte_ipsec/sa.h +6 -0
@@ -14,6 +14,7 @@/* padding alignment for different algorithms */ enum {IPSEC_PAD_DEFAULT =4 , +IPSEC_PAD_3DES_CBC =8 ,IPSEC_PAD_AES_CBC =IPSEC_MAX_IV_SIZE ,IPSEC_PAD_AES_CTR =IPSEC_PAD_DEFAULT ,IPSEC_PAD_AES_GCM =IPSEC_PAD_DEFAULT ,
@@ -24,6 +25,10 @@ enum {enum {IPSEC_IV_SIZE_DEFAULT =IPSEC_MAX_IV_SIZE ,IPSEC_AES_CTR_IV_SIZE =sizeof (uint64_t ), +/* TripleDES supports IV size of 32bits or 64bits but he library +* only supports 64bits. +*/ +IPSEC_3DES_IV_SIZE =sizeof (uint64_t ), };/* these definitions probably has to be in rte_crypto_sym.h */
@@ -57,6 +62,7 @@ struct replay_sqn {/*IPSEC SA supported algorithms */ enum sa_algo_type {ALGO_TYPE_NULL =0 , +ALGO_TYPE_3DES_CBC ,ALGO_TYPE_AES_CBC ,ALGO_TYPE_AES_CTR ,ALGO_TYPE_AES_GCM ,
Signature · 1 line
2.14.5
PATCH v5 4/5 ipsec-secgw: add 3des test files
In reply to Fan ZhangThis patch adds the functional test scripts to ipsec-secgw sample application for both transport and tunnel working mode.
--- examples/ipsec-secgw/test/run_test.sh | 10 ++- .../test/trs_3descbc_sha1_common_defs.sh | 73 ++++++++++++++++++++++ examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh | 67 ++++++++++++++++++++ .../test/trs_3descbc_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh | 66 +++++++++++++++++++ .../ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh | 5 ++ .../test/tun_3descbc_sha1_common_defs.sh | 72 +++++++++++++++++++++ examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh | 70 +++++++++++++++++++++ .../test/tun_3descbc_sha1_esn_atom_defs.sh | 5 ++ .../ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh | 70 +++++++++++++++++++++ .../ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh | 5 ++ 11 files changed, 447 insertions(+), 1 deletion(-) create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh create mode 100644 examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh
examples/ipsec-secgw/test/run_test.sh +9 -1
@@ -40,7 +40,15 @@ tun_aesctr_sha1_esn_atom \ trs_aesctr_sha1 \ trs_aesctr_sha1_old \ trs_aesctr_sha1_esn \ -trs_aesctr_sha1_esn_atom" +trs_aesctr_sha1_esn_atom \ +tun_3descbc_sha1 \ +tun_3descbc_sha1_old \ +tun_3descbc_sha1_esn \ +tun_3descbc_sha1_esn_atom \ +trs_3descbc_sha1 \ +trs_3descbc_sha1_old \ +trs_3descbc_sha1_esn \ +trs_3descbc_sha1_esn_atom" DIR=`dirname $0`
examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.sh new file +73 -0
73 lines not on this page · raw message
examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh new file +67 -0
67 lines not on this page · raw message
examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_3descbc_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh new file +66 -0
66 lines not on this page · raw message
examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/trs_3descbc_sha1_defs.sh + +SGW_CMD_XPRM=
examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.sh new file +72 -0
72 lines not on this page · raw message
examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_3descbc_sha1_esn_defs.sh + +SGW_CMD_XPRM='-e -a -w 300'
examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh new file +70 -0
70 lines not on this page · raw message
examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/bash + +. ${DIR}/tun_3descbc_sha1_defs.sh + +SGW_CMD_XPRM=
Signature · 1 line
2.14.5
PATCH v5 5/5 doc: update release note
In reply to Fan ZhangThis patch updates the 19.05 release note with IPsec library updates for the newly added AES-CTR and 3DES-CBC algorithm support.
--- doc/guides/rel_notes/release_19_05.rst | 6 ++++++ 1 file changed, 6 insertions(+)
doc/guides/rel_notes/release_19_05.rst +6 -0
@@ -91,6 +91,12 @@ New Features * Added promiscuous mode support. +* **Updated the IPsec library.** + + The IPsec library has been updated with AES-CTR and 3DES-CBC cipher algorithms + support. The ipsec-secgw sample application test scripts have also been updated + with these two algorithms' testing as well. + Removed Items -------------
Signature · 1 line
2.14.5
Re: [PATCH v5 0/5] ipsec: support AES-CTR and 3DES-CBC
In reply to Fan ZhangQuoted 64 lines · Fan Zhang
This patchset adds the AES-CTR and 3DES-CBC cipher algorithms support to ipsec library. The test scripts for ipsec-secgw sample application are added.
v5:
- updated ipsec-secgwrun_test.shscript
- updated release notev4:
- changed patch titles.
- changedALGO_TYPEnaming for 3DES-CBCv3:
- fixed a bug in 3DES.v2:
- removed unsupported tests.Fan Zhang (5):
ipsec: support AES-CTR
ipsec-secgw: add test scripts for aes ctr
ipsec: support 3DES-CBC
ipsec-secgw: add 3des test files
doc: update release notedoc/guides/rel_notes/release_19_05.rst | 6 + examples/ipsec-secgw/test/common_defs.sh | 4 +- examples/ipsec-secgw/test/run_test.sh | 18 ++- .../test/trs_3descbc_sha1_common_defs.sh | 73 +++++++++++ examples/ipsec-secgw/test/trs_3descbc_sha1_defs.sh | 67 ++++++++++ .../test/trs_3descbc_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/trs_3descbc_sha1_esn_defs.sh | 66 ++++++++++ .../ipsec-secgw/test/trs_3descbc_sha1_old_defs.sh | 5 + .../test/trs_aesctr_sha1_common_defs.sh | 69 +++++++++++ examples/ipsec-secgw/test/trs_aesctr_sha1_defs.sh | 67 ++++++++++ .../test/trs_aesctr_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/trs_aesctr_sha1_esn_defs.sh | 66 ++++++++++ .../ipsec-secgw/test/trs_aesctr_sha1_old_defs.sh | 5 + .../test/tun_3descbc_sha1_common_defs.sh | 72 +++++++++++ examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh | 70 +++++++++++ .../test/tun_3descbc_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/tun_3descbc_sha1_esn_defs.sh | 70 +++++++++++ .../ipsec-secgw/test/tun_3descbc_sha1_old_defs.sh | 5 + .../test/tun_aesctr_sha1_common_defs.sh | 68 ++++++++++ examples/ipsec-secgw/test/tun_aesctr_sha1_defs.sh | 70 +++++++++++ .../test/tun_aesctr_sha1_esn_atom_defs.sh | 5 + .../ipsec-secgw/test/tun_aesctr_sha1_esn_defs.sh | 70 +++++++++++ .../ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh | 5 + lib/librte_ipsec/crypto.h | 17 +++ lib/librte_ipsec/sa.c | 137 +++++++++++++++++---- lib/librte_ipsec/sa.h | 24 ++++ 26 files changed, 1050 insertions(+), 24 deletions(-)create mode 100644
examples/ipsec-secgw/test/trs_3descbc_sha1_common_defs.shcreate mode 100644examples/ipsec-secgw/test/trs_3descbc_sha1_defs.shcreate mode 100644examples/ipsec-secgw/test/trs_3descbc_sha1_esn_atom_defs.shcreate mode 100644examples/ipsec-secgw/test/trs_3descbc_sha1_esn_defs.shcreate mode 100644examples/ipsec-secgw/test/trs_3descbc_sha1_old_defs.shcreate mode 100644examples/ipsec-secgw/test/trs_aesctr_sha1_common_defs.shcreate mode 100644examples/ipsec-secgw/test/trs_aesctr_sha1_defs.shcreate mode 100644examples/ipsec-secgw/test/trs_aesctr_sha1_esn_atom_defs.shcreate mode 100644examples/ipsec-secgw/test/trs_aesctr_sha1_esn_defs.shcreate mode 100644examples/ipsec-secgw/test/trs_aesctr_sha1_old_defs.shcreate mode 100644examples/ipsec-secgw/test/tun_3descbc_sha1_common_defs.shcreate mode 100644examples/ipsec-secgw/test/tun_3descbc_sha1_defs.sh
Quoted 9 lines
create mode 100644
examples/ipsec-secgw/test/tun_3descbc_sha1_esn_atom_defs.shcreate mode 100644examples/ipsec-secgw/test/tun_3descbc_sha1_esn_defs.shcreate mode 100644examples/ipsec-secgw/test/tun_3descbc_sha1_old_defs.shcreate mode 100644examples/ipsec-secgw/test/tun_aesctr_sha1_common_defs.shcreate mode 100644examples/ipsec-secgw/test/tun_aesctr_sha1_defs.shcreate mode 100644examples/ipsec-secgw/test/tun_aesctr_sha1_esn_atom_defs.shcreate mode 100644examples/ipsec-secgw/test/tun_aesctr_sha1_esn_defs.shcreate mode 100644examples/ipsec-secgw/test/tun_aesctr_sha1_old_defs.sh
series applied to dpdk-next-crypto
Thanks.