Skip to contentSkip to conversation

support stream cipher chained operations

PATCH Superseded Tejasree Kondoj 3 participants 13 messages Jun 17, 2022 – Jun 28, 2022 Crypto API

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover support stream cipher chained operations

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(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/4 crypto/cnxk: fix CMAC IV

Fixing CMAC IV length to 16 bytes.

Fixes 759b5e653580 ("crypto/cnxk: support AES-CMAC")
---
 drivers/crypto/cnxk/cnxk_se.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/cnxk/cnxk_se.h +1 -1
index 8ed3a8b2ef..cca44f1d3e 100644
@@ -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;
 	}
 }
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/4 crypto/cnxk: support stream cipher chained operations

In reply to Tejasree Kondoj

Adding support for zuc, snow3g and aes-ctr-cmac chained operations on cn9k using key and IV scheme in microcode.

---
 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(-)
drivers/common/cnxk/roc_se.c +200 -71
index 3f0821e400..8d6446c3a0 100644
@@ -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;
 }
drivers/common/cnxk/roc_se.h +61 -13

109 lines not on this page · raw message

drivers/crypto/cnxk/cnxk_cryptodev_ops.c +66 -3

117 lines not on this page · raw message

drivers/crypto/cnxk/cnxk_se.h +209 -26

402 lines not on this page · raw message

Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/4 crypto/cnxk: support scatter gather mode

In reply to Tejasree Kondoj

Adding scatter gather support for zuc, snow3g
and aes-ctr-cmac chained operations on cn9k.

---
 drivers/crypto/cnxk/cnxk_se.h | 149 +++++++++++++++++++++++++++++-----
 1 file changed, 128 insertions(+), 21 deletions(-)
drivers/crypto/cnxk/cnxk_se.h +128 -21
index 7429d66314..a2a97aa88f 100644
@@ -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;
 
Signature · 1 line
2.25.1
#4 lore raw

PATCH 4/4 app/test: add additional stream cipher tests

In reply to Tejasree Kondoj

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.

---
 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(+)
app/test/test_cryptodev.c +432 -0
index 2766e0cc10..2aa28141e7 100644
@@ -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,
app/test/test_cryptodev_mixed_test_vectors.h +194 -0

200 lines not on this page · raw message

app/test/test_cryptodev_snow3g_test_vectors.h +137 -0

141 lines not on this page · raw message

app/test/test_cryptodev_zuc_test_vectors.h +77 -0

83 lines not on this page · raw message

Signature · 1 line
2.25.1
#5 lore raw

PATCH v2 1/1 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.

---
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(+)
app/test/test_cryptodev.c +288 -0
index 2766e0cc10..d7c7d50233 100644
@@ -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,
app/test/test_cryptodev_mixed_test_vectors.h +194 -0

200 lines not on this page · raw message

app/test/test_cryptodev_snow3g_test_vectors.h +137 -0

141 lines not on this page · raw message

app/test/test_cryptodev_zuc_test_vectors.h +77 -0

83 lines not on this page · raw message

Signature · 1 line
2.25.1
Acked-by on v2 1/1
#6 lore raw

RE: [PATCH v2] app/test: add additional stream cipher tests

Quoted 8 lines

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.

---

@Ciara Power: Do you have comments on this patch?

#7 lore raw

RE: [PATCH v2] app/test: add additional stream cipher tests

Hi Tejasree , Akhil,

Quoted 14 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Tuesday 21 June 2022 13:51
To: Tejasree Kondoj <[email protected]>; Zhang, Roy Fan <[email protected]>; Power, Ciara <[email protected]>
Cc: Anoob Joseph <[email protected]>; Ankur Dwivedi <[email protected]>; [email protected]
Subject: RE: [PATCH v2] app/test: add additional stream cipher tests

Quoted 5 lines

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.

Quoted 5 lines
Quoted 2 lines

---

@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

#8 lore raw

RE: [PATCH v2] app/test: add additional stream cipher tests

Hi Ciara,

Thanks for pointing it out. Will rework test vectors and submit new version.

Thanks
Tejasree

Quoted 59 lines

-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Tuesday, June 21, 2022 7:58 PM
To: Akhil Goyal <[email protected]>; Tejasree Kondoj <[email protected]>; Zhang, Roy Fan <[email protected]>
Cc: Anoob Joseph <[email protected]>; Ankur Dwivedi <[email protected]>; [email protected]
Subject: [EXT] RE: [PATCH v2] app/test: add additional stream cipher tests

External Email

----------------------------------------------------------------------
Hi Tejasree , Akhil,

Quoted 14 lines

-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Tuesday 21 June 2022 13:51
To: Tejasree Kondoj <[email protected]>; Zhang, Roy Fan <[email protected]>; Power, Ciara <[email protected]>
Cc: Anoob Joseph <[email protected]>; Ankur Dwivedi <[email protected]>; [email protected]
Subject: RE: [PATCH v2] app/test: add additional stream cipher tests

Quoted 5 lines

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.

Quoted 5 lines
Quoted 2 lines

---

@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

#9 lore raw

PATCH v3 1/1 app/test: add additional stream cipher tests

In reply to Tejasree Kondoj

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.

---
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(+)
app/test/test_cryptodev.c +270 -0
index 1cac76a64a..08842e77e6 100644
@@ -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,
app/test/test_cryptodev_mixed_test_vectors.h +194 -0

200 lines not on this page · raw message

app/test/test_cryptodev_snow3g_test_vectors.h +67 -0

71 lines not on this page · raw message

app/test/test_cryptodev_zuc_test_vectors.h +77 -0

83 lines not on this page · raw message

Signature · 1 line
2.25.1
#10 lore raw

PATCH v4 1/1 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.

---
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(+)
app/test/test_cryptodev.c +270 -0
index 1cac76a64a..08842e77e6 100644
@@ -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,
app/test/test_cryptodev_mixed_test_vectors.h +194 -0

200 lines not on this page · raw message

app/test/test_cryptodev_snow3g_test_vectors.h +67 -0

71 lines not on this page · raw message

app/test/test_cryptodev_zuc_test_vectors.h +77 -0

83 lines not on this page · raw message

Signature · 1 line
2.25.1
Acked-by on v4 1/1
#11 lore raw

RE: [PATCH v4] app/test: add additional stream cipher tests

Quoted 24 lines

-----Original Message-----
From: Tejasree Kondoj <[email protected]>
Sent: Thursday 23 June 2022 19:20
To: Akhil Goyal <[email protected]>; Power, Ciara <[email protected]>; Zhang, Roy Fan <[email protected]>
Cc: Anoob Joseph <[email protected]>; Ankur Dwivedi <[email protected]>; [email protected]
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.

---
v4:
* Set last 3 bytes of IV to zero in each 8 byte block

v3:
* Modified IV of test vectors as per specification

Quoted 8 lines

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.

Applied
#12 lore raw

RE: [PATCH v4] app/test: add additional stream cipher tests

Quoted 10 lines
Quoted 7 lines

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.

---

Thanks for updating those vectors to match spec.

Applied to dpdk-next-crypto

Thanks.