* [PATCH 0/4] support stream cipher chained operations @ 2022-06-17 7:36 Tejasree Kondoj 2022-06-17 7:36 ` [PATCH 1/4] crypto/cnxk: fix CMAC IV Tejasree Kondoj ` (3 more replies) 0 siblings, 4 replies; 13+ messages in thread From: Tejasree Kondoj @ 2022-06-17 7:36 UTC (permalink / raw) To: Akhil Goyal, Fan Zhang; +Cc: Anoob Joseph, Ankur Dwivedi, dev This series adds support for zuc, snow3g and aes-ctr-cmac chained operations in cn9k PMD and autotest application. Tejasree Kondoj (4): crypto/cnxk: fix CMAC IV crypto/cnxk: support stream cipher chained operations crypto/cnxk: support scatter gather mode app/test: add additional stream cipher tests app/test/test_cryptodev.c | 432 ++++++++++++++++++ app/test/test_cryptodev_mixed_test_vectors.h | 194 ++++++++ app/test/test_cryptodev_snow3g_test_vectors.h | 137 ++++++ app/test/test_cryptodev_zuc_test_vectors.h | 77 ++++ drivers/common/cnxk/roc_se.c | 271 ++++++++--- drivers/common/cnxk/roc_se.h | 74 ++- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 69 ++- drivers/crypto/cnxk/cnxk_se.h | 344 ++++++++++++-- 8 files changed, 1484 insertions(+), 114 deletions(-) -- 2.25.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/4] crypto/cnxk: fix CMAC IV 2022-06-17 7:36 [PATCH 0/4] support stream cipher chained operations Tejasree Kondoj @ 2022-06-17 7:36 ` Tejasree Kondoj 2022-06-17 7:36 ` [PATCH 2/4] crypto/cnxk: support stream cipher chained operations Tejasree Kondoj ` (2 subsequent siblings) 3 siblings, 0 replies; 13+ messages in thread From: Tejasree Kondoj @ 2022-06-17 7:36 UTC (permalink / raw) To: Akhil Goyal; +Cc: Anoob Joseph, Ankur Dwivedi, dev Fixing CMAC IV length to 16 bytes. Fixes: 759b5e653580 ("crypto/cnxk: support AES-CMAC") Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com> --- drivers/crypto/cnxk/cnxk_se.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index 8ed3a8b2ef..cca44f1d3e 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -82,7 +82,7 @@ pdcp_iv_copy(uint8_t *iv_d, uint8_t *iv_s, const uint8_t pdcp_alg_type, memcpy(iv_d, iv_s, 16); } else { /* AES-CMAC EIA2, microcode expects 16B zeroized IV */ - for (j = 0; j < 4; j++) + for (j = 0; j < 16; j++) iv_d[j] = 0; } } -- 2.25.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/4] crypto/cnxk: support stream cipher chained operations 2022-06-17 7:36 [PATCH 0/4] support stream cipher chained operations Tejasree Kondoj 2022-06-17 7:36 ` [PATCH 1/4] crypto/cnxk: fix CMAC IV Tejasree Kondoj @ 2022-06-17 7:36 ` Tejasree Kondoj 2022-06-17 7:36 ` [PATCH 3/4] crypto/cnxk: support scatter gather mode Tejasree Kondoj 2022-06-17 7:36 ` [PATCH 4/4] app/test: add additional stream cipher tests Tejasree Kondoj 3 siblings, 0 replies; 13+ messages in thread From: Tejasree Kondoj @ 2022-06-17 7:36 UTC (permalink / raw) To: Akhil Goyal; +Cc: Anoob Joseph, Ankur Dwivedi, dev Adding support for zuc, snow3g and aes-ctr-cmac chained operations on cn9k using key and IV scheme in microcode. Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com> --- drivers/common/cnxk/roc_se.c | 271 +++++++++++++++++------ drivers/common/cnxk/roc_se.h | 74 +++++-- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 69 +++++- drivers/crypto/cnxk/cnxk_se.h | 235 +++++++++++++++++--- 4 files changed, 536 insertions(+), 113 deletions(-) diff --git a/drivers/common/cnxk/roc_se.c b/drivers/common/cnxk/roc_se.c index 3f0821e400..8d6446c3a0 100644 --- a/drivers/common/cnxk/roc_se.c +++ b/drivers/common/cnxk/roc_se.c @@ -88,21 +88,24 @@ cpt_ciph_type_set(roc_se_cipher_type type, struct roc_se_ctx *ctx, fc_type = ROC_SE_FC_GEN; break; case ROC_SE_ZUC_EEA3: - /* No support for chained operations */ - if (unlikely(ctx->hash_type)) - return -1; - fc_type = ROC_SE_PDCP; + if (ctx->hash_type) + fc_type = ROC_SE_PDCP_CHAIN; + else + fc_type = ROC_SE_PDCP; break; case ROC_SE_SNOW3G_UEA2: if (unlikely(key_len != 16)) return -1; - /* No support for AEAD yet */ - if (unlikely(ctx->hash_type)) - return -1; - fc_type = ROC_SE_PDCP; + if (ctx->hash_type) + fc_type = ROC_SE_PDCP_CHAIN; + else + fc_type = ROC_SE_PDCP; break; case ROC_SE_AES_CTR_EEA2: - fc_type = ROC_SE_PDCP; + if (ctx->hash_type) + fc_type = ROC_SE_PDCP_CHAIN; + else + fc_type = ROC_SE_PDCP; break; case ROC_SE_KASUMI_F8_CBC: case ROC_SE_KASUMI_F8_ECB: @@ -171,6 +174,29 @@ cpt_pdcp_key_type_set(struct roc_se_zuc_snow3g_ctx *zs_ctx, uint16_t key_len) return 0; } +static int +cpt_pdcp_chain_key_type_get(uint16_t key_len) +{ + roc_se_aes_type key_type; + + switch (key_len) { + case 16: + key_type = ROC_SE_AES_128_BIT; + break; + case 24: + key_type = ROC_SE_AES_192_BIT; + break; + case 32: + key_type = ROC_SE_AES_256_BIT; + break; + default: + plt_err("Invalid key len"); + return -ENOTSUP; + } + + return key_type; +} + static int cpt_pdcp_mac_len_set(struct roc_se_zuc_snow3g_ctx *zs_ctx, uint16_t mac_len) { @@ -202,7 +228,7 @@ cpt_pdcp_mac_len_set(struct roc_se_zuc_snow3g_ctx *zs_ctx, uint16_t mac_len) } static void -cpt_pdcp_update_zuc_const(uint8_t *zuc_const, int key_len, int mac_len) +cpt_zuc_const_update(uint8_t *zuc_const, int key_len, int mac_len) { if (key_len == 16) { memcpy(zuc_const, zuc_key128, 32); @@ -227,15 +253,19 @@ int roc_se_auth_key_set(struct roc_se_ctx *se_ctx, roc_se_auth_type type, const uint8_t *key, uint16_t key_len, uint16_t mac_len) { + struct roc_se_zuc_snow3g_chain_ctx *zs_ch_ctx; struct roc_se_zuc_snow3g_ctx *zs_ctx; struct roc_se_kasumi_ctx *k_ctx; struct roc_se_context *fctx; + uint8_t opcode_minor; + uint8_t pdcp_alg; int ret; if (se_ctx == NULL) return -1; zs_ctx = &se_ctx->se_ctx.zs_ctx; + zs_ch_ctx = &se_ctx->se_ctx.zs_ch_ctx; k_ctx = &se_ctx->se_ctx.k_ctx; fctx = &se_ctx->se_ctx.fctx; @@ -243,14 +273,12 @@ roc_se_auth_key_set(struct roc_se_ctx *se_ctx, roc_se_auth_type type, uint8_t *zuc_const; uint32_t keyx[4]; uint8_t *ci_key; + bool chained_op = + se_ctx->ciph_then_auth || se_ctx->auth_then_ciph; if (!key_len) return -1; - /* No support for chained operations yet */ - if (se_ctx->enc_cipher) - return -1; - if (roc_model_is_cn9k()) { ci_key = zs_ctx->zuc.onk_ctx.ci_key; zuc_const = zs_ctx->zuc.onk_ctx.zuc_const; @@ -262,41 +290,88 @@ roc_se_auth_key_set(struct roc_se_ctx *se_ctx, roc_se_auth_type type, /* For ZUC/SNOW3G/Kasumi */ switch (type) { case ROC_SE_SNOW3G_UIA2: - zs_ctx->zuc.otk_ctx.w0.s.alg_type = - ROC_SE_PDCP_ALG_TYPE_SNOW3G; - zs_ctx->zuc.otk_ctx.w0.s.mac_len = - ROC_SE_PDCP_MAC_LEN_32_BIT; - se_ctx->pdcp_alg_type = ROC_SE_PDCP_ALG_TYPE_SNOW3G; - cpt_snow3g_key_gen(key, keyx); - memcpy(ci_key, keyx, key_len); - se_ctx->fc_type = ROC_SE_PDCP; + if (chained_op) { + struct roc_se_onk_zuc_chain_ctx *ctx = + &zs_ch_ctx->zuc.onk_ctx; + zs_ch_ctx->zuc.onk_ctx.w0.s.state_conf = + ROC_SE_PDCP_CHAIN_CTX_KEY_IV; + ctx->w0.s.auth_type = + ROC_SE_PDCP_CHAIN_ALG_TYPE_SNOW3G; + ctx->w0.s.mac_len = mac_len; + ctx->w0.s.auth_key_len = key_len; + se_ctx->fc_type = ROC_SE_PDCP_CHAIN; + cpt_snow3g_key_gen(key, keyx); + memcpy(ctx->st.auth_key, keyx, key_len); + } else { + zs_ctx->zuc.otk_ctx.w0.s.alg_type = + ROC_SE_PDCP_ALG_TYPE_SNOW3G; + zs_ctx->zuc.otk_ctx.w0.s.mac_len = + ROC_SE_PDCP_MAC_LEN_32_BIT; + cpt_snow3g_key_gen(key, keyx); + memcpy(ci_key, keyx, key_len); + se_ctx->fc_type = ROC_SE_PDCP; + } + se_ctx->pdcp_auth_alg = ROC_SE_PDCP_ALG_TYPE_SNOW3G; se_ctx->zsk_flags = 0x1; break; case ROC_SE_ZUC_EIA3: - zs_ctx->zuc.otk_ctx.w0.s.alg_type = - ROC_SE_PDCP_ALG_TYPE_ZUC; - ret = cpt_pdcp_key_type_set(zs_ctx, key_len); - if (ret) - return ret; - ret = cpt_pdcp_mac_len_set(zs_ctx, mac_len); - if (ret) - return ret; - se_ctx->pdcp_alg_type = ROC_SE_PDCP_ALG_TYPE_ZUC; - memcpy(ci_key, key, key_len); - if (key_len == 32) - roc_se_zuc_bytes_swap(ci_key, key_len); - cpt_pdcp_update_zuc_const(zuc_const, key_len, mac_len); - se_ctx->fc_type = ROC_SE_PDCP; + if (chained_op) { + struct roc_se_onk_zuc_chain_ctx *ctx = + &zs_ch_ctx->zuc.onk_ctx; + ctx->w0.s.state_conf = + ROC_SE_PDCP_CHAIN_CTX_KEY_IV; + ctx->w0.s.auth_type = + ROC_SE_PDCP_CHAIN_ALG_TYPE_ZUC; + ctx->w0.s.mac_len = mac_len; + ctx->w0.s.auth_key_len = key_len; + memcpy(ctx->st.auth_key, key, key_len); + cpt_zuc_const_update(ctx->st.auth_zuc_const, + key_len, mac_len); + se_ctx->fc_type = ROC_SE_PDCP_CHAIN; + } else { + zs_ctx->zuc.otk_ctx.w0.s.alg_type = + ROC_SE_PDCP_ALG_TYPE_ZUC; + ret = cpt_pdcp_key_type_set(zs_ctx, key_len); + if (ret) + return ret; + ret = cpt_pdcp_mac_len_set(zs_ctx, mac_len); + if (ret) + return ret; + memcpy(ci_key, key, key_len); + if (key_len == 32) + roc_se_zuc_bytes_swap(ci_key, key_len); + cpt_zuc_const_update(zuc_const, key_len, + mac_len); + se_ctx->fc_type = ROC_SE_PDCP; + } + se_ctx->pdcp_auth_alg = ROC_SE_PDCP_ALG_TYPE_ZUC; se_ctx->zsk_flags = 0x1; break; case ROC_SE_AES_CMAC_EIA2: - zs_ctx->zuc.otk_ctx.w0.s.alg_type = - ROC_SE_PDCP_ALG_TYPE_AES_CTR; - zs_ctx->zuc.otk_ctx.w0.s.mac_len = - ROC_SE_PDCP_MAC_LEN_32_BIT; - se_ctx->pdcp_alg_type = ROC_SE_PDCP_ALG_TYPE_AES_CTR; - memcpy(ci_key, key, key_len); - se_ctx->fc_type = ROC_SE_PDCP; + if (chained_op) { + struct roc_se_onk_zuc_chain_ctx *ctx = + &zs_ch_ctx->zuc.onk_ctx; + int key_type; + key_type = cpt_pdcp_chain_key_type_get(key_len); + if (key_type < 0) + return key_type; + ctx->w0.s.auth_key_len = key_type; + ctx->w0.s.state_conf = + ROC_SE_PDCP_CHAIN_CTX_KEY_IV; + ctx->w0.s.auth_type = + ROC_SE_PDCP_ALG_TYPE_AES_CTR; + ctx->w0.s.mac_len = mac_len; + memcpy(ctx->st.auth_key, key, key_len); + se_ctx->fc_type = ROC_SE_PDCP_CHAIN; + } else { + zs_ctx->zuc.otk_ctx.w0.s.alg_type = + ROC_SE_PDCP_ALG_TYPE_AES_CTR; + zs_ctx->zuc.otk_ctx.w0.s.mac_len = + ROC_SE_PDCP_MAC_LEN_32_BIT; + memcpy(ci_key, key, key_len); + se_ctx->fc_type = ROC_SE_PDCP; + } + se_ctx->pdcp_auth_alg = ROC_SE_PDCP_ALG_TYPE_AES_CMAC; se_ctx->zsk_flags = 0x1; break; case ROC_SE_KASUMI_F9_ECB: @@ -316,11 +391,16 @@ roc_se_auth_key_set(struct roc_se_ctx *se_ctx, roc_se_auth_type type, } se_ctx->mac_len = mac_len; se_ctx->hash_type = type; + pdcp_alg = zs_ctx->zuc.otk_ctx.w0.s.alg_type; if (roc_model_is_cn9k()) - se_ctx->template_w4.s.opcode_minor = - ((1 << 7) | (se_ctx->pdcp_alg_type << 5) | 1); + if (chained_op == true) + opcode_minor = se_ctx->ciph_then_auth ? 2 : 3; + else + opcode_minor = ((1 << 7) | (pdcp_alg << 5) | 1); else - se_ctx->template_w4.s.opcode_minor = ((1 << 4) | 1); + opcode_minor = ((1 << 4) | 1); + + se_ctx->template_w4.s.opcode_minor = opcode_minor; return 0; } @@ -363,13 +443,18 @@ int roc_se_ciph_key_set(struct roc_se_ctx *se_ctx, roc_se_cipher_type type, const uint8_t *key, uint16_t key_len, uint8_t *salt) { + bool chained_op = se_ctx->ciph_then_auth || se_ctx->auth_then_ciph; struct roc_se_zuc_snow3g_ctx *zs_ctx = &se_ctx->se_ctx.zs_ctx; struct roc_se_context *fctx = &se_ctx->se_ctx.fctx; + struct roc_se_zuc_snow3g_chain_ctx *zs_ch_ctx; + uint8_t opcode_minor; uint8_t *zuc_const; uint32_t keyx[4]; uint8_t *ci_key; int ret; + zs_ch_ctx = &se_ctx->se_ctx.zs_ch_ctx; + if (roc_model_is_cn9k()) { ci_key = zs_ctx->zuc.onk_ctx.ci_key; zuc_const = zs_ctx->zuc.onk_ctx.zuc_const; @@ -447,34 +532,73 @@ roc_se_ciph_key_set(struct roc_se_ctx *se_ctx, roc_se_cipher_type type, memcpy(fctx->hmac.ipad, &key[key_len], key_len); break; case ROC_SE_SNOW3G_UEA2: - zs_ctx->zuc.otk_ctx.w0.s.key_len = ROC_SE_AES_128_BIT; - zs_ctx->zuc.otk_ctx.w0.s.alg_type = ROC_SE_PDCP_ALG_TYPE_SNOW3G; - se_ctx->pdcp_alg_type = ROC_SE_PDCP_ALG_TYPE_SNOW3G; - cpt_snow3g_key_gen(key, keyx); - memcpy(ci_key, keyx, key_len); + if (chained_op == true) { + struct roc_se_onk_zuc_chain_ctx *ctx = + &zs_ch_ctx->zuc.onk_ctx; + zs_ch_ctx->zuc.onk_ctx.w0.s.state_conf = + ROC_SE_PDCP_CHAIN_CTX_KEY_IV; + zs_ch_ctx->zuc.onk_ctx.w0.s.cipher_type = + ROC_SE_PDCP_CHAIN_ALG_TYPE_SNOW3G; + zs_ch_ctx->zuc.onk_ctx.w0.s.ci_key_len = key_len; + cpt_snow3g_key_gen(key, keyx); + memcpy(ctx->st.ci_key, keyx, key_len); + } else { + zs_ctx->zuc.otk_ctx.w0.s.key_len = ROC_SE_AES_128_BIT; + zs_ctx->zuc.otk_ctx.w0.s.alg_type = + ROC_SE_PDCP_ALG_TYPE_SNOW3G; + cpt_snow3g_key_gen(key, keyx); + memcpy(ci_key, keyx, key_len); + } + se_ctx->pdcp_ci_alg = ROC_SE_PDCP_ALG_TYPE_SNOW3G; se_ctx->zsk_flags = 0; goto success; case ROC_SE_ZUC_EEA3: - ret = cpt_pdcp_key_type_set(zs_ctx, key_len); - if (ret) - return ret; - zs_ctx->zuc.otk_ctx.w0.s.alg_type = ROC_SE_PDCP_ALG_TYPE_ZUC; - se_ctx->pdcp_alg_type = ROC_SE_PDCP_ALG_TYPE_ZUC; - memcpy(ci_key, key, key_len); - if (key_len == 32) { - roc_se_zuc_bytes_swap(ci_key, key_len); - memcpy(zuc_const, zuc_key256, 16); - } else - memcpy(zuc_const, zuc_key128, 32); + if (chained_op == true) { + struct roc_se_onk_zuc_chain_ctx *ctx = + &zs_ch_ctx->zuc.onk_ctx; + zs_ch_ctx->zuc.onk_ctx.w0.s.state_conf = + ROC_SE_PDCP_CHAIN_CTX_KEY_IV; + zs_ch_ctx->zuc.onk_ctx.w0.s.cipher_type = + ROC_SE_PDCP_CHAIN_ALG_TYPE_ZUC; + memcpy(ctx->st.ci_key, key, key_len); + memcpy(ctx->st.ci_zuc_const, zuc_key128, 32); + zs_ch_ctx->zuc.onk_ctx.w0.s.ci_key_len = key_len; + } else { + ret = cpt_pdcp_key_type_set(zs_ctx, key_len); + if (ret) + return ret; + zs_ctx->zuc.otk_ctx.w0.s.alg_type = + ROC_SE_PDCP_ALG_TYPE_ZUC; + memcpy(ci_key, key, key_len); + if (key_len == 32) { + roc_se_zuc_bytes_swap(ci_key, key_len); + memcpy(zuc_const, zuc_key256, 16); + } else + memcpy(zuc_const, zuc_key128, 32); + } + se_ctx->pdcp_ci_alg = ROC_SE_PDCP_ALG_TYPE_ZUC; se_ctx->zsk_flags = 0; goto success; case ROC_SE_AES_CTR_EEA2: - zs_ctx->zuc.otk_ctx.w0.s.key_len = ROC_SE_AES_128_BIT; - zs_ctx->zuc.otk_ctx.w0.s.alg_type = - ROC_SE_PDCP_ALG_TYPE_AES_CTR; - se_ctx->pdcp_alg_type = ROC_SE_PDCP_ALG_TYPE_AES_CTR; - memcpy(ci_key, key, key_len); + if (chained_op == true) { + struct roc_se_onk_zuc_chain_ctx *ctx = + &zs_ch_ctx->zuc.onk_ctx; + int key_type; + key_type = cpt_pdcp_chain_key_type_get(key_len); + if (key_type < 0) + return key_type; + ctx->w0.s.ci_key_len = key_type; + ctx->w0.s.state_conf = ROC_SE_PDCP_CHAIN_CTX_KEY_IV; + ctx->w0.s.cipher_type = ROC_SE_PDCP_ALG_TYPE_AES_CTR; + memcpy(ctx->st.ci_key, key, key_len); + } else { + zs_ctx->zuc.otk_ctx.w0.s.key_len = ROC_SE_AES_128_BIT; + zs_ctx->zuc.otk_ctx.w0.s.alg_type = + ROC_SE_PDCP_ALG_TYPE_AES_CTR; + memcpy(ci_key, key, key_len); + } + se_ctx->pdcp_ci_alg = ROC_SE_PDCP_ALG_TYPE_AES_CTR; se_ctx->zsk_flags = 0; goto success; case ROC_SE_KASUMI_F8_ECB: @@ -502,11 +626,16 @@ roc_se_ciph_key_set(struct roc_se_ctx *se_ctx, roc_se_cipher_type type, se_ctx->enc_cipher = type; if (se_ctx->fc_type == ROC_SE_PDCP) { if (roc_model_is_cn9k()) - se_ctx->template_w4.s.opcode_minor = - ((1 << 7) | (se_ctx->pdcp_alg_type << 5) | - (se_ctx->zsk_flags & 0x7)); + if (chained_op == true) + opcode_minor = se_ctx->ciph_then_auth ? 2 : 3; + else + opcode_minor = + ((1 << 7) | (se_ctx->pdcp_ci_alg << 5) | + (se_ctx->zsk_flags & 0x7)); else - se_ctx->template_w4.s.opcode_minor = ((1 << 4)); + opcode_minor = ((1 << 4)); + + se_ctx->template_w4.s.opcode_minor = opcode_minor; } return 0; } diff --git a/drivers/common/cnxk/roc_se.h b/drivers/common/cnxk/roc_se.h index c565ec1b74..86bb3aa79d 100644 --- a/drivers/common/cnxk/roc_se.h +++ b/drivers/common/cnxk/roc_se.h @@ -11,10 +11,11 @@ #define ROC_SE_FC_MINOR_OP_DECRYPT 0x1 #define ROC_SE_FC_MINOR_OP_HMAC_FIRST 0x10 -#define ROC_SE_MAJOR_OP_HASH 0x34 -#define ROC_SE_MAJOR_OP_HMAC 0x35 -#define ROC_SE_MAJOR_OP_PDCP 0x37 -#define ROC_SE_MAJOR_OP_KASUMI 0x38 +#define ROC_SE_MAJOR_OP_HASH 0x34 +#define ROC_SE_MAJOR_OP_HMAC 0x35 +#define ROC_SE_MAJOR_OP_PDCP 0x37 +#define ROC_SE_MAJOR_OP_KASUMI 0x38 +#define ROC_SE_MAJOR_OP_PDCP_CHAIN 0x3C #define ROC_SE_MAJOR_OP_MISC 0x01 #define ROC_SE_MISC_MINOR_OP_PASSTHROUGH 0x03 @@ -38,10 +39,11 @@ #define ROC_SE_K_F8 0x4 #define ROC_SE_K_F9 0x8 -#define ROC_SE_FC_GEN 0x1 -#define ROC_SE_PDCP 0x2 -#define ROC_SE_KASUMI 0x3 -#define ROC_SE_HASH_HMAC 0x4 +#define ROC_SE_FC_GEN 0x1 +#define ROC_SE_PDCP 0x2 +#define ROC_SE_KASUMI 0x3 +#define ROC_SE_HASH_HMAC 0x4 +#define ROC_SE_PDCP_CHAIN 0x5 #define ROC_SE_OP_CIPHER_ENCRYPT 0x1 #define ROC_SE_OP_CIPHER_DECRYPT 0x2 @@ -224,6 +226,42 @@ struct roc_se_onk_zuc_ctx { uint8_t zuc_const[32]; }; +struct roc_se_onk_zuc_chain_ctx { + union { + uint64_t u64; + struct { + uint64_t cipher_type : 2; + uint64_t rsvd58_59 : 2; + uint64_t auth_type : 2; + uint64_t rsvd62_63 : 2; + uint64_t mac_len : 4; + uint64_t ci_key_len : 2; + uint64_t auth_key_len : 2; + uint64_t rsvd42_47 : 6; + uint64_t state_conf : 2; + uint64_t rsvd0_39 : 40; + } s; + } w0; + union { + struct { + uint8_t encr_lfsr_state[64]; + uint8_t auth_lfsr_state[64]; + }; + struct { + uint8_t ci_key[32]; + uint8_t ci_zuc_const[32]; + uint8_t auth_key[32]; + uint8_t auth_zuc_const[32]; + }; + } st; +}; + +struct roc_se_zuc_snow3g_chain_ctx { + union { + struct roc_se_onk_zuc_chain_ctx onk_ctx; + } zuc; +}; + struct roc_se_zuc_snow3g_ctx { union { struct roc_se_onk_zuc_ctx onk_ctx; @@ -275,9 +313,15 @@ struct roc_se_fc_params { PLT_STATIC_ASSERT((offsetof(struct roc_se_fc_params, aad_buf) % 128) == 0); -#define ROC_SE_PDCP_ALG_TYPE_ZUC 0 -#define ROC_SE_PDCP_ALG_TYPE_SNOW3G 1 -#define ROC_SE_PDCP_ALG_TYPE_AES_CTR 2 +#define ROC_SE_PDCP_ALG_TYPE_ZUC 0 +#define ROC_SE_PDCP_ALG_TYPE_SNOW3G 1 +#define ROC_SE_PDCP_ALG_TYPE_AES_CTR 2 +#define ROC_SE_PDCP_ALG_TYPE_AES_CMAC 3 +#define ROC_SE_PDCP_CHAIN_ALG_TYPE_SNOW3G 1 +#define ROC_SE_PDCP_CHAIN_ALG_TYPE_ZUC 3 + +#define ROC_SE_PDCP_CHAIN_CTX_LFSR 0 +#define ROC_SE_PDCP_CHAIN_CTX_KEY_IV 1 struct roc_se_ctx { /* Below fields are accessed by sw */ @@ -289,13 +333,17 @@ struct roc_se_ctx { uint64_t hmac : 1; uint64_t zsk_flags : 3; uint64_t k_ecb : 1; - uint64_t pdcp_alg_type : 2; - uint64_t rsvd : 21; + uint64_t pdcp_ci_alg : 2; + uint64_t pdcp_auth_alg : 2; + uint16_t ciph_then_auth : 1; + uint16_t auth_then_ciph : 1; + uint64_t rsvd : 17; union cpt_inst_w4 template_w4; /* Below fields are accessed by hardware */ union { struct roc_se_context fctx; struct roc_se_zuc_snow3g_ctx zs_ctx; + struct roc_se_zuc_snow3g_chain_ctx zs_ch_ctx; struct roc_se_kasumi_ctx k_ctx; } se_ctx; uint8_t *auth_key; diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c index 7237dacb48..80071872f1 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c +++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c @@ -421,14 +421,39 @@ cnxk_cpt_sym_session_get_size(struct rte_cryptodev *dev __rte_unused) return sizeof(struct cnxk_se_sess); } +static bool +is_valid_pdcp_cipher_alg(struct rte_crypto_sym_xform *c_xfrm, + struct cnxk_se_sess *sess) +{ + switch (c_xfrm->cipher.algo) { + case RTE_CRYPTO_CIPHER_SNOW3G_UEA2: + case RTE_CRYPTO_CIPHER_ZUC_EEA3: + break; + case RTE_CRYPTO_CIPHER_AES_CTR: + sess->aes_ctr_eea2 = 1; + break; + default: + return false; + } + + return true; +} + static int -cnxk_sess_fill(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) +cnxk_sess_fill(struct roc_cpt *roc_cpt, struct rte_crypto_sym_xform *xform, + struct cnxk_se_sess *sess) { struct rte_crypto_sym_xform *aead_xfrm = NULL; struct rte_crypto_sym_xform *c_xfrm = NULL; struct rte_crypto_sym_xform *a_xfrm = NULL; + bool pdcp_chain_supported = false; bool ciph_then_auth = false; + if (roc_cpt->cpt_revision == ROC_CPT_REVISION_ID_96XX_B0 || + roc_cpt->cpt_revision == ROC_CPT_REVISION_ID_96XX_C0 || + roc_cpt->cpt_revision == ROC_CPT_REVISION_ID_98XX) + pdcp_chain_supported = true; + if (xform == NULL) return -EINVAL; @@ -506,6 +531,32 @@ cnxk_sess_fill(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) /* Cipher then auth */ if (ciph_then_auth) { + if (c_xfrm->cipher.op == RTE_CRYPTO_CIPHER_OP_DECRYPT) { + if (a_xfrm->auth.op != RTE_CRYPTO_AUTH_OP_VERIFY) + return -EINVAL; + sess->auth_first = 1; + switch (a_xfrm->auth.algo) { + case RTE_CRYPTO_AUTH_SHA1_HMAC: + switch (c_xfrm->cipher.algo) { + case RTE_CRYPTO_CIPHER_AES_CBC: + break; + default: + return -ENOTSUP; + } + break; + case RTE_CRYPTO_AUTH_SNOW3G_UIA2: + case RTE_CRYPTO_AUTH_ZUC_EIA3: + case RTE_CRYPTO_AUTH_AES_CMAC: + if (!pdcp_chain_supported || + !is_valid_pdcp_cipher_alg(c_xfrm, sess)) + return -ENOTSUP; + break; + default: + return -ENOTSUP; + } + } + sess->roc_se_ctx.ciph_then_auth = 1; + sess->chained_op = 1; if (fill_sess_cipher(c_xfrm, sess)) return -ENOTSUP; if (fill_sess_auth(a_xfrm, sess)) @@ -517,6 +568,9 @@ cnxk_sess_fill(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) /* else */ if (c_xfrm->cipher.op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) { + if (a_xfrm->auth.op != RTE_CRYPTO_AUTH_OP_GENERATE) + return -EINVAL; + sess->auth_first = 1; switch (a_xfrm->auth.algo) { case RTE_CRYPTO_AUTH_SHA1_HMAC: switch (c_xfrm->cipher.algo) { @@ -526,11 +580,20 @@ cnxk_sess_fill(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) return -ENOTSUP; } break; + case RTE_CRYPTO_AUTH_SNOW3G_UIA2: + case RTE_CRYPTO_AUTH_ZUC_EIA3: + case RTE_CRYPTO_AUTH_AES_CMAC: + if (!pdcp_chain_supported || + !is_valid_pdcp_cipher_alg(c_xfrm, sess)) + return -ENOTSUP; + break; default: return -ENOTSUP; } } + sess->roc_se_ctx.auth_then_ciph = 1; + sess->chained_op = 1; if (fill_sess_auth(a_xfrm, sess)) return -ENOTSUP; if (fill_sess_cipher(c_xfrm, sess)) @@ -547,7 +610,7 @@ cnxk_cpt_inst_w7_get(struct cnxk_se_sess *sess, struct roc_cpt *roc_cpt) inst_w7.s.cptr = (uint64_t)&sess->roc_se_ctx.se_ctx; /* Set the engine group */ - if (sess->zsk_flag || sess->chacha_poly) + if (sess->zsk_flag || sess->chacha_poly || sess->aes_ctr_eea2) inst_w7.s.egrp = roc_cpt->eng_grp[CPT_ENG_TYPE_SE]; else inst_w7.s.egrp = roc_cpt->eng_grp[CPT_ENG_TYPE_IE]; @@ -574,7 +637,7 @@ sym_session_configure(struct roc_cpt *roc_cpt, int driver_id, sess_priv = priv; - ret = cnxk_sess_fill(xform, sess_priv); + ret = cnxk_sess_fill(roc_cpt, xform, sess_priv); if (ret) goto priv_put; diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index cca44f1d3e..7429d66314 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -24,7 +24,12 @@ struct cnxk_se_sess { uint16_t chacha_poly : 1; uint16_t is_null : 1; uint16_t is_gmac : 1; - uint16_t rsvd1 : 3; + uint16_t chained_op : 1; + uint16_t auth_first : 1; + uint16_t aes_ctr_eea2 : 1; + uint16_t zs_cipher : 4; + uint16_t zs_auth : 4; + uint16_t rsvd2 : 8; uint16_t aad_length; uint8_t mac_len; uint8_t iv_length; @@ -63,6 +68,11 @@ pdcp_iv_copy(uint8_t *iv_d, uint8_t *iv_s, const uint8_t pdcp_alg_type, uint32_t *iv_s_temp, iv_temp[4]; int j; + if (unlikely(iv_s == NULL)) { + memset(iv_d, 0, 16); + return; + } + if (pdcp_alg_type == ROC_SE_PDCP_ALG_TYPE_SNOW3G) { /* * DPDK seems to provide it in form of IV3 IV2 IV1 IV0 @@ -74,7 +84,8 @@ pdcp_iv_copy(uint8_t *iv_d, uint8_t *iv_s, const uint8_t pdcp_alg_type, for (j = 0; j < 4; j++) iv_temp[j] = iv_s_temp[3 - j]; memcpy(iv_d, iv_temp, 16); - } else if (pdcp_alg_type == ROC_SE_PDCP_ALG_TYPE_ZUC) { + } else if ((pdcp_alg_type == ROC_SE_PDCP_ALG_TYPE_ZUC) || + pdcp_alg_type == ROC_SE_PDCP_ALG_TYPE_AES_CTR) { if (pack_iv) { cpt_pack_iv(iv_s, iv_d); memcpy(iv_d + 6, iv_s + 8, 17); @@ -997,6 +1008,110 @@ cpt_dec_hmac_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens, return 0; } +static __rte_always_inline int +cpt_pdcp_chain_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, + struct roc_se_fc_params *params, + struct cpt_inst_s *inst) +{ + uint32_t encr_offset, auth_offset, iv_offset = 0; + uint8_t *auth_iv = NULL, *cipher_iv = NULL; + uint32_t encr_data_len, auth_data_len; + uint8_t pdcp_ci_alg, pdcp_auth_alg; + union cpt_inst_w4 cpt_inst_w4; + struct roc_se_ctx *se_ctx; + const int iv_len = 32; + uint32_t mac_len = 0; + uint8_t pack_iv = 0; + void *offset_vaddr; + int32_t inputlen; + void *dm_vaddr; + uint8_t *iv_d; + + if (unlikely((!(req_flags & ROC_SE_SINGLE_BUF_INPLACE)) || + (!(req_flags & ROC_SE_SINGLE_BUF_HEADROOM)))) { + plt_dp_err("Scatter gather mode is not supported"); + return -1; + } + + encr_offset = ROC_SE_ENCR_OFFSET(d_offs); + auth_offset = ROC_SE_AUTH_OFFSET(d_offs); + + if (auth_offset != encr_offset) { + plt_dp_err("encr_offset and auth_offset are not same"); + plt_dp_err("enc_offset: %d", encr_offset); + plt_dp_err("auth_offset: %d", auth_offset); + return -1; + } + + if (unlikely(encr_offset >> 16)) { + plt_dp_err("Offset not supported"); + plt_dp_err("enc_offset: %d", encr_offset); + return -1; + } + + se_ctx = params->ctx_buf.vaddr; + mac_len = se_ctx->mac_len; + pdcp_ci_alg = se_ctx->pdcp_ci_alg; + pdcp_auth_alg = se_ctx->pdcp_auth_alg; + + encr_data_len = ROC_SE_ENCR_DLEN(d_lens); + auth_data_len = ROC_SE_AUTH_DLEN(d_lens); + + if ((auth_data_len + mac_len) != encr_data_len) { + plt_dp_err("(auth_data_len + mac_len) != encr_data_len"); + plt_dp_err("auth_data_len: %d", auth_data_len); + plt_dp_err("encr_data_len: %d", encr_data_len); + plt_dp_err("mac_len: %d", mac_len); + return -1; + } + + cpt_inst_w4.s.opcode_major = ROC_SE_MAJOR_OP_PDCP_CHAIN; + cpt_inst_w4.s.opcode_minor = se_ctx->template_w4.s.opcode_minor; + + cpt_inst_w4.s.param1 = auth_data_len; + cpt_inst_w4.s.param2 = 0; + + if (likely(params->auth_iv_len)) + auth_iv = params->auth_iv_buf; + + if (likely(params->cipher_iv_len)) + cipher_iv = params->iv_buf; + + encr_offset += iv_len; + + if (se_ctx->auth_then_ciph) + inputlen = encr_offset + auth_data_len; + else + inputlen = encr_offset + encr_data_len; + + dm_vaddr = params->bufs[0].vaddr; + + /* Use Direct mode */ + + offset_vaddr = (uint64_t *)((uint8_t *)dm_vaddr - ROC_SE_OFF_CTRL_LEN - + iv_len); + + /* DPTR */ + inst->dptr = (uint64_t)offset_vaddr; + /* RPTR should just exclude offset control word */ + inst->rptr = (uint64_t)dm_vaddr - iv_len; + + cpt_inst_w4.s.dlen = inputlen + ROC_SE_OFF_CTRL_LEN; + + *(uint64_t *)offset_vaddr = rte_cpu_to_be_64( + ((uint64_t)(iv_offset) << 16) | ((uint64_t)(encr_offset))); + + iv_d = ((uint8_t *)offset_vaddr + ROC_SE_OFF_CTRL_LEN); + pdcp_iv_copy(iv_d, cipher_iv, pdcp_ci_alg, pack_iv); + + iv_d = ((uint8_t *)offset_vaddr + ROC_SE_OFF_CTRL_LEN + 16); + pdcp_iv_copy(iv_d, auth_iv, pdcp_auth_alg, pack_iv); + + inst->w4.u64 = cpt_inst_w4.u64; + + return 0; +} + static __rte_always_inline int cpt_pdcp_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, struct roc_se_fc_params *params, struct cpt_inst_s *inst) @@ -1018,7 +1133,6 @@ cpt_pdcp_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, se_ctx = params->ctx_buf.vaddr; flags = se_ctx->zsk_flags; mac_len = se_ctx->mac_len; - pdcp_alg_type = se_ctx->pdcp_alg_type; cpt_inst_w4.s.opcode_major = ROC_SE_MAJOR_OP_PDCP; cpt_inst_w4.s.opcode_minor = se_ctx->template_w4.s.opcode_minor; @@ -1032,8 +1146,9 @@ cpt_pdcp_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, */ auth_data_len = ROC_SE_AUTH_DLEN(d_lens); auth_offset = ROC_SE_AUTH_OFFSET(d_offs); + pdcp_alg_type = se_ctx->pdcp_auth_alg; - if (se_ctx->pdcp_alg_type != ROC_SE_PDCP_ALG_TYPE_AES_CTR) { + if (pdcp_alg_type != ROC_SE_PDCP_ALG_TYPE_AES_CMAC) { iv_len = params->auth_iv_len; if (iv_len == 25) { @@ -1067,6 +1182,7 @@ cpt_pdcp_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, } else { iv_s = params->iv_buf; iv_len = params->cipher_iv_len; + pdcp_alg_type = se_ctx->pdcp_ci_alg; if (iv_len == 25) { roc_se_zuc_bytes_swap(iv_s, iv_len); @@ -1609,6 +1725,9 @@ cpt_fc_dec_hmac_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens, ret = cpt_pdcp_alg_prep(flags, d_offs, d_lens, fc_params, inst); } else if (fc_type == ROC_SE_KASUMI) { ret = cpt_kasumi_dec_prep(d_offs, d_lens, fc_params, inst); + } else if (fc_type == ROC_SE_PDCP_CHAIN) { + ret = cpt_pdcp_chain_alg_prep(flags, d_offs, d_lens, fc_params, + inst); } /* @@ -1640,6 +1759,9 @@ cpt_fc_enc_hmac_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens, inst); } else if (fc_type == ROC_SE_HASH_HMAC) { ret = cpt_digest_gen_prep(flags, d_lens, fc_params, inst); + } else if (fc_type == ROC_SE_PDCP_CHAIN) { + ret = cpt_pdcp_chain_alg_prep(flags, d_offs, d_lens, fc_params, + inst); } return ret; @@ -1713,10 +1835,10 @@ fill_sess_aead(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) static __rte_always_inline int fill_sess_cipher(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) { + uint8_t zsk_flag = 0, zs_cipher = 0, aes_ctr = 0, is_null = 0; struct rte_crypto_cipher_xform *c_form; roc_se_cipher_type enc_type = 0; /* NULL Cipher type */ uint32_t cipher_key_len = 0; - uint8_t zsk_flag = 0, aes_ctr = 0, is_null = 0; c_form = &xform->cipher; @@ -1750,28 +1872,37 @@ fill_sess_cipher(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) cipher_key_len = 8; break; case RTE_CRYPTO_CIPHER_AES_CTR: - enc_type = ROC_SE_AES_CTR; + if (sess->aes_ctr_eea2) { + enc_type = ROC_SE_AES_CTR_EEA2; + } else { + enc_type = ROC_SE_AES_CTR; + aes_ctr = 1; + } cipher_key_len = 16; - aes_ctr = 1; break; case RTE_CRYPTO_CIPHER_NULL: enc_type = 0; is_null = 1; break; case RTE_CRYPTO_CIPHER_KASUMI_F8: + if (sess->chained_op) + return -ENOTSUP; enc_type = ROC_SE_KASUMI_F8_ECB; cipher_key_len = 16; zsk_flag = ROC_SE_K_F8; + zs_cipher = ROC_SE_K_F8; break; case RTE_CRYPTO_CIPHER_SNOW3G_UEA2: enc_type = ROC_SE_SNOW3G_UEA2; cipher_key_len = 16; zsk_flag = ROC_SE_ZS_EA; + zs_cipher = ROC_SE_ZS_EA; break; case RTE_CRYPTO_CIPHER_ZUC_EEA3: enc_type = ROC_SE_ZUC_EEA3; cipher_key_len = c_form->key.length; zsk_flag = ROC_SE_ZS_EA; + zs_cipher = ROC_SE_ZS_EA; break; case RTE_CRYPTO_CIPHER_AES_XTS: enc_type = ROC_SE_AES_XTS; @@ -1802,7 +1933,19 @@ fill_sess_cipher(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) return -1; } + if (zsk_flag && sess->roc_se_ctx.ciph_then_auth) { + struct rte_crypto_auth_xform *a_form; + a_form = &xform->next->auth; + if (c_form->op != RTE_CRYPTO_CIPHER_OP_DECRYPT && + a_form->op != RTE_CRYPTO_AUTH_OP_VERIFY) { + plt_dp_err("Crypto: PDCP cipher then auth must use" + " options: decrypt and verify"); + return -EINVAL; + } + } + sess->zsk_flag = zsk_flag; + sess->zs_cipher = zs_cipher; sess->aes_gcm = 0; sess->aes_ctr = aes_ctr; sess->iv_offset = c_form->iv.offset; @@ -1822,9 +1965,9 @@ fill_sess_cipher(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) static __rte_always_inline int fill_sess_auth(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) { + uint8_t zsk_flag = 0, zs_auth = 0, aes_gcm = 0, is_null = 0; struct rte_crypto_auth_xform *a_form; roc_se_auth_type auth_type = 0; /* NULL Auth type */ - uint8_t zsk_flag = 0, aes_gcm = 0, is_null = 0; if (xform->auth.algo == RTE_CRYPTO_AUTH_AES_GMAC) return fill_sess_gmac(xform, sess); @@ -1879,20 +2022,25 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) auth_type = ROC_SE_MD5_TYPE; break; case RTE_CRYPTO_AUTH_KASUMI_F9: + if (sess->chained_op) + return -ENOTSUP; auth_type = ROC_SE_KASUMI_F9_ECB; /* * Indicate that direction needs to be taken out * from end of src */ zsk_flag = ROC_SE_K_F9; + zs_auth = ROC_SE_K_F9; break; case RTE_CRYPTO_AUTH_SNOW3G_UIA2: auth_type = ROC_SE_SNOW3G_UIA2; zsk_flag = ROC_SE_ZS_IA; + zs_auth = ROC_SE_ZS_IA; break; case RTE_CRYPTO_AUTH_ZUC_EIA3: auth_type = ROC_SE_ZUC_EIA3; zsk_flag = ROC_SE_ZS_IA; + zs_auth = ROC_SE_ZS_IA; break; case RTE_CRYPTO_AUTH_NULL: auth_type = 0; @@ -1912,7 +2060,19 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) return -1; } + if (zsk_flag && sess->roc_se_ctx.auth_then_ciph) { + struct rte_crypto_cipher_xform *c_form; + c_form = &xform->next->cipher; + if (c_form->op != RTE_CRYPTO_CIPHER_OP_ENCRYPT && + a_form->op != RTE_CRYPTO_AUTH_OP_GENERATE) { + plt_dp_err("Crypto: PDCP auth then cipher must use" + " options: encrypt and generate"); + return -EINVAL; + } + } + sess->zsk_flag = zsk_flag; + sess->zs_auth = zs_auth; sess->aes_gcm = aes_gcm; sess->mac_len = a_form->digest_length; sess->is_null = is_null; @@ -2121,11 +2281,15 @@ fill_fc_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, uint8_t inplace = 1; #endif struct roc_se_fc_params fc_params; + bool chain = sess->chained_op; char src[SRC_IOV_SIZE]; char dst[SRC_IOV_SIZE]; uint32_t iv_buf[4]; + bool pdcp_chain; int ret; + pdcp_chain = chain && (sess->zs_auth || sess->zs_cipher); + fc_params.cipher_iv_len = sess->iv_length; fc_params.auth_iv_len = sess->auth_iv_length; @@ -2143,10 +2307,11 @@ fill_fc_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, } } - if (sess->zsk_flag) { - fc_params.auth_iv_buf = rte_crypto_op_ctod_offset( - cop, uint8_t *, sess->auth_iv_offset); - if (sess->zsk_flag != ROC_SE_ZS_EA) + if (sess->zsk_flag || sess->zs_auth) { + if (sess->auth_iv_length) + fc_params.auth_iv_buf = rte_crypto_op_ctod_offset( + cop, uint8_t *, sess->auth_iv_offset); + if ((!chain) && (sess->zsk_flag != ROC_SE_ZS_EA)) inplace = 0; } m_src = sym_op->m_src; @@ -2203,17 +2368,35 @@ fill_fc_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, } } } else { - d_offs = sym_op->cipher.data.offset; - d_lens = sym_op->cipher.data.length; - mc_hash_off = - sym_op->cipher.data.offset + sym_op->cipher.data.length; - d_offs = (d_offs << 16) | sym_op->auth.data.offset; - d_lens = (d_lens << 32) | sym_op->auth.data.length; - - if (mc_hash_off < - (sym_op->auth.data.offset + sym_op->auth.data.length)) { - mc_hash_off = (sym_op->auth.data.offset + - sym_op->auth.data.length); + uint32_t ci_data_length = sym_op->cipher.data.length; + uint32_t ci_data_offset = sym_op->cipher.data.offset; + uint32_t a_data_length = sym_op->auth.data.length; + uint32_t a_data_offset = sym_op->auth.data.offset; + + if (pdcp_chain) { + if (sess->zs_cipher) { + ci_data_length /= 8; + ci_data_offset /= 8; + } + if (sess->zs_auth) { + a_data_length /= 8; + a_data_offset /= 8; + } + } + + d_offs = ci_data_offset; + d_offs = (d_offs << 16) | a_data_offset; + + d_lens = ci_data_length; + d_lens = (d_lens << 32) | a_data_length; + + if (sess->auth_first) + mc_hash_off = a_data_offset + a_data_length; + else + mc_hash_off = ci_data_offset + ci_data_length; + + if (mc_hash_off < (a_data_offset + a_data_length)) { + mc_hash_off = (a_data_offset + a_data_length); } /* for gmac, salt should be updated like in gcm */ if (unlikely(sess->is_gmac)) { @@ -2247,7 +2430,7 @@ fill_fc_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, } fc_params.ctx_buf.vaddr = &sess->roc_se_ctx; - if (!(op_minor & ROC_SE_FC_MINOR_OP_HMAC_FIRST) && + if (!(sess->auth_first) && (!pdcp_chain) && unlikely(sess->is_null || sess->cpt_op == ROC_SE_OP_DECODE)) inplace = 0; @@ -2304,8 +2487,8 @@ fill_fc_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, if (unlikely(!((flags & ROC_SE_SINGLE_BUF_INPLACE) && (flags & ROC_SE_SINGLE_BUF_HEADROOM) && - ((ctx->fc_type == ROC_SE_FC_GEN) || - (ctx->fc_type == ROC_SE_PDCP))))) { + ((ctx->fc_type != ROC_SE_KASUMI) && + (ctx->fc_type != ROC_SE_HASH_HMAC))))) { mdata = alloc_op_meta(&fc_params.meta_buf, m_info->mlen, m_info->pool, infl_req); if (mdata == NULL) { -- 2.25.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/4] crypto/cnxk: support scatter gather mode 2022-06-17 7:36 [PATCH 0/4] support stream cipher chained operations Tejasree Kondoj 2022-06-17 7:36 ` [PATCH 1/4] crypto/cnxk: fix CMAC IV Tejasree Kondoj 2022-06-17 7:36 ` [PATCH 2/4] crypto/cnxk: support stream cipher chained operations Tejasree Kondoj @ 2022-06-17 7:36 ` Tejasree Kondoj 2022-06-17 7:36 ` [PATCH 4/4] app/test: add additional stream cipher tests Tejasree Kondoj 3 siblings, 0 replies; 13+ messages in thread From: Tejasree Kondoj @ 2022-06-17 7:36 UTC (permalink / raw) To: Akhil Goyal; +Cc: Anoob Joseph, Ankur Dwivedi, dev Adding scatter gather support for zuc, snow3g and aes-ctr-cmac chained operations on cn9k. Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com> --- drivers/crypto/cnxk/cnxk_se.h | 149 +++++++++++++++++++++++++++++----- 1 file changed, 128 insertions(+), 21 deletions(-) diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index 7429d66314..a2a97aa88f 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -1027,12 +1027,6 @@ cpt_pdcp_chain_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, void *dm_vaddr; uint8_t *iv_d; - if (unlikely((!(req_flags & ROC_SE_SINGLE_BUF_INPLACE)) || - (!(req_flags & ROC_SE_SINGLE_BUF_HEADROOM)))) { - plt_dp_err("Scatter gather mode is not supported"); - return -1; - } - encr_offset = ROC_SE_ENCR_OFFSET(d_offs); auth_offset = ROC_SE_AUTH_OFFSET(d_offs); @@ -1084,28 +1078,141 @@ cpt_pdcp_chain_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, else inputlen = encr_offset + encr_data_len; - dm_vaddr = params->bufs[0].vaddr; + if (likely(((req_flags & ROC_SE_SINGLE_BUF_INPLACE)) && + ((req_flags & ROC_SE_SINGLE_BUF_HEADROOM)))) { + + dm_vaddr = params->bufs[0].vaddr; - /* Use Direct mode */ + /* Use Direct mode */ + + offset_vaddr = (uint64_t *)((uint8_t *)dm_vaddr - + ROC_SE_OFF_CTRL_LEN - iv_len); - offset_vaddr = (uint64_t *)((uint8_t *)dm_vaddr - ROC_SE_OFF_CTRL_LEN - - iv_len); + /* DPTR */ + inst->dptr = (uint64_t)offset_vaddr; + /* RPTR should just exclude offset control word */ + inst->rptr = (uint64_t)dm_vaddr - iv_len; - /* DPTR */ - inst->dptr = (uint64_t)offset_vaddr; - /* RPTR should just exclude offset control word */ - inst->rptr = (uint64_t)dm_vaddr - iv_len; + cpt_inst_w4.s.dlen = inputlen + ROC_SE_OFF_CTRL_LEN; - cpt_inst_w4.s.dlen = inputlen + ROC_SE_OFF_CTRL_LEN; + *(uint64_t *)offset_vaddr = + rte_cpu_to_be_64(((uint64_t)(iv_offset) << 16) | + ((uint64_t)(encr_offset))); - *(uint64_t *)offset_vaddr = rte_cpu_to_be_64( - ((uint64_t)(iv_offset) << 16) | ((uint64_t)(encr_offset))); + iv_d = ((uint8_t *)offset_vaddr + ROC_SE_OFF_CTRL_LEN); + pdcp_iv_copy(iv_d, cipher_iv, pdcp_ci_alg, pack_iv); + + iv_d = ((uint8_t *)offset_vaddr + ROC_SE_OFF_CTRL_LEN + 16); + pdcp_iv_copy(iv_d, auth_iv, pdcp_auth_alg, pack_iv); + + } else { + + struct roc_se_sglist_comp *scatter_comp, *gather_comp; + void *m_vaddr = params->meta_buf.vaddr; + uint32_t i, g_size_bytes, s_size_bytes; + uint8_t *in_buffer; + uint32_t size; + + /* save space for IV */ + offset_vaddr = m_vaddr; + + m_vaddr = (uint8_t *)m_vaddr + ROC_SE_OFF_CTRL_LEN + + RTE_ALIGN_CEIL(iv_len, 8); + + cpt_inst_w4.s.opcode_major |= (uint64_t)ROC_SE_DMA_MODE; + + /* DPTR has SG list */ + in_buffer = m_vaddr; + + ((uint16_t *)in_buffer)[0] = 0; + ((uint16_t *)in_buffer)[1] = 0; + + gather_comp = + (struct roc_se_sglist_comp *)((uint8_t *)m_vaddr + 8); + + /* Input Gather List */ + i = 0; + + /* Offset control word followed by iv */ + + i = fill_sg_comp(gather_comp, i, (uint64_t)offset_vaddr, + ROC_SE_OFF_CTRL_LEN + iv_len); + + *(uint64_t *)offset_vaddr = + rte_cpu_to_be_64(((uint64_t)(iv_offset) << 16) | + ((uint64_t)(encr_offset))); + + iv_d = ((uint8_t *)offset_vaddr + ROC_SE_OFF_CTRL_LEN); + pdcp_iv_copy(iv_d, cipher_iv, pdcp_ci_alg, pack_iv); + + iv_d = ((uint8_t *)offset_vaddr + ROC_SE_OFF_CTRL_LEN + 16); + pdcp_iv_copy(iv_d, auth_iv, pdcp_auth_alg, pack_iv); + + /* input data */ + size = inputlen - iv_len; + if (size) { + i = fill_sg_comp_from_iov(gather_comp, i, + params->src_iov, 0, &size, + NULL, 0); + if (unlikely(size)) { + plt_dp_err("Insufficient buffer space," + " size %d needed", + size); + return -1; + } + } + ((uint16_t *)in_buffer)[2] = rte_cpu_to_be_16(i); + g_size_bytes = + ((i + 3) / 4) * sizeof(struct roc_se_sglist_comp); + + /* + * Output Scatter List + */ - iv_d = ((uint8_t *)offset_vaddr + ROC_SE_OFF_CTRL_LEN); - pdcp_iv_copy(iv_d, cipher_iv, pdcp_ci_alg, pack_iv); + i = 0; + scatter_comp = + (struct roc_se_sglist_comp *)((uint8_t *)gather_comp + + g_size_bytes); + + if (iv_len) { + i = fill_sg_comp(scatter_comp, i, + (uint64_t)offset_vaddr + + ROC_SE_OFF_CTRL_LEN, + iv_len); + } - iv_d = ((uint8_t *)offset_vaddr + ROC_SE_OFF_CTRL_LEN + 16); - pdcp_iv_copy(iv_d, auth_iv, pdcp_auth_alg, pack_iv); + /* Add output data */ + if (se_ctx->ciph_then_auth && + (req_flags & ROC_SE_VALID_MAC_BUF)) + size = inputlen - iv_len; + else + /* Output including mac */ + size = inputlen - iv_len + mac_len; + + if (size) { + i = fill_sg_comp_from_iov(scatter_comp, i, + params->dst_iov, 0, &size, + NULL, 0); + + if (unlikely(size)) { + plt_dp_err("Insufficient buffer space," + " size %d needed", + size); + return -1; + } + } + + ((uint16_t *)in_buffer)[3] = rte_cpu_to_be_16(i); + s_size_bytes = + ((i + 3) / 4) * sizeof(struct roc_se_sglist_comp); + + size = g_size_bytes + s_size_bytes + ROC_SE_SG_LIST_HDR_SIZE; + + /* This is DPTR len in case of SG mode */ + cpt_inst_w4.s.dlen = size; + + inst->dptr = (uint64_t)in_buffer; + } inst->w4.u64 = cpt_inst_w4.u64; -- 2.25.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 4/4] app/test: add additional stream cipher tests 2022-06-17 7:36 [PATCH 0/4] support stream cipher chained operations Tejasree Kondoj ` (2 preceding siblings ...) 2022-06-17 7:36 ` [PATCH 3/4] crypto/cnxk: support scatter gather mode Tejasree Kondoj @ 2022-06-17 7:36 ` Tejasree Kondoj 2022-06-20 12:30 ` [PATCH v2] " Tejasree Kondoj 3 siblings, 1 reply; 13+ messages in thread From: Tejasree Kondoj @ 2022-06-17 7:36 UTC (permalink / raw) To: Akhil Goyal, Fan Zhang; +Cc: Anoob Joseph, Ankur Dwivedi, dev Adding zuc, snow3g and aes-ctr-cmac auth-cipher test vectors with same auth and cipher offsets and total digest data encrypted. Also skipping other tests with different cipher and auth offsets and partial or no digest encrypted ones on cn9k platform. Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com> --- app/test/test_cryptodev.c | 432 ++++++++++++++++++ app/test/test_cryptodev_mixed_test_vectors.h | 194 ++++++++ app/test/test_cryptodev_snow3g_test_vectors.h | 137 ++++++ app/test/test_cryptodev_zuc_test_vectors.h | 77 ++++ 4 files changed, 840 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 2766e0cc10..2aa28141e7 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -6894,12 +6894,20 @@ test_snow3g_decryption_with_digest_test_case_1(void) static int test_snow3g_cipher_auth_test_case_1(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_cipher_auth(&snow3g_test_case_3); } static int test_snow3g_auth_cipher_test_case_1(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher( &snow3g_auth_cipher_test_case_1, IN_PLACE, 0); } @@ -6907,6 +6915,10 @@ test_snow3g_auth_cipher_test_case_1(void) static int test_snow3g_auth_cipher_test_case_2(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher( &snow3g_auth_cipher_test_case_2, IN_PLACE, 0); } @@ -6914,6 +6926,10 @@ test_snow3g_auth_cipher_test_case_2(void) static int test_snow3g_auth_cipher_test_case_2_oop(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher( &snow3g_auth_cipher_test_case_2, OUT_OF_PLACE, 0); } @@ -6921,6 +6937,10 @@ test_snow3g_auth_cipher_test_case_2_oop(void) static int test_snow3g_auth_cipher_part_digest_enc(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher( &snow3g_auth_cipher_partial_digest_encryption, IN_PLACE, 0); @@ -6929,6 +6949,10 @@ test_snow3g_auth_cipher_part_digest_enc(void) static int test_snow3g_auth_cipher_part_digest_enc_oop(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher( &snow3g_auth_cipher_partial_digest_encryption, OUT_OF_PLACE, 0); @@ -6940,6 +6964,10 @@ test_snow3g_auth_cipher_test_case_3_sgl(void) /* rte_crypto_mbuf_to_vec does not support incomplete mbuf build */ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) return TEST_SKIPPED; + else if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher_sgl( &snow3g_auth_cipher_test_case_3, IN_PLACE, 0); } @@ -6947,6 +6975,10 @@ test_snow3g_auth_cipher_test_case_3_sgl(void) static int test_snow3g_auth_cipher_test_case_3_oop_sgl(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher_sgl( &snow3g_auth_cipher_test_case_3, OUT_OF_PLACE, 0); } @@ -6957,6 +6989,10 @@ test_snow3g_auth_cipher_part_digest_enc_sgl(void) /* rte_crypto_mbuf_to_vec does not support incomplete mbuf build */ if (global_api_test_type == CRYPTODEV_RAW_API_TEST) return TEST_SKIPPED; + else if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher_sgl( &snow3g_auth_cipher_partial_digest_encryption, IN_PLACE, 0); @@ -6965,14 +7001,57 @@ test_snow3g_auth_cipher_part_digest_enc_sgl(void) static int test_snow3g_auth_cipher_part_digest_enc_oop_sgl(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher_sgl( &snow3g_auth_cipher_partial_digest_encryption, OUT_OF_PLACE, 0); } +static int +test_snow3g_auth_cipher_total_digest_enc_1(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_1, IN_PLACE, 0); +} + +static int +test_snow3g_auth_cipher_total_digest_enc_2(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_2, IN_PLACE, 0); +} + +static int +test_snow3g_auth_cipher_total_digest_enc_2_oop(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_2, OUT_OF_PLACE, 0); +} + +static int +test_snow3g_auth_cipher_total_digest_enc_2_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_2, IN_PLACE, 0); +} + +static int +test_snow3g_auth_cipher_total_digest_enc_2_oop_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_2, OUT_OF_PLACE, 0); +} + static int test_snow3g_auth_cipher_verify_test_case_1(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher( &snow3g_auth_cipher_test_case_1, IN_PLACE, 1); } @@ -6980,6 +7059,10 @@ test_snow3g_auth_cipher_verify_test_case_1(void) static int test_snow3g_auth_cipher_verify_test_case_2(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher( &snow3g_auth_cipher_test_case_2, IN_PLACE, 1); } @@ -6987,6 +7070,10 @@ test_snow3g_auth_cipher_verify_test_case_2(void) static int test_snow3g_auth_cipher_verify_test_case_2_oop(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher( &snow3g_auth_cipher_test_case_2, OUT_OF_PLACE, 1); } @@ -6994,6 +7081,10 @@ test_snow3g_auth_cipher_verify_test_case_2_oop(void) static int test_snow3g_auth_cipher_verify_part_digest_enc(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher( &snow3g_auth_cipher_partial_digest_encryption, IN_PLACE, 1); @@ -7002,6 +7093,10 @@ test_snow3g_auth_cipher_verify_part_digest_enc(void) static int test_snow3g_auth_cipher_verify_part_digest_enc_oop(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher( &snow3g_auth_cipher_partial_digest_encryption, OUT_OF_PLACE, 1); @@ -7010,6 +7105,10 @@ test_snow3g_auth_cipher_verify_part_digest_enc_oop(void) static int test_snow3g_auth_cipher_verify_test_case_3_sgl(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher_sgl( &snow3g_auth_cipher_test_case_3, IN_PLACE, 1); } @@ -7017,6 +7116,10 @@ test_snow3g_auth_cipher_verify_test_case_3_sgl(void) static int test_snow3g_auth_cipher_verify_test_case_3_oop_sgl(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher_sgl( &snow3g_auth_cipher_test_case_3, OUT_OF_PLACE, 1); } @@ -7024,6 +7127,10 @@ test_snow3g_auth_cipher_verify_test_case_3_oop_sgl(void) static int test_snow3g_auth_cipher_verify_part_digest_enc_sgl(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher_sgl( &snow3g_auth_cipher_partial_digest_encryption, IN_PLACE, 1); @@ -7032,14 +7139,57 @@ test_snow3g_auth_cipher_verify_part_digest_enc_sgl(void) static int test_snow3g_auth_cipher_verify_part_digest_enc_oop_sgl(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher_sgl( &snow3g_auth_cipher_partial_digest_encryption, OUT_OF_PLACE, 1); } +static int +test_snow3g_auth_cipher_verify_total_digest_enc_1(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_1, IN_PLACE, 1); +} + +static int +test_snow3g_auth_cipher_verify_total_digest_enc_2(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_2, IN_PLACE, 1); +} + +static int +test_snow3g_auth_cipher_verify_total_digest_enc_2_oop(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_2, OUT_OF_PLACE, 1); +} + +static int +test_snow3g_auth_cipher_verify_total_digest_enc_2_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_2, IN_PLACE, 1); +} + +static int +test_snow3g_auth_cipher_verify_total_digest_enc_2_oop_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_2, OUT_OF_PLACE, 1); +} + static int test_snow3g_auth_cipher_with_digest_test_case_1(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_snow3g_auth_cipher( &snow3g_test_case_7, IN_PLACE, 0); } @@ -7237,6 +7387,10 @@ test_zuc_cipher_auth_test_case_2(void) static int test_zuc_auth_cipher_test_case_1(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_zuc_auth_cipher( &zuc_auth_cipher_test_case_1, IN_PLACE, 0); } @@ -7244,6 +7398,10 @@ test_zuc_auth_cipher_test_case_1(void) static int test_zuc_auth_cipher_test_case_1_oop(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_zuc_auth_cipher( &zuc_auth_cipher_test_case_1, OUT_OF_PLACE, 0); } @@ -7251,6 +7409,10 @@ test_zuc_auth_cipher_test_case_1_oop(void) static int test_zuc_auth_cipher_test_case_1_sgl(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_zuc_auth_cipher_sgl( &zuc_auth_cipher_test_case_1, IN_PLACE, 0); } @@ -7258,13 +7420,35 @@ test_zuc_auth_cipher_test_case_1_sgl(void) static int test_zuc_auth_cipher_test_case_1_oop_sgl(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_zuc_auth_cipher_sgl( &zuc_auth_cipher_test_case_1, OUT_OF_PLACE, 0); } +static int +test_zuc_auth_cipher_test_case_2(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, IN_PLACE, 0); +} + +static int +test_zuc_auth_cipher_test_case_2_oop(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, OUT_OF_PLACE, 0); +} + static int test_zuc_auth_cipher_verify_test_case_1(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_zuc_auth_cipher( &zuc_auth_cipher_test_case_1, IN_PLACE, 1); } @@ -7272,6 +7456,10 @@ test_zuc_auth_cipher_verify_test_case_1(void) static int test_zuc_auth_cipher_verify_test_case_1_oop(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_zuc_auth_cipher( &zuc_auth_cipher_test_case_1, OUT_OF_PLACE, 1); } @@ -7279,6 +7467,10 @@ test_zuc_auth_cipher_verify_test_case_1_oop(void) static int test_zuc_auth_cipher_verify_test_case_1_sgl(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_zuc_auth_cipher_sgl( &zuc_auth_cipher_test_case_1, IN_PLACE, 1); } @@ -7286,10 +7478,28 @@ test_zuc_auth_cipher_verify_test_case_1_sgl(void) static int test_zuc_auth_cipher_verify_test_case_1_oop_sgl(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_zuc_auth_cipher_sgl( &zuc_auth_cipher_test_case_1, OUT_OF_PLACE, 1); } +static int +test_zuc_auth_cipher_verify_test_case_2(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, IN_PLACE, 1); +} + +static int +test_zuc_auth_cipher_verify_test_case_2_oop(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, OUT_OF_PLACE, 1); +} + static int test_zuc256_encryption_test_case_1(void) { @@ -7754,6 +7964,10 @@ test_mixed_auth_cipher_sgl(const struct mixed_cipher_auth_test_data *tdata, static int test_aes_cmac_aes_ctr_digest_enc_test_case_1(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_mixed_auth_cipher( &auth_aes_cmac_cipher_aes_ctr_test_case_1, IN_PLACE, 0); } @@ -7761,6 +7975,10 @@ test_aes_cmac_aes_ctr_digest_enc_test_case_1(void) static int test_aes_cmac_aes_ctr_digest_enc_test_case_1_oop(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_mixed_auth_cipher( &auth_aes_cmac_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 0); } @@ -7768,6 +7986,10 @@ test_aes_cmac_aes_ctr_digest_enc_test_case_1_oop(void) static int test_aes_cmac_aes_ctr_digest_enc_test_case_1_sgl(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_mixed_auth_cipher_sgl( &auth_aes_cmac_cipher_aes_ctr_test_case_1, IN_PLACE, 0); } @@ -7775,20 +7997,53 @@ test_aes_cmac_aes_ctr_digest_enc_test_case_1_sgl(void) static int test_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_mixed_auth_cipher_sgl( &auth_aes_cmac_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 0); } +static int +test_aes_cmac_aes_ctr_digest_enc_test_case_2(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, IN_PLACE, 0); +} + +static int +test_aes_cmac_aes_ctr_digest_enc_test_case_2_oop(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, OUT_OF_PLACE, 0); +} + static int test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_mixed_auth_cipher( &auth_aes_cmac_cipher_aes_ctr_test_case_1, IN_PLACE, 1); } +static int +test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, IN_PLACE, 1); +} + static int test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_mixed_auth_cipher( &auth_aes_cmac_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 1); } @@ -7796,6 +8051,10 @@ test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop(void) static int test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_sgl(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_mixed_auth_cipher_sgl( &auth_aes_cmac_cipher_aes_ctr_test_case_1, IN_PLACE, 1); } @@ -7803,10 +8062,21 @@ test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_sgl(void) static int test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl(void) { + if (gbl_driver_id == rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_CN9K_PMD))) + return TEST_SKIPPED; + return test_mixed_auth_cipher_sgl( &auth_aes_cmac_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 1); } +static int +test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2_oop(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, OUT_OF_PLACE, 1); +} + /** MIXED AUTH + CIPHER */ static int @@ -7823,6 +8093,21 @@ test_verify_auth_zuc_cipher_snow_test_case_1(void) &auth_zuc_cipher_snow_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_zuc_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_snow_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_zuc_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_snow_test_case_1, IN_PLACE, 1); +} + + static int test_auth_aes_cmac_cipher_snow_test_case_1(void) { @@ -7837,6 +8122,20 @@ test_verify_auth_aes_cmac_cipher_snow_test_case_1(void) &auth_aes_cmac_cipher_snow_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_aes_cmac_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_snow_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_aes_cmac_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_snow_test_case_1, IN_PLACE, 1); +} + static int test_auth_zuc_cipher_aes_ctr_test_case_1(void) { @@ -7851,6 +8150,20 @@ test_verify_auth_zuc_cipher_aes_ctr_test_case_1(void) &auth_zuc_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_zuc_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_aes_ctr_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_zuc_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_aes_ctr_test_case_1, IN_PLACE, 1); +} + static int test_auth_snow_cipher_aes_ctr_test_case_1(void) { @@ -7865,6 +8178,34 @@ test_verify_auth_snow_cipher_aes_ctr_test_case_1(void) &auth_snow_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl(void) +{ + return test_mixed_auth_cipher_sgl( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 0); +} + +static int +test_auth_snow_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl(void) +{ + return test_mixed_auth_cipher_sgl( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 1); +} + +static int +test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 1); +} + static int test_auth_snow_cipher_zuc_test_case_1(void) { @@ -7879,6 +8220,20 @@ test_verify_auth_snow_cipher_zuc_test_case_1(void) &auth_snow_cipher_zuc_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_snow_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_zuc_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_snow_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_zuc_test_case_1, IN_PLACE, 1); +} + static int test_auth_aes_cmac_cipher_zuc_test_case_1(void) { @@ -7892,6 +8247,19 @@ test_verify_auth_aes_cmac_cipher_zuc_test_case_1(void) return test_mixed_auth_cipher( &auth_aes_cmac_cipher_zuc_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_aes_cmac_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_zuc_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_aes_cmac_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_zuc_test_case_1, IN_PLACE, 1); +} static int test_auth_null_cipher_snow_test_case_1(void) @@ -15796,6 +16164,16 @@ static struct unit_test_suite cryptodev_snow3g_testsuite = { test_snow3g_auth_cipher_part_digest_enc_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_snow3g_auth_cipher_part_digest_enc_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_2_oop), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_2_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_2_oop_sgl), /** SNOW 3G decrypt (UEA2), then verify auth */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -15816,6 +16194,16 @@ static struct unit_test_suite cryptodev_snow3g_testsuite = { test_snow3g_auth_cipher_verify_part_digest_enc_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_snow3g_auth_cipher_verify_part_digest_enc_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_2_oop), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_2_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_2_oop_sgl), /** SNOW 3G decrypt only (UEA2) */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -15924,6 +16312,10 @@ static struct unit_test_suite cryptodev_zuc_testsuite = { test_zuc_auth_cipher_test_case_1_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_zuc_auth_cipher_test_case_1_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_test_case_2_oop), /** ZUC decrypt (EEA3), then verify auth */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -15934,6 +16326,10 @@ static struct unit_test_suite cryptodev_zuc_testsuite = { test_zuc_auth_cipher_verify_test_case_1_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_zuc_auth_cipher_verify_test_case_1_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_verify_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_verify_test_case_2_oop), /** ZUC-256 encrypt only **/ TEST_CASE_ST(ut_setup, ut_teardown, @@ -16137,37 +16533,73 @@ static struct unit_test_suite cryptodev_mixed_cipher_hash_testsuite = { test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_aes_cmac_aes_ctr_digest_enc_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_aes_cmac_aes_ctr_digest_enc_test_case_2_oop), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2_oop), /** AUTH ZUC + CIPHER SNOW3G */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_zuc_cipher_snow_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_zuc_cipher_snow_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_zuc_cipher_snow_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_zuc_cipher_snow_test_case_1_inplace), /** AUTH AES CMAC + CIPHER SNOW3G */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_aes_cmac_cipher_snow_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_aes_cmac_cipher_snow_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_aes_cmac_cipher_snow_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_aes_cmac_cipher_snow_test_case_1_inplace), /** AUTH ZUC + CIPHER AES CTR */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_zuc_cipher_aes_ctr_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_zuc_cipher_aes_ctr_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_zuc_cipher_aes_ctr_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_zuc_cipher_aes_ctr_test_case_1_inplace), /** AUTH SNOW3G + CIPHER AES CTR */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_snow_cipher_aes_ctr_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_snow_cipher_aes_ctr_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_snow_cipher_aes_ctr_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl), /** AUTH SNOW3G + CIPHER ZUC */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_snow_cipher_zuc_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_snow_cipher_zuc_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_snow_cipher_zuc_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_snow_cipher_zuc_test_case_1_inplace), /** AUTH AES CMAC + CIPHER ZUC */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_aes_cmac_cipher_zuc_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_aes_cmac_cipher_zuc_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_aes_cmac_cipher_zuc_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_aes_cmac_cipher_zuc_test_case_1_inplace), /** AUTH NULL + CIPHER SNOW3G */ TEST_CASE_ST(ut_setup, ut_teardown, diff --git a/app/test/test_cryptodev_mixed_test_vectors.h b/app/test/test_cryptodev_mixed_test_vectors.h index f50dcb0457..2816ecc6a4 100644 --- a/app/test/test_cryptodev_mixed_test_vectors.h +++ b/app/test/test_cryptodev_mixed_test_vectors.h @@ -169,6 +169,200 @@ struct mixed_cipher_auth_test_data auth_aes_cmac_cipher_aes_ctr_test_case_1 = { } }; +struct mixed_cipher_auth_test_data auth_aes_cmac_cipher_aes_ctr_test_case_2 = { + .auth_algo = RTE_CRYPTO_AUTH_AES_CMAC, + .auth_key = { + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16, + }, + .auth_iv = { + .data = { + }, + .len = 0, + }, + .auth = { + .len_bits = 512 << 3, + .offset_bits = 0, + }, + .cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR, + .cipher_key = { + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16, + }, + .cipher_iv = { + .data = { + 0xa9, 0x40, 0x59, 0xda, 0x50, 0x00, 0x00, 0x00, + 0x29, 0x40, 0x59, 0xda, 0x50, 0x00, 0x80, 0x00 + }, + .len = 16, + }, + .cipher = { + .len_bits = 516 << 3, + .offset_bits = 0, + }, + .plaintext = { + .data = { + 0x57, 0x68, 0x61, 0x74, 0x20, 0x61, 0x20, 0x6C, + 0x6F, 0x75, 0x73, 0x79, 0x20, 0x65, 0x61, 0x72, + 0x74, 0x68, 0x21, 0x20, 0x48, 0x65, 0x20, 0x77, + 0x6F, 0x6E, 0x64, 0x65, 0x72, 0x65, 0x64, 0x20, + 0x68, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, 0x79, + 0x20, 0x70, 0x65, 0x6F, 0x70, 0x6C, 0x65, 0x20, + 0x77, 0x65, 0x72, 0x65, 0x20, 0x64, 0x65, 0x73, + 0x74, 0x69, 0x74, 0x75, 0x74, 0x65, 0x20, 0x74, + 0x68, 0x61, 0x74, 0x20, 0x73, 0x61, 0x6D, 0x65, + 0x20, 0x6E, 0x69, 0x67, 0x68, 0x74, 0x20, 0x65, + 0x76, 0x65, 0x6E, 0x20, 0x69, 0x6E, 0x20, 0x68, + 0x69, 0x73, 0x20, 0x6F, 0x77, 0x6E, 0x20, 0x70, + 0x72, 0x6F, 0x73, 0x70, 0x65, 0x72, 0x6F, 0x75, + 0x73, 0x20, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x72, + 0x79, 0x2C, 0x20, 0x68, 0x6F, 0x77, 0x20, 0x6D, + 0x61, 0x6E, 0x79, 0x20, 0x68, 0x6F, 0x6D, 0x65, + 0x73, 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, 0x73, + 0x68, 0x61, 0x6E, 0x74, 0x69, 0x65, 0x73, 0x2C, + 0x20, 0x68, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, + 0x79, 0x20, 0x68, 0x75, 0x73, 0x62, 0x61, 0x6E, + 0x64, 0x73, 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, + 0x64, 0x72, 0x75, 0x6E, 0x6B, 0x20, 0x61, 0x6E, + 0x64, 0x20, 0x77, 0x69, 0x76, 0x65, 0x73, 0x20, + 0x73, 0x6F, 0x63, 0x6B, 0x65, 0x64, 0x2C, 0x20, + 0x61, 0x6E, 0x64, 0x20, 0x68, 0x6F, 0x77, 0x20, + 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x63, 0x68, 0x69, + 0x6C, 0x64, 0x72, 0x65, 0x6E, 0x20, 0x77, 0x65, + 0x72, 0x65, 0x20, 0x62, 0x75, 0x6C, 0x6C, 0x69, + 0x65, 0x64, 0x2C, 0x20, 0x61, 0x62, 0x75, 0x73, + 0x65, 0x64, 0x2C, 0x20, 0x6F, 0x72, 0x20, 0x61, + 0x62, 0x61, 0x6E, 0x64, 0x6F, 0x6E, 0x65, 0x64, + 0x2E, 0x20, 0x48, 0x6F, 0x77, 0x20, 0x6D, 0x61, + 0x6E, 0x79, 0x20, 0x66, 0x61, 0x6D, 0x69, 0x6C, + 0x69, 0x65, 0x73, 0x20, 0x68, 0x75, 0x6E, 0x67, + 0x65, 0x72, 0x65, 0x64, 0x20, 0x66, 0x6F, 0x72, + 0x20, 0x66, 0x6F, 0x6F, 0x64, 0x20, 0x74, 0x68, + 0x65, 0x79, 0x20, 0x63, 0x6F, 0x75, 0x6C, 0x64, + 0x20, 0x6E, 0x6F, 0x74, 0x20, 0x61, 0x66, 0x66, + 0x6F, 0x72, 0x64, 0x20, 0x74, 0x6F, 0x20, 0x62, + 0x75, 0x79, 0x3F, 0x20, 0x48, 0x6F, 0x77, 0x20, + 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x68, 0x65, 0x61, + 0x72, 0x74, 0x73, 0x20, 0x77, 0x65, 0x72, 0x65, + 0x20, 0x62, 0x72, 0x6F, 0x6B, 0x65, 0x6E, 0x3F, + 0x20, 0x48, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, + 0x79, 0x20, 0x73, 0x75, 0x69, 0x63, 0x69, 0x64, + 0x65, 0x73, 0x20, 0x77, 0x6F, 0x75, 0x6C, 0x64, + 0x20, 0x74, 0x61, 0x6B, 0x65, 0x20, 0x70, 0x6C, + 0x61, 0x63, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, + 0x20, 0x73, 0x61, 0x6D, 0x65, 0x20, 0x6E, 0x69, + 0x67, 0x68, 0x74, 0x2C, 0x20, 0x68, 0x6F, 0x77, + 0x20, 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x70, 0x65, + 0x6F, 0x70, 0x6C, 0x65, 0x20, 0x77, 0x6F, 0x75, + 0x6C, 0x64, 0x20, 0x67, 0x6F, 0x20, 0x69, 0x6E, + 0x73, 0x61, 0x6E, 0x65, 0x3F, 0x20, 0x48, 0x6F, + 0x77, 0x20, 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x63, + 0x6F, 0x63, 0x6B, 0x72, 0x6F, 0x61, 0x63, 0x68, + 0x65, 0x73, 0x20, 0x61, 0x6E, 0x64, 0x20, 0x6C, + 0x61, 0x6E, 0x64, 0x6C, 0x6F, 0x72, 0x64, 0x73, + 0x20, 0x77, 0x6F, 0x75, 0x6C, 0x64, 0x20, 0x74, + 0x72, 0x69, 0x75, 0x6D, 0x70, 0x68, 0x3F, 0x20, + 0x48, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, 0x79, + 0x20, 0x77, 0x69, 0x6E, 0x6E, 0x65, 0x72, 0x73, + 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, 0x6C, 0x6F, + 0x73, 0x65, 0x72, 0x73, 0x2C, 0x20, 0x73, 0x75 + }, + .len_bits = 512 << 3, + }, + .ciphertext = { + .data = { + 0xA5, 0xC3, 0xEC, 0xC5, 0x14, 0x36, 0xC8, 0x00, + 0x6E, 0xA6, 0xAD, 0xFB, 0x1C, 0x4F, 0x60, 0x6C, + 0x60, 0xC0, 0x9C, 0x00, 0xED, 0xC0, 0x2A, 0xD8, + 0x41, 0xD3, 0x44, 0x27, 0xE6, 0x1A, 0x6E, 0xB3, + 0x9C, 0x5E, 0x3C, 0x71, 0x19, 0x96, 0x13, 0xED, + 0x06, 0xCA, 0xFB, 0x74, 0x7C, 0x23, 0x3E, 0x54, + 0x49, 0xF1, 0x32, 0xA4, 0xCD, 0xF3, 0x92, 0x33, + 0x22, 0xDB, 0xE0, 0x0D, 0x3F, 0x31, 0xA3, 0x2B, + 0x85, 0x11, 0x41, 0x11, 0x02, 0xE0, 0x2B, 0x0E, + 0x35, 0xDF, 0xE4, 0x03, 0x6B, 0x48, 0x80, 0x4A, + 0xB8, 0x2D, 0xD4, 0xB3, 0x5B, 0xF1, 0xB4, 0xF9, + 0xC9, 0x83, 0x4E, 0x2A, 0x53, 0x92, 0xB2, 0xF6, + 0x0C, 0xBA, 0xC4, 0x94, 0x8E, 0x96, 0x60, 0x26, + 0x4F, 0xA1, 0x85, 0xC6, 0x31, 0x57, 0xAE, 0xC3, + 0x8C, 0x09, 0x1B, 0xDB, 0xC1, 0x0D, 0x0E, 0xCE, + 0xB9, 0xE9, 0x30, 0x5E, 0x51, 0x9C, 0xE4, 0xC5, + 0xDC, 0xC0, 0x4A, 0xD9, 0x1B, 0xBE, 0xCF, 0x0A, + 0x95, 0xA1, 0x78, 0xDD, 0xE0, 0x46, 0x90, 0xC8, + 0xFF, 0xAE, 0x38, 0x1E, 0xAF, 0x5C, 0x57, 0xED, + 0x20, 0x49, 0xED, 0x54, 0x57, 0xBA, 0x65, 0xAD, + 0xC1, 0x2B, 0xD3, 0xEF, 0x97, 0x1F, 0x27, 0xBE, + 0x8E, 0x98, 0x2C, 0x4B, 0xDF, 0x11, 0x77, 0xB9, + 0x7D, 0x89, 0x0D, 0x28, 0xE3, 0x8B, 0x09, 0xAF, + 0x85, 0xCE, 0x0F, 0x49, 0xD5, 0x8E, 0xF2, 0xF2, + 0xF9, 0x4C, 0xE0, 0xF0, 0x9B, 0xD0, 0x42, 0x07, + 0xBC, 0xD4, 0x8E, 0x78, 0xCD, 0x4D, 0x6D, 0x12, + 0xB2, 0x8D, 0x4C, 0xCB, 0x44, 0x2A, 0xA2, 0x4C, + 0xD7, 0x15, 0xFA, 0xB1, 0x05, 0xB9, 0xFF, 0x95, + 0x29, 0xF7, 0xA6, 0xFC, 0x25, 0x74, 0xF6, 0x9E, + 0x01, 0xFE, 0x4C, 0xFD, 0x50, 0xD8, 0xF6, 0x4C, + 0xDF, 0x75, 0xEF, 0xAF, 0x04, 0x84, 0x95, 0x15, + 0x33, 0x6D, 0x8E, 0x0A, 0x89, 0xE0, 0x20, 0x2E, + 0xC2, 0x0E, 0xE1, 0x91, 0xB9, 0x06, 0x34, 0x14, + 0xD4, 0x65, 0x68, 0x72, 0x5C, 0x60, 0x09, 0x2C, + 0x8A, 0x82, 0x4A, 0x04, 0x71, 0xB8, 0xDF, 0x45, + 0x3C, 0x21, 0x24, 0x06, 0x34, 0xD0, 0xE3, 0xA7, + 0x82, 0x25, 0xAB, 0x7B, 0xDD, 0x6D, 0xCC, 0xAE, + 0x01, 0xB1, 0xD6, 0x2A, 0xE2, 0x96, 0x6C, 0x65, + 0x94, 0xDB, 0xB5, 0x0F, 0xCD, 0xC9, 0xA6, 0x01, + 0x5C, 0x89, 0x59, 0x6C, 0x10, 0x4C, 0xA3, 0xBC, + 0x9A, 0x4F, 0x11, 0xEB, 0x54, 0xE0, 0x3B, 0x83, + 0x9C, 0x5E, 0x16, 0x0D, 0xD6, 0x2C, 0x4B, 0x6F, + 0xE6, 0xB9, 0xF6, 0x02, 0x6C, 0x34, 0x0C, 0x4D, + 0xEE, 0xF0, 0x42, 0xC3, 0x0C, 0xDE, 0x93, 0x8A, + 0xC1, 0xB5, 0xEF, 0xCF, 0x54, 0x9C, 0x3B, 0x4B, + 0x70, 0x6C, 0x06, 0x97, 0x3E, 0x26, 0x8C, 0x61, + 0x52, 0x47, 0xF6, 0x9C, 0x28, 0x5C, 0xD1, 0x4A, + 0x67, 0x4B, 0xCD, 0xD9, 0xA1, 0x8C, 0x29, 0x31, + 0x10, 0x71, 0x45, 0x68, 0x63, 0xCE, 0xC9, 0xBC, + 0x46, 0x6A, 0x81, 0x02, 0x4D, 0x66, 0xA4, 0x65, + 0xCC, 0x33, 0xEC, 0x99, 0x14, 0x4D, 0x28, 0xAB, + 0xF6, 0xCB, 0x46, 0x13, 0x0C, 0x13, 0x74, 0x22, + 0x4A, 0x7B, 0x53, 0x2F, 0x11, 0x54, 0xAF, 0xD9, + 0x2D, 0x66, 0x98, 0x7E, 0x20, 0x57, 0x01, 0x4C, + 0xF7, 0x0C, 0xCB, 0x70, 0xFF, 0x3D, 0xC4, 0x5F, + 0x3A, 0xAE, 0xD9, 0xC6, 0x93, 0xFC, 0x2C, 0x23, + 0x4C, 0x43, 0x92, 0x9B, 0x92, 0x3E, 0x35, 0xB7, + 0x1E, 0x96, 0xED, 0xCC, 0x60, 0xDE, 0x2E, 0x19, + 0xB8, 0x24, 0x55, 0x1E, 0x52, 0xB9, 0x52, 0x3C, + 0xC0, 0x06, 0x74, 0xC0, 0xEE, 0xD1, 0xA1, 0x80, + 0x98, 0xE8, 0xDF, 0x0D, 0x8A, 0x44, 0xC2, 0x36, + 0x16, 0xCC, 0x03, 0x68, 0xD9, 0xC2, 0xCF, 0xE2, + 0x78, 0xBD, 0x1A, 0x31, 0x19, 0x5D, 0xE0, 0x6E, + 0x09, 0x6E, 0xD5, 0x17, 0xB8, 0xA8, 0xF4, 0xBE, + 0x2C, 0xD6, 0xD1, 0x04 + }, + .len_bits = 516 << 3, + }, + .digest_enc = { + .data = { + 0x2C, 0xD6, 0xD1, 0x04 + }, + .len = 4, + .offset = 512, + }, + .validDataLen = { + .len_bits = 516 << 3, + }, + .validCipherLen = { + .len_bits = 516 << 3, + }, + .validAuthLen = { + .len_bits = 512 << 3, + } +}; + struct mixed_cipher_auth_test_data auth_zuc_cipher_snow_test_case_1 = { .auth_algo = RTE_CRYPTO_AUTH_ZUC_EIA3, .auth_key = { diff --git a/app/test/test_cryptodev_snow3g_test_vectors.h b/app/test/test_cryptodev_snow3g_test_vectors.h index bbe05662be..cdc86a81cc 100644 --- a/app/test/test_cryptodev_snow3g_test_vectors.h +++ b/app/test/test_cryptodev_snow3g_test_vectors.h @@ -736,4 +736,141 @@ struct snow3g_test_data snow3g_auth_cipher_partial_digest_encryption = { }, }; +struct snow3g_test_data snow3g_auth_cipher_total_digest_encryption_1 = { + .key = { + .data = { + 0xC7, 0x36, 0xC6, 0xAA, 0xB2, 0x2B, 0xFF, 0xF9, + 0x1E, 0x26, 0x98, 0xD2, 0xE2, 0x2A, 0xD5, 0x7E + }, + .len = 16 + }, + .cipher_iv = { + .data = { + 0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD, + 0x94, 0x79, 0x3E, 0x41, 0x03, 0x97, 0x68, 0xFD + }, + .len = 16 + }, + .auth_iv = { + .data = { + 0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD, + 0x94, 0x79, 0x3E, 0x41, 0x03, 0x97, 0x68, 0xFD + }, + .len = 16 + }, + .plaintext = { + .data = { + 0xD0, 0xA7, 0xD4, 0x63, 0xDF, 0x9F, 0xB2, 0xB2, + 0x78, 0x83, 0x3F, 0xA0, 0x2E, 0x23, 0x5A, 0xA1, + 0x72, 0xBD, 0x97, 0x0C, 0x14, 0x73, 0xE1, 0x29, + 0x07, 0xFB, 0x64, 0x8B, 0x65, 0x99, 0xAA, 0xA0, + 0xB2, 0x4A, 0x03, 0x86, 0x65, 0x42, 0x2B, 0x20, + 0xA4, 0x99, 0x27, 0x6A, 0x50, 0x42, 0x70, 0x09, + }, + .len = 384 + }, + .ciphertext = { + .data = { + 0x95, 0x2E, 0x5A, 0xE1, 0x50, 0xB8, 0x59, 0x2A, + 0x9B, 0xA0, 0x38, 0xA9, 0x8E, 0x2F, 0xED, 0xAB, + 0xFD, 0xC8, 0x3B, 0x47, 0x46, 0x0B, 0x50, 0x16, + 0xEC, 0x88, 0x45, 0xB6, 0x05, 0xC7, 0x54, 0xF8, + 0xBD, 0x91, 0xAA, 0xB6, 0xA4, 0xDC, 0x64, 0xB4, + 0xCB, 0xEB, 0x97, 0x06, 0x3B, 0x3E, 0xB6, 0x66 + }, + .len = 384 + }, + .cipher = { + .len_bits = 384, + .offset_bits = 0 + }, + .auth = { + .len_bits = 352, + .offset_bits = 0 + }, + .digest = { + .data = { + 0x3B, 0x3E, 0xB6, 0x66 + }, + .len = 4, + .offset_bytes = 44 + }, + .validDataLenInBits = { + .len = 384 + }, + .validCipherLenInBits = { + .len = 384 + }, + .validAuthLenInBits = { + .len = 352 + }, +}; + +struct snow3g_test_data snow3g_auth_cipher_total_digest_encryption_2 = { + .key = { + .data = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 + + }, + .len = 16 + }, + .cipher_iv = { + .data = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 + }, + .len = 16 + }, + .auth_iv = { + .data = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + .len = 16 + }, + .plaintext = { + .data = { + 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, + 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, + 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, + 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, + }, + .len = 32 << 3 + }, + .ciphertext = { + .data = { + 0x5A, 0x5A, 0xE4, 0xAD, 0x29, 0xA2, 0x6A, 0xA6, + 0x20, 0x1D, 0xCD, 0x08, 0x50, 0xD6, 0xE6, 0x47, + 0xBC, 0x88, 0x08, 0x01, 0x17, 0xFA, 0x47, 0x5B, + 0x90, 0x40, 0xBA, 0x0C, 0xE7, 0x31, 0x5B, 0x79, + }, + .len = 32 << 3 + }, + .cipher = { + .len_bits = 30 << 3, + .offset_bits = 2 << 3 + }, + .auth = { + .len_bits = 26 << 3, + .offset_bits = 2 << 3 + }, + .digest = { + .data = { + 0xE7, 0x31, 0x5B, 0x79 + }, + .len = 4, + .offset_bytes = 28 + }, + .validDataLenInBits = { + .len = 32 << 3 + }, + .validCipherLenInBits = { + .len = 30 << 3 + }, + .validAuthLenInBits = { + .len = 26 << 3 + }, +}; + #endif /* TEST_CRYPTODEV_SNOW3G_TEST_VECTORS_H_ */ diff --git a/app/test/test_cryptodev_zuc_test_vectors.h b/app/test/test_cryptodev_zuc_test_vectors.h index 5d1d264579..a95699631a 100644 --- a/app/test/test_cryptodev_zuc_test_vectors.h +++ b/app/test/test_cryptodev_zuc_test_vectors.h @@ -1239,6 +1239,83 @@ struct wireless_test_data zuc_auth_cipher_test_case_1 = { } }; +struct wireless_test_data zuc_auth_cipher_test_case_2 = { + .key = { + .data = { + 0xE5, 0xBD, 0x3E, 0xA0, 0xEB, 0x55, 0xAD, 0xE8, + 0x66, 0xC6, 0xAC, 0x58, 0xBD, 0x54, 0x30, 0x2A + }, + .len = 16 + }, + .cipher_iv = { + .data = { + 0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00 + }, + .len = 16 + }, + .auth_iv = { + .data = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + .len = 16 + }, + .plaintext = { + .data = { + 0x14, 0xA8, 0xEF, 0x69, 0x3D, 0x67, 0x85, 0x07, + 0xBB, 0xE7, 0x27, 0x0A, 0x7F, 0x67, 0xFF, 0x50, + 0x06, 0xC3, 0x52, 0x5B, 0x98, 0x07, 0xE4, 0x67, + 0xC4, 0xE5, 0x60, 0x00, 0xBA, 0x33, 0x8F, 0x5D, + 0x42, 0x95, 0x59, 0x03, 0x67, 0x51, 0x82, 0x22, + 0x46, 0xC8, 0x0D, 0x3B, 0x38, 0xF0, 0x7F, 0x4B, + 0xE2, 0xD8, 0xFF, 0x58, 0x05, 0xF5, 0x13, 0x22, + 0x29, 0xBD, 0xE9, 0x3B, 0xBB, 0xDC, 0xAF, 0x38, + 0x2B, 0xF1, 0xEE, 0x97, 0x2F, 0xBF, 0x99, 0x77, + 0xBA, 0xDA, 0x89, 0x45, 0x84, 0x7A, 0x2A, 0x6C, + 0x9A, 0xD3, 0x4A, 0x66, 0x75, 0x54, 0xE0, 0x4D, + 0x1F, 0x7F, 0xA2, 0xC3, 0x32, 0x41, 0xBD, 0x8F, + 0x01, 0xBA, 0x22, 0x0D + }, + .len = 96 << 3 + }, + .ciphertext = { + .data = { + 0x13, 0x1D, 0x43, 0xE0, 0xDE, 0xA1, 0xBE, 0x5C, + 0x5A, 0x1B, 0xFD, 0x97, 0x1D, 0x85, 0x2C, 0xBF, + 0x71, 0x2D, 0x7B, 0x4F, 0x57, 0x96, 0x1F, 0xEA, + 0x32, 0x08, 0xAF, 0xA8, 0xBC, 0xA4, 0x33, 0xF4, + 0x56, 0xAD, 0x09, 0xC7, 0x41, 0x7E, 0x58, 0xBC, + 0x69, 0xCF, 0x88, 0x66, 0xD1, 0x35, 0x3F, 0x74, + 0x86, 0x5E, 0x80, 0x78, 0x1D, 0x20, 0x2D, 0xFB, + 0x3E, 0xCF, 0xF7, 0xFC, 0xBC, 0x3B, 0x19, 0x0F, + 0xE8, 0x2A, 0x20, 0x4E, 0xD0, 0xE3, 0x50, 0xFC, + 0x0F, 0x6F, 0x26, 0x13, 0xB2, 0xF2, 0xBC, 0xA6, + 0xDF, 0x5A, 0x47, 0x3A, 0x57, 0xA4, 0xA0, 0x0D, + 0x98, 0x5E, 0xBA, 0xD8, 0x80, 0xD6, 0xF2, 0x38, + 0x5A, 0xEC, 0x5A, 0x35 + }, + .len = 800 + }, + .validDataLenInBits = { + .len = 800 + }, + .validCipherLenInBits = { + .len = 800 + }, + .validAuthLenInBits = { + .len = 96 << 3 + }, + .validCipherOffsetInBits = { + .len = 0 + }, + .digest = { + .data = { 0x5A, 0xEC, 0x5A, 0x35 }, + .len = 4, + .offset_bytes = 96 + } +}; + /** ZUC-256 vectors **/ static struct wireless_test_data zuc256_test_case_cipher_1 = { .key = { -- 2.25.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2] app/test: add additional stream cipher tests 2022-06-17 7:36 ` [PATCH 4/4] app/test: add additional stream cipher tests Tejasree Kondoj @ 2022-06-20 12:30 ` Tejasree Kondoj 2022-06-21 12:51 ` Akhil Goyal 2022-06-23 13:41 ` [PATCH v3] " Tejasree Kondoj 0 siblings, 2 replies; 13+ messages in thread From: Tejasree Kondoj @ 2022-06-20 12:30 UTC (permalink / raw) To: Akhil Goyal, Fan Zhang; +Cc: Anoob Joseph, Ankur Dwivedi, dev Adding zuc, snow3g and aes-ctr-cmac auth-cipher test vectors with same auth and cipher offsets and total digest data encrypted. Existing tests have different cipher and auth offsets and partial or no digest encrypted. Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com> --- v2: * Removed cn9k PMD checks app/test/test_cryptodev.c | 288 ++++++++++++++++++ app/test/test_cryptodev_mixed_test_vectors.h | 194 ++++++++++++ app/test/test_cryptodev_snow3g_test_vectors.h | 137 +++++++++ app/test/test_cryptodev_zuc_test_vectors.h | 77 +++++ 4 files changed, 696 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 2766e0cc10..d7c7d50233 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -6970,6 +6970,41 @@ test_snow3g_auth_cipher_part_digest_enc_oop_sgl(void) OUT_OF_PLACE, 0); } +static int +test_snow3g_auth_cipher_total_digest_enc_1(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_1, IN_PLACE, 0); +} + +static int +test_snow3g_auth_cipher_total_digest_enc_2(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_2, IN_PLACE, 0); +} + +static int +test_snow3g_auth_cipher_total_digest_enc_2_oop(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_2, OUT_OF_PLACE, 0); +} + +static int +test_snow3g_auth_cipher_total_digest_enc_2_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_2, IN_PLACE, 0); +} + +static int +test_snow3g_auth_cipher_total_digest_enc_2_oop_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_2, OUT_OF_PLACE, 0); +} + static int test_snow3g_auth_cipher_verify_test_case_1(void) { @@ -7037,6 +7072,41 @@ test_snow3g_auth_cipher_verify_part_digest_enc_oop_sgl(void) OUT_OF_PLACE, 1); } +static int +test_snow3g_auth_cipher_verify_total_digest_enc_1(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_1, IN_PLACE, 1); +} + +static int +test_snow3g_auth_cipher_verify_total_digest_enc_2(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_2, IN_PLACE, 1); +} + +static int +test_snow3g_auth_cipher_verify_total_digest_enc_2_oop(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_2, OUT_OF_PLACE, 1); +} + +static int +test_snow3g_auth_cipher_verify_total_digest_enc_2_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_2, IN_PLACE, 1); +} + +static int +test_snow3g_auth_cipher_verify_total_digest_enc_2_oop_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_2, OUT_OF_PLACE, 1); +} + static int test_snow3g_auth_cipher_with_digest_test_case_1(void) { @@ -7262,6 +7332,20 @@ test_zuc_auth_cipher_test_case_1_oop_sgl(void) &zuc_auth_cipher_test_case_1, OUT_OF_PLACE, 0); } +static int +test_zuc_auth_cipher_test_case_2(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, IN_PLACE, 0); +} + +static int +test_zuc_auth_cipher_test_case_2_oop(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, OUT_OF_PLACE, 0); +} + static int test_zuc_auth_cipher_verify_test_case_1(void) { @@ -7290,6 +7374,20 @@ test_zuc_auth_cipher_verify_test_case_1_oop_sgl(void) &zuc_auth_cipher_test_case_1, OUT_OF_PLACE, 1); } +static int +test_zuc_auth_cipher_verify_test_case_2(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, IN_PLACE, 1); +} + +static int +test_zuc_auth_cipher_verify_test_case_2_oop(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, OUT_OF_PLACE, 1); +} + static int test_zuc256_encryption_test_case_1(void) { @@ -7779,6 +7877,20 @@ test_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl(void) &auth_aes_cmac_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 0); } +static int +test_aes_cmac_aes_ctr_digest_enc_test_case_2(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, IN_PLACE, 0); +} + +static int +test_aes_cmac_aes_ctr_digest_enc_test_case_2_oop(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, OUT_OF_PLACE, 0); +} + static int test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1(void) { @@ -7786,6 +7898,13 @@ test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1(void) &auth_aes_cmac_cipher_aes_ctr_test_case_1, IN_PLACE, 1); } +static int +test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, IN_PLACE, 1); +} + static int test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop(void) { @@ -7807,6 +7926,13 @@ test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl(void) &auth_aes_cmac_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 1); } +static int +test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2_oop(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, OUT_OF_PLACE, 1); +} + /** MIXED AUTH + CIPHER */ static int @@ -7823,6 +7949,21 @@ test_verify_auth_zuc_cipher_snow_test_case_1(void) &auth_zuc_cipher_snow_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_zuc_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_snow_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_zuc_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_snow_test_case_1, IN_PLACE, 1); +} + + static int test_auth_aes_cmac_cipher_snow_test_case_1(void) { @@ -7837,6 +7978,20 @@ test_verify_auth_aes_cmac_cipher_snow_test_case_1(void) &auth_aes_cmac_cipher_snow_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_aes_cmac_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_snow_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_aes_cmac_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_snow_test_case_1, IN_PLACE, 1); +} + static int test_auth_zuc_cipher_aes_ctr_test_case_1(void) { @@ -7851,6 +8006,20 @@ test_verify_auth_zuc_cipher_aes_ctr_test_case_1(void) &auth_zuc_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_zuc_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_aes_ctr_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_zuc_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_aes_ctr_test_case_1, IN_PLACE, 1); +} + static int test_auth_snow_cipher_aes_ctr_test_case_1(void) { @@ -7865,6 +8034,34 @@ test_verify_auth_snow_cipher_aes_ctr_test_case_1(void) &auth_snow_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl(void) +{ + return test_mixed_auth_cipher_sgl( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 0); +} + +static int +test_auth_snow_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl(void) +{ + return test_mixed_auth_cipher_sgl( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 1); +} + +static int +test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 1); +} + static int test_auth_snow_cipher_zuc_test_case_1(void) { @@ -7879,6 +8076,20 @@ test_verify_auth_snow_cipher_zuc_test_case_1(void) &auth_snow_cipher_zuc_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_snow_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_zuc_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_snow_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_zuc_test_case_1, IN_PLACE, 1); +} + static int test_auth_aes_cmac_cipher_zuc_test_case_1(void) { @@ -7892,6 +8103,19 @@ test_verify_auth_aes_cmac_cipher_zuc_test_case_1(void) return test_mixed_auth_cipher( &auth_aes_cmac_cipher_zuc_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_aes_cmac_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_zuc_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_aes_cmac_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_zuc_test_case_1, IN_PLACE, 1); +} static int test_auth_null_cipher_snow_test_case_1(void) @@ -15796,6 +16020,16 @@ static struct unit_test_suite cryptodev_snow3g_testsuite = { test_snow3g_auth_cipher_part_digest_enc_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_snow3g_auth_cipher_part_digest_enc_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_2_oop), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_2_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_2_oop_sgl), /** SNOW 3G decrypt (UEA2), then verify auth */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -15816,6 +16050,16 @@ static struct unit_test_suite cryptodev_snow3g_testsuite = { test_snow3g_auth_cipher_verify_part_digest_enc_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_snow3g_auth_cipher_verify_part_digest_enc_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_2_oop), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_2_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_2_oop_sgl), /** SNOW 3G decrypt only (UEA2) */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -15924,6 +16168,10 @@ static struct unit_test_suite cryptodev_zuc_testsuite = { test_zuc_auth_cipher_test_case_1_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_zuc_auth_cipher_test_case_1_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_test_case_2_oop), /** ZUC decrypt (EEA3), then verify auth */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -15934,6 +16182,10 @@ static struct unit_test_suite cryptodev_zuc_testsuite = { test_zuc_auth_cipher_verify_test_case_1_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_zuc_auth_cipher_verify_test_case_1_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_verify_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_verify_test_case_2_oop), /** ZUC-256 encrypt only **/ TEST_CASE_ST(ut_setup, ut_teardown, @@ -16137,37 +16389,73 @@ static struct unit_test_suite cryptodev_mixed_cipher_hash_testsuite = { test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_aes_cmac_aes_ctr_digest_enc_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_aes_cmac_aes_ctr_digest_enc_test_case_2_oop), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2_oop), /** AUTH ZUC + CIPHER SNOW3G */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_zuc_cipher_snow_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_zuc_cipher_snow_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_zuc_cipher_snow_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_zuc_cipher_snow_test_case_1_inplace), /** AUTH AES CMAC + CIPHER SNOW3G */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_aes_cmac_cipher_snow_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_aes_cmac_cipher_snow_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_aes_cmac_cipher_snow_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_aes_cmac_cipher_snow_test_case_1_inplace), /** AUTH ZUC + CIPHER AES CTR */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_zuc_cipher_aes_ctr_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_zuc_cipher_aes_ctr_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_zuc_cipher_aes_ctr_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_zuc_cipher_aes_ctr_test_case_1_inplace), /** AUTH SNOW3G + CIPHER AES CTR */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_snow_cipher_aes_ctr_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_snow_cipher_aes_ctr_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_snow_cipher_aes_ctr_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl), /** AUTH SNOW3G + CIPHER ZUC */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_snow_cipher_zuc_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_snow_cipher_zuc_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_snow_cipher_zuc_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_snow_cipher_zuc_test_case_1_inplace), /** AUTH AES CMAC + CIPHER ZUC */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_aes_cmac_cipher_zuc_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_aes_cmac_cipher_zuc_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_aes_cmac_cipher_zuc_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_aes_cmac_cipher_zuc_test_case_1_inplace), /** AUTH NULL + CIPHER SNOW3G */ TEST_CASE_ST(ut_setup, ut_teardown, diff --git a/app/test/test_cryptodev_mixed_test_vectors.h b/app/test/test_cryptodev_mixed_test_vectors.h index f50dcb0457..2816ecc6a4 100644 --- a/app/test/test_cryptodev_mixed_test_vectors.h +++ b/app/test/test_cryptodev_mixed_test_vectors.h @@ -169,6 +169,200 @@ struct mixed_cipher_auth_test_data auth_aes_cmac_cipher_aes_ctr_test_case_1 = { } }; +struct mixed_cipher_auth_test_data auth_aes_cmac_cipher_aes_ctr_test_case_2 = { + .auth_algo = RTE_CRYPTO_AUTH_AES_CMAC, + .auth_key = { + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16, + }, + .auth_iv = { + .data = { + }, + .len = 0, + }, + .auth = { + .len_bits = 512 << 3, + .offset_bits = 0, + }, + .cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR, + .cipher_key = { + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16, + }, + .cipher_iv = { + .data = { + 0xa9, 0x40, 0x59, 0xda, 0x50, 0x00, 0x00, 0x00, + 0x29, 0x40, 0x59, 0xda, 0x50, 0x00, 0x80, 0x00 + }, + .len = 16, + }, + .cipher = { + .len_bits = 516 << 3, + .offset_bits = 0, + }, + .plaintext = { + .data = { + 0x57, 0x68, 0x61, 0x74, 0x20, 0x61, 0x20, 0x6C, + 0x6F, 0x75, 0x73, 0x79, 0x20, 0x65, 0x61, 0x72, + 0x74, 0x68, 0x21, 0x20, 0x48, 0x65, 0x20, 0x77, + 0x6F, 0x6E, 0x64, 0x65, 0x72, 0x65, 0x64, 0x20, + 0x68, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, 0x79, + 0x20, 0x70, 0x65, 0x6F, 0x70, 0x6C, 0x65, 0x20, + 0x77, 0x65, 0x72, 0x65, 0x20, 0x64, 0x65, 0x73, + 0x74, 0x69, 0x74, 0x75, 0x74, 0x65, 0x20, 0x74, + 0x68, 0x61, 0x74, 0x20, 0x73, 0x61, 0x6D, 0x65, + 0x20, 0x6E, 0x69, 0x67, 0x68, 0x74, 0x20, 0x65, + 0x76, 0x65, 0x6E, 0x20, 0x69, 0x6E, 0x20, 0x68, + 0x69, 0x73, 0x20, 0x6F, 0x77, 0x6E, 0x20, 0x70, + 0x72, 0x6F, 0x73, 0x70, 0x65, 0x72, 0x6F, 0x75, + 0x73, 0x20, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x72, + 0x79, 0x2C, 0x20, 0x68, 0x6F, 0x77, 0x20, 0x6D, + 0x61, 0x6E, 0x79, 0x20, 0x68, 0x6F, 0x6D, 0x65, + 0x73, 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, 0x73, + 0x68, 0x61, 0x6E, 0x74, 0x69, 0x65, 0x73, 0x2C, + 0x20, 0x68, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, + 0x79, 0x20, 0x68, 0x75, 0x73, 0x62, 0x61, 0x6E, + 0x64, 0x73, 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, + 0x64, 0x72, 0x75, 0x6E, 0x6B, 0x20, 0x61, 0x6E, + 0x64, 0x20, 0x77, 0x69, 0x76, 0x65, 0x73, 0x20, + 0x73, 0x6F, 0x63, 0x6B, 0x65, 0x64, 0x2C, 0x20, + 0x61, 0x6E, 0x64, 0x20, 0x68, 0x6F, 0x77, 0x20, + 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x63, 0x68, 0x69, + 0x6C, 0x64, 0x72, 0x65, 0x6E, 0x20, 0x77, 0x65, + 0x72, 0x65, 0x20, 0x62, 0x75, 0x6C, 0x6C, 0x69, + 0x65, 0x64, 0x2C, 0x20, 0x61, 0x62, 0x75, 0x73, + 0x65, 0x64, 0x2C, 0x20, 0x6F, 0x72, 0x20, 0x61, + 0x62, 0x61, 0x6E, 0x64, 0x6F, 0x6E, 0x65, 0x64, + 0x2E, 0x20, 0x48, 0x6F, 0x77, 0x20, 0x6D, 0x61, + 0x6E, 0x79, 0x20, 0x66, 0x61, 0x6D, 0x69, 0x6C, + 0x69, 0x65, 0x73, 0x20, 0x68, 0x75, 0x6E, 0x67, + 0x65, 0x72, 0x65, 0x64, 0x20, 0x66, 0x6F, 0x72, + 0x20, 0x66, 0x6F, 0x6F, 0x64, 0x20, 0x74, 0x68, + 0x65, 0x79, 0x20, 0x63, 0x6F, 0x75, 0x6C, 0x64, + 0x20, 0x6E, 0x6F, 0x74, 0x20, 0x61, 0x66, 0x66, + 0x6F, 0x72, 0x64, 0x20, 0x74, 0x6F, 0x20, 0x62, + 0x75, 0x79, 0x3F, 0x20, 0x48, 0x6F, 0x77, 0x20, + 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x68, 0x65, 0x61, + 0x72, 0x74, 0x73, 0x20, 0x77, 0x65, 0x72, 0x65, + 0x20, 0x62, 0x72, 0x6F, 0x6B, 0x65, 0x6E, 0x3F, + 0x20, 0x48, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, + 0x79, 0x20, 0x73, 0x75, 0x69, 0x63, 0x69, 0x64, + 0x65, 0x73, 0x20, 0x77, 0x6F, 0x75, 0x6C, 0x64, + 0x20, 0x74, 0x61, 0x6B, 0x65, 0x20, 0x70, 0x6C, + 0x61, 0x63, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, + 0x20, 0x73, 0x61, 0x6D, 0x65, 0x20, 0x6E, 0x69, + 0x67, 0x68, 0x74, 0x2C, 0x20, 0x68, 0x6F, 0x77, + 0x20, 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x70, 0x65, + 0x6F, 0x70, 0x6C, 0x65, 0x20, 0x77, 0x6F, 0x75, + 0x6C, 0x64, 0x20, 0x67, 0x6F, 0x20, 0x69, 0x6E, + 0x73, 0x61, 0x6E, 0x65, 0x3F, 0x20, 0x48, 0x6F, + 0x77, 0x20, 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x63, + 0x6F, 0x63, 0x6B, 0x72, 0x6F, 0x61, 0x63, 0x68, + 0x65, 0x73, 0x20, 0x61, 0x6E, 0x64, 0x20, 0x6C, + 0x61, 0x6E, 0x64, 0x6C, 0x6F, 0x72, 0x64, 0x73, + 0x20, 0x77, 0x6F, 0x75, 0x6C, 0x64, 0x20, 0x74, + 0x72, 0x69, 0x75, 0x6D, 0x70, 0x68, 0x3F, 0x20, + 0x48, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, 0x79, + 0x20, 0x77, 0x69, 0x6E, 0x6E, 0x65, 0x72, 0x73, + 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, 0x6C, 0x6F, + 0x73, 0x65, 0x72, 0x73, 0x2C, 0x20, 0x73, 0x75 + }, + .len_bits = 512 << 3, + }, + .ciphertext = { + .data = { + 0xA5, 0xC3, 0xEC, 0xC5, 0x14, 0x36, 0xC8, 0x00, + 0x6E, 0xA6, 0xAD, 0xFB, 0x1C, 0x4F, 0x60, 0x6C, + 0x60, 0xC0, 0x9C, 0x00, 0xED, 0xC0, 0x2A, 0xD8, + 0x41, 0xD3, 0x44, 0x27, 0xE6, 0x1A, 0x6E, 0xB3, + 0x9C, 0x5E, 0x3C, 0x71, 0x19, 0x96, 0x13, 0xED, + 0x06, 0xCA, 0xFB, 0x74, 0x7C, 0x23, 0x3E, 0x54, + 0x49, 0xF1, 0x32, 0xA4, 0xCD, 0xF3, 0x92, 0x33, + 0x22, 0xDB, 0xE0, 0x0D, 0x3F, 0x31, 0xA3, 0x2B, + 0x85, 0x11, 0x41, 0x11, 0x02, 0xE0, 0x2B, 0x0E, + 0x35, 0xDF, 0xE4, 0x03, 0x6B, 0x48, 0x80, 0x4A, + 0xB8, 0x2D, 0xD4, 0xB3, 0x5B, 0xF1, 0xB4, 0xF9, + 0xC9, 0x83, 0x4E, 0x2A, 0x53, 0x92, 0xB2, 0xF6, + 0x0C, 0xBA, 0xC4, 0x94, 0x8E, 0x96, 0x60, 0x26, + 0x4F, 0xA1, 0x85, 0xC6, 0x31, 0x57, 0xAE, 0xC3, + 0x8C, 0x09, 0x1B, 0xDB, 0xC1, 0x0D, 0x0E, 0xCE, + 0xB9, 0xE9, 0x30, 0x5E, 0x51, 0x9C, 0xE4, 0xC5, + 0xDC, 0xC0, 0x4A, 0xD9, 0x1B, 0xBE, 0xCF, 0x0A, + 0x95, 0xA1, 0x78, 0xDD, 0xE0, 0x46, 0x90, 0xC8, + 0xFF, 0xAE, 0x38, 0x1E, 0xAF, 0x5C, 0x57, 0xED, + 0x20, 0x49, 0xED, 0x54, 0x57, 0xBA, 0x65, 0xAD, + 0xC1, 0x2B, 0xD3, 0xEF, 0x97, 0x1F, 0x27, 0xBE, + 0x8E, 0x98, 0x2C, 0x4B, 0xDF, 0x11, 0x77, 0xB9, + 0x7D, 0x89, 0x0D, 0x28, 0xE3, 0x8B, 0x09, 0xAF, + 0x85, 0xCE, 0x0F, 0x49, 0xD5, 0x8E, 0xF2, 0xF2, + 0xF9, 0x4C, 0xE0, 0xF0, 0x9B, 0xD0, 0x42, 0x07, + 0xBC, 0xD4, 0x8E, 0x78, 0xCD, 0x4D, 0x6D, 0x12, + 0xB2, 0x8D, 0x4C, 0xCB, 0x44, 0x2A, 0xA2, 0x4C, + 0xD7, 0x15, 0xFA, 0xB1, 0x05, 0xB9, 0xFF, 0x95, + 0x29, 0xF7, 0xA6, 0xFC, 0x25, 0x74, 0xF6, 0x9E, + 0x01, 0xFE, 0x4C, 0xFD, 0x50, 0xD8, 0xF6, 0x4C, + 0xDF, 0x75, 0xEF, 0xAF, 0x04, 0x84, 0x95, 0x15, + 0x33, 0x6D, 0x8E, 0x0A, 0x89, 0xE0, 0x20, 0x2E, + 0xC2, 0x0E, 0xE1, 0x91, 0xB9, 0x06, 0x34, 0x14, + 0xD4, 0x65, 0x68, 0x72, 0x5C, 0x60, 0x09, 0x2C, + 0x8A, 0x82, 0x4A, 0x04, 0x71, 0xB8, 0xDF, 0x45, + 0x3C, 0x21, 0x24, 0x06, 0x34, 0xD0, 0xE3, 0xA7, + 0x82, 0x25, 0xAB, 0x7B, 0xDD, 0x6D, 0xCC, 0xAE, + 0x01, 0xB1, 0xD6, 0x2A, 0xE2, 0x96, 0x6C, 0x65, + 0x94, 0xDB, 0xB5, 0x0F, 0xCD, 0xC9, 0xA6, 0x01, + 0x5C, 0x89, 0x59, 0x6C, 0x10, 0x4C, 0xA3, 0xBC, + 0x9A, 0x4F, 0x11, 0xEB, 0x54, 0xE0, 0x3B, 0x83, + 0x9C, 0x5E, 0x16, 0x0D, 0xD6, 0x2C, 0x4B, 0x6F, + 0xE6, 0xB9, 0xF6, 0x02, 0x6C, 0x34, 0x0C, 0x4D, + 0xEE, 0xF0, 0x42, 0xC3, 0x0C, 0xDE, 0x93, 0x8A, + 0xC1, 0xB5, 0xEF, 0xCF, 0x54, 0x9C, 0x3B, 0x4B, + 0x70, 0x6C, 0x06, 0x97, 0x3E, 0x26, 0x8C, 0x61, + 0x52, 0x47, 0xF6, 0x9C, 0x28, 0x5C, 0xD1, 0x4A, + 0x67, 0x4B, 0xCD, 0xD9, 0xA1, 0x8C, 0x29, 0x31, + 0x10, 0x71, 0x45, 0x68, 0x63, 0xCE, 0xC9, 0xBC, + 0x46, 0x6A, 0x81, 0x02, 0x4D, 0x66, 0xA4, 0x65, + 0xCC, 0x33, 0xEC, 0x99, 0x14, 0x4D, 0x28, 0xAB, + 0xF6, 0xCB, 0x46, 0x13, 0x0C, 0x13, 0x74, 0x22, + 0x4A, 0x7B, 0x53, 0x2F, 0x11, 0x54, 0xAF, 0xD9, + 0x2D, 0x66, 0x98, 0x7E, 0x20, 0x57, 0x01, 0x4C, + 0xF7, 0x0C, 0xCB, 0x70, 0xFF, 0x3D, 0xC4, 0x5F, + 0x3A, 0xAE, 0xD9, 0xC6, 0x93, 0xFC, 0x2C, 0x23, + 0x4C, 0x43, 0x92, 0x9B, 0x92, 0x3E, 0x35, 0xB7, + 0x1E, 0x96, 0xED, 0xCC, 0x60, 0xDE, 0x2E, 0x19, + 0xB8, 0x24, 0x55, 0x1E, 0x52, 0xB9, 0x52, 0x3C, + 0xC0, 0x06, 0x74, 0xC0, 0xEE, 0xD1, 0xA1, 0x80, + 0x98, 0xE8, 0xDF, 0x0D, 0x8A, 0x44, 0xC2, 0x36, + 0x16, 0xCC, 0x03, 0x68, 0xD9, 0xC2, 0xCF, 0xE2, + 0x78, 0xBD, 0x1A, 0x31, 0x19, 0x5D, 0xE0, 0x6E, + 0x09, 0x6E, 0xD5, 0x17, 0xB8, 0xA8, 0xF4, 0xBE, + 0x2C, 0xD6, 0xD1, 0x04 + }, + .len_bits = 516 << 3, + }, + .digest_enc = { + .data = { + 0x2C, 0xD6, 0xD1, 0x04 + }, + .len = 4, + .offset = 512, + }, + .validDataLen = { + .len_bits = 516 << 3, + }, + .validCipherLen = { + .len_bits = 516 << 3, + }, + .validAuthLen = { + .len_bits = 512 << 3, + } +}; + struct mixed_cipher_auth_test_data auth_zuc_cipher_snow_test_case_1 = { .auth_algo = RTE_CRYPTO_AUTH_ZUC_EIA3, .auth_key = { diff --git a/app/test/test_cryptodev_snow3g_test_vectors.h b/app/test/test_cryptodev_snow3g_test_vectors.h index bbe05662be..cdc86a81cc 100644 --- a/app/test/test_cryptodev_snow3g_test_vectors.h +++ b/app/test/test_cryptodev_snow3g_test_vectors.h @@ -736,4 +736,141 @@ struct snow3g_test_data snow3g_auth_cipher_partial_digest_encryption = { }, }; +struct snow3g_test_data snow3g_auth_cipher_total_digest_encryption_1 = { + .key = { + .data = { + 0xC7, 0x36, 0xC6, 0xAA, 0xB2, 0x2B, 0xFF, 0xF9, + 0x1E, 0x26, 0x98, 0xD2, 0xE2, 0x2A, 0xD5, 0x7E + }, + .len = 16 + }, + .cipher_iv = { + .data = { + 0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD, + 0x94, 0x79, 0x3E, 0x41, 0x03, 0x97, 0x68, 0xFD + }, + .len = 16 + }, + .auth_iv = { + .data = { + 0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD, + 0x94, 0x79, 0x3E, 0x41, 0x03, 0x97, 0x68, 0xFD + }, + .len = 16 + }, + .plaintext = { + .data = { + 0xD0, 0xA7, 0xD4, 0x63, 0xDF, 0x9F, 0xB2, 0xB2, + 0x78, 0x83, 0x3F, 0xA0, 0x2E, 0x23, 0x5A, 0xA1, + 0x72, 0xBD, 0x97, 0x0C, 0x14, 0x73, 0xE1, 0x29, + 0x07, 0xFB, 0x64, 0x8B, 0x65, 0x99, 0xAA, 0xA0, + 0xB2, 0x4A, 0x03, 0x86, 0x65, 0x42, 0x2B, 0x20, + 0xA4, 0x99, 0x27, 0x6A, 0x50, 0x42, 0x70, 0x09, + }, + .len = 384 + }, + .ciphertext = { + .data = { + 0x95, 0x2E, 0x5A, 0xE1, 0x50, 0xB8, 0x59, 0x2A, + 0x9B, 0xA0, 0x38, 0xA9, 0x8E, 0x2F, 0xED, 0xAB, + 0xFD, 0xC8, 0x3B, 0x47, 0x46, 0x0B, 0x50, 0x16, + 0xEC, 0x88, 0x45, 0xB6, 0x05, 0xC7, 0x54, 0xF8, + 0xBD, 0x91, 0xAA, 0xB6, 0xA4, 0xDC, 0x64, 0xB4, + 0xCB, 0xEB, 0x97, 0x06, 0x3B, 0x3E, 0xB6, 0x66 + }, + .len = 384 + }, + .cipher = { + .len_bits = 384, + .offset_bits = 0 + }, + .auth = { + .len_bits = 352, + .offset_bits = 0 + }, + .digest = { + .data = { + 0x3B, 0x3E, 0xB6, 0x66 + }, + .len = 4, + .offset_bytes = 44 + }, + .validDataLenInBits = { + .len = 384 + }, + .validCipherLenInBits = { + .len = 384 + }, + .validAuthLenInBits = { + .len = 352 + }, +}; + +struct snow3g_test_data snow3g_auth_cipher_total_digest_encryption_2 = { + .key = { + .data = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 + + }, + .len = 16 + }, + .cipher_iv = { + .data = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 + }, + .len = 16 + }, + .auth_iv = { + .data = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + .len = 16 + }, + .plaintext = { + .data = { + 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, + 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, + 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, + 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, + }, + .len = 32 << 3 + }, + .ciphertext = { + .data = { + 0x5A, 0x5A, 0xE4, 0xAD, 0x29, 0xA2, 0x6A, 0xA6, + 0x20, 0x1D, 0xCD, 0x08, 0x50, 0xD6, 0xE6, 0x47, + 0xBC, 0x88, 0x08, 0x01, 0x17, 0xFA, 0x47, 0x5B, + 0x90, 0x40, 0xBA, 0x0C, 0xE7, 0x31, 0x5B, 0x79, + }, + .len = 32 << 3 + }, + .cipher = { + .len_bits = 30 << 3, + .offset_bits = 2 << 3 + }, + .auth = { + .len_bits = 26 << 3, + .offset_bits = 2 << 3 + }, + .digest = { + .data = { + 0xE7, 0x31, 0x5B, 0x79 + }, + .len = 4, + .offset_bytes = 28 + }, + .validDataLenInBits = { + .len = 32 << 3 + }, + .validCipherLenInBits = { + .len = 30 << 3 + }, + .validAuthLenInBits = { + .len = 26 << 3 + }, +}; + #endif /* TEST_CRYPTODEV_SNOW3G_TEST_VECTORS_H_ */ diff --git a/app/test/test_cryptodev_zuc_test_vectors.h b/app/test/test_cryptodev_zuc_test_vectors.h index 5d1d264579..a95699631a 100644 --- a/app/test/test_cryptodev_zuc_test_vectors.h +++ b/app/test/test_cryptodev_zuc_test_vectors.h @@ -1239,6 +1239,83 @@ struct wireless_test_data zuc_auth_cipher_test_case_1 = { } }; +struct wireless_test_data zuc_auth_cipher_test_case_2 = { + .key = { + .data = { + 0xE5, 0xBD, 0x3E, 0xA0, 0xEB, 0x55, 0xAD, 0xE8, + 0x66, 0xC6, 0xAC, 0x58, 0xBD, 0x54, 0x30, 0x2A + }, + .len = 16 + }, + .cipher_iv = { + .data = { + 0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00 + }, + .len = 16 + }, + .auth_iv = { + .data = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + .len = 16 + }, + .plaintext = { + .data = { + 0x14, 0xA8, 0xEF, 0x69, 0x3D, 0x67, 0x85, 0x07, + 0xBB, 0xE7, 0x27, 0x0A, 0x7F, 0x67, 0xFF, 0x50, + 0x06, 0xC3, 0x52, 0x5B, 0x98, 0x07, 0xE4, 0x67, + 0xC4, 0xE5, 0x60, 0x00, 0xBA, 0x33, 0x8F, 0x5D, + 0x42, 0x95, 0x59, 0x03, 0x67, 0x51, 0x82, 0x22, + 0x46, 0xC8, 0x0D, 0x3B, 0x38, 0xF0, 0x7F, 0x4B, + 0xE2, 0xD8, 0xFF, 0x58, 0x05, 0xF5, 0x13, 0x22, + 0x29, 0xBD, 0xE9, 0x3B, 0xBB, 0xDC, 0xAF, 0x38, + 0x2B, 0xF1, 0xEE, 0x97, 0x2F, 0xBF, 0x99, 0x77, + 0xBA, 0xDA, 0x89, 0x45, 0x84, 0x7A, 0x2A, 0x6C, + 0x9A, 0xD3, 0x4A, 0x66, 0x75, 0x54, 0xE0, 0x4D, + 0x1F, 0x7F, 0xA2, 0xC3, 0x32, 0x41, 0xBD, 0x8F, + 0x01, 0xBA, 0x22, 0x0D + }, + .len = 96 << 3 + }, + .ciphertext = { + .data = { + 0x13, 0x1D, 0x43, 0xE0, 0xDE, 0xA1, 0xBE, 0x5C, + 0x5A, 0x1B, 0xFD, 0x97, 0x1D, 0x85, 0x2C, 0xBF, + 0x71, 0x2D, 0x7B, 0x4F, 0x57, 0x96, 0x1F, 0xEA, + 0x32, 0x08, 0xAF, 0xA8, 0xBC, 0xA4, 0x33, 0xF4, + 0x56, 0xAD, 0x09, 0xC7, 0x41, 0x7E, 0x58, 0xBC, + 0x69, 0xCF, 0x88, 0x66, 0xD1, 0x35, 0x3F, 0x74, + 0x86, 0x5E, 0x80, 0x78, 0x1D, 0x20, 0x2D, 0xFB, + 0x3E, 0xCF, 0xF7, 0xFC, 0xBC, 0x3B, 0x19, 0x0F, + 0xE8, 0x2A, 0x20, 0x4E, 0xD0, 0xE3, 0x50, 0xFC, + 0x0F, 0x6F, 0x26, 0x13, 0xB2, 0xF2, 0xBC, 0xA6, + 0xDF, 0x5A, 0x47, 0x3A, 0x57, 0xA4, 0xA0, 0x0D, + 0x98, 0x5E, 0xBA, 0xD8, 0x80, 0xD6, 0xF2, 0x38, + 0x5A, 0xEC, 0x5A, 0x35 + }, + .len = 800 + }, + .validDataLenInBits = { + .len = 800 + }, + .validCipherLenInBits = { + .len = 800 + }, + .validAuthLenInBits = { + .len = 96 << 3 + }, + .validCipherOffsetInBits = { + .len = 0 + }, + .digest = { + .data = { 0x5A, 0xEC, 0x5A, 0x35 }, + .len = 4, + .offset_bytes = 96 + } +}; + /** ZUC-256 vectors **/ static struct wireless_test_data zuc256_test_case_cipher_1 = { .key = { -- 2.25.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH v2] app/test: add additional stream cipher tests 2022-06-20 12:30 ` [PATCH v2] " Tejasree Kondoj @ 2022-06-21 12:51 ` Akhil Goyal 2022-06-21 14:27 ` Power, Ciara 2022-06-23 13:41 ` [PATCH v3] " Tejasree Kondoj 1 sibling, 1 reply; 13+ messages in thread From: Akhil Goyal @ 2022-06-21 12:51 UTC (permalink / raw) To: Tejasree Kondoj, Fan Zhang, Ciara Power; +Cc: Anoob Joseph, Ankur Dwivedi, dev > Adding zuc, snow3g and aes-ctr-cmac auth-cipher > test vectors with same auth and cipher offsets > and total digest data encrypted. > Existing tests have different cipher and > auth offsets and partial or no digest encrypted. > > Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com> > --- Acked-by: Akhil Goyal <gakhil@marvell.com> @Ciara Power: Do you have comments on this patch? ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH v2] app/test: add additional stream cipher tests 2022-06-21 12:51 ` Akhil Goyal @ 2022-06-21 14:27 ` Power, Ciara 2022-06-23 6:19 ` Tejasree Kondoj 0 siblings, 1 reply; 13+ messages in thread From: Power, Ciara @ 2022-06-21 14:27 UTC (permalink / raw) To: Akhil Goyal, Tejasree Kondoj, Zhang, Roy Fan Cc: Anoob Joseph, Ankur Dwivedi, dev Hi Tejasree , Akhil, > -----Original Message----- > From: Akhil Goyal <gakhil@marvell.com> > Sent: Tuesday 21 June 2022 13:51 > To: Tejasree Kondoj <ktejasree@marvell.com>; Zhang, Roy Fan > <roy.fan.zhang@intel.com>; Power, Ciara <ciara.power@intel.com> > Cc: Anoob Joseph <anoobj@marvell.com>; Ankur Dwivedi > <adwivedi@marvell.com>; dev@dpdk.org > Subject: RE: [PATCH v2] app/test: add additional stream cipher tests > > > Adding zuc, snow3g and aes-ctr-cmac auth-cipher test vectors with same > > auth and cipher offsets and total digest data encrypted. > > Existing tests have different cipher and auth offsets and partial or > > no digest encrypted. > > > > Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com> > > --- > Acked-by: Akhil Goyal <gakhil@marvell.com> > > @Ciara Power: Do you have comments on this patch? [CP] Tested this patch and there are no fails for QAT, SNOW3G, ZUC, AESNI_MB PMDs (a combination of passed and skipped). One observation is the test vectors don't appear to match the spec for cipher and auth IV - although this seems to occur for other existing auth_cipher vectors I have noticed. This is based on the spec I see here: SNOW3G: https://www.gsma.com/aboutus/wp-content/uploads/2014/12/uea2uia2d1v21.pdf ZUC 128: https://www.gsma.com/security/wp-content/uploads/2019/05/EEA3_EIA3_specification_v1_8.pdf Thanks, Ciara ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH v2] app/test: add additional stream cipher tests 2022-06-21 14:27 ` Power, Ciara @ 2022-06-23 6:19 ` Tejasree Kondoj 0 siblings, 0 replies; 13+ messages in thread From: Tejasree Kondoj @ 2022-06-23 6:19 UTC (permalink / raw) To: Power, Ciara, Akhil Goyal, Zhang, Roy Fan Cc: Anoob Joseph, Ankur Dwivedi, dev Hi Ciara, Thanks for pointing it out. Will rework test vectors and submit new version. Thanks Tejasree > -----Original Message----- > From: Power, Ciara <ciara.power@intel.com> > Sent: Tuesday, June 21, 2022 7:58 PM > To: Akhil Goyal <gakhil@marvell.com>; Tejasree Kondoj > <ktejasree@marvell.com>; Zhang, Roy Fan <roy.fan.zhang@intel.com> > Cc: Anoob Joseph <anoobj@marvell.com>; Ankur Dwivedi > <adwivedi@marvell.com>; dev@dpdk.org > Subject: [EXT] RE: [PATCH v2] app/test: add additional stream cipher tests > > External Email > > ---------------------------------------------------------------------- > Hi Tejasree , Akhil, > > > -----Original Message----- > > From: Akhil Goyal <gakhil@marvell.com> > > Sent: Tuesday 21 June 2022 13:51 > > To: Tejasree Kondoj <ktejasree@marvell.com>; Zhang, Roy Fan > > <roy.fan.zhang@intel.com>; Power, Ciara <ciara.power@intel.com> > > Cc: Anoob Joseph <anoobj@marvell.com>; Ankur Dwivedi > > <adwivedi@marvell.com>; dev@dpdk.org > > Subject: RE: [PATCH v2] app/test: add additional stream cipher tests > > > > > Adding zuc, snow3g and aes-ctr-cmac auth-cipher test vectors with > > > same auth and cipher offsets and total digest data encrypted. > > > Existing tests have different cipher and auth offsets and partial or > > > no digest encrypted. > > > > > > Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com> > > > --- > > Acked-by: Akhil Goyal <gakhil@marvell.com> > > > > @Ciara Power: Do you have comments on this patch? > > [CP] > Tested this patch and there are no fails for QAT, SNOW3G, ZUC, AESNI_MB > PMDs (a combination of passed and skipped). > > One observation is the test vectors don't appear to match the spec for cipher > and auth IV - although this seems to occur for other existing auth_cipher > vectors I have noticed. > This is based on the spec I see here: > SNOW3G: https://urldefense.proofpoint.com/v2/url?u=https- > 3A__www.gsma.com_aboutus_wp- > 2Dcontent_uploads_2014_12_uea2uia2d1v21.pdf&d=DwIFAg&c=nKjWec2b6 > R0mOyPaz7xtfQ&r=NjpqGUAf6Xc0ZLzxCvv4idf8zRFeSJHioNlG1Wif1Gs&m=Lu > QUS0xRBdqoB-HkggX8l2lVEvlN- > 8JUOSqZbNXEzqFISwm_UZLnF8eQabCahkMl&s=_CSrhs6637angbaRgKua6fSb > 70EKYnmyPg1C0eJqiIo&e= > ZUC 128: https://urldefense.proofpoint.com/v2/url?u=https- > 3A__www.gsma.com_security_wp-2Dcontent_uploads_2019_05_EEA3- > 5FEIA3-5Fspecification-5Fv1- > 5F8.pdf&d=DwIFAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=NjpqGUAf6Xc0ZLzxCvv > 4idf8zRFeSJHioNlG1Wif1Gs&m=LuQUS0xRBdqoB-HkggX8l2lVEvlN- > 8JUOSqZbNXEzqFISwm_UZLnF8eQabCahkMl&s=BzAkYZxJofomR4lkzeiPKXMn > ewV25NLzB6MpFdlV3kk&e= > > Thanks, > Ciara ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3] app/test: add additional stream cipher tests 2022-06-20 12:30 ` [PATCH v2] " Tejasree Kondoj 2022-06-21 12:51 ` Akhil Goyal @ 2022-06-23 13:41 ` Tejasree Kondoj 2022-06-23 18:19 ` [PATCH v4] " Tejasree Kondoj 1 sibling, 1 reply; 13+ messages in thread From: Tejasree Kondoj @ 2022-06-23 13:41 UTC (permalink / raw) To: Akhil Goyal, Ciara Power, Fan Zhang; +Cc: Anoob Joseph, Ankur Dwivedi, dev Adding zuc, snow3g and aes-ctr-cmac auth-cipher test vectors with same auth and cipher offsets and total digest data encrypted. Existing tests have different cipher and auth offsets and partial or no digest encrypted. Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com> --- v3: * Modified IV of test vectors as per specification v2: * Removed cn9k PMD checks app/test/test_cryptodev.c | 270 ++++++++++++++++++ app/test/test_cryptodev_mixed_test_vectors.h | 194 +++++++++++++ app/test/test_cryptodev_snow3g_test_vectors.h | 67 +++++ app/test/test_cryptodev_zuc_test_vectors.h | 77 +++++ 4 files changed, 608 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 1cac76a64a..08842e77e6 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -6968,6 +6968,34 @@ test_snow3g_auth_cipher_part_digest_enc_oop_sgl(void) OUT_OF_PLACE, 0); } +static int +test_snow3g_auth_cipher_total_digest_enc_1(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_1, IN_PLACE, 0); +} + +static int +test_snow3g_auth_cipher_total_digest_enc_1_oop(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_1, OUT_OF_PLACE, 0); +} + +static int +test_snow3g_auth_cipher_total_digest_enc_1_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_1, IN_PLACE, 0); +} + +static int +test_snow3g_auth_cipher_total_digest_enc_1_oop_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_1, OUT_OF_PLACE, 0); +} + static int test_snow3g_auth_cipher_verify_test_case_1(void) { @@ -7035,6 +7063,34 @@ test_snow3g_auth_cipher_verify_part_digest_enc_oop_sgl(void) OUT_OF_PLACE, 1); } +static int +test_snow3g_auth_cipher_verify_total_digest_enc_1(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_1, IN_PLACE, 1); +} + +static int +test_snow3g_auth_cipher_verify_total_digest_enc_1_oop(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_1, OUT_OF_PLACE, 1); +} + +static int +test_snow3g_auth_cipher_verify_total_digest_enc_1_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_1, IN_PLACE, 1); +} + +static int +test_snow3g_auth_cipher_verify_total_digest_enc_1_oop_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_1, OUT_OF_PLACE, 1); +} + static int test_snow3g_auth_cipher_with_digest_test_case_1(void) { @@ -7260,6 +7316,20 @@ test_zuc_auth_cipher_test_case_1_oop_sgl(void) &zuc_auth_cipher_test_case_1, OUT_OF_PLACE, 0); } +static int +test_zuc_auth_cipher_test_case_2(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, IN_PLACE, 0); +} + +static int +test_zuc_auth_cipher_test_case_2_oop(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, OUT_OF_PLACE, 0); +} + static int test_zuc_auth_cipher_verify_test_case_1(void) { @@ -7288,6 +7358,20 @@ test_zuc_auth_cipher_verify_test_case_1_oop_sgl(void) &zuc_auth_cipher_test_case_1, OUT_OF_PLACE, 1); } +static int +test_zuc_auth_cipher_verify_test_case_2(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, IN_PLACE, 1); +} + +static int +test_zuc_auth_cipher_verify_test_case_2_oop(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, OUT_OF_PLACE, 1); +} + static int test_zuc256_encryption_test_case_1(void) { @@ -7777,6 +7861,20 @@ test_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl(void) &auth_aes_cmac_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 0); } +static int +test_aes_cmac_aes_ctr_digest_enc_test_case_2(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, IN_PLACE, 0); +} + +static int +test_aes_cmac_aes_ctr_digest_enc_test_case_2_oop(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, OUT_OF_PLACE, 0); +} + static int test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1(void) { @@ -7784,6 +7882,13 @@ test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1(void) &auth_aes_cmac_cipher_aes_ctr_test_case_1, IN_PLACE, 1); } +static int +test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, IN_PLACE, 1); +} + static int test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop(void) { @@ -7805,6 +7910,13 @@ test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl(void) &auth_aes_cmac_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 1); } +static int +test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2_oop(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, OUT_OF_PLACE, 1); +} + /** MIXED AUTH + CIPHER */ static int @@ -7821,6 +7933,21 @@ test_verify_auth_zuc_cipher_snow_test_case_1(void) &auth_zuc_cipher_snow_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_zuc_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_snow_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_zuc_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_snow_test_case_1, IN_PLACE, 1); +} + + static int test_auth_aes_cmac_cipher_snow_test_case_1(void) { @@ -7835,6 +7962,20 @@ test_verify_auth_aes_cmac_cipher_snow_test_case_1(void) &auth_aes_cmac_cipher_snow_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_aes_cmac_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_snow_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_aes_cmac_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_snow_test_case_1, IN_PLACE, 1); +} + static int test_auth_zuc_cipher_aes_ctr_test_case_1(void) { @@ -7849,6 +7990,20 @@ test_verify_auth_zuc_cipher_aes_ctr_test_case_1(void) &auth_zuc_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_zuc_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_aes_ctr_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_zuc_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_aes_ctr_test_case_1, IN_PLACE, 1); +} + static int test_auth_snow_cipher_aes_ctr_test_case_1(void) { @@ -7863,6 +8018,34 @@ test_verify_auth_snow_cipher_aes_ctr_test_case_1(void) &auth_snow_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl(void) +{ + return test_mixed_auth_cipher_sgl( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 0); +} + +static int +test_auth_snow_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl(void) +{ + return test_mixed_auth_cipher_sgl( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 1); +} + +static int +test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 1); +} + static int test_auth_snow_cipher_zuc_test_case_1(void) { @@ -7877,6 +8060,20 @@ test_verify_auth_snow_cipher_zuc_test_case_1(void) &auth_snow_cipher_zuc_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_snow_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_zuc_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_snow_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_zuc_test_case_1, IN_PLACE, 1); +} + static int test_auth_aes_cmac_cipher_zuc_test_case_1(void) { @@ -7890,6 +8087,19 @@ test_verify_auth_aes_cmac_cipher_zuc_test_case_1(void) return test_mixed_auth_cipher( &auth_aes_cmac_cipher_zuc_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_aes_cmac_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_zuc_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_aes_cmac_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_zuc_test_case_1, IN_PLACE, 1); +} static int test_auth_null_cipher_snow_test_case_1(void) @@ -15794,6 +16004,14 @@ static struct unit_test_suite cryptodev_snow3g_testsuite = { test_snow3g_auth_cipher_part_digest_enc_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_snow3g_auth_cipher_part_digest_enc_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_1_oop), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_1_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_1_oop_sgl), /** SNOW 3G decrypt (UEA2), then verify auth */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -15814,6 +16032,14 @@ static struct unit_test_suite cryptodev_snow3g_testsuite = { test_snow3g_auth_cipher_verify_part_digest_enc_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_snow3g_auth_cipher_verify_part_digest_enc_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_1_oop), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_1_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_1_oop_sgl), /** SNOW 3G decrypt only (UEA2) */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -15922,6 +16148,10 @@ static struct unit_test_suite cryptodev_zuc_testsuite = { test_zuc_auth_cipher_test_case_1_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_zuc_auth_cipher_test_case_1_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_test_case_2_oop), /** ZUC decrypt (EEA3), then verify auth */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -15932,6 +16162,10 @@ static struct unit_test_suite cryptodev_zuc_testsuite = { test_zuc_auth_cipher_verify_test_case_1_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_zuc_auth_cipher_verify_test_case_1_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_verify_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_verify_test_case_2_oop), /** ZUC-256 encrypt only **/ TEST_CASE_ST(ut_setup, ut_teardown, @@ -16135,37 +16369,73 @@ static struct unit_test_suite cryptodev_mixed_cipher_hash_testsuite = { test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_aes_cmac_aes_ctr_digest_enc_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_aes_cmac_aes_ctr_digest_enc_test_case_2_oop), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2_oop), /** AUTH ZUC + CIPHER SNOW3G */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_zuc_cipher_snow_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_zuc_cipher_snow_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_zuc_cipher_snow_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_zuc_cipher_snow_test_case_1_inplace), /** AUTH AES CMAC + CIPHER SNOW3G */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_aes_cmac_cipher_snow_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_aes_cmac_cipher_snow_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_aes_cmac_cipher_snow_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_aes_cmac_cipher_snow_test_case_1_inplace), /** AUTH ZUC + CIPHER AES CTR */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_zuc_cipher_aes_ctr_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_zuc_cipher_aes_ctr_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_zuc_cipher_aes_ctr_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_zuc_cipher_aes_ctr_test_case_1_inplace), /** AUTH SNOW3G + CIPHER AES CTR */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_snow_cipher_aes_ctr_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_snow_cipher_aes_ctr_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_snow_cipher_aes_ctr_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl), /** AUTH SNOW3G + CIPHER ZUC */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_snow_cipher_zuc_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_snow_cipher_zuc_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_snow_cipher_zuc_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_snow_cipher_zuc_test_case_1_inplace), /** AUTH AES CMAC + CIPHER ZUC */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_aes_cmac_cipher_zuc_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_aes_cmac_cipher_zuc_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_aes_cmac_cipher_zuc_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_aes_cmac_cipher_zuc_test_case_1_inplace), /** AUTH NULL + CIPHER SNOW3G */ TEST_CASE_ST(ut_setup, ut_teardown, diff --git a/app/test/test_cryptodev_mixed_test_vectors.h b/app/test/test_cryptodev_mixed_test_vectors.h index f50dcb0457..2816ecc6a4 100644 --- a/app/test/test_cryptodev_mixed_test_vectors.h +++ b/app/test/test_cryptodev_mixed_test_vectors.h @@ -169,6 +169,200 @@ struct mixed_cipher_auth_test_data auth_aes_cmac_cipher_aes_ctr_test_case_1 = { } }; +struct mixed_cipher_auth_test_data auth_aes_cmac_cipher_aes_ctr_test_case_2 = { + .auth_algo = RTE_CRYPTO_AUTH_AES_CMAC, + .auth_key = { + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16, + }, + .auth_iv = { + .data = { + }, + .len = 0, + }, + .auth = { + .len_bits = 512 << 3, + .offset_bits = 0, + }, + .cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR, + .cipher_key = { + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16, + }, + .cipher_iv = { + .data = { + 0xa9, 0x40, 0x59, 0xda, 0x50, 0x00, 0x00, 0x00, + 0x29, 0x40, 0x59, 0xda, 0x50, 0x00, 0x80, 0x00 + }, + .len = 16, + }, + .cipher = { + .len_bits = 516 << 3, + .offset_bits = 0, + }, + .plaintext = { + .data = { + 0x57, 0x68, 0x61, 0x74, 0x20, 0x61, 0x20, 0x6C, + 0x6F, 0x75, 0x73, 0x79, 0x20, 0x65, 0x61, 0x72, + 0x74, 0x68, 0x21, 0x20, 0x48, 0x65, 0x20, 0x77, + 0x6F, 0x6E, 0x64, 0x65, 0x72, 0x65, 0x64, 0x20, + 0x68, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, 0x79, + 0x20, 0x70, 0x65, 0x6F, 0x70, 0x6C, 0x65, 0x20, + 0x77, 0x65, 0x72, 0x65, 0x20, 0x64, 0x65, 0x73, + 0x74, 0x69, 0x74, 0x75, 0x74, 0x65, 0x20, 0x74, + 0x68, 0x61, 0x74, 0x20, 0x73, 0x61, 0x6D, 0x65, + 0x20, 0x6E, 0x69, 0x67, 0x68, 0x74, 0x20, 0x65, + 0x76, 0x65, 0x6E, 0x20, 0x69, 0x6E, 0x20, 0x68, + 0x69, 0x73, 0x20, 0x6F, 0x77, 0x6E, 0x20, 0x70, + 0x72, 0x6F, 0x73, 0x70, 0x65, 0x72, 0x6F, 0x75, + 0x73, 0x20, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x72, + 0x79, 0x2C, 0x20, 0x68, 0x6F, 0x77, 0x20, 0x6D, + 0x61, 0x6E, 0x79, 0x20, 0x68, 0x6F, 0x6D, 0x65, + 0x73, 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, 0x73, + 0x68, 0x61, 0x6E, 0x74, 0x69, 0x65, 0x73, 0x2C, + 0x20, 0x68, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, + 0x79, 0x20, 0x68, 0x75, 0x73, 0x62, 0x61, 0x6E, + 0x64, 0x73, 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, + 0x64, 0x72, 0x75, 0x6E, 0x6B, 0x20, 0x61, 0x6E, + 0x64, 0x20, 0x77, 0x69, 0x76, 0x65, 0x73, 0x20, + 0x73, 0x6F, 0x63, 0x6B, 0x65, 0x64, 0x2C, 0x20, + 0x61, 0x6E, 0x64, 0x20, 0x68, 0x6F, 0x77, 0x20, + 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x63, 0x68, 0x69, + 0x6C, 0x64, 0x72, 0x65, 0x6E, 0x20, 0x77, 0x65, + 0x72, 0x65, 0x20, 0x62, 0x75, 0x6C, 0x6C, 0x69, + 0x65, 0x64, 0x2C, 0x20, 0x61, 0x62, 0x75, 0x73, + 0x65, 0x64, 0x2C, 0x20, 0x6F, 0x72, 0x20, 0x61, + 0x62, 0x61, 0x6E, 0x64, 0x6F, 0x6E, 0x65, 0x64, + 0x2E, 0x20, 0x48, 0x6F, 0x77, 0x20, 0x6D, 0x61, + 0x6E, 0x79, 0x20, 0x66, 0x61, 0x6D, 0x69, 0x6C, + 0x69, 0x65, 0x73, 0x20, 0x68, 0x75, 0x6E, 0x67, + 0x65, 0x72, 0x65, 0x64, 0x20, 0x66, 0x6F, 0x72, + 0x20, 0x66, 0x6F, 0x6F, 0x64, 0x20, 0x74, 0x68, + 0x65, 0x79, 0x20, 0x63, 0x6F, 0x75, 0x6C, 0x64, + 0x20, 0x6E, 0x6F, 0x74, 0x20, 0x61, 0x66, 0x66, + 0x6F, 0x72, 0x64, 0x20, 0x74, 0x6F, 0x20, 0x62, + 0x75, 0x79, 0x3F, 0x20, 0x48, 0x6F, 0x77, 0x20, + 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x68, 0x65, 0x61, + 0x72, 0x74, 0x73, 0x20, 0x77, 0x65, 0x72, 0x65, + 0x20, 0x62, 0x72, 0x6F, 0x6B, 0x65, 0x6E, 0x3F, + 0x20, 0x48, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, + 0x79, 0x20, 0x73, 0x75, 0x69, 0x63, 0x69, 0x64, + 0x65, 0x73, 0x20, 0x77, 0x6F, 0x75, 0x6C, 0x64, + 0x20, 0x74, 0x61, 0x6B, 0x65, 0x20, 0x70, 0x6C, + 0x61, 0x63, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, + 0x20, 0x73, 0x61, 0x6D, 0x65, 0x20, 0x6E, 0x69, + 0x67, 0x68, 0x74, 0x2C, 0x20, 0x68, 0x6F, 0x77, + 0x20, 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x70, 0x65, + 0x6F, 0x70, 0x6C, 0x65, 0x20, 0x77, 0x6F, 0x75, + 0x6C, 0x64, 0x20, 0x67, 0x6F, 0x20, 0x69, 0x6E, + 0x73, 0x61, 0x6E, 0x65, 0x3F, 0x20, 0x48, 0x6F, + 0x77, 0x20, 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x63, + 0x6F, 0x63, 0x6B, 0x72, 0x6F, 0x61, 0x63, 0x68, + 0x65, 0x73, 0x20, 0x61, 0x6E, 0x64, 0x20, 0x6C, + 0x61, 0x6E, 0x64, 0x6C, 0x6F, 0x72, 0x64, 0x73, + 0x20, 0x77, 0x6F, 0x75, 0x6C, 0x64, 0x20, 0x74, + 0x72, 0x69, 0x75, 0x6D, 0x70, 0x68, 0x3F, 0x20, + 0x48, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, 0x79, + 0x20, 0x77, 0x69, 0x6E, 0x6E, 0x65, 0x72, 0x73, + 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, 0x6C, 0x6F, + 0x73, 0x65, 0x72, 0x73, 0x2C, 0x20, 0x73, 0x75 + }, + .len_bits = 512 << 3, + }, + .ciphertext = { + .data = { + 0xA5, 0xC3, 0xEC, 0xC5, 0x14, 0x36, 0xC8, 0x00, + 0x6E, 0xA6, 0xAD, 0xFB, 0x1C, 0x4F, 0x60, 0x6C, + 0x60, 0xC0, 0x9C, 0x00, 0xED, 0xC0, 0x2A, 0xD8, + 0x41, 0xD3, 0x44, 0x27, 0xE6, 0x1A, 0x6E, 0xB3, + 0x9C, 0x5E, 0x3C, 0x71, 0x19, 0x96, 0x13, 0xED, + 0x06, 0xCA, 0xFB, 0x74, 0x7C, 0x23, 0x3E, 0x54, + 0x49, 0xF1, 0x32, 0xA4, 0xCD, 0xF3, 0x92, 0x33, + 0x22, 0xDB, 0xE0, 0x0D, 0x3F, 0x31, 0xA3, 0x2B, + 0x85, 0x11, 0x41, 0x11, 0x02, 0xE0, 0x2B, 0x0E, + 0x35, 0xDF, 0xE4, 0x03, 0x6B, 0x48, 0x80, 0x4A, + 0xB8, 0x2D, 0xD4, 0xB3, 0x5B, 0xF1, 0xB4, 0xF9, + 0xC9, 0x83, 0x4E, 0x2A, 0x53, 0x92, 0xB2, 0xF6, + 0x0C, 0xBA, 0xC4, 0x94, 0x8E, 0x96, 0x60, 0x26, + 0x4F, 0xA1, 0x85, 0xC6, 0x31, 0x57, 0xAE, 0xC3, + 0x8C, 0x09, 0x1B, 0xDB, 0xC1, 0x0D, 0x0E, 0xCE, + 0xB9, 0xE9, 0x30, 0x5E, 0x51, 0x9C, 0xE4, 0xC5, + 0xDC, 0xC0, 0x4A, 0xD9, 0x1B, 0xBE, 0xCF, 0x0A, + 0x95, 0xA1, 0x78, 0xDD, 0xE0, 0x46, 0x90, 0xC8, + 0xFF, 0xAE, 0x38, 0x1E, 0xAF, 0x5C, 0x57, 0xED, + 0x20, 0x49, 0xED, 0x54, 0x57, 0xBA, 0x65, 0xAD, + 0xC1, 0x2B, 0xD3, 0xEF, 0x97, 0x1F, 0x27, 0xBE, + 0x8E, 0x98, 0x2C, 0x4B, 0xDF, 0x11, 0x77, 0xB9, + 0x7D, 0x89, 0x0D, 0x28, 0xE3, 0x8B, 0x09, 0xAF, + 0x85, 0xCE, 0x0F, 0x49, 0xD5, 0x8E, 0xF2, 0xF2, + 0xF9, 0x4C, 0xE0, 0xF0, 0x9B, 0xD0, 0x42, 0x07, + 0xBC, 0xD4, 0x8E, 0x78, 0xCD, 0x4D, 0x6D, 0x12, + 0xB2, 0x8D, 0x4C, 0xCB, 0x44, 0x2A, 0xA2, 0x4C, + 0xD7, 0x15, 0xFA, 0xB1, 0x05, 0xB9, 0xFF, 0x95, + 0x29, 0xF7, 0xA6, 0xFC, 0x25, 0x74, 0xF6, 0x9E, + 0x01, 0xFE, 0x4C, 0xFD, 0x50, 0xD8, 0xF6, 0x4C, + 0xDF, 0x75, 0xEF, 0xAF, 0x04, 0x84, 0x95, 0x15, + 0x33, 0x6D, 0x8E, 0x0A, 0x89, 0xE0, 0x20, 0x2E, + 0xC2, 0x0E, 0xE1, 0x91, 0xB9, 0x06, 0x34, 0x14, + 0xD4, 0x65, 0x68, 0x72, 0x5C, 0x60, 0x09, 0x2C, + 0x8A, 0x82, 0x4A, 0x04, 0x71, 0xB8, 0xDF, 0x45, + 0x3C, 0x21, 0x24, 0x06, 0x34, 0xD0, 0xE3, 0xA7, + 0x82, 0x25, 0xAB, 0x7B, 0xDD, 0x6D, 0xCC, 0xAE, + 0x01, 0xB1, 0xD6, 0x2A, 0xE2, 0x96, 0x6C, 0x65, + 0x94, 0xDB, 0xB5, 0x0F, 0xCD, 0xC9, 0xA6, 0x01, + 0x5C, 0x89, 0x59, 0x6C, 0x10, 0x4C, 0xA3, 0xBC, + 0x9A, 0x4F, 0x11, 0xEB, 0x54, 0xE0, 0x3B, 0x83, + 0x9C, 0x5E, 0x16, 0x0D, 0xD6, 0x2C, 0x4B, 0x6F, + 0xE6, 0xB9, 0xF6, 0x02, 0x6C, 0x34, 0x0C, 0x4D, + 0xEE, 0xF0, 0x42, 0xC3, 0x0C, 0xDE, 0x93, 0x8A, + 0xC1, 0xB5, 0xEF, 0xCF, 0x54, 0x9C, 0x3B, 0x4B, + 0x70, 0x6C, 0x06, 0x97, 0x3E, 0x26, 0x8C, 0x61, + 0x52, 0x47, 0xF6, 0x9C, 0x28, 0x5C, 0xD1, 0x4A, + 0x67, 0x4B, 0xCD, 0xD9, 0xA1, 0x8C, 0x29, 0x31, + 0x10, 0x71, 0x45, 0x68, 0x63, 0xCE, 0xC9, 0xBC, + 0x46, 0x6A, 0x81, 0x02, 0x4D, 0x66, 0xA4, 0x65, + 0xCC, 0x33, 0xEC, 0x99, 0x14, 0x4D, 0x28, 0xAB, + 0xF6, 0xCB, 0x46, 0x13, 0x0C, 0x13, 0x74, 0x22, + 0x4A, 0x7B, 0x53, 0x2F, 0x11, 0x54, 0xAF, 0xD9, + 0x2D, 0x66, 0x98, 0x7E, 0x20, 0x57, 0x01, 0x4C, + 0xF7, 0x0C, 0xCB, 0x70, 0xFF, 0x3D, 0xC4, 0x5F, + 0x3A, 0xAE, 0xD9, 0xC6, 0x93, 0xFC, 0x2C, 0x23, + 0x4C, 0x43, 0x92, 0x9B, 0x92, 0x3E, 0x35, 0xB7, + 0x1E, 0x96, 0xED, 0xCC, 0x60, 0xDE, 0x2E, 0x19, + 0xB8, 0x24, 0x55, 0x1E, 0x52, 0xB9, 0x52, 0x3C, + 0xC0, 0x06, 0x74, 0xC0, 0xEE, 0xD1, 0xA1, 0x80, + 0x98, 0xE8, 0xDF, 0x0D, 0x8A, 0x44, 0xC2, 0x36, + 0x16, 0xCC, 0x03, 0x68, 0xD9, 0xC2, 0xCF, 0xE2, + 0x78, 0xBD, 0x1A, 0x31, 0x19, 0x5D, 0xE0, 0x6E, + 0x09, 0x6E, 0xD5, 0x17, 0xB8, 0xA8, 0xF4, 0xBE, + 0x2C, 0xD6, 0xD1, 0x04 + }, + .len_bits = 516 << 3, + }, + .digest_enc = { + .data = { + 0x2C, 0xD6, 0xD1, 0x04 + }, + .len = 4, + .offset = 512, + }, + .validDataLen = { + .len_bits = 516 << 3, + }, + .validCipherLen = { + .len_bits = 516 << 3, + }, + .validAuthLen = { + .len_bits = 512 << 3, + } +}; + struct mixed_cipher_auth_test_data auth_zuc_cipher_snow_test_case_1 = { .auth_algo = RTE_CRYPTO_AUTH_ZUC_EIA3, .auth_key = { diff --git a/app/test/test_cryptodev_snow3g_test_vectors.h b/app/test/test_cryptodev_snow3g_test_vectors.h index bbe05662be..2bc4ecca14 100644 --- a/app/test/test_cryptodev_snow3g_test_vectors.h +++ b/app/test/test_cryptodev_snow3g_test_vectors.h @@ -736,4 +736,71 @@ struct snow3g_test_data snow3g_auth_cipher_partial_digest_encryption = { }, }; +struct snow3g_test_data snow3g_auth_cipher_total_digest_encryption_1 = { + .key = { + .data = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 + + }, + .len = 16 + }, + .cipher_iv = { + .data = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 + }, + .len = 16 + }, + .auth_iv = { + .data = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + }, + .len = 16 + }, + .plaintext = { + .data = { + 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, + 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, + 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, + 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, + }, + .len = 32 << 3 + }, + .ciphertext = { + .data = { + 0x5A, 0x5A, 0xE4, 0xAD, 0x29, 0xA2, 0x6A, 0xA6, + 0x20, 0x1D, 0xCD, 0x08, 0x50, 0xD6, 0xE6, 0x47, + 0xBC, 0x88, 0x08, 0x01, 0x17, 0xFA, 0x47, 0x5B, + 0x90, 0x40, 0xBA, 0x0C, 0x67, 0xCB, 0xFE, 0x87, + }, + .len = 32 << 3 + }, + .cipher = { + .len_bits = 30 << 3, + .offset_bits = 2 << 3 + }, + .auth = { + .len_bits = 26 << 3, + .offset_bits = 2 << 3 + }, + .digest = { + .data = { + 0x67, 0xCB, 0xFE, 0x87 + }, + .len = 4, + .offset_bytes = 28 + }, + .validDataLenInBits = { + .len = 32 << 3 + }, + .validCipherLenInBits = { + .len = 30 << 3 + }, + .validAuthLenInBits = { + .len = 26 << 3 + }, +}; + #endif /* TEST_CRYPTODEV_SNOW3G_TEST_VECTORS_H_ */ diff --git a/app/test/test_cryptodev_zuc_test_vectors.h b/app/test/test_cryptodev_zuc_test_vectors.h index 5d1d264579..87851e2ec6 100644 --- a/app/test/test_cryptodev_zuc_test_vectors.h +++ b/app/test/test_cryptodev_zuc_test_vectors.h @@ -1239,6 +1239,83 @@ struct wireless_test_data zuc_auth_cipher_test_case_1 = { } }; +struct wireless_test_data zuc_auth_cipher_test_case_2 = { + .key = { + .data = { + 0xE5, 0xBD, 0x3E, 0xA0, 0xEB, 0x55, 0xAD, 0xE8, + 0x66, 0xC6, 0xAC, 0x58, 0xBD, 0x54, 0x30, 0x2A + }, + .len = 16 + }, + .cipher_iv = { + .data = { + 0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00 + }, + .len = 16 + }, + .auth_iv = { + .data = { + 0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00, + 0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00 + }, + .len = 16 + }, + .plaintext = { + .data = { + 0x14, 0xA8, 0xEF, 0x69, 0x3D, 0x67, 0x85, 0x07, + 0xBB, 0xE7, 0x27, 0x0A, 0x7F, 0x67, 0xFF, 0x50, + 0x06, 0xC3, 0x52, 0x5B, 0x98, 0x07, 0xE4, 0x67, + 0xC4, 0xE5, 0x60, 0x00, 0xBA, 0x33, 0x8F, 0x5D, + 0x42, 0x95, 0x59, 0x03, 0x67, 0x51, 0x82, 0x22, + 0x46, 0xC8, 0x0D, 0x3B, 0x38, 0xF0, 0x7F, 0x4B, + 0xE2, 0xD8, 0xFF, 0x58, 0x05, 0xF5, 0x13, 0x22, + 0x29, 0xBD, 0xE9, 0x3B, 0xBB, 0xDC, 0xAF, 0x38, + 0x2B, 0xF1, 0xEE, 0x97, 0x2F, 0xBF, 0x99, 0x77, + 0xBA, 0xDA, 0x89, 0x45, 0x84, 0x7A, 0x2A, 0x6C, + 0x9A, 0xD3, 0x4A, 0x66, 0x75, 0x54, 0xE0, 0x4D, + 0x1F, 0x7F, 0xA2, 0xC3, 0x32, 0x41, 0xBD, 0x8F, + 0x01, 0xBA, 0x22, 0x0D + }, + .len = 96 << 3 + }, + .ciphertext = { + .data = { + 0x13, 0x1D, 0x43, 0xE0, 0xDE, 0xA1, 0xBE, 0x5C, + 0x5A, 0x1B, 0xFD, 0x97, 0x1D, 0x85, 0x2C, 0xBF, + 0x71, 0x2D, 0x7B, 0x4F, 0x57, 0x96, 0x1F, 0xEA, + 0x32, 0x08, 0xAF, 0xA8, 0xBC, 0xA4, 0x33, 0xF4, + 0x56, 0xAD, 0x09, 0xC7, 0x41, 0x7E, 0x58, 0xBC, + 0x69, 0xCF, 0x88, 0x66, 0xD1, 0x35, 0x3F, 0x74, + 0x86, 0x5E, 0x80, 0x78, 0x1D, 0x20, 0x2D, 0xFB, + 0x3E, 0xCF, 0xF7, 0xFC, 0xBC, 0x3B, 0x19, 0x0F, + 0xE8, 0x2A, 0x20, 0x4E, 0xD0, 0xE3, 0x50, 0xFC, + 0x0F, 0x6F, 0x26, 0x13, 0xB2, 0xF2, 0xBC, 0xA6, + 0xDF, 0x5A, 0x47, 0x3A, 0x57, 0xA4, 0xA0, 0x0D, + 0x98, 0x5E, 0xBA, 0xD8, 0x80, 0xD6, 0xF2, 0x38, + 0xC0, 0xB4, 0x77, 0x6B + }, + .len = 800 + }, + .validDataLenInBits = { + .len = 800 + }, + .validCipherLenInBits = { + .len = 800 + }, + .validAuthLenInBits = { + .len = 96 << 3 + }, + .validCipherOffsetInBits = { + .len = 0 + }, + .digest = { + .data = { 0xC0, 0xB4, 0x77, 0x6B }, + .len = 4, + .offset_bytes = 96 + } +}; + /** ZUC-256 vectors **/ static struct wireless_test_data zuc256_test_case_cipher_1 = { .key = { -- 2.25.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4] app/test: add additional stream cipher tests 2022-06-23 13:41 ` [PATCH v3] " Tejasree Kondoj @ 2022-06-23 18:19 ` Tejasree Kondoj 2022-06-28 12:07 ` Power, Ciara 0 siblings, 1 reply; 13+ messages in thread From: Tejasree Kondoj @ 2022-06-23 18:19 UTC (permalink / raw) To: Akhil Goyal, Ciara Power, Fan Zhang; +Cc: Anoob Joseph, Ankur Dwivedi, dev Adding zuc, snow3g and aes-ctr-cmac auth-cipher test vectors with same auth and cipher offsets and total digest data encrypted. Existing tests have different cipher and auth offsets and partial or no digest encrypted. Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com> --- v4: * Set last 3 bytes of IV to zero in each 8 byte block v3: * Modified IV of test vectors as per specification v2: * Removed cn9k PMD checks app/test/test_cryptodev.c | 270 ++++++++++++++++++ app/test/test_cryptodev_mixed_test_vectors.h | 194 +++++++++++++ app/test/test_cryptodev_snow3g_test_vectors.h | 67 +++++ app/test/test_cryptodev_zuc_test_vectors.h | 77 +++++ 4 files changed, 608 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 1cac76a64a..08842e77e6 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -6968,6 +6968,34 @@ test_snow3g_auth_cipher_part_digest_enc_oop_sgl(void) OUT_OF_PLACE, 0); } +static int +test_snow3g_auth_cipher_total_digest_enc_1(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_1, IN_PLACE, 0); +} + +static int +test_snow3g_auth_cipher_total_digest_enc_1_oop(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_1, OUT_OF_PLACE, 0); +} + +static int +test_snow3g_auth_cipher_total_digest_enc_1_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_1, IN_PLACE, 0); +} + +static int +test_snow3g_auth_cipher_total_digest_enc_1_oop_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_1, OUT_OF_PLACE, 0); +} + static int test_snow3g_auth_cipher_verify_test_case_1(void) { @@ -7035,6 +7063,34 @@ test_snow3g_auth_cipher_verify_part_digest_enc_oop_sgl(void) OUT_OF_PLACE, 1); } +static int +test_snow3g_auth_cipher_verify_total_digest_enc_1(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_1, IN_PLACE, 1); +} + +static int +test_snow3g_auth_cipher_verify_total_digest_enc_1_oop(void) +{ + return test_snow3g_auth_cipher( + &snow3g_auth_cipher_total_digest_encryption_1, OUT_OF_PLACE, 1); +} + +static int +test_snow3g_auth_cipher_verify_total_digest_enc_1_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_1, IN_PLACE, 1); +} + +static int +test_snow3g_auth_cipher_verify_total_digest_enc_1_oop_sgl(void) +{ + return test_snow3g_auth_cipher_sgl( + &snow3g_auth_cipher_total_digest_encryption_1, OUT_OF_PLACE, 1); +} + static int test_snow3g_auth_cipher_with_digest_test_case_1(void) { @@ -7260,6 +7316,20 @@ test_zuc_auth_cipher_test_case_1_oop_sgl(void) &zuc_auth_cipher_test_case_1, OUT_OF_PLACE, 0); } +static int +test_zuc_auth_cipher_test_case_2(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, IN_PLACE, 0); +} + +static int +test_zuc_auth_cipher_test_case_2_oop(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, OUT_OF_PLACE, 0); +} + static int test_zuc_auth_cipher_verify_test_case_1(void) { @@ -7288,6 +7358,20 @@ test_zuc_auth_cipher_verify_test_case_1_oop_sgl(void) &zuc_auth_cipher_test_case_1, OUT_OF_PLACE, 1); } +static int +test_zuc_auth_cipher_verify_test_case_2(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, IN_PLACE, 1); +} + +static int +test_zuc_auth_cipher_verify_test_case_2_oop(void) +{ + return test_zuc_auth_cipher( + &zuc_auth_cipher_test_case_2, OUT_OF_PLACE, 1); +} + static int test_zuc256_encryption_test_case_1(void) { @@ -7777,6 +7861,20 @@ test_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl(void) &auth_aes_cmac_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 0); } +static int +test_aes_cmac_aes_ctr_digest_enc_test_case_2(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, IN_PLACE, 0); +} + +static int +test_aes_cmac_aes_ctr_digest_enc_test_case_2_oop(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, OUT_OF_PLACE, 0); +} + static int test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1(void) { @@ -7784,6 +7882,13 @@ test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1(void) &auth_aes_cmac_cipher_aes_ctr_test_case_1, IN_PLACE, 1); } +static int +test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, IN_PLACE, 1); +} + static int test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop(void) { @@ -7805,6 +7910,13 @@ test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl(void) &auth_aes_cmac_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 1); } +static int +test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2_oop(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_aes_ctr_test_case_2, OUT_OF_PLACE, 1); +} + /** MIXED AUTH + CIPHER */ static int @@ -7821,6 +7933,21 @@ test_verify_auth_zuc_cipher_snow_test_case_1(void) &auth_zuc_cipher_snow_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_zuc_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_snow_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_zuc_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_snow_test_case_1, IN_PLACE, 1); +} + + static int test_auth_aes_cmac_cipher_snow_test_case_1(void) { @@ -7835,6 +7962,20 @@ test_verify_auth_aes_cmac_cipher_snow_test_case_1(void) &auth_aes_cmac_cipher_snow_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_aes_cmac_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_snow_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_aes_cmac_cipher_snow_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_snow_test_case_1, IN_PLACE, 1); +} + static int test_auth_zuc_cipher_aes_ctr_test_case_1(void) { @@ -7849,6 +7990,20 @@ test_verify_auth_zuc_cipher_aes_ctr_test_case_1(void) &auth_zuc_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_zuc_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_aes_ctr_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_zuc_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_zuc_cipher_aes_ctr_test_case_1, IN_PLACE, 1); +} + static int test_auth_snow_cipher_aes_ctr_test_case_1(void) { @@ -7863,6 +8018,34 @@ test_verify_auth_snow_cipher_aes_ctr_test_case_1(void) &auth_snow_cipher_aes_ctr_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl(void) +{ + return test_mixed_auth_cipher_sgl( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 0); +} + +static int +test_auth_snow_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl(void) +{ + return test_mixed_auth_cipher_sgl( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 1); +} + +static int +test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_aes_ctr_test_case_1, IN_PLACE, 1); +} + static int test_auth_snow_cipher_zuc_test_case_1(void) { @@ -7877,6 +8060,20 @@ test_verify_auth_snow_cipher_zuc_test_case_1(void) &auth_snow_cipher_zuc_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_snow_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_zuc_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_snow_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_snow_cipher_zuc_test_case_1, IN_PLACE, 1); +} + static int test_auth_aes_cmac_cipher_zuc_test_case_1(void) { @@ -7890,6 +8087,19 @@ test_verify_auth_aes_cmac_cipher_zuc_test_case_1(void) return test_mixed_auth_cipher( &auth_aes_cmac_cipher_zuc_test_case_1, OUT_OF_PLACE, 1); } +static int +test_auth_aes_cmac_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_zuc_test_case_1, IN_PLACE, 0); +} + +static int +test_verify_auth_aes_cmac_cipher_zuc_test_case_1_inplace(void) +{ + return test_mixed_auth_cipher( + &auth_aes_cmac_cipher_zuc_test_case_1, IN_PLACE, 1); +} static int test_auth_null_cipher_snow_test_case_1(void) @@ -15794,6 +16004,14 @@ static struct unit_test_suite cryptodev_snow3g_testsuite = { test_snow3g_auth_cipher_part_digest_enc_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_snow3g_auth_cipher_part_digest_enc_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_1_oop), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_1_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_total_digest_enc_1_oop_sgl), /** SNOW 3G decrypt (UEA2), then verify auth */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -15814,6 +16032,14 @@ static struct unit_test_suite cryptodev_snow3g_testsuite = { test_snow3g_auth_cipher_verify_part_digest_enc_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_snow3g_auth_cipher_verify_part_digest_enc_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_1_oop), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_1_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_snow3g_auth_cipher_verify_total_digest_enc_1_oop_sgl), /** SNOW 3G decrypt only (UEA2) */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -15922,6 +16148,10 @@ static struct unit_test_suite cryptodev_zuc_testsuite = { test_zuc_auth_cipher_test_case_1_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_zuc_auth_cipher_test_case_1_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_test_case_2_oop), /** ZUC decrypt (EEA3), then verify auth */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -15932,6 +16162,10 @@ static struct unit_test_suite cryptodev_zuc_testsuite = { test_zuc_auth_cipher_verify_test_case_1_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_zuc_auth_cipher_verify_test_case_1_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_verify_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_auth_cipher_verify_test_case_2_oop), /** ZUC-256 encrypt only **/ TEST_CASE_ST(ut_setup, ut_teardown, @@ -16135,37 +16369,73 @@ static struct unit_test_suite cryptodev_mixed_cipher_hash_testsuite = { test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_sgl), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_aes_cmac_aes_ctr_digest_enc_test_case_1_oop_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_aes_cmac_aes_ctr_digest_enc_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_aes_cmac_aes_ctr_digest_enc_test_case_2_oop), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_aes_cmac_aes_ctr_digest_enc_test_case_2_oop), /** AUTH ZUC + CIPHER SNOW3G */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_zuc_cipher_snow_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_zuc_cipher_snow_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_zuc_cipher_snow_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_zuc_cipher_snow_test_case_1_inplace), /** AUTH AES CMAC + CIPHER SNOW3G */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_aes_cmac_cipher_snow_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_aes_cmac_cipher_snow_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_aes_cmac_cipher_snow_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_aes_cmac_cipher_snow_test_case_1_inplace), /** AUTH ZUC + CIPHER AES CTR */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_zuc_cipher_aes_ctr_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_zuc_cipher_aes_ctr_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_zuc_cipher_aes_ctr_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_zuc_cipher_aes_ctr_test_case_1_inplace), /** AUTH SNOW3G + CIPHER AES CTR */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_snow_cipher_aes_ctr_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_snow_cipher_aes_ctr_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_snow_cipher_aes_ctr_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_snow_cipher_aes_ctr_test_case_1_inplace_sgl), /** AUTH SNOW3G + CIPHER ZUC */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_snow_cipher_zuc_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_snow_cipher_zuc_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_snow_cipher_zuc_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_snow_cipher_zuc_test_case_1_inplace), /** AUTH AES CMAC + CIPHER ZUC */ TEST_CASE_ST(ut_setup, ut_teardown, test_auth_aes_cmac_cipher_zuc_test_case_1), TEST_CASE_ST(ut_setup, ut_teardown, test_verify_auth_aes_cmac_cipher_zuc_test_case_1), + TEST_CASE_ST(ut_setup, ut_teardown, + test_auth_aes_cmac_cipher_zuc_test_case_1_inplace), + TEST_CASE_ST(ut_setup, ut_teardown, + test_verify_auth_aes_cmac_cipher_zuc_test_case_1_inplace), /** AUTH NULL + CIPHER SNOW3G */ TEST_CASE_ST(ut_setup, ut_teardown, diff --git a/app/test/test_cryptodev_mixed_test_vectors.h b/app/test/test_cryptodev_mixed_test_vectors.h index f50dcb0457..2816ecc6a4 100644 --- a/app/test/test_cryptodev_mixed_test_vectors.h +++ b/app/test/test_cryptodev_mixed_test_vectors.h @@ -169,6 +169,200 @@ struct mixed_cipher_auth_test_data auth_aes_cmac_cipher_aes_ctr_test_case_1 = { } }; +struct mixed_cipher_auth_test_data auth_aes_cmac_cipher_aes_ctr_test_case_2 = { + .auth_algo = RTE_CRYPTO_AUTH_AES_CMAC, + .auth_key = { + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16, + }, + .auth_iv = { + .data = { + }, + .len = 0, + }, + .auth = { + .len_bits = 512 << 3, + .offset_bits = 0, + }, + .cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR, + .cipher_key = { + .data = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C + }, + .len = 16, + }, + .cipher_iv = { + .data = { + 0xa9, 0x40, 0x59, 0xda, 0x50, 0x00, 0x00, 0x00, + 0x29, 0x40, 0x59, 0xda, 0x50, 0x00, 0x80, 0x00 + }, + .len = 16, + }, + .cipher = { + .len_bits = 516 << 3, + .offset_bits = 0, + }, + .plaintext = { + .data = { + 0x57, 0x68, 0x61, 0x74, 0x20, 0x61, 0x20, 0x6C, + 0x6F, 0x75, 0x73, 0x79, 0x20, 0x65, 0x61, 0x72, + 0x74, 0x68, 0x21, 0x20, 0x48, 0x65, 0x20, 0x77, + 0x6F, 0x6E, 0x64, 0x65, 0x72, 0x65, 0x64, 0x20, + 0x68, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, 0x79, + 0x20, 0x70, 0x65, 0x6F, 0x70, 0x6C, 0x65, 0x20, + 0x77, 0x65, 0x72, 0x65, 0x20, 0x64, 0x65, 0x73, + 0x74, 0x69, 0x74, 0x75, 0x74, 0x65, 0x20, 0x74, + 0x68, 0x61, 0x74, 0x20, 0x73, 0x61, 0x6D, 0x65, + 0x20, 0x6E, 0x69, 0x67, 0x68, 0x74, 0x20, 0x65, + 0x76, 0x65, 0x6E, 0x20, 0x69, 0x6E, 0x20, 0x68, + 0x69, 0x73, 0x20, 0x6F, 0x77, 0x6E, 0x20, 0x70, + 0x72, 0x6F, 0x73, 0x70, 0x65, 0x72, 0x6F, 0x75, + 0x73, 0x20, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x72, + 0x79, 0x2C, 0x20, 0x68, 0x6F, 0x77, 0x20, 0x6D, + 0x61, 0x6E, 0x79, 0x20, 0x68, 0x6F, 0x6D, 0x65, + 0x73, 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, 0x73, + 0x68, 0x61, 0x6E, 0x74, 0x69, 0x65, 0x73, 0x2C, + 0x20, 0x68, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, + 0x79, 0x20, 0x68, 0x75, 0x73, 0x62, 0x61, 0x6E, + 0x64, 0x73, 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, + 0x64, 0x72, 0x75, 0x6E, 0x6B, 0x20, 0x61, 0x6E, + 0x64, 0x20, 0x77, 0x69, 0x76, 0x65, 0x73, 0x20, + 0x73, 0x6F, 0x63, 0x6B, 0x65, 0x64, 0x2C, 0x20, + 0x61, 0x6E, 0x64, 0x20, 0x68, 0x6F, 0x77, 0x20, + 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x63, 0x68, 0x69, + 0x6C, 0x64, 0x72, 0x65, 0x6E, 0x20, 0x77, 0x65, + 0x72, 0x65, 0x20, 0x62, 0x75, 0x6C, 0x6C, 0x69, + 0x65, 0x64, 0x2C, 0x20, 0x61, 0x62, 0x75, 0x73, + 0x65, 0x64, 0x2C, 0x20, 0x6F, 0x72, 0x20, 0x61, + 0x62, 0x61, 0x6E, 0x64, 0x6F, 0x6E, 0x65, 0x64, + 0x2E, 0x20, 0x48, 0x6F, 0x77, 0x20, 0x6D, 0x61, + 0x6E, 0x79, 0x20, 0x66, 0x61, 0x6D, 0x69, 0x6C, + 0x69, 0x65, 0x73, 0x20, 0x68, 0x75, 0x6E, 0x67, + 0x65, 0x72, 0x65, 0x64, 0x20, 0x66, 0x6F, 0x72, + 0x20, 0x66, 0x6F, 0x6F, 0x64, 0x20, 0x74, 0x68, + 0x65, 0x79, 0x20, 0x63, 0x6F, 0x75, 0x6C, 0x64, + 0x20, 0x6E, 0x6F, 0x74, 0x20, 0x61, 0x66, 0x66, + 0x6F, 0x72, 0x64, 0x20, 0x74, 0x6F, 0x20, 0x62, + 0x75, 0x79, 0x3F, 0x20, 0x48, 0x6F, 0x77, 0x20, + 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x68, 0x65, 0x61, + 0x72, 0x74, 0x73, 0x20, 0x77, 0x65, 0x72, 0x65, + 0x20, 0x62, 0x72, 0x6F, 0x6B, 0x65, 0x6E, 0x3F, + 0x20, 0x48, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, + 0x79, 0x20, 0x73, 0x75, 0x69, 0x63, 0x69, 0x64, + 0x65, 0x73, 0x20, 0x77, 0x6F, 0x75, 0x6C, 0x64, + 0x20, 0x74, 0x61, 0x6B, 0x65, 0x20, 0x70, 0x6C, + 0x61, 0x63, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, + 0x20, 0x73, 0x61, 0x6D, 0x65, 0x20, 0x6E, 0x69, + 0x67, 0x68, 0x74, 0x2C, 0x20, 0x68, 0x6F, 0x77, + 0x20, 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x70, 0x65, + 0x6F, 0x70, 0x6C, 0x65, 0x20, 0x77, 0x6F, 0x75, + 0x6C, 0x64, 0x20, 0x67, 0x6F, 0x20, 0x69, 0x6E, + 0x73, 0x61, 0x6E, 0x65, 0x3F, 0x20, 0x48, 0x6F, + 0x77, 0x20, 0x6D, 0x61, 0x6E, 0x79, 0x20, 0x63, + 0x6F, 0x63, 0x6B, 0x72, 0x6F, 0x61, 0x63, 0x68, + 0x65, 0x73, 0x20, 0x61, 0x6E, 0x64, 0x20, 0x6C, + 0x61, 0x6E, 0x64, 0x6C, 0x6F, 0x72, 0x64, 0x73, + 0x20, 0x77, 0x6F, 0x75, 0x6C, 0x64, 0x20, 0x74, + 0x72, 0x69, 0x75, 0x6D, 0x70, 0x68, 0x3F, 0x20, + 0x48, 0x6F, 0x77, 0x20, 0x6D, 0x61, 0x6E, 0x79, + 0x20, 0x77, 0x69, 0x6E, 0x6E, 0x65, 0x72, 0x73, + 0x20, 0x77, 0x65, 0x72, 0x65, 0x20, 0x6C, 0x6F, + 0x73, 0x65, 0x72, 0x73, 0x2C, 0x20, 0x73, 0x75 + }, + .len_bits = 512 << 3, + }, + .ciphertext = { + .data = { + 0xA5, 0xC3, 0xEC, 0xC5, 0x14, 0x36, 0xC8, 0x00, + 0x6E, 0xA6, 0xAD, 0xFB, 0x1C, 0x4F, 0x60, 0x6C, + 0x60, 0xC0, 0x9C, 0x00, 0xED, 0xC0, 0x2A, 0xD8, + 0x41, 0xD3, 0x44, 0x27, 0xE6, 0x1A, 0x6E, 0xB3, + 0x9C, 0x5E, 0x3C, 0x71, 0x19, 0x96, 0x13, 0xED, + 0x06, 0xCA, 0xFB, 0x74, 0x7C, 0x23, 0x3E, 0x54, + 0x49, 0xF1, 0x32, 0xA4, 0xCD, 0xF3, 0x92, 0x33, + 0x22, 0xDB, 0xE0, 0x0D, 0x3F, 0x31, 0xA3, 0x2B, + 0x85, 0x11, 0x41, 0x11, 0x02, 0xE0, 0x2B, 0x0E, + 0x35, 0xDF, 0xE4, 0x03, 0x6B, 0x48, 0x80, 0x4A, + 0xB8, 0x2D, 0xD4, 0xB3, 0x5B, 0xF1, 0xB4, 0xF9, + 0xC9, 0x83, 0x4E, 0x2A, 0x53, 0x92, 0xB2, 0xF6, + 0x0C, 0xBA, 0xC4, 0x94, 0x8E, 0x96, 0x60, 0x26, + 0x4F, 0xA1, 0x85, 0xC6, 0x31, 0x57, 0xAE, 0xC3, + 0x8C, 0x09, 0x1B, 0xDB, 0xC1, 0x0D, 0x0E, 0xCE, + 0xB9, 0xE9, 0x30, 0x5E, 0x51, 0x9C, 0xE4, 0xC5, + 0xDC, 0xC0, 0x4A, 0xD9, 0x1B, 0xBE, 0xCF, 0x0A, + 0x95, 0xA1, 0x78, 0xDD, 0xE0, 0x46, 0x90, 0xC8, + 0xFF, 0xAE, 0x38, 0x1E, 0xAF, 0x5C, 0x57, 0xED, + 0x20, 0x49, 0xED, 0x54, 0x57, 0xBA, 0x65, 0xAD, + 0xC1, 0x2B, 0xD3, 0xEF, 0x97, 0x1F, 0x27, 0xBE, + 0x8E, 0x98, 0x2C, 0x4B, 0xDF, 0x11, 0x77, 0xB9, + 0x7D, 0x89, 0x0D, 0x28, 0xE3, 0x8B, 0x09, 0xAF, + 0x85, 0xCE, 0x0F, 0x49, 0xD5, 0x8E, 0xF2, 0xF2, + 0xF9, 0x4C, 0xE0, 0xF0, 0x9B, 0xD0, 0x42, 0x07, + 0xBC, 0xD4, 0x8E, 0x78, 0xCD, 0x4D, 0x6D, 0x12, + 0xB2, 0x8D, 0x4C, 0xCB, 0x44, 0x2A, 0xA2, 0x4C, + 0xD7, 0x15, 0xFA, 0xB1, 0x05, 0xB9, 0xFF, 0x95, + 0x29, 0xF7, 0xA6, 0xFC, 0x25, 0x74, 0xF6, 0x9E, + 0x01, 0xFE, 0x4C, 0xFD, 0x50, 0xD8, 0xF6, 0x4C, + 0xDF, 0x75, 0xEF, 0xAF, 0x04, 0x84, 0x95, 0x15, + 0x33, 0x6D, 0x8E, 0x0A, 0x89, 0xE0, 0x20, 0x2E, + 0xC2, 0x0E, 0xE1, 0x91, 0xB9, 0x06, 0x34, 0x14, + 0xD4, 0x65, 0x68, 0x72, 0x5C, 0x60, 0x09, 0x2C, + 0x8A, 0x82, 0x4A, 0x04, 0x71, 0xB8, 0xDF, 0x45, + 0x3C, 0x21, 0x24, 0x06, 0x34, 0xD0, 0xE3, 0xA7, + 0x82, 0x25, 0xAB, 0x7B, 0xDD, 0x6D, 0xCC, 0xAE, + 0x01, 0xB1, 0xD6, 0x2A, 0xE2, 0x96, 0x6C, 0x65, + 0x94, 0xDB, 0xB5, 0x0F, 0xCD, 0xC9, 0xA6, 0x01, + 0x5C, 0x89, 0x59, 0x6C, 0x10, 0x4C, 0xA3, 0xBC, + 0x9A, 0x4F, 0x11, 0xEB, 0x54, 0xE0, 0x3B, 0x83, + 0x9C, 0x5E, 0x16, 0x0D, 0xD6, 0x2C, 0x4B, 0x6F, + 0xE6, 0xB9, 0xF6, 0x02, 0x6C, 0x34, 0x0C, 0x4D, + 0xEE, 0xF0, 0x42, 0xC3, 0x0C, 0xDE, 0x93, 0x8A, + 0xC1, 0xB5, 0xEF, 0xCF, 0x54, 0x9C, 0x3B, 0x4B, + 0x70, 0x6C, 0x06, 0x97, 0x3E, 0x26, 0x8C, 0x61, + 0x52, 0x47, 0xF6, 0x9C, 0x28, 0x5C, 0xD1, 0x4A, + 0x67, 0x4B, 0xCD, 0xD9, 0xA1, 0x8C, 0x29, 0x31, + 0x10, 0x71, 0x45, 0x68, 0x63, 0xCE, 0xC9, 0xBC, + 0x46, 0x6A, 0x81, 0x02, 0x4D, 0x66, 0xA4, 0x65, + 0xCC, 0x33, 0xEC, 0x99, 0x14, 0x4D, 0x28, 0xAB, + 0xF6, 0xCB, 0x46, 0x13, 0x0C, 0x13, 0x74, 0x22, + 0x4A, 0x7B, 0x53, 0x2F, 0x11, 0x54, 0xAF, 0xD9, + 0x2D, 0x66, 0x98, 0x7E, 0x20, 0x57, 0x01, 0x4C, + 0xF7, 0x0C, 0xCB, 0x70, 0xFF, 0x3D, 0xC4, 0x5F, + 0x3A, 0xAE, 0xD9, 0xC6, 0x93, 0xFC, 0x2C, 0x23, + 0x4C, 0x43, 0x92, 0x9B, 0x92, 0x3E, 0x35, 0xB7, + 0x1E, 0x96, 0xED, 0xCC, 0x60, 0xDE, 0x2E, 0x19, + 0xB8, 0x24, 0x55, 0x1E, 0x52, 0xB9, 0x52, 0x3C, + 0xC0, 0x06, 0x74, 0xC0, 0xEE, 0xD1, 0xA1, 0x80, + 0x98, 0xE8, 0xDF, 0x0D, 0x8A, 0x44, 0xC2, 0x36, + 0x16, 0xCC, 0x03, 0x68, 0xD9, 0xC2, 0xCF, 0xE2, + 0x78, 0xBD, 0x1A, 0x31, 0x19, 0x5D, 0xE0, 0x6E, + 0x09, 0x6E, 0xD5, 0x17, 0xB8, 0xA8, 0xF4, 0xBE, + 0x2C, 0xD6, 0xD1, 0x04 + }, + .len_bits = 516 << 3, + }, + .digest_enc = { + .data = { + 0x2C, 0xD6, 0xD1, 0x04 + }, + .len = 4, + .offset = 512, + }, + .validDataLen = { + .len_bits = 516 << 3, + }, + .validCipherLen = { + .len_bits = 516 << 3, + }, + .validAuthLen = { + .len_bits = 512 << 3, + } +}; + struct mixed_cipher_auth_test_data auth_zuc_cipher_snow_test_case_1 = { .auth_algo = RTE_CRYPTO_AUTH_ZUC_EIA3, .auth_key = { diff --git a/app/test/test_cryptodev_snow3g_test_vectors.h b/app/test/test_cryptodev_snow3g_test_vectors.h index bbe05662be..3e7294675e 100644 --- a/app/test/test_cryptodev_snow3g_test_vectors.h +++ b/app/test/test_cryptodev_snow3g_test_vectors.h @@ -736,4 +736,71 @@ struct snow3g_test_data snow3g_auth_cipher_partial_digest_encryption = { }, }; +struct snow3g_test_data snow3g_auth_cipher_total_digest_encryption_1 = { + .key = { + .data = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 + + }, + .len = 16 + }, + .cipher_iv = { + .data = { + 0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00, + 0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00 + }, + .len = 16 + }, + .auth_iv = { + .data = { + 0xB6, 0xAF, 0x61, 0x44, 0x98, 0x38, 0x70, 0x3A, + 0x36, 0xAF, 0x61, 0x44, 0x98, 0x38, 0xF0, 0x3A + }, + .len = 16 + }, + .plaintext = { + .data = { + 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, + 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, + 0x06, 0xC3, 0x52, 0x5B, 0x98, 0x07, 0xE4, 0x67, + 0xE2, 0xD8, 0xFF, 0x58, 0x05, 0xF5, 0x13, 0x22, + }, + .len = 32 << 3 + }, + .ciphertext = { + .data = { + 0x5A, 0x5A, 0xCF, 0xCF, 0x3D, 0x11, 0xBF, 0xD9, + 0xC3, 0x7F, 0x7C, 0xA8, 0x1A, 0x9F, 0x9F, 0x34, + 0x99, 0xF7, 0x13, 0x2D, 0x22, 0xDC, 0xF5, 0x5B, + 0x3F, 0x49, 0x70, 0x63, 0x26, 0x6C, 0x4E, 0x8E + }, + .len = 32 << 3 + }, + .cipher = { + .len_bits = 30 << 3, + .offset_bits = 2 << 3 + }, + .auth = { + .len_bits = 26 << 3, + .offset_bits = 2 << 3 + }, + .digest = { + .data = { + 0x26, 0x6C, 0x4E, 0x8E + }, + .len = 4, + .offset_bytes = 28 + }, + .validDataLenInBits = { + .len = 32 << 3 + }, + .validCipherLenInBits = { + .len = 30 << 3 + }, + .validAuthLenInBits = { + .len = 26 << 3 + }, +}; + #endif /* TEST_CRYPTODEV_SNOW3G_TEST_VECTORS_H_ */ diff --git a/app/test/test_cryptodev_zuc_test_vectors.h b/app/test/test_cryptodev_zuc_test_vectors.h index 5d1d264579..da19d4e1af 100644 --- a/app/test/test_cryptodev_zuc_test_vectors.h +++ b/app/test/test_cryptodev_zuc_test_vectors.h @@ -1239,6 +1239,83 @@ struct wireless_test_data zuc_auth_cipher_test_case_1 = { } }; +struct wireless_test_data zuc_auth_cipher_test_case_2 = { + .key = { + .data = { + 0xE5, 0xBD, 0x3E, 0xA0, 0xEB, 0x55, 0xAD, 0xE8, + 0x66, 0xC6, 0xAC, 0x58, 0xBD, 0x54, 0x30, 0x2A + }, + .len = 16 + }, + .cipher_iv = { + .data = { + 0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00 + }, + .len = 16 + }, + .auth_iv = { + .data = { + 0xFA, 0x55, 0x6B, 0x26, 0x18, 0x00, 0x00, 0x00, + 0xFA, 0x55, 0x6B, 0x26, 0x18, 0x00, 0x00, 0x00 + }, + .len = 16 + }, + .plaintext = { + .data = { + 0x14, 0xA8, 0xEF, 0x69, 0x3D, 0x67, 0x85, 0x07, + 0xBB, 0xE7, 0x27, 0x0A, 0x7F, 0x67, 0xFF, 0x50, + 0x06, 0xC3, 0x52, 0x5B, 0x98, 0x07, 0xE4, 0x67, + 0xC4, 0xE5, 0x60, 0x00, 0xBA, 0x33, 0x8F, 0x5D, + 0x42, 0x95, 0x59, 0x03, 0x67, 0x51, 0x82, 0x22, + 0x46, 0xC8, 0x0D, 0x3B, 0x38, 0xF0, 0x7F, 0x4B, + 0xE2, 0xD8, 0xFF, 0x58, 0x05, 0xF5, 0x13, 0x22, + 0x29, 0xBD, 0xE9, 0x3B, 0xBB, 0xDC, 0xAF, 0x38, + 0x2B, 0xF1, 0xEE, 0x97, 0x2F, 0xBF, 0x99, 0x77, + 0xBA, 0xDA, 0x89, 0x45, 0x84, 0x7A, 0x2A, 0x6C, + 0x9A, 0xD3, 0x4A, 0x66, 0x75, 0x54, 0xE0, 0x4D, + 0x1F, 0x7F, 0xA2, 0xC3, 0x32, 0x41, 0xBD, 0x8F, + 0x01, 0xBA, 0x22, 0x0D + }, + .len = 96 << 3 + }, + .ciphertext = { + .data = { + 0x13, 0x1D, 0x43, 0xE0, 0xDE, 0xA1, 0xBE, 0x5C, + 0x5A, 0x1B, 0xFD, 0x97, 0x1D, 0x85, 0x2C, 0xBF, + 0x71, 0x2D, 0x7B, 0x4F, 0x57, 0x96, 0x1F, 0xEA, + 0x32, 0x08, 0xAF, 0xA8, 0xBC, 0xA4, 0x33, 0xF4, + 0x56, 0xAD, 0x09, 0xC7, 0x41, 0x7E, 0x58, 0xBC, + 0x69, 0xCF, 0x88, 0x66, 0xD1, 0x35, 0x3F, 0x74, + 0x86, 0x5E, 0x80, 0x78, 0x1D, 0x20, 0x2D, 0xFB, + 0x3E, 0xCF, 0xF7, 0xFC, 0xBC, 0x3B, 0x19, 0x0F, + 0xE8, 0x2A, 0x20, 0x4E, 0xD0, 0xE3, 0x50, 0xFC, + 0x0F, 0x6F, 0x26, 0x13, 0xB2, 0xF2, 0xBC, 0xA6, + 0xDF, 0x5A, 0x47, 0x3A, 0x57, 0xA4, 0xA0, 0x0D, + 0x98, 0x5E, 0xBA, 0xD8, 0x80, 0xD6, 0xF2, 0x38, + 0x00, 0x3B, 0x7C, 0x75 + }, + .len = 800 + }, + .validDataLenInBits = { + .len = 800 + }, + .validCipherLenInBits = { + .len = 800 + }, + .validAuthLenInBits = { + .len = 96 << 3 + }, + .validCipherOffsetInBits = { + .len = 0 + }, + .digest = { + .data = { 0x00, 0x3B, 0x7C, 0x75 }, + .len = 4, + .offset_bytes = 96 + } +}; + /** ZUC-256 vectors **/ static struct wireless_test_data zuc256_test_case_cipher_1 = { .key = { -- 2.25.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH v4] app/test: add additional stream cipher tests 2022-06-23 18:19 ` [PATCH v4] " Tejasree Kondoj @ 2022-06-28 12:07 ` Power, Ciara 2022-06-28 12:15 ` Akhil Goyal 0 siblings, 1 reply; 13+ messages in thread From: Power, Ciara @ 2022-06-28 12:07 UTC (permalink / raw) To: Tejasree Kondoj, Akhil Goyal, Zhang, Roy Fan Cc: Anoob Joseph, Ankur Dwivedi, dev > -----Original Message----- > From: Tejasree Kondoj <ktejasree@marvell.com> > Sent: Thursday 23 June 2022 19:20 > To: Akhil Goyal <gakhil@marvell.com>; Power, Ciara <ciara.power@intel.com>; > Zhang, Roy Fan <roy.fan.zhang@intel.com> > Cc: Anoob Joseph <anoobj@marvell.com>; Ankur Dwivedi > <adwivedi@marvell.com>; dev@dpdk.org > Subject: [PATCH v4] app/test: add additional stream cipher tests > > Adding zuc, snow3g and aes-ctr-cmac auth-cipher test vectors with same auth > and cipher offsets and total digest data encrypted. > Existing tests have different cipher and auth offsets and partial or no digest > encrypted. > > Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com> > --- > v4: > * Set last 3 bytes of IV to zero in each 8 byte block > > v3: > * Modified IV of test vectors as per specification > > v2: > * Removed cn9k PMD checks > > app/test/test_cryptodev.c | 270 ++++++++++++++++++ > app/test/test_cryptodev_mixed_test_vectors.h | 194 +++++++++++++ > app/test/test_cryptodev_snow3g_test_vectors.h | 67 +++++ > app/test/test_cryptodev_zuc_test_vectors.h | 77 +++++ > 4 files changed, 608 insertions(+) Thanks for updating those vectors to match spec. Acked-by: Ciara Power <ciara.power@intel.com> ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH v4] app/test: add additional stream cipher tests 2022-06-28 12:07 ` Power, Ciara @ 2022-06-28 12:15 ` Akhil Goyal 0 siblings, 0 replies; 13+ messages in thread From: Akhil Goyal @ 2022-06-28 12:15 UTC (permalink / raw) To: Power, Ciara, Tejasree Kondoj, Zhang, Roy Fan Cc: Anoob Joseph, Ankur Dwivedi, dev > > Adding zuc, snow3g and aes-ctr-cmac auth-cipher test vectors with same auth > > and cipher offsets and total digest data encrypted. > > Existing tests have different cipher and auth offsets and partial or no digest > > encrypted. > > > > Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com> > > --- > Thanks for updating those vectors to match spec. > > Acked-by: Ciara Power <ciara.power@intel.com> Applied to dpdk-next-crypto Thanks. ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2022-06-28 12:15 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-06-17 7:36 [PATCH 0/4] support stream cipher chained operations Tejasree Kondoj 2022-06-17 7:36 ` [PATCH 1/4] crypto/cnxk: fix CMAC IV Tejasree Kondoj 2022-06-17 7:36 ` [PATCH 2/4] crypto/cnxk: support stream cipher chained operations Tejasree Kondoj 2022-06-17 7:36 ` [PATCH 3/4] crypto/cnxk: support scatter gather mode Tejasree Kondoj 2022-06-17 7:36 ` [PATCH 4/4] app/test: add additional stream cipher tests Tejasree Kondoj 2022-06-20 12:30 ` [PATCH v2] " Tejasree Kondoj 2022-06-21 12:51 ` Akhil Goyal 2022-06-21 14:27 ` Power, Ciara 2022-06-23 6:19 ` Tejasree Kondoj 2022-06-23 13:41 ` [PATCH v3] " Tejasree Kondoj 2022-06-23 18:19 ` [PATCH v4] " Tejasree Kondoj 2022-06-28 12:07 ` Power, Ciara 2022-06-28 12:15 ` Akhil Goyal
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).