X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=test%2Ftest%2Ftest_cryptodev.c;h=83b8ee7f3e3f9c0ede60872bbbffeaf985b38973;hb=51e202f0596f3cc2061bd2c69bd1f7bd5f04d4be;hp=4c750f67902a112ecbe51f10d124ae9622373687;hpb=ab56c4d9ed9a75c20340812a8a07646fc72403e3;p=dpdk.git diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c index 4c750f6790..83b8ee7f3e 100644 --- a/test/test/test_cryptodev.c +++ b/test/test/test_cryptodev.c @@ -58,7 +58,7 @@ #include "test_cryptodev_snow3g_test_vectors.h" #include "test_cryptodev_snow3g_hash_test_vectors.h" #include "test_cryptodev_zuc_test_vectors.h" -#include "test_cryptodev_gcm_test_vectors.h" +#include "test_cryptodev_aead_test_vectors.h" #include "test_cryptodev_hmac_test_vectors.h" static int gbl_driver_id; @@ -4842,10 +4842,11 @@ test_3DES_cipheronly_openssl_all(void) return TEST_SUCCESS; } -/* ***** AES-GCM Tests ***** */ +/* ***** AEAD algorithm Tests ***** */ static int -create_gcm_session(uint8_t dev_id, enum rte_crypto_aead_operation op, +create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo, + enum rte_crypto_aead_operation op, const uint8_t *key, const uint8_t key_len, const uint16_t aad_len, const uint8_t auth_len, uint8_t iv_len) @@ -4860,7 +4861,7 @@ create_gcm_session(uint8_t dev_id, enum rte_crypto_aead_operation op, /* Setup AEAD Parameters */ ut_params->aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD; ut_params->aead_xform.next = NULL; - ut_params->aead_xform.aead.algo = RTE_CRYPTO_AEAD_AES_GCM; + ut_params->aead_xform.aead.algo = algo; ut_params->aead_xform.aead.op = op; ut_params->aead_xform.aead.key.data = aead_key; ut_params->aead_xform.aead.key.length = key_len; @@ -4884,7 +4885,8 @@ create_gcm_session(uint8_t dev_id, enum rte_crypto_aead_operation op, } static int -create_gcm_xforms(struct rte_crypto_op *op, +create_aead_xform(struct rte_crypto_op *op, + enum rte_crypto_aead_algorithm algo, enum rte_crypto_aead_operation aead_op, uint8_t *key, const uint8_t key_len, const uint8_t aad_len, const uint8_t auth_len, @@ -4898,7 +4900,7 @@ create_gcm_xforms(struct rte_crypto_op *op, /* Setup AEAD Parameters */ sym_op->xform->type = RTE_CRYPTO_SYM_XFORM_AEAD; sym_op->xform->next = NULL; - sym_op->xform->aead.algo = RTE_CRYPTO_AEAD_AES_GCM; + sym_op->xform->aead.algo = algo; sym_op->xform->aead.op = aead_op; sym_op->xform->aead.key.data = key; sym_op->xform->aead.key.length = key_len; @@ -4913,8 +4915,8 @@ create_gcm_xforms(struct rte_crypto_op *op, } static int -create_gcm_operation(enum rte_crypto_aead_operation op, - const struct gcm_test_data *tdata) +create_aead_operation(enum rte_crypto_aead_operation op, + const struct aead_test_data *tdata) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -5033,7 +5035,7 @@ create_gcm_operation(enum rte_crypto_aead_operation op, } static int -test_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata) +test_authenticated_encryption(const struct aead_test_data *tdata) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -5043,8 +5045,9 @@ test_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata) uint16_t plaintext_pad_len; uint32_t i; - /* Create GCM session */ - retval = create_gcm_session(ts_params->valid_devs[0], + /* Create AEAD session */ + retval = create_aead_session(ts_params->valid_devs[0], + tdata->algo, RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata->key.data, tdata->key.len, tdata->aad.len, tdata->auth_tag.len, @@ -5055,7 +5058,7 @@ test_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata) if (tdata->aad.len > MBUF_SIZE) { ut_params->ibuf = rte_pktmbuf_alloc(ts_params->large_mbuf_pool); /* Populate full size of add data */ - for (i = 32; i < GCM_MAX_AAD_LENGTH; i += 32) + for (i = 32; i < MAX_AAD_LENGTH; i += 32) memcpy(&tdata->aad.data[i], &tdata->aad.data[0], 32); } else ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool); @@ -5064,8 +5067,8 @@ test_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata) memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, rte_pktmbuf_tailroom(ut_params->ibuf)); - /* Create GCM operation */ - retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata); + /* Create AEAD operation */ + retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata); if (retval < 0) return retval; @@ -5102,13 +5105,13 @@ test_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata) ciphertext, tdata->ciphertext.data, tdata->ciphertext.len, - "GCM Ciphertext data not as expected"); + "Ciphertext data not as expected"); TEST_ASSERT_BUFFERS_ARE_EQUAL( auth_tag, tdata->auth_tag.data, tdata->auth_tag.len, - "GCM Generated auth tag not as expected"); + "Generated auth tag not as expected"); return 0; @@ -5117,143 +5120,143 @@ test_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata) static int test_AES_GCM_authenticated_encryption_test_case_1(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_1); + return test_authenticated_encryption(&gcm_test_case_1); } static int test_AES_GCM_authenticated_encryption_test_case_2(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_2); + return test_authenticated_encryption(&gcm_test_case_2); } static int test_AES_GCM_authenticated_encryption_test_case_3(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_3); + return test_authenticated_encryption(&gcm_test_case_3); } static int test_AES_GCM_authenticated_encryption_test_case_4(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_4); + return test_authenticated_encryption(&gcm_test_case_4); } static int test_AES_GCM_authenticated_encryption_test_case_5(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_5); + return test_authenticated_encryption(&gcm_test_case_5); } static int test_AES_GCM_authenticated_encryption_test_case_6(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_6); + return test_authenticated_encryption(&gcm_test_case_6); } static int test_AES_GCM_authenticated_encryption_test_case_7(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_7); + return test_authenticated_encryption(&gcm_test_case_7); } static int test_AES_GCM_auth_encryption_test_case_192_1(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_1); + return test_authenticated_encryption(&gcm_test_case_192_1); } static int test_AES_GCM_auth_encryption_test_case_192_2(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_2); + return test_authenticated_encryption(&gcm_test_case_192_2); } static int test_AES_GCM_auth_encryption_test_case_192_3(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_3); + return test_authenticated_encryption(&gcm_test_case_192_3); } static int test_AES_GCM_auth_encryption_test_case_192_4(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_4); + return test_authenticated_encryption(&gcm_test_case_192_4); } static int test_AES_GCM_auth_encryption_test_case_192_5(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_5); + return test_authenticated_encryption(&gcm_test_case_192_5); } static int test_AES_GCM_auth_encryption_test_case_192_6(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_6); + return test_authenticated_encryption(&gcm_test_case_192_6); } static int test_AES_GCM_auth_encryption_test_case_192_7(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_192_7); + return test_authenticated_encryption(&gcm_test_case_192_7); } static int test_AES_GCM_auth_encryption_test_case_256_1(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_1); + return test_authenticated_encryption(&gcm_test_case_256_1); } static int test_AES_GCM_auth_encryption_test_case_256_2(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_2); + return test_authenticated_encryption(&gcm_test_case_256_2); } static int test_AES_GCM_auth_encryption_test_case_256_3(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_3); + return test_authenticated_encryption(&gcm_test_case_256_3); } static int test_AES_GCM_auth_encryption_test_case_256_4(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_4); + return test_authenticated_encryption(&gcm_test_case_256_4); } static int test_AES_GCM_auth_encryption_test_case_256_5(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_5); + return test_authenticated_encryption(&gcm_test_case_256_5); } static int test_AES_GCM_auth_encryption_test_case_256_6(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_6); + return test_authenticated_encryption(&gcm_test_case_256_6); } static int test_AES_GCM_auth_encryption_test_case_256_7(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_256_7); + return test_authenticated_encryption(&gcm_test_case_256_7); } static int test_AES_GCM_auth_encryption_test_case_aad_1(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_aad_1); + return test_authenticated_encryption(&gcm_test_case_aad_1); } static int test_AES_GCM_auth_encryption_test_case_aad_2(void) { - return test_AES_GCM_authenticated_encryption(&gcm_test_case_aad_2); + return test_authenticated_encryption(&gcm_test_case_aad_2); } static int -test_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata) +test_authenticated_decryption(const struct aead_test_data *tdata) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -5262,8 +5265,9 @@ test_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata) uint8_t *plaintext; uint32_t i; - /* Create GCM session */ - retval = create_gcm_session(ts_params->valid_devs[0], + /* Create AEAD session */ + retval = create_aead_session(ts_params->valid_devs[0], + tdata->algo, RTE_CRYPTO_AEAD_OP_DECRYPT, tdata->key.data, tdata->key.len, tdata->aad.len, tdata->auth_tag.len, @@ -5275,7 +5279,7 @@ test_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata) if (tdata->aad.len > MBUF_SIZE) { ut_params->ibuf = rte_pktmbuf_alloc(ts_params->large_mbuf_pool); /* Populate full size of add data */ - for (i = 32; i < GCM_MAX_AAD_LENGTH; i += 32) + for (i = 32; i < MAX_AAD_LENGTH; i += 32) memcpy(&tdata->aad.data[i], &tdata->aad.data[0], 32); } else ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool); @@ -5283,8 +5287,8 @@ test_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata) memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, rte_pktmbuf_tailroom(ut_params->ibuf)); - /* Create GCM operation */ - retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata); + /* Create AEAD operation */ + retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata); if (retval < 0) return retval; @@ -5314,154 +5318,154 @@ test_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata) plaintext, tdata->plaintext.data, tdata->plaintext.len, - "GCM plaintext data not as expected"); + "Plaintext data not as expected"); TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "GCM authentication failed"); + "Authentication failed"); return 0; } static int test_AES_GCM_authenticated_decryption_test_case_1(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_1); + return test_authenticated_decryption(&gcm_test_case_1); } static int test_AES_GCM_authenticated_decryption_test_case_2(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_2); + return test_authenticated_decryption(&gcm_test_case_2); } static int test_AES_GCM_authenticated_decryption_test_case_3(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_3); + return test_authenticated_decryption(&gcm_test_case_3); } static int test_AES_GCM_authenticated_decryption_test_case_4(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_4); + return test_authenticated_decryption(&gcm_test_case_4); } static int test_AES_GCM_authenticated_decryption_test_case_5(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_5); + return test_authenticated_decryption(&gcm_test_case_5); } static int test_AES_GCM_authenticated_decryption_test_case_6(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_6); + return test_authenticated_decryption(&gcm_test_case_6); } static int test_AES_GCM_authenticated_decryption_test_case_7(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_7); + return test_authenticated_decryption(&gcm_test_case_7); } static int test_AES_GCM_auth_decryption_test_case_192_1(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_1); + return test_authenticated_decryption(&gcm_test_case_192_1); } static int test_AES_GCM_auth_decryption_test_case_192_2(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_2); + return test_authenticated_decryption(&gcm_test_case_192_2); } static int test_AES_GCM_auth_decryption_test_case_192_3(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_3); + return test_authenticated_decryption(&gcm_test_case_192_3); } static int test_AES_GCM_auth_decryption_test_case_192_4(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_4); + return test_authenticated_decryption(&gcm_test_case_192_4); } static int test_AES_GCM_auth_decryption_test_case_192_5(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_5); + return test_authenticated_decryption(&gcm_test_case_192_5); } static int test_AES_GCM_auth_decryption_test_case_192_6(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_6); + return test_authenticated_decryption(&gcm_test_case_192_6); } static int test_AES_GCM_auth_decryption_test_case_192_7(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_192_7); + return test_authenticated_decryption(&gcm_test_case_192_7); } static int test_AES_GCM_auth_decryption_test_case_256_1(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_1); + return test_authenticated_decryption(&gcm_test_case_256_1); } static int test_AES_GCM_auth_decryption_test_case_256_2(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_2); + return test_authenticated_decryption(&gcm_test_case_256_2); } static int test_AES_GCM_auth_decryption_test_case_256_3(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_3); + return test_authenticated_decryption(&gcm_test_case_256_3); } static int test_AES_GCM_auth_decryption_test_case_256_4(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_4); + return test_authenticated_decryption(&gcm_test_case_256_4); } static int test_AES_GCM_auth_decryption_test_case_256_5(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_5); + return test_authenticated_decryption(&gcm_test_case_256_5); } static int test_AES_GCM_auth_decryption_test_case_256_6(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_6); + return test_authenticated_decryption(&gcm_test_case_256_6); } static int test_AES_GCM_auth_decryption_test_case_256_7(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_256_7); + return test_authenticated_decryption(&gcm_test_case_256_7); } static int test_AES_GCM_auth_decryption_test_case_aad_1(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_aad_1); + return test_authenticated_decryption(&gcm_test_case_aad_1); } static int test_AES_GCM_auth_decryption_test_case_aad_2(void) { - return test_AES_GCM_authenticated_decryption(&gcm_test_case_aad_2); + return test_authenticated_decryption(&gcm_test_case_aad_2); } static int -test_AES_GCM_authenticated_encryption_oop(const struct gcm_test_data *tdata) +test_authenticated_encryption_oop(const struct aead_test_data *tdata) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -5470,8 +5474,9 @@ test_AES_GCM_authenticated_encryption_oop(const struct gcm_test_data *tdata) uint8_t *ciphertext, *auth_tag; uint16_t plaintext_pad_len; - /* Create GCM session */ - retval = create_gcm_session(ts_params->valid_devs[0], + /* Create AEAD session */ + retval = create_aead_session(ts_params->valid_devs[0], + tdata->algo, RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata->key.data, tdata->key.len, tdata->aad.len, tdata->auth_tag.len, @@ -5488,8 +5493,8 @@ test_AES_GCM_authenticated_encryption_oop(const struct gcm_test_data *tdata) memset(rte_pktmbuf_mtod(ut_params->obuf, uint8_t *), 0, rte_pktmbuf_tailroom(ut_params->obuf)); - /* Create GCM operation */ - retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata); + /* Create AEAD operation */ + retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata); if (retval < 0) return retval; @@ -5519,13 +5524,13 @@ test_AES_GCM_authenticated_encryption_oop(const struct gcm_test_data *tdata) ciphertext, tdata->ciphertext.data, tdata->ciphertext.len, - "GCM Ciphertext data not as expected"); + "Ciphertext data not as expected"); TEST_ASSERT_BUFFERS_ARE_EQUAL( auth_tag, tdata->auth_tag.data, tdata->auth_tag.len, - "GCM Generated auth tag not as expected"); + "Generated auth tag not as expected"); return 0; @@ -5534,11 +5539,11 @@ test_AES_GCM_authenticated_encryption_oop(const struct gcm_test_data *tdata) static int test_AES_GCM_authenticated_encryption_oop_test_case_1(void) { - return test_AES_GCM_authenticated_encryption_oop(&gcm_test_case_5); + return test_authenticated_encryption_oop(&gcm_test_case_5); } static int -test_AES_GCM_authenticated_decryption_oop(const struct gcm_test_data *tdata) +test_authenticated_decryption_oop(const struct aead_test_data *tdata) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -5546,8 +5551,9 @@ test_AES_GCM_authenticated_decryption_oop(const struct gcm_test_data *tdata) int retval; uint8_t *plaintext; - /* Create GCM session */ - retval = create_gcm_session(ts_params->valid_devs[0], + /* Create AEAD session */ + retval = create_aead_session(ts_params->valid_devs[0], + tdata->algo, RTE_CRYPTO_AEAD_OP_DECRYPT, tdata->key.data, tdata->key.len, tdata->aad.len, tdata->auth_tag.len, @@ -5564,8 +5570,8 @@ test_AES_GCM_authenticated_decryption_oop(const struct gcm_test_data *tdata) memset(rte_pktmbuf_mtod(ut_params->obuf, uint8_t *), 0, rte_pktmbuf_tailroom(ut_params->obuf)); - /* Create GCM operation */ - retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata); + /* Create AEAD operation */ + retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata); if (retval < 0) return retval; @@ -5591,23 +5597,23 @@ test_AES_GCM_authenticated_decryption_oop(const struct gcm_test_data *tdata) plaintext, tdata->plaintext.data, tdata->plaintext.len, - "GCM plaintext data not as expected"); + "Plaintext data not as expected"); TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "GCM authentication failed"); + "Authentication failed"); return 0; } static int test_AES_GCM_authenticated_decryption_oop_test_case_1(void) { - return test_AES_GCM_authenticated_decryption_oop(&gcm_test_case_5); + return test_authenticated_decryption_oop(&gcm_test_case_5); } static int -test_AES_GCM_authenticated_encryption_sessionless( - const struct gcm_test_data *tdata) +test_authenticated_encryption_sessionless( + const struct aead_test_data *tdata) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -5623,14 +5629,15 @@ test_AES_GCM_authenticated_encryption_sessionless( memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, rte_pktmbuf_tailroom(ut_params->ibuf)); - /* Create GCM operation */ - retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata); + /* Create AEAD operation */ + retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata); if (retval < 0) return retval; - /* Create GCM xforms */ + /* Create GCM xform */ memcpy(key, tdata->key.data, tdata->key.len); - retval = create_gcm_xforms(ut_params->op, + retval = create_aead_xform(ut_params->op, + tdata->algo, RTE_CRYPTO_AEAD_OP_ENCRYPT, key, tdata->key.len, tdata->aad.len, tdata->auth_tag.len, @@ -5667,13 +5674,13 @@ test_AES_GCM_authenticated_encryption_sessionless( ciphertext, tdata->ciphertext.data, tdata->ciphertext.len, - "GCM Ciphertext data not as expected"); + "Ciphertext data not as expected"); TEST_ASSERT_BUFFERS_ARE_EQUAL( auth_tag, tdata->auth_tag.data, tdata->auth_tag.len, - "GCM Generated auth tag not as expected"); + "Generated auth tag not as expected"); return 0; @@ -5682,13 +5689,13 @@ test_AES_GCM_authenticated_encryption_sessionless( static int test_AES_GCM_authenticated_encryption_sessionless_test_case_1(void) { - return test_AES_GCM_authenticated_encryption_sessionless( + return test_authenticated_encryption_sessionless( &gcm_test_case_5); } static int -test_AES_GCM_authenticated_decryption_sessionless( - const struct gcm_test_data *tdata) +test_authenticated_decryption_sessionless( + const struct aead_test_data *tdata) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -5703,14 +5710,15 @@ test_AES_GCM_authenticated_decryption_sessionless( memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, rte_pktmbuf_tailroom(ut_params->ibuf)); - /* Create GCM operation */ - retval = create_gcm_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata); + /* Create AEAD operation */ + retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata); if (retval < 0) return retval; - /* Create GCM xforms */ + /* Create AEAD xform */ memcpy(key, tdata->key.data, tdata->key.len); - retval = create_gcm_xforms(ut_params->op, + retval = create_aead_xform(ut_params->op, + tdata->algo, RTE_CRYPTO_AEAD_OP_DECRYPT, key, tdata->key.len, tdata->aad.len, tdata->auth_tag.len, @@ -5743,18 +5751,18 @@ test_AES_GCM_authenticated_decryption_sessionless( plaintext, tdata->plaintext.data, tdata->plaintext.len, - "GCM plaintext data not as expected"); + "Plaintext data not as expected"); TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, - "GCM authentication failed"); + "Authentication failed"); return 0; } static int test_AES_GCM_authenticated_decryption_sessionless_test_case_1(void) { - return test_AES_GCM_authenticated_decryption_sessionless( + return test_authenticated_decryption_sessionless( &gcm_test_case_5); } @@ -7463,8 +7471,8 @@ test_authenticated_decryption_fail_when_corruption( } static int -create_gcm_operation_SGL(enum rte_crypto_aead_operation op, - const struct gcm_test_data *tdata, +create_aead_operation_SGL(enum rte_crypto_aead_operation op, + const struct aead_test_data *tdata, void *digest_mem, uint64_t digest_phys) { struct crypto_testsuite_params *ts_params = &testsuite_params; @@ -7525,7 +7533,7 @@ create_gcm_operation_SGL(enum rte_crypto_aead_operation op, #define SGL_MAX_NO 16 static int -test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata, +test_authenticated_encryption_SGL(const struct aead_test_data *tdata, const int oop, uint32_t fragsz, uint32_t fragsz_oop) { struct crypto_testsuite_params *ts_params = &testsuite_params; @@ -7570,8 +7578,9 @@ test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata, buf_oop = ut_params->obuf; } - /* Create GCM session */ - retval = create_gcm_session(ts_params->valid_devs[0], + /* Create AEAD session */ + retval = create_aead_session(ts_params->valid_devs[0], + tdata->algo, RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata->key.data, tdata->key.len, tdata->aad.len, tdata->auth_tag.len, @@ -7700,8 +7709,8 @@ test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata, tdata->plaintext.len); } - /* Create GCM opertaion */ - retval = create_gcm_operation_SGL(RTE_CRYPTO_AEAD_OP_ENCRYPT, + /* Create AEAD operation */ + retval = create_aead_operation_SGL(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata, digest_mem, digest_phys); if (retval < 0) @@ -7735,7 +7744,7 @@ test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata, ciphertext, tdata->ciphertext.data, fragsz, - "GCM Ciphertext data not as expected"); + "Ciphertext data not as expected"); buf = ut_params->op->sym->m_src->next; if (oop) @@ -7752,7 +7761,7 @@ test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata, ciphertext, tdata->ciphertext.data + off, to_trn_tbl[ecx], - "GCM Ciphertext data not as expected"); + "Ciphertext data not as expected"); off += to_trn_tbl[ecx++]; buf = buf->next; @@ -7763,7 +7772,7 @@ test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata, auth_tag, tdata->auth_tag.data, tdata->auth_tag.len, - "GCM Generated auth tag not as expected"); + "Generated auth tag not as expected"); return 0; } @@ -7774,21 +7783,21 @@ test_AES_GCM_authenticated_encryption_SGL(const struct gcm_test_data *tdata, static int test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_400B(void) { - return test_AES_GCM_authenticated_encryption_SGL( + return test_authenticated_encryption_SGL( &gcm_test_case_SGL_1, OUT_OF_PLACE, 400, 400); } static int test_AES_GCM_auth_encrypt_SGL_out_of_place_1500B_2000B(void) { - return test_AES_GCM_authenticated_encryption_SGL( + return test_authenticated_encryption_SGL( &gcm_test_case_SGL_1, OUT_OF_PLACE, 1500, 2000); } static int test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_1seg(void) { - return test_AES_GCM_authenticated_encryption_SGL( + return test_authenticated_encryption_SGL( &gcm_test_case_8, OUT_OF_PLACE, 400, gcm_test_case_8.plaintext.len); } @@ -7797,7 +7806,7 @@ static int test_AES_GCM_auth_encrypt_SGL_in_place_1500B(void) { - return test_AES_GCM_authenticated_encryption_SGL( + return test_authenticated_encryption_SGL( &gcm_test_case_SGL_1, IN_PLACE, 1500, 0); }