test/crypto: add ZUC test cases for QAT
authorArek Kusztal <arkadiuszx.kusztal@intel.com>
Fri, 31 Mar 2017 12:53:20 +0000 (13:53 +0100)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Wed, 5 Apr 2017 22:17:44 +0000 (00:17 +0200)
This patch adds ZUC EEA3/EIA3 test cases for QAT crypto test suite

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
test/test/test_cryptodev.c
test/test/test_cryptodev_zuc_test_vectors.h

index f654c66..a29c019 100644 (file)
@@ -1962,6 +1962,65 @@ create_wireless_algo_cipher_auth_session(uint8_t dev_id,
        return 0;
 }
 
+static int
+create_wireless_cipher_auth_session(uint8_t dev_id,
+               enum rte_crypto_cipher_operation cipher_op,
+               enum rte_crypto_auth_operation auth_op,
+               enum rte_crypto_auth_algorithm auth_algo,
+               enum rte_crypto_cipher_algorithm cipher_algo,
+               const struct wireless_test_data *tdata)
+{
+       const uint8_t key_len = tdata->key.len;
+       uint8_t cipher_auth_key[key_len];
+
+       struct crypto_unittest_params *ut_params = &unittest_params;
+       const uint8_t *key = tdata->key.data;
+       const uint8_t aad_len = tdata->aad.len;
+       const uint8_t auth_len = tdata->digest.len;
+
+       memcpy(cipher_auth_key, key, key_len);
+
+       /* Setup Authentication Parameters */
+       ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+       ut_params->auth_xform.next = NULL;
+
+       ut_params->auth_xform.auth.op = auth_op;
+       ut_params->auth_xform.auth.algo = auth_algo;
+       ut_params->auth_xform.auth.key.length = key_len;
+       /* Hash key = cipher key */
+       ut_params->auth_xform.auth.key.data = cipher_auth_key;
+       ut_params->auth_xform.auth.digest_length = auth_len;
+       ut_params->auth_xform.auth.add_auth_data_length = aad_len;
+
+       /* Setup Cipher Parameters */
+       ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+       ut_params->cipher_xform.next = &ut_params->auth_xform;
+
+       ut_params->cipher_xform.cipher.algo = cipher_algo;
+       ut_params->cipher_xform.cipher.op = cipher_op;
+       ut_params->cipher_xform.cipher.key.data = cipher_auth_key;
+       ut_params->cipher_xform.cipher.key.length = key_len;
+
+       TEST_HEXDUMP(stdout, "key:", key, key_len);
+
+       /* Create Crypto session*/
+       ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+                               &ut_params->cipher_xform);
+
+       TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
+       return 0;
+}
+
+static int
+create_zuc_cipher_auth_encrypt_generate_session(uint8_t dev_id,
+               const struct wireless_test_data *tdata)
+{
+       return create_wireless_cipher_auth_session(dev_id,
+               RTE_CRYPTO_CIPHER_OP_ENCRYPT,
+               RTE_CRYPTO_AUTH_OP_GENERATE, RTE_CRYPTO_AUTH_ZUC_EIA3,
+               RTE_CRYPTO_CIPHER_ZUC_EEA3, tdata);
+}
+
 static int
 create_wireless_algo_auth_cipher_session(uint8_t dev_id,
                enum rte_crypto_cipher_operation cipher_op,
@@ -2086,6 +2145,120 @@ create_wireless_algo_hash_operation(const uint8_t *auth_tag,
        return 0;
 }
 
+static int
+create_wireless_cipher_hash_operation(const struct wireless_test_data *tdata,
+       enum rte_crypto_auth_operation op,
+       enum rte_crypto_auth_algorithm auth_algo,
+       enum rte_crypto_cipher_algorithm cipher_algo)
+{
+       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_unittest_params *ut_params = &unittest_params;
+
+       const uint8_t *auth_tag = tdata->digest.data;
+       const unsigned int auth_tag_len = tdata->digest.len;
+       const uint8_t *aad = tdata->aad.data;
+       const uint8_t aad_len = tdata->aad.len;
+       unsigned int plaintext_len = ceil_byte_length(tdata->plaintext.len);
+       unsigned int data_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
+
+       const uint8_t *iv = tdata->iv.data;
+       const uint8_t iv_len = tdata->iv.len;
+       const unsigned int cipher_len = tdata->validCipherLenInBits.len;
+       const unsigned int cipher_offset =
+               tdata->validCipherOffsetLenInBits.len;
+       const unsigned int auth_len = tdata->validAuthLenInBits.len;
+       const unsigned int auth_offset = tdata->validAuthOffsetLenInBits.len;
+
+       unsigned int iv_pad_len = 0;
+       unsigned int aad_buffer_len;
+
+       /* Generate Crypto op data structure */
+       ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
+                       RTE_CRYPTO_OP_TYPE_SYMMETRIC);
+       TEST_ASSERT_NOT_NULL(ut_params->op,
+                       "Failed to allocate pktmbuf offload");
+       /* Set crypto operation data parameters */
+       rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
+
+       struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
+
+       /* set crypto operation source mbuf */
+       sym_op->m_src = ut_params->ibuf;
+
+       /* digest */
+       sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
+                       ut_params->ibuf, auth_tag_len);
+
+       TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
+                       "no room to append auth tag");
+       ut_params->digest = sym_op->auth.digest.data;
+       sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+                       ut_params->ibuf, data_pad_len);
+       sym_op->auth.digest.length = auth_tag_len;
+       if (op == RTE_CRYPTO_AUTH_OP_GENERATE)
+               memset(sym_op->auth.digest.data, 0, auth_tag_len);
+       else
+               rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len);
+
+       TEST_HEXDUMP(stdout, "digest:",
+               sym_op->auth.digest.data,
+               sym_op->auth.digest.length);
+
+       /* aad */
+       /*
+       * Always allocate the aad up to the block size.
+       * The cryptodev API calls out -
+       *  - the array must be big enough to hold the AAD, plus any
+       *   space to round this up to the nearest multiple of the
+       *   block size (8 bytes for KASUMI and 16 bytes for SNOW 3G).
+       */
+       if (auth_algo == RTE_CRYPTO_AUTH_KASUMI_F9)
+               aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 8);
+       else
+               aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 16);
+       sym_op->auth.aad.data =
+               (uint8_t *)rte_pktmbuf_prepend(
+                       ut_params->ibuf, aad_buffer_len);
+       TEST_ASSERT_NOT_NULL(sym_op->auth.aad.data,
+                       "no room to prepend aad");
+       sym_op->auth.aad.phys_addr = rte_pktmbuf_mtophys(
+                       ut_params->ibuf);
+       sym_op->auth.aad.length = aad_len;
+       memset(sym_op->auth.aad.data, 0, aad_buffer_len);
+       rte_memcpy(sym_op->auth.aad.data, aad, aad_len);
+       TEST_HEXDUMP(stdout, "aad:", sym_op->auth.aad.data, aad_len);
+
+       /* iv */
+       if (cipher_algo == RTE_CRYPTO_CIPHER_KASUMI_F8)
+               iv_pad_len = RTE_ALIGN_CEIL(iv_len, 8);
+       else
+               iv_pad_len = RTE_ALIGN_CEIL(iv_len, 16);
+       sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(
+               ut_params->ibuf, iv_pad_len);
+
+       TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, "no room to prepend iv");
+       memset(sym_op->cipher.iv.data, 0, iv_pad_len);
+       sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
+       sym_op->cipher.iv.length = iv_pad_len;
+       rte_memcpy(sym_op->cipher.iv.data, iv, iv_len);
+       sym_op->cipher.data.length = cipher_len;
+       sym_op->cipher.data.offset = cipher_offset + auth_offset;
+       sym_op->auth.data.length = auth_len;
+       sym_op->auth.data.offset = auth_offset + cipher_offset;
+
+       return 0;
+}
+
+static int
+create_zuc_cipher_hash_generate_operation(
+               const struct wireless_test_data *tdata)
+{
+       return create_wireless_cipher_hash_operation(tdata,
+               RTE_CRYPTO_AUTH_OP_GENERATE,
+               RTE_CRYPTO_AUTH_ZUC_EIA3,
+               RTE_CRYPTO_CIPHER_ZUC_EEA3);
+}
+
 static int
 create_wireless_algo_cipher_hash_operation(const uint8_t *auth_tag,
                const unsigned auth_tag_len,
@@ -3549,6 +3722,93 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata)
        return 0;
 }
 
