test/crypto: add PDCP U-Plane encap with integrity cases
PDCP User/Data plane can optionally support integrity along with confidentiality. This patch add test cases and test vectors for all supported algos combos for cipher+integrity for 12 and 18bit SN. The test cases are added in DPAA_SEC and DPAA2_SEC test suite as a reference. Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com> Signed-off-by: Vakul Garg <vakul.garg@nxp.com> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com> Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
This commit is contained in:
parent
0fce8f6a6c
commit
cca7d1f785
@ -7228,6 +7228,18 @@ test_pdcp_proto_uplane_encap(int i)
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
test_pdcp_proto_uplane_encap_with_int(int i)
|
||||
{
|
||||
return test_pdcp_proto(i, 0,
|
||||
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
|
||||
RTE_CRYPTO_AUTH_OP_GENERATE,
|
||||
pdcp_test_data_in[i],
|
||||
pdcp_test_data_in_len[i],
|
||||
pdcp_test_data_out[i],
|
||||
pdcp_test_data_in_len[i] + 4);
|
||||
}
|
||||
|
||||
int
|
||||
test_pdcp_proto_cplane_decap(int i)
|
||||
{
|
||||
|
@ -99,6 +99,31 @@ static int uplane_encap_no_integrity(uint32_t sn_size, uint8_t dir,
|
||||
return test_pdcp_proto_uplane_encap(i);
|
||||
}
|
||||
|
||||
static int
|
||||
uplane_encap_with_integrity(uint32_t sn_size, uint8_t dir,
|
||||
enum enc_alg_off enc_alg_off,
|
||||
enum auth_alg_off auth_alg_off)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
switch (sn_size) {
|
||||
case 12:
|
||||
i = PDCP_UPLANE_12BIT_OFFSET + enc_alg_off +
|
||||
auth_alg_off + ((dir == 0) ?
|
||||
UPLINK : DOWNLINK);
|
||||
break;
|
||||
case 18:
|
||||
i = PDCP_UPLANE_18BIT_OFFSET + enc_alg_off +
|
||||
auth_alg_off + ((dir == 0) ?
|
||||
UPLINK : DOWNLINK);
|
||||
break;
|
||||
default:
|
||||
printf("\nInvalid SN: %u\n", sn_size);
|
||||
}
|
||||
|
||||
return test_pdcp_proto_uplane_encap_with_int(i);
|
||||
}
|
||||
|
||||
#define TEST_PDCP_COUNT(func) do { \
|
||||
if (func == TEST_SUCCESS) { \
|
||||
printf("\t%d)", n++); \
|
||||
@ -311,6 +336,80 @@ test_PDCP_PROTO_uplane_encap_all(void)
|
||||
TEST_PDCP_COUNT(uplane_encap_no_integrity(18, UPLINK, ZUC_ENC));
|
||||
TEST_PDCP_COUNT(uplane_encap_no_integrity(18, DOWNLINK, ZUC_ENC));
|
||||
|
||||
/* For 12-bit SN with integrity */
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, UPLINK, NULL_ENC, NULL_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, DOWNLINK, NULL_ENC, NULL_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, UPLINK, NULL_ENC, SNOW_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, DOWNLINK, NULL_ENC, SNOW_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, UPLINK, NULL_ENC, AES_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, DOWNLINK, NULL_ENC, AES_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, UPLINK, NULL_ENC, ZUC_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, DOWNLINK, NULL_ENC, ZUC_AUTH));
|
||||
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, UPLINK, SNOW_ENC, NULL_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, DOWNLINK, SNOW_ENC, NULL_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, UPLINK, SNOW_ENC, SNOW_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, DOWNLINK, SNOW_ENC, SNOW_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, UPLINK, SNOW_ENC, AES_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, DOWNLINK, SNOW_ENC, AES_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, UPLINK, SNOW_ENC, ZUC_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, DOWNLINK, SNOW_ENC, ZUC_AUTH));
|
||||
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, UPLINK, AES_ENC, NULL_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, DOWNLINK, AES_ENC, NULL_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, UPLINK, AES_ENC, SNOW_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, DOWNLINK, AES_ENC, SNOW_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, UPLINK, AES_ENC, AES_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, DOWNLINK, AES_ENC, AES_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, UPLINK, AES_ENC, ZUC_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, DOWNLINK, AES_ENC, ZUC_AUTH));
|
||||
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, UPLINK, ZUC_ENC, NULL_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, DOWNLINK, ZUC_ENC, NULL_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, UPLINK, ZUC_ENC, SNOW_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, DOWNLINK, ZUC_ENC, SNOW_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, UPLINK, ZUC_ENC, AES_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, DOWNLINK, ZUC_ENC, AES_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, UPLINK, ZUC_ENC, ZUC_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(12, DOWNLINK, ZUC_ENC, ZUC_AUTH));
|
||||
|
||||
/* For 18-bit SN with integrity */
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, UPLINK, NULL_ENC, NULL_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, DOWNLINK, NULL_ENC, NULL_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, UPLINK, NULL_ENC, SNOW_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, DOWNLINK, NULL_ENC, SNOW_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, UPLINK, NULL_ENC, AES_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, DOWNLINK, NULL_ENC, AES_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, UPLINK, NULL_ENC, ZUC_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, DOWNLINK, NULL_ENC, ZUC_AUTH));
|
||||
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, UPLINK, SNOW_ENC, NULL_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, DOWNLINK, SNOW_ENC, NULL_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, UPLINK, SNOW_ENC, SNOW_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, DOWNLINK, SNOW_ENC, SNOW_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, UPLINK, SNOW_ENC, AES_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, DOWNLINK, SNOW_ENC, AES_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, UPLINK, SNOW_ENC, ZUC_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, DOWNLINK, SNOW_ENC, ZUC_AUTH));
|
||||
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, UPLINK, AES_ENC, NULL_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, DOWNLINK, AES_ENC, NULL_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, UPLINK, AES_ENC, SNOW_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, DOWNLINK, AES_ENC, SNOW_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, UPLINK, AES_ENC, AES_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, DOWNLINK, AES_ENC, AES_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, UPLINK, AES_ENC, ZUC_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, DOWNLINK, AES_ENC, ZUC_AUTH));
|
||||
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, UPLINK, ZUC_ENC, NULL_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, DOWNLINK, ZUC_ENC, NULL_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, UPLINK, ZUC_ENC, SNOW_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, DOWNLINK, ZUC_ENC, SNOW_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, UPLINK, ZUC_ENC, AES_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, DOWNLINK, ZUC_ENC, AES_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, UPLINK, ZUC_ENC, ZUC_AUTH));
|
||||
TEST_PDCP_COUNT(uplane_encap_with_integrity(18, DOWNLINK, ZUC_ENC, ZUC_AUTH));
|
||||
|
||||
if (n - i)
|
||||
printf("## %s: %d passed out of %d\n", __func__, i, n);
|
||||
|
||||
|
@ -35,6 +35,7 @@ enum auth_alg_off {
|
||||
|
||||
int test_pdcp_proto_cplane_encap(int i);
|
||||
int test_pdcp_proto_uplane_encap(int i);
|
||||
int test_pdcp_proto_uplane_encap_with_int(int i);
|
||||
int test_pdcp_proto_cplane_decap(int i);
|
||||
|
||||
int test_PDCP_PROTO_cplane_encap_all(void);
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user