diff options
author | Janne Peltonen <janne.peltonen@nokia.com> | 2022-02-17 12:53:34 +0200 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2022-02-24 15:12:38 +0200 |
commit | 444fb5e1739160d1c9570c5991284ef5a6314f9f (patch) | |
tree | 3c01cdfe8979d127ba2efe1a81d3b28c37f2896e /test/validation | |
parent | 580648654f854f0af31df07fa50d419191c7de1d (diff) |
validation: crypto: indicate in a test vector if its length is in bits
Currently some test vectors use bits and some use bytes as the length
unit. The test functions using the vectors pass a hard coded bit_mode
flag to a generic test function. Clean up the code by augmenting test
vectors with a boolean that tells if the length is in bits and by
getting rid of the bit_mode flag in the top level test functions.
Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
Diffstat (limited to 'test/validation')
-rw-r--r-- | test/validation/api/crypto/odp_crypto_test_inp.c | 211 | ||||
-rw-r--r-- | test/validation/api/crypto/test_vectors.h | 12 |
2 files changed, 83 insertions, 140 deletions
diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index fbcb66086..afefac018 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -789,8 +789,7 @@ static void check_alg(odp_crypto_op_t op, odp_cipher_alg_t cipher_alg, odp_auth_alg_t auth_alg, crypto_test_reference_t *ref, - size_t count, - odp_bool_t bit_mode) + size_t count) { int rc, i; int cipher_num = odp_crypto_cipher_capability(cipher_alg, NULL, 0); @@ -820,6 +819,7 @@ static void check_alg(odp_crypto_op_t op, for (idx = 0; idx < count; idx++) { int cipher_idx = -1, auth_idx = -1; + odp_bool_t bit_mode = ref[idx].is_length_in_bits; uint32_t digest_offs = ref[idx].length; if (bit_mode) @@ -1167,7 +1167,8 @@ static void create_hash_test_reference(odp_auth_alg_t auth, ref->auth_key_length = capa->key_len; ref->auth_iv_length = capa->iv_len; ref->digest_length = capa->digest_len; - ref->length = capa->bit_mode ? auth_bytes * 8 : auth_bytes; + ref->is_length_in_bits = capa->bit_mode; + ref->length = ref->is_length_in_bits ? auth_bytes * 8 : auth_bytes; auth_range.length = ref->length; if (ref->auth_key_length > MAX_KEY_LEN || @@ -1327,8 +1328,7 @@ static void crypto_test_enc_alg_null(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_NULL, null_reference, - ARRAY_SIZE(null_reference), - false); + ARRAY_SIZE(null_reference)); } static void crypto_test_dec_alg_null(void) @@ -1337,8 +1337,7 @@ static void crypto_test_dec_alg_null(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_NULL, null_reference, - ARRAY_SIZE(null_reference), - false); + ARRAY_SIZE(null_reference)); } static int check_alg_3des_cbc(void) @@ -1352,8 +1351,7 @@ static void crypto_test_enc_alg_3des_cbc(void) ODP_CIPHER_ALG_3DES_CBC, ODP_AUTH_ALG_NULL, tdes_cbc_reference, - ARRAY_SIZE(tdes_cbc_reference), - false); + ARRAY_SIZE(tdes_cbc_reference)); } static void crypto_test_dec_alg_3des_cbc(void) @@ -1362,8 +1360,7 @@ static void crypto_test_dec_alg_3des_cbc(void) ODP_CIPHER_ALG_3DES_CBC, ODP_AUTH_ALG_NULL, tdes_cbc_reference, - ARRAY_SIZE(tdes_cbc_reference), - false); + ARRAY_SIZE(tdes_cbc_reference)); } static int check_alg_3des_ecb(void) @@ -1377,8 +1374,7 @@ static void crypto_test_enc_alg_3des_ecb(void) ODP_CIPHER_ALG_3DES_ECB, ODP_AUTH_ALG_NULL, tdes_ecb_reference, - ARRAY_SIZE(tdes_ecb_reference), - false); + ARRAY_SIZE(tdes_ecb_reference)); } static void crypto_test_dec_alg_3des_ecb(void) @@ -1387,8 +1383,7 @@ static void crypto_test_dec_alg_3des_ecb(void) ODP_CIPHER_ALG_3DES_ECB, ODP_AUTH_ALG_NULL, tdes_ecb_reference, - ARRAY_SIZE(tdes_ecb_reference), - false); + ARRAY_SIZE(tdes_ecb_reference)); } static int check_alg_chacha20_poly1305(void) @@ -1403,8 +1398,7 @@ static void crypto_test_enc_alg_chacha20_poly1305(void) ODP_CIPHER_ALG_CHACHA20_POLY1305, ODP_AUTH_ALG_CHACHA20_POLY1305, chacha20_poly1305_reference, - ARRAY_SIZE(chacha20_poly1305_reference), - false); + ARRAY_SIZE(chacha20_poly1305_reference)); } static void crypto_test_dec_alg_chacha20_poly1305(void) @@ -1413,8 +1407,7 @@ static void crypto_test_dec_alg_chacha20_poly1305(void) ODP_CIPHER_ALG_CHACHA20_POLY1305, ODP_AUTH_ALG_CHACHA20_POLY1305, chacha20_poly1305_reference, - ARRAY_SIZE(chacha20_poly1305_reference), - false); + ARRAY_SIZE(chacha20_poly1305_reference)); } static int check_alg_aes_gcm(void) @@ -1428,8 +1421,7 @@ static void crypto_test_enc_alg_aes_gcm(void) ODP_CIPHER_ALG_AES_GCM, ODP_AUTH_ALG_AES_GCM, aes_gcm_reference, - ARRAY_SIZE(aes_gcm_reference), - false); + ARRAY_SIZE(aes_gcm_reference)); } static void crypto_test_dec_alg_aes_gcm(void) @@ -1438,8 +1430,7 @@ static void crypto_test_dec_alg_aes_gcm(void) ODP_CIPHER_ALG_AES_GCM, ODP_AUTH_ALG_AES_GCM, aes_gcm_reference, - ARRAY_SIZE(aes_gcm_reference), - false); + ARRAY_SIZE(aes_gcm_reference)); } static int check_alg_aes_ccm(void) @@ -1453,8 +1444,7 @@ static void crypto_test_enc_alg_aes_ccm(void) ODP_CIPHER_ALG_AES_CCM, ODP_AUTH_ALG_AES_CCM, aes_ccm_reference, - ARRAY_SIZE(aes_ccm_reference), - false); + ARRAY_SIZE(aes_ccm_reference)); } static void crypto_test_dec_alg_aes_ccm(void) @@ -1463,8 +1453,7 @@ static void crypto_test_dec_alg_aes_ccm(void) ODP_CIPHER_ALG_AES_CCM, ODP_AUTH_ALG_AES_CCM, aes_ccm_reference, - ARRAY_SIZE(aes_ccm_reference), - false); + ARRAY_SIZE(aes_ccm_reference)); } static int check_alg_aes_cbc(void) @@ -1478,8 +1467,7 @@ static void crypto_test_enc_alg_aes_cbc(void) ODP_CIPHER_ALG_AES_CBC, ODP_AUTH_ALG_NULL, aes_cbc_reference, - ARRAY_SIZE(aes_cbc_reference), - false); + ARRAY_SIZE(aes_cbc_reference)); } static void crypto_test_dec_alg_aes_cbc(void) @@ -1488,8 +1476,7 @@ static void crypto_test_dec_alg_aes_cbc(void) ODP_CIPHER_ALG_AES_CBC, ODP_AUTH_ALG_NULL, aes_cbc_reference, - ARRAY_SIZE(aes_cbc_reference), - false); + ARRAY_SIZE(aes_cbc_reference)); } static int check_alg_aes_ctr(void) @@ -1503,8 +1490,7 @@ static void crypto_test_enc_alg_aes_ctr(void) ODP_CIPHER_ALG_AES_CTR, ODP_AUTH_ALG_NULL, aes_ctr_reference, - ARRAY_SIZE(aes_ctr_reference), - false); + ARRAY_SIZE(aes_ctr_reference)); } static void crypto_test_dec_alg_aes_ctr(void) @@ -1513,8 +1499,7 @@ static void crypto_test_dec_alg_aes_ctr(void) ODP_CIPHER_ALG_AES_CTR, ODP_AUTH_ALG_NULL, aes_ctr_reference, - ARRAY_SIZE(aes_ctr_reference), - false); + ARRAY_SIZE(aes_ctr_reference)); } static int check_alg_aes_ecb(void) @@ -1528,8 +1513,7 @@ static void crypto_test_enc_alg_aes_ecb(void) ODP_CIPHER_ALG_AES_ECB, ODP_AUTH_ALG_NULL, aes_ecb_reference, - ARRAY_SIZE(aes_ecb_reference), - false); + ARRAY_SIZE(aes_ecb_reference)); } static void crypto_test_dec_alg_aes_ecb(void) @@ -1538,8 +1522,7 @@ static void crypto_test_dec_alg_aes_ecb(void) ODP_CIPHER_ALG_AES_ECB, ODP_AUTH_ALG_NULL, aes_ecb_reference, - ARRAY_SIZE(aes_ecb_reference), - false); + ARRAY_SIZE(aes_ecb_reference)); } static int check_alg_aes_cfb128(void) @@ -1553,8 +1536,7 @@ static void crypto_test_enc_alg_aes_cfb128(void) ODP_CIPHER_ALG_AES_CFB128, ODP_AUTH_ALG_NULL, aes_cfb128_reference, - ARRAY_SIZE(aes_cfb128_reference), - false); + ARRAY_SIZE(aes_cfb128_reference)); } static void crypto_test_dec_alg_aes_cfb128(void) @@ -1563,8 +1545,7 @@ static void crypto_test_dec_alg_aes_cfb128(void) ODP_CIPHER_ALG_AES_CFB128, ODP_AUTH_ALG_NULL, aes_cfb128_reference, - ARRAY_SIZE(aes_cfb128_reference), - false); + ARRAY_SIZE(aes_cfb128_reference)); } static int check_alg_aes_xts(void) @@ -1578,8 +1559,7 @@ static void crypto_test_enc_alg_aes_xts(void) ODP_CIPHER_ALG_AES_XTS, ODP_AUTH_ALG_NULL, aes_xts_reference, - ARRAY_SIZE(aes_xts_reference), - false); + ARRAY_SIZE(aes_xts_reference)); } static void crypto_test_dec_alg_aes_xts(void) @@ -1588,8 +1568,7 @@ static void crypto_test_dec_alg_aes_xts(void) ODP_CIPHER_ALG_AES_XTS, ODP_AUTH_ALG_NULL, aes_xts_reference, - ARRAY_SIZE(aes_xts_reference), - false); + ARRAY_SIZE(aes_xts_reference)); } static int check_alg_kasumi_f8(void) @@ -1603,8 +1582,7 @@ static void crypto_test_enc_alg_kasumi_f8(void) ODP_CIPHER_ALG_KASUMI_F8, ODP_AUTH_ALG_NULL, kasumi_f8_reference, - ARRAY_SIZE(kasumi_f8_reference), - true); + ARRAY_SIZE(kasumi_f8_reference)); } static void crypto_test_dec_alg_kasumi_f8(void) @@ -1613,8 +1591,7 @@ static void crypto_test_dec_alg_kasumi_f8(void) ODP_CIPHER_ALG_KASUMI_F8, ODP_AUTH_ALG_NULL, kasumi_f8_reference, - ARRAY_SIZE(kasumi_f8_reference), - true); + ARRAY_SIZE(kasumi_f8_reference)); } static int check_alg_snow3g_uea2(void) @@ -1628,8 +1605,7 @@ static void crypto_test_enc_alg_snow3g_uea2(void) ODP_CIPHER_ALG_SNOW3G_UEA2, ODP_AUTH_ALG_NULL, snow3g_uea2_reference, - ARRAY_SIZE(snow3g_uea2_reference), - true); + ARRAY_SIZE(snow3g_uea2_reference)); } static void crypto_test_dec_alg_snow3g_uea2(void) @@ -1638,8 +1614,7 @@ static void crypto_test_dec_alg_snow3g_uea2(void) ODP_CIPHER_ALG_SNOW3G_UEA2, ODP_AUTH_ALG_NULL, snow3g_uea2_reference, - ARRAY_SIZE(snow3g_uea2_reference), - true); + ARRAY_SIZE(snow3g_uea2_reference)); } static int check_alg_aes_eea2(void) @@ -1654,8 +1629,7 @@ static void crypto_test_enc_alg_aes_eea2(void) ODP_CIPHER_ALG_AES_EEA2, ODP_AUTH_ALG_NULL, aes_eea2_reference, - ARRAY_SIZE(aes_eea2_reference), - true); + ARRAY_SIZE(aes_eea2_reference)); } static void crypto_test_dec_alg_aes_eea2(void) @@ -1664,8 +1638,7 @@ static void crypto_test_dec_alg_aes_eea2(void) ODP_CIPHER_ALG_AES_EEA2, ODP_AUTH_ALG_NULL, aes_eea2_reference, - ARRAY_SIZE(aes_eea2_reference), - true); + ARRAY_SIZE(aes_eea2_reference)); } static int check_alg_zuc_eea3(void) @@ -1679,8 +1652,7 @@ static void crypto_test_enc_alg_zuc_eea3(void) ODP_CIPHER_ALG_ZUC_EEA3, ODP_AUTH_ALG_NULL, zuc_eea3_reference, - ARRAY_SIZE(zuc_eea3_reference), - true); + ARRAY_SIZE(zuc_eea3_reference)); } static void crypto_test_dec_alg_zuc_eea3(void) @@ -1689,8 +1661,7 @@ static void crypto_test_dec_alg_zuc_eea3(void) ODP_CIPHER_ALG_ZUC_EEA3, ODP_AUTH_ALG_NULL, zuc_eea3_reference, - ARRAY_SIZE(zuc_eea3_reference), - true); + ARRAY_SIZE(zuc_eea3_reference)); } static int check_alg_hmac_md5(void) @@ -1704,8 +1675,7 @@ static void crypto_test_gen_alg_hmac_md5(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_MD5_HMAC, hmac_md5_reference, - ARRAY_SIZE(hmac_md5_reference), - false); + ARRAY_SIZE(hmac_md5_reference)); } static void crypto_test_check_alg_hmac_md5(void) @@ -1714,8 +1684,7 @@ static void crypto_test_check_alg_hmac_md5(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_MD5_HMAC, hmac_md5_reference, - ARRAY_SIZE(hmac_md5_reference), - false); + ARRAY_SIZE(hmac_md5_reference)); } static int check_alg_hmac_sha1(void) @@ -1729,8 +1698,7 @@ static void crypto_test_gen_alg_hmac_sha1(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA1_HMAC, hmac_sha1_reference, - ARRAY_SIZE(hmac_sha1_reference), - false); + ARRAY_SIZE(hmac_sha1_reference)); } static void crypto_test_check_alg_hmac_sha1(void) @@ -1739,8 +1707,7 @@ static void crypto_test_check_alg_hmac_sha1(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA1_HMAC, hmac_sha1_reference, - ARRAY_SIZE(hmac_sha1_reference), - false); + ARRAY_SIZE(hmac_sha1_reference)); } static int check_alg_hmac_sha224(void) @@ -1754,8 +1721,7 @@ static void crypto_test_gen_alg_hmac_sha224(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA224_HMAC, hmac_sha224_reference, - ARRAY_SIZE(hmac_sha224_reference), - false); + ARRAY_SIZE(hmac_sha224_reference)); } static void crypto_test_check_alg_hmac_sha224(void) @@ -1764,8 +1730,7 @@ static void crypto_test_check_alg_hmac_sha224(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA224_HMAC, hmac_sha224_reference, - ARRAY_SIZE(hmac_sha224_reference), - false); + ARRAY_SIZE(hmac_sha224_reference)); } static int check_alg_hmac_sha256(void) @@ -1779,8 +1744,7 @@ static void crypto_test_gen_alg_hmac_sha256(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA256_HMAC, hmac_sha256_reference, - ARRAY_SIZE(hmac_sha256_reference), - false); + ARRAY_SIZE(hmac_sha256_reference)); } static void crypto_test_check_alg_hmac_sha256(void) @@ -1789,8 +1753,7 @@ static void crypto_test_check_alg_hmac_sha256(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA256_HMAC, hmac_sha256_reference, - ARRAY_SIZE(hmac_sha256_reference), - false); + ARRAY_SIZE(hmac_sha256_reference)); } static int check_alg_hmac_sha384(void) @@ -1804,8 +1767,7 @@ static void crypto_test_gen_alg_hmac_sha384(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA384_HMAC, hmac_sha384_reference, - ARRAY_SIZE(hmac_sha384_reference), - false); + ARRAY_SIZE(hmac_sha384_reference)); } static void crypto_test_check_alg_hmac_sha384(void) @@ -1814,8 +1776,7 @@ static void crypto_test_check_alg_hmac_sha384(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA384_HMAC, hmac_sha384_reference, - ARRAY_SIZE(hmac_sha384_reference), - false); + ARRAY_SIZE(hmac_sha384_reference)); } static int check_alg_hmac_sha512(void) @@ -1829,8 +1790,7 @@ static void crypto_test_gen_alg_hmac_sha512(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA512_HMAC, hmac_sha512_reference, - ARRAY_SIZE(hmac_sha512_reference), - false); + ARRAY_SIZE(hmac_sha512_reference)); } static void crypto_test_check_alg_hmac_sha512(void) @@ -1839,8 +1799,7 @@ static void crypto_test_check_alg_hmac_sha512(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA512_HMAC, hmac_sha512_reference, - ARRAY_SIZE(hmac_sha512_reference), - false); + ARRAY_SIZE(hmac_sha512_reference)); } static int check_alg_aes_xcbc(void) @@ -1855,8 +1814,7 @@ static void crypto_test_gen_alg_aes_xcbc(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_AES_XCBC_MAC, aes_xcbc_reference, - ARRAY_SIZE(aes_xcbc_reference), - false); + ARRAY_SIZE(aes_xcbc_reference)); } static void crypto_test_check_alg_aes_xcbc(void) @@ -1865,8 +1823,7 @@ static void crypto_test_check_alg_aes_xcbc(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_AES_XCBC_MAC, aes_xcbc_reference, - ARRAY_SIZE(aes_xcbc_reference), - false); + ARRAY_SIZE(aes_xcbc_reference)); } static int check_alg_aes_gmac(void) @@ -1880,8 +1837,7 @@ static void crypto_test_gen_alg_aes_gmac(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_AES_GMAC, aes_gmac_reference, - ARRAY_SIZE(aes_gmac_reference), - false); + ARRAY_SIZE(aes_gmac_reference)); } static void crypto_test_check_alg_aes_gmac(void) @@ -1890,8 +1846,7 @@ static void crypto_test_check_alg_aes_gmac(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_AES_GMAC, aes_gmac_reference, - ARRAY_SIZE(aes_gmac_reference), - false); + ARRAY_SIZE(aes_gmac_reference)); } static int check_alg_aes_cmac(void) @@ -1905,8 +1860,7 @@ static void crypto_test_gen_alg_aes_cmac(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_AES_CMAC, aes_cmac_reference, - ARRAY_SIZE(aes_cmac_reference), - false); + ARRAY_SIZE(aes_cmac_reference)); } static void crypto_test_check_alg_aes_cmac(void) @@ -1915,8 +1869,7 @@ static void crypto_test_check_alg_aes_cmac(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_AES_CMAC, aes_cmac_reference, - ARRAY_SIZE(aes_cmac_reference), - false); + ARRAY_SIZE(aes_cmac_reference)); } static int check_alg_kasumi_f9(void) @@ -1930,8 +1883,7 @@ static void crypto_test_gen_alg_kasumi_f9(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_KASUMI_F9, kasumi_f9_reference, - ARRAY_SIZE(kasumi_f9_reference), - true); + ARRAY_SIZE(kasumi_f9_reference)); } static void crypto_test_check_alg_kasumi_f9(void) @@ -1940,8 +1892,7 @@ static void crypto_test_check_alg_kasumi_f9(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_KASUMI_F9, kasumi_f9_reference, - ARRAY_SIZE(kasumi_f9_reference), - true); + ARRAY_SIZE(kasumi_f9_reference)); } static int check_alg_snow3g_uia2(void) @@ -1955,8 +1906,7 @@ static void crypto_test_gen_alg_snow3g_uia2(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SNOW3G_UIA2, snow3g_uia2_reference, - ARRAY_SIZE(snow3g_uia2_reference), - true); + ARRAY_SIZE(snow3g_uia2_reference)); } static void crypto_test_check_alg_snow3g_uia2(void) @@ -1965,8 +1915,7 @@ static void crypto_test_check_alg_snow3g_uia2(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SNOW3G_UIA2, snow3g_uia2_reference, - ARRAY_SIZE(snow3g_uia2_reference), - true); + ARRAY_SIZE(snow3g_uia2_reference)); } static int check_alg_aes_eia2(void) @@ -1981,8 +1930,7 @@ static void crypto_test_gen_alg_aes_eia2(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_AES_EIA2, aes_eia2_reference, - ARRAY_SIZE(aes_eia2_reference), - true); + ARRAY_SIZE(aes_eia2_reference)); } static void crypto_test_check_alg_aes_eia2(void) @@ -1991,8 +1939,7 @@ static void crypto_test_check_alg_aes_eia2(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_AES_EIA2, aes_eia2_reference, - ARRAY_SIZE(aes_eia2_reference), - true); + ARRAY_SIZE(aes_eia2_reference)); } static int check_alg_zuc_eia3(void) @@ -2006,8 +1953,7 @@ static void crypto_test_gen_alg_zuc_eia3(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_ZUC_EIA3, zuc_eia3_reference, - ARRAY_SIZE(zuc_eia3_reference), - true); + ARRAY_SIZE(zuc_eia3_reference)); } static void crypto_test_check_alg_zuc_eia3(void) @@ -2016,8 +1962,7 @@ static void crypto_test_check_alg_zuc_eia3(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_ZUC_EIA3, zuc_eia3_reference, - ARRAY_SIZE(zuc_eia3_reference), - true); + ARRAY_SIZE(zuc_eia3_reference)); } static int check_alg_md5(void) @@ -2031,8 +1976,7 @@ static void crypto_test_gen_alg_md5(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_MD5, md5_reference, - ARRAY_SIZE(md5_reference), - false); + ARRAY_SIZE(md5_reference)); } static void crypto_test_check_alg_md5(void) @@ -2041,8 +1985,7 @@ static void crypto_test_check_alg_md5(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_MD5, md5_reference, - ARRAY_SIZE(md5_reference), - false); + ARRAY_SIZE(md5_reference)); } static int check_alg_sha1(void) @@ -2056,8 +1999,7 @@ static void crypto_test_gen_alg_sha1(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA1, sha1_reference, - ARRAY_SIZE(sha1_reference), - false); + ARRAY_SIZE(sha1_reference)); } static void crypto_test_check_alg_sha1(void) @@ -2066,8 +2008,7 @@ static void crypto_test_check_alg_sha1(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA1, sha1_reference, - ARRAY_SIZE(sha1_reference), - false); + ARRAY_SIZE(sha1_reference)); } static int check_alg_sha224(void) @@ -2081,8 +2022,7 @@ static void crypto_test_gen_alg_sha224(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA224, sha224_reference, - ARRAY_SIZE(sha224_reference), - false); + ARRAY_SIZE(sha224_reference)); } static void crypto_test_check_alg_sha224(void) @@ -2091,8 +2031,7 @@ static void crypto_test_check_alg_sha224(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA224, sha224_reference, - ARRAY_SIZE(sha224_reference), - false); + ARRAY_SIZE(sha224_reference)); } static int check_alg_sha256(void) @@ -2106,8 +2045,7 @@ static void crypto_test_gen_alg_sha256(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA256, sha256_reference, - ARRAY_SIZE(sha256_reference), - false); + ARRAY_SIZE(sha256_reference)); } static void crypto_test_check_alg_sha256(void) @@ -2116,8 +2054,7 @@ static void crypto_test_check_alg_sha256(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA256, sha256_reference, - ARRAY_SIZE(sha256_reference), - false); + ARRAY_SIZE(sha256_reference)); } static int check_alg_sha384(void) @@ -2131,8 +2068,7 @@ static void crypto_test_gen_alg_sha384(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA384, sha384_reference, - ARRAY_SIZE(sha384_reference), - false); + ARRAY_SIZE(sha384_reference)); } static void crypto_test_check_alg_sha384(void) @@ -2141,8 +2077,7 @@ static void crypto_test_check_alg_sha384(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA384, sha384_reference, - ARRAY_SIZE(sha384_reference), - false); + ARRAY_SIZE(sha384_reference)); } static int check_alg_sha512(void) @@ -2156,8 +2091,7 @@ static void crypto_test_gen_alg_sha512(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA512, sha512_reference, - ARRAY_SIZE(sha512_reference), - false); + ARRAY_SIZE(sha512_reference)); } static void crypto_test_check_alg_sha512(void) @@ -2166,8 +2100,7 @@ static void crypto_test_check_alg_sha512(void) ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA512, sha512_reference, - ARRAY_SIZE(sha512_reference), - false); + ARRAY_SIZE(sha512_reference)); } static odp_queue_t sched_compl_queue_create(void) diff --git a/test/validation/api/crypto/test_vectors.h b/test/validation/api/crypto/test_vectors.h index 98fbcd343..122d581e6 100644 --- a/test/validation/api/crypto/test_vectors.h +++ b/test/validation/api/crypto/test_vectors.h @@ -1,5 +1,5 @@ /* Copyright (c) 2014-2018, Linaro Limited - * Copyright (c) 2021, Nokia + * Copyright (c) 2021-2022, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -21,6 +21,7 @@ typedef struct crypto_test_reference_s { uint32_t auth_iv_length; uint8_t auth_iv[MAX_IV_LEN]; uint32_t length; + odp_bool_t is_length_in_bits; uint8_t plaintext[MAX_DATA_LEN]; uint8_t ciphertext[MAX_DATA_LEN]; uint32_t aad_length; @@ -2252,6 +2253,7 @@ static crypto_test_reference_t kasumi_f8_reference[] = { .cipher_iv_length = KASUMI_F8_IV_LEN, .cipher_iv = { 0xfa, 0x55, 0x6b, 0x26, 0x1c, 0x00, 0x00, 0x00}, .length = 120, /* 15 bytes */ + .is_length_in_bits = true, .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, @@ -2268,6 +2270,7 @@ static crypto_test_reference_t kasumi_f9_reference[] = { .auth_iv = { 0x14, 0x79, 0x3e, 0x41, 0x03, 0x97, 0xe8, 0xfd, 0x01, }, .length = 384, /* 48 bytes */ + .is_length_in_bits = true, .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, @@ -2302,6 +2305,7 @@ static crypto_test_reference_t snow3g_uea2_reference[] = { .cipher_iv = { 0xfa, 0x55, 0x6b, 0x26, 0x1c, 0x00, 0x00, 0x00, 0xfa, 0x55, 0x6b, 0x26, 0x1c, 0x00, 0x00, 0x00}, .length = 120, /* 15 bytes */ + .is_length_in_bits = true, .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, @@ -2318,6 +2322,7 @@ static crypto_test_reference_t snow3g_uia2_reference[] = { .auth_iv = { 0x14, 0x79, 0x3e, 0x41, 0x03, 0x97, 0xe8, 0xfd, 0x94, 0x79, 0x3e, 0x41, 0x03, 0x97, 0x68, 0xfd }, .length = 384, /* 48 bytes */ + .is_length_in_bits = true, .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, @@ -2348,6 +2353,7 @@ static crypto_test_reference_t aes_eea2_reference[] = { .cipher_iv_length = AES_EEA2_IV_LEN, .cipher_iv = { 0x39, 0x8a, 0x59, 0xb4, 0xac, }, .length = 253, + .is_length_in_bits = true, .plaintext = { 0x98, 0x1B, 0xA6, 0x82, 0x4C, 0x1B, 0xFB, 0x1A, 0xB4, 0x85, 0x47, 0x20, 0x29, 0xB7, 0x1D, 0x80, 0x8C, 0xE3, 0x3E, 0x2C, 0xC3, 0xC0, 0xB5, 0xFC, @@ -2364,6 +2370,7 @@ static crypto_test_reference_t aes_eea2_reference[] = { .cipher_iv_length = AES_EEA2_IV_LEN, .cipher_iv = { 0xc6, 0x75, 0xa6, 0x4b, 0x64, }, .length = 798, + .is_length_in_bits = true, .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, @@ -2401,6 +2408,7 @@ static crypto_test_reference_t aes_eia2_reference[] = { .auth_iv_length = AES_EIA2_IV_LEN, .auth_iv = { 0x39, 0x8a, 0x59, 0xb4, 0xd4, }, .length = 64, /* 8 bytes */ + .is_length_in_bits = true, .plaintext = { 0x48, 0x45, 0x83, 0xd5, 0xaf, 0xe0, 0x82, 0xae }, .ciphertext = { 0x48, 0x45, 0x83, 0xd5, 0xaf, 0xe0, 0x82, 0xae}, .digest_length = AES_EIA2_DIGEST_LEN, @@ -2425,6 +2433,7 @@ static crypto_test_reference_t zuc_eea3_reference[] = { .cipher_iv = { 0x00, 0x05, 0x68, 0x23, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x05, 0x68, 0x23, 0xc4, 0x00, 0x00, 0x00 }, .length = 800, /* 100 bytes */ + .is_length_in_bits = true, .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, @@ -2463,6 +2472,7 @@ static crypto_test_reference_t zuc_eia3_reference[] = { .auth_iv = { 0xa9, 0x40, 0x59, 0xda, 0x50, 0x00, 0x00, 0x00, 0x29, 0x40, 0x59, 0xda, 0x50, 0x00, 0x80, 0x00 }, .length = 584, /* 73 bytes */ + .is_length_in_bits = true, .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, |