+static int
+test_zuc_cipher_auth(const struct wireless_test_data *tdata)
+{
+       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       struct crypto_unittest_params *ut_params = &unittest_params;
+
+       int retval;
+
+       uint8_t *plaintext, *ciphertext;
+       unsigned int plaintext_pad_len;
+       unsigned int plaintext_len;
+
+       struct rte_cryptodev_sym_capability_idx cap_idx;
+
+       /* Check if device supports ZUC EEA3 */
+       cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+       cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_ZUC_EEA3;
+
+       if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+                       &cap_idx) == NULL)
+               return -ENOTSUP;
+
+       /* Check if device supports ZUC EIA3 */
+       cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+       cap_idx.algo.auth = RTE_CRYPTO_AUTH_ZUC_EIA3;
+
+       if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+                       &cap_idx) == NULL)
+               return -ENOTSUP;
+
+       /* Create ZUC session */
+       retval = create_zuc_cipher_auth_encrypt_generate_session(
+                       ts_params->valid_devs[0],
+                       tdata);
+       if (retval < 0)
+               return retval;
+       ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
+
+       /* clear mbuf payload */
+       memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
+                       rte_pktmbuf_tailroom(ut_params->ibuf));
+
+       plaintext_len = ceil_byte_length(tdata->plaintext.len);
+       /* Append data which is padded to a multiple of */
+       /* the algorithms block size */
+       plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
+       plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
+                               plaintext_pad_len);
+       memcpy(plaintext, tdata->plaintext.data, plaintext_len);
+
+       TEST_HEXDUMP(stdout, "plaintext:", plaintext, plaintext_len);
+
+       /* Create ZUC operation */
+       retval = create_zuc_cipher_hash_generate_operation(tdata);
+       if (retval < 0)
+               return retval;
+
+       ut_params->op = process_crypto_request(ts_params->valid_devs[0],
+                       ut_params->op);
+       TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
+       ut_params->obuf = ut_params->op->sym->m_src;
+       if (ut_params->obuf)
+               ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
+                               + tdata->iv.len + tdata->aad.len;
+       else
+               ciphertext = plaintext;
+
+       TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, plaintext_len);
+       /* Validate obuf */
+       TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
+                       ciphertext,
+                       tdata->ciphertext.data,
+                       tdata->validDataLenInBits.len,
+                       "ZUC Ciphertext data not as expected");
+
+       ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
+           + plaintext_pad_len + tdata->aad.len + tdata->iv.len;
+
+       /* Validate obuf */
+       TEST_ASSERT_BUFFERS_ARE_EQUAL(
+                       ut_params->digest,
+                       tdata->digest.data,
+                       4,
+                       "ZUC Generated auth tag not as expected");
+       return 0;
+}
+
 static int
 test_snow3g_cipher_auth(const struct snow3g_test_data *tdata)
 {
@@ -3887,7 +4147,7 @@ test_kasumi_cipher_auth(const struct kasumi_test_data *tdata)
 }
 
 static int
