@@ -58,6 +58,12 @@ static const char *auth_alg_name(odp_auth_alg_t auth)
return "ODP_AUTH_ALG_AES_CMAC";
case ODP_AUTH_ALG_CHACHA20_POLY1305:
return "ODP_AUTH_ALG_CHACHA20_POLY1305";
+ case ODP_AUTH_ALG_KASUMI_F9:
+ return "ODP_AUTH_ALG_KASUMI_F9";
+ case ODP_AUTH_ALG_SNOW3G_UIA2:
+ return "ODP_AUTH_ALG_SNOW3G_UIA2";
+ case ODP_AUTH_ALG_ZUC_EIA3:
+ return "ODP_AUTH_ALG_ZUC_EIA3";
default:
return "Unknown";
}
@@ -80,6 +86,12 @@ static const char *cipher_alg_name(odp_cipher_alg_t cipher)
return "ODP_CIPHER_ALG_AES_CCM";
case ODP_CIPHER_ALG_CHACHA20_POLY1305:
return "ODP_CIPHER_ALG_CHACHA20_POLY1305";
+ case ODP_CIPHER_ALG_KASUMI_F8:
+ return "ODP_CIPHER_ALG_KASUMI_F8";
+ case ODP_CIPHER_ALG_SNOW3G_UEA2:
+ return "ODP_CIPHER_ALG_SNOW3G_UEA2";
+ case ODP_CIPHER_ALG_ZUC_EEA3:
+ return "ODP_CIPHER_ALG_ZUC_EEA3";
default:
return "Unknown";
}
@@ -322,6 +334,7 @@ static void alg_test(odp_crypto_op_t op,
odp_crypto_ses_create_err_t status;
odp_bool_t ok = false;
int iteration;
+ uint32_t reflength;
odp_crypto_session_param_t ses_params;
odp_packet_data_range_t cipher_range;
odp_packet_data_range_t auth_range;
@@ -358,6 +371,7 @@ static void alg_test(odp_crypto_op_t op,
ses_params.auth_key = auth_key;
ses_params.auth_digest_len = ref->digest_length;
ses_params.auth_aad_len = ref->aad_length;
+ ses_params.bitstring = ref->bitstring;
rc = odp_crypto_session_create(&ses_params, &session, &status);
CU_ASSERT_FATAL(!rc);
@@ -370,9 +384,14 @@ static void alg_test(odp_crypto_op_t op,
auth_range.offset = 0;
auth_range.length = ref->length;
+ if (ref->bitstring)
+ reflength = (ref->length + 7) / 8;
+ else
+ reflength = ref->length;
+
/* Prepare input data */
odp_packet_t pkt = odp_packet_alloc(suite_context.pool,
- ref->length + ref->digest_length);
+ reflength + ref->digest_length);
CU_ASSERT(pkt != ODP_PACKET_INVALID);
if (pkt == ODP_PACKET_INVALID)
goto cleanup;
@@ -386,18 +405,18 @@ static void alg_test(odp_crypto_op_t op,
continue;
if (op == ODP_CRYPTO_OP_ENCODE) {
- odp_packet_copy_from_mem(pkt, 0, ref->length,
+ odp_packet_copy_from_mem(pkt, 0, reflength,
ref->plaintext);
} else {
- odp_packet_copy_from_mem(pkt, 0, ref->length,
+ odp_packet_copy_from_mem(pkt, 0, reflength,
ref->ciphertext);
- odp_packet_copy_from_mem(pkt, ref->length,
+ odp_packet_copy_from_mem(pkt, reflength,
ref->digest_length,
ref->digest);
if (iteration == WRONG_DIGEST_TEST) {
uint8_t byte = ~ref->digest[0];
- odp_packet_copy_from_mem(pkt, ref->length,
+ odp_packet_copy_from_mem(pkt, reflength,
1, &byte);
}
}
@@ -407,19 +426,19 @@ static void alg_test(odp_crypto_op_t op,
ovr_iv ? ref->cipher_iv : NULL,
ovr_iv ? ref->auth_iv : NULL,
&cipher_range, &auth_range,
- ref->aad, ref->length);
+ ref->aad, reflength);
else if (ODP_CRYPTO_ASYNC == suite_context.op_mode)
rc = alg_packet_op_enq(pkt, &ok, session,
ovr_iv ? ref->cipher_iv : NULL,
ovr_iv ? ref->auth_iv : NULL,
&cipher_range, &auth_range,
- ref->aad, ref->length);
+ ref->aad, reflength);
else
rc = alg_packet_op(pkt, &ok, session,
ovr_iv ? ref->cipher_iv : NULL,
ovr_iv ? ref->auth_iv : NULL,
&cipher_range, &auth_range,
- ref->aad, ref->length);
+ ref->aad, reflength);
if (rc < 0)
break;
@@ -433,14 +452,14 @@ static void alg_test(odp_crypto_op_t op,
if (op == ODP_CRYPTO_OP_ENCODE) {
CU_ASSERT(!packet_cmp_mem(pkt, 0,
ref->ciphertext,
- ref->length));
- CU_ASSERT(!packet_cmp_mem(pkt, ref->length,
+ reflength));
+ CU_ASSERT(!packet_cmp_mem(pkt, reflength,
ref->digest,
ref->digest_length));
} else {
CU_ASSERT(!packet_cmp_mem(pkt, 0,
ref->plaintext,
- ref->length));
+ reflength));
}
}
@@ -489,6 +508,15 @@ static void check_alg(odp_crypto_op_t op,
if (cipher_alg == ODP_CIPHER_ALG_CHACHA20_POLY1305 &&
!(capa.ciphers.bit.chacha20_poly1305))
rc = -1;
+ if (cipher_alg == ODP_CIPHER_ALG_KASUMI_F8 &&
+ !(capa.ciphers.bit.kasumi_f8))
+ rc = -1;
+ if (cipher_alg == ODP_CIPHER_ALG_SNOW3G_UEA2 &&
+ !(capa.ciphers.bit.snow3g_uea2))
+ rc = -1;
+ if (cipher_alg == ODP_CIPHER_ALG_ZUC_EEA3 &&
+ !(capa.ciphers.bit.zuc_eea3))
+ rc = -1;
if (cipher_alg == ODP_CIPHER_ALG_DES &&
!(capa.ciphers.bit.des))
rc = -1;
@@ -514,6 +542,15 @@ static void check_alg(odp_crypto_op_t op,
if (auth_alg == ODP_AUTH_ALG_CHACHA20_POLY1305 &&
!(capa.auths.bit.chacha20_poly1305))
rc = -1;
+ if (auth_alg == ODP_AUTH_ALG_KASUMI_F9 &&
+ !(capa.auths.bit.kasumi_f9))
+ rc = -1;
+ if (auth_alg == ODP_AUTH_ALG_SNOW3G_UIA2 &&
+ !(capa.auths.bit.snow3g_uia2))
+ rc = -1;
+ if (auth_alg == ODP_AUTH_ALG_ZUC_EIA3 &&
+ !(capa.auths.bit.zuc_eia3))
+ rc = -1;
if (auth_alg == ODP_AUTH_ALG_MD5_HMAC &&
!(capa.auths.bit.md5_hmac))
rc = -1;
@@ -559,7 +596,9 @@ static void check_alg(odp_crypto_op_t op,
if (cipher_capa[i].key_len ==
ref[idx].cipher_key_length &&
cipher_capa[i].iv_len ==
- ref[idx].cipher_iv_length) {
+ ref[idx].cipher_iv_length &&
+ cipher_capa[i].bitstring ==
+ ref[idx].bitstring) {
cipher_idx = i;
break;
}
@@ -567,10 +606,11 @@ static void check_alg(odp_crypto_op_t op,
if (cipher_idx < 0) {
printf("\n Unsupported: alg=%s, key_len=%" PRIu32
- ", iv_len=%" PRIu32 "\n",
+ ", iv_len=%" PRIu32 "%s\n",
cipher_alg_name(cipher_alg),
ref[idx].cipher_key_length,
- ref[idx].cipher_iv_length);
+ ref[idx].cipher_iv_length,
+ ref[idx].bitstring ? " bitstring" : "");
continue;
}
@@ -580,7 +620,9 @@ static void check_alg(odp_crypto_op_t op,
auth_capa[i].iv_len ==
ref[idx].auth_iv_length &&
auth_capa[i].key_len ==
- ref[idx].auth_key_length) {
+ ref[idx].auth_key_length &&
+ auth_capa[i].bitstring ==
+ ref[idx].bitstring) {
auth_idx = i;
break;
}
@@ -588,11 +630,13 @@ static void check_alg(odp_crypto_op_t op,
if (auth_idx < 0) {
printf("\n Unsupported: alg=%s, key_len=%" PRIu32
- ", iv_len=%" PRIu32 ", digest_len=%" PRIu32 "\n",
+ ", iv_len=%" PRIu32 ", digest_len=%" PRIu32
+ "%s\n",
auth_alg_name(auth_alg),
ref[idx].auth_key_length,
ref[idx].auth_iv_length,
- ref[idx].digest_length);
+ ref[idx].digest_length,
+ ref[idx].bitstring ? " bitstring" : "");
continue;
}
@@ -687,6 +731,18 @@ static int check_alg_support(odp_cipher_alg_t cipher, odp_auth_alg_t auth)
if (!capability.ciphers.bit.chacha20_poly1305)
return ODP_TEST_INACTIVE;
break;
+ case ODP_CIPHER_ALG_KASUMI_F8:
+ if (!capability.ciphers.bit.kasumi_f8)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_CIPHER_ALG_SNOW3G_UEA2:
+ if (!capability.ciphers.bit.snow3g_uea2)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_CIPHER_ALG_ZUC_EEA3:
+ if (!capability.ciphers.bit.zuc_eea3)
+ return ODP_TEST_INACTIVE;
+ break;
default:
fprintf(stderr, "Unsupported cipher algorithm\n");
return ODP_TEST_INACTIVE;
@@ -734,6 +790,18 @@ static int check_alg_support(odp_cipher_alg_t cipher, odp_auth_alg_t auth)
if (!capability.auths.bit.chacha20_poly1305)
return ODP_TEST_INACTIVE;
break;
+ case ODP_AUTH_ALG_KASUMI_F9:
+ if (!capability.auths.bit.kasumi_f9)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_SNOW3G_UIA2:
+ if (!capability.auths.bit.snow3g_uia2)
+ return ODP_TEST_INACTIVE;
+ break;
+ case ODP_AUTH_ALG_ZUC_EIA3:
+ if (!capability.auths.bit.zuc_eia3)
+ return ODP_TEST_INACTIVE;
+ break;
default:
fprintf(stderr, "Unsupported authentication algorithm\n");
return ODP_TEST_INACTIVE;
@@ -1108,6 +1176,141 @@ static void crypto_test_dec_alg_aes_ctr_ovr_iv(void)
true);
}
+static int check_alg_kasumi_f8(void)
+{
+ return check_alg_support(ODP_CIPHER_ALG_KASUMI_F8, ODP_AUTH_ALG_NULL);
+}
+
+static void crypto_test_enc_alg_kasumi_f8(void)
+{
+ check_alg(ODP_CRYPTO_OP_ENCODE,
+ ODP_CIPHER_ALG_KASUMI_F8,
+ ODP_AUTH_ALG_NULL,
+ kasumi_f8_reference,
+ ARRAY_SIZE(kasumi_f8_reference),
+ false);
+}
+
+static void crypto_test_enc_alg_kasumi_f8_ovr_iv(void)
+{
+ check_alg(ODP_CRYPTO_OP_ENCODE,
+ ODP_CIPHER_ALG_KASUMI_F8,
+ ODP_AUTH_ALG_NULL,
+ kasumi_f8_reference,
+ ARRAY_SIZE(kasumi_f8_reference),
+ true);
+}
+
+static void crypto_test_dec_alg_kasumi_f8(void)
+{
+ check_alg(ODP_CRYPTO_OP_DECODE,
+ ODP_CIPHER_ALG_KASUMI_F8,
+ ODP_AUTH_ALG_NULL,
+ kasumi_f8_reference,
+ ARRAY_SIZE(kasumi_f8_reference),
+ false);
+}
+
+static void crypto_test_dec_alg_kasumi_f8_ovr_iv(void)
+{
+ check_alg(ODP_CRYPTO_OP_DECODE,
+ ODP_CIPHER_ALG_KASUMI_F8,
+ ODP_AUTH_ALG_NULL,
+ kasumi_f8_reference,
+ ARRAY_SIZE(kasumi_f8_reference),
+ true);
+}
+
+static int check_alg_snow3g_uea2(void)
+{
+ return check_alg_support(ODP_CIPHER_ALG_SNOW3G_UEA2, ODP_AUTH_ALG_NULL);
+}
+
+static void crypto_test_enc_alg_snow3g_uea2(void)
+{
+ check_alg(ODP_CRYPTO_OP_ENCODE,
+ ODP_CIPHER_ALG_SNOW3G_UEA2,
+ ODP_AUTH_ALG_NULL,
+ snow3g_uea2_reference,
+ ARRAY_SIZE(snow3g_uea2_reference),
+ false);
+}
+
+static void crypto_test_enc_alg_snow3g_uea2_ovr_iv(void)
+{
+ check_alg(ODP_CRYPTO_OP_ENCODE,
+ ODP_CIPHER_ALG_SNOW3G_UEA2,
+ ODP_AUTH_ALG_NULL,
+ snow3g_uea2_reference,
+ ARRAY_SIZE(snow3g_uea2_reference),
+ true);
+}
+
+static void crypto_test_dec_alg_snow3g_uea2(void)
+{
+ check_alg(ODP_CRYPTO_OP_DECODE,
+ ODP_CIPHER_ALG_SNOW3G_UEA2,
+ ODP_AUTH_ALG_NULL,
+ snow3g_uea2_reference,
+ ARRAY_SIZE(snow3g_uea2_reference),
+ false);
+}
+
+static void crypto_test_dec_alg_snow3g_uea2_ovr_iv(void)
+{
+ check_alg(ODP_CRYPTO_OP_DECODE,
+ ODP_CIPHER_ALG_SNOW3G_UEA2,
+ ODP_AUTH_ALG_NULL,
+ snow3g_uea2_reference,
+ ARRAY_SIZE(snow3g_uea2_reference),
+ true);
+}
+
+static int check_alg_zuc_eea3(void)
+{
+ return check_alg_support(ODP_CIPHER_ALG_ZUC_EEA3, ODP_AUTH_ALG_NULL);
+}
+
+static void crypto_test_enc_alg_zuc_eea3(void)
+{
+ check_alg(ODP_CRYPTO_OP_ENCODE,
+ ODP_CIPHER_ALG_ZUC_EEA3,
+ ODP_AUTH_ALG_NULL,
+ zuc_eea3_reference,
+ ARRAY_SIZE(zuc_eea3_reference),
+ false);
+}
+
+static void crypto_test_enc_alg_zuc_eea3_ovr_iv(void)
+{
+ check_alg(ODP_CRYPTO_OP_ENCODE,
+ ODP_CIPHER_ALG_ZUC_EEA3,
+ ODP_AUTH_ALG_NULL,
+ zuc_eea3_reference,
+ ARRAY_SIZE(zuc_eea3_reference),
+ true);
+}
+
+static void crypto_test_dec_alg_zuc_eea3(void)
+{
+ check_alg(ODP_CRYPTO_OP_DECODE,
+ ODP_CIPHER_ALG_ZUC_EEA3,
+ ODP_AUTH_ALG_NULL,
+ zuc_eea3_reference,
+ ARRAY_SIZE(zuc_eea3_reference),
+ false);
+}
+
+static void crypto_test_dec_alg_zuc_eea3_ovr_iv(void)
+{
+ check_alg(ODP_CRYPTO_OP_DECODE,
+ ODP_CIPHER_ALG_ZUC_EEA3,
+ ODP_AUTH_ALG_NULL,
+ zuc_eea3_reference,
+ ARRAY_SIZE(zuc_eea3_reference),
+ true);
+}
+
static int check_alg_hmac_md5(void)
{
return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_MD5_HMAC);
@@ -1306,6 +1509,141 @@ static void crypto_test_check_alg_aes_cmac(void)
false);
}
+static int check_alg_kasumi_f9(void)
+{
+ return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_KASUMI_F9);
+}
+
+static void crypto_test_gen_alg_kasumi_f9(void)
+{
+ check_alg(ODP_CRYPTO_OP_ENCODE,
+ ODP_CIPHER_ALG_NULL,
+ ODP_AUTH_ALG_KASUMI_F9,
+ kasumi_f9_reference,
+ ARRAY_SIZE(kasumi_f9_reference),
+ false);
+}
+
+static void crypto_test_gen_alg_kasumi_f9_ovr_iv(void)
+{
+ check_alg(ODP_CRYPTO_OP_ENCODE,
+ ODP_CIPHER_ALG_NULL,
+ ODP_AUTH_ALG_KASUMI_F9,
+ kasumi_f9_reference,
+ ARRAY_SIZE(kasumi_f9_reference),
+ true);
+}
+
+static void crypto_test_check_alg_kasumi_f9(void)
+{
+ check_alg(ODP_CRYPTO_OP_DECODE,
+ ODP_CIPHER_ALG_NULL,
+ ODP_AUTH_ALG_KASUMI_F9,
+ kasumi_f9_reference,
+ ARRAY_SIZE(kasumi_f9_reference),
+ false);
+}
+
+static void crypto_test_check_alg_kasumi_f9_ovr_iv(void)
+{
+ check_alg(ODP_CRYPTO_OP_DECODE,
+ ODP_CIPHER_ALG_NULL,
+ ODP_AUTH_ALG_KASUMI_F9,
+ kasumi_f9_reference,
+ ARRAY_SIZE(kasumi_f9_reference),
+ true);
+}
+
+static int check_alg_snow3g_uia2(void)
+{
+ return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SNOW3G_UIA2);
+}
+
+static void crypto_test_gen_alg_snow3g_uia2(void)
+{
+ check_alg(ODP_CRYPTO_OP_ENCODE,
+ ODP_CIPHER_ALG_NULL,
+ ODP_AUTH_ALG_SNOW3G_UIA2,
+ snow3g_uia2_reference,
+ ARRAY_SIZE(snow3g_uia2_reference),
+ false);
+}
+
+static void crypto_test_gen_alg_snow3g_uia2_ovr_iv(void)
+{
+ check_alg(ODP_CRYPTO_OP_ENCODE,
+ ODP_CIPHER_ALG_NULL,
+ ODP_AUTH_ALG_SNOW3G_UIA2,
+ snow3g_uia2_reference,
+ ARRAY_SIZE(snow3g_uia2_reference),
+ true);
+}
+
+static void crypto_test_check_alg_snow3g_uia2(void)
+{
+ check_alg(ODP_CRYPTO_OP_DECODE,
+ ODP_CIPHER_ALG_NULL,
+ ODP_AUTH_ALG_SNOW3G_UIA2,
+ snow3g_uia2_reference,
+ ARRAY_SIZE(snow3g_uia2_reference),
+ false);
+}
+
+static void crypto_test_check_alg_snow3g_uia2_ovr_iv(void)
+{
+ check_alg(ODP_CRYPTO_OP_DECODE,
+ ODP_CIPHER_ALG_NULL,
+ ODP_AUTH_ALG_SNOW3G_UIA2,
+ snow3g_uia2_reference,
+ ARRAY_SIZE(snow3g_uia2_reference),
+ true);
+}
+
+static int check_alg_zuc_eia3(void)
+{
+ return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_ZUC_EIA3);
+}
+
+static void crypto_test_gen_alg_zuc_eia3(void)
+{
+ check_alg(ODP_CRYPTO_OP_ENCODE,
+ ODP_CIPHER_ALG_NULL,
+ ODP_AUTH_ALG_ZUC_EIA3,
+ zuc_eia3_reference,
+ ARRAY_SIZE(zuc_eia3_reference),
+ false);
+}
+
+static void crypto_test_gen_alg_zuc_eia3_ovr_iv(void)
+{
+ check_alg(ODP_CRYPTO_OP_ENCODE,
+ ODP_CIPHER_ALG_NULL,
+ ODP_AUTH_ALG_ZUC_EIA3,
+ zuc_eia3_reference,
+ ARRAY_SIZE(zuc_eia3_reference),
+ true);
+}
+
+static void crypto_test_check_alg_zuc_eia3(void)
+{
+ check_alg(ODP_CRYPTO_OP_DECODE,
+ ODP_CIPHER_ALG_NULL,
+ ODP_AUTH_ALG_ZUC_EIA3,
+ zuc_eia3_reference,
+ ARRAY_SIZE(zuc_eia3_reference),
+ false);
+}
+
+static void crypto_test_check_alg_zuc_eia3_ovr_iv(void)
+{
+ check_alg(ODP_CRYPTO_OP_DECODE,
+ ODP_CIPHER_ALG_NULL,
+ ODP_AUTH_ALG_ZUC_EIA3,
+ zuc_eia3_reference,
+ ARRAY_SIZE(zuc_eia3_reference),
+ true);
+}
+
int crypto_suite_sync_init(void)
{
suite_context.pool = odp_pool_lookup("packet_pool");
@@ -1387,6 +1725,30 @@ odp_testinfo_t crypto_suite[] = {
check_alg_aes_ctr),
ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_aes_ctr_ovr_iv,
check_alg_aes_ctr),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_kasumi_f8,
+ check_alg_kasumi_f8),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_kasumi_f8,
+ check_alg_kasumi_f8),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_kasumi_f8_ovr_iv,
+ check_alg_kasumi_f8),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_kasumi_f8_ovr_iv,
+ check_alg_kasumi_f8),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_snow3g_uea2,
+ check_alg_snow3g_uea2),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_snow3g_uea2,
+ check_alg_snow3g_uea2),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_snow3g_uea2_ovr_iv,
+ check_alg_snow3g_uea2),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_snow3g_uea2_ovr_iv,
+ check_alg_snow3g_uea2),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_zuc_eea3,
+ check_alg_zuc_eea3),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_zuc_eea3,
+ check_alg_zuc_eea3),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_zuc_eea3_ovr_iv,
+ check_alg_zuc_eea3),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_zuc_eea3_ovr_iv,
+ check_alg_zuc_eea3),
ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_aes_gcm,
check_alg_aes_gcm),
ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_aes_gcm_ovr_iv,
@@ -1439,6 +1801,30 @@ odp_testinfo_t crypto_suite[] = {
check_alg_aes_cmac),
ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_aes_cmac,
check_alg_aes_cmac),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_gen_alg_kasumi_f9,
+ check_alg_kasumi_f9),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_kasumi_f9,
+ check_alg_kasumi_f9),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_gen_alg_kasumi_f9_ovr_iv,
+ check_alg_kasumi_f9),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_kasumi_f9_ovr_iv,
+ check_alg_kasumi_f9),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_gen_alg_snow3g_uia2,
+ check_alg_snow3g_uia2),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_snow3g_uia2,
+ check_alg_snow3g_uia2),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_gen_alg_snow3g_uia2_ovr_iv,
+ check_alg_snow3g_uia2),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_snow3g_uia2_ovr_iv,
+ check_alg_snow3g_uia2),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_gen_alg_zuc_eia3,
+ check_alg_zuc_eia3),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_zuc_eia3,
+ check_alg_zuc_eia3),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_gen_alg_zuc_eia3_ovr_iv,
+ check_alg_zuc_eia3),
+ ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_zuc_eia3_ovr_iv,
+ check_alg_zuc_eia3),
ODP_TEST_INFO_NULL,
};
@@ -25,6 +25,7 @@ typedef struct crypto_test_reference_s {
uint8_t aad[MAX_AAD_LEN];
uint32_t digest_length;
uint8_t digest[MAX_DIGEST_LEN];
+ odp_bool_t bitstring;
} crypto_test_reference_t;
static crypto_test_reference_t null_reference[] = {
@@ -1325,4 +1326,411 @@ static crypto_test_reference_t hmac_sha512_reference[] = {
}
};
+/*
+ * Kasumi F8 and F9 test vectors are taken from
+ * 3GPP TS 35.203 V9.0.0 (2009-12)
+ * 3rd Generation Partnership Project;
+ * Technical Specification Group Services and System Aspects;
+ * 3G Security;
+ * Specification of the 3GPP Confidentiality
+ * and Integrity Algorithms;
+ * Document 3: Implementors' Test Data
+ * (Release 9)
+ */
+static crypto_test_reference_t kasumi_f8_reference[] = {
+ {
+ .bitstring = true,
+ .cipher_key_length = KASUMI_F8_KEY_LEN,
+ .cipher_key = { 0x2b, 0xd6, 0x45, 0x9f, 0x82, 0xc5, 0xb3, 0x00,
+ 0x95, 0x2c, 0x49, 0x10, 0x48, 0x81, 0xff, 0x48},
+ .cipher_iv_length = KASUMI_F8_IV_LEN,
+ .cipher_iv = { 0x72, 0xa4, 0xf2, 0x0f, 0x64, 0x00, 0x00, 0x00 },
+ .length = 798, /* 100 bytes */
+ .plaintext = { 0x7e, 0xc6, 0x12, 0x72, 0x74, 0x3b, 0xf1, 0x61,
+ 0x47, 0x26, 0x44, 0x6a, 0x6c, 0x38, 0xce, 0xd1,
+ 0x66, 0xf6, 0xca, 0x76, 0xeb, 0x54, 0x30, 0x04,
+ 0x42, 0x86, 0x34, 0x6c, 0xef, 0x13, 0x0f, 0x92,
+ 0x92, 0x2b, 0x03, 0x45, 0x0d, 0x3a, 0x99, 0x75,
+ 0xe5, 0xbd, 0x2e, 0xa0, 0xeb, 0x55, 0xad, 0x8e,
+ 0x1b, 0x19, 0x9e, 0x3e, 0xc4, 0x31, 0x60, 0x20,
+ 0xe9, 0xa1, 0xb2, 0x85, 0xe7, 0x62, 0x79, 0x53,
+ 0x59, 0xb7, 0xbd, 0xfd, 0x39, 0xbe, 0xf4, 0xb2,
+ 0x48, 0x45, 0x83, 0xd5, 0xaf, 0xe0, 0x82, 0xae,
+ 0xe6, 0x38, 0xbf, 0x5f, 0xd5, 0xa6, 0x06, 0x19,
+ 0x39, 0x01, 0xa0, 0x8f, 0x4a, 0xb4, 0x1a, 0xab,
+ 0x9b, 0x13, 0x48, 0x80 },
+ .ciphertext = { 0xd1, 0xe2, 0xde, 0x70, 0xee, 0xf8, 0x6c, 0x69,
+ 0x64, 0xfb, 0x54, 0x2b, 0xc2, 0xd4, 0x60, 0xaa,
+ 0xbf, 0xaa, 0x10, 0xa4, 0xa0, 0x93, 0x26, 0x2b,
+ 0x7d, 0x19, 0x9e, 0x70, 0x6f, 0xc2, 0xd4, 0x89,
+ 0x15, 0x53, 0x29, 0x69, 0x10, 0xf3, 0xa9, 0x73,
+ 0x01, 0x26, 0x82, 0xe4, 0x1c, 0x4e, 0x2b, 0x02,
+ 0xbe, 0x20, 0x17, 0xb7, 0x25, 0x3b, 0xbf, 0x93,
+ 0x09, 0xde, 0x58, 0x19, 0xcb, 0x42, 0xe8, 0x19,
+ 0x56, 0xf4, 0xc9, 0x9b, 0xc9, 0x76, 0x5c, 0xaf,
+ 0x53, 0xb1, 0xd0, 0xbb, 0x82, 0x79, 0x82, 0x6a,
+ 0xdb, 0xbc, 0x55, 0x22, 0xe9, 0x15, 0xc1, 0x20,
+ 0xa6, 0x18, 0xa5, 0xa7, 0xf5, 0xe8, 0x97, 0x08,
+ 0x93, 0x39, 0x65, 0x0f }
+ },
+ {
+ .bitstring = true,
+ .cipher_key_length = KASUMI_F8_KEY_LEN,
+ .cipher_key = { 0xef, 0xa8, 0xb2, 0x22, 0x9e, 0x72, 0x0c, 0x2a,
+ 0x7c, 0x36, 0xea, 0x55, 0xe9, 0x60, 0x56, 0x95},
+ .cipher_iv_length = KASUMI_F8_IV_LEN,
+ .cipher_iv = { 0xe2, 0x8b, 0xcf, 0x7b, 0xc0, 0x00, 0x00, 0x00 },
+ .length = 510, /* 64 bytes */
+ .plaintext = { 0x10, 0x11, 0x12, 0x31, 0xe0, 0x60, 0x25, 0x3a,
+ 0x43, 0xfd, 0x3f, 0x57, 0xe3, 0x76, 0x07, 0xab,
+ 0x28, 0x27, 0xb5, 0x99, 0xb6, 0xb1, 0xbb, 0xda,
+ 0x37, 0xa8, 0xab, 0xcc, 0x5a, 0x8c, 0x55, 0x0d,
+ 0x1b, 0xfb, 0x2f, 0x49, 0x46, 0x24, 0xfb, 0x50,
+ 0x36, 0x7f, 0xa3, 0x6c, 0xe3, 0xbc, 0x68, 0xf1,
+ 0x1c, 0xf9, 0x3b, 0x15, 0x10, 0x37, 0x6b, 0x02,
+ 0x13, 0x0f, 0x81, 0x2a, 0x9f, 0xa1, 0x69, 0xd8},
+ .ciphertext = { 0x3d, 0xea, 0xcc, 0x7c, 0x15, 0x82, 0x1c, 0xaa,
+ 0x89, 0xee, 0xca, 0xde, 0x9b, 0x5b, 0xd3, 0x61,
+ 0x4b, 0xd0, 0xc8, 0x41, 0x9d, 0x71, 0x03, 0x85,
+ 0xdd, 0xbe, 0x58, 0x49, 0xef, 0x1b, 0xac, 0x5a,
+ 0xe8, 0xb1, 0x4a, 0x5b, 0x0a, 0x67, 0x41, 0x52,
+ 0x1e, 0xb4, 0xe0, 0x0b, 0xb9, 0xec, 0xf3, 0xe9,
+ 0xf7, 0xcc, 0xb9, 0xca, 0xe7, 0x41, 0x52, 0xd7,
+ 0xf4, 0xe2, 0xa0, 0x34, 0xb6, 0xea, 0x00, 0xec }
+ }
+};
+
+static crypto_test_reference_t kasumi_f9_reference[] = {
+ {
+ .bitstring = true,
+ .auth_key_length = KASUMI_F9_KEY_LEN,
+ .auth_key = { 0x2b, 0xd6, 0x45, 0x9f, 0x82, 0xc5, 0xb3, 0x00,
+ 0x95, 0x2c, 0x49, 0x10, 0x48, 0x81, 0xff, 0x48 },
+ .auth_iv_length = KASUMI_F9_IV_LEN,
+ .auth_iv = { 0x38, 0xa6, 0xf0, 0x56, 0x05, 0xd2, 0xec, 0x49,
+ 0x00, },
+ .length = 189, /* 24 bytes */
+ .plaintext = { 0x6b, 0x22, 0x77, 0x37, 0x29, 0x6f, 0x39, 0x3c,
+ 0x80, 0x79, 0x35, 0x3e, 0xdc, 0x87, 0xe2, 0xe8,
+ 0x05, 0xd2, 0xec, 0x49, 0xa4, 0xf2, 0xd8, 0xe0},
+ .ciphertext = { 0x6b, 0x22, 0x77, 0x37, 0x29, 0x6f, 0x39, 0x3c,
+ 0x80, 0x79, 0x35, 0x3e, 0xdc, 0x87, 0xe2, 0xe8,
+ 0x05, 0xd2, 0xec, 0x49, 0xa4, 0xf2, 0xd8, 0xe0},
+ .digest_length = KASUMI_F9_DIGEST_LEN,
+ .digest = { 0xf6, 0x3b, 0xd7, 0x2c }
+ },
+ {
+ .bitstring = true,
+ .auth_key_length = KASUMI_F9_KEY_LEN,
+ .auth_key = { 0xd4, 0x2f, 0x68, 0x24, 0x28, 0x20, 0x1c, 0xaf,
+ 0xcd, 0x9f, 0x97, 0x94, 0x5e, 0x6d, 0xe7, 0xb7 },
+ .auth_iv_length = KASUMI_F9_IV_LEN,
+ .auth_iv = { 0x3e, 0xdc, 0x87, 0xe2, 0xa4, 0xf2, 0xd8, 0xe2,
+ 0x01, },
+ .length = 254, /* 32 bytes */
+ .plaintext = { 0xb5, 0x92, 0x43, 0x84, 0x32, 0x8a, 0x4a, 0xe0,
+ 0x0b, 0x73, 0x71, 0x09, 0xf8, 0xb6, 0xc8, 0xdd,
+ 0x2b, 0x4d, 0xb6, 0x3d, 0xd5, 0x33, 0x98, 0x1c,
+ 0xeb, 0x19, 0xaa, 0xd5, 0x2a, 0x5b, 0x2b, 0xc0},
+ .ciphertext = { 0xb5, 0x92, 0x43, 0x84, 0x32, 0x8a, 0x4a, 0xe0,
+ 0x0b, 0x73, 0x71, 0x09, 0xf8, 0xb6, 0xc8, 0xdd,
+ 0x2b, 0x4d, 0xb6, 0x3d, 0xd5, 0x33, 0x98, 0x1c,
+ 0xeb, 0x19, 0xaa, 0xd5, 0x2a, 0x5b, 0x2b, 0xc0},
+ .digest_length = KASUMI_F9_DIGEST_LEN,
+ .digest = { 0xa9, 0xda, 0xf1, 0xff }
+ }
+};
+
+/*
+ * Snow3G UEA2 & UIA2 test vectors are taken from
+ * Specification of the 3GPP Confidentiality and
+ * Integrity Algorithms UEA2 & UIA2
+ * Document 3: Implementors’ Test Data
+ * Version: 1.1
+ * Date: 25 th October 2012
+ */
+static crypto_test_reference_t snow3g_uea2_reference[] = {
+ {
+ .bitstring = true,
+ .cipher_key_length = SNOW3G_UEA2_KEY_LEN,
+ .cipher_key = { 0x2b, 0xd6, 0x45, 0x9f, 0x82, 0xc5, 0xb3, 0x00,
+ 0x95, 0x2c, 0x49, 0x10, 0x48, 0x81, 0xff, 0x48},
+ .cipher_iv_length = SNOW3G_UEA2_IV_LEN,
+ .cipher_iv = { 0x72, 0xa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29, 0x32, 0xa5,
+ 0x3c, 0x9d, 0x5f, 0x93, 0x1a, 0x3a, 0x7c, 0x53,
+ 0x22, 0x59, 0xaf, 0x43, 0x25, 0xe2, 0xa6, 0x5e,
+ 0x30, 0x84, 0xad, 0x5f, 0x6a, 0x51, 0x3b, 0x7b,
+ 0xdd, 0xc1, 0xb6, 0x5f, 0x0a, 0xa0, 0xd9, 0x7a,
+ 0x05, 0x3d, 0xb5, 0x5a, 0x88, 0xc4, 0xc4, 0xf9,
+ 0x60, 0x5e, 0x41, 0x40 }
+ },
+ {
+ .bitstring = true,
+ .cipher_key_length = SNOW3G_UEA2_KEY_LEN,
+ .cipher_key = { 0xef, 0xa8, 0xb2, 0x22, 0x9e, 0x72, 0x0c, 0x2a,
+ 0x7c, 0x36, 0xea, 0x55, 0xe9, 0x60, 0x56, 0x95},
+ .cipher_iv_length = SNOW3G_UEA2_IV_LEN,
+ .cipher_iv = { 0xe2, 0x8b, 0xcf, 0x7b, 0xc0, 0x00, 0x00, 0x00,
+ 0xe2, 0x8b, 0xcf, 0x7b, 0xc0, 0x00, 0x00, 0x00 },
+ .length = 510, /* 64 bytes */
+ .plaintext = { 0x10, 0x11, 0x12, 0x31, 0xe0, 0x60, 0x25, 0x3a,
+ 0x43, 0xfd, 0x3f, 0x57, 0xe3, 0x76, 0x07, 0xab,
+ 0x28, 0x27, 0xb5, 0x99, 0xb6, 0xb1, 0xbb, 0xda,
+ 0x37, 0xa8, 0xab, 0xcc, 0x5a, 0x8c, 0x55, 0x0d,
+ 0x1b, 0xfb, 0x2f, 0x49, 0x46, 0x24, 0xfb, 0x50,
+ 0x36, 0x7f, 0xa3, 0x6c, 0xe3, 0xbc, 0x68, 0xf1,
+ 0x1c, 0xf9, 0x3b, 0x15, 0x10, 0x37, 0x6b, 0x02,
+ 0x13, 0x0f, 0x81, 0x2a, 0x9f, 0xa1, 0x69, 0xd8},
+ .ciphertext = { 0xe0, 0xda, 0x15, 0xca, 0x8e, 0x25, 0x54, 0xf5,
+ 0xe5, 0x6c, 0x94, 0x68, 0xdc, 0x6c, 0x7c, 0x12,
+ 0x9c, 0x56, 0x8a, 0xa5, 0x03, 0x23, 0x17, 0xe0,
+ 0x4e, 0x07, 0x29, 0x64, 0x6c, 0xab, 0xef, 0xa6,
+ 0x89, 0x86, 0x4c, 0x41, 0x0f, 0x24, 0xf9, 0x19,
+ 0xe6, 0x1e, 0x3d, 0xfd, 0xfa, 0xd7, 0x7e, 0x56,
+ 0x0d, 0xb0, 0xa9, 0xcd, 0x36, 0xc3, 0x4a, 0xe4,
+ 0x18, 0x14, 0x90, 0xb2, 0x9f, 0x5f, 0xa2, 0xfc }
+ }
+};
+
+static crypto_test_reference_t snow3g_uia2_reference[] = {
+ {
+ .bitstring = true,
+ .auth_key_length = SNOW3G_UIA2_KEY_LEN,
+ .auth_key = { 0x2b, 0xd6, 0x45, 0x9f, 0x82, 0xc5, 0xb3, 0x00,
+ 0x95, 0x2c, 0x49, 0x10, 0x48, 0x81, 0xff, 0x48 },
+ .auth_iv_length = SNOW3G_UIA2_IV_LEN,
+ .auth_iv = { 0x38, 0xa6, 0xf0, 0x56, 0x05, 0xd2, 0xec, 0x49,
+ 0x38, 0xa6, 0xf0, 0x56, 0x05, 0xd2, 0xec, 0x49 },
+ .length = 189, /* 24 bytes */
+ .plaintext = { 0x6b, 0x22, 0x77, 0x37, 0x29, 0x6f, 0x39, 0x3c,
+ 0x80, 0x79, 0x35, 0x3e, 0xdc, 0x87, 0xe2, 0xe8,
+ 0x05, 0xd2, 0xec, 0x49, 0xa4, 0xf2, 0xd8, 0xe0},
+ .ciphertext = { 0x6b, 0x22, 0x77, 0x37, 0x29, 0x6f, 0x39, 0x3c,
+ 0x80, 0x79, 0x35, 0x3e, 0xdc, 0x87, 0xe2, 0xe8,
+ 0x05, 0xd2, 0xec, 0x49, 0xa4, 0xf2, 0xd8, 0xe0},
+ .digest_length = SNOW3G_UIA2_DIGEST_LEN,
+ .digest = { 0x2b, 0xce, 0x18, 0x20 }
+ },
+ {
+ .bitstring = true,
+ .auth_key_length = SNOW3G_UIA2_KEY_LEN,
+ .auth_key = { 0xc7, 0x36, 0xc6, 0xaa, 0xb2, 0x2b, 0xff, 0xf9,
+ 0x1e, 0x26, 0x98, 0xd2, 0xe2, 0x2a, 0xd5, 0x7e},
+ .auth_iv_length = SNOW3G_UIA2_IV_LEN,
+ .auth_iv = { 0x14, 0x79, 0x3e, 0x41, 0x03, 0x97, 0xe8, 0xfd,
+ 0x94, 0x79, 0x3e, 0x41, 0x03, 0x97, 0x68, 0xfd },
+ .length = 384, /* 48 bytes */
+ .plaintext = { 0xd0, 0xa7, 0xd4, 0x63, 0xdf, 0x9f, 0xb2, 0xb2,
+ 0x78, 0x83, 0x3f, 0xa0, 0x2e, 0x23, 0x5a, 0xa1,
+ 0x72, 0xbd, 0x97, 0x0c, 0x14, 0x73, 0xe1, 0x29,
+ 0x07, 0xfb, 0x64, 0x8b, 0x65, 0x99, 0xaa, 0xa0,
+ 0xb2, 0x4a, 0x03, 0x86, 0x65, 0x42, 0x2b, 0x20,
+ 0xa4, 0x99, 0x27, 0x6a, 0x50, 0x42, 0x70, 0x09},
+ .ciphertext = { 0xd0, 0xa7, 0xd4, 0x63, 0xdf, 0x9f, 0xb2, 0xb2,
+ 0x78, 0x83, 0x3f, 0xa0, 0x2e, 0x23, 0x5a, 0xa1,
+ 0x72, 0xbd, 0x97, 0x0c, 0x14, 0x73, 0xe1, 0x29,
+ 0x07, 0xfb, 0x64, 0x8b, 0x65, 0x99, 0xaa, 0xa0,
+ 0xb2, 0x4a, 0x03, 0x86, 0x65, 0x42, 0x2b, 0x20,
+ 0xa4, 0x99, 0x27, 0x6a, 0x50, 0x42, 0x70, 0x09},
+ .digest_length = SNOW3G_UIA2_DIGEST_LEN,
+ .digest = { 0x38, 0xb5, 0x54, 0xc0 }
+ },
+ {
+ .bitstring = false,
+ .auth_key_length = SNOW3G_UIA2_KEY_LEN,
+ .auth_key = { 0xc7, 0x36, 0xc6, 0xaa, 0xb2, 0x2b, 0xff, 0xf9,
+ 0x1e, 0x26, 0x98, 0xd2, 0xe2, 0x2a, 0xd5, 0x7e},
+ .auth_iv_length = SNOW3G_UIA2_IV_LEN,
+ .auth_iv = { 0x14, 0x79, 0x3e, 0x41, 0x03, 0x97, 0xe8, 0xfd,
+ 0x94, 0x79, 0x3e, 0x41, 0x03, 0x97, 0x68, 0xfd },
+ .length = 384 / 8, /* 48 bytes */
+ .plaintext = { 0xd0, 0xa7, 0xd4, 0x63, 0xdf, 0x9f, 0xb2, 0xb2,
+ 0x78, 0x83, 0x3f, 0xa0, 0x2e, 0x23, 0x5a, 0xa1,
+ 0x72, 0xbd, 0x97, 0x0c, 0x14, 0x73, 0xe1, 0x29,
+ 0x07, 0xfb, 0x64, 0x8b, 0x65, 0x99, 0xaa, 0xa0,
+ 0xb2, 0x4a, 0x03, 0x86, 0x65, 0x42, 0x2b, 0x20,
+ 0xa4, 0x99, 0x27, 0x6a, 0x50, 0x42, 0x70, 0x09},
+ .ciphertext = { 0xd0, 0xa7, 0xd4, 0x63, 0xdf, 0x9f, 0xb2, 0xb2,
+ 0x78, 0x83, 0x3f, 0xa0, 0x2e, 0x23, 0x5a, 0xa1,
+ 0x72, 0xbd, 0x97, 0x0c, 0x14, 0x73, 0xe1, 0x29,
+ 0x07, 0xfb, 0x64, 0x8b, 0x65, 0x99, 0xaa, 0xa0,
+ 0xb2, 0x4a, 0x03, 0x86, 0x65, 0x42, 0x2b, 0x20,
+ 0xa4, 0x99, 0x27, 0x6a, 0x50, 0x42, 0x70, 0x09},
+ .digest_length = SNOW3G_UIA2_DIGEST_LEN,
+ .digest = { 0x38, 0xb5, 0x54, 0xc0 }
+ },
+};
+
+/*
+ * ZUC EEA3 and EIA3 test vectors from
+ * Specification of the 3GPP Confidentiality and Integrity
+ * Algorithms 128-EEA3 & 128-EIA3
+ * Document 3: Implementor’s Test Data
+ * Version: 1.1
+ * Date: 4 th Jan. 2011
+ */
+static crypto_test_reference_t zuc_eea3_reference[] = {
+ {
+ .bitstring = true,
+ .cipher_key_length = ZUC_EEA3_KEY_LEN,
+ .cipher_key = { 0x17, 0x3d, 0x14, 0xba, 0x50, 0x03, 0x73, 0x1d,
+ 0x7a, 0x60, 0x04, 0x94, 0x70, 0xf0, 0x0a, 0x29},
+ .cipher_iv_length = ZUC_EEA3_IV_LEN,
+ .cipher_iv = { 0x66, 0x03, 0x54, 0x92, 0x78, 0x00, 0x00, 0x00,
+ 0x66, 0x03, 0x54, 0x92, 0x78, 0x00, 0x00, 0x00 },
+ .length = 193, /* 25 bytes */
+ .plaintext = { 0x6c, 0xf6, 0x53, 0x40, 0x73, 0x55, 0x52, 0xab,
+ 0x0c, 0x97, 0x52, 0xfa, 0x6f, 0x90, 0x25, 0xfe,
+ 0x0b, 0xd6, 0x75, 0xd9, 0x00, 0x58, 0x75, 0xb2,
+ 0x00 },
+ .ciphertext = { 0xa6, 0xc8, 0x5f, 0xc6, 0x6a, 0xfb, 0x85, 0x33,
+ 0xaa, 0xfc, 0x25, 0x18, 0xdf, 0xe7, 0x84, 0x94,
+ 0x0e, 0xe1, 0xe4, 0xb0, 0x30, 0x23, 0x8c, 0xc8,
+ 0x00 }
+ },
+ {
+ .bitstring = true,
+ .cipher_key_length = ZUC_EIA3_KEY_LEN,
+ .cipher_key = { 0xe5, 0xbd, 0x3e, 0xa0, 0xeb, 0x55, 0xad, 0xe8,
+ 0x66, 0xc6, 0xac, 0x58, 0xbd, 0x54, 0x30, 0x2a},
+ .cipher_iv_length = ZUC_EEA3_IV_LEN,
+ .cipher_iv = { 0x00, 0x05, 0x68, 0x23, 0xc4, 0x00, 0x00, 0x00,
+ 0x00, 0x05, 0x68, 0x23, 0xc4, 0x00, 0x00, 0x00 },
+ .length = 800, /* 100 bytes */
+ .plaintext = { 0x14, 0xa8, 0xef, 0x69, 0x3d, 0x67, 0x85, 0x07,
+ 0xbb, 0xe7, 0x27, 0x0a, 0x7f, 0x67, 0xff, 0x50,
+ 0x06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+ 0x98, 0x5e, 0xba, 0xd8, 0x80, 0xd6, 0xf2, 0x38,
+ 0x64, 0xa0, 0x7b, 0x01 }
+ },
+ {
+ .bitstring = false,
+ .cipher_key_length = ZUC_EIA3_KEY_LEN,
+ .cipher_key = { 0xe5, 0xbd, 0x3e, 0xa0, 0xeb, 0x55, 0xad, 0xe8,
+ 0x66, 0xc6, 0xac, 0x58, 0xbd, 0x54, 0x30, 0x2a},
+ .cipher_iv_length = ZUC_EEA3_IV_LEN,
+ .cipher_iv = { 0x00, 0x05, 0x68, 0x23, 0xc4, 0x00, 0x00, 0x00,
+ 0x00, 0x05, 0x68, 0x23, 0xc4, 0x00, 0x00, 0x00 },
+ .length = 800 / 8, /* 100 bytes */
+ .plaintext = { 0x14, 0xa8, 0xef, 0x69, 0x3d, 0x67, 0x85, 0x07,
+ 0xbb, 0xe7, 0x27, 0x0a, 0x7f, 0x67, 0xff, 0x50,
+ 0x06, 0xc3, 0x52, 0x5b, 0x98, 0x07, 0xe4, 0x67,
+ 0xc4, 0xe5, 0x60, 0x00, 0xba, 0x33, 0x8f, 0x5d,
+ 0x42, 0x95, 0x59, 0x03, 0x67, 0x51, 0x82, 0x22,
+ 0x46, 0xc8, 0x0d, 0x3b, 0x38, 0xf0, 0x7f, 0x4b,
+ 0xe2, 0xd8, 0xff, 0x58, 0x05, 0xf5, 0x13, 0x22,
+ 0x29, 0xbd, 0xe9, 0x3b, 0xbb, 0xdc, 0xaf, 0x38,
+ 0x2b, 0xf1, 0xee, 0x97, 0x2f, 0xbf, 0x99, 0x77,
+ 0xba, 0xda, 0x89, 0x45, 0x84, 0x7a, 0x2a, 0x6c,
+ 0x9a, 0xd3, 0x4a, 0x66, 0x75, 0x54, 0xe0, 0x4d,
+ 0x1f, 0x7f, 0xa2, 0xc3, 0x32, 0x41, 0xbd, 0x8f,
+ 0x01, 0xba, 0x22, 0x0d },
+ .ciphertext = { 0x13, 0x1d, 0x43, 0xe0, 0xde, 0xa1, 0xbe, 0x5c,
+ 0x5a, 0x1b, 0xfd, 0x97, 0x1d, 0x85, 0x2c, 0xbf,
+ 0x71, 0x2d, 0x7b, 0x4f, 0x57, 0x96, 0x1f, 0xea,
+ 0x32, 0x08, 0xaf, 0xa8, 0xbc, 0xa4, 0x33, 0xf4,
+ 0x56, 0xad, 0x09, 0xc7, 0x41, 0x7e, 0x58, 0xbc,
+ 0x69, 0xcf, 0x88, 0x66, 0xd1, 0x35, 0x3f, 0x74,
+ 0x86, 0x5e, 0x80, 0x78, 0x1d, 0x20, 0x2d, 0xfb,
+ 0x3e, 0xcf, 0xf7, 0xfc, 0xbc, 0x3b, 0x19, 0x0f,
+ 0xe8, 0x2a, 0x20, 0x4e, 0xd0, 0xe3, 0x50, 0xfc,
+ 0x0f, 0x6f, 0x26, 0x13, 0xb2, 0xf2, 0xbc, 0xa6,
+ 0xdf, 0x5a, 0x47, 0x3a, 0x57, 0xa4, 0xa0, 0x0d,
+ 0x98, 0x5e, 0xba, 0xd8, 0x80, 0xd6, 0xf2, 0x38,
+ 0x64, 0xa0, 0x7b, 0x01 }
+ }
+};
+
+static crypto_test_reference_t zuc_eia3_reference[] = {
+ {
+ .bitstring = true,
+ .auth_key_length = ZUC_EIA3_KEY_LEN,
+ .auth_key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+ .auth_iv_length = ZUC_EIA3_IV_LEN,
+ .auth_iv = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ .length = 1, /* 1 bytes */
+ .plaintext = { 0x00 },
+ .ciphertext = { 0x00 },
+ .digest_length = ZUC_EIA3_DIGEST_LEN,
+ .digest = { 0xc8, 0xa9, 0x59, 0x5e }
+ },
+ {
+ .bitstring = true,
+ .auth_key_length = ZUC_EIA3_KEY_LEN,
+ .auth_key = { 0xc9,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21, 0xe5, 0x69, 0xd2, 0x80, 0xed, 0x77, 0x5c,
+ 0xeb, 0xde, 0x3f, 0x40, 0x93, 0xc5, 0x38, 0x81,
+ 0x00 },
+ .digest_length = ZUC_EIA3_DIGEST_LEN,
+ .digest = { 0xfa, 0xe8, 0xff, 0x0b }
+ }
+};
+
#endif
@@ -60,4 +60,31 @@
#define CHACHA20_POLY1305_IV_LEN 12
#define CHACHA20_POLY1305_CHECK_LEN 16
+/* KASUMI_F8 */
+#define KASUMI_F8_KEY_LEN 16
+#define KASUMI_F8_IV_LEN 8
+
+/* SNOW3G_UEA2 */
+#define SNOW3G_UEA2_KEY_LEN 16
+#define SNOW3G_UEA2_IV_LEN 16
+
+/* ZUC_EEA3 */
+#define ZUC_EEA3_KEY_LEN 16
+#define ZUC_EEA3_IV_LEN 16
+
+/* KASUMI_F9 */
+#define KASUMI_F9_KEY_LEN 16
+#define KASUMI_F9_IV_LEN 9
+#define KASUMI_F9_DIGEST_LEN 4
+
+/* SNOW3G_UIA2 */
+#define SNOW3G_UIA2_KEY_LEN 16
+#define SNOW3G_UIA2_IV_LEN 16
+#define SNOW3G_UIA2_DIGEST_LEN 4
+
+/* ZUC_EIA3 */
+#define ZUC_EIA3_KEY_LEN 16
+#define ZUC_EIA3_IV_LEN 16
+#define ZUC_EIA3_DIGEST_LEN 4
+
#endif