Add new cases to lookaside IPsec tests
cover Add new cases to lookaside IPsec tests
Add new tests to lookaside IPsec tests.
* Support for chained operations.
* AES-CBC 128 NULL auth known vector tests.
* AES-CBC 128 HMAC-SHA256 known vector tests.
* AES-CBC 128 HMAC-SHA384 known vector tests.
* AES-CBC 128 HMAC-SHA512 known vector tests.
* NULL cipher AES-XCBC known vector tests.
* Tunnel mode tests
* IPv6 in IPv6
* IPv4 in IPv4
* IPv4 in IPv6
* IPv6 in IPv4
* IPv4 transport mode tests.
* Security stats tests.
* AES-CTR tests.
* set/copy DF tests.
Ankur Dwivedi (1):
test/crypto: add security stats cases
Anoob Joseph (5):
test/crypto: add IPsec aes-cbc known vectors test/crypto: add chained operations in combined cases test/crypto: add transport mode cases test/crypto: add aes xcbc known vectors test/crypto: add copy and set DF cases
Tejasree Kondoj (7):
test/crypto: add IPsec AES-CBC-HMAC-SHA256 known vectors test/crypto: add IPv6 tunnel mode cases test/crypto: add IPsec HMAC-SHA384/512 known vectors test/crypto: add IPsec fragmented packet known vectors test/crypto: add lookaside IPsec AES-CTR known vectors test/crypto: add fragmented packet case test/crypto: skip null auth in ICV corrupt case
app/test/test_cryptodev.c | 395 +++++++++- app/test/test_cryptodev_security_ipsec.c | 352 ++++++++- app/test/test_cryptodev_security_ipsec.h | 113 +++ .../test_cryptodev_security_ipsec_test_vectors.h | 828 +++++++++++++++++++++ doc/guides/rel_notes/release_22_03.rst | 18 + 5 files changed, 1664 insertions(+), 42 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/13 test/crypto: add IPsec aes-cbc known vectors
Extend the framework to support chained operations and add AES-CBC 128 known vector tests.
--- app/test/test_cryptodev.c | 62 ++++++++++-- app/test/test_cryptodev_security_ipsec.c | 51 ++++++++++ app/test/test_cryptodev_security_ipsec.h | 8 ++ .../test_cryptodev_security_ipsec_test_vectors.h | 110 +++++++++++++++++++++ 4 files changed, 222 insertions(+), 9 deletions(-)
app/test/test_cryptodev.c +53 -9
@@ -9191,23 +9191,59 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],return TEST_SKIPPED ; } }else { -/* Only AEAD supported now */ -return TEST_SKIPPED ; +memcpy (&ut_params->cipher_xform, &td[0 ].xform.chain.cipher, +sizeof (ut_params->cipher_xform)); +memcpy (&ut_params->auth_xform, &td[0 ].xform.chain.auth, +sizeof (ut_params->auth_xform)); + ut_params->cipher_xform.cipher.key.data = td[0 ].key.data; + ut_params->cipher_xform.cipher.iv.offset =IV_OFFSET ; + ut_params->auth_xform.auth.key.data = td[0 ].key.data; + +/* Verify crypto capabilities */ + +if (test_ipsec_crypto_caps_cipher_verify ( + sec_cap, + &ut_params->cipher_xform) !=0 ) { +if (!silent) +RTE_LOG (INFO ,USER1 , +"Cipher crypto capabilities not supported\n" ); +return TEST_SKIPPED ; + } + +if (test_ipsec_crypto_caps_auth_verify ( + sec_cap, + &ut_params->auth_xform) !=0 ) { +if (!silent) +RTE_LOG (INFO ,USER1 , +"Auth crypto capabilities not supported\n" ); +return TEST_SKIPPED ; + } }if (test_ipsec_sec_caps_verify (&ipsec_xform, sec_cap, silent) !=0 )return TEST_SKIPPED ; - salt_len =RTE_MIN (sizeof (ipsec_xform.salt), td[0 ].salt.len); -memcpy (&ipsec_xform.salt, td[0 ].salt.data, salt_len); -struct rte_security_session_conf sess_conf = { .action_type = ut_params->type, .protocol =RTE_SECURITY_PROTOCOL_IPSEC , - .ipsec = ipsec_xform, - .crypto_xform = &ut_params->aead_xform, }; +if (td[0 ].aead) { + salt_len =RTE_MIN (sizeof (ipsec_xform.salt), td[0 ].salt.len); +memcpy (&ipsec_xform.salt, td[0 ].salt.data, salt_len); + sess_conf.ipsec = ipsec_xform; + sess_conf.crypto_xform = &ut_params->aead_xform; + }else { + sess_conf.ipsec = ipsec_xform; +if (dir ==RTE_SECURITY_IPSEC_SA_DIR_EGRESS ) { + sess_conf.crypto_xform = &ut_params->cipher_xform; + ut_params->cipher_xform.next = &ut_params->auth_xform; + }else { + sess_conf.crypto_xform = &ut_params->auth_xform; + ut_params->auth_xform.next = &ut_params->cipher_xform; + } + } +/* Create security session */ ut_params->sec_session = rte_security_session_create(ctx, &sess_conf, ts_params->session_mpool,
@@ -9316,14 +9352,18 @@ test_ipsec_proto_known_vec(const void *test_data) }static int -test_ipsec_proto_known_vec_inb (const void *td_outb) +test_ipsec_proto_known_vec_inb (const void *test_data) { +const struct ipsec_test_data *td = test_data;struct ipsec_test_flags flags;struct ipsec_test_data td_inb;memset (&flags,0 ,sizeof (flags)); -test_ipsec_td_in_from_out (td_outb, &td_inb); +if (td->ipsec_xform.direction ==RTE_SECURITY_IPSEC_SA_DIR_EGRESS ) +test_ipsec_td_in_from_out (td, &td_inb); +else +memcpy (&td_inb, td,sizeof (td_inb));return test_ipsec_proto_process (&td_inb,NULL ,1 , false, &flags); }
@@ -14394,6 +14434,10 @@ static struct unit_test_suite ipsec_proto_testsuite = { "Inbound known vector (ESP tunnel mode IPv4 AES-GCM 256)", ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_inb, &pkt_aes_256_gcm), +TEST_CASE_NAMED_WITH_DATA ( +"Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128)" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec_inb, &pkt_aes_128_cbc_null), TEST_CASE_NAMED_ST( "Combined test alg list", ut_setup_security, ut_teardown,
app/test/test_cryptodev_security_ipsec.c +51 -0
57 lines not on this page · raw message
app/test/test_cryptodev_security_ipsec.h +8 -0
@@ -96,6 +96,14 @@ int test_ipsec_crypto_caps_aead_verify(const struct rte_security_capability *sec_cap, struct rte_crypto_sym_xform *aead); +int test_ipsec_crypto_caps_cipher_verify ( +const struct rte_security_capability *sec_cap, +struct rte_crypto_sym_xform *cipher); + +int test_ipsec_crypto_caps_auth_verify ( +const struct rte_security_capability *sec_cap, +struct rte_crypto_sym_xform *auth); +void test_ipsec_td_in_from_out (const struct ipsec_test_data *td_out,struct ipsec_test_data *td_in);
app/test/test_cryptodev_security_ipsec_test_vectors.h +110 -0
114 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 2/13 test/crypto: add IPsec AES-CBC-HMAC-SHA256 known vectors
In reply to Anoob JosephFrom: Tejasree Kondoj <[email protected]>
Adding lookaside IPsec AES-CBC-HMAC-SHA256 test cases.
--- app/test/test_cryptodev.c | 12 ++- app/test/test_cryptodev_security_ipsec.h | 3 + .../test_cryptodev_security_ipsec_test_vectors.h | 109 +++++++++++++++++++++ 3 files changed, 123 insertions(+), 1 deletion(-)
app/test/test_cryptodev.c +11 -1
@@ -9197,7 +9197,7 @@ test_ipsec_proto_process(const struct ipsec_test_data td[], sizeof(ut_params->auth_xform)); ut_params->cipher_xform.cipher.key.data = td[0 ].key.data; ut_params->cipher_xform.cipher.iv.offset =IV_OFFSET ; - ut_params->auth_xform.auth.key.data = td[0 ].key.data; + ut_params->auth_xform.auth.key.data = td[0 ].auth_key.data;/* Verify crypto capabilities */
@@ -14423,6 +14423,11 @@ static struct unit_test_suite ipsec_proto_testsuite = { ut_setup_security, ut_teardown, test_ipsec_proto_known_vec, &pkt_aes_256_gcm),TEST_CASE_NAMED_WITH_DATA ( +"Outbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA256 [16B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec, + &pkt_aes_128_cbc_hmac_sha256), +TEST_CASE_NAMED_WITH_DATA ("Inbound known vector (ESP tunnel mode IPv4 AES-GCM 128)" , ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_inb, &pkt_aes_128_gcm),
@@ -14438,6 +14443,11 @@ static struct unit_test_suite ipsec_proto_testsuite = { "Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128)", ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_inb, &pkt_aes_128_cbc_null), +TEST_CASE_NAMED_WITH_DATA ( +"Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA256 [16B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec_inb, + &pkt_aes_128_cbc_hmac_sha256), TEST_CASE_NAMED_ST( "Combined test alg list", ut_setup_security, ut_teardown,
app/test/test_cryptodev_security_ipsec.h +3 -0
@@ -14,6 +14,9 @@ struct ipsec_test_data {struct {uint8_t data[32 ]; } key; +struct { +uint8_t data[32 ]; + } auth_key;struct {uint8_t data[1024 ];
app/test/test_cryptodev_security_ipsec_test_vectors.h +109 -0
113 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 3/13 test/crypto: add chained operations in combined cases
In reply to Anoob JosephExtend lookaside IPsec combined mode cases to cover chained operations also.
Currently covering combinations of,
Ciphers,
1. AES-128-CBC
Auth,
1. NULL
2. SHA2-256 [16B ICV]
--- app/test/test_cryptodev.c | 11 +++-- app/test/test_cryptodev_security_ipsec.c | 77 +++++++++++++++++++++++++------- app/test/test_cryptodev_security_ipsec.h | 36 +++++++++++++++ 3 files changed, 103 insertions(+), 21 deletions(-)
app/test/test_cryptodev.c +7 -4
@@ -835,6 +835,8 @@ ipsec_proto_testsuite_setup(void) ret =TEST_SKIPPED ; } +test_ipsec_alg_list_populate (); +/* * Stop the device. Device would be started again by individual test * case setup routine.
@@ -9381,9 +9383,9 @@ test_ipsec_proto_all(const struct ipsec_test_flags *flags) flags->sa_expiry_pkts_hard) nb_pkts =IPSEC_TEST_PACKETS_MAX ; -for (i =0 ; i <RTE_DIM (aead_list); i++) { -test_ipsec_td_prepare (&aead_list[i], -NULL , +for (i =0 ; i <RTE_DIM (alg_list); i++) { +test_ipsec_td_prepare (alg_list[i].param1, + alg_list[i].param2, flags, td_outb, nb_pkts);
@@ -9407,7 +9409,8 @@ test_ipsec_proto_all(const struct ipsec_test_flags *flags)return TEST_FAILED ;if (flags->display_alg) -test_ipsec_display_alg (&aead_list[i],NULL ); +test_ipsec_display_alg (alg_list[i].param1, + alg_list[i].param2); pass_cnt++; }
app/test/test_cryptodev_security_ipsec.c +60 -17
113 lines not on this page · raw message
app/test/test_cryptodev_security_ipsec.h +36 -0
@@ -71,6 +71,7 @@ struct crypto_param {enum rte_crypto_aead_algorithm aead; } alg;uint16_t key_length; +uint16_t digest_length; };static const struct crypto_param aead_list[] = {
@@ -91,6 +92,41 @@ static const struct crypto_param aead_list[] = { }, }; +static const struct crypto_param cipher_list[] = { + { + .type =RTE_CRYPTO_SYM_XFORM_CIPHER , + .alg.cipher =RTE_CRYPTO_CIPHER_AES_CBC , + .key_length =16 , + }, +}; + +static const struct crypto_param auth_list[] = { + { + .type =RTE_CRYPTO_SYM_XFORM_AUTH , + .alg.auth =RTE_CRYPTO_AUTH_NULL , + }, + { + .type =RTE_CRYPTO_SYM_XFORM_AUTH , + .alg.auth =RTE_CRYPTO_AUTH_SHA256_HMAC , + .key_length =32 , + .digest_length =16 , + }, +}; + +struct crypto_param_comb { +const struct crypto_param *param1; +const struct crypto_param *param2; +}; + +extern struct ipsec_test_data pkt_aes_256_gcm; +extern struct ipsec_test_data pkt_aes_128_cbc_hmac_sha256; + +extern struct crypto_param_comb alg_list[RTE_DIM (aead_list) + + (RTE_DIM (cipher_list) * +RTE_DIM (auth_list))]; + +void test_ipsec_alg_list_populate (void ); +int test_ipsec_sec_caps_verify (struct rte_security_ipsec_xform *ipsec_xform,const struct rte_security_capability *sec_cap,bool silent);
Signature · 1 line
2.7.4
PATCH 4/13 test/crypto: add IPv6 tunnel mode cases
In reply to Anoob JosephFrom: Tejasree Kondoj <[email protected]>
Add IPv6 known vector and combined mode tests.
Following modes are added:
Tunnel IPv6 in IPv6
Tunnel IPv4 in IPv4
Tunnel IPv4 in IPv6
Tunnel IPv6 in IPv4
--- app/test/test_cryptodev.c | 102 ++++++++++- app/test/test_cryptodev_security_ipsec.c | 74 +++++++- app/test/test_cryptodev_security_ipsec.h | 4 + .../test_cryptodev_security_ipsec_test_vectors.h | 202 +++++++++++++++++++++ 4 files changed, 378 insertions(+), 4 deletions(-)
app/test/test_cryptodev.c +100 -2
@@ -9125,6 +9125,10 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],bool silent, const struct ipsec_test_flags *flags) { + uint16_t v6_src[8] = {0x2607, 0xf8b0, 0x400c, 0x0c03, 0x0000, 0x0000, +0x0000 ,0x001a }; +uint16_t v6_dst[8 ] = {0x2001 ,0x0470 ,0xe5bf ,0xdead ,0x4957 ,0x2174 , +0xe82c ,0x4887 };struct crypto_testsuite_params *ts_params = &testsuite_params;struct crypto_unittest_params *ut_params = &unittest_params;struct rte_security_capability_idx sec_cap_idx;
@@ -9158,8 +9162,16 @@ test_ipsec_proto_process(const struct ipsec_test_data td[], dst +=1 ; } -memcpy (&ipsec_xform.tunnel.ipv4.src_ip, &src,sizeof (src)); -memcpy (&ipsec_xform.tunnel.ipv4.dst_ip, &dst,sizeof (dst)); +if (td->ipsec_xform.tunnel.type == +RTE_SECURITY_IPSEC_TUNNEL_IPV4 ) { +memcpy (&ipsec_xform.tunnel.ipv4.src_ip, &src,sizeof (src)); +memcpy (&ipsec_xform.tunnel.ipv4.dst_ip, &dst,sizeof (dst)); + }else { +memcpy (&ipsec_xform.tunnel.ipv6.src_addr, &v6_src, +sizeof (v6_src)); +memcpy (&ipsec_xform.tunnel.ipv6.dst_addr, &v6_dst, +sizeof (v6_dst)); + } ctx =rte_cryptodev_get_sec_ctx (dev_id);
@@ -9555,6 +9567,58 @@ test_ipsec_proto_inner_l4_csum(const void *data __rte_unused) }static int +test_ipsec_proto_tunnel_v4_in_v4(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.ipv6 = false; + flags.tunnel_ipv6 = false; + +return test_ipsec_proto_all (&flags); +} + +static int +test_ipsec_proto_tunnel_v6_in_v6(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.ipv6 = true; + flags.tunnel_ipv6 = true; + +return test_ipsec_proto_all (&flags); +} + +static int +test_ipsec_proto_tunnel_v4_in_v6(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.ipv6 = false; + flags.tunnel_ipv6 = true; + +return test_ipsec_proto_all (&flags); +} + +static int +test_ipsec_proto_tunnel_v6_in_v4(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.ipv6 = true; + flags.tunnel_ipv6 = false; + +return test_ipsec_proto_all (&flags); +} + +static int test_PDCP_PROTO_all (void ) {struct crypto_testsuite_params *ts_params = &testsuite_params;
@@ -14431,6 +14495,15 @@ static struct unit_test_suite ipsec_proto_testsuite = { test_ipsec_proto_known_vec, &pkt_aes_128_cbc_hmac_sha256),TEST_CASE_NAMED_WITH_DATA ( +"Outbound known vector (ESP tunnel mode IPv6 AES-GCM 128)" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec, &pkt_aes_256_gcm_v6), +TEST_CASE_NAMED_WITH_DATA ( +"Outbound known vector (ESP tunnel mode IPv6 AES-CBC 128 HMAC-SHA256 [16B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec, + &pkt_aes_128_cbc_hmac_sha256_v6), +TEST_CASE_NAMED_WITH_DATA ("Inbound known vector (ESP tunnel mode IPv4 AES-GCM 128)" , ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_inb, &pkt_aes_128_gcm),
@@ -14451,6 +14524,15 @@ static struct unit_test_suite ipsec_proto_testsuite = { ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_inb, &pkt_aes_128_cbc_hmac_sha256), +TEST_CASE_NAMED_WITH_DATA ( +"Inbound known vector (ESP tunnel mode IPv6 AES-GCM 128)" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec_inb, &pkt_aes_256_gcm_v6), +TEST_CASE_NAMED_WITH_DATA ( +"Inbound known vector (ESP tunnel mode IPv6 AES-CBC 128 HMAC-SHA256 [16B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec_inb, + &pkt_aes_128_cbc_hmac_sha256_v6), TEST_CASE_NAMED_ST( "Combined test alg list", ut_setup_security, ut_teardown,
@@ -14495,6 +14577,22 @@ static struct unit_test_suite ipsec_proto_testsuite = { "Inner L4 checksum", ut_setup_security, ut_teardown, test_ipsec_proto_inner_l4_csum), +TEST_CASE_NAMED_ST ( +"Tunnel IPv4 in IPv4" , + ut_setup_security, ut_teardown, + test_ipsec_proto_tunnel_v4_in_v4), +TEST_CASE_NAMED_ST ( +"Tunnel IPv6 in IPv6" , + ut_setup_security, ut_teardown, + test_ipsec_proto_tunnel_v6_in_v6), +TEST_CASE_NAMED_ST ( +"Tunnel IPv4 in IPv6" , + ut_setup_security, ut_teardown, + test_ipsec_proto_tunnel_v4_in_v6), +TEST_CASE_NAMED_ST ( +"Tunnel IPv6 in IPv4" , + ut_setup_security, ut_teardown, + test_ipsec_proto_tunnel_v6_in_v4), TEST_CASES_END() /**< NULL terminate unit test array */ } };
app/test/test_cryptodev_security_ipsec.c +72 -2
110 lines not on this page · raw message
app/test/test_cryptodev_security_ipsec.h +4 -0
@@ -61,6 +61,8 @@ struct ipsec_test_flags {bool udp_ports_verify;bool ip_csum;bool l4_csum; +bool ipv6; +bool tunnel_ipv6; };struct crypto_param {
@@ -119,7 +121,9 @@ struct crypto_param_comb { };extern struct ipsec_test_data pkt_aes_256_gcm; +extern struct ipsec_test_data pkt_aes_256_gcm_v6;extern struct ipsec_test_data pkt_aes_128_cbc_hmac_sha256; +extern struct ipsec_test_data pkt_aes_128_cbc_hmac_sha256_v6; extern struct crypto_param_comb alg_list[RTE_DIM(aead_list) + (RTE_DIM(cipher_list) *
app/test/test_cryptodev_security_ipsec_test_vectors.h +202 -0
212 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 5/13 test/crypto: add IPsec HMAC-SHA384/512 known vectors
In reply to Anoob JosephFrom: Tejasree Kondoj <[email protected]>
Add lookaside IPsec HMAC-SHA384/512 known vectors.
--- app/test/test_cryptodev.c | 20 ++ app/test/test_cryptodev_security_ipsec.h | 14 +- .../test_cryptodev_security_ipsec_test_vectors.h | 213 +++++++++++++++++++++ 3 files changed, 246 insertions(+), 1 deletion(-)
app/test/test_cryptodev.c +20 -0
@@ -14495,6 +14495,16 @@ static struct unit_test_suite ipsec_proto_testsuite = { test_ipsec_proto_known_vec, &pkt_aes_128_cbc_hmac_sha256),TEST_CASE_NAMED_WITH_DATA ( +"Outbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA384 [24B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec, + &pkt_aes_128_cbc_hmac_sha384), +TEST_CASE_NAMED_WITH_DATA ( +"Outbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA512 [32B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec, + &pkt_aes_128_cbc_hmac_sha512), +TEST_CASE_NAMED_WITH_DATA ("Outbound known vector (ESP tunnel mode IPv6 AES-GCM 128)" , ut_setup_security, ut_teardown, test_ipsec_proto_known_vec, &pkt_aes_256_gcm_v6),
@@ -14525,6 +14535,16 @@ static struct unit_test_suite ipsec_proto_testsuite = { test_ipsec_proto_known_vec_inb, &pkt_aes_128_cbc_hmac_sha256),TEST_CASE_NAMED_WITH_DATA ( +"Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA384 [24B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec_inb, + &pkt_aes_128_cbc_hmac_sha384), +TEST_CASE_NAMED_WITH_DATA ( +"Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA512 [32B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec_inb, + &pkt_aes_128_cbc_hmac_sha512), +TEST_CASE_NAMED_WITH_DATA ("Inbound known vector (ESP tunnel mode IPv6 AES-GCM 128)" , ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_inb, &pkt_aes_256_gcm_v6),
app/test/test_cryptodev_security_ipsec.h +13 -1
@@ -15,7 +15,7 @@ struct ipsec_test_data {uint8_t data[32 ]; } key;struct { -uint8_t data[32 ]; +uint8_t data[64 ]; } auth_key;struct {
@@ -113,6 +113,18 @@ static const struct crypto_param auth_list[] = { .key_length = 32, .digest_length = 16, }, + { + .type = RTE_CRYPTO_SYM_XFORM_AUTH, + .alg.auth = RTE_CRYPTO_AUTH_SHA384_HMAC, + .key_length = 48, + .digest_length = 24, + }, + { + .type = RTE_CRYPTO_SYM_XFORM_AUTH, + .alg.auth = RTE_CRYPTO_AUTH_SHA512_HMAC, + .key_length = 64, + .digest_length = 32, + }, }; struct crypto_param_comb {
app/test/test_cryptodev_security_ipsec_test_vectors.h +213 -0
219 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 6/13 test/crypto: add IPsec fragmented packet known vectors
In reply to Anoob JosephFrom: Tejasree Kondoj <[email protected]>
Add fragmented plain packet known vector test case in IPsec outbound.
--- app/test/test_cryptodev.c | 22 +++++ app/test/test_cryptodev_security_ipsec.c | 10 ++ app/test/test_cryptodev_security_ipsec.h | 1 + .../test_cryptodev_security_ipsec_test_vectors.h | 104 +++++++++++++++++++++ 4 files changed, 137 insertions(+)
app/test/test_cryptodev.c +22 -0
@@ -9383,6 +9383,23 @@ test_ipsec_proto_known_vec_inb(const void *test_data) }static int +test_ipsec_proto_known_vec_fragmented (const void *test_data) +{ +struct ipsec_test_data td_outb; +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + flags.fragment = true; + +memcpy (&td_outb, test_data,sizeof (td_outb)); + +/* Disable IV gen to be able to test with known vectors */ + td_outb.ipsec_xform.options.iv_gen_disable =1 ; + +return test_ipsec_proto_process (&td_outb,NULL ,1 , false, &flags); +} + +static int test_ipsec_proto_all (const struct ipsec_test_flags *flags) {struct ipsec_test_data td_outb[IPSEC_TEST_PACKETS_MAX ];
@@ -14514,6 +14531,11 @@ static struct unit_test_suite ipsec_proto_testsuite = { test_ipsec_proto_known_vec, &pkt_aes_128_cbc_hmac_sha256_v6),TEST_CASE_NAMED_WITH_DATA ( +"Outbound fragmented packet" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec_fragmented, + &pkt_aes_128_gcm_frag), +TEST_CASE_NAMED_WITH_DATA ("Inbound known vector (ESP tunnel mode IPv4 AES-GCM 128)" , ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_inb, &pkt_aes_128_gcm),
app/test/test_cryptodev_security_ipsec.c +10 -0
@@ -659,6 +659,16 @@ test_ipsec_td_verify(struct rte_mbuf *m, const struct ipsec_test_data *td,return TEST_FAILED ; } +if ((td->ipsec_xform.direction ==RTE_SECURITY_IPSEC_SA_DIR_EGRESS ) && + flags->fragment) { +const struct rte_ipv4_hdr *iph4; + iph4 = (const struct rte_ipv4_hdr *)output_text; +if (iph4->fragment_offset) { +printf ("Output packet is fragmented" ); +return TEST_FAILED ; + } + } + skip =test_ipsec_tunnel_hdr_len_get (td); len -= skip;
app/test/test_cryptodev_security_ipsec.h +1 -0
@@ -63,6 +63,7 @@ struct ipsec_test_flags {bool l4_csum;bool ipv6;bool tunnel_ipv6; +bool fragment; };struct crypto_param {
app/test/test_cryptodev_security_ipsec_test_vectors.h +104 -0
108 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 7/13 test/crypto: add transport mode cases
In reply to Anoob JosephAdd transport mode tests with test cases for IPv4 packets.
--- app/test/test_cryptodev.c | 39 ++++++++++++++---- app/test/test_cryptodev_security_ipsec.c | 71 +++++++++++++++++++++----------- app/test/test_cryptodev_security_ipsec.h | 1 + 3 files changed, 79 insertions(+), 32 deletions(-)
app/test/test_cryptodev.c +30 -9
@@ -9162,15 +9162,19 @@ test_ipsec_proto_process(const struct ipsec_test_data td[], dst +=1 ; } -if (td->ipsec_xform.tunnel.type == -RTE_SECURITY_IPSEC_TUNNEL_IPV4 ) { -memcpy (&ipsec_xform.tunnel.ipv4.src_ip, &src,sizeof (src)); -memcpy (&ipsec_xform.tunnel.ipv4.dst_ip, &dst,sizeof (dst)); - }else { -memcpy (&ipsec_xform.tunnel.ipv6.src_addr, &v6_src, -sizeof (v6_src)); -memcpy (&ipsec_xform.tunnel.ipv6.dst_addr, &v6_dst, -sizeof (v6_dst)); +if (td->ipsec_xform.mode ==RTE_SECURITY_IPSEC_SA_MODE_TUNNEL ) { +if (td->ipsec_xform.tunnel.type == +RTE_SECURITY_IPSEC_TUNNEL_IPV4 ) { +memcpy (&ipsec_xform.tunnel.ipv4.src_ip, &src, +sizeof (src)); +memcpy (&ipsec_xform.tunnel.ipv4.dst_ip, &dst, +sizeof (dst)); + }else { +memcpy (&ipsec_xform.tunnel.ipv6.src_addr, &v6_src, +sizeof (v6_src)); +memcpy (&ipsec_xform.tunnel.ipv6.dst_addr, &v6_dst, +sizeof (v6_dst)); + } } ctx =rte_cryptodev_get_sec_ctx (dev_id);
@@ -9636,6 +9640,19 @@ test_ipsec_proto_tunnel_v6_in_v4(const void *data __rte_unused) }static int +test_ipsec_proto_transport_v4(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.ipv6 = false; + flags.transport = true; + +return test_ipsec_proto_all (&flags); +} + +static int test_PDCP_PROTO_all (void ) {struct crypto_testsuite_params *ts_params = &testsuite_params;
@@ -14635,6 +14652,10 @@ static struct unit_test_suite ipsec_proto_testsuite = { "Tunnel IPv6 in IPv4", ut_setup_security, ut_teardown, test_ipsec_proto_tunnel_v6_in_v4), + TEST_CASE_NAMED_ST( + "Transport IPv4", + ut_setup_security, ut_teardown, + test_ipsec_proto_transport_v4), TEST_CASES_END() /**< NULL terminate unit test array */ } };
app/test/test_cryptodev_security_ipsec.c +48 -23
89 lines not on this page · raw message
app/test/test_cryptodev_security_ipsec.h +1 -0
@@ -63,6 +63,7 @@ struct ipsec_test_flags {bool l4_csum;bool ipv6;bool tunnel_ipv6; +bool transport;bool fragment; };
Signature · 1 line
2.7.4
PATCH 8/13 test/crypto: add security stats cases
In reply to Anoob JosephFrom: Ankur Dwivedi <[email protected]>
Adds security stats test cases in IPSEC protocol testsuite.
--- app/test/test_cryptodev.c | 21 +++++++++++++++++++++ app/test/test_cryptodev_security_ipsec.c | 29 +++++++++++++++++++++++++++++ app/test/test_cryptodev_security_ipsec.h | 6 ++++++ 3 files changed, 56 insertions(+)
app/test/test_cryptodev.c +21 -0
@@ -9332,6 +9332,11 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],if (ret !=TEST_SUCCESS ) goto crypto_op_free; + ret =test_ipsec_stats_verify (ctx, ut_params->sec_session, + flags, dir); +if (ret !=TEST_SUCCESS ) + goto crypto_op_free; +rte_crypto_op_free (ut_params->op); ut_params->op =NULL ;
@@ -9653,6 +9658,18 @@ test_ipsec_proto_transport_v4(const void *data __rte_unused) }static int +test_ipsec_proto_stats(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.stats_success = true; + +return test_ipsec_proto_all (&flags); +} + +static int test_PDCP_PROTO_all (void ) {struct crypto_testsuite_params *ts_params = &testsuite_params;
@@ -14656,6 +14673,10 @@ static struct unit_test_suite ipsec_proto_testsuite = { "Transport IPv4", ut_setup_security, ut_teardown, test_ipsec_proto_transport_v4), + TEST_CASE_NAMED_ST( + "Statistics: success", + ut_setup_security, ut_teardown, + test_ipsec_proto_stats), TEST_CASES_END() /**< NULL terminate unit test array */ } };
app/test/test_cryptodev_security_ipsec.c +29 -0
@@ -415,6 +415,8 @@ test_ipsec_td_prepare(const struct crypto_param *param1,RTE_SECURITY_IPSEC_TUNNEL_IPV4 ; } +if (flags->stats_success) + td->ipsec_xform.options.stats =1 ; } }
@@ -871,3 +873,30 @@ test_ipsec_status_check(struct rte_crypto_op *op,return ret; } + +int +test_ipsec_stats_verify (struct rte_security_ctx *ctx, +struct rte_security_session *sess, +const struct ipsec_test_flags *flags, +enum rte_security_ipsec_sa_direction dir) +{ +struct rte_security_stats stats = {0 }; +int ret =TEST_SUCCESS ; + +if (flags->stats_success) { +if (rte_security_session_stats_get (ctx, sess, &stats) <0 ) +return TEST_FAILED ; + +if (dir ==RTE_SECURITY_IPSEC_SA_DIR_EGRESS ) { +if (stats.ipsec.opackets !=1 || + stats.ipsec.oerrors !=0 ) + ret =TEST_FAILED ; + }else { +if (stats.ipsec.ipackets !=1 || + stats.ipsec.ierrors !=0 ) + ret =TEST_FAILED ; + } + } + +return ret; +}
app/test/test_cryptodev_security_ipsec.h +6 -0
@@ -65,6 +65,7 @@ struct ipsec_test_flags {bool tunnel_ipv6;bool transport;bool fragment; +bool stats_success; };struct crypto_param {
@@ -188,4 +189,9 @@ int test_ipsec_status_check(struct rte_crypto_op *op,enum rte_security_ipsec_sa_direction dir, int pkt_num); +int test_ipsec_stats_verify (struct rte_security_ctx *ctx, +struct rte_security_session *sess, +const struct ipsec_test_flags *flags, +enum rte_security_ipsec_sa_direction dir); +#endif
Signature · 1 line
2.7.4
PATCH 9/13 test/crypto: add lookaside IPsec AES-CTR known vectors
In reply to Anoob JosephFrom: Tejasree Kondoj <[email protected]>
Add known vectors for AES-CTR in lookaside IPsec mode.
--- app/test/test_cryptodev_security_ipsec.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
app/test/test_cryptodev_security_ipsec.h +15 -0
@@ -103,6 +103,21 @@ static const struct crypto_param cipher_list[] = { .alg.cipher = RTE_CRYPTO_CIPHER_AES_CBC, .key_length = 16, }, + { + .type = RTE_CRYPTO_SYM_XFORM_CIPHER, + .alg.cipher = RTE_CRYPTO_CIPHER_AES_CTR, + .key_length = 16, + }, + { + .type = RTE_CRYPTO_SYM_XFORM_CIPHER, + .alg.cipher = RTE_CRYPTO_CIPHER_AES_CTR, + .key_length = 24, + }, + { + .type = RTE_CRYPTO_SYM_XFORM_CIPHER, + .alg.cipher = RTE_CRYPTO_CIPHER_AES_CTR, + .key_length = 32, + }, }; static const struct crypto_param auth_list[] = {
Signature · 1 line
2.7.4
PATCH 10/13 test/crypto: add fragmented packet case
In reply to Anoob JosephFrom: Tejasree Kondoj <[email protected]>
Add fragmented plain packet test case in combined mode.
--- app/test/test_cryptodev.c | 16 ++++++++++++++++ app/test/test_cryptodev_security_ipsec.c | 7 +++++++ 2 files changed, 23 insertions(+)
app/test/test_cryptodev.c +16 -0
@@ -9670,6 +9670,18 @@ test_ipsec_proto_stats(const void *data __rte_unused) }static int +test_ipsec_proto_pkt_fragment(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.fragment = true; + +return test_ipsec_proto_all (&flags); +} + +static int test_PDCP_PROTO_all (void ) {struct crypto_testsuite_params *ts_params = &testsuite_params;
@@ -14677,6 +14689,10 @@ static struct unit_test_suite ipsec_proto_testsuite = { "Statistics: success", ut_setup_security, ut_teardown, test_ipsec_proto_stats), + TEST_CASE_NAMED_ST( + "Fragmented packet", + ut_setup_security, ut_teardown, + test_ipsec_proto_pkt_fragment), TEST_CASES_END() /**< NULL terminate unit test array */ } };
app/test/test_cryptodev_security_ipsec.c +7 -0
@@ -418,6 +418,13 @@ test_ipsec_td_prepare(const struct crypto_param *param1,if (flags->stats_success) td->ipsec_xform.options.stats =1 ; +if (flags->fragment) { +struct rte_ipv4_hdr *ip; + ip = (struct rte_ipv4_hdr *)&td->input_text.data; + ip->fragment_offset =4 ; + ip->hdr_checksum =rte_ipv4_cksum (ip); + } + } }
Signature · 1 line
2.7.4
PATCH 11/13 test/crypto: skip null auth in ICV corrupt case
In reply to Anoob JosephFrom: Tejasree Kondoj <[email protected]>
Skipping NULL auth in ICV corruption test case.
--- app/test/test_cryptodev.c | 5 +++++ 1 file changed, 5 insertions(+)
app/test/test_cryptodev.c +5 -0
@@ -9428,6 +9428,11 @@ test_ipsec_proto_all(const struct ipsec_test_flags *flags) td_outb, nb_pkts); +if (flags->icv_corrupt && (td_outb->aead == false) && + (td_outb->xform.chain.auth.auth.algo == +RTE_CRYPTO_AUTH_NULL )) +continue ; + ret =test_ipsec_proto_process (td_outb, td_inb, nb_pkts, true, flags);if (ret ==TEST_SKIPPED )
Signature · 1 line
2.7.4
PATCH 12/13 test/crypto: add aes xcbc known vectors
In reply to Anoob JosephAdd known vector test cases for NULL cipher + AES-XCBC. Also add both algos to the combined mode list of algos.
--- app/test/test_cryptodev.c | 38 +++++++-- app/test/test_cryptodev_security_ipsec.c | 2 + app/test/test_cryptodev_security_ipsec.h | 17 ++++ .../test_cryptodev_security_ipsec_test_vectors.h | 90 ++++++++++++++++++++++ 4 files changed, 141 insertions(+), 6 deletions(-)
app/test/test_cryptodev.c +32 -6
@@ -9368,8 +9368,11 @@ test_ipsec_proto_known_vec(const void *test_data)memcpy (&td_outb, test_data,sizeof (td_outb)); -/* Disable IV gen to be able to test with known vectors */ - td_outb.ipsec_xform.options.iv_gen_disable =1 ; +if (td_outb.aead || + td_outb.xform.chain.cipher.cipher.algo !=RTE_CRYPTO_CIPHER_NULL ) { +/* Disable IV gen to be able to test with known vectors */ + td_outb.ipsec_xform.options.iv_gen_disable =1 ; + }return test_ipsec_proto_process (&td_outb,NULL ,1 , false, &flags); }
@@ -9428,10 +9431,23 @@ test_ipsec_proto_all(const struct ipsec_test_flags *flags) td_outb, nb_pkts); -if (flags->icv_corrupt && (td_outb->aead == false) && - (td_outb->xform.chain.auth.auth.algo == -RTE_CRYPTO_AUTH_NULL )) -continue ; +if (!td_outb->aead) { +enum rte_crypto_cipher_algorithm cipher_alg; +enum rte_crypto_auth_algorithm auth_alg; + + cipher_alg = td_outb->xform.chain.cipher.cipher.algo; + auth_alg = td_outb->xform.chain.auth.auth.algo; + +/* ICV is not applicable for NULL auth */ +if (flags->icv_corrupt && + auth_alg ==RTE_CRYPTO_AUTH_NULL ) +continue ; + +/* IV is not applicable for NULL cipher */ +if (flags->iv_gen && + cipher_alg ==RTE_CRYPTO_CIPHER_NULL ) +continue ; + } ret =test_ipsec_proto_process (td_outb, td_inb, nb_pkts, true, flags);
@@ -14582,6 +14598,11 @@ static struct unit_test_suite ipsec_proto_testsuite = { test_ipsec_proto_known_vec, &pkt_aes_128_cbc_hmac_sha256_v6),TEST_CASE_NAMED_WITH_DATA ( +"Outbound known vector (ESP tunnel mode IPv4 NULL AES-XCBC-MAC [12B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec, + &pkt_null_aes_xcbc), + TEST_CASE_NAMED_WITH_DATA( "Outbound fragmented packet", ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_fragmented,
@@ -14626,6 +14647,11 @@ static struct unit_test_suite ipsec_proto_testsuite = { ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_inb, &pkt_aes_128_cbc_hmac_sha256_v6), +TEST_CASE_NAMED_WITH_DATA ( +"Inbound known vector (ESP tunnel mode IPv4 NULL AES-XCBC-MAC [12B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec_inb, + &pkt_null_aes_xcbc), TEST_CASE_NAMED_ST( "Combined test alg list", ut_setup_security, ut_teardown,
app/test/test_cryptodev_security_ipsec.c +2 -0
@@ -375,6 +375,8 @@ test_ipsec_td_prepare(const struct crypto_param *param1, td->xform.chain.cipher.cipher.algo = param1->alg.cipher; td->xform.chain.cipher.cipher.key.length = param1->key_length; + td->xform.chain.cipher.cipher.iv.length = + param1->iv_length; td->xform.chain.auth.auth.algo = param2->alg.auth; td->xform.chain.auth.auth.key.length = param2->key_length;
app/test/test_cryptodev_security_ipsec.h +17 -0
@@ -76,6 +76,7 @@ struct crypto_param {enum rte_crypto_aead_algorithm aead; } alg;uint16_t key_length; +uint16_t iv_length;uint16_t digest_length; };
@@ -100,23 +101,33 @@ static const struct crypto_param aead_list[] = {static const struct crypto_param cipher_list[] = { { .type =RTE_CRYPTO_SYM_XFORM_CIPHER , + .alg.cipher =RTE_CRYPTO_CIPHER_NULL , + .key_length =0 , + .iv_length =0 , + }, + { + .type =RTE_CRYPTO_SYM_XFORM_CIPHER , .alg.cipher =RTE_CRYPTO_CIPHER_AES_CBC , .key_length =16 , + .iv_length =16 , }, { .type =RTE_CRYPTO_SYM_XFORM_CIPHER , .alg.cipher =RTE_CRYPTO_CIPHER_AES_CTR , .key_length =16 , + .iv_length =16 , }, { .type =RTE_CRYPTO_SYM_XFORM_CIPHER , .alg.cipher =RTE_CRYPTO_CIPHER_AES_CTR , .key_length =24 , + .iv_length =16 , }, { .type =RTE_CRYPTO_SYM_XFORM_CIPHER , .alg.cipher =RTE_CRYPTO_CIPHER_AES_CTR , .key_length =32 , + .iv_length =16 , }, };
@@ -143,6 +154,12 @@ static const struct crypto_param auth_list[] = { .key_length = 64, .digest_length = 32, }, + { + .type = RTE_CRYPTO_SYM_XFORM_AUTH, + .alg.auth = RTE_CRYPTO_AUTH_AES_XCBC_MAC, + .key_length = 16, + .digest_length = 12, + }, };struct crypto_param_comb {
app/test/test_cryptodev_security_ipsec_test_vectors.h +90 -0
94 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 13/13 test/crypto: add copy and set DF cases
In reply to Anoob JosephAdd test cases to verify copy DF and set DF options with lookaside IPsec offload.
--- app/test/test_cryptodev.c | 75 ++++++++++++++++++++++++++++++++ app/test/test_cryptodev_security_ipsec.c | 71 ++++++++++++++++++++++++++++-- app/test/test_cryptodev_security_ipsec.h | 10 +++++ doc/guides/rel_notes/release_22_03.rst | 18 ++++++++ 4 files changed, 171 insertions(+), 3 deletions(-)
app/test/test_cryptodev.c +75 -0
@@ -9169,6 +9169,13 @@ test_ipsec_proto_process(const struct ipsec_test_data td[], sizeof(src));memcpy (&ipsec_xform.tunnel.ipv4.dst_ip, &dst,sizeof (dst)); + +if (flags->df ==TEST_IPSEC_SET_DF_0_INNER_1 ) + ipsec_xform.tunnel.ipv4.df =0 ; + +if (flags->df ==TEST_IPSEC_SET_DF_1_INNER_0 ) + ipsec_xform.tunnel.ipv4.df =1 ; + }else {memcpy (&ipsec_xform.tunnel.ipv6.src_addr, &v6_src,sizeof (v6_src));
@@ -9282,6 +9289,9 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],memcpy (input_text, td[i].input_text.data, td[i].input_text.len); +if (test_ipsec_pkt_update (input_text, flags)) +return TEST_FAILED ; +/* Generate crypto op data structure */ ut_params->op =rte_crypto_op_alloc (ts_params->op_mpool,RTE_CRYPTO_OP_TYPE_SYMMETRIC );
@@ -9700,6 +9710,55 @@ test_ipsec_proto_pkt_fragment(const void *data __rte_unused) flags.fragment = true;return test_ipsec_proto_all (&flags); + +} + +static int +test_ipsec_proto_copy_df_inner_0(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.df =TEST_IPSEC_COPY_DF_INNER_0 ; + +return test_ipsec_proto_all (&flags); +} + +static int +test_ipsec_proto_copy_df_inner_1(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.df =TEST_IPSEC_COPY_DF_INNER_1 ; + +return test_ipsec_proto_all (&flags); +} + +static int +test_ipsec_proto_set_df_0_inner_1(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.df =TEST_IPSEC_SET_DF_0_INNER_1 ; + +return test_ipsec_proto_all (&flags); +} + +static int +test_ipsec_proto_set_df_1_inner_0(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.df =TEST_IPSEC_SET_DF_1_INNER_0 ; + +return test_ipsec_proto_all (&flags); } static int
@@ -14724,6 +14783,22 @@ static struct unit_test_suite ipsec_proto_testsuite = { "Fragmented packet", ut_setup_security, ut_teardown, test_ipsec_proto_pkt_fragment), +TEST_CASE_NAMED_ST ( +"Tunnel header copy DF (inner 0)" , + ut_setup_security, ut_teardown, + test_ipsec_proto_copy_df_inner_0), +TEST_CASE_NAMED_ST ( +"Tunnel header copy DF (inner 1)" , + ut_setup_security, ut_teardown, + test_ipsec_proto_copy_df_inner_1), +TEST_CASE_NAMED_ST ( +"Tunnel header set DF 0 (inner 1)" , + ut_setup_security, ut_teardown, + test_ipsec_proto_set_df_0_inner_1), +TEST_CASE_NAMED_ST ( +"Tunnel header set DF 1 (inner 0)" , + ut_setup_security, ut_teardown, + test_ipsec_proto_set_df_1_inner_0), TEST_CASES_END() /**< NULL terminate unit test array */ } };
app/test/test_cryptodev_security_ipsec.c +68 -3
109 lines not on this page · raw message
app/test/test_cryptodev_security_ipsec.h +10 -0
@@ -50,6 +50,13 @@ struct ipsec_test_data { } xform; }; +enum df_flags { +TEST_IPSEC_COPY_DF_INNER_0 =1 , +TEST_IPSEC_COPY_DF_INNER_1 , +TEST_IPSEC_SET_DF_0_INNER_1 , +TEST_IPSEC_SET_DF_1_INNER_0 , +}; +struct ipsec_test_flags {bool display_alg;bool sa_expiry_pkts_soft;
@@ -66,6 +73,7 @@ struct ipsec_test_flags {bool transport;bool fragment;bool stats_success; +enum df_flags df; };struct crypto_param {
@@ -226,4 +234,6 @@ int test_ipsec_stats_verify(struct rte_security_ctx *ctx,const struct ipsec_test_flags *flags, enum rte_security_ipsec_sa_direction dir); +int test_ipsec_pkt_update (uint8_t *pkt,const struct ipsec_test_flags *flags); +#endif
doc/guides/rel_notes/release_22_03.rst +18 -0
@@ -55,6 +55,24 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Updated lookaside protocol (IPsec) tests in dpdk-test.** + + * Added support for chained operations. + * Added AES-CBC 128 NULL auth known vector tests. + * Added AES-CBC 128 HMAC-SHA256 known vector tests. + * Added AES-CBC 128 HMAC-SHA384 known vector tests. + * Added AES-CBC 128 HMAC-SHA512 known vector tests. + * Added NULL cipher AES-XCBC known vector tests. + * Added tunnel mode tests + * IPv6 in IPv6 + * IPv4 in IPv4 + * IPv4 in IPv6 + * IPv6 in IPv4 + * Added IPv4 transport mode tests. + * Added security stats tests. + * Added AES-CTR tests. + * Added set/copy DF tests. + Removed Items -------------
Signature · 1 line
2.7.4
v2 cover Add new cases to lookaside IPsec tests
In reply to Anoob JosephAdd new tests to lookaside IPsec tests.
* Support for chained operations.
* AES-CBC 128 NULL auth known vector tests.
* AES-CBC 128 HMAC-SHA256 known vector tests.
* AES-CBC 128 HMAC-SHA384 known vector tests.
* AES-CBC 128 HMAC-SHA512 known vector tests.
* NULL cipher AES-XCBC known vector tests.
* Tunnel mode tests
* IPv6 in IPv6
* IPv4 in IPv4
* IPv4 in IPv6
* IPv6 in IPv4
* IPv4 transport mode tests.
* Tunnel mode fragment packet tests.
* Security stats tests.
* AES-CTR tests.
* set/copy DF tests.
Changes in v2:
- Moved release notes update to originating patch
- Fixed build failure with last patch
Ankur Dwivedi (1):
test/crypto: add security stats cases
Anoob Joseph (5):
test/crypto: add IPsec aes-cbc known vectors test/crypto: add chained operations in combined cases test/crypto: add transport mode cases test/crypto: add aes xcbc known vectors test/crypto: add copy and set DF cases
Tejasree Kondoj (7):
test/crypto: add IPsec AES-CBC-HMAC-SHA256 known vectors test/crypto: add IPv6 tunnel mode cases test/crypto: add IPsec HMAC-SHA384/512 known vectors test/crypto: add IPsec fragmented packet known vectors test/crypto: add lookaside IPsec AES-CTR known vectors test/crypto: add fragmented packet case test/crypto: skip null auth in ICV corrupt case
app/test/test_cryptodev.c | 395 +++++++++- app/test/test_cryptodev_security_ipsec.c | 352 ++++++++- app/test/test_cryptodev_security_ipsec.h | 113 +++ .../test_cryptodev_security_ipsec_test_vectors.h | 828 +++++++++++++++++++++ doc/guides/rel_notes/release_22_03.rst | 19 + 5 files changed, 1665 insertions(+), 42 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/13 test/crypto: add IPsec aes-cbc known vectors
Extend the framework to support chained operations and add AES-CBC 128 known vector tests.
--- app/test/test_cryptodev.c | 62 ++++++++++-- app/test/test_cryptodev_security_ipsec.c | 51 ++++++++++ app/test/test_cryptodev_security_ipsec.h | 8 ++ .../test_cryptodev_security_ipsec_test_vectors.h | 110 +++++++++++++++++++++ doc/guides/rel_notes/release_22_03.rst | 4 + 5 files changed, 226 insertions(+), 9 deletions(-)
app/test/test_cryptodev.c +53 -9
@@ -9191,23 +9191,59 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],return TEST_SKIPPED ; } }else { -/* Only AEAD supported now */ -return TEST_SKIPPED ; +memcpy (&ut_params->cipher_xform, &td[0 ].xform.chain.cipher, +sizeof (ut_params->cipher_xform)); +memcpy (&ut_params->auth_xform, &td[0 ].xform.chain.auth, +sizeof (ut_params->auth_xform)); + ut_params->cipher_xform.cipher.key.data = td[0 ].key.data; + ut_params->cipher_xform.cipher.iv.offset =IV_OFFSET ; + ut_params->auth_xform.auth.key.data = td[0 ].key.data; + +/* Verify crypto capabilities */ + +if (test_ipsec_crypto_caps_cipher_verify ( + sec_cap, + &ut_params->cipher_xform) !=0 ) { +if (!silent) +RTE_LOG (INFO ,USER1 , +"Cipher crypto capabilities not supported\n" ); +return TEST_SKIPPED ; + } + +if (test_ipsec_crypto_caps_auth_verify ( + sec_cap, + &ut_params->auth_xform) !=0 ) { +if (!silent) +RTE_LOG (INFO ,USER1 , +"Auth crypto capabilities not supported\n" ); +return TEST_SKIPPED ; + } }if (test_ipsec_sec_caps_verify (&ipsec_xform, sec_cap, silent) !=0 )return TEST_SKIPPED ; - salt_len =RTE_MIN (sizeof (ipsec_xform.salt), td[0 ].salt.len); -memcpy (&ipsec_xform.salt, td[0 ].salt.data, salt_len); -struct rte_security_session_conf sess_conf = { .action_type = ut_params->type, .protocol =RTE_SECURITY_PROTOCOL_IPSEC , - .ipsec = ipsec_xform, - .crypto_xform = &ut_params->aead_xform, }; +if (td[0 ].aead) { + salt_len =RTE_MIN (sizeof (ipsec_xform.salt), td[0 ].salt.len); +memcpy (&ipsec_xform.salt, td[0 ].salt.data, salt_len); + sess_conf.ipsec = ipsec_xform; + sess_conf.crypto_xform = &ut_params->aead_xform; + }else { + sess_conf.ipsec = ipsec_xform; +if (dir ==RTE_SECURITY_IPSEC_SA_DIR_EGRESS ) { + sess_conf.crypto_xform = &ut_params->cipher_xform; + ut_params->cipher_xform.next = &ut_params->auth_xform; + }else { + sess_conf.crypto_xform = &ut_params->auth_xform; + ut_params->auth_xform.next = &ut_params->cipher_xform; + } + } +/* Create security session */ ut_params->sec_session = rte_security_session_create(ctx, &sess_conf, ts_params->session_mpool,
@@ -9316,14 +9352,18 @@ test_ipsec_proto_known_vec(const void *test_data) }static int -test_ipsec_proto_known_vec_inb (const void *td_outb) +test_ipsec_proto_known_vec_inb (const void *test_data) { +const struct ipsec_test_data *td = test_data;struct ipsec_test_flags flags;struct ipsec_test_data td_inb;memset (&flags,0 ,sizeof (flags)); -test_ipsec_td_in_from_out (td_outb, &td_inb); +if (td->ipsec_xform.direction ==RTE_SECURITY_IPSEC_SA_DIR_EGRESS ) +test_ipsec_td_in_from_out (td, &td_inb); +else +memcpy (&td_inb, td,sizeof (td_inb));return test_ipsec_proto_process (&td_inb,NULL ,1 , false, &flags); }
@@ -14394,6 +14434,10 @@ static struct unit_test_suite ipsec_proto_testsuite = { "Inbound known vector (ESP tunnel mode IPv4 AES-GCM 256)", ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_inb, &pkt_aes_256_gcm), +TEST_CASE_NAMED_WITH_DATA ( +"Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128)" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec_inb, &pkt_aes_128_cbc_null), TEST_CASE_NAMED_ST( "Combined test alg list", ut_setup_security, ut_teardown,
app/test/test_cryptodev_security_ipsec.c +51 -0
57 lines not on this page · raw message
app/test/test_cryptodev_security_ipsec.h +8 -0
@@ -96,6 +96,14 @@ int test_ipsec_crypto_caps_aead_verify(const struct rte_security_capability *sec_cap, struct rte_crypto_sym_xform *aead); +int test_ipsec_crypto_caps_cipher_verify ( +const struct rte_security_capability *sec_cap, +struct rte_crypto_sym_xform *cipher); + +int test_ipsec_crypto_caps_auth_verify ( +const struct rte_security_capability *sec_cap, +struct rte_crypto_sym_xform *auth); +void test_ipsec_td_in_from_out (const struct ipsec_test_data *td_out,struct ipsec_test_data *td_in);
app/test/test_cryptodev_security_ipsec_test_vectors.h +110 -0
114 lines not on this page · raw message
doc/guides/rel_notes/release_22_03.rst +4 -0
@@ -55,6 +55,10 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Updated lookaside protocol (IPsec) tests in dpdk-test.** + + * Added AES-CBC 128 NULL auth known vector tests. + Removed Items -------------
Signature · 1 line
2.7.4
PATCH v2 2/13 test/crypto: add IPsec AES-CBC-HMAC-SHA256 known vectors
In reply to Anoob JosephFrom: Tejasree Kondoj <[email protected]>
Adding lookaside IPsec AES-CBC-HMAC-SHA256 test cases.
--- app/test/test_cryptodev.c | 12 ++- app/test/test_cryptodev_security_ipsec.h | 3 + .../test_cryptodev_security_ipsec_test_vectors.h | 109 +++++++++++++++++++++ doc/guides/rel_notes/release_22_03.rst | 1 + 4 files changed, 124 insertions(+), 1 deletion(-)
app/test/test_cryptodev.c +11 -1
@@ -9197,7 +9197,7 @@ test_ipsec_proto_process(const struct ipsec_test_data td[], sizeof(ut_params->auth_xform)); ut_params->cipher_xform.cipher.key.data = td[0 ].key.data; ut_params->cipher_xform.cipher.iv.offset =IV_OFFSET ; - ut_params->auth_xform.auth.key.data = td[0 ].key.data; + ut_params->auth_xform.auth.key.data = td[0 ].auth_key.data;/* Verify crypto capabilities */
@@ -14423,6 +14423,11 @@ static struct unit_test_suite ipsec_proto_testsuite = { ut_setup_security, ut_teardown, test_ipsec_proto_known_vec, &pkt_aes_256_gcm),TEST_CASE_NAMED_WITH_DATA ( +"Outbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA256 [16B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec, + &pkt_aes_128_cbc_hmac_sha256), +TEST_CASE_NAMED_WITH_DATA ("Inbound known vector (ESP tunnel mode IPv4 AES-GCM 128)" , ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_inb, &pkt_aes_128_gcm),
@@ -14438,6 +14443,11 @@ static struct unit_test_suite ipsec_proto_testsuite = { "Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128)", ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_inb, &pkt_aes_128_cbc_null), +TEST_CASE_NAMED_WITH_DATA ( +"Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA256 [16B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec_inb, + &pkt_aes_128_cbc_hmac_sha256), TEST_CASE_NAMED_ST( "Combined test alg list", ut_setup_security, ut_teardown,
app/test/test_cryptodev_security_ipsec.h +3 -0
@@ -14,6 +14,9 @@ struct ipsec_test_data {struct {uint8_t data[32 ]; } key; +struct { +uint8_t data[32 ]; + } auth_key;struct {uint8_t data[1024 ];
app/test/test_cryptodev_security_ipsec_test_vectors.h +109 -0
113 lines not on this page · raw message
doc/guides/rel_notes/release_22_03.rst +1 -0
@@ -58,6 +58,7 @@ New Features * **Updated lookaside protocol (IPsec) tests in dpdk-test.** * Added AES-CBC 128 NULL auth known vector tests. + * Added AES-CBC 128 HMAC-SHA256 known vector tests. Removed Items
Signature · 1 line
2.7.4
PATCH v2 3/13 test/crypto: add chained operations in combined cases
In reply to Anoob JosephExtend lookaside IPsec combined mode cases to cover chained operations also.
Currently covering combinations of,
Ciphers,
1. AES-128-CBC
Auth,
1. NULL
2. SHA2-256 [16B ICV]
--- app/test/test_cryptodev.c | 11 +++-- app/test/test_cryptodev_security_ipsec.c | 77 +++++++++++++++++++++++++------- app/test/test_cryptodev_security_ipsec.h | 36 +++++++++++++++ doc/guides/rel_notes/release_22_03.rst | 1 + 4 files changed, 104 insertions(+), 21 deletions(-)
app/test/test_cryptodev.c +7 -4
@@ -835,6 +835,8 @@ ipsec_proto_testsuite_setup(void) ret =TEST_SKIPPED ; } +test_ipsec_alg_list_populate (); +/* * Stop the device. Device would be started again by individual test * case setup routine.
@@ -9381,9 +9383,9 @@ test_ipsec_proto_all(const struct ipsec_test_flags *flags) flags->sa_expiry_pkts_hard) nb_pkts =IPSEC_TEST_PACKETS_MAX ; -for (i =0 ; i <RTE_DIM (aead_list); i++) { -test_ipsec_td_prepare (&aead_list[i], -NULL , +for (i =0 ; i <RTE_DIM (alg_list); i++) { +test_ipsec_td_prepare (alg_list[i].param1, + alg_list[i].param2, flags, td_outb, nb_pkts);
@@ -9407,7 +9409,8 @@ test_ipsec_proto_all(const struct ipsec_test_flags *flags)return TEST_FAILED ;if (flags->display_alg) -test_ipsec_display_alg (&aead_list[i],NULL ); +test_ipsec_display_alg (alg_list[i].param1, + alg_list[i].param2); pass_cnt++; }
app/test/test_cryptodev_security_ipsec.c +60 -17
113 lines not on this page · raw message
app/test/test_cryptodev_security_ipsec.h +36 -0
@@ -71,6 +71,7 @@ struct crypto_param {enum rte_crypto_aead_algorithm aead; } alg;uint16_t key_length; +uint16_t digest_length; };static const struct crypto_param aead_list[] = {
@@ -91,6 +92,41 @@ static const struct crypto_param aead_list[] = { }, }; +static const struct crypto_param cipher_list[] = { + { + .type =RTE_CRYPTO_SYM_XFORM_CIPHER , + .alg.cipher =RTE_CRYPTO_CIPHER_AES_CBC , + .key_length =16 , + }, +}; + +static const struct crypto_param auth_list[] = { + { + .type =RTE_CRYPTO_SYM_XFORM_AUTH , + .alg.auth =RTE_CRYPTO_AUTH_NULL , + }, + { + .type =RTE_CRYPTO_SYM_XFORM_AUTH , + .alg.auth =RTE_CRYPTO_AUTH_SHA256_HMAC , + .key_length =32 , + .digest_length =16 , + }, +}; + +struct crypto_param_comb { +const struct crypto_param *param1; +const struct crypto_param *param2; +}; + +extern struct ipsec_test_data pkt_aes_256_gcm; +extern struct ipsec_test_data pkt_aes_128_cbc_hmac_sha256; + +extern struct crypto_param_comb alg_list[RTE_DIM (aead_list) + + (RTE_DIM (cipher_list) * +RTE_DIM (auth_list))]; + +void test_ipsec_alg_list_populate (void ); +int test_ipsec_sec_caps_verify (struct rte_security_ipsec_xform *ipsec_xform,const struct rte_security_capability *sec_cap,bool silent);
doc/guides/rel_notes/release_22_03.rst +1 -0
@@ -57,6 +57,7 @@ New Features * **Updated lookaside protocol (IPsec) tests in dpdk-test.** + * Added support for chained operations. * Added AES-CBC 128 NULL auth known vector tests. * Added AES-CBC 128 HMAC-SHA256 known vector tests.
Signature · 1 line
2.7.4
PATCH v2 4/13 test/crypto: add IPv6 tunnel mode cases
In reply to Anoob JosephFrom: Tejasree Kondoj <[email protected]>
Add IPv6 known vector and combined mode tests.
Following modes are added:
Tunnel IPv6 in IPv6
Tunnel IPv4 in IPv4
Tunnel IPv4 in IPv6
Tunnel IPv6 in IPv4
--- app/test/test_cryptodev.c | 102 ++++++++++- app/test/test_cryptodev_security_ipsec.c | 74 +++++++- app/test/test_cryptodev_security_ipsec.h | 4 + .../test_cryptodev_security_ipsec_test_vectors.h | 202 +++++++++++++++++++++ doc/guides/rel_notes/release_22_03.rst | 5 + 5 files changed, 383 insertions(+), 4 deletions(-)
app/test/test_cryptodev.c +100 -2
@@ -9125,6 +9125,10 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],bool silent, const struct ipsec_test_flags *flags) { + uint16_t v6_src[8] = {0x2607, 0xf8b0, 0x400c, 0x0c03, 0x0000, 0x0000, +0x0000 ,0x001a }; +uint16_t v6_dst[8 ] = {0x2001 ,0x0470 ,0xe5bf ,0xdead ,0x4957 ,0x2174 , +0xe82c ,0x4887 };struct crypto_testsuite_params *ts_params = &testsuite_params;struct crypto_unittest_params *ut_params = &unittest_params;struct rte_security_capability_idx sec_cap_idx;
@@ -9158,8 +9162,16 @@ test_ipsec_proto_process(const struct ipsec_test_data td[], dst +=1 ; } -memcpy (&ipsec_xform.tunnel.ipv4.src_ip, &src,sizeof (src)); -memcpy (&ipsec_xform.tunnel.ipv4.dst_ip, &dst,sizeof (dst)); +if (td->ipsec_xform.tunnel.type == +RTE_SECURITY_IPSEC_TUNNEL_IPV4 ) { +memcpy (&ipsec_xform.tunnel.ipv4.src_ip, &src,sizeof (src)); +memcpy (&ipsec_xform.tunnel.ipv4.dst_ip, &dst,sizeof (dst)); + }else { +memcpy (&ipsec_xform.tunnel.ipv6.src_addr, &v6_src, +sizeof (v6_src)); +memcpy (&ipsec_xform.tunnel.ipv6.dst_addr, &v6_dst, +sizeof (v6_dst)); + } ctx =rte_cryptodev_get_sec_ctx (dev_id);
@@ -9555,6 +9567,58 @@ test_ipsec_proto_inner_l4_csum(const void *data __rte_unused) }static int +test_ipsec_proto_tunnel_v4_in_v4(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.ipv6 = false; + flags.tunnel_ipv6 = false; + +return test_ipsec_proto_all (&flags); +} + +static int +test_ipsec_proto_tunnel_v6_in_v6(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.ipv6 = true; + flags.tunnel_ipv6 = true; + +return test_ipsec_proto_all (&flags); +} + +static int +test_ipsec_proto_tunnel_v4_in_v6(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.ipv6 = false; + flags.tunnel_ipv6 = true; + +return test_ipsec_proto_all (&flags); +} + +static int +test_ipsec_proto_tunnel_v6_in_v4(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.ipv6 = true; + flags.tunnel_ipv6 = false; + +return test_ipsec_proto_all (&flags); +} + +static int test_PDCP_PROTO_all (void ) {struct crypto_testsuite_params *ts_params = &testsuite_params;
@@ -14431,6 +14495,15 @@ static struct unit_test_suite ipsec_proto_testsuite = { test_ipsec_proto_known_vec, &pkt_aes_128_cbc_hmac_sha256),TEST_CASE_NAMED_WITH_DATA ( +"Outbound known vector (ESP tunnel mode IPv6 AES-GCM 128)" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec, &pkt_aes_256_gcm_v6), +TEST_CASE_NAMED_WITH_DATA ( +"Outbound known vector (ESP tunnel mode IPv6 AES-CBC 128 HMAC-SHA256 [16B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec, + &pkt_aes_128_cbc_hmac_sha256_v6), +TEST_CASE_NAMED_WITH_DATA ("Inbound known vector (ESP tunnel mode IPv4 AES-GCM 128)" , ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_inb, &pkt_aes_128_gcm),
@@ -14451,6 +14524,15 @@ static struct unit_test_suite ipsec_proto_testsuite = { ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_inb, &pkt_aes_128_cbc_hmac_sha256), +TEST_CASE_NAMED_WITH_DATA ( +"Inbound known vector (ESP tunnel mode IPv6 AES-GCM 128)" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec_inb, &pkt_aes_256_gcm_v6), +TEST_CASE_NAMED_WITH_DATA ( +"Inbound known vector (ESP tunnel mode IPv6 AES-CBC 128 HMAC-SHA256 [16B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec_inb, + &pkt_aes_128_cbc_hmac_sha256_v6), TEST_CASE_NAMED_ST( "Combined test alg list", ut_setup_security, ut_teardown,
@@ -14495,6 +14577,22 @@ static struct unit_test_suite ipsec_proto_testsuite = { "Inner L4 checksum", ut_setup_security, ut_teardown, test_ipsec_proto_inner_l4_csum), +TEST_CASE_NAMED_ST ( +"Tunnel IPv4 in IPv4" , + ut_setup_security, ut_teardown, + test_ipsec_proto_tunnel_v4_in_v4), +TEST_CASE_NAMED_ST ( +"Tunnel IPv6 in IPv6" , + ut_setup_security, ut_teardown, + test_ipsec_proto_tunnel_v6_in_v6), +TEST_CASE_NAMED_ST ( +"Tunnel IPv4 in IPv6" , + ut_setup_security, ut_teardown, + test_ipsec_proto_tunnel_v4_in_v6), +TEST_CASE_NAMED_ST ( +"Tunnel IPv6 in IPv4" , + ut_setup_security, ut_teardown, + test_ipsec_proto_tunnel_v6_in_v4), TEST_CASES_END() /**< NULL terminate unit test array */ } };
app/test/test_cryptodev_security_ipsec.c +72 -2
110 lines not on this page · raw message
app/test/test_cryptodev_security_ipsec.h +4 -0
@@ -61,6 +61,8 @@ struct ipsec_test_flags {bool udp_ports_verify;bool ip_csum;bool l4_csum; +bool ipv6; +bool tunnel_ipv6; };struct crypto_param {
@@ -119,7 +121,9 @@ struct crypto_param_comb { };extern struct ipsec_test_data pkt_aes_256_gcm; +extern struct ipsec_test_data pkt_aes_256_gcm_v6;extern struct ipsec_test_data pkt_aes_128_cbc_hmac_sha256; +extern struct ipsec_test_data pkt_aes_128_cbc_hmac_sha256_v6; extern struct crypto_param_comb alg_list[RTE_DIM(aead_list) + (RTE_DIM(cipher_list) *
app/test/test_cryptodev_security_ipsec_test_vectors.h +202 -0
212 lines not on this page · raw message
doc/guides/rel_notes/release_22_03.rst +5 -0
@@ -60,6 +60,11 @@ New Features * Added support for chained operations. * Added AES-CBC 128 NULL auth known vector tests. * Added AES-CBC 128 HMAC-SHA256 known vector tests. + * Added tunnel mode tests + * IPv6 in IPv6 + * IPv4 in IPv4 + * IPv4 in IPv6 + * IPv6 in IPv4 Removed Items
Signature · 1 line
2.7.4
PATCH v2 5/13 test/crypto: add IPsec HMAC-SHA384/512 known vectors
In reply to Anoob JosephFrom: Tejasree Kondoj <[email protected]>
Add lookaside IPsec HMAC-SHA384/512 known vectors.
--- app/test/test_cryptodev.c | 20 ++ app/test/test_cryptodev_security_ipsec.h | 14 +- .../test_cryptodev_security_ipsec_test_vectors.h | 213 +++++++++++++++++++++ doc/guides/rel_notes/release_22_03.rst | 2 + 4 files changed, 248 insertions(+), 1 deletion(-)
app/test/test_cryptodev.c +20 -0
@@ -14495,6 +14495,16 @@ static struct unit_test_suite ipsec_proto_testsuite = { test_ipsec_proto_known_vec, &pkt_aes_128_cbc_hmac_sha256),TEST_CASE_NAMED_WITH_DATA ( +"Outbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA384 [24B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec, + &pkt_aes_128_cbc_hmac_sha384), +TEST_CASE_NAMED_WITH_DATA ( +"Outbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA512 [32B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec, + &pkt_aes_128_cbc_hmac_sha512), +TEST_CASE_NAMED_WITH_DATA ("Outbound known vector (ESP tunnel mode IPv6 AES-GCM 128)" , ut_setup_security, ut_teardown, test_ipsec_proto_known_vec, &pkt_aes_256_gcm_v6),
@@ -14525,6 +14535,16 @@ static struct unit_test_suite ipsec_proto_testsuite = { test_ipsec_proto_known_vec_inb, &pkt_aes_128_cbc_hmac_sha256),TEST_CASE_NAMED_WITH_DATA ( +"Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA384 [24B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec_inb, + &pkt_aes_128_cbc_hmac_sha384), +TEST_CASE_NAMED_WITH_DATA ( +"Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA512 [32B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec_inb, + &pkt_aes_128_cbc_hmac_sha512), +TEST_CASE_NAMED_WITH_DATA ("Inbound known vector (ESP tunnel mode IPv6 AES-GCM 128)" , ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_inb, &pkt_aes_256_gcm_v6),
app/test/test_cryptodev_security_ipsec.h +13 -1
@@ -15,7 +15,7 @@ struct ipsec_test_data {uint8_t data[32 ]; } key;struct { -uint8_t data[32 ]; +uint8_t data[64 ]; } auth_key;struct {
@@ -113,6 +113,18 @@ static const struct crypto_param auth_list[] = { .key_length = 32, .digest_length = 16, }, + { + .type = RTE_CRYPTO_SYM_XFORM_AUTH, + .alg.auth = RTE_CRYPTO_AUTH_SHA384_HMAC, + .key_length = 48, + .digest_length = 24, + }, + { + .type = RTE_CRYPTO_SYM_XFORM_AUTH, + .alg.auth = RTE_CRYPTO_AUTH_SHA512_HMAC, + .key_length = 64, + .digest_length = 32, + }, }; struct crypto_param_comb {
app/test/test_cryptodev_security_ipsec_test_vectors.h +213 -0
219 lines not on this page · raw message
doc/guides/rel_notes/release_22_03.rst +2 -0
@@ -60,6 +60,8 @@ New Features * Added support for chained operations. * Added AES-CBC 128 NULL auth known vector tests. * Added AES-CBC 128 HMAC-SHA256 known vector tests. + * Added AES-CBC 128 HMAC-SHA384 known vector tests. + * Added AES-CBC 128 HMAC-SHA512 known vector tests. * Added tunnel mode tests * IPv6 in IPv6 * IPv4 in IPv4
Signature · 1 line
2.7.4
PATCH v2 6/13 test/crypto: add IPsec fragmented packet known vectors
In reply to Anoob JosephFrom: Tejasree Kondoj <[email protected]>
Add fragmented plain packet known vector test case in IPsec outbound.
--- app/test/test_cryptodev.c | 22 +++++ app/test/test_cryptodev_security_ipsec.c | 10 ++ app/test/test_cryptodev_security_ipsec.h | 1 + .../test_cryptodev_security_ipsec_test_vectors.h | 104 +++++++++++++++++++++ doc/guides/rel_notes/release_22_03.rst | 1 + 5 files changed, 138 insertions(+)
app/test/test_cryptodev.c +22 -0
@@ -9383,6 +9383,23 @@ test_ipsec_proto_known_vec_inb(const void *test_data) }static int +test_ipsec_proto_known_vec_fragmented (const void *test_data) +{ +struct ipsec_test_data td_outb; +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + flags.fragment = true; + +memcpy (&td_outb, test_data,sizeof (td_outb)); + +/* Disable IV gen to be able to test with known vectors */ + td_outb.ipsec_xform.options.iv_gen_disable =1 ; + +return test_ipsec_proto_process (&td_outb,NULL ,1 , false, &flags); +} + +static int test_ipsec_proto_all (const struct ipsec_test_flags *flags) {struct ipsec_test_data td_outb[IPSEC_TEST_PACKETS_MAX ];
@@ -14514,6 +14531,11 @@ static struct unit_test_suite ipsec_proto_testsuite = { test_ipsec_proto_known_vec, &pkt_aes_128_cbc_hmac_sha256_v6),TEST_CASE_NAMED_WITH_DATA ( +"Outbound fragmented packet" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec_fragmented, + &pkt_aes_128_gcm_frag), +TEST_CASE_NAMED_WITH_DATA ("Inbound known vector (ESP tunnel mode IPv4 AES-GCM 128)" , ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_inb, &pkt_aes_128_gcm),
app/test/test_cryptodev_security_ipsec.c +10 -0
@@ -659,6 +659,16 @@ test_ipsec_td_verify(struct rte_mbuf *m, const struct ipsec_test_data *td,return TEST_FAILED ; } +if ((td->ipsec_xform.direction ==RTE_SECURITY_IPSEC_SA_DIR_EGRESS ) && + flags->fragment) { +const struct rte_ipv4_hdr *iph4; + iph4 = (const struct rte_ipv4_hdr *)output_text; +if (iph4->fragment_offset) { +printf ("Output packet is fragmented" ); +return TEST_FAILED ; + } + } + skip =test_ipsec_tunnel_hdr_len_get (td); len -= skip;
app/test/test_cryptodev_security_ipsec.h +1 -0
@@ -63,6 +63,7 @@ struct ipsec_test_flags {bool l4_csum;bool ipv6;bool tunnel_ipv6; +bool fragment; };struct crypto_param {
app/test/test_cryptodev_security_ipsec_test_vectors.h +104 -0
108 lines not on this page · raw message
doc/guides/rel_notes/release_22_03.rst +1 -0
@@ -67,6 +67,7 @@ New Features * IPv4 in IPv4 * IPv4 in IPv6 * IPv6 in IPv4 + * Added tunnel mode fragment packet tests. Removed Items
Signature · 1 line
2.7.4
PATCH v2 7/13 test/crypto: add transport mode cases
In reply to Anoob JosephAdd transport mode tests with test cases for IPv4 packets.
--- app/test/test_cryptodev.c | 39 ++++++++++++++---- app/test/test_cryptodev_security_ipsec.c | 71 +++++++++++++++++++++----------- app/test/test_cryptodev_security_ipsec.h | 1 + doc/guides/rel_notes/release_22_03.rst | 1 + 4 files changed, 80 insertions(+), 32 deletions(-)
app/test/test_cryptodev.c +30 -9
@@ -9162,15 +9162,19 @@ test_ipsec_proto_process(const struct ipsec_test_data td[], dst +=1 ; } -if (td->ipsec_xform.tunnel.type == -RTE_SECURITY_IPSEC_TUNNEL_IPV4 ) { -memcpy (&ipsec_xform.tunnel.ipv4.src_ip, &src,sizeof (src)); -memcpy (&ipsec_xform.tunnel.ipv4.dst_ip, &dst,sizeof (dst)); - }else { -memcpy (&ipsec_xform.tunnel.ipv6.src_addr, &v6_src, -sizeof (v6_src)); -memcpy (&ipsec_xform.tunnel.ipv6.dst_addr, &v6_dst, -sizeof (v6_dst)); +if (td->ipsec_xform.mode ==RTE_SECURITY_IPSEC_SA_MODE_TUNNEL ) { +if (td->ipsec_xform.tunnel.type == +RTE_SECURITY_IPSEC_TUNNEL_IPV4 ) { +memcpy (&ipsec_xform.tunnel.ipv4.src_ip, &src, +sizeof (src)); +memcpy (&ipsec_xform.tunnel.ipv4.dst_ip, &dst, +sizeof (dst)); + }else { +memcpy (&ipsec_xform.tunnel.ipv6.src_addr, &v6_src, +sizeof (v6_src)); +memcpy (&ipsec_xform.tunnel.ipv6.dst_addr, &v6_dst, +sizeof (v6_dst)); + } } ctx =rte_cryptodev_get_sec_ctx (dev_id);
@@ -9636,6 +9640,19 @@ test_ipsec_proto_tunnel_v6_in_v4(const void *data __rte_unused) }static int +test_ipsec_proto_transport_v4(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.ipv6 = false; + flags.transport = true; + +return test_ipsec_proto_all (&flags); +} + +static int test_PDCP_PROTO_all (void ) {struct crypto_testsuite_params *ts_params = &testsuite_params;
@@ -14635,6 +14652,10 @@ static struct unit_test_suite ipsec_proto_testsuite = { "Tunnel IPv6 in IPv4", ut_setup_security, ut_teardown, test_ipsec_proto_tunnel_v6_in_v4), + TEST_CASE_NAMED_ST( + "Transport IPv4", + ut_setup_security, ut_teardown, + test_ipsec_proto_transport_v4), TEST_CASES_END() /**< NULL terminate unit test array */ } };
app/test/test_cryptodev_security_ipsec.c +48 -23
89 lines not on this page · raw message
app/test/test_cryptodev_security_ipsec.h +1 -0
@@ -63,6 +63,7 @@ struct ipsec_test_flags {bool l4_csum;bool ipv6;bool tunnel_ipv6; +bool transport;bool fragment; };
doc/guides/rel_notes/release_22_03.rst +1 -0
@@ -67,6 +67,7 @@ New Features * IPv4 in IPv4 * IPv4 in IPv6 * IPv6 in IPv4 + * Added IPv4 transport mode tests. * Added tunnel mode fragment packet tests.
Signature · 1 line
2.7.4
PATCH v2 8/13 test/crypto: add security stats cases
In reply to Anoob JosephFrom: Ankur Dwivedi <[email protected]>
Adds security stats test cases in IPSEC protocol testsuite.
--- app/test/test_cryptodev.c | 21 +++++++++++++++++++++ app/test/test_cryptodev_security_ipsec.c | 29 +++++++++++++++++++++++++++++ app/test/test_cryptodev_security_ipsec.h | 6 ++++++ doc/guides/rel_notes/release_22_03.rst | 1 + 4 files changed, 57 insertions(+)
app/test/test_cryptodev.c +21 -0
@@ -9332,6 +9332,11 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],if (ret !=TEST_SUCCESS ) goto crypto_op_free; + ret =test_ipsec_stats_verify (ctx, ut_params->sec_session, + flags, dir); +if (ret !=TEST_SUCCESS ) + goto crypto_op_free; +rte_crypto_op_free (ut_params->op); ut_params->op =NULL ;
@@ -9653,6 +9658,18 @@ test_ipsec_proto_transport_v4(const void *data __rte_unused) }static int +test_ipsec_proto_stats(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.stats_success = true; + +return test_ipsec_proto_all (&flags); +} + +static int test_PDCP_PROTO_all (void ) {struct crypto_testsuite_params *ts_params = &testsuite_params;
@@ -14656,6 +14673,10 @@ static struct unit_test_suite ipsec_proto_testsuite = { "Transport IPv4", ut_setup_security, ut_teardown, test_ipsec_proto_transport_v4), + TEST_CASE_NAMED_ST( + "Statistics: success", + ut_setup_security, ut_teardown, + test_ipsec_proto_stats), TEST_CASES_END() /**< NULL terminate unit test array */ } };
app/test/test_cryptodev_security_ipsec.c +29 -0
@@ -415,6 +415,8 @@ test_ipsec_td_prepare(const struct crypto_param *param1,RTE_SECURITY_IPSEC_TUNNEL_IPV4 ; } +if (flags->stats_success) + td->ipsec_xform.options.stats =1 ; } }
@@ -871,3 +873,30 @@ test_ipsec_status_check(struct rte_crypto_op *op,return ret; } + +int +test_ipsec_stats_verify (struct rte_security_ctx *ctx, +struct rte_security_session *sess, +const struct ipsec_test_flags *flags, +enum rte_security_ipsec_sa_direction dir) +{ +struct rte_security_stats stats = {0 }; +int ret =TEST_SUCCESS ; + +if (flags->stats_success) { +if (rte_security_session_stats_get (ctx, sess, &stats) <0 ) +return TEST_FAILED ; + +if (dir ==RTE_SECURITY_IPSEC_SA_DIR_EGRESS ) { +if (stats.ipsec.opackets !=1 || + stats.ipsec.oerrors !=0 ) + ret =TEST_FAILED ; + }else { +if (stats.ipsec.ipackets !=1 || + stats.ipsec.ierrors !=0 ) + ret =TEST_FAILED ; + } + } + +return ret; +}
app/test/test_cryptodev_security_ipsec.h +6 -0
@@ -65,6 +65,7 @@ struct ipsec_test_flags {bool tunnel_ipv6;bool transport;bool fragment; +bool stats_success; };struct crypto_param {
@@ -188,4 +189,9 @@ int test_ipsec_status_check(struct rte_crypto_op *op,enum rte_security_ipsec_sa_direction dir, int pkt_num); +int test_ipsec_stats_verify (struct rte_security_ctx *ctx, +struct rte_security_session *sess, +const struct ipsec_test_flags *flags, +enum rte_security_ipsec_sa_direction dir); +#endif
doc/guides/rel_notes/release_22_03.rst +1 -0
@@ -69,6 +69,7 @@ New Features * IPv6 in IPv4 * Added IPv4 transport mode tests. * Added tunnel mode fragment packet tests. + * Added security stats tests. Removed Items
Signature · 1 line
2.7.4
PATCH v2 9/13 test/crypto: add lookaside IPsec AES-CTR known vectors
In reply to Anoob JosephFrom: Tejasree Kondoj <[email protected]>
Add known vectors for AES-CTR in lookaside IPsec mode.
--- app/test/test_cryptodev_security_ipsec.h | 15 +++++++++++++++ doc/guides/rel_notes/release_22_03.rst | 1 + 2 files changed, 16 insertions(+)
app/test/test_cryptodev_security_ipsec.h +15 -0
@@ -103,6 +103,21 @@ static const struct crypto_param cipher_list[] = { .alg.cipher = RTE_CRYPTO_CIPHER_AES_CBC, .key_length = 16, }, + { + .type = RTE_CRYPTO_SYM_XFORM_CIPHER, + .alg.cipher = RTE_CRYPTO_CIPHER_AES_CTR, + .key_length = 16, + }, + { + .type = RTE_CRYPTO_SYM_XFORM_CIPHER, + .alg.cipher = RTE_CRYPTO_CIPHER_AES_CTR, + .key_length = 24, + }, + { + .type = RTE_CRYPTO_SYM_XFORM_CIPHER, + .alg.cipher = RTE_CRYPTO_CIPHER_AES_CTR, + .key_length = 32, + }, }; static const struct crypto_param auth_list[] = {
doc/guides/rel_notes/release_22_03.rst +1 -0
@@ -70,6 +70,7 @@ New Features * Added IPv4 transport mode tests. * Added tunnel mode fragment packet tests. * Added security stats tests. + * Added AES-CTR tests. Removed Items
Signature · 1 line
2.7.4
PATCH v2 10/13 test/crypto: add fragmented packet case
In reply to Anoob JosephFrom: Tejasree Kondoj <[email protected]>
Add fragmented plain packet test case in combined mode.
--- app/test/test_cryptodev.c | 16 ++++++++++++++++ app/test/test_cryptodev_security_ipsec.c | 7 +++++++ 2 files changed, 23 insertions(+)
app/test/test_cryptodev.c +16 -0
@@ -9670,6 +9670,18 @@ test_ipsec_proto_stats(const void *data __rte_unused) }static int +test_ipsec_proto_pkt_fragment(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.fragment = true; + +return test_ipsec_proto_all (&flags); +} + +static int test_PDCP_PROTO_all (void ) {struct crypto_testsuite_params *ts_params = &testsuite_params;
@@ -14677,6 +14689,10 @@ static struct unit_test_suite ipsec_proto_testsuite = { "Statistics: success", ut_setup_security, ut_teardown, test_ipsec_proto_stats), + TEST_CASE_NAMED_ST( + "Fragmented packet", + ut_setup_security, ut_teardown, + test_ipsec_proto_pkt_fragment), TEST_CASES_END() /**< NULL terminate unit test array */ } };
app/test/test_cryptodev_security_ipsec.c +7 -0
@@ -418,6 +418,13 @@ test_ipsec_td_prepare(const struct crypto_param *param1,if (flags->stats_success) td->ipsec_xform.options.stats =1 ; +if (flags->fragment) { +struct rte_ipv4_hdr *ip; + ip = (struct rte_ipv4_hdr *)&td->input_text.data; + ip->fragment_offset =4 ; + ip->hdr_checksum =rte_ipv4_cksum (ip); + } + } }
Signature · 1 line
2.7.4
PATCH v2 11/13 test/crypto: skip null auth in ICV corrupt case
In reply to Anoob JosephFrom: Tejasree Kondoj <[email protected]>
Skipping NULL auth in ICV corruption test case.
--- app/test/test_cryptodev.c | 5 +++++ 1 file changed, 5 insertions(+)
app/test/test_cryptodev.c +5 -0
@@ -9428,6 +9428,11 @@ test_ipsec_proto_all(const struct ipsec_test_flags *flags) td_outb, nb_pkts); +if (flags->icv_corrupt && (td_outb->aead == false) && + (td_outb->xform.chain.auth.auth.algo == +RTE_CRYPTO_AUTH_NULL )) +continue ; + ret =test_ipsec_proto_process (td_outb, td_inb, nb_pkts, true, flags);if (ret ==TEST_SKIPPED )
Signature · 1 line
2.7.4
PATCH v2 12/13 test/crypto: add aes xcbc known vectors
In reply to Anoob JosephAdd known vector test cases for NULL cipher + AES-XCBC. Also add both algos to the combined mode list of algos.
--- app/test/test_cryptodev.c | 38 +++++++-- app/test/test_cryptodev_security_ipsec.c | 2 + app/test/test_cryptodev_security_ipsec.h | 17 ++++ .../test_cryptodev_security_ipsec_test_vectors.h | 90 ++++++++++++++++++++++ doc/guides/rel_notes/release_22_03.rst | 1 + 5 files changed, 142 insertions(+), 6 deletions(-)
app/test/test_cryptodev.c +32 -6
@@ -9368,8 +9368,11 @@ test_ipsec_proto_known_vec(const void *test_data)memcpy (&td_outb, test_data,sizeof (td_outb)); -/* Disable IV gen to be able to test with known vectors */ - td_outb.ipsec_xform.options.iv_gen_disable =1 ; +if (td_outb.aead || + td_outb.xform.chain.cipher.cipher.algo !=RTE_CRYPTO_CIPHER_NULL ) { +/* Disable IV gen to be able to test with known vectors */ + td_outb.ipsec_xform.options.iv_gen_disable =1 ; + }return test_ipsec_proto_process (&td_outb,NULL ,1 , false, &flags); }
@@ -9428,10 +9431,23 @@ test_ipsec_proto_all(const struct ipsec_test_flags *flags) td_outb, nb_pkts); -if (flags->icv_corrupt && (td_outb->aead == false) && - (td_outb->xform.chain.auth.auth.algo == -RTE_CRYPTO_AUTH_NULL )) -continue ; +if (!td_outb->aead) { +enum rte_crypto_cipher_algorithm cipher_alg; +enum rte_crypto_auth_algorithm auth_alg; + + cipher_alg = td_outb->xform.chain.cipher.cipher.algo; + auth_alg = td_outb->xform.chain.auth.auth.algo; + +/* ICV is not applicable for NULL auth */ +if (flags->icv_corrupt && + auth_alg ==RTE_CRYPTO_AUTH_NULL ) +continue ; + +/* IV is not applicable for NULL cipher */ +if (flags->iv_gen && + cipher_alg ==RTE_CRYPTO_CIPHER_NULL ) +continue ; + } ret =test_ipsec_proto_process (td_outb, td_inb, nb_pkts, true, flags);
@@ -14582,6 +14598,11 @@ static struct unit_test_suite ipsec_proto_testsuite = { test_ipsec_proto_known_vec, &pkt_aes_128_cbc_hmac_sha256_v6),TEST_CASE_NAMED_WITH_DATA ( +"Outbound known vector (ESP tunnel mode IPv4 NULL AES-XCBC-MAC [12B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec, + &pkt_null_aes_xcbc), + TEST_CASE_NAMED_WITH_DATA( "Outbound fragmented packet", ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_fragmented,
@@ -14626,6 +14647,11 @@ static struct unit_test_suite ipsec_proto_testsuite = { ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_inb, &pkt_aes_128_cbc_hmac_sha256_v6), +TEST_CASE_NAMED_WITH_DATA ( +"Inbound known vector (ESP tunnel mode IPv4 NULL AES-XCBC-MAC [12B ICV])" , + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec_inb, + &pkt_null_aes_xcbc), TEST_CASE_NAMED_ST( "Combined test alg list", ut_setup_security, ut_teardown,
app/test/test_cryptodev_security_ipsec.c +2 -0
@@ -375,6 +375,8 @@ test_ipsec_td_prepare(const struct crypto_param *param1, td->xform.chain.cipher.cipher.algo = param1->alg.cipher; td->xform.chain.cipher.cipher.key.length = param1->key_length; + td->xform.chain.cipher.cipher.iv.length = + param1->iv_length; td->xform.chain.auth.auth.algo = param2->alg.auth; td->xform.chain.auth.auth.key.length = param2->key_length;
app/test/test_cryptodev_security_ipsec.h +17 -0
@@ -76,6 +76,7 @@ struct crypto_param {enum rte_crypto_aead_algorithm aead; } alg;uint16_t key_length; +uint16_t iv_length;uint16_t digest_length; };
@@ -100,23 +101,33 @@ static const struct crypto_param aead_list[] = {static const struct crypto_param cipher_list[] = { { .type =RTE_CRYPTO_SYM_XFORM_CIPHER , + .alg.cipher =RTE_CRYPTO_CIPHER_NULL , + .key_length =0 , + .iv_length =0 , + }, + { + .type =RTE_CRYPTO_SYM_XFORM_CIPHER , .alg.cipher =RTE_CRYPTO_CIPHER_AES_CBC , .key_length =16 , + .iv_length =16 , }, { .type =RTE_CRYPTO_SYM_XFORM_CIPHER , .alg.cipher =RTE_CRYPTO_CIPHER_AES_CTR , .key_length =16 , + .iv_length =16 , }, { .type =RTE_CRYPTO_SYM_XFORM_CIPHER , .alg.cipher =RTE_CRYPTO_CIPHER_AES_CTR , .key_length =24 , + .iv_length =16 , }, { .type =RTE_CRYPTO_SYM_XFORM_CIPHER , .alg.cipher =RTE_CRYPTO_CIPHER_AES_CTR , .key_length =32 , + .iv_length =16 , }, };
@@ -143,6 +154,12 @@ static const struct crypto_param auth_list[] = { .key_length = 64, .digest_length = 32, }, + { + .type = RTE_CRYPTO_SYM_XFORM_AUTH, + .alg.auth = RTE_CRYPTO_AUTH_AES_XCBC_MAC, + .key_length = 16, + .digest_length = 12, + }, };struct crypto_param_comb {
app/test/test_cryptodev_security_ipsec_test_vectors.h +90 -0
94 lines not on this page · raw message
doc/guides/rel_notes/release_22_03.rst +1 -0
@@ -62,6 +62,7 @@ New Features * Added AES-CBC 128 HMAC-SHA256 known vector tests. * Added AES-CBC 128 HMAC-SHA384 known vector tests. * Added AES-CBC 128 HMAC-SHA512 known vector tests. + * Added NULL cipher AES-XCBC known vector tests. * Added tunnel mode tests * IPv6 in IPv6 * IPv4 in IPv4
Signature · 1 line
2.7.4
PATCH v2 13/13 test/crypto: add copy and set DF cases
In reply to Anoob JosephAdd test cases to verify copy DF and set DF options with lookaside IPsec offload.
--- app/test/test_cryptodev.c | 75 ++++++++++++++++++++++++++++++++ app/test/test_cryptodev_security_ipsec.c | 71 ++++++++++++++++++++++++++++-- app/test/test_cryptodev_security_ipsec.h | 10 +++++ doc/guides/rel_notes/release_22_03.rst | 1 + 4 files changed, 154 insertions(+), 3 deletions(-)
app/test/test_cryptodev.c +75 -0
@@ -9169,6 +9169,13 @@ test_ipsec_proto_process(const struct ipsec_test_data td[], sizeof(src));memcpy (&ipsec_xform.tunnel.ipv4.dst_ip, &dst,sizeof (dst)); + +if (flags->df ==TEST_IPSEC_SET_DF_0_INNER_1 ) + ipsec_xform.tunnel.ipv4.df =0 ; + +if (flags->df ==TEST_IPSEC_SET_DF_1_INNER_0 ) + ipsec_xform.tunnel.ipv4.df =1 ; + }else {memcpy (&ipsec_xform.tunnel.ipv6.src_addr, &v6_src,sizeof (v6_src));
@@ -9282,6 +9289,9 @@ test_ipsec_proto_process(const struct ipsec_test_data td[],memcpy (input_text, td[i].input_text.data, td[i].input_text.len); +if (test_ipsec_pkt_update (input_text, flags)) +return TEST_FAILED ; +/* Generate crypto op data structure */ ut_params->op =rte_crypto_op_alloc (ts_params->op_mpool,RTE_CRYPTO_OP_TYPE_SYMMETRIC );
@@ -9700,6 +9710,55 @@ test_ipsec_proto_pkt_fragment(const void *data __rte_unused) flags.fragment = true;return test_ipsec_proto_all (&flags); + +} + +static int +test_ipsec_proto_copy_df_inner_0(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.df =TEST_IPSEC_COPY_DF_INNER_0 ; + +return test_ipsec_proto_all (&flags); +} + +static int +test_ipsec_proto_copy_df_inner_1(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.df =TEST_IPSEC_COPY_DF_INNER_1 ; + +return test_ipsec_proto_all (&flags); +} + +static int +test_ipsec_proto_set_df_0_inner_1(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.df =TEST_IPSEC_SET_DF_0_INNER_1 ; + +return test_ipsec_proto_all (&flags); +} + +static int +test_ipsec_proto_set_df_1_inner_0(const void *data __rte_unused) +{ +struct ipsec_test_flags flags; + +memset (&flags,0 ,sizeof (flags)); + + flags.df =TEST_IPSEC_SET_DF_1_INNER_0 ; + +return test_ipsec_proto_all (&flags); } static int
@@ -14724,6 +14783,22 @@ static struct unit_test_suite ipsec_proto_testsuite = { "Fragmented packet", ut_setup_security, ut_teardown, test_ipsec_proto_pkt_fragment), +TEST_CASE_NAMED_ST ( +"Tunnel header copy DF (inner 0)" , + ut_setup_security, ut_teardown, + test_ipsec_proto_copy_df_inner_0), +TEST_CASE_NAMED_ST ( +"Tunnel header copy DF (inner 1)" , + ut_setup_security, ut_teardown, + test_ipsec_proto_copy_df_inner_1), +TEST_CASE_NAMED_ST ( +"Tunnel header set DF 0 (inner 1)" , + ut_setup_security, ut_teardown, + test_ipsec_proto_set_df_0_inner_1), +TEST_CASE_NAMED_ST ( +"Tunnel header set DF 1 (inner 0)" , + ut_setup_security, ut_teardown, + test_ipsec_proto_set_df_1_inner_0), TEST_CASES_END() /**< NULL terminate unit test array */ } };
app/test/test_cryptodev_security_ipsec.c +68 -3
109 lines not on this page · raw message
app/test/test_cryptodev_security_ipsec.h +10 -0
@@ -50,6 +50,13 @@ struct ipsec_test_data { } xform; }; +enum df_flags { +TEST_IPSEC_COPY_DF_INNER_0 =1 , +TEST_IPSEC_COPY_DF_INNER_1 , +TEST_IPSEC_SET_DF_0_INNER_1 , +TEST_IPSEC_SET_DF_1_INNER_0 , +}; +struct ipsec_test_flags {bool display_alg;bool sa_expiry_pkts_soft;
@@ -66,6 +73,7 @@ struct ipsec_test_flags {bool transport;bool fragment;bool stats_success; +enum df_flags df; };struct crypto_param {
@@ -226,4 +234,6 @@ int test_ipsec_stats_verify(struct rte_security_ctx *ctx,const struct ipsec_test_flags *flags, enum rte_security_ipsec_sa_direction dir); +int test_ipsec_pkt_update (uint8_t *pkt,const struct ipsec_test_flags *flags); +#endif
doc/guides/rel_notes/release_22_03.rst +1 -0
@@ -72,6 +72,7 @@ New Features * Added tunnel mode fragment packet tests. * Added security stats tests. * Added AES-CTR tests. + * Added set/copy DF tests. Removed Items
Signature · 1 line
2.7.4
Akhil Goyal
AppliedQuoted 42 lines
Add new tests to lookaside IPsec tests.
* Support for chained operations.
* AES-CBC 128 NULL auth known vector tests.
* AES-CBC 128 HMAC-SHA256 known vector tests.
* AES-CBC 128 HMAC-SHA384 known vector tests.
* AES-CBC 128 HMAC-SHA512 known vector tests.
* NULL cipher AES-XCBC known vector tests.
* Tunnel mode tests
* IPv6 in IPv6
* IPv4 in IPv4
* IPv4 in IPv6
* IPv6 in IPv4
* IPv4 transport mode tests.
* Tunnel mode fragment packet tests.
* Security stats tests.
* AES-CTR tests.
* set/copy DF tests.Changes in v2:
- Moved release notes update to originating patch
- Fixed build failure with last patchAnkur Dwivedi (1):
test/crypto: add security stats casesAnoob Joseph (5):
test/crypto: add IPsec aes-cbc known vectors test/crypto: add chained operations in combined cases test/crypto: add transport mode cases test/crypto: add aes xcbc known vectors test/crypto: add copy and set DF casesTejasree Kondoj (7):
test/crypto: add IPsec AES-CBC-HMAC-SHA256 known vectors test/crypto: add IPv6 tunnel mode cases test/crypto: add IPsec HMAC-SHA384/512 known vectors test/crypto: add IPsec fragmented packet known vectors test/crypto: add lookaside IPsec AES-CTR known vectors test/crypto: add fragmented packet case test/crypto: skip null auth in ICV corrupt case
Quoted 8 lines
app/test/test_cryptodev.c | 395 +++++++++- app/test/test_cryptodev_security_ipsec.c | 352 ++++++++- app/test/test_cryptodev_security_ipsec.h | 113 +++ .../test_cryptodev_security_ipsec_test_vectors.h | 828 +++++++++++++++++++++ doc/guides/rel_notes/release_22_03.rst | 19 + 5 files changed, 1665 insertions(+), 42 deletions(-)
Series Acked-by: Akhil Goyal <[email protected]>
Applied to dpdk-next-crypto