-test_zuc_encryption(const struct zuc_test_data *tdata)
+test_zuc_encryption(const struct wireless_test_data *tdata)
 {
        struct crypto_testsuite_params *ts_params = &testsuite_params;
        struct crypto_unittest_params *ut_params = &unittest_params;
@@ -3897,6 +4157,16 @@ test_zuc_encryption(const struct zuc_test_data *tdata)
        unsigned plaintext_pad_len;
        unsigned plaintext_len;
 
+       struct rte_cryptodev_sym_capability_idx cap_idx;
+
+       /* Check if device supports ZUC EEA3 */
+       cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+       cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_ZUC_EEA3;
+
+       if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+                       &cap_idx) == NULL)
+               return -ENOTSUP;
+
        /* Create ZUC session */
        retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
                                        RTE_CRYPTO_CIPHER_OP_ENCRYPT,
@@ -3952,7 +4222,7 @@ test_zuc_encryption(const struct zuc_test_data *tdata)
 }
 
 static int
-test_zuc_encryption_sgl(const struct zuc_test_data *tdata)
+test_zuc_encryption_sgl(const struct wireless_test_data *tdata)
 {
        struct crypto_testsuite_params *ts_params = &testsuite_params;
        struct crypto_unittest_params *ut_params = &unittest_params;
@@ -3965,11 +4235,21 @@ test_zuc_encryption_sgl(const struct zuc_test_data *tdata)
        uint8_t ciphertext_buffer[2048];
        struct rte_cryptodev_info dev_info;
 
+       struct rte_cryptodev_sym_capability_idx cap_idx;
+
+       /* Check if device supports ZUC EEA3 */
+       cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+       cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_ZUC_EEA3;
+
+       if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+                       &cap_idx) == NULL)
+               return -ENOTSUP;
+
        rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
        if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) {
                printf("Device doesn't support scatter-gather. "
                                "Test Skipped.\n");
-               return 0;
+               return -ENOTSUP;
        }
 
        plaintext_len = ceil_byte_length(tdata->plaintext.len);
@@ -4030,7 +4310,7 @@ test_zuc_encryption_sgl(const struct zuc_test_data *tdata)
 }
 
 static int
