This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, api-next has been updated via 9b2b5a9695ad66977c964c83691cd2fef4c45b85 (commit) via 067a7054ba44a2c754f1382daf6469c495085639 (commit) via f5b1a18c53cec7203b4f94541af4b112c459ab74 (commit) via 09da8929a55e31b5005a3bb1c2c1184c435612cf (commit) from 7c629241f07aa7509d996c0560a20c5b0c7b371d (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit 9b2b5a9695ad66977c964c83691cd2fef4c45b85 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Tue Dec 26 01:27:07 2017 +0300
validation: crypto: 3GPP crypto algorightms support
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index a551be55..07f1d1fa 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -61,6 +61,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"; } @@ -85,6 +91,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"; } @@ -507,6 +519,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; @@ -532,6 +553,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; @@ -709,6 +739,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; @@ -764,6 +806,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; @@ -1164,6 +1218,153 @@ static void crypto_test_dec_alg_aes_ctr_ovr_iv(void) false); }
+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, + true); +} + +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, + 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, + true); +} + +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, + 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, + true); +} + +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, + 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, + true); +} + +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, + 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, + true); +} + +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, + 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, + true); +} + +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, + true); +} + static int check_alg_hmac_md5(void) { return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_MD5_HMAC); @@ -1445,6 +1646,153 @@ 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, + true); +} + +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, + 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, + true); +} + +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, + 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, + true); +} + +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, + 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, + true); +} + +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, + 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, + true); +} + +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, + 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, + true); +} + +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, + true); +} + static int crypto_suite_sync_init(void) { suite_context.pool = odp_pool_lookup("packet_pool"); @@ -1526,6 +1874,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, @@ -1586,6 +1958,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, };
diff --git a/test/validation/api/crypto/test_vectors.h b/test/validation/api/crypto/test_vectors.h index 9adb4332..3e40d708 100644 --- a/test/validation/api/crypto/test_vectors.h +++ b/test/validation/api/crypto/test_vectors.h @@ -1534,4 +1534,186 @@ static crypto_test_reference_t aes_xcbc_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[] = { + { + .cipher_key_length = KASUMI_F8_KEY_LEN, + .cipher_key = { 0x5a, 0xcb, 0x1d, 0x64, 0x4c, 0x0d, 0x51, 0x20, + 0x4e, 0xa5, 0xf1, 0x45, 0x10, 0x10, 0xd8, 0x52}, + .cipher_iv_length = KASUMI_F8_IV_LEN, + .cipher_iv = { 0xfa, 0x55, 0x6b, 0x26, 0x1c, 0x00, 0x00, 0x00}, + .length = 120, /* 15 bytes */ + .plaintext = { 0xad, 0x9c, 0x44, 0x1f, 0x89, 0x0b, 0x38, 0xc4, + 0x57, 0xa4, 0x9d, 0x42, 0x14, 0x07, 0xe8 }, + .ciphertext = { 0x9b, 0xc9, 0x2c, 0xa8, 0x03, 0xc6, 0x7b, 0x28, + 0xa1, 0x1a, 0x4b, 0xee, 0x5a, 0x0c, 0x25 } + } +}; + +static crypto_test_reference_t kasumi_f9_reference[] = { + { + .auth_key_length = KASUMI_F9_KEY_LEN, + .auth_key = { 0xc7, 0x36, 0xc6, 0xaa, 0xb2, 0x2b, 0xff, 0xf9, + 0x1e, 0x26, 0x98, 0xd2, 0xe2, 0x2a, 0xd5, 0x7e }, + .auth_iv_length = KASUMI_F9_IV_LEN, + .auth_iv = { 0x14, 0x79, 0x3e, 0x41, 0x03, 0x97, 0xe8, 0xfd, + 0x01, }, + .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 = KASUMI_F9_DIGEST_LEN, + .digest = { 0xdd, 0x7d, 0xfa, 0xdd }, + } +}; + +/* + * 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[] = { + { + .cipher_key_length = SNOW3G_UEA2_KEY_LEN, + .cipher_key = { 0x5a, 0xcb, 0x1d, 0x64, 0x4c, 0x0d, 0x51, 0x20, + 0x4e, 0xa5, 0xf1, 0x45, 0x10, 0x10, 0xd8, 0x52}, + .cipher_iv_length = SNOW3G_UEA2_IV_LEN, + .cipher_iv = { 0xfa, 0x55, 0x6b, 0x26, 0x1c, 0x00, 0x00, 0x00, + 0xfa, 0x55, 0x6b, 0x26, 0x1c, 0x00, 0x00, 0x00}, + .length = 120, /* 15 bytes */ + .plaintext = { 0xad, 0x9c, 0x44, 0x1f, 0x89, 0x0b, 0x38, 0xc4, + 0x57, 0xa4, 0x9d, 0x42, 0x14, 0x07, 0xe8 }, + .ciphertext = { 0xba, 0x0f, 0x31, 0x30, 0x03, 0x34, 0xc5, 0x6b, + 0x52, 0xa7, 0x49, 0x7c, 0xba, 0xc0, 0x46 } + } +}; + +static crypto_test_reference_t snow3g_uia2_reference[] = { + { + .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 } + } +}; + +/* + * 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[] = { + { + .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, 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[] = { + { + .auth_key_length = ZUC_EIA3_KEY_LEN, + .auth_key = { 0xc9, 0xe6, 0xce, 0xc4, 0x60, 0x7c, 0x72, 0xdb, + 0x00, 0x0a, 0xef, 0xa8, 0x83, 0x85, 0xab, 0x0a }, + .auth_iv_length = ZUC_EIA3_IV_LEN, + .auth_iv = { 0xa9, 0x40, 0x59, 0xda, 0x50, 0x00, 0x00, 0x00, + 0x29, 0x40, 0x59, 0xda, 0x50, 0x00, 0x80, 0x00 }, + .length = 584, /* 73 bytes */ + .plaintext = { 0x98, 0x3b, 0x41, 0xd4, 0x7d, 0x78, 0x0c, 0x9e, + 0x1a, 0xd1, 0x1d, 0x7e, 0xb7, 0x03, 0x91, 0xb1, + 0xde, 0x0b, 0x35, 0xda, 0x2d, 0xc6, 0x2f, 0x83, + 0xe7, 0xb7, 0x8d, 0x63, 0x06, 0xca, 0x0e, 0xa0, + 0x7e, 0x94, 0x1b, 0x7b, 0xe9, 0x13, 0x48, 0xf9, + 0xfc, 0xb1, 0x70, 0xe2, 0x21, 0x7f, 0xec, 0xd9, + 0x7f, 0x9f, 0x68, 0xad, 0xb1, 0x6e, 0x5d, 0x7d, + 0x21, 0xe5, 0x69, 0xd2, 0x80, 0xed, 0x77, 0x5c, + 0xeb, 0xde, 0x3f, 0x40, 0x93, 0xc5, 0x38, 0x81, + 0x00, 0x00, 0x00, 0x00 }, + .ciphertext = { 0x98, 0x3b, 0x41, 0xd4, 0x7d, 0x78, 0x0c, 0x9e, + 0x1a, 0xd1, 0x1d, 0x7e, 0xb7, 0x03, 0x91, 0xb1, + 0xde, 0x0b, 0x35, 0xda, 0x2d, 0xc6, 0x2f, 0x83, + 0xe7, 0xb7, 0x8d, 0x63, 0x06, 0xca, 0x0e, 0xa0, + 0x7e, 0x94, 0x1b, 0x7b, 0xe9, 0x13, 0x48, 0xf9, + 0xfc, 0xb1, 0x70, 0xe2, 0x21, 0x7f, 0xec, 0xd9, + 0x7f, 0x9f, 0x68, 0xad, 0xb1, 0x6e, 0x5d, 0x7d, + 0x21, 0xe5, 0x69, 0xd2, 0x80, 0xed, 0x77, 0x5c, + 0xeb, 0xde, 0x3f, 0x40, 0x93, 0xc5, 0x38, 0x81, + 0x00, 0x00, 0x00, 0x00 }, + .digest_length = ZUC_EIA3_DIGEST_LEN, + .digest = { 0x24, 0xa8, 0x42, 0xb3 } + } +}; + #endif diff --git a/test/validation/api/crypto/test_vectors_len.h b/test/validation/api/crypto/test_vectors_len.h index 95d202b6..3418ef27 100644 --- a/test/validation/api/crypto/test_vectors_len.h +++ b/test/validation/api/crypto/test_vectors_len.h @@ -70,4 +70,31 @@ #define AES_XCBC_MAC_96_CHECK_LEN 12 #define AES_XCBC_MAC_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
commit 067a7054ba44a2c754f1382daf6469c495085639 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Mon Jul 16 15:34:54 2018 +0300
validation: crypto: add support for bit mode algorithm testing
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index 1e06761c..a551be55 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -320,13 +320,15 @@ static void alg_test(odp_crypto_op_t op, odp_cipher_alg_t cipher_alg, odp_auth_alg_t auth_alg, crypto_test_reference_t *ref, - odp_bool_t ovr_iv) + odp_bool_t ovr_iv, + odp_bool_t bit_mode) { odp_crypto_session_t session; int rc; 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; @@ -375,9 +377,14 @@ static void alg_test(odp_crypto_op_t op, auth_range.offset = 0; auth_range.length = ref->length;
+ if (bit_mode) + 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; @@ -391,18 +398,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); } } @@ -412,19 +419,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;
@@ -438,14 +445,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)); } }
@@ -461,7 +468,8 @@ static void check_alg(odp_crypto_op_t op, odp_auth_alg_t auth_alg, crypto_test_reference_t *ref, size_t count, - odp_bool_t ovr_iv) + odp_bool_t ovr_iv, + odp_bool_t bit_mode) { odp_crypto_capability_t capa; int rc, i; @@ -565,7 +573,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].bit_mode == + bit_mode) { cipher_idx = i; break; } @@ -573,10 +583,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, + bit_mode ? " using bits" : ""); continue; }
@@ -586,7 +597,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].bit_mode == + bit_mode) { auth_idx = i; break; } @@ -594,15 +607,17 @@ 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, + bit_mode ? " using bits" : ""); continue; }
- alg_test(op, cipher_alg, auth_alg, &ref[idx], ovr_iv); + alg_test(op, cipher_alg, auth_alg, &ref[idx], ovr_iv, bit_mode);
cipher_tested[cipher_idx] = true; auth_tested[auth_idx] = true; @@ -610,23 +625,24 @@ static void check_alg(odp_crypto_op_t op,
for (i = 0; i < cipher_num; i++) { cipher_ok |= cipher_tested[i]; - if (!cipher_tested[i]) { + if (!cipher_tested[i] && cipher_capa[i].bit_mode == bit_mode) printf("\n Untested: alg=%s, key_len=%" PRIu32 ", " - "iv_len=%" PRIu32 "\n", + "iv_len=%" PRIu32 "%s\n", cipher_alg_name(cipher_alg), cipher_capa[i].key_len, - cipher_capa[i].iv_len); - } + cipher_capa[i].iv_len, + cipher_capa[i].bit_mode ? " using bits" : ""); }
for (i = 0; i < auth_num; i++) { auth_ok |= auth_tested[i]; - if (!auth_tested[i]) + if (!auth_tested[i] && auth_capa[i].bit_mode == bit_mode) printf("\n Untested: alg=%s, key_len=%" PRIu32 ", " - "digest_len=%" PRIu32 "\n", + "digest_len=%" PRIu32 "%s\n", auth_alg_name(auth_alg), auth_capa[i].key_len, - auth_capa[i].digest_len); + auth_capa[i].digest_len, + auth_capa[i].bit_mode ? " using bits" : ""); }
/* Verify that we were able to run at least several tests */ @@ -769,6 +785,7 @@ static void crypto_test_enc_alg_null(void) ODP_AUTH_ALG_NULL, null_reference, ARRAY_SIZE(null_reference), + false, false); }
@@ -779,6 +796,7 @@ static void crypto_test_dec_alg_null(void) ODP_AUTH_ALG_NULL, null_reference, ARRAY_SIZE(null_reference), + false, false); }
@@ -798,6 +816,7 @@ static void crypto_test_enc_alg_3des_cbc(void) ODP_AUTH_ALG_NULL, tdes_cbc_reference, ARRAY_SIZE(tdes_cbc_reference), + false, false); }
@@ -811,7 +830,8 @@ static void crypto_test_enc_alg_3des_cbc_ovr_iv(void) ODP_AUTH_ALG_NULL, tdes_cbc_reference, ARRAY_SIZE(tdes_cbc_reference), - true); + true, + false); }
/* This test verifies the correctness of decode (ciphertext -> plaintext) @@ -826,6 +846,7 @@ static void crypto_test_dec_alg_3des_cbc(void) ODP_AUTH_ALG_NULL, tdes_cbc_reference, ARRAY_SIZE(tdes_cbc_reference), + false, false); }
@@ -841,7 +862,8 @@ static void crypto_test_dec_alg_3des_cbc_ovr_iv(void) ODP_AUTH_ALG_NULL, tdes_cbc_reference, ARRAY_SIZE(tdes_cbc_reference), - true); + true, + false); }
static int check_alg_chacha20_poly1305(void) @@ -857,6 +879,7 @@ static void crypto_test_enc_alg_chacha20_poly1305(void) ODP_AUTH_ALG_CHACHA20_POLY1305, chacha20_poly1305_reference, ARRAY_SIZE(chacha20_poly1305_reference), + false, false); }
@@ -867,7 +890,8 @@ static void crypto_test_enc_alg_chacha20_poly1305_ovr_iv(void) ODP_AUTH_ALG_CHACHA20_POLY1305, chacha20_poly1305_reference, ARRAY_SIZE(chacha20_poly1305_reference), - true); + true, + false); }
static void crypto_test_dec_alg_chacha20_poly1305(void) @@ -877,6 +901,7 @@ static void crypto_test_dec_alg_chacha20_poly1305(void) ODP_AUTH_ALG_CHACHA20_POLY1305, chacha20_poly1305_reference, ARRAY_SIZE(chacha20_poly1305_reference), + false, false); }
@@ -887,7 +912,8 @@ static void crypto_test_dec_alg_chacha20_poly1305_ovr_iv(void) ODP_AUTH_ALG_CHACHA20_POLY1305, chacha20_poly1305_reference, ARRAY_SIZE(chacha20_poly1305_reference), - true); + true, + false); }
static int check_alg_aes_gcm(void) @@ -906,6 +932,7 @@ static void crypto_test_enc_alg_aes_gcm(void) ODP_AUTH_ALG_AES_GCM, aes_gcm_reference, ARRAY_SIZE(aes_gcm_reference), + false, false); }
@@ -920,7 +947,8 @@ static void crypto_test_enc_alg_aes_gcm_ovr_iv(void) ODP_AUTH_ALG_AES_GCM, aes_gcm_reference, ARRAY_SIZE(aes_gcm_reference), - true); + true, + false); }
/* This test verifies the correctness of decode (ciphertext -> plaintext) @@ -935,6 +963,7 @@ static void crypto_test_dec_alg_aes_gcm(void) ODP_AUTH_ALG_AES_GCM, aes_gcm_reference, ARRAY_SIZE(aes_gcm_reference), + false, false); }
@@ -950,7 +979,8 @@ static void crypto_test_dec_alg_aes_gcm_ovr_iv(void) ODP_AUTH_ALG_AES_GCM, aes_gcm_reference, ARRAY_SIZE(aes_gcm_reference), - true); + true, + false); }
static int check_alg_aes_ccm(void) @@ -965,6 +995,7 @@ static void crypto_test_enc_alg_aes_ccm(void) ODP_AUTH_ALG_AES_CCM, aes_ccm_reference, ARRAY_SIZE(aes_ccm_reference), + false, false); }
@@ -975,7 +1006,8 @@ static void crypto_test_enc_alg_aes_ccm_ovr_iv(void) ODP_AUTH_ALG_AES_CCM, aes_ccm_reference, ARRAY_SIZE(aes_ccm_reference), - true); + true, + false); }
static void crypto_test_dec_alg_aes_ccm(void) @@ -985,6 +1017,7 @@ static void crypto_test_dec_alg_aes_ccm(void) ODP_AUTH_ALG_AES_CCM, aes_ccm_reference, ARRAY_SIZE(aes_ccm_reference), + false, false); }
@@ -995,7 +1028,8 @@ static void crypto_test_dec_alg_aes_ccm_ovr_iv(void) ODP_AUTH_ALG_AES_CCM, aes_ccm_reference, ARRAY_SIZE(aes_ccm_reference), - true); + true, + false); }
static int check_alg_aes_cbc(void) @@ -1014,6 +1048,7 @@ static void crypto_test_enc_alg_aes_cbc(void) ODP_AUTH_ALG_NULL, aes_cbc_reference, ARRAY_SIZE(aes_cbc_reference), + false, false); }
@@ -1027,7 +1062,8 @@ static void crypto_test_enc_alg_aes_cbc_ovr_iv(void) ODP_AUTH_ALG_NULL, aes_cbc_reference, ARRAY_SIZE(aes_cbc_reference), - true); + true, + false); }
/* This test verifies the correctness of decode (ciphertext -> plaintext) @@ -1042,6 +1078,7 @@ static void crypto_test_dec_alg_aes_cbc(void) ODP_AUTH_ALG_NULL, aes_cbc_reference, ARRAY_SIZE(aes_cbc_reference), + false, false); }
@@ -1057,7 +1094,8 @@ static void crypto_test_dec_alg_aes_cbc_ovr_iv(void) ODP_AUTH_ALG_NULL, aes_cbc_reference, ARRAY_SIZE(aes_cbc_reference), - true); + true, + false); }
static int check_alg_aes_ctr(void) @@ -1076,6 +1114,7 @@ static void crypto_test_enc_alg_aes_ctr(void) ODP_AUTH_ALG_NULL, aes_ctr_reference, ARRAY_SIZE(aes_ctr_reference), + false, false); }
@@ -1089,7 +1128,8 @@ static void crypto_test_enc_alg_aes_ctr_ovr_iv(void) ODP_AUTH_ALG_NULL, aes_ctr_reference, ARRAY_SIZE(aes_ctr_reference), - true); + true, + false); }
/* This test verifies the correctness of decode (ciphertext -> plaintext) @@ -1104,6 +1144,7 @@ static void crypto_test_dec_alg_aes_ctr(void) ODP_AUTH_ALG_NULL, aes_ctr_reference, ARRAY_SIZE(aes_ctr_reference), + false, false); }
@@ -1119,7 +1160,8 @@ static void crypto_test_dec_alg_aes_ctr_ovr_iv(void) ODP_AUTH_ALG_NULL, aes_ctr_reference, ARRAY_SIZE(aes_ctr_reference), - true); + true, + false); }
static int check_alg_hmac_md5(void) @@ -1141,6 +1183,7 @@ static void crypto_test_gen_alg_hmac_md5(void) ODP_AUTH_ALG_MD5_HMAC, hmac_md5_reference, ARRAY_SIZE(hmac_md5_reference), + false, false); }
@@ -1151,6 +1194,7 @@ static void crypto_test_check_alg_hmac_md5(void) ODP_AUTH_ALG_MD5_HMAC, hmac_md5_reference, ARRAY_SIZE(hmac_md5_reference), + false, false); }
@@ -1173,6 +1217,7 @@ static void crypto_test_gen_alg_hmac_sha1(void) ODP_AUTH_ALG_SHA1_HMAC, hmac_sha1_reference, ARRAY_SIZE(hmac_sha1_reference), + false, false); }
@@ -1183,6 +1228,7 @@ static void crypto_test_check_alg_hmac_sha1(void) ODP_AUTH_ALG_SHA1_HMAC, hmac_sha1_reference, ARRAY_SIZE(hmac_sha1_reference), + false, false); }
@@ -1205,6 +1251,7 @@ static void crypto_test_gen_alg_hmac_sha256(void) ODP_AUTH_ALG_SHA256_HMAC, hmac_sha256_reference, ARRAY_SIZE(hmac_sha256_reference), + false, false); }
@@ -1215,6 +1262,7 @@ static void crypto_test_check_alg_hmac_sha256(void) ODP_AUTH_ALG_SHA256_HMAC, hmac_sha256_reference, ARRAY_SIZE(hmac_sha256_reference), + false, false); }
@@ -1237,6 +1285,7 @@ static void crypto_test_gen_alg_hmac_sha384(void) ODP_AUTH_ALG_SHA384_HMAC, hmac_sha384_reference, ARRAY_SIZE(hmac_sha384_reference), + false, false); }
@@ -1247,6 +1296,7 @@ static void crypto_test_check_alg_hmac_sha384(void) ODP_AUTH_ALG_SHA384_HMAC, hmac_sha384_reference, ARRAY_SIZE(hmac_sha384_reference), + false, false); }
@@ -1269,6 +1319,7 @@ static void crypto_test_gen_alg_hmac_sha512(void) ODP_AUTH_ALG_SHA512_HMAC, hmac_sha512_reference, ARRAY_SIZE(hmac_sha512_reference), + false, false); }
@@ -1279,6 +1330,7 @@ static void crypto_test_check_alg_hmac_sha512(void) ODP_AUTH_ALG_SHA512_HMAC, hmac_sha512_reference, ARRAY_SIZE(hmac_sha512_reference), + false, false); }
@@ -1302,6 +1354,7 @@ static void crypto_test_gen_alg_aes_xcbc(void) ODP_AUTH_ALG_AES_XCBC_MAC, aes_xcbc_reference, ARRAY_SIZE(aes_xcbc_reference), + false, false); }
@@ -1312,6 +1365,7 @@ static void crypto_test_check_alg_aes_xcbc(void) ODP_AUTH_ALG_AES_XCBC_MAC, aes_xcbc_reference, ARRAY_SIZE(aes_xcbc_reference), + false, false); }
@@ -1327,6 +1381,7 @@ static void crypto_test_gen_alg_aes_gmac(void) ODP_AUTH_ALG_AES_GMAC, aes_gmac_reference, ARRAY_SIZE(aes_gmac_reference), + false, false); }
@@ -1337,7 +1392,8 @@ static void crypto_test_gen_alg_aes_gmac_ovr_iv(void) ODP_AUTH_ALG_AES_GMAC, aes_gmac_reference, ARRAY_SIZE(aes_gmac_reference), - true); + true, + false); }
static void crypto_test_check_alg_aes_gmac(void) @@ -1347,6 +1403,7 @@ static void crypto_test_check_alg_aes_gmac(void) ODP_AUTH_ALG_AES_GMAC, aes_gmac_reference, ARRAY_SIZE(aes_gmac_reference), + false, false); }
@@ -1357,6 +1414,7 @@ static void crypto_test_check_alg_aes_gmac_ovr_iv(void) ODP_AUTH_ALG_AES_GMAC, aes_gmac_reference, ARRAY_SIZE(aes_gmac_reference), + false, false); }
@@ -1372,6 +1430,7 @@ static void crypto_test_gen_alg_aes_cmac(void) ODP_AUTH_ALG_AES_CMAC, aes_cmac_reference, ARRAY_SIZE(aes_cmac_reference), + false, false); }
@@ -1382,6 +1441,7 @@ static void crypto_test_check_alg_aes_cmac(void) ODP_AUTH_ALG_AES_CMAC, aes_cmac_reference, ARRAY_SIZE(aes_cmac_reference), + false, false); }
commit f5b1a18c53cec7203b4f94541af4b112c459ab74 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Sat Feb 3 05:27:10 2018 +0300
api: crypto: add bitstring operation capability
For several wireless communication algorithms it is expected that they operate on bit strings, which are not byte-aligned. Add cipher and auth flags, denoting that this cipher/auth can be enabled to work in bit-string mode.
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h index 654ae7bb..843fdefe 100644 --- a/include/odp/api/spec/crypto.h +++ b/include/odp/api/spec/crypto.h @@ -755,6 +755,22 @@ typedef struct odp_crypto_cipher_capability_t { /** IV length in bytes */ uint32_t iv_len;
+ /** Cipher is operating in bitwise mode + * + * This cipher works on series of bits, rather than sequences of bytes: + * cipher_range in odp_crypto_op_param_t and + * odp_crypto_packet_op_param_t will use bits, rather than bytes. + * + * Note: data buffer MUST start on the byte boundary, using offset + * which is not divisible by 8 is unsupported and will result in + * unspecified behaviour. + * + * Note2: currently data length MUST be divisible by 8. Specifying data + * which does not consist of full bytes will result in unspecified + * behaviour. + */ + odp_bool_t bit_mode; + } odp_crypto_cipher_capability_t;
/** @@ -783,6 +799,18 @@ typedef struct odp_crypto_auth_capability_t { uint32_t inc; } aad_len;
+ /** Auth is operating in bitstring mode + * + * This auth works on series of bits, rather than sequences of bytes: + * auth_range in odp_crypto_op_param_t and + * odp_crypto_packet_op_param_t will use bits, rather than bytes. + * + * Note: data buffer MUST start on the byte boundary, using offset + * which is not divisible by 8 is unsupported and will result in + * unpredictable behaviour. + */ + odp_bool_t bit_mode; + } odp_crypto_auth_capability_t;
/**
commit 09da8929a55e31b5005a3bb1c2c1184c435612cf Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Tue Dec 26 01:26:25 2017 +0300
api: crypto: provide definitions for 3GPP crypto algorithms
Add enumeration definitions for KASUMI F8/F9, SNOW 3G UEA2/UIA2 and ZUC 128-EEA3/128-EIA3 algorithms.
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h index c59f6602..654ae7bb 100644 --- a/include/odp/api/spec/crypto.h +++ b/include/odp/api/spec/crypto.h @@ -110,6 +110,24 @@ typedef enum { */ ODP_CIPHER_ALG_CHACHA20_POLY1305,
+ /** Confidentiality F8 algorithm (UEA1) + * + * KASUMI-based F8 algorithm (also known as UEA1). + */ + ODP_CIPHER_ALG_KASUMI_F8, + + /** Confidentiality UEA2 algorithm (128-EEA1) + * + * SNOW 3G-based UEA2 algorithm (also known as 128-EEA1). + */ + ODP_CIPHER_ALG_SNOW3G_UEA2, + + /** Confidentiality 128-EEA3 algorithm + * + * ZUC-based 128-EEA3 algorithm. + */ + ODP_CIPHER_ALG_ZUC_EEA3, + /** @deprecated Use ODP_CIPHER_ALG_AES_CBC instead */ ODP_DEPRECATE(ODP_CIPHER_ALG_AES128_CBC),
@@ -214,6 +232,27 @@ typedef enum { */ ODP_AUTH_ALG_CHACHA20_POLY1305,
+ /** Integrity F9 algorithm (UIA1) + * + * KASUMI-based F9 algorithm (also known as UIA1). + * + * IV (9 bytes) is a concatenation of COUNT (32b), FRESH (32b) and + * DIRECTION (LSB-aligned, 1b). + */ + ODP_AUTH_ALG_KASUMI_F9, + + /** Integrity UIA2 algorithm (128-EEA1) + * + * SNOW 3G-based UIA2 algorithm (also known as 128-EIA1). + */ + ODP_AUTH_ALG_SNOW3G_UIA2, + + /** Integrity 128-EIA3 algorithm + * + * ZUC-based 128-EIA3 algorithm. + */ + ODP_AUTH_ALG_ZUC_EIA3, + /** @deprecated Use ODP_AUTH_ALG_MD5_HMAC instead */ ODP_DEPRECATE(ODP_AUTH_ALG_MD5_96),
@@ -255,6 +294,15 @@ typedef union odp_crypto_cipher_algos_t { /** ODP_CIPHER_ALG_CHACHA20_POLY1305 */ uint32_t chacha20_poly1305 : 1;
+ /** ODP_CIPHER_ALG_KASUMI_F8 */ + uint32_t kasumi_f8 : 1; + + /** ODP_CIPHER_ALG_SNOW3G_UEA2 */ + uint32_t snow3g_uea2 : 1; + + /** ODP_CIPHER_ALG_ZUC_EEA3 */ + uint32_t zuc_eea3 : 1; + /** @deprecated Use aes_cbc instead */ uint32_t ODP_DEPRECATE(aes128_cbc) : 1;
@@ -312,6 +360,15 @@ typedef union odp_crypto_auth_algos_t { /** ODP_AUTH_ALG_CHACHA20_POLY1305 */ uint32_t chacha20_poly1305 : 1;
+ /** ODP_AUTH_ALG_KASUMI_F9 */ + uint32_t kasumi_f9 : 1; + + /** ODP_AUTH_ALG_SNOW3G_UIA2 */ + uint32_t snow3g_uia2 : 1; + + /** ODP_AUTH_ALG_ZUC_EIA3 */ + uint32_t zuc_eia3 : 1; + /** @deprecated Use md5_hmac instead */ uint32_t ODP_DEPRECATE(md5_96) : 1;
-----------------------------------------------------------------------
Summary of changes: include/odp/api/spec/crypto.h | 85 ++++ test/validation/api/crypto/odp_crypto_test_inp.c | 534 +++++++++++++++++++++-- test/validation/api/crypto/test_vectors.h | 182 ++++++++ test/validation/api/crypto/test_vectors_len.h | 27 ++ 4 files changed, 789 insertions(+), 39 deletions(-)
hooks/post-receive