-test_zuc_authentication(const struct zuc_test_data *tdata)
+test_zuc_authentication(const struct wireless_test_data *tdata)
 {
        struct crypto_testsuite_params *ts_params = &testsuite_params;
        struct crypto_unittest_params *ut_params = &unittest_params;
@@ -4040,6 +4320,16 @@ test_zuc_authentication(const struct zuc_test_data *tdata)
        unsigned plaintext_len;
        uint8_t *plaintext;
 
+       struct rte_cryptodev_sym_capability_idx cap_idx;
+
+       /* Check if device supports ZUC EIA3 */
+       cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+       cap_idx.algo.auth = RTE_CRYPTO_AUTH_ZUC_EIA3;
+
+       if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
+                       &cap_idx) == NULL)
+               return -ENOTSUP;
+
        /* Create ZUC session */
        retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
                        tdata->key.data, tdata->key.len,
@@ -4284,67 +4574,97 @@ test_kasumi_cipher_auth_test_case_1(void)
 static int
 test_zuc_encryption_test_case_1(void)
 {
-       return test_zuc_encryption(&zuc_test_case_1);
+       return test_zuc_encryption(&zuc_test_case_cipher_193b);
 }
 
 static int
 test_zuc_encryption_test_case_2(void)
 {
-       return test_zuc_encryption(&zuc_test_case_2);
+       return test_zuc_encryption(&zuc_test_case_cipher_800b);
 }
 
 static int
 test_zuc_encryption_test_case_3(void)
 {
-       return test_zuc_encryption(&zuc_test_case_3);
+       return test_zuc_encryption(&zuc_test_case_cipher_1570b);
 }
 
 static int
 test_zuc_encryption_test_case_4(void)
 {
-       return test_zuc_encryption(&zuc_test_case_4);
+       return test_zuc_encryption(&zuc_test_case_cipher_2798b);
 }
 
 static int
 test_zuc_encryption_test_case_5(void)
 {
-       return test_zuc_encryption(&zuc_test_case_5);
+       return test_zuc_encryption(&zuc_test_case_cipher_4019b);
 }
 
 static int
 test_zuc_encryption_test_case_6_sgl(void)
 {
-       return test_zuc_encryption_sgl(&zuc_test_case_1);
+       return test_zuc_encryption_sgl(&zuc_test_case_cipher_193b);
 }
 
 static int
 test_zuc_hash_generate_test_case_1(void)
 {
-       return test_zuc_authentication(&zuc_hash_test_case_1);
+       return test_zuc_authentication(&zuc_test_case_auth_1b);
 }
 
 static int
 test_zuc_hash_generate_test_case_2(void)
 {
-       return test_zuc_authentication(&zuc_hash_test_case_2);
+       return test_zuc_authentication(&zuc_test_case_auth_90b);
 }
 
 static int
 test_zuc_hash_generate_test_case_3(void)
 {
-       return test_zuc_authentication(&zuc_hash_test_case_3);
+       return test_zuc_authentication(&zuc_test_case_auth_577b);
 }
 
 static int
 test_zuc_hash_generate_test_case_4(void)
 {
-       return test_zuc_authentication(&zuc_hash_test_case_4);
+       return test_zuc_authentication(&zuc_test_case_auth_2079b);
 }
 
 static int
 test_zuc_hash_generate_test_case_5(void)
 {
-       return test_zuc_authentication(&zuc_hash_test_case_5);
+       return test_zuc_authentication(&zuc_test_auth_5670b);
+}
+
+static int
+test_zuc_hash_generate_test_case_6(void)
+{
+       return test_zuc_authentication(&zuc_test_case_auth_128b);
+}
+
+static int
+test_zuc_hash_generate_test_case_7(void)
+{
+       return test_zuc_authentication(&zuc_test_case_auth_2080b);
+}
+
+static int
+test_zuc_hash_generate_test_case_8(void)
+{
+       return test_zuc_authentication(&zuc_test_case_auth_584b);
+}
+
+static int
+test_zuc_cipher_auth_test_case_1(void)
+{
+       return test_zuc_cipher_auth(&zuc_test_case_cipher_200b_auth_200b);
+}
+
+static int
+test_zuc_cipher_auth_test_case_2(void)
+{
+       return test_zuc_cipher_auth(&zuc_test_case_cipher_800b_auth_120b);
 }
 
 static int
@@ -7682,6 +8002,32 @@ static struct unit_test_suite cryptodev_qat_testsuite  = {
                TEST_CASE_ST(ut_setup, ut_teardown,
                        test_snow3g_auth_cipher_test_case_1),
 
+               /** ZUC encrypt only (EEA3) */
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_zuc_encryption_test_case_1),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_zuc_encryption_test_case_2),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_zuc_encryption_test_case_3),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_zuc_encryption_test_case_4),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_zuc_encryption_test_case_5),
+
+               /** ZUC authenticate (EIA3) */
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_zuc_hash_generate_test_case_6),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_zuc_hash_generate_test_case_7),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_zuc_hash_generate_test_case_8),
+
+               /** ZUC alg-chain (EEA3/EIA3) */
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_zuc_cipher_auth_test_case_1),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_zuc_cipher_auth_test_case_2),
+
                /** HMAC_MD5 Authentication */
                TEST_CASE_ST(ut_setup, ut_teardown,
                        test_MD5_HMAC_generate_case_1),
index dde7bb3..a900e91 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef TEST_CRYPTODEV_ZUC_TEST_VECTORS_H_
 #define TEST_CRYPTODEV_ZUC_TEST_VECTORS_H_
 
-struct zuc_test_data {
+struct wireless_test_data {
        struct {
                uint8_t data[64];
                unsigned len;
@@ -45,12 +45,12 @@ struct zuc_test_data {
        } iv;
 
        struct {
-               uint8_t data[1024];
+               uint8_t data[2048];
                unsigned len; /* length must be in Bits */
        } plaintext;
 
        struct {
-               uint8_t data[1024];
+               uint8_t data[2048];
                unsigned len; /* length must be in Bits */
        } ciphertext;
 
@@ -84,7 +84,7 @@ struct zuc_test_data {
                unsigned len;
        } digest;
 };
-struct zuc_test_data zuc_test_case_1 = {
+static struct wireless_test_data zuc_test_case_cipher_193b = {
        .key = {
                .data = {
                        0x17, 0x3D, 0x14, 0xBA, 0x50, 0x03, 0x73, 0x1D,
@@ -128,7 +128,7 @@ struct zuc_test_data zuc_test_case_1 = {
        }
 };
 
-struct zuc_test_data zuc_test_case_2 = {
+static struct wireless_test_data zuc_test_case_cipher_800b = {
        .key = {
                .data = {
                        0xE5, 0xBD, 0x3E, 0xA0, 0xEB, 0x55, 0xAD, 0xE8,
@@ -190,7 +190,7 @@ struct zuc_test_data zuc_test_case_2 = {
        }
 };
 
-struct zuc_test_data zuc_test_case_3 = {
+static struct wireless_test_data zuc_test_case_cipher_1570b = {
        .key = {
                .data = {
                        0xD4, 0x55, 0x2A, 0x8F, 0xD6, 0xE6, 0x1C, 0xC8,
@@ -274,26 +274,9 @@ struct zuc_test_data zuc_test_case_3 = {
        .validCipherOffsetLenInBits = {
                .len = 128
        },
-       .aad = {
-               .data = {
-                       0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00,
-                       0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00
-               },
-               .len = 16
-       },
-       .digest = {
-               .data = {0xE8, 0x60, 0x5A, 0x3E},
-               .len  = 4
-       },
-       .validAuthLenInBits = {
-               .len = 120
-       },
-       .validAuthOffsetLenInBits = {
-               .len = 128
-       }
 };
 
-struct zuc_test_data zuc_test_case_4 = {
+static struct wireless_test_data zuc_test_case_cipher_2798b = {
        .key = {
                .data = {
                        0xDB, 0x84, 0xB4, 0xFB, 0xCC, 0xDA, 0x56, 0x3B,
@@ -417,7 +400,7 @@ struct zuc_test_data zuc_test_case_4 = {
        }
 };
 
-struct zuc_test_data zuc_test_case_5 = {
+static struct wireless_test_data zuc_test_case_cipher_4019b = {
        .key = {
                .data = {
                        0xE1, 0x3F, 0xED, 0x21, 0xB4, 0x6E, 0x4E, 0x7E,
@@ -579,7 +562,147 @@ struct zuc_test_data zuc_test_case_5 = {
        }
 };
 
-struct zuc_test_data zuc_hash_test_case_1 = {
+static struct wireless_test_data zuc_test_case_cipher_200b_auth_200b = {
+       .key = {
+               .data = {
+                       0x17, 0x3D, 0x14, 0xBA, 0x50, 0x03, 0x73, 0x1D,
+                       0x7A, 0x60, 0x04, 0x94, 0x70, 0xF0, 0x0A, 0x29
+               },
+               .len = 16
+       },
+       .iv = {
+               .data = {
+                       0x66, 0x03, 0x54, 0x92, 0x78, 0x00, 0x00, 0x00,
+                       0x66, 0x03, 0x54, 0x92, 0x78, 0x00, 0x00, 0x00
+               },
+               .len = 16
+       },
+       .plaintext = {
+               .data = {
+                       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
+               },
+               .len = 200
+       },
+       .ciphertext = {
+               .data = {
+                       0xA6, 0xC8, 0x5F, 0xC6, 0x6A, 0xFB, 0x85, 0x33,
+                       0xAA, 0xFC, 0x25, 0x18, 0xDF, 0xE7, 0x84, 0x94,
+                       0x0E, 0xE1, 0xE4, 0xB0, 0x30, 0x23, 0x8C, 0xC8,
+                       0x10
+               },
+               .len = 200
+       },
+       .validDataLenInBits = {
+               .len = 200
+       },
+       .validCipherLenInBits = {
+               .len = 200
+       },
+       .validCipherOffsetLenInBits = {
+               .len = 128
+       },
+       .aad = {
+               .data = {
+                       0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00,
+                       0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00
+               },
+               .len = 16
+       },
+       .digest = {
+               .data = {0x01, 0xFE, 0x5E, 0x38},
+               .len  = 4
+       },
+       .validAuthLenInBits = {
+               .len = 200
+       },
+       .validAuthOffsetLenInBits = {
+               .len = 128
+       }
+};
+
+static struct wireless_test_data zuc_test_case_cipher_800b_auth_120b = {
+       .key = {
+               .data = {
+                       0xE5, 0xBD, 0x3E, 0xA0, 0xEB, 0x55, 0xAD, 0xE8,
+                       0x66, 0xC6, 0xAC, 0x58, 0xBD, 0x54, 0x30, 0x2A
+               },
+               .len = 16
+       },
+       .iv = {
+               .data = {
+                       0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00,
+                       0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00
+               },
+               .len = 16
+       },
+       .plaintext = {
+               .data = {
+                       0x14, 0xA8, 0xEF, 0x69, 0x3D, 0x67, 0x85, 0x07,
+                       0xBB, 0xE7, 0x27, 0x0A, 0x7F, 0x67, 0xFF, 0x50,
+                       0x06, 0xC3, 0x52, 0x5B, 0x98, 0x07, 0xE4, 0x67,
+                       0xC4, 0xE5, 0x60, 0x00, 0xBA, 0x33, 0x8F, 0x5D,
+                       0x42, 0x95, 0x59, 0x03, 0x67, 0x51, 0x82, 0x22,
+                       0x46, 0xC8, 0x0D, 0x3B, 0x38, 0xF0, 0x7F, 0x4B,
+                       0xE2, 0xD8, 0xFF, 0x58, 0x05, 0xF5, 0x13, 0x22,
+                       0x29, 0xBD, 0xE9, 0x3B, 0xBB, 0xDC, 0xAF, 0x38,
+                       0x2B, 0xF1, 0xEE, 0x97, 0x2F, 0xBF, 0x99, 0x77,
+                       0xBA, 0xDA, 0x89, 0x45, 0x84, 0x7A, 0x2A, 0x6C,
+                       0x9A, 0xD3, 0x4A, 0x66, 0x75, 0x54, 0xE0, 0x4D,
+                       0x1F, 0x7F, 0xA2, 0xC3, 0x32, 0x41, 0xBD, 0x8F,
+                       0x01, 0xBA, 0x22, 0x0D
+               },
+               .len = 800
+       },
+       .ciphertext = {
+               .data = {
+                       0x13, 0x1D, 0x43, 0xE0, 0xDE, 0xA1, 0xBE, 0x5C,
+                       0x5A, 0x1B, 0xFD, 0x97, 0x1D, 0x85, 0x2C, 0xBF,
+                       0x71, 0x2D, 0x7B, 0x4F, 0x57, 0x96, 0x1F, 0xEA,
+                       0x32, 0x08, 0xAF, 0xA8, 0xBC, 0xA4, 0x33, 0xF4,
+                       0x56, 0xAD, 0x09, 0xC7, 0x41, 0x7E, 0x58, 0xBC,
+                       0x69, 0xCF, 0x88, 0x66, 0xD1, 0x35, 0x3F, 0x74,
+                       0x86, 0x5E, 0x80, 0x78, 0x1D, 0x20, 0x2D, 0xFB,
+                       0x3E, 0xCF, 0xF7, 0xFC, 0xBC, 0x3B, 0x19, 0x0F,
+                       0xE8, 0x2A, 0x20, 0x4E, 0xD0, 0xE3, 0x50, 0xFC,
+                       0x0F, 0x6F, 0x26, 0x13, 0xB2, 0xF2, 0xBC, 0xA6,
+                       0xDF, 0x5A, 0x47, 0x3A, 0x57, 0xA4, 0xA0, 0x0D,
+                       0x98, 0x5E, 0xBA, 0xD8, 0x80, 0xD6, 0xF2, 0x38,
+                       0x64, 0xA0, 0x7B, 0x01
+               },
+               .len = 800
+       },
+       .validDataLenInBits = {
+               .len = 800
+       },
+       .validCipherLenInBits = {
+               .len = 800
+       },
+       .validCipherOffsetLenInBits = {
+               .len = 128
+       },
+       .aad = {
+               .data = {
+                       0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00,
+                       0xFA, 0x55, 0x6B, 0x26, 0x1C, 0x00, 0x00, 0x00
+               },
+               .len = 16
+       },
+       .digest = {
+               .data = {0x9D, 0x42, 0x1C, 0xEA},
+               .len  = 4
+       },
+       .validAuthLenInBits = {
+               .len = 120
+       },
+       .validAuthOffsetLenInBits = {
+               .len = 128
+       }
+};
+
+struct wireless_test_data zuc_test_case_auth_1b = {
        .key = {
                .data = {
                        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -610,7 +733,7 @@ struct zuc_test_data zuc_hash_test_case_1 = {
        }
 };
 
-struct zuc_test_data zuc_hash_test_case_2 = {
+struct wireless_test_data zuc_test_case_auth_90b = {
        .key = {
                .data = {
                        0x47, 0x05, 0x41, 0x25, 0x56, 0x1E, 0xB2, 0xDD,
@@ -644,7 +767,7 @@ struct zuc_test_data zuc_hash_test_case_2 = {
        }
 };
 
-struct zuc_test_data zuc_hash_test_case_3 = {
+struct wireless_test_data zuc_test_case_auth_577b = {
        .key = {
                .data = {
                        0xC9, 0xE6, 0xCE, 0xC4, 0x60, 0x7C, 0x72, 0xDB,
@@ -686,7 +809,7 @@ struct zuc_test_data zuc_hash_test_case_3 = {
        }
 };
 
-struct zuc_test_data zuc_hash_test_case_4 = {
+struct wireless_test_data zuc_test_case_auth_2079b = {
        .key = {
                .data = {
                        0xC8, 0xA4, 0x82, 0x62, 0xD0, 0xC2, 0xE2, 0xBA,
@@ -751,7 +874,7 @@ struct zuc_test_data zuc_hash_test_case_4 = {
        }
 };
 
-struct zuc_test_data zuc_hash_test_case_5 = {
+struct wireless_test_data zuc_test_auth_5670b = {
        .key = {
                .data = {
                        0x6B, 0x8B, 0x08, 0xEE, 0x79, 0xE0, 0xB5, 0x98,
@@ -872,5 +995,136 @@ struct zuc_test_data zuc_hash_test_case_5 = {
        }
 };
 
+static struct wireless_test_data zuc_test_case_auth_128b = {
+       .key = {
+               .data = { 0x0 },
+               .len = 16
+       },
+       .aad = {
+               .data = { 0x0 },
+               .len = 16
+       },
+       .plaintext = {
+               .data = { 0x0 },
+               .len = 8
+       },
+       .validAuthLenInBits = {
+               .len = 8
+       },
+       .validAuthOffsetLenInBits = {
+               .len = 128
+       },
+       .digest = {
+               .data = { 0x39, 0x0a, 0x91, 0xb7 },
+               .len  = 4
+       }
+};
+
+static struct wireless_test_data zuc_test_case_auth_2080b = {
+       .key = {
+               .data = {
+                       0xC8, 0xA4, 0x82, 0x62, 0xD0, 0xC2, 0xE2, 0xBA,
+                       0xC4, 0xB9, 0x6E, 0xF7, 0x7E, 0x80, 0xCA, 0x59
+               },
+               .len = 16
+       },
+       .aad = {
+               .data = {
+                       0x05, 0x09, 0x78, 0x50, 0x80, 0x00, 0x00, 0x00,
+                       0x85, 0x09, 0x78, 0x50, 0x80, 0x00, 0x80, 0x00
+               },
+               .len = 16
+       },
+       .plaintext = {
+               .data = {
+                       0xB5, 0x46, 0x43, 0x0B, 0xF8, 0x7B, 0x4F, 0x1E,
+                       0xE8, 0x34, 0x70, 0x4C, 0xD6, 0x95, 0x1C, 0x36,
+                       0xE2, 0x6F, 0x10, 0x8C, 0xF7, 0x31, 0x78, 0x8F,
+                       0x48, 0xDC, 0x34, 0xF1, 0x67, 0x8C, 0x05, 0x22,
+                       0x1C, 0x8F, 0xA7, 0xFF, 0x2F, 0x39, 0xF4, 0x77,
+                       0xE7, 0xE4, 0x9E, 0xF6, 0x0A, 0x4E, 0xC2, 0xC3,
+                       0xDE, 0x24, 0x31, 0x2A, 0x96, 0xAA, 0x26, 0xE1,
+                       0xCF, 0xBA, 0x57, 0x56, 0x38, 0x38, 0xB2, 0x97,
+                       0xF4, 0x7E, 0x85, 0x10, 0xC7, 0x79, 0xFD, 0x66,
+                       0x54, 0xB1, 0x43, 0x38, 0x6F, 0xA6, 0x39, 0xD3,
+                       0x1E, 0xDB, 0xD6, 0xC0, 0x6E, 0x47, 0xD1, 0x59,
+                       0xD9, 0x43, 0x62, 0xF2, 0x6A, 0xEE, 0xED, 0xEE,
+                       0x0E, 0x4F, 0x49, 0xD9, 0xBF, 0x84, 0x12, 0x99,
+                       0x54, 0x15, 0xBF, 0xAD, 0x56, 0xEE, 0x82, 0xD1,
+                       0xCA, 0x74, 0x63, 0xAB, 0xF0, 0x85, 0xB0, 0x82,
+                       0xB0, 0x99, 0x04, 0xD6, 0xD9, 0x90, 0xD4, 0x3C,
+                       0xF2, 0xE0, 0x62, 0xF4, 0x08, 0x39, 0xD9, 0x32,
+                       0x48, 0xB1, 0xEB, 0x92, 0xCD, 0xFE, 0xD5, 0x30,
+                       0x0B, 0xC1, 0x48, 0x28, 0x04, 0x30, 0xB6, 0xD0,
+                       0xCA, 0xA0, 0x94, 0xB6, 0xEC, 0x89, 0x11, 0xAB,
+                       0x7D, 0xC3, 0x68, 0x24, 0xB8, 0x24, 0xDC, 0x0A,
+                       0xF6, 0x68, 0x2B, 0x09, 0x35, 0xFD, 0xE7, 0xB4,
+                       0x92, 0xA1, 0x4D, 0xC2, 0xF4, 0x36, 0x48, 0x03,
+                       0x8D, 0xA2, 0xCF, 0x79, 0x17, 0x0D, 0x2D, 0x50,
+                       0x13, 0x3F, 0xD4, 0x94, 0x16, 0xCB, 0x6E, 0x33,
+                       0xBE, 0xA9, 0x0B, 0x8B, 0xF4, 0x55, 0x9B, 0x03,
+                       0x73, 0x2A, 0x01, 0xEA, 0x29, 0x0E, 0x6D, 0x07,
+                       0x4F, 0x79, 0xBB, 0x83, 0xC1, 0x0E, 0x58, 0x00,
+                       0x15, 0xCC, 0x1A, 0x85, 0xB3, 0x6B, 0x55, 0x01,
+                       0x04, 0x6E, 0x9C, 0x4B, 0xDC, 0xAE, 0x51, 0x35,
+                       0x69, 0x0B, 0x86, 0x66, 0xBD, 0x54, 0xB7, 0xA7,
+                       0x03, 0xEA, 0x7B, 0x6F, 0x22, 0x0A, 0x54, 0x69,
+                       0xA5, 0x68, 0x02, 0x7E
+               },
+               .len = 2080
+       },
+       .validAuthLenInBits = {
+               .len = 2080
+       },
+       .validAuthOffsetLenInBits = {
+               .len = 128
+       },
+       .digest = {
+               .data = {0x03, 0x95, 0x32, 0xe1},
+               .len  = 4
+       }
+};
+
+static struct wireless_test_data zuc_test_case_auth_584b = {
+       .key = {
+               .data = {
+                       0xc9, 0xe6, 0xce, 0xc4, 0x60, 0x7c, 0x72, 0xdb,
+                       0x00, 0x0a, 0xef, 0xa8, 0x83, 0x85, 0xab, 0x0a
+               },
+               .len = 16
+       },
+       .aad = {
+               .data = {
+                       0xa9, 0x40, 0x59, 0xda, 0x50, 0x0, 0x0, 0x0,
+                       0x29, 0x40, 0x59, 0xda, 0x50, 0x0, 0x80, 0x0
+               },
+               .len = 16
+       },
+       .plaintext = {
+               .data = {
+                       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
+               },
+               .len = 584
+       },
+       .validAuthLenInBits = {
+               .len = 584
+       },
+       .validAuthOffsetLenInBits = {
+               .len = 128
+       },
+       .digest = {
+               .data = {0x24, 0xa8, 0x42, 0xb3},
+               .len  = 4
+       }
+};
 
 #endif /* TEST_CRYPTODEV_ZUC_TEST_VECTORS_H_ */