1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2015-2017 Intel Corporation
7 #include <rte_common.h>
8 #include <rte_hexdump.h>
10 #include <rte_malloc.h>
11 #include <rte_memcpy.h>
12 #include <rte_pause.h>
13 #include <rte_bus_vdev.h>
15 #include <rte_crypto.h>
16 #include <rte_cryptodev.h>
17 #include <rte_cryptodev_pmd.h>
19 #ifdef RTE_LIBRTE_PMD_CRYPTO_SCHEDULER
20 #include <rte_cryptodev_scheduler.h>
21 #include <rte_cryptodev_scheduler_operations.h>
24 #include <rte_lcore.h>
27 #include "test_cryptodev.h"
29 #include "test_cryptodev_blockcipher.h"
30 #include "test_cryptodev_aes_test_vectors.h"
31 #include "test_cryptodev_des_test_vectors.h"
32 #include "test_cryptodev_hash_test_vectors.h"
33 #include "test_cryptodev_kasumi_test_vectors.h"
34 #include "test_cryptodev_kasumi_hash_test_vectors.h"
35 #include "test_cryptodev_snow3g_test_vectors.h"
36 #include "test_cryptodev_snow3g_hash_test_vectors.h"
37 #include "test_cryptodev_zuc_test_vectors.h"
38 #include "test_cryptodev_aead_test_vectors.h"
39 #include "test_cryptodev_hmac_test_vectors.h"
41 #define VDEV_ARGS_SIZE 100
42 #define MAX_NB_SESSIONS 4
44 static int gbl_driver_id;
46 struct crypto_testsuite_params {
47 struct rte_mempool *mbuf_pool;
48 struct rte_mempool *large_mbuf_pool;
49 struct rte_mempool *op_mpool;
50 struct rte_mempool *session_mpool;
51 struct rte_cryptodev_config conf;
52 struct rte_cryptodev_qp_conf qp_conf;
54 uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
55 uint8_t valid_dev_count;
58 struct crypto_unittest_params {
59 struct rte_crypto_sym_xform cipher_xform;
60 struct rte_crypto_sym_xform auth_xform;
61 struct rte_crypto_sym_xform aead_xform;
63 struct rte_cryptodev_sym_session *sess;
65 struct rte_crypto_op *op;
67 struct rte_mbuf *obuf, *ibuf;
72 #define ALIGN_POW2_ROUNDUP(num, align) \
73 (((num) + (align) - 1) & ~((align) - 1))
76 * Forward declarations.
79 test_AES_CBC_HMAC_SHA512_decrypt_create_session_params(
80 struct crypto_unittest_params *ut_params, uint8_t *cipher_key,
84 test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session *sess,
85 struct crypto_unittest_params *ut_params,
86 struct crypto_testsuite_params *ts_param,
87 const uint8_t *cipher,
88 const uint8_t *digest,
91 static struct rte_mbuf *
92 setup_test_string(struct rte_mempool *mpool,
93 const char *string, size_t len, uint8_t blocksize)
95 struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
96 size_t t_len = len - (blocksize ? (len % blocksize) : 0);
98 memset(m->buf_addr, 0, m->buf_len);
100 char *dst = rte_pktmbuf_append(m, t_len);
107 rte_memcpy(dst, string, t_len);
109 memset(dst, 0, t_len);
115 /* Get number of bytes in X bits (rounding up) */
117 ceil_byte_length(uint32_t num_bits)
120 return ((num_bits >> 3) + 1);
122 return (num_bits >> 3);
125 static struct rte_crypto_op *
126 process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op)
128 if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
129 printf("Error sending packet for encryption");
135 while (rte_cryptodev_dequeue_burst(dev_id, 0, &op, 1) == 0)
141 static struct crypto_testsuite_params testsuite_params = { NULL };
142 static struct crypto_unittest_params unittest_params;
145 testsuite_setup(void)
147 struct crypto_testsuite_params *ts_params = &testsuite_params;
148 struct rte_cryptodev_info info;
149 uint32_t i = 0, nb_devs, dev_id;
153 memset(ts_params, 0, sizeof(*ts_params));
155 ts_params->mbuf_pool = rte_mempool_lookup("CRYPTO_MBUFPOOL");
156 if (ts_params->mbuf_pool == NULL) {
157 /* Not already created so create */
158 ts_params->mbuf_pool = rte_pktmbuf_pool_create(
160 NUM_MBUFS, MBUF_CACHE_SIZE, 0, MBUF_SIZE,
162 if (ts_params->mbuf_pool == NULL) {
163 RTE_LOG(ERR, USER1, "Can't create CRYPTO_MBUFPOOL\n");
168 ts_params->large_mbuf_pool = rte_mempool_lookup(
169 "CRYPTO_LARGE_MBUFPOOL");
170 if (ts_params->large_mbuf_pool == NULL) {
171 /* Not already created so create */
172 ts_params->large_mbuf_pool = rte_pktmbuf_pool_create(
173 "CRYPTO_LARGE_MBUFPOOL",
176 if (ts_params->large_mbuf_pool == NULL) {
178 "Can't create CRYPTO_LARGE_MBUFPOOL\n");
183 ts_params->op_mpool = rte_crypto_op_pool_create(
184 "MBUF_CRYPTO_SYM_OP_POOL",
185 RTE_CRYPTO_OP_TYPE_SYMMETRIC,
186 NUM_MBUFS, MBUF_CACHE_SIZE,
188 sizeof(struct rte_crypto_sym_xform) +
191 if (ts_params->op_mpool == NULL) {
192 RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n");
196 /* Create an AESNI MB device if required */
197 if (gbl_driver_id == rte_cryptodev_driver_id_get(
198 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))) {
199 nb_devs = rte_cryptodev_device_count_by_driver(
200 rte_cryptodev_driver_id_get(
201 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)));
204 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL);
206 TEST_ASSERT(ret == 0,
207 "Failed to create instance of"
209 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
213 /* Create an AESNI GCM device if required */
214 if (gbl_driver_id == rte_cryptodev_driver_id_get(
215 RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD))) {
216 nb_devs = rte_cryptodev_device_count_by_driver(
217 rte_cryptodev_driver_id_get(
218 RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD)));
220 TEST_ASSERT_SUCCESS(rte_vdev_init(
221 RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), NULL),
222 "Failed to create instance of"
224 RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
228 /* Create a SNOW 3G device if required */
229 if (gbl_driver_id == rte_cryptodev_driver_id_get(
230 RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD))) {
231 nb_devs = rte_cryptodev_device_count_by_driver(
232 rte_cryptodev_driver_id_get(
233 RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD)));
235 TEST_ASSERT_SUCCESS(rte_vdev_init(
236 RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), NULL),
237 "Failed to create instance of"
239 RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
243 /* Create a KASUMI device if required */
244 if (gbl_driver_id == rte_cryptodev_driver_id_get(
245 RTE_STR(CRYPTODEV_NAME_KASUMI_PMD))) {
246 nb_devs = rte_cryptodev_device_count_by_driver(
247 rte_cryptodev_driver_id_get(
248 RTE_STR(CRYPTODEV_NAME_KASUMI_PMD)));
250 TEST_ASSERT_SUCCESS(rte_vdev_init(
251 RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), NULL),
252 "Failed to create instance of"
254 RTE_STR(CRYPTODEV_NAME_KASUMI_PMD));
258 /* Create a ZUC device if required */
259 if (gbl_driver_id == rte_cryptodev_driver_id_get(
260 RTE_STR(CRYPTODEV_NAME_ZUC_PMD))) {
261 nb_devs = rte_cryptodev_device_count_by_driver(
262 rte_cryptodev_driver_id_get(
263 RTE_STR(CRYPTODEV_NAME_ZUC_PMD)));
265 TEST_ASSERT_SUCCESS(rte_vdev_init(
266 RTE_STR(CRYPTODEV_NAME_ZUC_PMD), NULL),
267 "Failed to create instance of"
269 RTE_STR(CRYPTODEV_NAME_ZUC_PMD));
273 /* Create a NULL device if required */
274 if (gbl_driver_id == rte_cryptodev_driver_id_get(
275 RTE_STR(CRYPTODEV_NAME_NULL_PMD))) {
276 nb_devs = rte_cryptodev_device_count_by_driver(
277 rte_cryptodev_driver_id_get(
278 RTE_STR(CRYPTODEV_NAME_NULL_PMD)));
281 RTE_STR(CRYPTODEV_NAME_NULL_PMD), NULL);
283 TEST_ASSERT(ret == 0,
284 "Failed to create instance of"
286 RTE_STR(CRYPTODEV_NAME_NULL_PMD));
290 /* Create an OPENSSL device if required */
291 if (gbl_driver_id == rte_cryptodev_driver_id_get(
292 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD))) {
293 nb_devs = rte_cryptodev_device_count_by_driver(
294 rte_cryptodev_driver_id_get(
295 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)));
298 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD),
301 TEST_ASSERT(ret == 0, "Failed to create "
302 "instance of pmd : %s",
303 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
307 /* Create a ARMv8 device if required */
308 if (gbl_driver_id == rte_cryptodev_driver_id_get(
309 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD))) {
310 nb_devs = rte_cryptodev_device_count_by_driver(
311 rte_cryptodev_driver_id_get(
312 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)));
315 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD),
318 TEST_ASSERT(ret == 0, "Failed to create "
319 "instance of pmd : %s",
320 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
324 /* Create a MVSAM device if required */
325 if (gbl_driver_id == rte_cryptodev_driver_id_get(
326 RTE_STR(CRYPTODEV_NAME_MVSAM_PMD))) {
327 nb_devs = rte_cryptodev_device_count_by_driver(
328 rte_cryptodev_driver_id_get(
329 RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)));
332 RTE_STR(CRYPTODEV_NAME_MVSAM_PMD),
335 TEST_ASSERT(ret == 0, "Failed to create "
336 "instance of pmd : %s",
337 RTE_STR(CRYPTODEV_NAME_MVSAM_PMD));
341 /* Create an CCP device if required */
342 if (gbl_driver_id == rte_cryptodev_driver_id_get(
343 RTE_STR(CRYPTODEV_NAME_CCP_PMD))) {
344 nb_devs = rte_cryptodev_device_count_by_driver(
345 rte_cryptodev_driver_id_get(
346 RTE_STR(CRYPTODEV_NAME_CCP_PMD)));
349 RTE_STR(CRYPTODEV_NAME_CCP_PMD),
352 TEST_ASSERT(ret == 0, "Failed to create "
353 "instance of pmd : %s",
354 RTE_STR(CRYPTODEV_NAME_CCP_PMD));
358 #ifdef RTE_LIBRTE_PMD_CRYPTO_SCHEDULER
359 char vdev_args[VDEV_ARGS_SIZE] = {""};
360 char temp_str[VDEV_ARGS_SIZE] = {"mode=multi-core,"
361 "ordering=enable,name=cryptodev_test_scheduler,corelist="};
362 uint16_t slave_core_count = 0;
363 uint16_t socket_id = 0;
365 if (gbl_driver_id == rte_cryptodev_driver_id_get(
366 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD))) {
368 /* Identify the Slave Cores
369 * Use 2 slave cores for the device args
371 RTE_LCORE_FOREACH_SLAVE(i) {
372 if (slave_core_count > 1)
374 snprintf(vdev_args, sizeof(vdev_args),
375 "%s%d", temp_str, i);
376 strcpy(temp_str, vdev_args);
377 strcat(temp_str, ";");
379 socket_id = lcore_config[i].socket_id;
381 if (slave_core_count != 2) {
383 "Cryptodev scheduler test require at least "
384 "two slave cores to run. "
385 "Please use the correct coremask.\n");
388 strcpy(temp_str, vdev_args);
389 snprintf(vdev_args, sizeof(vdev_args), "%s,socket_id=%d",
390 temp_str, socket_id);
391 RTE_LOG(DEBUG, USER1, "vdev_args: %s\n", vdev_args);
392 nb_devs = rte_cryptodev_device_count_by_driver(
393 rte_cryptodev_driver_id_get(
394 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)));
397 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD),
399 TEST_ASSERT(ret == 0,
400 "Failed to create instance %u of"
402 i, RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
405 #endif /* RTE_LIBRTE_PMD_CRYPTO_SCHEDULER */
407 nb_devs = rte_cryptodev_count();
409 RTE_LOG(ERR, USER1, "No crypto devices found?\n");
413 /* Create list of valid crypto devs */
414 for (i = 0; i < nb_devs; i++) {
415 rte_cryptodev_info_get(i, &info);
416 if (info.driver_id == gbl_driver_id)
417 ts_params->valid_devs[ts_params->valid_dev_count++] = i;
420 if (ts_params->valid_dev_count < 1)
423 /* Set up all the qps on the first of the valid devices found */
425 dev_id = ts_params->valid_devs[0];
427 rte_cryptodev_info_get(dev_id, &info);
429 ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs;
430 ts_params->conf.socket_id = SOCKET_ID_ANY;
432 unsigned int session_size =
433 rte_cryptodev_sym_get_private_session_size(dev_id);
436 * Create mempool with maximum number of sessions * 2,
437 * to include the session headers
439 if (info.sym.max_nb_sessions != 0 &&
440 info.sym.max_nb_sessions < MAX_NB_SESSIONS) {
441 RTE_LOG(ERR, USER1, "Device does not support "
442 "at least %u sessions\n",
447 ts_params->session_mpool = rte_mempool_create(
451 0, 0, NULL, NULL, NULL,
455 TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
456 "session mempool allocation failed");
458 TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
460 "Failed to configure cryptodev %u with %u qps",
461 dev_id, ts_params->conf.nb_queue_pairs);
463 ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
465 for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
466 TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
467 dev_id, qp_id, &ts_params->qp_conf,
468 rte_cryptodev_socket_id(dev_id),
469 ts_params->session_mpool),
470 "Failed to setup queue pair %u on cryptodev %u",
478 testsuite_teardown(void)
480 struct crypto_testsuite_params *ts_params = &testsuite_params;
482 if (ts_params->mbuf_pool != NULL) {
483 RTE_LOG(DEBUG, USER1, "CRYPTO_MBUFPOOL count %u\n",
484 rte_mempool_avail_count(ts_params->mbuf_pool));
487 if (ts_params->op_mpool != NULL) {
488 RTE_LOG(DEBUG, USER1, "CRYPTO_OP_POOL count %u\n",
489 rte_mempool_avail_count(ts_params->op_mpool));
492 /* Free session mempools */
493 if (ts_params->session_mpool != NULL) {
494 rte_mempool_free(ts_params->session_mpool);
495 ts_params->session_mpool = NULL;
502 struct crypto_testsuite_params *ts_params = &testsuite_params;
503 struct crypto_unittest_params *ut_params = &unittest_params;
507 /* Clear unit test parameters before running test */
508 memset(ut_params, 0, sizeof(*ut_params));
510 /* Reconfigure device to default parameters */
511 ts_params->conf.socket_id = SOCKET_ID_ANY;
513 TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
515 "Failed to configure cryptodev %u",
516 ts_params->valid_devs[0]);
518 for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) {
519 TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
520 ts_params->valid_devs[0], qp_id,
522 rte_cryptodev_socket_id(ts_params->valid_devs[0]),
523 ts_params->session_mpool),
524 "Failed to setup queue pair %u on cryptodev %u",
525 qp_id, ts_params->valid_devs[0]);
529 rte_cryptodev_stats_reset(ts_params->valid_devs[0]);
531 /* Start the device */
532 TEST_ASSERT_SUCCESS(rte_cryptodev_start(ts_params->valid_devs[0]),
533 "Failed to start cryptodev %u",
534 ts_params->valid_devs[0]);
542 struct crypto_testsuite_params *ts_params = &testsuite_params;
543 struct crypto_unittest_params *ut_params = &unittest_params;
544 struct rte_cryptodev_stats stats;
546 /* free crypto session structure */
547 if (ut_params->sess) {
548 rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
550 rte_cryptodev_sym_session_free(ut_params->sess);
551 ut_params->sess = NULL;
554 /* free crypto operation structure */
556 rte_crypto_op_free(ut_params->op);
559 * free mbuf - both obuf and ibuf are usually the same,
560 * so check if they point at the same address is necessary,
561 * to avoid freeing the mbuf twice.
563 if (ut_params->obuf) {
564 rte_pktmbuf_free(ut_params->obuf);
565 if (ut_params->ibuf == ut_params->obuf)
569 if (ut_params->ibuf) {
570 rte_pktmbuf_free(ut_params->ibuf);
574 if (ts_params->mbuf_pool != NULL)
575 RTE_LOG(DEBUG, USER1, "CRYPTO_MBUFPOOL count %u\n",
576 rte_mempool_avail_count(ts_params->mbuf_pool));
578 rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats);
580 /* Stop the device */
581 rte_cryptodev_stop(ts_params->valid_devs[0]);
585 test_device_configure_invalid_dev_id(void)
587 struct crypto_testsuite_params *ts_params = &testsuite_params;
588 uint16_t dev_id, num_devs = 0;
590 TEST_ASSERT((num_devs = rte_cryptodev_count()) >= 1,
591 "Need at least %d devices for test", 1);
593 /* valid dev_id values */
594 dev_id = ts_params->valid_devs[ts_params->valid_dev_count - 1];
596 /* Stop the device in case it's started so it can be configured */
597 rte_cryptodev_stop(dev_id);
599 TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id, &ts_params->conf),
600 "Failed test for rte_cryptodev_configure: "
601 "invalid dev_num %u", dev_id);
603 /* invalid dev_id values */
606 TEST_ASSERT_FAIL(rte_cryptodev_configure(dev_id, &ts_params->conf),
607 "Failed test for rte_cryptodev_configure: "
608 "invalid dev_num %u", dev_id);
612 TEST_ASSERT_FAIL(rte_cryptodev_configure(dev_id, &ts_params->conf),
613 "Failed test for rte_cryptodev_configure:"
614 "invalid dev_num %u", dev_id);
620 test_device_configure_invalid_queue_pair_ids(void)
622 struct crypto_testsuite_params *ts_params = &testsuite_params;
623 uint16_t orig_nb_qps = ts_params->conf.nb_queue_pairs;
625 /* Stop the device in case it's started so it can be configured */
626 rte_cryptodev_stop(ts_params->valid_devs[0]);
628 /* valid - one queue pairs */
629 ts_params->conf.nb_queue_pairs = 1;
631 TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
633 "Failed to configure cryptodev: dev_id %u, qp_id %u",
634 ts_params->valid_devs[0], ts_params->conf.nb_queue_pairs);
637 /* valid - max value queue pairs */
638 ts_params->conf.nb_queue_pairs = orig_nb_qps;
640 TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
642 "Failed to configure cryptodev: dev_id %u, qp_id %u",
643 ts_params->valid_devs[0],
644 ts_params->conf.nb_queue_pairs);
647 /* invalid - zero queue pairs */
648 ts_params->conf.nb_queue_pairs = 0;
650 TEST_ASSERT_FAIL(rte_cryptodev_configure(ts_params->valid_devs[0],
652 "Failed test for rte_cryptodev_configure, dev_id %u,"
654 ts_params->valid_devs[0],
655 ts_params->conf.nb_queue_pairs);
658 /* invalid - max value supported by field queue pairs */
659 ts_params->conf.nb_queue_pairs = UINT16_MAX;
661 TEST_ASSERT_FAIL(rte_cryptodev_configure(ts_params->valid_devs[0],
663 "Failed test for rte_cryptodev_configure, dev_id %u,"
665 ts_params->valid_devs[0],
666 ts_params->conf.nb_queue_pairs);
669 /* invalid - max value + 1 queue pairs */
670 ts_params->conf.nb_queue_pairs = orig_nb_qps + 1;
672 TEST_ASSERT_FAIL(rte_cryptodev_configure(ts_params->valid_devs[0],
674 "Failed test for rte_cryptodev_configure, dev_id %u,"
676 ts_params->valid_devs[0],
677 ts_params->conf.nb_queue_pairs);
679 /* revert to original testsuite value */
680 ts_params->conf.nb_queue_pairs = orig_nb_qps;
686 test_queue_pair_descriptor_setup(void)
688 struct crypto_testsuite_params *ts_params = &testsuite_params;
689 struct rte_cryptodev_info dev_info;
690 struct rte_cryptodev_qp_conf qp_conf = {
691 .nb_descriptors = MAX_NUM_OPS_INFLIGHT
696 /* Stop the device in case it's started so it can be configured */
697 rte_cryptodev_stop(ts_params->valid_devs[0]);
700 rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
702 TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
704 "Failed to configure cryptodev %u",
705 ts_params->valid_devs[0]);
708 * Test various ring sizes on this device. memzones can't be
709 * freed so are re-used if ring is released and re-created.
711 qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/
713 for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
714 TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
715 ts_params->valid_devs[0], qp_id, &qp_conf,
716 rte_cryptodev_socket_id(
717 ts_params->valid_devs[0]),
718 ts_params->session_mpool),
720 "rte_cryptodev_queue_pair_setup: num_inflights "
721 "%u on qp %u on cryptodev %u",
722 qp_conf.nb_descriptors, qp_id,
723 ts_params->valid_devs[0]);
726 qp_conf.nb_descriptors = (uint32_t)(MAX_NUM_OPS_INFLIGHT / 2);
728 for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
729 TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
730 ts_params->valid_devs[0], qp_id, &qp_conf,
731 rte_cryptodev_socket_id(
732 ts_params->valid_devs[0]),
733 ts_params->session_mpool),
735 " rte_cryptodev_queue_pair_setup: num_inflights"
736 " %u on qp %u on cryptodev %u",
737 qp_conf.nb_descriptors, qp_id,
738 ts_params->valid_devs[0]);
741 qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT; /* valid */
743 for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
744 TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
745 ts_params->valid_devs[0], qp_id, &qp_conf,
746 rte_cryptodev_socket_id(
747 ts_params->valid_devs[0]),
748 ts_params->session_mpool),
750 "rte_cryptodev_queue_pair_setup: num_inflights"
751 " %u on qp %u on cryptodev %u",
752 qp_conf.nb_descriptors, qp_id,
753 ts_params->valid_devs[0]);
756 /* invalid number of descriptors - max supported + 2 */
757 qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT + 2;
759 for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
760 TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
761 ts_params->valid_devs[0], qp_id, &qp_conf,
762 rte_cryptodev_socket_id(
763 ts_params->valid_devs[0]),
764 ts_params->session_mpool),
765 "Unexpectedly passed test for "
766 "rte_cryptodev_queue_pair_setup:"
767 "num_inflights %u on qp %u on cryptodev %u",
768 qp_conf.nb_descriptors, qp_id,
769 ts_params->valid_devs[0]);
772 /* invalid number of descriptors - max value of parameter */
773 qp_conf.nb_descriptors = UINT32_MAX-1;
775 for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
776 TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
777 ts_params->valid_devs[0], qp_id, &qp_conf,
778 rte_cryptodev_socket_id(
779 ts_params->valid_devs[0]),
780 ts_params->session_mpool),
781 "Unexpectedly passed test for "
782 "rte_cryptodev_queue_pair_setup:"
783 "num_inflights %u on qp %u on cryptodev %u",
784 qp_conf.nb_descriptors, qp_id,
785 ts_params->valid_devs[0]);
788 qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
790 for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
791 TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
792 ts_params->valid_devs[0], qp_id, &qp_conf,
793 rte_cryptodev_socket_id(
794 ts_params->valid_devs[0]),
795 ts_params->session_mpool),
797 " rte_cryptodev_queue_pair_setup:"
798 "num_inflights %u on qp %u on cryptodev %u",
799 qp_conf.nb_descriptors, qp_id,
800 ts_params->valid_devs[0]);
803 /* invalid number of descriptors - max supported + 1 */
804 qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT + 1;
806 for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
807 TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
808 ts_params->valid_devs[0], qp_id, &qp_conf,
809 rte_cryptodev_socket_id(
810 ts_params->valid_devs[0]),
811 ts_params->session_mpool),
812 "Unexpectedly passed test for "
813 "rte_cryptodev_queue_pair_setup:"
814 "num_inflights %u on qp %u on cryptodev %u",
815 qp_conf.nb_descriptors, qp_id,
816 ts_params->valid_devs[0]);
819 /* test invalid queue pair id */
820 qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT; /*valid */
822 qp_id = ts_params->conf.nb_queue_pairs; /*invalid */
824 TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
825 ts_params->valid_devs[0],
827 rte_cryptodev_socket_id(ts_params->valid_devs[0]),
828 ts_params->session_mpool),
829 "Failed test for rte_cryptodev_queue_pair_setup:"
830 "invalid qp %u on cryptodev %u",
831 qp_id, ts_params->valid_devs[0]);
833 qp_id = 0xffff; /*invalid*/
835 TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
836 ts_params->valid_devs[0],
838 rte_cryptodev_socket_id(ts_params->valid_devs[0]),
839 ts_params->session_mpool),
840 "Failed test for rte_cryptodev_queue_pair_setup:"
841 "invalid qp %u on cryptodev %u",
842 qp_id, ts_params->valid_devs[0]);
847 /* ***** Plaintext data for tests ***** */
849 const char catch_22_quote_1[] =
850 "There was only one catch and that was Catch-22, which "
851 "specified that a concern for one's safety in the face of "
852 "dangers that were real and immediate was the process of a "
853 "rational mind. Orr was crazy and could be grounded. All he "
854 "had to do was ask; and as soon as he did, he would no longer "
855 "be crazy and would have to fly more missions. Orr would be "
856 "crazy to fly more missions and sane if he didn't, but if he "
857 "was sane he had to fly them. If he flew them he was crazy "
858 "and didn't have to; but if he didn't want to he was sane and "
859 "had to. Yossarian was moved very deeply by the absolute "
860 "simplicity of this clause of Catch-22 and let out a "
861 "respectful whistle. \"That's some catch, that Catch-22\", he "
862 "observed. \"It's the best there is,\" Doc Daneeka agreed.";
864 const char catch_22_quote[] =
865 "What a lousy earth! He wondered how many people were "
866 "destitute that same night even in his own prosperous country, "
867 "how many homes were shanties, how many husbands were drunk "
868 "and wives socked, and how many children were bullied, abused, "
869 "or abandoned. How many families hungered for food they could "
870 "not afford to buy? How many hearts were broken? How many "
871 "suicides would take place that same night, how many people "
872 "would go insane? How many cockroaches and landlords would "
873 "triumph? How many winners were losers, successes failures, "
874 "and rich men poor men? How many wise guys were stupid? How "
875 "many happy endings were unhappy endings? How many honest men "
876 "were liars, brave men cowards, loyal men traitors, how many "
877 "sainted men were corrupt, how many people in positions of "
878 "trust had sold their souls to bodyguards, how many had never "
879 "had souls? How many straight-and-narrow paths were crooked "
880 "paths? How many best families were worst families and how "
881 "many good people were bad people? When you added them all up "
882 "and then subtracted, you might be left with only the children, "
883 "and perhaps with Albert Einstein and an old violinist or "
884 "sculptor somewhere.";
886 #define QUOTE_480_BYTES (480)
887 #define QUOTE_512_BYTES (512)
888 #define QUOTE_768_BYTES (768)
889 #define QUOTE_1024_BYTES (1024)
893 /* ***** SHA1 Hash Tests ***** */
895 #define HMAC_KEY_LENGTH_SHA1 (DIGEST_BYTE_LENGTH_SHA1)
897 static uint8_t hmac_sha1_key[] = {
898 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
899 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
900 0xDE, 0xF4, 0xDE, 0xAD };
902 /* ***** SHA224 Hash Tests ***** */
904 #define HMAC_KEY_LENGTH_SHA224 (DIGEST_BYTE_LENGTH_SHA224)
907 /* ***** AES-CBC Cipher Tests ***** */
909 #define CIPHER_KEY_LENGTH_AES_CBC (16)
910 #define CIPHER_IV_LENGTH_AES_CBC (CIPHER_KEY_LENGTH_AES_CBC)
912 static uint8_t aes_cbc_key[] = {
913 0xE4, 0x23, 0x33, 0x8A, 0x35, 0x64, 0x61, 0xE2,
914 0x49, 0x03, 0xDD, 0xC6, 0xB8, 0xCA, 0x55, 0x7A };
916 static uint8_t aes_cbc_iv[] = {
917 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
918 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
921 /* ***** AES-CBC / HMAC-SHA1 Hash Tests ***** */
923 static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_ciphertext[] = {
924 0x8B, 0x4D, 0xDA, 0x1B, 0xCF, 0x04, 0xA0, 0x31,
925 0xB4, 0xBF, 0xBD, 0x68, 0x43, 0x20, 0x7E, 0x76,
926 0xB1, 0x96, 0x8B, 0xA2, 0x7C, 0xA2, 0x83, 0x9E,
927 0x39, 0x5A, 0x2F, 0x7E, 0x92, 0xB4, 0x48, 0x1A,
928 0x3F, 0x6B, 0x5D, 0xDF, 0x52, 0x85, 0x5F, 0x8E,
929 0x42, 0x3C, 0xFB, 0xE9, 0x1A, 0x24, 0xD6, 0x08,
930 0xDD, 0xFD, 0x16, 0xFB, 0xE9, 0x55, 0xEF, 0xF0,
931 0xA0, 0x8D, 0x13, 0xAB, 0x81, 0xC6, 0x90, 0x01,
932 0xB5, 0x18, 0x84, 0xB3, 0xF6, 0xE6, 0x11, 0x57,
933 0xD6, 0x71, 0xC6, 0x3C, 0x3F, 0x2F, 0x33, 0xEE,
934 0x24, 0x42, 0x6E, 0xAC, 0x0B, 0xCA, 0xEC, 0xF9,
935 0x84, 0xF8, 0x22, 0xAA, 0x60, 0xF0, 0x32, 0xA9,
936 0x75, 0x75, 0x3B, 0xCB, 0x70, 0x21, 0x0A, 0x8D,
937 0x0F, 0xE0, 0xC4, 0x78, 0x2B, 0xF8, 0x97, 0xE3,
938 0xE4, 0x26, 0x4B, 0x29, 0xDA, 0x88, 0xCD, 0x46,
939 0xEC, 0xAA, 0xF9, 0x7F, 0xF1, 0x15, 0xEA, 0xC3,
940 0x87, 0xE6, 0x31, 0xF2, 0xCF, 0xDE, 0x4D, 0x80,
941 0x70, 0x91, 0x7E, 0x0C, 0xF7, 0x26, 0x3A, 0x92,
942 0x4F, 0x18, 0x83, 0xC0, 0x8F, 0x59, 0x01, 0xA5,
943 0x88, 0xD1, 0xDB, 0x26, 0x71, 0x27, 0x16, 0xF5,
944 0xEE, 0x10, 0x82, 0xAC, 0x68, 0x26, 0x9B, 0xE2,
945 0x6D, 0xD8, 0x9A, 0x80, 0xDF, 0x04, 0x31, 0xD5,
946 0xF1, 0x35, 0x5C, 0x3B, 0xDD, 0x9A, 0x65, 0xBA,
947 0x58, 0x34, 0x85, 0x61, 0x1C, 0x42, 0x10, 0x76,
948 0x73, 0x02, 0x42, 0xC9, 0x23, 0x18, 0x8E, 0xB4,
949 0x6F, 0xB4, 0xA3, 0x54, 0x6E, 0x88, 0x3B, 0x62,
950 0x7C, 0x02, 0x8D, 0x4C, 0x9F, 0xC8, 0x45, 0xF4,
951 0xC9, 0xDE, 0x4F, 0xEB, 0x22, 0x83, 0x1B, 0xE4,
952 0x49, 0x37, 0xE4, 0xAD, 0xE7, 0xCD, 0x21, 0x54,
953 0xBC, 0x1C, 0xC2, 0x04, 0x97, 0xB4, 0x10, 0x61,
954 0xF0, 0xE4, 0xEF, 0x27, 0x63, 0x3A, 0xDA, 0x91,
955 0x41, 0x25, 0x62, 0x1C, 0x5C, 0xB6, 0x38, 0x4A,
956 0x88, 0x71, 0x59, 0x5A, 0x8D, 0xA0, 0x09, 0xAF,
957 0x72, 0x94, 0xD7, 0x79, 0x5C, 0x60, 0x7C, 0x8F,
958 0x4C, 0xF5, 0xD9, 0xA1, 0x39, 0x6D, 0x81, 0x28,
959 0xEF, 0x13, 0x28, 0xDF, 0xF5, 0x3E, 0xF7, 0x8E,
960 0x09, 0x9C, 0x78, 0x18, 0x79, 0xB8, 0x68, 0xD7,
961 0xA8, 0x29, 0x62, 0xAD, 0xDE, 0xE1, 0x61, 0x76,
962 0x1B, 0x05, 0x16, 0xCD, 0xBF, 0x02, 0x8E, 0xA6,
963 0x43, 0x6E, 0x92, 0x55, 0x4F, 0x60, 0x9C, 0x03,
964 0xB8, 0x4F, 0xA3, 0x02, 0xAC, 0xA8, 0xA7, 0x0C,
965 0x1E, 0xB5, 0x6B, 0xF8, 0xC8, 0x4D, 0xDE, 0xD2,
966 0xB0, 0x29, 0x6E, 0x40, 0xE6, 0xD6, 0xC9, 0xE6,
967 0xB9, 0x0F, 0xB6, 0x63, 0xF5, 0xAA, 0x2B, 0x96,
968 0xA7, 0x16, 0xAC, 0x4E, 0x0A, 0x33, 0x1C, 0xA6,
969 0xE6, 0xBD, 0x8A, 0xCF, 0x40, 0xA9, 0xB2, 0xFA,
970 0x63, 0x27, 0xFD, 0x9B, 0xD9, 0xFC, 0xD5, 0x87,
971 0x8D, 0x4C, 0xB6, 0xA4, 0xCB, 0xE7, 0x74, 0x55,
972 0xF4, 0xFB, 0x41, 0x25, 0xB5, 0x4B, 0x0A, 0x1B,
973 0xB1, 0xD6, 0xB7, 0xD9, 0x47, 0x2A, 0xC3, 0x98,
974 0x6A, 0xC4, 0x03, 0x73, 0x1F, 0x93, 0x6E, 0x53,
975 0x19, 0x25, 0x64, 0x15, 0x83, 0xF9, 0x73, 0x2A,
976 0x74, 0xB4, 0x93, 0x69, 0xC4, 0x72, 0xFC, 0x26,
977 0xA2, 0x9F, 0x43, 0x45, 0xDD, 0xB9, 0xEF, 0x36,
978 0xC8, 0x3A, 0xCD, 0x99, 0x9B, 0x54, 0x1A, 0x36,
979 0xC1, 0x59, 0xF8, 0x98, 0xA8, 0xCC, 0x28, 0x0D,
980 0x73, 0x4C, 0xEE, 0x98, 0xCB, 0x7C, 0x58, 0x7E,
981 0x20, 0x75, 0x1E, 0xB7, 0xC9, 0xF8, 0xF2, 0x0E,
982 0x63, 0x9E, 0x05, 0x78, 0x1A, 0xB6, 0xA8, 0x7A,
983 0xF9, 0x98, 0x6A, 0xA6, 0x46, 0x84, 0x2E, 0xF6,
984 0x4B, 0xDC, 0x9B, 0x8F, 0x9B, 0x8F, 0xEE, 0xB4,
985 0xAA, 0x3F, 0xEE, 0xC0, 0x37, 0x27, 0x76, 0xC7,
986 0x95, 0xBB, 0x26, 0x74, 0x69, 0x12, 0x7F, 0xF1,
987 0xBB, 0xFF, 0xAE, 0xB5, 0x99, 0x6E, 0xCB, 0x0C
990 static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest[] = {
991 0x9a, 0x4f, 0x88, 0x1b, 0xb6, 0x8f, 0xd8, 0x60,
992 0x42, 0x1a, 0x7d, 0x3d, 0xf5, 0x82, 0x80, 0xf1,
993 0x18, 0x8c, 0x1d, 0x32
997 /* Multisession Vector context Test */
999 static uint8_t ms_aes_cbc_key0[] = {
1000 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
1001 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
1004 static uint8_t ms_aes_cbc_iv0[] = {
1005 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
1006 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
1009 static const uint8_t ms_aes_cbc_cipher0[] = {
1010 0x3C, 0xE4, 0xEE, 0x42, 0xB6, 0x9B, 0xC3, 0x38,
1011 0x5F, 0xAD, 0x54, 0xDC, 0xA8, 0x32, 0x81, 0xDC,
1012 0x7A, 0x6F, 0x85, 0x58, 0x07, 0x35, 0xED, 0xEB,
1013 0xAD, 0x79, 0x79, 0x96, 0xD3, 0x0E, 0xA6, 0xD9,
1014 0xAA, 0x86, 0xA4, 0x8F, 0xB5, 0xD6, 0x6E, 0x6D,
1015 0x0C, 0x91, 0x2F, 0xC4, 0x67, 0x98, 0x0E, 0xC4,
1016 0x8D, 0x83, 0x68, 0x69, 0xC4, 0xD3, 0x94, 0x34,
1017 0xC4, 0x5D, 0x60, 0x55, 0x22, 0x87, 0x8F, 0x6F,
1018 0x17, 0x8E, 0x75, 0xE4, 0x02, 0xF5, 0x1B, 0x99,
1019 0xC8, 0x39, 0xA9, 0xAB, 0x23, 0x91, 0x12, 0xED,
1020 0x08, 0xE7, 0xD9, 0x25, 0x89, 0x24, 0x4F, 0x8D,
1021 0x68, 0xF3, 0x10, 0x39, 0x0A, 0xEE, 0x45, 0x24,
1022 0xDF, 0x7A, 0x9D, 0x00, 0x25, 0xE5, 0x35, 0x71,
1023 0x4E, 0x40, 0x59, 0x6F, 0x0A, 0x13, 0xB3, 0x72,
1024 0x1D, 0x98, 0x63, 0x94, 0x89, 0xA5, 0x39, 0x8E,
1025 0xD3, 0x9C, 0x8A, 0x7F, 0x71, 0x2F, 0xC7, 0xCD,
1026 0x81, 0x05, 0xDC, 0xC0, 0x8D, 0xCE, 0x6D, 0x18,
1027 0x30, 0xC4, 0x72, 0x51, 0xF0, 0x27, 0xC8, 0xF6,
1028 0x60, 0x5B, 0x7C, 0xB2, 0xE3, 0x49, 0x0C, 0x29,
1029 0xC6, 0x9F, 0x39, 0x57, 0x80, 0x55, 0x24, 0x2C,
1030 0x9B, 0x0F, 0x5A, 0xB3, 0x89, 0x55, 0x31, 0x96,
1031 0x0D, 0xCD, 0xF6, 0x51, 0x03, 0x2D, 0x89, 0x26,
1032 0x74, 0x44, 0xD6, 0xE8, 0xDC, 0xEA, 0x44, 0x55,
1033 0x64, 0x71, 0x9C, 0x9F, 0x5D, 0xBA, 0x39, 0x46,
1034 0xA8, 0x17, 0xA1, 0x9C, 0x52, 0x9D, 0xBC, 0x6B,
1035 0x4A, 0x98, 0xE6, 0xEA, 0x33, 0xEC, 0x58, 0xB4,
1036 0x43, 0xF0, 0x32, 0x45, 0xA4, 0xC1, 0x55, 0xB7,
1037 0x5D, 0xB5, 0x59, 0xB2, 0xE3, 0x96, 0xFF, 0xA5,
1038 0xAF, 0xE1, 0x86, 0x1B, 0x42, 0xE6, 0x3B, 0xA0,
1039 0x90, 0x4A, 0xE8, 0x8C, 0x21, 0x7F, 0x36, 0x1E,
1040 0x5B, 0x65, 0x25, 0xD1, 0xC1, 0x5A, 0xCA, 0x3D,
1041 0x10, 0xED, 0x2D, 0x79, 0xD0, 0x0F, 0x58, 0x44,
1042 0x69, 0x81, 0xF5, 0xD4, 0xC9, 0x0F, 0x90, 0x76,
1043 0x1F, 0x54, 0xD2, 0xD5, 0x97, 0xCE, 0x2C, 0xE3,
1044 0xEF, 0xF4, 0xB7, 0xC6, 0x3A, 0x87, 0x7F, 0x83,
1045 0x2A, 0xAF, 0xCD, 0x90, 0x12, 0xA7, 0x7D, 0x85,
1046 0x1D, 0x62, 0xD3, 0x85, 0x25, 0x05, 0xDB, 0x45,
1047 0x92, 0xA3, 0xF6, 0xA2, 0xA8, 0x41, 0xE4, 0x25,
1048 0x86, 0x87, 0x67, 0x24, 0xEC, 0x89, 0x23, 0x2A,
1049 0x9B, 0x20, 0x4D, 0x93, 0xEE, 0xE2, 0x2E, 0xC1,
1050 0x0B, 0x15, 0x33, 0xCF, 0x00, 0xD1, 0x1A, 0xDA,
1051 0x93, 0xFD, 0x28, 0x21, 0x5B, 0xCF, 0xD1, 0xF3,
1052 0x5A, 0x81, 0xBA, 0x82, 0x5E, 0x2F, 0x61, 0xB4,
1053 0x05, 0x71, 0xB5, 0xF4, 0x39, 0x3C, 0x1F, 0x60,
1054 0x00, 0x7A, 0xC4, 0xF8, 0x35, 0x20, 0x6C, 0x3A,
1055 0xCC, 0x03, 0x8F, 0x7B, 0xA2, 0xB6, 0x65, 0x8A,
1056 0xB6, 0x5F, 0xFD, 0x25, 0xD3, 0x5F, 0x92, 0xF9,
1057 0xAE, 0x17, 0x9B, 0x5E, 0x6E, 0x9A, 0xE4, 0x55,
1058 0x10, 0x25, 0x07, 0xA4, 0xAF, 0x21, 0x69, 0x13,
1059 0xD8, 0xFA, 0x31, 0xED, 0xF7, 0xA7, 0xA7, 0x3B,
1060 0xB8, 0x96, 0x8E, 0x10, 0x86, 0x74, 0xD8, 0xB1,
1061 0x34, 0x9E, 0x9B, 0x6A, 0x26, 0xA8, 0xD4, 0xD0,
1062 0xB5, 0xF6, 0xDE, 0xE7, 0xCA, 0x06, 0xDC, 0xA3,
1063 0x6F, 0xEE, 0x6B, 0x1E, 0xB5, 0x30, 0x99, 0x23,
1064 0xF9, 0x76, 0xF0, 0xA0, 0xCF, 0x3B, 0x94, 0x7B,
1065 0x19, 0x8D, 0xA5, 0x0C, 0x18, 0xA6, 0x1D, 0x07,
1066 0x89, 0xBE, 0x5B, 0x61, 0xE5, 0xF1, 0x42, 0xDB,
1067 0xD4, 0x2E, 0x02, 0x1F, 0xCE, 0xEF, 0x92, 0xB1,
1068 0x1B, 0x56, 0x50, 0xF2, 0x16, 0xE5, 0xE7, 0x4F,
1069 0xFD, 0xBB, 0x3E, 0xD2, 0xFC, 0x3C, 0xC6, 0x0F,
1070 0xF9, 0x12, 0x4E, 0xCB, 0x1E, 0x0C, 0x15, 0x84,
1071 0x2A, 0x14, 0x8A, 0x02, 0xE4, 0x7E, 0x95, 0x5B,
1072 0x86, 0xDB, 0x9B, 0x62, 0x5B, 0x19, 0xD2, 0x17,
1073 0xFA, 0x13, 0xBB, 0x6B, 0x3F, 0x45, 0x9F, 0xBF
1077 static uint8_t ms_hmac_key0[] = {
1078 0xFF, 0x1A, 0x7D, 0x3D, 0xF5, 0x82, 0x80, 0xF1,
1079 0xF1, 0x35, 0x5C, 0x3B, 0xDD, 0x9A, 0x65, 0xBA,
1080 0x58, 0x34, 0x85, 0x65, 0x1C, 0x42, 0x50, 0x76,
1081 0x9A, 0xAF, 0x88, 0x1B, 0xB6, 0x8F, 0xF8, 0x60,
1082 0xA2, 0x5A, 0x7F, 0x3F, 0xF4, 0x72, 0x70, 0xF1,
1083 0xF5, 0x35, 0x4C, 0x3B, 0xDD, 0x90, 0x65, 0xB0,
1084 0x47, 0x3A, 0x75, 0x61, 0x5C, 0xA2, 0x10, 0x76,
1085 0x9A, 0xAF, 0x77, 0x5B, 0xB6, 0x7F, 0xF7, 0x60
1088 static const uint8_t ms_hmac_digest0[] = {
1089 0x43, 0x52, 0xED, 0x34, 0xAB, 0x36, 0xB2, 0x51,
1090 0xFB, 0xA3, 0xA6, 0x7C, 0x38, 0xFC, 0x42, 0x8F,
1091 0x57, 0x64, 0xAB, 0x81, 0xA7, 0x89, 0xB7, 0x6C,
1092 0xA0, 0xDC, 0xB9, 0x4D, 0xC4, 0x30, 0xF9, 0xD4,
1093 0x10, 0x82, 0x55, 0xD0, 0xAB, 0x32, 0xFB, 0x56,
1094 0x0D, 0xE4, 0x68, 0x3D, 0x76, 0xD0, 0x7B, 0xE4,
1095 0xA6, 0x2C, 0x34, 0x9E, 0x8C, 0x41, 0xF8, 0x23,
1096 0x28, 0x1B, 0x3A, 0x90, 0x26, 0x34, 0x47, 0x90
1100 /* Begin session 1 */
1102 static uint8_t ms_aes_cbc_key1[] = {
1103 0xf1, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
1104 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
1107 static uint8_t ms_aes_cbc_iv1[] = {
1108 0xf1, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
1109 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
1112 static const uint8_t ms_aes_cbc_cipher1[] = {
1113 0x5A, 0x7A, 0x67, 0x5D, 0xB8, 0xE1, 0xDC, 0x71,
1114 0x39, 0xA8, 0x74, 0x93, 0x9C, 0x4C, 0xFE, 0x23,
1115 0x61, 0xCD, 0xA4, 0xB3, 0xD9, 0xCE, 0x99, 0x09,
1116 0x2A, 0x23, 0xF3, 0x29, 0xBF, 0x4C, 0xB4, 0x6A,
1117 0x1B, 0x6B, 0x73, 0x4D, 0x48, 0x0C, 0xCF, 0x6C,
1118 0x5E, 0x34, 0x9E, 0x7F, 0xBC, 0x8F, 0xCC, 0x8F,
1119 0x75, 0x1D, 0x3D, 0x77, 0x10, 0x76, 0xC8, 0xB9,
1120 0x99, 0x6F, 0xD6, 0x56, 0x75, 0xA9, 0xB2, 0x66,
1121 0xC2, 0x24, 0x2B, 0x9C, 0xFE, 0x40, 0x8E, 0x43,
1122 0x20, 0x97, 0x1B, 0xFA, 0xD0, 0xCF, 0x04, 0xAB,
1123 0xBB, 0xF6, 0x5D, 0xF5, 0xA0, 0x19, 0x7C, 0x23,
1124 0x5D, 0x80, 0x8C, 0x49, 0xF6, 0x76, 0x88, 0x29,
1125 0x27, 0x4C, 0x59, 0x2B, 0x43, 0xA6, 0xB2, 0x26,
1126 0x27, 0x78, 0xBE, 0x1B, 0xE1, 0x4F, 0x5A, 0x1F,
1127 0xFC, 0x68, 0x08, 0xE7, 0xC4, 0xD1, 0x34, 0x68,
1128 0xB7, 0x13, 0x14, 0x41, 0x62, 0x6B, 0x1F, 0x77,
1129 0x0C, 0x68, 0x1D, 0x0D, 0xED, 0x89, 0xAA, 0xD8,
1130 0x97, 0x02, 0xBA, 0x5E, 0xD4, 0x84, 0x25, 0x97,
1131 0x03, 0xA5, 0xA6, 0x13, 0x66, 0x02, 0xF4, 0xC3,
1132 0xF3, 0xD3, 0xCC, 0x95, 0xC3, 0x87, 0x46, 0x90,
1133 0x1F, 0x6E, 0x14, 0xA8, 0x00, 0xF2, 0x6F, 0xD5,
1134 0xA1, 0xAD, 0xD5, 0x40, 0xA2, 0x0F, 0x32, 0x7E,
1135 0x99, 0xA3, 0xF5, 0x53, 0xC3, 0x26, 0xA1, 0x45,
1136 0x01, 0x88, 0x57, 0x84, 0x3E, 0x7B, 0x4E, 0x0B,
1137 0x3C, 0xB5, 0x3E, 0x9E, 0xE9, 0x78, 0x77, 0xC5,
1138 0xC0, 0x89, 0xA8, 0xF8, 0xF1, 0xA5, 0x2D, 0x5D,
1139 0xF9, 0xC6, 0xFB, 0xCB, 0x05, 0x23, 0xBD, 0x6E,
1140 0x5E, 0x14, 0xC6, 0x57, 0x73, 0xCF, 0x98, 0xBD,
1141 0x10, 0x8B, 0x18, 0xA6, 0x01, 0x5B, 0x13, 0xAE,
1142 0x8E, 0xDE, 0x1F, 0xB5, 0xB7, 0x40, 0x6C, 0xC1,
1143 0x1E, 0xA1, 0x19, 0x20, 0x9E, 0x95, 0xE0, 0x2F,
1144 0x1C, 0xF5, 0xD9, 0xD0, 0x2B, 0x1E, 0x82, 0x25,
1145 0x62, 0xB4, 0xEB, 0xA1, 0x1F, 0xCE, 0x44, 0xA1,
1146 0xCB, 0x92, 0x01, 0x6B, 0xE4, 0x26, 0x23, 0xE3,
1147 0xC5, 0x67, 0x35, 0x55, 0xDA, 0xE5, 0x27, 0xEE,
1148 0x8D, 0x12, 0x84, 0xB7, 0xBA, 0xA7, 0x1C, 0xD6,
1149 0x32, 0x3F, 0x67, 0xED, 0xFB, 0x5B, 0x8B, 0x52,
1150 0x46, 0x8C, 0xF9, 0x69, 0xCD, 0xAE, 0x79, 0xAA,
1151 0x37, 0x78, 0x49, 0xEB, 0xC6, 0x8E, 0x76, 0x63,
1152 0x84, 0xFF, 0x9D, 0x22, 0x99, 0x51, 0xB7, 0x5E,
1153 0x83, 0x4C, 0x8B, 0xDF, 0x5A, 0x07, 0xCC, 0xBA,
1154 0x42, 0xA5, 0x98, 0xB6, 0x47, 0x0E, 0x66, 0xEB,
1155 0x23, 0x0E, 0xBA, 0x44, 0xA8, 0xAA, 0x20, 0x71,
1156 0x79, 0x9C, 0x77, 0x5F, 0xF5, 0xFE, 0xEC, 0xEF,
1157 0xC6, 0x64, 0x3D, 0x84, 0xD0, 0x2B, 0xA7, 0x0A,
1158 0xC3, 0x72, 0x5B, 0x9C, 0xFA, 0xA8, 0x87, 0x95,
1159 0x94, 0x11, 0x38, 0xA7, 0x1E, 0x58, 0xE3, 0x73,
1160 0xC6, 0xC9, 0xD1, 0x7B, 0x92, 0xDB, 0x0F, 0x49,
1161 0x74, 0xC2, 0xA2, 0x0E, 0x35, 0x57, 0xAC, 0xDB,
1162 0x9A, 0x1C, 0xCF, 0x5A, 0x32, 0x3E, 0x26, 0x9B,
1163 0xEC, 0xB3, 0xEF, 0x9C, 0xFE, 0xBE, 0x52, 0xAC,
1164 0xB1, 0x29, 0xDD, 0xFD, 0x07, 0xE2, 0xEE, 0xED,
1165 0xE4, 0x46, 0x37, 0xFE, 0xD1, 0xDC, 0xCD, 0x02,
1166 0xF9, 0x31, 0xB0, 0xFB, 0x36, 0xB7, 0x34, 0xA4,
1167 0x76, 0xE8, 0x57, 0xBF, 0x99, 0x92, 0xC7, 0xAF,
1168 0x98, 0x10, 0xE2, 0x70, 0xCA, 0xC9, 0x2B, 0x82,
1169 0x06, 0x96, 0x88, 0x0D, 0xB3, 0xAC, 0x9E, 0x6D,
1170 0x43, 0xBC, 0x5B, 0x31, 0xCF, 0x65, 0x8D, 0xA6,
1171 0xC7, 0xFE, 0x73, 0xE1, 0x54, 0xF7, 0x10, 0xF9,
1172 0x86, 0xF7, 0xDF, 0xA1, 0xA1, 0xD8, 0xAE, 0x35,
1173 0xB3, 0x90, 0xDC, 0x6F, 0x43, 0x7A, 0x8B, 0xE0,
1174 0xFE, 0x8F, 0x33, 0x4D, 0x29, 0x6C, 0x45, 0x53,
1175 0x73, 0xDD, 0x21, 0x0B, 0x85, 0x30, 0xB5, 0xA5,
1176 0xF3, 0x5D, 0xEC, 0x79, 0x61, 0x9D, 0x9E, 0xB3
1180 static uint8_t ms_hmac_key1[] = {
1181 0xFE, 0x1A, 0x7D, 0x3D, 0xF5, 0x82, 0x80, 0xF1,
1182 0xF1, 0x35, 0x5C, 0x3B, 0xDD, 0x9A, 0x65, 0xBA,
1183 0x58, 0x34, 0x85, 0x65, 0x1C, 0x42, 0x50, 0x76,
1184 0x9A, 0xAF, 0x88, 0x1B, 0xB6, 0x8F, 0xF8, 0x60,
1185 0xA2, 0x5A, 0x7F, 0x3F, 0xF4, 0x72, 0x70, 0xF1,
1186 0xF5, 0x35, 0x4C, 0x3B, 0xDD, 0x90, 0x65, 0xB0,
1187 0x47, 0x3A, 0x75, 0x61, 0x5C, 0xA2, 0x10, 0x76,
1188 0x9A, 0xAF, 0x77, 0x5B, 0xB6, 0x7F, 0xF7, 0x60
1191 static const uint8_t ms_hmac_digest1[] = {
1192 0xCE, 0x6E, 0x5F, 0x77, 0x96, 0x9A, 0xB1, 0x69,
1193 0x2D, 0x5E, 0xF3, 0x2F, 0x32, 0x10, 0xCB, 0x50,
1194 0x0E, 0x09, 0x56, 0x25, 0x07, 0x34, 0xC9, 0x20,
1195 0xEC, 0x13, 0x43, 0x23, 0x5C, 0x08, 0x8B, 0xCD,
1196 0xDC, 0x86, 0x8C, 0xEE, 0x0A, 0x95, 0x2E, 0xB9,
1197 0x8C, 0x7B, 0x02, 0x7A, 0xD4, 0xE1, 0x49, 0xB4,
1198 0x45, 0xB5, 0x52, 0x37, 0xC6, 0xFF, 0xFE, 0xAA,
1199 0x0A, 0x87, 0xB8, 0x51, 0xF9, 0x2A, 0x01, 0x8F
1202 /* Begin Session 2 */
1203 static uint8_t ms_aes_cbc_key2[] = {
1204 0xff, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
1205 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
1208 static uint8_t ms_aes_cbc_iv2[] = {
1209 0xff, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
1210 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
1213 static const uint8_t ms_aes_cbc_cipher2[] = {
1214 0xBB, 0x3C, 0x68, 0x25, 0xFD, 0xB6, 0xA2, 0x91,
1215 0x20, 0x56, 0xF6, 0x30, 0x35, 0xFC, 0x9E, 0x97,
1216 0xF2, 0x90, 0xFC, 0x7E, 0x3E, 0x0A, 0x75, 0xC8,
1217 0x4C, 0xF2, 0x2D, 0xAC, 0xD3, 0x93, 0xF0, 0xC5,
1218 0x14, 0x88, 0x8A, 0x23, 0xC2, 0x59, 0x9A, 0x98,
1219 0x4B, 0xD5, 0x2C, 0xDA, 0x43, 0xA9, 0x34, 0x69,
1220 0x7C, 0x6D, 0xDB, 0xDC, 0xCB, 0xC0, 0xA0, 0x09,
1221 0xA7, 0x86, 0x16, 0x4B, 0xBF, 0xA8, 0xB6, 0xCF,
1222 0x7F, 0x74, 0x1F, 0x22, 0xF0, 0xF6, 0xBB, 0x44,
1223 0x8B, 0x4C, 0x9E, 0x23, 0xF8, 0x9F, 0xFC, 0x5B,
1224 0x9E, 0x9C, 0x2A, 0x79, 0x30, 0x8F, 0xBF, 0xA9,
1225 0x68, 0xA1, 0x20, 0x71, 0x7C, 0x77, 0x22, 0x34,
1226 0x07, 0xCD, 0xC6, 0xF6, 0x50, 0x0A, 0x08, 0x99,
1227 0x17, 0x98, 0xE3, 0x93, 0x8A, 0xB0, 0xEE, 0xDF,
1228 0xC2, 0xBA, 0x3B, 0x44, 0x73, 0xDF, 0xDD, 0xDC,
1229 0x14, 0x4D, 0x3B, 0xBB, 0x5E, 0x58, 0xC1, 0x26,
1230 0xA7, 0xAE, 0x47, 0xF3, 0x24, 0x6D, 0x4F, 0xD3,
1231 0x6E, 0x3E, 0x33, 0xE6, 0x7F, 0xCA, 0x50, 0xAF,
1232 0x5D, 0x3D, 0xA0, 0xDD, 0xC9, 0xF3, 0x30, 0xD3,
1233 0x6E, 0x8B, 0x2E, 0x12, 0x24, 0x34, 0xF0, 0xD3,
1234 0xC7, 0x8D, 0x23, 0x29, 0xAA, 0x05, 0xE1, 0xFA,
1235 0x2E, 0xF6, 0x8D, 0x37, 0x86, 0xC0, 0x6D, 0x13,
1236 0x2D, 0x98, 0xF3, 0x52, 0x39, 0x22, 0xCE, 0x38,
1237 0xC2, 0x1A, 0x72, 0xED, 0xFB, 0xCC, 0xE4, 0x71,
1238 0x5A, 0x0C, 0x0D, 0x09, 0xF8, 0xE8, 0x1B, 0xBC,
1239 0x53, 0xC8, 0xD8, 0x8F, 0xE5, 0x98, 0x5A, 0xB1,
1240 0x06, 0xA6, 0x5B, 0xE6, 0xA2, 0x88, 0x21, 0x9E,
1241 0x36, 0xC0, 0x34, 0xF9, 0xFB, 0x3B, 0x0A, 0x22,
1242 0x00, 0x00, 0x39, 0x48, 0x8D, 0x23, 0x74, 0x62,
1243 0x72, 0x91, 0xE6, 0x36, 0xAA, 0x77, 0x9C, 0x72,
1244 0x9D, 0xA8, 0xC3, 0xA9, 0xD5, 0x44, 0x72, 0xA6,
1245 0xB9, 0x28, 0x8F, 0x64, 0x4C, 0x8A, 0x64, 0xE6,
1246 0x4E, 0xFA, 0xEF, 0x87, 0xDE, 0x7B, 0x22, 0x44,
1247 0xB0, 0xDF, 0x2E, 0x5F, 0x0B, 0xA5, 0xF2, 0x24,
1248 0x07, 0x5C, 0x2D, 0x39, 0xB7, 0x3D, 0x8A, 0xE5,
1249 0x0E, 0x9D, 0x4E, 0x50, 0xED, 0x03, 0x99, 0x8E,
1250 0xF0, 0x06, 0x55, 0x4E, 0xA2, 0x24, 0xE7, 0x17,
1251 0x46, 0xDF, 0x6C, 0xCD, 0xC6, 0x44, 0xE8, 0xF9,
1252 0xB9, 0x1B, 0x36, 0xF6, 0x7F, 0x10, 0xA4, 0x7D,
1253 0x90, 0xBD, 0xE4, 0xAA, 0xD6, 0x9E, 0x18, 0x9D,
1254 0x22, 0x35, 0xD6, 0x55, 0x54, 0xAA, 0xF7, 0x22,
1255 0xA3, 0x3E, 0xEF, 0xC8, 0xA2, 0x34, 0x8D, 0xA9,
1256 0x37, 0x63, 0xA6, 0xC3, 0x57, 0xCB, 0x0C, 0x49,
1257 0x7D, 0x02, 0xBE, 0xAA, 0x13, 0x75, 0xB7, 0x4E,
1258 0x52, 0x62, 0xA5, 0xC2, 0x33, 0xC7, 0x6C, 0x1B,
1259 0xF6, 0x34, 0xF6, 0x09, 0xA5, 0x0C, 0xC7, 0xA2,
1260 0x61, 0x48, 0x62, 0x7D, 0x17, 0x15, 0xE3, 0x95,
1261 0xC8, 0x63, 0xD2, 0xA4, 0x43, 0xA9, 0x49, 0x07,
1262 0xB2, 0x3B, 0x2B, 0x62, 0x7D, 0xCB, 0x51, 0xB3,
1263 0x25, 0x33, 0x47, 0x0E, 0x14, 0x67, 0xDC, 0x6A,
1264 0x9B, 0x51, 0xAC, 0x9D, 0x8F, 0xA2, 0x2B, 0x57,
1265 0x8C, 0x5C, 0x5F, 0x76, 0x23, 0x92, 0x0F, 0x84,
1266 0x46, 0x0E, 0x40, 0x85, 0x38, 0x60, 0xFA, 0x61,
1267 0x20, 0xC5, 0xE3, 0xF1, 0x70, 0xAC, 0x1B, 0xBF,
1268 0xC4, 0x2B, 0xC5, 0x67, 0xD1, 0x43, 0xC5, 0x17,
1269 0x74, 0x71, 0x69, 0x6F, 0x82, 0x89, 0x19, 0x8A,
1270 0x70, 0x43, 0x92, 0x01, 0xC4, 0x63, 0x7E, 0xB1,
1271 0x59, 0x4E, 0xCD, 0xEA, 0x93, 0xA4, 0x52, 0x53,
1272 0x9B, 0x61, 0x5B, 0xD2, 0x3E, 0x19, 0x39, 0xB7,
1273 0x32, 0xEA, 0x8E, 0xF8, 0x1D, 0x76, 0x5C, 0xB2,
1274 0x73, 0x2D, 0x91, 0xC0, 0x18, 0xED, 0x25, 0x2A,
1275 0x53, 0x64, 0xF0, 0x92, 0x31, 0x55, 0x21, 0xA8,
1276 0x24, 0xA9, 0xD1, 0x02, 0xF6, 0x6C, 0x2B, 0x70,
1277 0xA9, 0x59, 0xC1, 0xD6, 0xC3, 0x57, 0x5B, 0x92
1280 static uint8_t ms_hmac_key2[] = {
1281 0xFC, 0x1A, 0x7D, 0x3D, 0xF5, 0x82, 0x80, 0xF1,
1282 0xF1, 0x35, 0x5C, 0x3B, 0xDD, 0x9A, 0x65, 0xBA,
1283 0x58, 0x34, 0x85, 0x65, 0x1C, 0x42, 0x50, 0x76,
1284 0x9A, 0xAF, 0x88, 0x1B, 0xB6, 0x8F, 0xF8, 0x60,
1285 0xA2, 0x5A, 0x7F, 0x3F, 0xF4, 0x72, 0x70, 0xF1,
1286 0xF5, 0x35, 0x4C, 0x3B, 0xDD, 0x90, 0x65, 0xB0,
1287 0x47, 0x3A, 0x75, 0x61, 0x5C, 0xA2, 0x10, 0x76,
1288 0x9A, 0xAF, 0x77, 0x5B, 0xB6, 0x7F, 0xF7, 0x60
1291 static const uint8_t ms_hmac_digest2[] = {
1292 0xA5, 0x0F, 0x9C, 0xFB, 0x08, 0x62, 0x59, 0xFF,
1293 0x80, 0x2F, 0xEB, 0x4B, 0xE1, 0x46, 0x21, 0xD6,
1294 0x02, 0x98, 0xF2, 0x8E, 0xF4, 0xEC, 0xD4, 0x77,
1295 0x86, 0x4C, 0x31, 0x28, 0xC8, 0x25, 0x80, 0x27,
1296 0x3A, 0x72, 0x5D, 0x6A, 0x56, 0x8A, 0xD3, 0x82,
1297 0xB0, 0xEC, 0x31, 0x6D, 0x8B, 0x6B, 0xB4, 0x24,
1298 0xE7, 0x62, 0xC1, 0x52, 0xBC, 0x14, 0x1B, 0x8E,
1299 0xEC, 0x9A, 0xF1, 0x47, 0x80, 0xD2, 0xB0, 0x59
1306 test_AES_CBC_HMAC_SHA1_encrypt_digest(void)
1308 struct crypto_testsuite_params *ts_params = &testsuite_params;
1309 struct crypto_unittest_params *ut_params = &unittest_params;
1311 /* Generate test mbuf data and space for digest */
1312 ut_params->ibuf = setup_test_string(ts_params->mbuf_pool,
1313 catch_22_quote, QUOTE_512_BYTES, 0);
1315 ut_params->digest = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
1316 DIGEST_BYTE_LENGTH_SHA1);
1317 TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest");
1319 /* Setup Cipher Parameters */
1320 ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
1321 ut_params->cipher_xform.next = &ut_params->auth_xform;
1323 ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;
1324 ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
1325 ut_params->cipher_xform.cipher.key.data = aes_cbc_key;
1326 ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC;
1327 ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
1328 ut_params->cipher_xform.cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC;
1330 /* Setup HMAC Parameters */
1331 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
1333 ut_params->auth_xform.next = NULL;
1335 ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
1336 ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
1337 ut_params->auth_xform.auth.key.length = HMAC_KEY_LENGTH_SHA1;
1338 ut_params->auth_xform.auth.key.data = hmac_sha1_key;
1339 ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA1;
1341 ut_params->sess = rte_cryptodev_sym_session_create(
1342 ts_params->session_mpool);
1344 /* Create crypto session*/
1345 rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
1346 ut_params->sess, &ut_params->cipher_xform,
1347 ts_params->session_mpool);
1348 TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
1350 /* Generate crypto op data structure */
1351 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
1352 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
1353 TEST_ASSERT_NOT_NULL(ut_params->op,
1354 "Failed to allocate symmetric crypto operation struct");
1356 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
1358 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
1360 /* set crypto operation source mbuf */
1361 sym_op->m_src = ut_params->ibuf;
1363 /* Set crypto operation authentication parameters */
1364 sym_op->auth.digest.data = ut_params->digest;
1365 sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
1366 ut_params->ibuf, QUOTE_512_BYTES);
1368 sym_op->auth.data.offset = 0;
1369 sym_op->auth.data.length = QUOTE_512_BYTES;
1371 /* Copy IV at the end of the crypto operation */
1372 rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
1373 aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC);
1375 /* Set crypto operation cipher parameters */
1376 sym_op->cipher.data.offset = 0;
1377 sym_op->cipher.data.length = QUOTE_512_BYTES;
1379 /* Process crypto operation */
1380 TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0],
1381 ut_params->op), "failed to process sym crypto op");
1383 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
1384 "crypto op processing failed");
1387 uint8_t *ciphertext = rte_pktmbuf_mtod(ut_params->op->sym->m_src,
1390 TEST_ASSERT_BUFFERS_ARE_EQUAL(ciphertext,
1391 catch_22_quote_2_512_bytes_AES_CBC_ciphertext,
1393 "ciphertext data not as expected");
1395 uint8_t *digest = ciphertext + QUOTE_512_BYTES;
1397 TEST_ASSERT_BUFFERS_ARE_EQUAL(digest,
1398 catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest,
1399 gbl_driver_id == rte_cryptodev_driver_id_get(
1400 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)) ?
1401 TRUNCATED_DIGEST_BYTE_LENGTH_SHA1 :
1402 DIGEST_BYTE_LENGTH_SHA1,
1403 "Generated digest data not as expected");
1405 return TEST_SUCCESS;
1408 /* ***** AES-CBC / HMAC-SHA512 Hash Tests ***** */
1410 #define HMAC_KEY_LENGTH_SHA512 (DIGEST_BYTE_LENGTH_SHA512)
1412 static uint8_t hmac_sha512_key[] = {
1413 0x42, 0x1a, 0x7d, 0x3d, 0xf5, 0x82, 0x80, 0xf1,
1414 0xF1, 0x35, 0x5C, 0x3B, 0xDD, 0x9A, 0x65, 0xBA,
1415 0x58, 0x34, 0x85, 0x65, 0x1C, 0x42, 0x50, 0x76,
1416 0x9a, 0xaf, 0x88, 0x1b, 0xb6, 0x8f, 0xf8, 0x60,
1417 0xa2, 0x5a, 0x7f, 0x3f, 0xf4, 0x72, 0x70, 0xf1,
1418 0xF5, 0x35, 0x4C, 0x3B, 0xDD, 0x90, 0x65, 0xB0,
1419 0x47, 0x3a, 0x75, 0x61, 0x5C, 0xa2, 0x10, 0x76,
1420 0x9a, 0xaf, 0x77, 0x5b, 0xb6, 0x7f, 0xf7, 0x60 };
1422 static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA512_digest[] = {
1423 0x5D, 0x54, 0x66, 0xC1, 0x6E, 0xBC, 0x04, 0xB8,
1424 0x46, 0xB8, 0x08, 0x6E, 0xE0, 0xF0, 0x43, 0x48,
1425 0x37, 0x96, 0x9C, 0xC6, 0x9C, 0xC2, 0x1E, 0xE8,
1426 0xF2, 0x0C, 0x0B, 0xEF, 0x86, 0xA2, 0xE3, 0x70,
1427 0x95, 0xC8, 0xB3, 0x06, 0x47, 0xA9, 0x90, 0xE8,
1428 0xA0, 0xC6, 0x72, 0x69, 0x05, 0xC0, 0x0D, 0x0E,
1429 0x21, 0x96, 0x65, 0x93, 0x74, 0x43, 0x2A, 0x1D,
1430 0x2E, 0xBF, 0xC2, 0xC2, 0xEE, 0xCC, 0x2F, 0x0A };
1435 test_AES_CBC_HMAC_SHA512_decrypt_create_session_params(
1436 struct crypto_unittest_params *ut_params,
1437 uint8_t *cipher_key,
1441 test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session *sess,
1442 struct crypto_unittest_params *ut_params,
1443 struct crypto_testsuite_params *ts_params,
1444 const uint8_t *cipher,
1445 const uint8_t *digest,
1450 test_AES_CBC_HMAC_SHA512_decrypt_create_session_params(
1451 struct crypto_unittest_params *ut_params,
1452 uint8_t *cipher_key,
1456 /* Setup Cipher Parameters */
1457 ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
1458 ut_params->cipher_xform.next = NULL;
1460 ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;
1461 ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;
1462 ut_params->cipher_xform.cipher.key.data = cipher_key;
1463 ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC;
1464 ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
1465 ut_params->cipher_xform.cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC;
1467 /* Setup HMAC Parameters */
1468 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
1469 ut_params->auth_xform.next = &ut_params->cipher_xform;
1471 ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
1472 ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA512_HMAC;
1473 ut_params->auth_xform.auth.key.data = hmac_key;
1474 ut_params->auth_xform.auth.key.length = HMAC_KEY_LENGTH_SHA512;
1475 ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA512;
1477 return TEST_SUCCESS;
1482 test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session *sess,
1483 struct crypto_unittest_params *ut_params,
1484 struct crypto_testsuite_params *ts_params,
1485 const uint8_t *cipher,
1486 const uint8_t *digest,
1489 /* Generate test mbuf data and digest */
1490 ut_params->ibuf = setup_test_string(ts_params->mbuf_pool,
1493 QUOTE_512_BYTES, 0);
1495 ut_params->digest = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
1496 DIGEST_BYTE_LENGTH_SHA512);
1497 TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest");
1499 rte_memcpy(ut_params->digest,
1501 DIGEST_BYTE_LENGTH_SHA512);
1503 /* Generate Crypto op data structure */
1504 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
1505 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
1506 TEST_ASSERT_NOT_NULL(ut_params->op,
1507 "Failed to allocate symmetric crypto operation struct");
1509 rte_crypto_op_attach_sym_session(ut_params->op, sess);
1511 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
1513 /* set crypto operation source mbuf */
1514 sym_op->m_src = ut_params->ibuf;
1516 sym_op->auth.digest.data = ut_params->digest;
1517 sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
1518 ut_params->ibuf, QUOTE_512_BYTES);
1520 sym_op->auth.data.offset = 0;
1521 sym_op->auth.data.length = QUOTE_512_BYTES;
1523 /* Copy IV at the end of the crypto operation */
1524 rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
1525 iv, CIPHER_IV_LENGTH_AES_CBC);
1527 sym_op->cipher.data.offset = 0;
1528 sym_op->cipher.data.length = QUOTE_512_BYTES;
1530 /* Process crypto operation */
1531 TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0],
1532 ut_params->op), "failed to process sym crypto op");
1534 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
1535 "crypto op processing failed");
1537 ut_params->obuf = ut_params->op->sym->m_src;
1540 TEST_ASSERT_BUFFERS_ARE_EQUAL(
1541 rte_pktmbuf_mtod(ut_params->obuf, uint8_t *),
1544 "Plaintext data not as expected");
1547 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
1548 "Digest verification failed");
1550 return TEST_SUCCESS;
1554 test_AES_cipheronly_mb_all(void)
1556 struct crypto_testsuite_params *ts_params = &testsuite_params;
1559 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1560 ts_params->op_mpool,
1561 ts_params->session_mpool,
1562 ts_params->valid_devs[0],
1563 rte_cryptodev_driver_id_get(
1564 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
1565 BLKCIPHER_AES_CIPHERONLY_TYPE);
1567 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1569 return TEST_SUCCESS;
1573 test_AES_docsis_mb_all(void)
1575 struct crypto_testsuite_params *ts_params = &testsuite_params;
1578 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1579 ts_params->op_mpool,
1580 ts_params->session_mpool,
1581 ts_params->valid_devs[0],
1582 rte_cryptodev_driver_id_get(
1583 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
1584 BLKCIPHER_AES_DOCSIS_TYPE);
1586 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1588 return TEST_SUCCESS;
1592 test_AES_docsis_qat_all(void)
1594 struct crypto_testsuite_params *ts_params = &testsuite_params;
1597 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1598 ts_params->op_mpool,
1599 ts_params->session_mpool,
1600 ts_params->valid_devs[0],
1601 rte_cryptodev_driver_id_get(
1602 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
1603 BLKCIPHER_AES_DOCSIS_TYPE);
1605 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1607 return TEST_SUCCESS;
1611 test_DES_docsis_qat_all(void)
1613 struct crypto_testsuite_params *ts_params = &testsuite_params;
1616 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1617 ts_params->op_mpool,
1618 ts_params->session_mpool,
1619 ts_params->valid_devs[0],
1620 rte_cryptodev_driver_id_get(
1621 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
1622 BLKCIPHER_DES_DOCSIS_TYPE);
1624 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1626 return TEST_SUCCESS;
1630 test_authonly_mb_all(void)
1632 struct crypto_testsuite_params *ts_params = &testsuite_params;
1635 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1636 ts_params->op_mpool,
1637 ts_params->session_mpool,
1638 ts_params->valid_devs[0],
1639 rte_cryptodev_driver_id_get(
1640 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
1641 BLKCIPHER_AUTHONLY_TYPE);
1643 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1645 return TEST_SUCCESS;
1649 test_authonly_qat_all(void)
1651 struct crypto_testsuite_params *ts_params = &testsuite_params;
1654 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1655 ts_params->op_mpool,
1656 ts_params->session_mpool,
1657 ts_params->valid_devs[0],
1658 rte_cryptodev_driver_id_get(
1659 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
1660 BLKCIPHER_AUTHONLY_TYPE);
1662 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1664 return TEST_SUCCESS;
1667 test_AES_chain_mb_all(void)
1669 struct crypto_testsuite_params *ts_params = &testsuite_params;
1672 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1673 ts_params->op_mpool,
1674 ts_params->session_mpool,
1675 ts_params->valid_devs[0],
1676 rte_cryptodev_driver_id_get(
1677 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
1678 BLKCIPHER_AES_CHAIN_TYPE);
1680 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1682 return TEST_SUCCESS;
1685 #ifdef RTE_LIBRTE_PMD_CRYPTO_SCHEDULER
1688 test_AES_cipheronly_scheduler_all(void)
1690 struct crypto_testsuite_params *ts_params = &testsuite_params;
1693 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1694 ts_params->op_mpool,
1695 ts_params->session_mpool,
1696 ts_params->valid_devs[0],
1697 rte_cryptodev_driver_id_get(
1698 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
1699 BLKCIPHER_AES_CIPHERONLY_TYPE);
1701 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1703 return TEST_SUCCESS;
1707 test_AES_chain_scheduler_all(void)
1709 struct crypto_testsuite_params *ts_params = &testsuite_params;
1712 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1713 ts_params->op_mpool,
1714 ts_params->session_mpool,
1715 ts_params->valid_devs[0],
1716 rte_cryptodev_driver_id_get(
1717 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
1718 BLKCIPHER_AES_CHAIN_TYPE);
1720 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1722 return TEST_SUCCESS;
1726 test_authonly_scheduler_all(void)
1728 struct crypto_testsuite_params *ts_params = &testsuite_params;
1731 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1732 ts_params->op_mpool,
1733 ts_params->session_mpool,
1734 ts_params->valid_devs[0],
1735 rte_cryptodev_driver_id_get(
1736 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD)),
1737 BLKCIPHER_AUTHONLY_TYPE);
1739 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1741 return TEST_SUCCESS;
1744 #endif /* RTE_LIBRTE_PMD_CRYPTO_SCHEDULER */
1747 test_AES_chain_openssl_all(void)
1749 struct crypto_testsuite_params *ts_params = &testsuite_params;
1752 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1753 ts_params->op_mpool,
1754 ts_params->session_mpool,
1755 ts_params->valid_devs[0],
1756 rte_cryptodev_driver_id_get(
1757 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
1758 BLKCIPHER_AES_CHAIN_TYPE);
1760 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1762 return TEST_SUCCESS;
1766 test_AES_cipheronly_openssl_all(void)
1768 struct crypto_testsuite_params *ts_params = &testsuite_params;
1771 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1772 ts_params->op_mpool,
1773 ts_params->session_mpool,
1774 ts_params->valid_devs[0],
1775 rte_cryptodev_driver_id_get(
1776 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
1777 BLKCIPHER_AES_CIPHERONLY_TYPE);
1779 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1781 return TEST_SUCCESS;
1785 test_AES_chain_ccp_all(void)
1787 struct crypto_testsuite_params *ts_params = &testsuite_params;
1790 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1791 ts_params->op_mpool,
1792 ts_params->session_mpool,
1793 ts_params->valid_devs[0],
1794 rte_cryptodev_driver_id_get(
1795 RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
1796 BLKCIPHER_AES_CHAIN_TYPE);
1798 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1800 return TEST_SUCCESS;
1804 test_AES_cipheronly_ccp_all(void)
1806 struct crypto_testsuite_params *ts_params = &testsuite_params;
1809 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1810 ts_params->op_mpool,
1811 ts_params->session_mpool,
1812 ts_params->valid_devs[0],
1813 rte_cryptodev_driver_id_get(
1814 RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
1815 BLKCIPHER_AES_CIPHERONLY_TYPE);
1817 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1819 return TEST_SUCCESS;
1823 test_AES_chain_qat_all(void)
1825 struct crypto_testsuite_params *ts_params = &testsuite_params;
1828 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1829 ts_params->op_mpool,
1830 ts_params->session_mpool,
1831 ts_params->valid_devs[0],
1832 rte_cryptodev_driver_id_get(
1833 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
1834 BLKCIPHER_AES_CHAIN_TYPE);
1836 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1838 return TEST_SUCCESS;
1842 test_AES_cipheronly_qat_all(void)
1844 struct crypto_testsuite_params *ts_params = &testsuite_params;
1847 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1848 ts_params->op_mpool,
1849 ts_params->session_mpool,
1850 ts_params->valid_devs[0],
1851 rte_cryptodev_driver_id_get(
1852 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
1853 BLKCIPHER_AES_CIPHERONLY_TYPE);
1855 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1857 return TEST_SUCCESS;
1861 test_AES_cipheronly_virtio_all(void)
1863 struct crypto_testsuite_params *ts_params = &testsuite_params;
1866 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1867 ts_params->op_mpool,
1868 ts_params->session_mpool,
1869 ts_params->valid_devs[0],
1870 rte_cryptodev_driver_id_get(
1871 RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD)),
1872 BLKCIPHER_AES_CIPHERONLY_TYPE);
1874 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1876 return TEST_SUCCESS;
1880 test_AES_chain_dpaa_sec_all(void)
1882 struct crypto_testsuite_params *ts_params = &testsuite_params;
1885 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1886 ts_params->op_mpool,
1887 ts_params->session_mpool,
1888 ts_params->valid_devs[0],
1889 rte_cryptodev_driver_id_get(
1890 RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
1891 BLKCIPHER_AES_CHAIN_TYPE);
1893 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1895 return TEST_SUCCESS;
1899 test_AES_cipheronly_dpaa_sec_all(void)
1901 struct crypto_testsuite_params *ts_params = &testsuite_params;
1904 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1905 ts_params->op_mpool,
1906 ts_params->session_mpool,
1907 ts_params->valid_devs[0],
1908 rte_cryptodev_driver_id_get(
1909 RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
1910 BLKCIPHER_AES_CIPHERONLY_TYPE);
1912 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1914 return TEST_SUCCESS;
1918 test_authonly_dpaa_sec_all(void)
1920 struct crypto_testsuite_params *ts_params = &testsuite_params;
1923 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1924 ts_params->op_mpool,
1925 ts_params->session_mpool,
1926 ts_params->valid_devs[0],
1927 rte_cryptodev_driver_id_get(
1928 RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
1929 BLKCIPHER_AUTHONLY_TYPE);
1931 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1933 return TEST_SUCCESS;
1937 test_AES_chain_dpaa2_sec_all(void)
1939 struct crypto_testsuite_params *ts_params = &testsuite_params;
1942 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1943 ts_params->op_mpool,
1944 ts_params->session_mpool,
1945 ts_params->valid_devs[0],
1946 rte_cryptodev_driver_id_get(
1947 RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
1948 BLKCIPHER_AES_CHAIN_TYPE);
1950 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1952 return TEST_SUCCESS;
1956 test_AES_cipheronly_dpaa2_sec_all(void)
1958 struct crypto_testsuite_params *ts_params = &testsuite_params;
1961 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1962 ts_params->op_mpool,
1963 ts_params->session_mpool,
1964 ts_params->valid_devs[0],
1965 rte_cryptodev_driver_id_get(
1966 RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
1967 BLKCIPHER_AES_CIPHERONLY_TYPE);
1969 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1971 return TEST_SUCCESS;
1975 test_authonly_dpaa2_sec_all(void)
1977 struct crypto_testsuite_params *ts_params = &testsuite_params;
1980 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
1981 ts_params->op_mpool,
1982 ts_params->session_mpool,
1983 ts_params->valid_devs[0],
1984 rte_cryptodev_driver_id_get(
1985 RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
1986 BLKCIPHER_AUTHONLY_TYPE);
1988 TEST_ASSERT_EQUAL(status, 0, "Test failed");
1990 return TEST_SUCCESS;
1994 test_authonly_openssl_all(void)
1996 struct crypto_testsuite_params *ts_params = &testsuite_params;
1999 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
2000 ts_params->op_mpool,
2001 ts_params->session_mpool,
2002 ts_params->valid_devs[0],
2003 rte_cryptodev_driver_id_get(
2004 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
2005 BLKCIPHER_AUTHONLY_TYPE);
2007 TEST_ASSERT_EQUAL(status, 0, "Test failed");
2009 return TEST_SUCCESS;
2013 test_authonly_ccp_all(void)
2015 struct crypto_testsuite_params *ts_params = &testsuite_params;
2018 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
2019 ts_params->op_mpool,
2020 ts_params->session_mpool,
2021 ts_params->valid_devs[0],
2022 rte_cryptodev_driver_id_get(
2023 RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
2024 BLKCIPHER_AUTHONLY_TYPE);
2026 TEST_ASSERT_EQUAL(status, 0, "Test failed");
2028 return TEST_SUCCESS;
2032 test_AES_chain_armv8_all(void)
2034 struct crypto_testsuite_params *ts_params = &testsuite_params;
2037 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
2038 ts_params->op_mpool,
2039 ts_params->session_mpool,
2040 ts_params->valid_devs[0],
2041 rte_cryptodev_driver_id_get(
2042 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD)),
2043 BLKCIPHER_AES_CHAIN_TYPE);
2045 TEST_ASSERT_EQUAL(status, 0, "Test failed");
2047 return TEST_SUCCESS;
2051 test_AES_chain_mrvl_all(void)
2053 struct crypto_testsuite_params *ts_params = &testsuite_params;
2056 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
2057 ts_params->op_mpool,
2058 ts_params->session_mpool,
2059 ts_params->valid_devs[0],
2060 rte_cryptodev_driver_id_get(
2061 RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
2062 BLKCIPHER_AES_CHAIN_TYPE);
2064 TEST_ASSERT_EQUAL(status, 0, "Test failed");
2066 return TEST_SUCCESS;
2070 test_AES_cipheronly_mrvl_all(void)
2072 struct crypto_testsuite_params *ts_params = &testsuite_params;
2075 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
2076 ts_params->op_mpool,
2077 ts_params->session_mpool,
2078 ts_params->valid_devs[0],
2079 rte_cryptodev_driver_id_get(
2080 RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
2081 BLKCIPHER_AES_CIPHERONLY_TYPE);
2083 TEST_ASSERT_EQUAL(status, 0, "Test failed");
2085 return TEST_SUCCESS;
2089 test_authonly_mrvl_all(void)
2091 struct crypto_testsuite_params *ts_params = &testsuite_params;
2094 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
2095 ts_params->op_mpool,
2096 ts_params->session_mpool,
2097 ts_params->valid_devs[0],
2098 rte_cryptodev_driver_id_get(
2099 RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
2100 BLKCIPHER_AUTHONLY_TYPE);
2102 TEST_ASSERT_EQUAL(status, 0, "Test failed");
2104 return TEST_SUCCESS;
2108 test_3DES_chain_mrvl_all(void)
2110 struct crypto_testsuite_params *ts_params = &testsuite_params;
2113 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
2114 ts_params->op_mpool,
2115 ts_params->session_mpool,
2116 ts_params->valid_devs[0],
2117 rte_cryptodev_driver_id_get(
2118 RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
2119 BLKCIPHER_3DES_CHAIN_TYPE);
2121 TEST_ASSERT_EQUAL(status, 0, "Test failed");
2123 return TEST_SUCCESS;
2127 test_3DES_cipheronly_mrvl_all(void)
2129 struct crypto_testsuite_params *ts_params = &testsuite_params;
2132 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
2133 ts_params->op_mpool,
2134 ts_params->session_mpool,
2135 ts_params->valid_devs[0],
2136 rte_cryptodev_driver_id_get(
2137 RTE_STR(CRYPTODEV_NAME_MVSAM_PMD)),
2138 BLKCIPHER_3DES_CIPHERONLY_TYPE);
2140 TEST_ASSERT_EQUAL(status, 0, "Test failed");
2142 return TEST_SUCCESS;
2146 test_AES_chain_octeontx_all(void)
2148 struct crypto_testsuite_params *ts_params = &testsuite_params;
2151 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
2152 ts_params->op_mpool, ts_params->session_mpool,
2153 ts_params->valid_devs[0],
2154 rte_cryptodev_driver_id_get(
2155 RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
2156 BLKCIPHER_AES_CHAIN_TYPE);
2158 TEST_ASSERT_EQUAL(status, 0, "Test failed");
2160 return TEST_SUCCESS;
2164 test_AES_cipheronly_octeontx_all(void)
2166 struct crypto_testsuite_params *ts_params = &testsuite_params;
2169 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
2170 ts_params->op_mpool, ts_params->session_mpool,
2171 ts_params->valid_devs[0],
2172 rte_cryptodev_driver_id_get(
2173 RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
2174 BLKCIPHER_AES_CIPHERONLY_TYPE);
2176 TEST_ASSERT_EQUAL(status, 0, "Test failed");
2178 return TEST_SUCCESS;
2182 test_3DES_chain_octeontx_all(void)
2184 struct crypto_testsuite_params *ts_params = &testsuite_params;
2187 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
2188 ts_params->op_mpool, ts_params->session_mpool,
2189 ts_params->valid_devs[0],
2190 rte_cryptodev_driver_id_get(
2191 RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
2192 BLKCIPHER_3DES_CHAIN_TYPE);
2194 TEST_ASSERT_EQUAL(status, 0, "Test failed");
2196 return TEST_SUCCESS;
2200 test_3DES_cipheronly_octeontx_all(void)
2202 struct crypto_testsuite_params *ts_params = &testsuite_params;
2205 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
2206 ts_params->op_mpool, ts_params->session_mpool,
2207 ts_params->valid_devs[0],
2208 rte_cryptodev_driver_id_get(
2209 RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
2210 BLKCIPHER_3DES_CIPHERONLY_TYPE);
2212 TEST_ASSERT_EQUAL(status, 0, "Test failed");
2214 return TEST_SUCCESS;
2218 test_authonly_octeontx_all(void)
2220 struct crypto_testsuite_params *ts_params = &testsuite_params;
2223 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
2224 ts_params->op_mpool, ts_params->session_mpool,
2225 ts_params->valid_devs[0],
2226 rte_cryptodev_driver_id_get(
2227 RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD)),
2228 BLKCIPHER_AUTHONLY_TYPE);
2230 TEST_ASSERT_EQUAL(status, 0, "Test failed");
2232 return TEST_SUCCESS;
2235 /* ***** SNOW 3G Tests ***** */
2237 create_wireless_algo_hash_session(uint8_t dev_id,
2238 const uint8_t *key, const uint8_t key_len,
2239 const uint8_t iv_len, const uint8_t auth_len,
2240 enum rte_crypto_auth_operation op,
2241 enum rte_crypto_auth_algorithm algo)
2243 uint8_t hash_key[key_len];
2245 struct crypto_testsuite_params *ts_params = &testsuite_params;
2246 struct crypto_unittest_params *ut_params = &unittest_params;
2248 memcpy(hash_key, key, key_len);
2250 debug_hexdump(stdout, "key:", key, key_len);
2252 /* Setup Authentication Parameters */
2253 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
2254 ut_params->auth_xform.next = NULL;
2256 ut_params->auth_xform.auth.op = op;
2257 ut_params->auth_xform.auth.algo = algo;
2258 ut_params->auth_xform.auth.key.length = key_len;
2259 ut_params->auth_xform.auth.key.data = hash_key;
2260 ut_params->auth_xform.auth.digest_length = auth_len;
2261 ut_params->auth_xform.auth.iv.offset = IV_OFFSET;
2262 ut_params->auth_xform.auth.iv.length = iv_len;
2263 ut_params->sess = rte_cryptodev_sym_session_create(
2264 ts_params->session_mpool);
2266 rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
2267 &ut_params->auth_xform, ts_params->session_mpool);
2268 TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
2273 create_wireless_algo_cipher_session(uint8_t dev_id,
2274 enum rte_crypto_cipher_operation op,
2275 enum rte_crypto_cipher_algorithm algo,
2276 const uint8_t *key, const uint8_t key_len,
2279 uint8_t cipher_key[key_len];
2281 struct crypto_testsuite_params *ts_params = &testsuite_params;
2282 struct crypto_unittest_params *ut_params = &unittest_params;
2284 memcpy(cipher_key, key, key_len);
2286 /* Setup Cipher Parameters */
2287 ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
2288 ut_params->cipher_xform.next = NULL;
2290 ut_params->cipher_xform.cipher.algo = algo;
2291 ut_params->cipher_xform.cipher.op = op;
2292 ut_params->cipher_xform.cipher.key.data = cipher_key;
2293 ut_params->cipher_xform.cipher.key.length = key_len;
2294 ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
2295 ut_params->cipher_xform.cipher.iv.length = iv_len;
2297 debug_hexdump(stdout, "key:", key, key_len);
2299 /* Create Crypto session */
2300 ut_params->sess = rte_cryptodev_sym_session_create(
2301 ts_params->session_mpool);
2303 rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
2304 &ut_params->cipher_xform, ts_params->session_mpool);
2305 TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
2310 create_wireless_algo_cipher_operation(const uint8_t *iv, uint8_t iv_len,
2311 unsigned int cipher_len,
2312 unsigned int cipher_offset)
2314 struct crypto_testsuite_params *ts_params = &testsuite_params;
2315 struct crypto_unittest_params *ut_params = &unittest_params;
2317 /* Generate Crypto op data structure */
2318 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
2319 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
2320 TEST_ASSERT_NOT_NULL(ut_params->op,
2321 "Failed to allocate pktmbuf offload");
2323 /* Set crypto operation data parameters */
2324 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
2326 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
2328 /* set crypto operation source mbuf */
2329 sym_op->m_src = ut_params->ibuf;
2332 rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
2334 sym_op->cipher.data.length = cipher_len;
2335 sym_op->cipher.data.offset = cipher_offset;
2340 create_wireless_algo_cipher_operation_oop(const uint8_t *iv, uint8_t iv_len,
2341 unsigned int cipher_len,
2342 unsigned int cipher_offset)
2344 struct crypto_testsuite_params *ts_params = &testsuite_params;
2345 struct crypto_unittest_params *ut_params = &unittest_params;
2347 /* Generate Crypto op data structure */
2348 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
2349 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
2350 TEST_ASSERT_NOT_NULL(ut_params->op,
2351 "Failed to allocate pktmbuf offload");
2353 /* Set crypto operation data parameters */
2354 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
2356 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
2358 /* set crypto operation source mbuf */
2359 sym_op->m_src = ut_params->ibuf;
2360 sym_op->m_dst = ut_params->obuf;
2363 rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
2365 sym_op->cipher.data.length = cipher_len;
2366 sym_op->cipher.data.offset = cipher_offset;
2371 create_wireless_algo_cipher_auth_session(uint8_t dev_id,
2372 enum rte_crypto_cipher_operation cipher_op,
2373 enum rte_crypto_auth_operation auth_op,
2374 enum rte_crypto_auth_algorithm auth_algo,
2375 enum rte_crypto_cipher_algorithm cipher_algo,
2376 const uint8_t *key, uint8_t key_len,
2377 uint8_t auth_iv_len, uint8_t auth_len,
2378 uint8_t cipher_iv_len)
2381 uint8_t cipher_auth_key[key_len];
2383 struct crypto_testsuite_params *ts_params = &testsuite_params;
2384 struct crypto_unittest_params *ut_params = &unittest_params;
2386 memcpy(cipher_auth_key, key, key_len);
2388 /* Setup Authentication Parameters */
2389 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
2390 ut_params->auth_xform.next = NULL;
2392 ut_params->auth_xform.auth.op = auth_op;
2393 ut_params->auth_xform.auth.algo = auth_algo;
2394 ut_params->auth_xform.auth.key.length = key_len;
2395 /* Hash key = cipher key */
2396 ut_params->auth_xform.auth.key.data = cipher_auth_key;
2397 ut_params->auth_xform.auth.digest_length = auth_len;
2398 /* Auth IV will be after cipher IV */
2399 ut_params->auth_xform.auth.iv.offset = IV_OFFSET + cipher_iv_len;
2400 ut_params->auth_xform.auth.iv.length = auth_iv_len;
2402 /* Setup Cipher Parameters */
2403 ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
2404 ut_params->cipher_xform.next = &ut_params->auth_xform;
2406 ut_params->cipher_xform.cipher.algo = cipher_algo;
2407 ut_params->cipher_xform.cipher.op = cipher_op;
2408 ut_params->cipher_xform.cipher.key.data = cipher_auth_key;
2409 ut_params->cipher_xform.cipher.key.length = key_len;
2410 ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
2411 ut_params->cipher_xform.cipher.iv.length = cipher_iv_len;
2413 debug_hexdump(stdout, "key:", key, key_len);
2415 /* Create Crypto session*/
2416 ut_params->sess = rte_cryptodev_sym_session_create(
2417 ts_params->session_mpool);
2419 rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
2420 &ut_params->cipher_xform, ts_params->session_mpool);
2422 TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
2427 create_wireless_cipher_auth_session(uint8_t dev_id,
2428 enum rte_crypto_cipher_operation cipher_op,
2429 enum rte_crypto_auth_operation auth_op,
2430 enum rte_crypto_auth_algorithm auth_algo,
2431 enum rte_crypto_cipher_algorithm cipher_algo,
2432 const struct wireless_test_data *tdata)
2434 const uint8_t key_len = tdata->key.len;
2435 uint8_t cipher_auth_key[key_len];
2437 struct crypto_testsuite_params *ts_params = &testsuite_params;
2438 struct crypto_unittest_params *ut_params = &unittest_params;
2439 const uint8_t *key = tdata->key.data;
2440 const uint8_t auth_len = tdata->digest.len;
2441 uint8_t cipher_iv_len = tdata->cipher_iv.len;
2442 uint8_t auth_iv_len = tdata->auth_iv.len;
2444 memcpy(cipher_auth_key, key, key_len);
2446 /* Setup Authentication Parameters */
2447 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
2448 ut_params->auth_xform.next = NULL;
2450 ut_params->auth_xform.auth.op = auth_op;
2451 ut_params->auth_xform.auth.algo = auth_algo;
2452 ut_params->auth_xform.auth.key.length = key_len;
2453 /* Hash key = cipher key */
2454 ut_params->auth_xform.auth.key.data = cipher_auth_key;
2455 ut_params->auth_xform.auth.digest_length = auth_len;
2456 /* Auth IV will be after cipher IV */
2457 ut_params->auth_xform.auth.iv.offset = IV_OFFSET + cipher_iv_len;
2458 ut_params->auth_xform.auth.iv.length = auth_iv_len;
2460 /* Setup Cipher Parameters */
2461 ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
2462 ut_params->cipher_xform.next = &ut_params->auth_xform;
2464 ut_params->cipher_xform.cipher.algo = cipher_algo;
2465 ut_params->cipher_xform.cipher.op = cipher_op;
2466 ut_params->cipher_xform.cipher.key.data = cipher_auth_key;
2467 ut_params->cipher_xform.cipher.key.length = key_len;
2468 ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
2469 ut_params->cipher_xform.cipher.iv.length = cipher_iv_len;
2472 debug_hexdump(stdout, "key:", key, key_len);
2474 /* Create Crypto session*/
2475 ut_params->sess = rte_cryptodev_sym_session_create(
2476 ts_params->session_mpool);
2478 rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
2479 &ut_params->cipher_xform, ts_params->session_mpool);
2481 TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
2486 create_zuc_cipher_auth_encrypt_generate_session(uint8_t dev_id,
2487 const struct wireless_test_data *tdata)
2489 return create_wireless_cipher_auth_session(dev_id,
2490 RTE_CRYPTO_CIPHER_OP_ENCRYPT,
2491 RTE_CRYPTO_AUTH_OP_GENERATE, RTE_CRYPTO_AUTH_ZUC_EIA3,
2492 RTE_CRYPTO_CIPHER_ZUC_EEA3, tdata);
2496 create_wireless_algo_auth_cipher_session(uint8_t dev_id,
2497 enum rte_crypto_cipher_operation cipher_op,
2498 enum rte_crypto_auth_operation auth_op,
2499 enum rte_crypto_auth_algorithm auth_algo,
2500 enum rte_crypto_cipher_algorithm cipher_algo,
2501 const uint8_t *key, const uint8_t key_len,
2502 uint8_t auth_iv_len, uint8_t auth_len,
2503 uint8_t cipher_iv_len)
2505 uint8_t auth_cipher_key[key_len];
2507 struct crypto_testsuite_params *ts_params = &testsuite_params;
2508 struct crypto_unittest_params *ut_params = &unittest_params;
2510 memcpy(auth_cipher_key, key, key_len);
2512 /* Setup Authentication Parameters */
2513 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
2514 ut_params->auth_xform.auth.op = auth_op;
2515 ut_params->auth_xform.next = &ut_params->cipher_xform;
2516 ut_params->auth_xform.auth.algo = auth_algo;
2517 ut_params->auth_xform.auth.key.length = key_len;
2518 ut_params->auth_xform.auth.key.data = auth_cipher_key;
2519 ut_params->auth_xform.auth.digest_length = auth_len;
2520 /* Auth IV will be after cipher IV */
2521 ut_params->auth_xform.auth.iv.offset = IV_OFFSET + cipher_iv_len;
2522 ut_params->auth_xform.auth.iv.length = auth_iv_len;
2524 /* Setup Cipher Parameters */
2525 ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
2526 ut_params->cipher_xform.next = NULL;
2527 ut_params->cipher_xform.cipher.algo = cipher_algo;
2528 ut_params->cipher_xform.cipher.op = cipher_op;
2529 ut_params->cipher_xform.cipher.key.data = auth_cipher_key;
2530 ut_params->cipher_xform.cipher.key.length = key_len;
2531 ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
2532 ut_params->cipher_xform.cipher.iv.length = cipher_iv_len;
2534 debug_hexdump(stdout, "key:", key, key_len);
2536 /* Create Crypto session*/
2537 ut_params->sess = rte_cryptodev_sym_session_create(
2538 ts_params->session_mpool);
2540 rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
2541 &ut_params->auth_xform, ts_params->session_mpool);
2543 TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
2549 create_wireless_algo_hash_operation(const uint8_t *auth_tag,
2550 unsigned int auth_tag_len,
2551 const uint8_t *iv, unsigned int iv_len,
2552 unsigned int data_pad_len,
2553 enum rte_crypto_auth_operation op,
2554 unsigned int auth_len, unsigned int auth_offset)
2556 struct crypto_testsuite_params *ts_params = &testsuite_params;
2558 struct crypto_unittest_params *ut_params = &unittest_params;
2560 /* Generate Crypto op data structure */
2561 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
2562 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
2563 TEST_ASSERT_NOT_NULL(ut_params->op,
2564 "Failed to allocate pktmbuf offload");
2566 /* Set crypto operation data parameters */
2567 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
2569 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
2571 /* set crypto operation source mbuf */
2572 sym_op->m_src = ut_params->ibuf;
2575 rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
2578 sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
2579 ut_params->ibuf, auth_tag_len);
2581 TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
2582 "no room to append auth tag");
2583 ut_params->digest = sym_op->auth.digest.data;
2584 sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
2585 ut_params->ibuf, data_pad_len);
2586 if (op == RTE_CRYPTO_AUTH_OP_GENERATE)
2587 memset(sym_op->auth.digest.data, 0, auth_tag_len);
2589 rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len);
2591 debug_hexdump(stdout, "digest:",
2592 sym_op->auth.digest.data,
2595 sym_op->auth.data.length = auth_len;
2596 sym_op->auth.data.offset = auth_offset;
2602 create_wireless_cipher_hash_operation(const struct wireless_test_data *tdata,
2603 enum rte_crypto_auth_operation op)
2605 struct crypto_testsuite_params *ts_params = &testsuite_params;
2606 struct crypto_unittest_params *ut_params = &unittest_params;
2608 const uint8_t *auth_tag = tdata->digest.data;
2609 const unsigned int auth_tag_len = tdata->digest.len;
2610 unsigned int plaintext_len = ceil_byte_length(tdata->plaintext.len);
2611 unsigned int data_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
2613 const uint8_t *cipher_iv = tdata->cipher_iv.data;
2614 const uint8_t cipher_iv_len = tdata->cipher_iv.len;
2615 const uint8_t *auth_iv = tdata->auth_iv.data;
2616 const uint8_t auth_iv_len = tdata->auth_iv.len;
2617 const unsigned int cipher_len = tdata->validCipherLenInBits.len;
2618 const unsigned int auth_len = tdata->validAuthLenInBits.len;
2620 /* Generate Crypto op data structure */
2621 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
2622 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
2623 TEST_ASSERT_NOT_NULL(ut_params->op,
2624 "Failed to allocate pktmbuf offload");
2625 /* Set crypto operation data parameters */
2626 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
2628 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
2630 /* set crypto operation source mbuf */
2631 sym_op->m_src = ut_params->ibuf;
2634 sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
2635 ut_params->ibuf, auth_tag_len);
2637 TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
2638 "no room to append auth tag");
2639 ut_params->digest = sym_op->auth.digest.data;
2640 sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
2641 ut_params->ibuf, data_pad_len);
2642 if (op == RTE_CRYPTO_AUTH_OP_GENERATE)
2643 memset(sym_op->auth.digest.data, 0, auth_tag_len);
2645 rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len);
2647 debug_hexdump(stdout, "digest:",
2648 sym_op->auth.digest.data,
2651 /* Copy cipher and auth IVs at the end of the crypto operation */
2652 uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, uint8_t *,
2654 rte_memcpy(iv_ptr, cipher_iv, cipher_iv_len);
2655 iv_ptr += cipher_iv_len;
2656 rte_memcpy(iv_ptr, auth_iv, auth_iv_len);
2658 sym_op->cipher.data.length = cipher_len;
2659 sym_op->cipher.data.offset = 0;
2660 sym_op->auth.data.length = auth_len;
2661 sym_op->auth.data.offset = 0;
2667 create_zuc_cipher_hash_generate_operation(
2668 const struct wireless_test_data *tdata)
2670 return create_wireless_cipher_hash_operation(tdata,
2671 RTE_CRYPTO_AUTH_OP_GENERATE);
2675 create_wireless_algo_cipher_hash_operation(const uint8_t *auth_tag,
2676 const unsigned auth_tag_len,
2677 const uint8_t *auth_iv, uint8_t auth_iv_len,
2678 unsigned data_pad_len,
2679 enum rte_crypto_auth_operation op,
2680 const uint8_t *cipher_iv, uint8_t cipher_iv_len,
2681 const unsigned cipher_len, const unsigned cipher_offset,
2682 const unsigned auth_len, const unsigned auth_offset)
2684 struct crypto_testsuite_params *ts_params = &testsuite_params;
2685 struct crypto_unittest_params *ut_params = &unittest_params;
2687 /* Generate Crypto op data structure */
2688 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
2689 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
2690 TEST_ASSERT_NOT_NULL(ut_params->op,
2691 "Failed to allocate pktmbuf offload");
2692 /* Set crypto operation data parameters */
2693 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
2695 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
2697 /* set crypto operation source mbuf */
2698 sym_op->m_src = ut_params->ibuf;
2701 sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
2702 ut_params->ibuf, auth_tag_len);
2704 TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
2705 "no room to append auth tag");
2706 ut_params->digest = sym_op->auth.digest.data;
2707 sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
2708 ut_params->ibuf, data_pad_len);
2709 if (op == RTE_CRYPTO_AUTH_OP_GENERATE)
2710 memset(sym_op->auth.digest.data, 0, auth_tag_len);
2712 rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len);
2714 debug_hexdump(stdout, "digest:",
2715 sym_op->auth.digest.data,
2718 /* Copy cipher and auth IVs at the end of the crypto operation */
2719 uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, uint8_t *,
2721 rte_memcpy(iv_ptr, cipher_iv, cipher_iv_len);
2722 iv_ptr += cipher_iv_len;
2723 rte_memcpy(iv_ptr, auth_iv, auth_iv_len);
2725 sym_op->cipher.data.length = cipher_len;
2726 sym_op->cipher.data.offset = cipher_offset;
2727 sym_op->auth.data.length = auth_len;
2728 sym_op->auth.data.offset = auth_offset;
2734 create_wireless_algo_auth_cipher_operation(unsigned int auth_tag_len,
2735 const uint8_t *cipher_iv, uint8_t cipher_iv_len,
2736 const uint8_t *auth_iv, uint8_t auth_iv_len,
2737 unsigned int data_pad_len,
2738 unsigned int cipher_len, unsigned int cipher_offset,
2739 unsigned int auth_len, unsigned int auth_offset)
2741 struct crypto_testsuite_params *ts_params = &testsuite_params;
2742 struct crypto_unittest_params *ut_params = &unittest_params;
2744 /* Generate Crypto op data structure */
2745 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
2746 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
2747 TEST_ASSERT_NOT_NULL(ut_params->op,
2748 "Failed to allocate pktmbuf offload");
2750 /* Set crypto operation data parameters */
2751 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
2753 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
2755 /* set crypto operation source mbuf */
2756 sym_op->m_src = ut_params->ibuf;
2759 sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
2760 ut_params->ibuf, auth_tag_len);
2762 TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
2763 "no room to append auth tag");
2765 sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
2766 ut_params->ibuf, data_pad_len);
2768 memset(sym_op->auth.digest.data, 0, auth_tag_len);
2770 debug_hexdump(stdout, "digest:",
2771 sym_op->auth.digest.data,
2774 /* Copy cipher and auth IVs at the end of the crypto operation */
2775 uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op, uint8_t *,
2777 rte_memcpy(iv_ptr, cipher_iv, cipher_iv_len);
2778 iv_ptr += cipher_iv_len;
2779 rte_memcpy(iv_ptr, auth_iv, auth_iv_len);
2781 sym_op->cipher.data.length = cipher_len;
2782 sym_op->cipher.data.offset = cipher_offset;
2784 sym_op->auth.data.length = auth_len;
2785 sym_op->auth.data.offset = auth_offset;
2791 test_snow3g_authentication(const struct snow3g_hash_test_data *tdata)
2793 struct crypto_testsuite_params *ts_params = &testsuite_params;
2794 struct crypto_unittest_params *ut_params = &unittest_params;
2797 unsigned plaintext_pad_len;
2798 unsigned plaintext_len;
2801 /* Create SNOW 3G session */
2802 retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
2803 tdata->key.data, tdata->key.len,
2804 tdata->auth_iv.len, tdata->digest.len,
2805 RTE_CRYPTO_AUTH_OP_GENERATE,
2806 RTE_CRYPTO_AUTH_SNOW3G_UIA2);
2810 /* alloc mbuf and set payload */
2811 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
2813 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
2814 rte_pktmbuf_tailroom(ut_params->ibuf));
2816 plaintext_len = ceil_byte_length(tdata->plaintext.len);
2817 /* Append data which is padded to a multiple of */
2818 /* the algorithms block size */
2819 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
2820 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
2822 memcpy(plaintext, tdata->plaintext.data, plaintext_len);
2824 /* Create SNOW 3G operation */
2825 retval = create_wireless_algo_hash_operation(NULL, tdata->digest.len,
2826 tdata->auth_iv.data, tdata->auth_iv.len,
2827 plaintext_pad_len, RTE_CRYPTO_AUTH_OP_GENERATE,
2828 tdata->validAuthLenInBits.len,
2833 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
2835 ut_params->obuf = ut_params->op->sym->m_src;
2836 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
2837 ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
2838 + plaintext_pad_len;
2841 TEST_ASSERT_BUFFERS_ARE_EQUAL(
2844 DIGEST_BYTE_LENGTH_SNOW3G_UIA2,
2845 "SNOW 3G Generated auth tag not as expected");
2851 test_snow3g_authentication_verify(const struct snow3g_hash_test_data *tdata)
2853 struct crypto_testsuite_params *ts_params = &testsuite_params;
2854 struct crypto_unittest_params *ut_params = &unittest_params;
2857 unsigned plaintext_pad_len;
2858 unsigned plaintext_len;
2861 /* Create SNOW 3G session */
2862 retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
2863 tdata->key.data, tdata->key.len,
2864 tdata->auth_iv.len, tdata->digest.len,
2865 RTE_CRYPTO_AUTH_OP_VERIFY,
2866 RTE_CRYPTO_AUTH_SNOW3G_UIA2);
2869 /* alloc mbuf and set payload */
2870 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
2872 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
2873 rte_pktmbuf_tailroom(ut_params->ibuf));
2875 plaintext_len = ceil_byte_length(tdata->plaintext.len);
2876 /* Append data which is padded to a multiple of */
2877 /* the algorithms block size */
2878 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
2879 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
2881 memcpy(plaintext, tdata->plaintext.data, plaintext_len);
2883 /* Create SNOW 3G operation */
2884 retval = create_wireless_algo_hash_operation(tdata->digest.data,
2886 tdata->auth_iv.data, tdata->auth_iv.len,
2888 RTE_CRYPTO_AUTH_OP_VERIFY,
2889 tdata->validAuthLenInBits.len,
2894 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
2896 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
2897 ut_params->obuf = ut_params->op->sym->m_src;
2898 ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
2899 + plaintext_pad_len;
2902 if (ut_params->op->status == RTE_CRYPTO_OP_STATUS_SUCCESS)
2911 test_kasumi_authentication(const struct kasumi_hash_test_data *tdata)
2913 struct crypto_testsuite_params *ts_params = &testsuite_params;
2914 struct crypto_unittest_params *ut_params = &unittest_params;
2917 unsigned plaintext_pad_len;
2918 unsigned plaintext_len;
2921 /* Create KASUMI session */
2922 retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
2923 tdata->key.data, tdata->key.len,
2924 0, tdata->digest.len,
2925 RTE_CRYPTO_AUTH_OP_GENERATE,
2926 RTE_CRYPTO_AUTH_KASUMI_F9);
2930 /* alloc mbuf and set payload */
2931 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
2933 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
2934 rte_pktmbuf_tailroom(ut_params->ibuf));
2936 plaintext_len = ceil_byte_length(tdata->plaintext.len);
2937 /* Append data which is padded to a multiple of */
2938 /* the algorithms block size */
2939 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 8);
2940 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
2942 memcpy(plaintext, tdata->plaintext.data, plaintext_len);
2944 /* Create KASUMI operation */
2945 retval = create_wireless_algo_hash_operation(NULL, tdata->digest.len,
2947 plaintext_pad_len, RTE_CRYPTO_AUTH_OP_GENERATE,
2948 tdata->plaintext.len,
2953 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
2955 ut_params->obuf = ut_params->op->sym->m_src;
2956 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
2957 ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
2958 + plaintext_pad_len;
2961 TEST_ASSERT_BUFFERS_ARE_EQUAL(
2964 DIGEST_BYTE_LENGTH_KASUMI_F9,
2965 "KASUMI Generated auth tag not as expected");
2971 test_kasumi_authentication_verify(const struct kasumi_hash_test_data *tdata)
2973 struct crypto_testsuite_params *ts_params = &testsuite_params;
2974 struct crypto_unittest_params *ut_params = &unittest_params;
2977 unsigned plaintext_pad_len;
2978 unsigned plaintext_len;
2981 /* Create KASUMI session */
2982 retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
2983 tdata->key.data, tdata->key.len,
2984 0, tdata->digest.len,
2985 RTE_CRYPTO_AUTH_OP_VERIFY,
2986 RTE_CRYPTO_AUTH_KASUMI_F9);
2989 /* alloc mbuf and set payload */
2990 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
2992 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
2993 rte_pktmbuf_tailroom(ut_params->ibuf));
2995 plaintext_len = ceil_byte_length(tdata->plaintext.len);
2996 /* Append data which is padded to a multiple */
2997 /* of the algorithms block size */
2998 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 8);
2999 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
3001 memcpy(plaintext, tdata->plaintext.data, plaintext_len);
3003 /* Create KASUMI operation */
3004 retval = create_wireless_algo_hash_operation(tdata->digest.data,
3008 RTE_CRYPTO_AUTH_OP_VERIFY,
3009 tdata->plaintext.len,
3014 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
3016 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
3017 ut_params->obuf = ut_params->op->sym->m_src;
3018 ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
3019 + plaintext_pad_len;
3022 if (ut_params->op->status == RTE_CRYPTO_OP_STATUS_SUCCESS)
3031 test_snow3g_hash_generate_test_case_1(void)
3033 return test_snow3g_authentication(&snow3g_hash_test_case_1);
3037 test_snow3g_hash_generate_test_case_2(void)
3039 return test_snow3g_authentication(&snow3g_hash_test_case_2);
3043 test_snow3g_hash_generate_test_case_3(void)
3045 return test_snow3g_authentication(&snow3g_hash_test_case_3);
3049 test_snow3g_hash_generate_test_case_4(void)
3051 return test_snow3g_authentication(&snow3g_hash_test_case_4);
3055 test_snow3g_hash_generate_test_case_5(void)
3057 return test_snow3g_authentication(&snow3g_hash_test_case_5);
3061 test_snow3g_hash_generate_test_case_6(void)
3063 return test_snow3g_authentication(&snow3g_hash_test_case_6);
3067 test_snow3g_hash_verify_test_case_1(void)
3069 return test_snow3g_authentication_verify(&snow3g_hash_test_case_1);
3074 test_snow3g_hash_verify_test_case_2(void)
3076 return test_snow3g_authentication_verify(&snow3g_hash_test_case_2);
3080 test_snow3g_hash_verify_test_case_3(void)
3082 return test_snow3g_authentication_verify(&snow3g_hash_test_case_3);
3086 test_snow3g_hash_verify_test_case_4(void)
3088 return test_snow3g_authentication_verify(&snow3g_hash_test_case_4);
3092 test_snow3g_hash_verify_test_case_5(void)
3094 return test_snow3g_authentication_verify(&snow3g_hash_test_case_5);
3098 test_snow3g_hash_verify_test_case_6(void)
3100 return test_snow3g_authentication_verify(&snow3g_hash_test_case_6);
3104 test_kasumi_hash_generate_test_case_1(void)
3106 return test_kasumi_authentication(&kasumi_hash_test_case_1);
3110 test_kasumi_hash_generate_test_case_2(void)
3112 return test_kasumi_authentication(&kasumi_hash_test_case_2);
3116 test_kasumi_hash_generate_test_case_3(void)
3118 return test_kasumi_authentication(&kasumi_hash_test_case_3);
3122 test_kasumi_hash_generate_test_case_4(void)
3124 return test_kasumi_authentication(&kasumi_hash_test_case_4);
3128 test_kasumi_hash_generate_test_case_5(void)
3130 return test_kasumi_authentication(&kasumi_hash_test_case_5);
3134 test_kasumi_hash_generate_test_case_6(void)
3136 return test_kasumi_authentication(&kasumi_hash_test_case_6);
3140 test_kasumi_hash_verify_test_case_1(void)
3142 return test_kasumi_authentication_verify(&kasumi_hash_test_case_1);
3146 test_kasumi_hash_verify_test_case_2(void)
3148 return test_kasumi_authentication_verify(&kasumi_hash_test_case_2);
3152 test_kasumi_hash_verify_test_case_3(void)
3154 return test_kasumi_authentication_verify(&kasumi_hash_test_case_3);
3158 test_kasumi_hash_verify_test_case_4(void)
3160 return test_kasumi_authentication_verify(&kasumi_hash_test_case_4);
3164 test_kasumi_hash_verify_test_case_5(void)
3166 return test_kasumi_authentication_verify(&kasumi_hash_test_case_5);
3170 test_kasumi_encryption(const struct kasumi_test_data *tdata)
3172 struct crypto_testsuite_params *ts_params = &testsuite_params;
3173 struct crypto_unittest_params *ut_params = &unittest_params;
3176 uint8_t *plaintext, *ciphertext;
3177 unsigned plaintext_pad_len;
3178 unsigned plaintext_len;
3180 /* Create KASUMI session */
3181 retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
3182 RTE_CRYPTO_CIPHER_OP_ENCRYPT,
3183 RTE_CRYPTO_CIPHER_KASUMI_F8,
3184 tdata->key.data, tdata->key.len,
3185 tdata->cipher_iv.len);
3189 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
3191 /* Clear mbuf payload */
3192 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
3193 rte_pktmbuf_tailroom(ut_params->ibuf));
3195 plaintext_len = ceil_byte_length(tdata->plaintext.len);
3196 /* Append data which is padded to a multiple */
3197 /* of the algorithms block size */
3198 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 8);
3199 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
3201 memcpy(plaintext, tdata->plaintext.data, plaintext_len);
3203 debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
3205 /* Create KASUMI operation */
3206 retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
3207 tdata->cipher_iv.len,
3208 RTE_ALIGN_CEIL(tdata->validCipherLenInBits.len, 8),
3209 tdata->validCipherOffsetInBits.len);
3213 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
3215 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
3217 ut_params->obuf = ut_params->op->sym->m_dst;
3218 if (ut_params->obuf)
3219 ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
3221 ciphertext = plaintext + (tdata->validCipherOffsetInBits.len >> 3);
3223 debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
3225 const uint8_t *reference_ciphertext = tdata->ciphertext.data +
3226 (tdata->validCipherOffsetInBits.len >> 3);
3228 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
3230 reference_ciphertext,
3231 tdata->validCipherLenInBits.len,
3232 "KASUMI Ciphertext data not as expected");
3237 test_kasumi_encryption_sgl(const struct kasumi_test_data *tdata)
3239 struct crypto_testsuite_params *ts_params = &testsuite_params;
3240 struct crypto_unittest_params *ut_params = &unittest_params;
3244 unsigned int plaintext_pad_len;
3245 unsigned int plaintext_len;
3247 uint8_t buffer[10000];
3248 const uint8_t *ciphertext;
3250 struct rte_cryptodev_info dev_info;
3252 rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
3254 uint64_t feat_flags = dev_info.feature_flags;
3256 if (!(feat_flags & RTE_CRYPTODEV_FF_IN_PLACE_SGL)) {
3257 printf("Device doesn't support in-place scatter-gather. "
3262 /* Create KASUMI session */
3263 retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
3264 RTE_CRYPTO_CIPHER_OP_ENCRYPT,
3265 RTE_CRYPTO_CIPHER_KASUMI_F8,
3266 tdata->key.data, tdata->key.len,
3267 tdata->cipher_iv.len);
3271 plaintext_len = ceil_byte_length(tdata->plaintext.len);
3274 /* Append data which is padded to a multiple */
3275 /* of the algorithms block size */
3276 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 8);
3278 ut_params->ibuf = create_segmented_mbuf(ts_params->mbuf_pool,
3279 plaintext_pad_len, 10, 0);
3281 pktmbuf_write(ut_params->ibuf, 0, plaintext_len, tdata->plaintext.data);
3283 /* Create KASUMI operation */
3284 retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
3285 tdata->cipher_iv.len,
3286 RTE_ALIGN_CEIL(tdata->validCipherLenInBits.len, 8),
3287 tdata->validCipherOffsetInBits.len);
3291 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
3293 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
3295 ut_params->obuf = ut_params->op->sym->m_dst;
3297 if (ut_params->obuf)
3298 ciphertext = rte_pktmbuf_read(ut_params->obuf, 0,
3299 plaintext_len, buffer);
3301 ciphertext = rte_pktmbuf_read(ut_params->ibuf,
3302 tdata->validCipherOffsetInBits.len >> 3,
3303 plaintext_len, buffer);
3306 debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
3308 const uint8_t *reference_ciphertext = tdata->ciphertext.data +
3309 (tdata->validCipherOffsetInBits.len >> 3);
3311 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
3313 reference_ciphertext,
3314 tdata->validCipherLenInBits.len,
3315 "KASUMI Ciphertext data not as expected");
3320 test_kasumi_encryption_oop(const struct kasumi_test_data *tdata)
3322 struct crypto_testsuite_params *ts_params = &testsuite_params;
3323 struct crypto_unittest_params *ut_params = &unittest_params;
3326 uint8_t *plaintext, *ciphertext;
3327 unsigned plaintext_pad_len;
3328 unsigned plaintext_len;
3330 /* Create KASUMI session */
3331 retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
3332 RTE_CRYPTO_CIPHER_OP_ENCRYPT,
3333 RTE_CRYPTO_CIPHER_KASUMI_F8,
3334 tdata->key.data, tdata->key.len,
3335 tdata->cipher_iv.len);
3339 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
3340 ut_params->obuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
3342 /* Clear mbuf payload */
3343 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
3344 rte_pktmbuf_tailroom(ut_params->ibuf));
3346 plaintext_len = ceil_byte_length(tdata->plaintext.len);
3347 /* Append data which is padded to a multiple */
3348 /* of the algorithms block size */
3349 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 8);
3350 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
3352 rte_pktmbuf_append(ut_params->obuf, plaintext_pad_len);
3353 memcpy(plaintext, tdata->plaintext.data, plaintext_len);
3355 debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
3357 /* Create KASUMI operation */
3358 retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
3359 tdata->cipher_iv.len,
3360 RTE_ALIGN_CEIL(tdata->validCipherLenInBits.len, 8),
3361 tdata->validCipherOffsetInBits.len);
3365 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
3367 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
3369 ut_params->obuf = ut_params->op->sym->m_dst;
3370 if (ut_params->obuf)
3371 ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
3373 ciphertext = plaintext + (tdata->validCipherOffsetInBits.len >> 3);
3375 debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
3377 const uint8_t *reference_ciphertext = tdata->ciphertext.data +
3378 (tdata->validCipherOffsetInBits.len >> 3);
3380 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
3382 reference_ciphertext,
3383 tdata->validCipherLenInBits.len,
3384 "KASUMI Ciphertext data not as expected");
3389 test_kasumi_encryption_oop_sgl(const struct kasumi_test_data *tdata)
3391 struct crypto_testsuite_params *ts_params = &testsuite_params;
3392 struct crypto_unittest_params *ut_params = &unittest_params;
3395 unsigned int plaintext_pad_len;
3396 unsigned int plaintext_len;
3398 const uint8_t *ciphertext;
3399 uint8_t buffer[2048];
3401 struct rte_cryptodev_info dev_info;
3403 rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
3405 uint64_t feat_flags = dev_info.feature_flags;
3406 if (!(feat_flags & RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT)) {
3407 printf("Device doesn't support out-of-place scatter-gather "
3408 "in both input and output mbufs. "
3413 /* Create KASUMI session */
3414 retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
3415 RTE_CRYPTO_CIPHER_OP_ENCRYPT,
3416 RTE_CRYPTO_CIPHER_KASUMI_F8,
3417 tdata->key.data, tdata->key.len,
3418 tdata->cipher_iv.len);
3422 plaintext_len = ceil_byte_length(tdata->plaintext.len);
3423 /* Append data which is padded to a multiple */
3424 /* of the algorithms block size */
3425 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 8);
3427 ut_params->ibuf = create_segmented_mbuf(ts_params->mbuf_pool,
3428 plaintext_pad_len, 10, 0);
3429 ut_params->obuf = create_segmented_mbuf(ts_params->mbuf_pool,
3430 plaintext_pad_len, 3, 0);
3432 /* Append data which is padded to a multiple */
3433 /* of the algorithms block size */
3434 pktmbuf_write(ut_params->ibuf, 0, plaintext_len, tdata->plaintext.data);
3436 /* Create KASUMI operation */
3437 retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
3438 tdata->cipher_iv.len,
3439 RTE_ALIGN_CEIL(tdata->validCipherLenInBits.len, 8),
3440 tdata->validCipherOffsetInBits.len);
3444 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
3446 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
3448 ut_params->obuf = ut_params->op->sym->m_dst;
3449 if (ut_params->obuf)
3450 ciphertext = rte_pktmbuf_read(ut_params->obuf, 0,
3451 plaintext_pad_len, buffer);
3453 ciphertext = rte_pktmbuf_read(ut_params->ibuf,
3454 tdata->validCipherOffsetInBits.len >> 3,
3455 plaintext_pad_len, buffer);
3457 const uint8_t *reference_ciphertext = tdata->ciphertext.data +
3458 (tdata->validCipherOffsetInBits.len >> 3);
3460 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
3462 reference_ciphertext,
3463 tdata->validCipherLenInBits.len,
3464 "KASUMI Ciphertext data not as expected");
3470 test_kasumi_decryption_oop(const struct kasumi_test_data *tdata)
3472 struct crypto_testsuite_params *ts_params = &testsuite_params;
3473 struct crypto_unittest_params *ut_params = &unittest_params;
3476 uint8_t *ciphertext, *plaintext;
3477 unsigned ciphertext_pad_len;
3478 unsigned ciphertext_len;
3480 /* Create KASUMI session */
3481 retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
3482 RTE_CRYPTO_CIPHER_OP_DECRYPT,
3483 RTE_CRYPTO_CIPHER_KASUMI_F8,
3484 tdata->key.data, tdata->key.len,
3485 tdata->cipher_iv.len);
3489 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
3490 ut_params->obuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
3492 /* Clear mbuf payload */
3493 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
3494 rte_pktmbuf_tailroom(ut_params->ibuf));
3496 ciphertext_len = ceil_byte_length(tdata->ciphertext.len);
3497 /* Append data which is padded to a multiple */
3498 /* of the algorithms block size */
3499 ciphertext_pad_len = RTE_ALIGN_CEIL(ciphertext_len, 8);
3500 ciphertext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
3501 ciphertext_pad_len);
3502 rte_pktmbuf_append(ut_params->obuf, ciphertext_pad_len);
3503 memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len);
3505 debug_hexdump(stdout, "ciphertext:", ciphertext, ciphertext_len);
3507 /* Create KASUMI operation */
3508 retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
3509 tdata->cipher_iv.len,
3510 RTE_ALIGN_CEIL(tdata->validCipherLenInBits.len, 8),
3511 tdata->validCipherOffsetInBits.len);
3515 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
3517 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
3519 ut_params->obuf = ut_params->op->sym->m_dst;
3520 if (ut_params->obuf)
3521 plaintext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
3523 plaintext = ciphertext + (tdata->validCipherOffsetInBits.len >> 3);
3525 debug_hexdump(stdout, "plaintext:", plaintext, ciphertext_len);
3527 const uint8_t *reference_plaintext = tdata->plaintext.data +
3528 (tdata->validCipherOffsetInBits.len >> 3);
3530 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
3532 reference_plaintext,
3533 tdata->validCipherLenInBits.len,
3534 "KASUMI Plaintext data not as expected");
3539 test_kasumi_decryption(const struct kasumi_test_data *tdata)
3541 struct crypto_testsuite_params *ts_params = &testsuite_params;
3542 struct crypto_unittest_params *ut_params = &unittest_params;
3545 uint8_t *ciphertext, *plaintext;
3546 unsigned ciphertext_pad_len;
3547 unsigned ciphertext_len;
3549 /* Create KASUMI session */
3550 retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
3551 RTE_CRYPTO_CIPHER_OP_DECRYPT,
3552 RTE_CRYPTO_CIPHER_KASUMI_F8,
3553 tdata->key.data, tdata->key.len,
3554 tdata->cipher_iv.len);
3558 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
3560 /* Clear mbuf payload */
3561 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
3562 rte_pktmbuf_tailroom(ut_params->ibuf));
3564 ciphertext_len = ceil_byte_length(tdata->ciphertext.len);
3565 /* Append data which is padded to a multiple */
3566 /* of the algorithms block size */
3567 ciphertext_pad_len = RTE_ALIGN_CEIL(ciphertext_len, 8);
3568 ciphertext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
3569 ciphertext_pad_len);
3570 memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len);
3572 debug_hexdump(stdout, "ciphertext:", ciphertext, ciphertext_len);
3574 /* Create KASUMI operation */
3575 retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
3576 tdata->cipher_iv.len,
3577 tdata->ciphertext.len,
3578 tdata->validCipherOffsetInBits.len);
3582 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
3584 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
3586 ut_params->obuf = ut_params->op->sym->m_dst;
3587 if (ut_params->obuf)
3588 plaintext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
3590 plaintext = ciphertext + (tdata->validCipherOffsetInBits.len >> 3);
3592 debug_hexdump(stdout, "plaintext:", plaintext, ciphertext_len);
3594 const uint8_t *reference_plaintext = tdata->plaintext.data +
3595 (tdata->validCipherOffsetInBits.len >> 3);
3597 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
3599 reference_plaintext,
3600 tdata->validCipherLenInBits.len,
3601 "KASUMI Plaintext data not as expected");
3606 test_snow3g_encryption(const struct snow3g_test_data *tdata)
3608 struct crypto_testsuite_params *ts_params = &testsuite_params;
3609 struct crypto_unittest_params *ut_params = &unittest_params;
3612 uint8_t *plaintext, *ciphertext;
3613 unsigned plaintext_pad_len;
3614 unsigned plaintext_len;
3616 /* Create SNOW 3G session */
3617 retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
3618 RTE_CRYPTO_CIPHER_OP_ENCRYPT,
3619 RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
3620 tdata->key.data, tdata->key.len,
3621 tdata->cipher_iv.len);
3625 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
3627 /* Clear mbuf payload */
3628 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
3629 rte_pktmbuf_tailroom(ut_params->ibuf));
3631 plaintext_len = ceil_byte_length(tdata->plaintext.len);
3632 /* Append data which is padded to a multiple of */
3633 /* the algorithms block size */
3634 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
3635 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
3637 memcpy(plaintext, tdata->plaintext.data, plaintext_len);
3639 debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
3641 /* Create SNOW 3G operation */
3642 retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
3643 tdata->cipher_iv.len,
3644 tdata->validCipherLenInBits.len,
3649 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
3651 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
3653 ut_params->obuf = ut_params->op->sym->m_dst;
3654 if (ut_params->obuf)
3655 ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
3657 ciphertext = plaintext;
3659 debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
3662 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
3664 tdata->ciphertext.data,
3665 tdata->validDataLenInBits.len,
3666 "SNOW 3G Ciphertext data not as expected");
3672 test_snow3g_encryption_oop(const struct snow3g_test_data *tdata)
3674 struct crypto_testsuite_params *ts_params = &testsuite_params;
3675 struct crypto_unittest_params *ut_params = &unittest_params;
3676 uint8_t *plaintext, *ciphertext;
3679 unsigned plaintext_pad_len;
3680 unsigned plaintext_len;
3682 /* Create SNOW 3G session */
3683 retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
3684 RTE_CRYPTO_CIPHER_OP_ENCRYPT,
3685 RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
3686 tdata->key.data, tdata->key.len,
3687 tdata->cipher_iv.len);
3691 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
3692 ut_params->obuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
3694 TEST_ASSERT_NOT_NULL(ut_params->ibuf,
3695 "Failed to allocate input buffer in mempool");
3696 TEST_ASSERT_NOT_NULL(ut_params->obuf,
3697 "Failed to allocate output buffer in mempool");
3699 /* Clear mbuf payload */
3700 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
3701 rte_pktmbuf_tailroom(ut_params->ibuf));
3703 plaintext_len = ceil_byte_length(tdata->plaintext.len);
3704 /* Append data which is padded to a multiple of */
3705 /* the algorithms block size */
3706 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
3707 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
3709 rte_pktmbuf_append(ut_params->obuf, plaintext_pad_len);
3710 memcpy(plaintext, tdata->plaintext.data, plaintext_len);
3712 debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
3714 /* Create SNOW 3G operation */
3715 retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
3716 tdata->cipher_iv.len,
3717 tdata->validCipherLenInBits.len,
3722 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
3724 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
3726 ut_params->obuf = ut_params->op->sym->m_dst;
3727 if (ut_params->obuf)
3728 ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
3730 ciphertext = plaintext;
3732 debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
3735 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
3737 tdata->ciphertext.data,
3738 tdata->validDataLenInBits.len,
3739 "SNOW 3G Ciphertext data not as expected");
3744 test_snow3g_encryption_oop_sgl(const struct snow3g_test_data *tdata)
3746 struct crypto_testsuite_params *ts_params = &testsuite_params;
3747 struct crypto_unittest_params *ut_params = &unittest_params;
3750 unsigned int plaintext_pad_len;
3751 unsigned int plaintext_len;
3752 uint8_t buffer[10000];
3753 const uint8_t *ciphertext;
3755 struct rte_cryptodev_info dev_info;
3757 rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
3759 uint64_t feat_flags = dev_info.feature_flags;
3761 if (!(feat_flags & RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT)) {
3762 printf("Device doesn't support out-of-place scatter-gather "
3763 "in both input and output mbufs. "
3768 /* Create SNOW 3G session */
3769 retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
3770 RTE_CRYPTO_CIPHER_OP_ENCRYPT,
3771 RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
3772 tdata->key.data, tdata->key.len,
3773 tdata->cipher_iv.len);
3777 plaintext_len = ceil_byte_length(tdata->plaintext.len);
3778 /* Append data which is padded to a multiple of */
3779 /* the algorithms block size */
3780 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
3782 ut_params->ibuf = create_segmented_mbuf(ts_params->mbuf_pool,
3783 plaintext_pad_len, 10, 0);
3784 ut_params->obuf = create_segmented_mbuf(ts_params->mbuf_pool,
3785 plaintext_pad_len, 3, 0);
3787 TEST_ASSERT_NOT_NULL(ut_params->ibuf,
3788 "Failed to allocate input buffer in mempool");
3789 TEST_ASSERT_NOT_NULL(ut_params->obuf,
3790 "Failed to allocate output buffer in mempool");
3792 pktmbuf_write(ut_params->ibuf, 0, plaintext_len, tdata->plaintext.data);
3794 /* Create SNOW 3G operation */
3795 retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
3796 tdata->cipher_iv.len,
3797 tdata->validCipherLenInBits.len,
3802 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
3804 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
3806 ut_params->obuf = ut_params->op->sym->m_dst;
3807 if (ut_params->obuf)
3808 ciphertext = rte_pktmbuf_read(ut_params->obuf, 0,
3809 plaintext_len, buffer);
3811 ciphertext = rte_pktmbuf_read(ut_params->ibuf, 0,
3812 plaintext_len, buffer);
3814 debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
3817 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
3819 tdata->ciphertext.data,
3820 tdata->validDataLenInBits.len,
3821 "SNOW 3G Ciphertext data not as expected");
3826 /* Shift right a buffer by "offset" bits, "offset" < 8 */
3828 buffer_shift_right(uint8_t *buffer, uint32_t length, uint8_t offset)
3830 uint8_t curr_byte, prev_byte;
3831 uint32_t length_in_bytes = ceil_byte_length(length + offset);
3832 uint8_t lower_byte_mask = (1 << offset) - 1;
3835 prev_byte = buffer[0];
3836 buffer[0] >>= offset;
3838 for (i = 1; i < length_in_bytes; i++) {
3839 curr_byte = buffer[i];
3840 buffer[i] = ((prev_byte & lower_byte_mask) << (8 - offset)) |
3841 (curr_byte >> offset);
3842 prev_byte = curr_byte;
3847 test_snow3g_encryption_offset_oop(const struct snow3g_test_data *tdata)
3849 struct crypto_testsuite_params *ts_params = &testsuite_params;
3850 struct crypto_unittest_params *ut_params = &unittest_params;
3851 uint8_t *plaintext, *ciphertext;
3853 uint32_t plaintext_len;
3854 uint32_t plaintext_pad_len;
3855 uint8_t extra_offset = 4;
3856 uint8_t *expected_ciphertext_shifted;
3858 /* Create SNOW 3G session */
3859 retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
3860 RTE_CRYPTO_CIPHER_OP_ENCRYPT,
3861 RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
3862 tdata->key.data, tdata->key.len,
3863 tdata->cipher_iv.len);
3867 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
3868 ut_params->obuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
3870 TEST_ASSERT_NOT_NULL(ut_params->ibuf,
3871 "Failed to allocate input buffer in mempool");
3872 TEST_ASSERT_NOT_NULL(ut_params->obuf,
3873 "Failed to allocate output buffer in mempool");
3875 /* Clear mbuf payload */
3876 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
3877 rte_pktmbuf_tailroom(ut_params->ibuf));
3879 plaintext_len = ceil_byte_length(tdata->plaintext.len + extra_offset);
3881 * Append data which is padded to a
3882 * multiple of the algorithms block size
3884 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
3886 plaintext = (uint8_t *) rte_pktmbuf_append(ut_params->ibuf,
3889 rte_pktmbuf_append(ut_params->obuf, plaintext_pad_len);
3891 memcpy(plaintext, tdata->plaintext.data, (tdata->plaintext.len >> 3));
3892 buffer_shift_right(plaintext, tdata->plaintext.len, extra_offset);
3894 #ifdef RTE_APP_TEST_DEBUG
3895 rte_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len);
3897 /* Create SNOW 3G operation */
3898 retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
3899 tdata->cipher_iv.len,
3900 tdata->validCipherLenInBits.len,
3905 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
3907 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
3909 ut_params->obuf = ut_params->op->sym->m_dst;
3910 if (ut_params->obuf)
3911 ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
3913 ciphertext = plaintext;
3915 #ifdef RTE_APP_TEST_DEBUG
3916 rte_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
3919 expected_ciphertext_shifted = rte_malloc(NULL, plaintext_len, 8);
3921 TEST_ASSERT_NOT_NULL(expected_ciphertext_shifted,
3922 "failed to reserve memory for ciphertext shifted\n");
3924 memcpy(expected_ciphertext_shifted, tdata->ciphertext.data,
3925 ceil_byte_length(tdata->ciphertext.len));
3926 buffer_shift_right(expected_ciphertext_shifted, tdata->ciphertext.len,
3929 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT_OFFSET(
3931 expected_ciphertext_shifted,
3932 tdata->validDataLenInBits.len,
3934 "SNOW 3G Ciphertext data not as expected");
3938 static int test_snow3g_decryption(const struct snow3g_test_data *tdata)
3940 struct crypto_testsuite_params *ts_params = &testsuite_params;
3941 struct crypto_unittest_params *ut_params = &unittest_params;
3945 uint8_t *plaintext, *ciphertext;
3946 unsigned ciphertext_pad_len;
3947 unsigned ciphertext_len;
3949 /* Create SNOW 3G session */
3950 retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
3951 RTE_CRYPTO_CIPHER_OP_DECRYPT,
3952 RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
3953 tdata->key.data, tdata->key.len,
3954 tdata->cipher_iv.len);
3958 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
3960 /* Clear mbuf payload */
3961 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
3962 rte_pktmbuf_tailroom(ut_params->ibuf));
3964 ciphertext_len = ceil_byte_length(tdata->ciphertext.len);
3965 /* Append data which is padded to a multiple of */
3966 /* the algorithms block size */
3967 ciphertext_pad_len = RTE_ALIGN_CEIL(ciphertext_len, 16);
3968 ciphertext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
3969 ciphertext_pad_len);
3970 memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len);
3972 debug_hexdump(stdout, "ciphertext:", ciphertext, ciphertext_len);
3974 /* Create SNOW 3G operation */
3975 retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
3976 tdata->cipher_iv.len,
3977 tdata->validCipherLenInBits.len,
3982 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
3984 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
3985 ut_params->obuf = ut_params->op->sym->m_dst;
3986 if (ut_params->obuf)
3987 plaintext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
3989 plaintext = ciphertext;
3991 debug_hexdump(stdout, "plaintext:", plaintext, ciphertext_len);
3994 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(plaintext,
3995 tdata->plaintext.data,
3996 tdata->validDataLenInBits.len,
3997 "SNOW 3G Plaintext data not as expected");
4001 static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata)
4003 struct crypto_testsuite_params *ts_params = &testsuite_params;
4004 struct crypto_unittest_params *ut_params = &unittest_params;
4008 uint8_t *plaintext, *ciphertext;
4009 unsigned ciphertext_pad_len;
4010 unsigned ciphertext_len;
4012 /* Create SNOW 3G session */
4013 retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
4014 RTE_CRYPTO_CIPHER_OP_DECRYPT,
4015 RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
4016 tdata->key.data, tdata->key.len,
4017 tdata->cipher_iv.len);
4021 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
4022 ut_params->obuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
4024 TEST_ASSERT_NOT_NULL(ut_params->ibuf,
4025 "Failed to allocate input buffer");
4026 TEST_ASSERT_NOT_NULL(ut_params->obuf,
4027 "Failed to allocate output buffer");
4029 /* Clear mbuf payload */
4030 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
4031 rte_pktmbuf_tailroom(ut_params->ibuf));
4033 memset(rte_pktmbuf_mtod(ut_params->obuf, uint8_t *), 0,
4034 rte_pktmbuf_tailroom(ut_params->obuf));
4036 ciphertext_len = ceil_byte_length(tdata->ciphertext.len);
4037 /* Append data which is padded to a multiple of */
4038 /* the algorithms block size */
4039 ciphertext_pad_len = RTE_ALIGN_CEIL(ciphertext_len, 16);
4040 ciphertext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
4041 ciphertext_pad_len);
4042 rte_pktmbuf_append(ut_params->obuf, ciphertext_pad_len);
4043 memcpy(ciphertext, tdata->ciphertext.data, ciphertext_len);
4045 debug_hexdump(stdout, "ciphertext:", ciphertext, ciphertext_len);
4047 /* Create SNOW 3G operation */
4048 retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data,
4049 tdata->cipher_iv.len,
4050 tdata->validCipherLenInBits.len,
4055 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
4057 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
4058 ut_params->obuf = ut_params->op->sym->m_dst;
4059 if (ut_params->obuf)
4060 plaintext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
4062 plaintext = ciphertext;
4064 debug_hexdump(stdout, "plaintext:", plaintext, ciphertext_len);
4067 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(plaintext,
4068 tdata->plaintext.data,
4069 tdata->validDataLenInBits.len,
4070 "SNOW 3G Plaintext data not as expected");
4075 test_zuc_cipher_auth(const struct wireless_test_data *tdata)
4077 struct crypto_testsuite_params *ts_params = &testsuite_params;
4078 struct crypto_unittest_params *ut_params = &unittest_params;
4082 uint8_t *plaintext, *ciphertext;
4083 unsigned int plaintext_pad_len;
4084 unsigned int plaintext_len;
4086 struct rte_cryptodev_sym_capability_idx cap_idx;
4088 /* Check if device supports ZUC EEA3 */
4089 cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
4090 cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_ZUC_EEA3;
4092 if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
4096 /* Check if device supports ZUC EIA3 */
4097 cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
4098 cap_idx.algo.auth = RTE_CRYPTO_AUTH_ZUC_EIA3;
4100 if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
4104 /* Create ZUC session */
4105 retval = create_zuc_cipher_auth_encrypt_generate_session(
4106 ts_params->valid_devs[0],
4110 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
4112 /* clear mbuf payload */
4113 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
4114 rte_pktmbuf_tailroom(ut_params->ibuf));
4116 plaintext_len = ceil_byte_length(tdata->plaintext.len);
4117 /* Append data which is padded to a multiple of */
4118 /* the algorithms block size */
4119 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
4120 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
4122 memcpy(plaintext, tdata->plaintext.data, plaintext_len);
4124 debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
4126 /* Create ZUC operation */
4127 retval = create_zuc_cipher_hash_generate_operation(tdata);
4131 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
4133 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
4134 ut_params->obuf = ut_params->op->sym->m_src;
4135 if (ut_params->obuf)
4136 ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
4138 ciphertext = plaintext;
4140 debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
4142 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
4144 tdata->ciphertext.data,
4145 tdata->validDataLenInBits.len,
4146 "ZUC Ciphertext data not as expected");
4148 ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
4149 + plaintext_pad_len;
4152 TEST_ASSERT_BUFFERS_ARE_EQUAL(
4156 "ZUC Generated auth tag not as expected");
4161 test_snow3g_cipher_auth(const struct snow3g_test_data *tdata)
4163 struct crypto_testsuite_params *ts_params = &testsuite_params;
4164 struct crypto_unittest_params *ut_params = &unittest_params;
4168 uint8_t *plaintext, *ciphertext;
4169 unsigned plaintext_pad_len;
4170 unsigned plaintext_len;
4172 /* Create SNOW 3G session */
4173 retval = create_wireless_algo_cipher_auth_session(ts_params->valid_devs[0],
4174 RTE_CRYPTO_CIPHER_OP_ENCRYPT,
4175 RTE_CRYPTO_AUTH_OP_GENERATE,
4176 RTE_CRYPTO_AUTH_SNOW3G_UIA2,
4177 RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
4178 tdata->key.data, tdata->key.len,
4179 tdata->auth_iv.len, tdata->digest.len,
4180 tdata->cipher_iv.len);
4183 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
4185 /* clear mbuf payload */
4186 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
4187 rte_pktmbuf_tailroom(ut_params->ibuf));
4189 plaintext_len = ceil_byte_length(tdata->plaintext.len);
4190 /* Append data which is padded to a multiple of */
4191 /* the algorithms block size */
4192 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
4193 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
4195 memcpy(plaintext, tdata->plaintext.data, plaintext_len);
4197 debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
4199 /* Create SNOW 3G operation */
4200 retval = create_wireless_algo_cipher_hash_operation(tdata->digest.data,
4201 tdata->digest.len, tdata->auth_iv.data,
4203 plaintext_pad_len, RTE_CRYPTO_AUTH_OP_GENERATE,
4204 tdata->cipher_iv.data, tdata->cipher_iv.len,
4205 tdata->validCipherLenInBits.len,
4207 tdata->validAuthLenInBits.len,
4213 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
4215 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
4216 ut_params->obuf = ut_params->op->sym->m_src;
4217 if (ut_params->obuf)
4218 ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
4220 ciphertext = plaintext;
4222 debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
4224 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
4226 tdata->ciphertext.data,
4227 tdata->validDataLenInBits.len,
4228 "SNOW 3G Ciphertext data not as expected");
4230 ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
4231 + plaintext_pad_len;
4234 TEST_ASSERT_BUFFERS_ARE_EQUAL(
4237 DIGEST_BYTE_LENGTH_SNOW3G_UIA2,
4238 "SNOW 3G Generated auth tag not as expected");
4242 test_snow3g_auth_cipher(const struct snow3g_test_data *tdata)
4244 struct crypto_testsuite_params *ts_params = &testsuite_params;
4245 struct crypto_unittest_params *ut_params = &unittest_params;
4249 uint8_t *plaintext, *ciphertext;
4250 unsigned plaintext_pad_len;
4251 unsigned plaintext_len;
4253 /* Create SNOW 3G session */
4254 retval = create_wireless_algo_auth_cipher_session(ts_params->valid_devs[0],
4255 RTE_CRYPTO_CIPHER_OP_ENCRYPT,
4256 RTE_CRYPTO_AUTH_OP_GENERATE,
4257 RTE_CRYPTO_AUTH_SNOW3G_UIA2,
4258 RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
4259 tdata->key.data, tdata->key.len,
4260 tdata->auth_iv.len, tdata->digest.len,
4261 tdata->cipher_iv.len);
4265 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
4267 /* clear mbuf payload */
4268 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
4269 rte_pktmbuf_tailroom(ut_params->ibuf));
4271 plaintext_len = ceil_byte_length(tdata->plaintext.len);
4272 /* Append data which is padded to a multiple of */
4273 /* the algorithms block size */
4274 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
4275 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
4277 memcpy(plaintext, tdata->plaintext.data, plaintext_len);
4279 debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
4281 /* Create SNOW 3G operation */
4282 retval = create_wireless_algo_auth_cipher_operation(
4284 tdata->cipher_iv.data, tdata->cipher_iv.len,
4285 tdata->auth_iv.data, tdata->auth_iv.len,
4287 tdata->validCipherLenInBits.len,
4289 tdata->validAuthLenInBits.len,
4295 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
4297 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
4298 ut_params->obuf = ut_params->op->sym->m_src;
4299 if (ut_params->obuf)
4300 ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
4302 ciphertext = plaintext;
4304 ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
4305 + plaintext_pad_len;
4306 debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
4309 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
4311 tdata->ciphertext.data,
4312 tdata->validDataLenInBits.len,
4313 "SNOW 3G Ciphertext data not as expected");
4316 TEST_ASSERT_BUFFERS_ARE_EQUAL(
4319 DIGEST_BYTE_LENGTH_SNOW3G_UIA2,
4320 "SNOW 3G Generated auth tag not as expected");
4325 test_kasumi_auth_cipher(const struct kasumi_test_data *tdata)
4327 struct crypto_testsuite_params *ts_params = &testsuite_params;
4328 struct crypto_unittest_params *ut_params = &unittest_params;
4332 uint8_t *plaintext, *ciphertext;
4333 unsigned plaintext_pad_len;
4334 unsigned plaintext_len;
4336 /* Create KASUMI session */
4337 retval = create_wireless_algo_auth_cipher_session(
4338 ts_params->valid_devs[0],
4339 RTE_CRYPTO_CIPHER_OP_ENCRYPT,
4340 RTE_CRYPTO_AUTH_OP_GENERATE,
4341 RTE_CRYPTO_AUTH_KASUMI_F9,
4342 RTE_CRYPTO_CIPHER_KASUMI_F8,
4343 tdata->key.data, tdata->key.len,
4344 0, tdata->digest.len,
4345 tdata->cipher_iv.len);
4348 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
4350 /* clear mbuf payload */
4351 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
4352 rte_pktmbuf_tailroom(ut_params->ibuf));
4354 plaintext_len = ceil_byte_length(tdata->plaintext.len);
4355 /* Append data which is padded to a multiple of */
4356 /* the algorithms block size */
4357 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
4358 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
4360 memcpy(plaintext, tdata->plaintext.data, plaintext_len);
4362 debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
4364 /* Create KASUMI operation */
4365 retval = create_wireless_algo_auth_cipher_operation(tdata->digest.len,
4366 tdata->cipher_iv.data, tdata->cipher_iv.len,
4369 tdata->validCipherLenInBits.len,
4370 tdata->validCipherOffsetInBits.len,
4371 tdata->validAuthLenInBits.len,
4378 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
4380 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
4381 if (ut_params->op->sym->m_dst)
4382 ut_params->obuf = ut_params->op->sym->m_dst;
4384 ut_params->obuf = ut_params->op->sym->m_src;
4386 ciphertext = rte_pktmbuf_mtod_offset(ut_params->obuf, uint8_t *,
4387 tdata->validCipherOffsetInBits.len >> 3);
4389 const uint8_t *reference_ciphertext = tdata->ciphertext.data +
4390 (tdata->validCipherOffsetInBits.len >> 3);
4392 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
4394 reference_ciphertext,
4395 tdata->validCipherLenInBits.len,
4396 "KASUMI Ciphertext data not as expected");
4397 ut_params->digest = rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *)
4398 + plaintext_pad_len;
4401 TEST_ASSERT_BUFFERS_ARE_EQUAL(
4404 DIGEST_BYTE_LENGTH_KASUMI_F9,
4405 "KASUMI Generated auth tag not as expected");
4410 test_kasumi_cipher_auth(const struct kasumi_test_data *tdata)
4412 struct crypto_testsuite_params *ts_params = &testsuite_params;
4413 struct crypto_unittest_params *ut_params = &unittest_params;
4417 uint8_t *plaintext, *ciphertext;
4418 unsigned plaintext_pad_len;
4419 unsigned plaintext_len;
4421 /* Create KASUMI session */
4422 retval = create_wireless_algo_cipher_auth_session(
4423 ts_params->valid_devs[0],
4424 RTE_CRYPTO_CIPHER_OP_ENCRYPT,
4425 RTE_CRYPTO_AUTH_OP_GENERATE,
4426 RTE_CRYPTO_AUTH_KASUMI_F9,
4427 RTE_CRYPTO_CIPHER_KASUMI_F8,
4428 tdata->key.data, tdata->key.len,
4429 0, tdata->digest.len,
4430 tdata->cipher_iv.len);
4434 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
4436 /* clear mbuf payload */
4437 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
4438 rte_pktmbuf_tailroom(ut_params->ibuf));
4440 plaintext_len = ceil_byte_length(tdata->plaintext.len);
4441 /* Append data which is padded to a multiple of */
4442 /* the algorithms block size */
4443 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
4444 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
4446 memcpy(plaintext, tdata->plaintext.data, plaintext_len);
4448 debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
4450 /* Create KASUMI operation */
4451 retval = create_wireless_algo_cipher_hash_operation(tdata->digest.data,
4452 tdata->digest.len, NULL, 0,
4453 plaintext_pad_len, RTE_CRYPTO_AUTH_OP_GENERATE,
4454 tdata->cipher_iv.data, tdata->cipher_iv.len,
4455 RTE_ALIGN_CEIL(tdata->validCipherLenInBits.len, 8),
4456 tdata->validCipherOffsetInBits.len,
4457 tdata->validAuthLenInBits.len,
4463 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
4465 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
4467 if (ut_params->op->sym->m_dst)
4468 ut_params->obuf = ut_params->op->sym->m_dst;
4470 ut_params->obuf = ut_params->op->sym->m_src;
4472 ciphertext = rte_pktmbuf_mtod_offset(ut_params->obuf, uint8_t *,
4473 tdata->validCipherOffsetInBits.len >> 3);
4475 ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
4476 + plaintext_pad_len;
4478 const uint8_t *reference_ciphertext = tdata->ciphertext.data +
4479 (tdata->validCipherOffsetInBits.len >> 3);
4481 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
4483 reference_ciphertext,
4484 tdata->validCipherLenInBits.len,
4485 "KASUMI Ciphertext data not as expected");
4488 TEST_ASSERT_BUFFERS_ARE_EQUAL(
4491 DIGEST_BYTE_LENGTH_SNOW3G_UIA2,
4492 "KASUMI Generated auth tag not as expected");
4497 test_zuc_encryption(const struct wireless_test_data *tdata)
4499 struct crypto_testsuite_params *ts_params = &testsuite_params;
4500 struct crypto_unittest_params *ut_params = &unittest_params;
4503 uint8_t *plaintext, *ciphertext;
4504 unsigned plaintext_pad_len;
4505 unsigned plaintext_len;
4507 struct rte_cryptodev_sym_capability_idx cap_idx;
4509 /* Check if device supports ZUC EEA3 */
4510 cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
4511 cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_ZUC_EEA3;
4513 if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
4517 /* Create ZUC session */
4518 retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
4519 RTE_CRYPTO_CIPHER_OP_ENCRYPT,
4520 RTE_CRYPTO_CIPHER_ZUC_EEA3,
4521 tdata->key.data, tdata->key.len,
4522 tdata->cipher_iv.len);
4526 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
4528 /* Clear mbuf payload */
4529 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
4530 rte_pktmbuf_tailroom(ut_params->ibuf));
4532 plaintext_len = ceil_byte_length(tdata->plaintext.len);
4533 /* Append data which is padded to a multiple */
4534 /* of the algorithms block size */
4535 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 8);
4536 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
4538 memcpy(plaintext, tdata->plaintext.data, plaintext_len);
4540 debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len);
4542 /* Create ZUC operation */
4543 retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
4544 tdata->cipher_iv.len,
4545 tdata->plaintext.len,
4550 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
4552 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
4554 ut_params->obuf = ut_params->op->sym->m_dst;
4555 if (ut_params->obuf)
4556 ciphertext = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
4558 ciphertext = plaintext;
4560 debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
4563 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
4565 tdata->ciphertext.data,
4566 tdata->validCipherLenInBits.len,
4567 "ZUC Ciphertext data not as expected");
4572 test_zuc_encryption_sgl(const struct wireless_test_data *tdata)
4574 struct crypto_testsuite_params *ts_params = &testsuite_params;
4575 struct crypto_unittest_params *ut_params = &unittest_params;
4579 unsigned int plaintext_pad_len;
4580 unsigned int plaintext_len;
4581 const uint8_t *ciphertext;
4582 uint8_t ciphertext_buffer[2048];
4583 struct rte_cryptodev_info dev_info;
4585 struct rte_cryptodev_sym_capability_idx cap_idx;
4587 /* Check if device supports ZUC EEA3 */
4588 cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
4589 cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_ZUC_EEA3;
4591 if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
4595 rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
4597 uint64_t feat_flags = dev_info.feature_flags;
4599 if (!(feat_flags & RTE_CRYPTODEV_FF_IN_PLACE_SGL)) {
4600 printf("Device doesn't support in-place scatter-gather. "
4605 plaintext_len = ceil_byte_length(tdata->plaintext.len);
4607 /* Append data which is padded to a multiple */
4608 /* of the algorithms block size */
4609 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 8);
4611 ut_params->ibuf = create_segmented_mbuf(ts_params->mbuf_pool,
4612 plaintext_pad_len, 10, 0);
4614 pktmbuf_write(ut_params->ibuf, 0, plaintext_len,
4615 tdata->plaintext.data);
4617 /* Create ZUC session */
4618 retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0],
4619 RTE_CRYPTO_CIPHER_OP_ENCRYPT,
4620 RTE_CRYPTO_CIPHER_ZUC_EEA3,
4621 tdata->key.data, tdata->key.len,
4622 tdata->cipher_iv.len);
4626 /* Clear mbuf payload */
4628 pktmbuf_write(ut_params->ibuf, 0, plaintext_len, tdata->plaintext.data);
4630 /* Create ZUC operation */
4631 retval = create_wireless_algo_cipher_operation(tdata->cipher_iv.data,
4632 tdata->cipher_iv.len, tdata->plaintext.len,
4637 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
4639 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
4641 ut_params->obuf = ut_params->op->sym->m_dst;
4642 if (ut_params->obuf)
4643 ciphertext = rte_pktmbuf_read(ut_params->obuf,
4644 0, plaintext_len, ciphertext_buffer);
4646 ciphertext = rte_pktmbuf_read(ut_params->ibuf,
4647 0, plaintext_len, ciphertext_buffer);
4650 debug_hexdump(stdout, "ciphertext:", ciphertext, plaintext_len);
4653 TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(
4655 tdata->ciphertext.data,
4656 tdata->validCipherLenInBits.len,
4657 "ZUC Ciphertext data not as expected");
4663 test_zuc_authentication(const struct wireless_test_data *tdata)
4665 struct crypto_testsuite_params *ts_params = &testsuite_params;
4666 struct crypto_unittest_params *ut_params = &unittest_params;
4669 unsigned plaintext_pad_len;
4670 unsigned plaintext_len;
4673 struct rte_cryptodev_sym_capability_idx cap_idx;
4675 /* Check if device supports ZUC EIA3 */
4676 cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
4677 cap_idx.algo.auth = RTE_CRYPTO_AUTH_ZUC_EIA3;
4679 if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
4683 /* Create ZUC session */
4684 retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
4685 tdata->key.data, tdata->key.len,
4686 tdata->auth_iv.len, tdata->digest.len,
4687 RTE_CRYPTO_AUTH_OP_GENERATE,
4688 RTE_CRYPTO_AUTH_ZUC_EIA3);
4692 /* alloc mbuf and set payload */
4693 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
4695 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
4696 rte_pktmbuf_tailroom(ut_params->ibuf));
4698 plaintext_len = ceil_byte_length(tdata->plaintext.len);
4699 /* Append data which is padded to a multiple of */
4700 /* the algorithms block size */
4701 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 8);
4702 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
4704 memcpy(plaintext, tdata->plaintext.data, plaintext_len);
4706 /* Create ZUC operation */
4707 retval = create_wireless_algo_hash_operation(NULL, tdata->digest.len,
4708 tdata->auth_iv.data, tdata->auth_iv.len,
4709 plaintext_pad_len, RTE_CRYPTO_AUTH_OP_GENERATE,
4710 tdata->validAuthLenInBits.len,
4715 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
4717 ut_params->obuf = ut_params->op->sym->m_src;
4718 TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
4719 ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
4720 + plaintext_pad_len;
4723 TEST_ASSERT_BUFFERS_ARE_EQUAL(
4726 DIGEST_BYTE_LENGTH_KASUMI_F9,
4727 "ZUC Generated auth tag not as expected");
4733 test_kasumi_encryption_test_case_1(void)
4735 return test_kasumi_encryption(&kasumi_test_case_1);
4739 test_kasumi_encryption_test_case_1_sgl(void)
4741 return test_kasumi_encryption_sgl(&kasumi_test_case_1);
4745 test_kasumi_encryption_test_case_1_oop(void)
4747 return test_kasumi_encryption_oop(&kasumi_test_case_1);
4751 test_kasumi_encryption_test_case_1_oop_sgl(void)
4753 return test_kasumi_encryption_oop_sgl(&kasumi_test_case_1);
4757 test_kasumi_encryption_test_case_2(void)
4759 return test_kasumi_encryption(&kasumi_test_case_2);
4763 test_kasumi_encryption_test_case_3(void)
4765 return test_kasumi_encryption(&kasumi_test_case_3);
4769 test_kasumi_encryption_test_case_4(void)
4771 return test_kasumi_encryption(&kasumi_test_case_4);
4775 test_kasumi_encryption_test_case_5(void)
4777 return test_kasumi_encryption(&kasumi_test_case_5);
4781 test_kasumi_decryption_test_case_1(void)
4783 return test_kasumi_decryption(&kasumi_test_case_1);
4787 test_kasumi_decryption_test_case_1_oop(void)
4789 return test_kasumi_decryption_oop(&kasumi_test_case_1);
4793 test_kasumi_decryption_test_case_2(void)
4795 return test_kasumi_decryption(&kasumi_test_case_2);
4799 test_kasumi_decryption_test_case_3(void)
4801 return test_kasumi_decryption(&kasumi_test_case_3);
4805 test_kasumi_decryption_test_case_4(void)
4807 return test_kasumi_decryption(&kasumi_test_case_4);
4811 test_kasumi_decryption_test_case_5(void)
4813 return test_kasumi_decryption(&kasumi_test_case_5);
4816 test_snow3g_encryption_test_case_1(void)
4818 return test_snow3g_encryption(&snow3g_test_case_1);
4822 test_snow3g_encryption_test_case_1_oop(void)
4824 return test_snow3g_encryption_oop(&snow3g_test_case_1);
4828 test_snow3g_encryption_test_case_1_oop_sgl(void)
4830 return test_snow3g_encryption_oop_sgl(&snow3g_test_case_1);
4835 test_snow3g_encryption_test_case_1_offset_oop(void)
4837 return test_snow3g_encryption_offset_oop(&snow3g_test_case_1);
4841 test_snow3g_encryption_test_case_2(void)
4843 return test_snow3g_encryption(&snow3g_test_case_2);
4847 test_snow3g_encryption_test_case_3(void)
4849 return test_snow3g_encryption(&snow3g_test_case_3);
4853 test_snow3g_encryption_test_case_4(void)
4855 return test_snow3g_encryption(&snow3g_test_case_4);
4859 test_snow3g_encryption_test_case_5(void)
4861 return test_snow3g_encryption(&snow3g_test_case_5);
4865 test_snow3g_decryption_test_case_1(void)
4867 return test_snow3g_decryption(&snow3g_test_case_1);
4871 test_snow3g_decryption_test_case_1_oop(void)
4873 return test_snow3g_decryption_oop(&snow3g_test_case_1);
4877 test_snow3g_decryption_test_case_2(void)
4879 return test_snow3g_decryption(&snow3g_test_case_2);
4883 test_snow3g_decryption_test_case_3(void)
4885 return test_snow3g_decryption(&snow3g_test_case_3);
4889 test_snow3g_decryption_test_case_4(void)
4891 return test_snow3g_decryption(&snow3g_test_case_4);
4895 test_snow3g_decryption_test_case_5(void)
4897 return test_snow3g_decryption(&snow3g_test_case_5);
4900 test_snow3g_cipher_auth_test_case_1(void)
4902 return test_snow3g_cipher_auth(&snow3g_test_case_3);
4906 test_snow3g_auth_cipher_test_case_1(void)
4908 return test_snow3g_auth_cipher(&snow3g_test_case_6);
4912 test_kasumi_auth_cipher_test_case_1(void)
4914 return test_kasumi_auth_cipher(&kasumi_test_case_3);
4918 test_kasumi_cipher_auth_test_case_1(void)
4920 return test_kasumi_cipher_auth(&kasumi_test_case_6);
4924 test_zuc_encryption_test_case_1(void)
4926 return test_zuc_encryption(&zuc_test_case_cipher_193b);
4930 test_zuc_encryption_test_case_2(void)
4932 return test_zuc_encryption(&zuc_test_case_cipher_800b);
4936 test_zuc_encryption_test_case_3(void)
4938 return test_zuc_encryption(&zuc_test_case_cipher_1570b);
4942 test_zuc_encryption_test_case_4(void)
4944 return test_zuc_encryption(&zuc_test_case_cipher_2798b);
4948 test_zuc_encryption_test_case_5(void)
4950 return test_zuc_encryption(&zuc_test_case_cipher_4019b);
4954 test_zuc_encryption_test_case_6_sgl(void)
4956 return test_zuc_encryption_sgl(&zuc_test_case_cipher_193b);
4960 test_zuc_hash_generate_test_case_1(void)
4962 return test_zuc_authentication(&zuc_test_case_auth_1b);
4966 test_zuc_hash_generate_test_case_2(void)
4968 return test_zuc_authentication(&zuc_test_case_auth_90b);
4972 test_zuc_hash_generate_test_case_3(void)
4974 return test_zuc_authentication(&zuc_test_case_auth_577b);
4978 test_zuc_hash_generate_test_case_4(void)
4980 return test_zuc_authentication(&zuc_test_case_auth_2079b);
4984 test_zuc_hash_generate_test_case_5(void)
4986 return test_zuc_authentication(&zuc_test_auth_5670b);
4990 test_zuc_hash_generate_test_case_6(void)
4992 return test_zuc_authentication(&zuc_test_case_auth_128b);
4996 test_zuc_hash_generate_test_case_7(void)
4998 return test_zuc_authentication(&zuc_test_case_auth_2080b);
5002 test_zuc_hash_generate_test_case_8(void)
5004 return test_zuc_authentication(&zuc_test_case_auth_584b);
5008 test_zuc_cipher_auth_test_case_1(void)
5010 return test_zuc_cipher_auth(&zuc_test_case_cipher_200b_auth_200b);
5014 test_zuc_cipher_auth_test_case_2(void)
5016 return test_zuc_cipher_auth(&zuc_test_case_cipher_800b_auth_120b);
5020 test_3DES_chain_qat_all(void)
5022 struct crypto_testsuite_params *ts_params = &testsuite_params;
5025 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
5026 ts_params->op_mpool,
5027 ts_params->session_mpool,
5028 ts_params->valid_devs[0],
5029 rte_cryptodev_driver_id_get(
5030 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
5031 BLKCIPHER_3DES_CHAIN_TYPE);
5033 TEST_ASSERT_EQUAL(status, 0, "Test failed");
5035 return TEST_SUCCESS;
5039 test_DES_cipheronly_qat_all(void)
5041 struct crypto_testsuite_params *ts_params = &testsuite_params;
5044 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
5045 ts_params->op_mpool,
5046 ts_params->session_mpool,
5047 ts_params->valid_devs[0],
5048 rte_cryptodev_driver_id_get(
5049 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
5050 BLKCIPHER_DES_CIPHERONLY_TYPE);
5052 TEST_ASSERT_EQUAL(status, 0, "Test failed");
5054 return TEST_SUCCESS;
5058 test_DES_cipheronly_openssl_all(void)
5060 struct crypto_testsuite_params *ts_params = &testsuite_params;
5063 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
5064 ts_params->op_mpool,
5065 ts_params->session_mpool,
5066 ts_params->valid_devs[0],
5067 rte_cryptodev_driver_id_get(
5068 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
5069 BLKCIPHER_DES_CIPHERONLY_TYPE);
5071 TEST_ASSERT_EQUAL(status, 0, "Test failed");
5073 return TEST_SUCCESS;
5077 test_DES_docsis_openssl_all(void)
5079 struct crypto_testsuite_params *ts_params = &testsuite_params;
5082 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
5083 ts_params->op_mpool,
5084 ts_params->session_mpool,
5085 ts_params->valid_devs[0],
5086 rte_cryptodev_driver_id_get(
5087 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
5088 BLKCIPHER_DES_DOCSIS_TYPE);
5090 TEST_ASSERT_EQUAL(status, 0, "Test failed");
5092 return TEST_SUCCESS;
5096 test_DES_cipheronly_mb_all(void)
5098 struct crypto_testsuite_params *ts_params = &testsuite_params;
5101 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
5102 ts_params->op_mpool,
5103 ts_params->session_mpool,
5104 ts_params->valid_devs[0],
5105 rte_cryptodev_driver_id_get(
5106 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
5107 BLKCIPHER_DES_CIPHERONLY_TYPE);
5109 TEST_ASSERT_EQUAL(status, 0, "Test failed");
5111 return TEST_SUCCESS;
5114 test_3DES_cipheronly_mb_all(void)
5116 struct crypto_testsuite_params *ts_params = &testsuite_params;
5119 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
5120 ts_params->op_mpool,
5121 ts_params->session_mpool,
5122 ts_params->valid_devs[0],
5123 rte_cryptodev_driver_id_get(
5124 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
5125 BLKCIPHER_3DES_CIPHERONLY_TYPE);
5127 TEST_ASSERT_EQUAL(status, 0, "Test failed");
5129 return TEST_SUCCESS;
5133 test_DES_docsis_mb_all(void)
5135 struct crypto_testsuite_params *ts_params = &testsuite_params;
5138 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
5139 ts_params->op_mpool,
5140 ts_params->session_mpool,
5141 ts_params->valid_devs[0],
5142 rte_cryptodev_driver_id_get(
5143 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)),
5144 BLKCIPHER_DES_DOCSIS_TYPE);
5146 TEST_ASSERT_EQUAL(status, 0, "Test failed");
5148 return TEST_SUCCESS;
5152 test_3DES_chain_dpaa_sec_all(void)
5154 struct crypto_testsuite_params *ts_params = &testsuite_params;
5157 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
5158 ts_params->op_mpool,
5159 ts_params->session_mpool,
5160 ts_params->valid_devs[0],
5161 rte_cryptodev_driver_id_get(
5162 RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
5163 BLKCIPHER_3DES_CHAIN_TYPE);
5165 TEST_ASSERT_EQUAL(status, 0, "Test failed");
5167 return TEST_SUCCESS;
5171 test_3DES_cipheronly_dpaa_sec_all(void)
5173 struct crypto_testsuite_params *ts_params = &testsuite_params;
5176 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
5177 ts_params->op_mpool,
5178 ts_params->session_mpool,
5179 ts_params->valid_devs[0],
5180 rte_cryptodev_driver_id_get(
5181 RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD)),
5182 BLKCIPHER_3DES_CIPHERONLY_TYPE);
5184 TEST_ASSERT_EQUAL(status, 0, "Test failed");
5186 return TEST_SUCCESS;
5190 test_3DES_chain_dpaa2_sec_all(void)
5192 struct crypto_testsuite_params *ts_params = &testsuite_params;
5195 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
5196 ts_params->op_mpool,
5197 ts_params->session_mpool,
5198 ts_params->valid_devs[0],
5199 rte_cryptodev_driver_id_get(
5200 RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
5201 BLKCIPHER_3DES_CHAIN_TYPE);
5203 TEST_ASSERT_EQUAL(status, 0, "Test failed");
5205 return TEST_SUCCESS;
5209 test_3DES_cipheronly_dpaa2_sec_all(void)
5211 struct crypto_testsuite_params *ts_params = &testsuite_params;
5214 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
5215 ts_params->op_mpool,
5216 ts_params->session_mpool,
5217 ts_params->valid_devs[0],
5218 rte_cryptodev_driver_id_get(
5219 RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD)),
5220 BLKCIPHER_3DES_CIPHERONLY_TYPE);
5222 TEST_ASSERT_EQUAL(status, 0, "Test failed");
5224 return TEST_SUCCESS;
5228 test_3DES_chain_ccp_all(void)
5230 struct crypto_testsuite_params *ts_params = &testsuite_params;
5233 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
5234 ts_params->op_mpool,
5235 ts_params->session_mpool,
5236 ts_params->valid_devs[0],
5237 rte_cryptodev_driver_id_get(
5238 RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
5239 BLKCIPHER_3DES_CHAIN_TYPE);
5241 TEST_ASSERT_EQUAL(status, 0, "Test failed");
5243 return TEST_SUCCESS;
5247 test_3DES_cipheronly_ccp_all(void)
5249 struct crypto_testsuite_params *ts_params = &testsuite_params;
5252 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
5253 ts_params->op_mpool,
5254 ts_params->session_mpool,
5255 ts_params->valid_devs[0],
5256 rte_cryptodev_driver_id_get(
5257 RTE_STR(CRYPTODEV_NAME_CCP_PMD)),
5258 BLKCIPHER_3DES_CIPHERONLY_TYPE);
5260 TEST_ASSERT_EQUAL(status, 0, "Test failed");
5262 return TEST_SUCCESS;
5266 test_3DES_cipheronly_qat_all(void)
5268 struct crypto_testsuite_params *ts_params = &testsuite_params;
5271 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
5272 ts_params->op_mpool,
5273 ts_params->session_mpool,
5274 ts_params->valid_devs[0],
5275 rte_cryptodev_driver_id_get(
5276 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)),
5277 BLKCIPHER_3DES_CIPHERONLY_TYPE);
5279 TEST_ASSERT_EQUAL(status, 0, "Test failed");
5281 return TEST_SUCCESS;
5285 test_3DES_chain_openssl_all(void)
5287 struct crypto_testsuite_params *ts_params = &testsuite_params;
5290 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
5291 ts_params->op_mpool,
5292 ts_params->session_mpool,
5293 ts_params->valid_devs[0],
5294 rte_cryptodev_driver_id_get(
5295 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
5296 BLKCIPHER_3DES_CHAIN_TYPE);
5298 TEST_ASSERT_EQUAL(status, 0, "Test failed");
5300 return TEST_SUCCESS;
5304 test_3DES_cipheronly_openssl_all(void)
5306 struct crypto_testsuite_params *ts_params = &testsuite_params;
5309 status = test_blockcipher_all_tests(ts_params->mbuf_pool,
5310 ts_params->op_mpool,
5311 ts_params->session_mpool,
5312 ts_params->valid_devs[0],
5313 rte_cryptodev_driver_id_get(
5314 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD)),
5315 BLKCIPHER_3DES_CIPHERONLY_TYPE);
5317 TEST_ASSERT_EQUAL(status, 0, "Test failed");
5319 return TEST_SUCCESS;
5322 /* ***** AEAD algorithm Tests ***** */
5325 create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
5326 enum rte_crypto_aead_operation op,
5327 const uint8_t *key, const uint8_t key_len,
5328 const uint16_t aad_len, const uint8_t auth_len,
5331 uint8_t aead_key[key_len];
5333 struct crypto_testsuite_params *ts_params = &testsuite_params;
5334 struct crypto_unittest_params *ut_params = &unittest_params;
5336 memcpy(aead_key, key, key_len);
5338 /* Setup AEAD Parameters */
5339 ut_params->aead_xform.type = RTE_CRYPTO_SYM_XFORM_AEAD;
5340 ut_params->aead_xform.next = NULL;
5341 ut_params->aead_xform.aead.algo = algo;
5342 ut_params->aead_xform.aead.op = op;
5343 ut_params->aead_xform.aead.key.data = aead_key;
5344 ut_params->aead_xform.aead.key.length = key_len;
5345 ut_params->aead_xform.aead.iv.offset = IV_OFFSET;
5346 ut_params->aead_xform.aead.iv.length = iv_len;
5347 ut_params->aead_xform.aead.digest_length = auth_len;
5348 ut_params->aead_xform.aead.aad_length = aad_len;
5350 debug_hexdump(stdout, "key:", key, key_len);
5352 /* Create Crypto session*/
5353 ut_params->sess = rte_cryptodev_sym_session_create(
5354 ts_params->session_mpool);
5356 rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
5357 &ut_params->aead_xform, ts_params->session_mpool);
5359 TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
5365 create_aead_xform(struct rte_crypto_op *op,
5366 enum rte_crypto_aead_algorithm algo,
5367 enum rte_crypto_aead_operation aead_op,
5368 uint8_t *key, const uint8_t key_len,
5369 const uint8_t aad_len, const uint8_t auth_len,
5372 TEST_ASSERT_NOT_NULL(rte_crypto_op_sym_xforms_alloc(op, 1),
5373 "failed to allocate space for crypto transform");
5375 struct rte_crypto_sym_op *sym_op = op->sym;
5377 /* Setup AEAD Parameters */
5378 sym_op->xform->type = RTE_CRYPTO_SYM_XFORM_AEAD;
5379 sym_op->xform->next = NULL;
5380 sym_op->xform->aead.algo = algo;
5381 sym_op->xform->aead.op = aead_op;
5382 sym_op->xform->aead.key.data = key;
5383 sym_op->xform->aead.key.length = key_len;
5384 sym_op->xform->aead.iv.offset = IV_OFFSET;
5385 sym_op->xform->aead.iv.length = iv_len;
5386 sym_op->xform->aead.digest_length = auth_len;
5387 sym_op->xform->aead.aad_length = aad_len;
5389 debug_hexdump(stdout, "key:", key, key_len);
5395 create_aead_operation(enum rte_crypto_aead_operation op,
5396 const struct aead_test_data *tdata)
5398 struct crypto_testsuite_params *ts_params = &testsuite_params;
5399 struct crypto_unittest_params *ut_params = &unittest_params;
5401 uint8_t *plaintext, *ciphertext;
5402 unsigned int aad_pad_len, plaintext_pad_len;
5404 /* Generate Crypto op data structure */
5405 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
5406 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
5407 TEST_ASSERT_NOT_NULL(ut_params->op,
5408 "Failed to allocate symmetric crypto operation struct");
5410 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
5412 /* Append aad data */
5413 if (tdata->algo == RTE_CRYPTO_AEAD_AES_CCM) {
5414 aad_pad_len = RTE_ALIGN_CEIL(tdata->aad.len + 18, 16);
5415 sym_op->aead.aad.data = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
5417 TEST_ASSERT_NOT_NULL(sym_op->aead.aad.data,
5418 "no room to append aad");
5420 sym_op->aead.aad.phys_addr =
5421 rte_pktmbuf_iova(ut_params->ibuf);
5422 /* Copy AAD 18 bytes after the AAD pointer, according to the API */
5423 memcpy(sym_op->aead.aad.data + 18, tdata->aad.data, tdata->aad.len);
5424 debug_hexdump(stdout, "aad:", sym_op->aead.aad.data,
5427 /* Append IV at the end of the crypto operation*/
5428 uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op,
5429 uint8_t *, IV_OFFSET);
5431 /* Copy IV 1 byte after the IV pointer, according to the API */
5432 rte_memcpy(iv_ptr + 1, tdata->iv.data, tdata->iv.len);
5433 debug_hexdump(stdout, "iv:", iv_ptr,
5436 aad_pad_len = RTE_ALIGN_CEIL(tdata->aad.len, 16);
5437 sym_op->aead.aad.data = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
5439 TEST_ASSERT_NOT_NULL(sym_op->aead.aad.data,
5440 "no room to append aad");
5442 sym_op->aead.aad.phys_addr =
5443 rte_pktmbuf_iova(ut_params->ibuf);
5444 memcpy(sym_op->aead.aad.data, tdata->aad.data, tdata->aad.len);
5445 debug_hexdump(stdout, "aad:", sym_op->aead.aad.data,
5448 /* Append IV at the end of the crypto operation*/
5449 uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op,
5450 uint8_t *, IV_OFFSET);
5452 rte_memcpy(iv_ptr, tdata->iv.data, tdata->iv.len);
5453 debug_hexdump(stdout, "iv:", iv_ptr,
5457 /* Append plaintext/ciphertext */
5458 if (op == RTE_CRYPTO_AEAD_OP_ENCRYPT) {
5459 plaintext_pad_len = RTE_ALIGN_CEIL(tdata->plaintext.len, 16);
5460 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
5462 TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext");
5464 memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len);
5465 debug_hexdump(stdout, "plaintext:", plaintext,
5466 tdata->plaintext.len);
5468 if (ut_params->obuf) {
5469 ciphertext = (uint8_t *)rte_pktmbuf_append(
5471 plaintext_pad_len + aad_pad_len);
5472 TEST_ASSERT_NOT_NULL(ciphertext,
5473 "no room to append ciphertext");
5475 memset(ciphertext + aad_pad_len, 0,
5476 tdata->ciphertext.len);
5479 plaintext_pad_len = RTE_ALIGN_CEIL(tdata->ciphertext.len, 16);
5480 ciphertext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
5482 TEST_ASSERT_NOT_NULL(ciphertext,
5483 "no room to append ciphertext");
5485 memcpy(ciphertext, tdata->ciphertext.data,
5486 tdata->ciphertext.len);
5487 debug_hexdump(stdout, "ciphertext:", ciphertext,
5488 tdata->ciphertext.len);
5490 if (ut_params->obuf) {
5491 plaintext = (uint8_t *)rte_pktmbuf_append(
5493 plaintext_pad_len + aad_pad_len);
5494 TEST_ASSERT_NOT_NULL(plaintext,
5495 "no room to append plaintext");
5497 memset(plaintext + aad_pad_len, 0,
5498 tdata->plaintext.len);
5502 /* Append digest data */
5503 if (op == RTE_CRYPTO_AEAD_OP_ENCRYPT) {
5504 sym_op->aead.digest.data = (uint8_t *)rte_pktmbuf_append(
5505 ut_params->obuf ? ut_params->obuf :
5507 tdata->auth_tag.len);
5508 TEST_ASSERT_NOT_NULL(sym_op->aead.digest.data,
5509 "no room to append digest");
5510 memset(sym_op->aead.digest.data, 0, tdata->auth_tag.len);
5511 sym_op->aead.digest.phys_addr = rte_pktmbuf_iova_offset(
5512 ut_params->obuf ? ut_params->obuf :
5517 sym_op->aead.digest.data = (uint8_t *)rte_pktmbuf_append(
5518 ut_params->ibuf, tdata->auth_tag.len);
5519 TEST_ASSERT_NOT_NULL(sym_op->aead.digest.data,
5520 "no room to append digest");
5521 sym_op->aead.digest.phys_addr = rte_pktmbuf_iova_offset(
5523 plaintext_pad_len + aad_pad_len);
5525 rte_memcpy(sym_op->aead.digest.data, tdata->auth_tag.data,
5526 tdata->auth_tag.len);
5527 debug_hexdump(stdout, "digest:",
5528 sym_op->aead.digest.data,
5529 tdata->auth_tag.len);
5532 sym_op->aead.data.length = tdata->plaintext.len;
5533 sym_op->aead.data.offset = aad_pad_len;
5539 test_authenticated_encryption(const struct aead_test_data *tdata)
5541 struct crypto_testsuite_params *ts_params = &testsuite_params;
5542 struct crypto_unittest_params *ut_params = &unittest_params;
5545 uint8_t *ciphertext, *auth_tag;
5546 uint16_t plaintext_pad_len;
5549 /* Create AEAD session */
5550 retval = create_aead_session(ts_params->valid_devs[0],
5552 RTE_CRYPTO_AEAD_OP_ENCRYPT,
5553 tdata->key.data, tdata->key.len,
5554 tdata->aad.len, tdata->auth_tag.len,
5559 if (tdata->aad.len > MBUF_SIZE) {
5560 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->large_mbuf_pool);
5561 /* Populate full size of add data */
5562 for (i = 32; i < MAX_AAD_LENGTH; i += 32)
5563 memcpy(&tdata->aad.data[i], &tdata->aad.data[0], 32);
5565 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
5567 /* clear mbuf payload */
5568 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
5569 rte_pktmbuf_tailroom(ut_params->ibuf));
5571 /* Create AEAD operation */
5572 retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata);
5576 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
5578 ut_params->op->sym->m_src = ut_params->ibuf;
5580 /* Process crypto operation */
5581 TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0],
5582 ut_params->op), "failed to process sym crypto op");
5584 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
5585 "crypto op processing failed");
5587 plaintext_pad_len = RTE_ALIGN_CEIL(tdata->plaintext.len, 16);
5589 if (ut_params->op->sym->m_dst) {
5590 ciphertext = rte_pktmbuf_mtod(ut_params->op->sym->m_dst,
5592 auth_tag = rte_pktmbuf_mtod_offset(ut_params->op->sym->m_dst,
5593 uint8_t *, plaintext_pad_len);
5595 ciphertext = rte_pktmbuf_mtod_offset(ut_params->op->sym->m_src,
5597 ut_params->op->sym->cipher.data.offset);
5598 auth_tag = ciphertext + plaintext_pad_len;
5601 debug_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
5602 debug_hexdump(stdout, "auth tag:", auth_tag, tdata->auth_tag.len);
5605 TEST_ASSERT_BUFFERS_ARE_EQUAL(
5607 tdata->ciphertext.data,
5608 tdata->ciphertext.len,
5609 "Ciphertext data not as expected");
5611 TEST_ASSERT_BUFFERS_ARE_EQUAL(
5613 tdata->auth_tag.data,
5614 tdata->auth_tag.len,
5615 "Generated auth tag not as expected");
5622 test_AES_GCM_authenticated_encryption_test_case_1(void)
5624 return test_authenticated_encryption(&gcm_test_case_1);
5628 test_AES_GCM_authenticated_encryption_test_case_2(void)
5630 return test_authenticated_encryption(&gcm_test_case_2);
5634 test_AES_GCM_authenticated_encryption_test_case_3(void)
5636 return test_authenticated_encryption(&gcm_test_case_3);
5640 test_AES_GCM_authenticated_encryption_test_case_4(void)
5642 return test_authenticated_encryption(&gcm_test_case_4);
5646 test_AES_GCM_authenticated_encryption_test_case_5(void)
5648 return test_authenticated_encryption(&gcm_test_case_5);
5652 test_AES_GCM_authenticated_encryption_test_case_6(void)
5654 return test_authenticated_encryption(&gcm_test_case_6);
5658 test_AES_GCM_authenticated_encryption_test_case_7(void)
5660 return test_authenticated_encryption(&gcm_test_case_7);
5664 test_AES_GCM_auth_encryption_test_case_192_1(void)
5666 return test_authenticated_encryption(&gcm_test_case_192_1);
5670 test_AES_GCM_auth_encryption_test_case_192_2(void)
5672 return test_authenticated_encryption(&gcm_test_case_192_2);
5676 test_AES_GCM_auth_encryption_test_case_192_3(void)
5678 return test_authenticated_encryption(&gcm_test_case_192_3);
5682 test_AES_GCM_auth_encryption_test_case_192_4(void)
5684 return test_authenticated_encryption(&gcm_test_case_192_4);
5688 test_AES_GCM_auth_encryption_test_case_192_5(void)
5690 return test_authenticated_encryption(&gcm_test_case_192_5);
5694 test_AES_GCM_auth_encryption_test_case_192_6(void)
5696 return test_authenticated_encryption(&gcm_test_case_192_6);
5700 test_AES_GCM_auth_encryption_test_case_192_7(void)
5702 return test_authenticated_encryption(&gcm_test_case_192_7);
5706 test_AES_GCM_auth_encryption_test_case_256_1(void)
5708 return test_authenticated_encryption(&gcm_test_case_256_1);
5712 test_AES_GCM_auth_encryption_test_case_256_2(void)
5714 return test_authenticated_encryption(&gcm_test_case_256_2);
5718 test_AES_GCM_auth_encryption_test_case_256_3(void)
5720 return test_authenticated_encryption(&gcm_test_case_256_3);
5724 test_AES_GCM_auth_encryption_test_case_256_4(void)
5726 return test_authenticated_encryption(&gcm_test_case_256_4);
5730 test_AES_GCM_auth_encryption_test_case_256_5(void)
5732 return test_authenticated_encryption(&gcm_test_case_256_5);
5736 test_AES_GCM_auth_encryption_test_case_256_6(void)
5738 return test_authenticated_encryption(&gcm_test_case_256_6);
5742 test_AES_GCM_auth_encryption_test_case_256_7(void)
5744 return test_authenticated_encryption(&gcm_test_case_256_7);
5748 test_AES_GCM_auth_encryption_test_case_aad_1(void)
5750 return test_authenticated_encryption(&gcm_test_case_aad_1);
5754 test_AES_GCM_auth_encryption_test_case_aad_2(void)
5756 return test_authenticated_encryption(&gcm_test_case_aad_2);
5760 test_authenticated_decryption(const struct aead_test_data *tdata)
5762 struct crypto_testsuite_params *ts_params = &testsuite_params;
5763 struct crypto_unittest_params *ut_params = &unittest_params;
5769 /* Create AEAD session */
5770 retval = create_aead_session(ts_params->valid_devs[0],
5772 RTE_CRYPTO_AEAD_OP_DECRYPT,
5773 tdata->key.data, tdata->key.len,
5774 tdata->aad.len, tdata->auth_tag.len,
5779 /* alloc mbuf and set payload */
5780 if (tdata->aad.len > MBUF_SIZE) {
5781 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->large_mbuf_pool);
5782 /* Populate full size of add data */
5783 for (i = 32; i < MAX_AAD_LENGTH; i += 32)
5784 memcpy(&tdata->aad.data[i], &tdata->aad.data[0], 32);
5786 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
5788 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
5789 rte_pktmbuf_tailroom(ut_params->ibuf));
5791 /* Create AEAD operation */
5792 retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata);
5796 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
5798 ut_params->op->sym->m_src = ut_params->ibuf;
5800 /* Process crypto operation */
5801 TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0],
5802 ut_params->op), "failed to process sym crypto op");
5804 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
5805 "crypto op processing failed");
5807 if (ut_params->op->sym->m_dst)
5808 plaintext = rte_pktmbuf_mtod(ut_params->op->sym->m_dst,
5811 plaintext = rte_pktmbuf_mtod_offset(ut_params->op->sym->m_src,
5813 ut_params->op->sym->cipher.data.offset);
5815 debug_hexdump(stdout, "plaintext:", plaintext, tdata->ciphertext.len);
5818 TEST_ASSERT_BUFFERS_ARE_EQUAL(
5820 tdata->plaintext.data,
5821 tdata->plaintext.len,
5822 "Plaintext data not as expected");
5824 TEST_ASSERT_EQUAL(ut_params->op->status,
5825 RTE_CRYPTO_OP_STATUS_SUCCESS,
5826 "Authentication failed");
5831 test_AES_GCM_authenticated_decryption_test_case_1(void)
5833 return test_authenticated_decryption(&gcm_test_case_1);
5837 test_AES_GCM_authenticated_decryption_test_case_2(void)
5839 return test_authenticated_decryption(&gcm_test_case_2);
5843 test_AES_GCM_authenticated_decryption_test_case_3(void)
5845 return test_authenticated_decryption(&gcm_test_case_3);
5849 test_AES_GCM_authenticated_decryption_test_case_4(void)
5851 return test_authenticated_decryption(&gcm_test_case_4);
5855 test_AES_GCM_authenticated_decryption_test_case_5(void)
5857 return test_authenticated_decryption(&gcm_test_case_5);
5861 test_AES_GCM_authenticated_decryption_test_case_6(void)
5863 return test_authenticated_decryption(&gcm_test_case_6);
5867 test_AES_GCM_authenticated_decryption_test_case_7(void)
5869 return test_authenticated_decryption(&gcm_test_case_7);
5873 test_AES_GCM_auth_decryption_test_case_192_1(void)
5875 return test_authenticated_decryption(&gcm_test_case_192_1);
5879 test_AES_GCM_auth_decryption_test_case_192_2(void)
5881 return test_authenticated_decryption(&gcm_test_case_192_2);
5885 test_AES_GCM_auth_decryption_test_case_192_3(void)
5887 return test_authenticated_decryption(&gcm_test_case_192_3);
5891 test_AES_GCM_auth_decryption_test_case_192_4(void)
5893 return test_authenticated_decryption(&gcm_test_case_192_4);
5897 test_AES_GCM_auth_decryption_test_case_192_5(void)
5899 return test_authenticated_decryption(&gcm_test_case_192_5);
5903 test_AES_GCM_auth_decryption_test_case_192_6(void)
5905 return test_authenticated_decryption(&gcm_test_case_192_6);
5909 test_AES_GCM_auth_decryption_test_case_192_7(void)
5911 return test_authenticated_decryption(&gcm_test_case_192_7);
5915 test_AES_GCM_auth_decryption_test_case_256_1(void)
5917 return test_authenticated_decryption(&gcm_test_case_256_1);
5921 test_AES_GCM_auth_decryption_test_case_256_2(void)
5923 return test_authenticated_decryption(&gcm_test_case_256_2);
5927 test_AES_GCM_auth_decryption_test_case_256_3(void)
5929 return test_authenticated_decryption(&gcm_test_case_256_3);
5933 test_AES_GCM_auth_decryption_test_case_256_4(void)
5935 return test_authenticated_decryption(&gcm_test_case_256_4);
5939 test_AES_GCM_auth_decryption_test_case_256_5(void)
5941 return test_authenticated_decryption(&gcm_test_case_256_5);
5945 test_AES_GCM_auth_decryption_test_case_256_6(void)
5947 return test_authenticated_decryption(&gcm_test_case_256_6);
5951 test_AES_GCM_auth_decryption_test_case_256_7(void)
5953 return test_authenticated_decryption(&gcm_test_case_256_7);
5957 test_AES_GCM_auth_decryption_test_case_aad_1(void)
5959 return test_authenticated_decryption(&gcm_test_case_aad_1);
5963 test_AES_GCM_auth_decryption_test_case_aad_2(void)
5965 return test_authenticated_decryption(&gcm_test_case_aad_2);
5969 test_authenticated_encryption_oop(const struct aead_test_data *tdata)
5971 struct crypto_testsuite_params *ts_params = &testsuite_params;
5972 struct crypto_unittest_params *ut_params = &unittest_params;
5975 uint8_t *ciphertext, *auth_tag;
5976 uint16_t plaintext_pad_len;
5978 /* Create AEAD session */
5979 retval = create_aead_session(ts_params->valid_devs[0],
5981 RTE_CRYPTO_AEAD_OP_ENCRYPT,
5982 tdata->key.data, tdata->key.len,
5983 tdata->aad.len, tdata->auth_tag.len,
5988 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
5989 ut_params->obuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
5991 /* clear mbuf payload */
5992 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
5993 rte_pktmbuf_tailroom(ut_params->ibuf));
5994 memset(rte_pktmbuf_mtod(ut_params->obuf, uint8_t *), 0,
5995 rte_pktmbuf_tailroom(ut_params->obuf));
5997 /* Create AEAD operation */
5998 retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata);
6002 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
6004 ut_params->op->sym->m_src = ut_params->ibuf;
6005 ut_params->op->sym->m_dst = ut_params->obuf;
6007 /* Process crypto operation */
6008 TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0],
6009 ut_params->op), "failed to process sym crypto op");
6011 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
6012 "crypto op processing failed");
6014 plaintext_pad_len = RTE_ALIGN_CEIL(tdata->plaintext.len, 16);
6016 ciphertext = rte_pktmbuf_mtod_offset(ut_params->obuf, uint8_t *,
6017 ut_params->op->sym->cipher.data.offset);
6018 auth_tag = ciphertext + plaintext_pad_len;
6020 debug_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
6021 debug_hexdump(stdout, "auth tag:", auth_tag, tdata->auth_tag.len);
6024 TEST_ASSERT_BUFFERS_ARE_EQUAL(
6026 tdata->ciphertext.data,
6027 tdata->ciphertext.len,
6028 "Ciphertext data not as expected");
6030 TEST_ASSERT_BUFFERS_ARE_EQUAL(
6032 tdata->auth_tag.data,
6033 tdata->auth_tag.len,
6034 "Generated auth tag not as expected");
6041 test_AES_GCM_authenticated_encryption_oop_test_case_1(void)
6043 return test_authenticated_encryption_oop(&gcm_test_case_5);
6047 test_authenticated_decryption_oop(const struct aead_test_data *tdata)
6049 struct crypto_testsuite_params *ts_params = &testsuite_params;
6050 struct crypto_unittest_params *ut_params = &unittest_params;
6055 /* Create AEAD session */
6056 retval = create_aead_session(ts_params->valid_devs[0],
6058 RTE_CRYPTO_AEAD_OP_DECRYPT,
6059 tdata->key.data, tdata->key.len,
6060 tdata->aad.len, tdata->auth_tag.len,
6065 /* alloc mbuf and set payload */
6066 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
6067 ut_params->obuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
6069 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
6070 rte_pktmbuf_tailroom(ut_params->ibuf));
6071 memset(rte_pktmbuf_mtod(ut_params->obuf, uint8_t *), 0,
6072 rte_pktmbuf_tailroom(ut_params->obuf));
6074 /* Create AEAD operation */
6075 retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata);
6079 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
6081 ut_params->op->sym->m_src = ut_params->ibuf;
6082 ut_params->op->sym->m_dst = ut_params->obuf;
6084 /* Process crypto operation */
6085 TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0],
6086 ut_params->op), "failed to process sym crypto op");
6088 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
6089 "crypto op processing failed");
6091 plaintext = rte_pktmbuf_mtod_offset(ut_params->obuf, uint8_t *,
6092 ut_params->op->sym->cipher.data.offset);
6094 debug_hexdump(stdout, "plaintext:", plaintext, tdata->ciphertext.len);
6097 TEST_ASSERT_BUFFERS_ARE_EQUAL(
6099 tdata->plaintext.data,
6100 tdata->plaintext.len,
6101 "Plaintext data not as expected");
6103 TEST_ASSERT_EQUAL(ut_params->op->status,
6104 RTE_CRYPTO_OP_STATUS_SUCCESS,
6105 "Authentication failed");
6110 test_AES_GCM_authenticated_decryption_oop_test_case_1(void)
6112 return test_authenticated_decryption_oop(&gcm_test_case_5);
6116 test_authenticated_encryption_sessionless(
6117 const struct aead_test_data *tdata)
6119 struct crypto_testsuite_params *ts_params = &testsuite_params;
6120 struct crypto_unittest_params *ut_params = &unittest_params;
6123 uint8_t *ciphertext, *auth_tag;
6124 uint16_t plaintext_pad_len;
6125 uint8_t key[tdata->key.len + 1];
6127 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
6129 /* clear mbuf payload */
6130 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
6131 rte_pktmbuf_tailroom(ut_params->ibuf));
6133 /* Create AEAD operation */
6134 retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_ENCRYPT, tdata);
6138 /* Create GCM xform */
6139 memcpy(key, tdata->key.data, tdata->key.len);
6140 retval = create_aead_xform(ut_params->op,
6142 RTE_CRYPTO_AEAD_OP_ENCRYPT,
6143 key, tdata->key.len,
6144 tdata->aad.len, tdata->auth_tag.len,
6149 ut_params->op->sym->m_src = ut_params->ibuf;
6151 TEST_ASSERT_EQUAL(ut_params->op->sess_type,
6152 RTE_CRYPTO_OP_SESSIONLESS,
6153 "crypto op session type not sessionless");
6155 /* Process crypto operation */
6156 TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0],
6157 ut_params->op), "failed to process sym crypto op");
6159 TEST_ASSERT_NOT_NULL(ut_params->op, "failed crypto process");
6161 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
6162 "crypto op status not success");
6164 plaintext_pad_len = RTE_ALIGN_CEIL(tdata->plaintext.len, 16);
6166 ciphertext = rte_pktmbuf_mtod_offset(ut_params->ibuf, uint8_t *,
6167 ut_params->op->sym->cipher.data.offset);
6168 auth_tag = ciphertext + plaintext_pad_len;
6170 debug_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
6171 debug_hexdump(stdout, "auth tag:", auth_tag, tdata->auth_tag.len);
6174 TEST_ASSERT_BUFFERS_ARE_EQUAL(
6176 tdata->ciphertext.data,
6177 tdata->ciphertext.len,
6178 "Ciphertext data not as expected");
6180 TEST_ASSERT_BUFFERS_ARE_EQUAL(
6182 tdata->auth_tag.data,
6183 tdata->auth_tag.len,
6184 "Generated auth tag not as expected");
6191 test_AES_GCM_authenticated_encryption_sessionless_test_case_1(void)
6193 return test_authenticated_encryption_sessionless(
6198 test_authenticated_decryption_sessionless(
6199 const struct aead_test_data *tdata)
6201 struct crypto_testsuite_params *ts_params = &testsuite_params;
6202 struct crypto_unittest_params *ut_params = &unittest_params;
6206 uint8_t key[tdata->key.len + 1];
6208 /* alloc mbuf and set payload */
6209 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
6211 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
6212 rte_pktmbuf_tailroom(ut_params->ibuf));
6214 /* Create AEAD operation */
6215 retval = create_aead_operation(RTE_CRYPTO_AEAD_OP_DECRYPT, tdata);
6219 /* Create AEAD xform */
6220 memcpy(key, tdata->key.data, tdata->key.len);
6221 retval = create_aead_xform(ut_params->op,
6223 RTE_CRYPTO_AEAD_OP_DECRYPT,
6224 key, tdata->key.len,
6225 tdata->aad.len, tdata->auth_tag.len,
6230 ut_params->op->sym->m_src = ut_params->ibuf;
6232 TEST_ASSERT_EQUAL(ut_params->op->sess_type,
6233 RTE_CRYPTO_OP_SESSIONLESS,
6234 "crypto op session type not sessionless");
6236 /* Process crypto operation */
6237 TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0],
6238 ut_params->op), "failed to process sym crypto op");
6240 TEST_ASSERT_NOT_NULL(ut_params->op, "failed crypto process");
6242 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
6243 "crypto op status not success");
6245 plaintext = rte_pktmbuf_mtod_offset(ut_params->ibuf, uint8_t *,
6246 ut_params->op->sym->cipher.data.offset);
6248 debug_hexdump(stdout, "plaintext:", plaintext, tdata->ciphertext.len);
6251 TEST_ASSERT_BUFFERS_ARE_EQUAL(
6253 tdata->plaintext.data,
6254 tdata->plaintext.len,
6255 "Plaintext data not as expected");
6257 TEST_ASSERT_EQUAL(ut_params->op->status,
6258 RTE_CRYPTO_OP_STATUS_SUCCESS,
6259 "Authentication failed");
6264 test_AES_GCM_authenticated_decryption_sessionless_test_case_1(void)
6266 return test_authenticated_decryption_sessionless(
6271 test_AES_CCM_authenticated_encryption_test_case_128_1(void)
6273 return test_authenticated_encryption(&ccm_test_case_128_1);
6277 test_AES_CCM_authenticated_encryption_test_case_128_2(void)
6279 return test_authenticated_encryption(&ccm_test_case_128_2);
6283 test_AES_CCM_authenticated_encryption_test_case_128_3(void)
6285 return test_authenticated_encryption(&ccm_test_case_128_3);
6289 test_AES_CCM_authenticated_decryption_test_case_128_1(void)
6291 return test_authenticated_decryption(&ccm_test_case_128_1);
6295 test_AES_CCM_authenticated_decryption_test_case_128_2(void)
6297 return test_authenticated_decryption(&ccm_test_case_128_2);
6301 test_AES_CCM_authenticated_decryption_test_case_128_3(void)
6303 return test_authenticated_decryption(&ccm_test_case_128_3);
6307 test_AES_CCM_authenticated_encryption_test_case_192_1(void)
6309 return test_authenticated_encryption(&ccm_test_case_192_1);
6313 test_AES_CCM_authenticated_encryption_test_case_192_2(void)
6315 return test_authenticated_encryption(&ccm_test_case_192_2);
6319 test_AES_CCM_authenticated_encryption_test_case_192_3(void)
6321 return test_authenticated_encryption(&ccm_test_case_192_3);
6325 test_AES_CCM_authenticated_decryption_test_case_192_1(void)
6327 return test_authenticated_decryption(&ccm_test_case_192_1);
6331 test_AES_CCM_authenticated_decryption_test_case_192_2(void)
6333 return test_authenticated_decryption(&ccm_test_case_192_2);
6337 test_AES_CCM_authenticated_decryption_test_case_192_3(void)
6339 return test_authenticated_decryption(&ccm_test_case_192_3);
6343 test_AES_CCM_authenticated_encryption_test_case_256_1(void)
6345 return test_authenticated_encryption(&ccm_test_case_256_1);
6349 test_AES_CCM_authenticated_encryption_test_case_256_2(void)
6351 return test_authenticated_encryption(&ccm_test_case_256_2);
6355 test_AES_CCM_authenticated_encryption_test_case_256_3(void)
6357 return test_authenticated_encryption(&ccm_test_case_256_3);
6361 test_AES_CCM_authenticated_decryption_test_case_256_1(void)
6363 return test_authenticated_decryption(&ccm_test_case_256_1);
6367 test_AES_CCM_authenticated_decryption_test_case_256_2(void)
6369 return test_authenticated_decryption(&ccm_test_case_256_2);
6373 test_AES_CCM_authenticated_decryption_test_case_256_3(void)
6375 return test_authenticated_decryption(&ccm_test_case_256_3);
6381 struct crypto_testsuite_params *ts_params = &testsuite_params;
6382 struct rte_cryptodev_stats stats;
6383 struct rte_cryptodev *dev;
6384 cryptodev_stats_get_t temp_pfn;
6386 rte_cryptodev_stats_reset(ts_params->valid_devs[0]);
6387 TEST_ASSERT((rte_cryptodev_stats_get(ts_params->valid_devs[0] + 600,
6388 &stats) == -ENODEV),
6389 "rte_cryptodev_stats_get invalid dev failed");
6390 TEST_ASSERT((rte_cryptodev_stats_get(ts_params->valid_devs[0], 0) != 0),
6391 "rte_cryptodev_stats_get invalid Param failed");
6392 dev = &rte_cryptodevs[ts_params->valid_devs[0]];
6393 temp_pfn = dev->dev_ops->stats_get;
6394 dev->dev_ops->stats_get = (cryptodev_stats_get_t)0;
6395 TEST_ASSERT((rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats)
6397 "rte_cryptodev_stats_get invalid Param failed");
6398 dev->dev_ops->stats_get = temp_pfn;
6400 /* Test expected values */
6402 test_AES_CBC_HMAC_SHA1_encrypt_digest();
6404 TEST_ASSERT_SUCCESS(rte_cryptodev_stats_get(ts_params->valid_devs[0],
6406 "rte_cryptodev_stats_get failed");
6407 TEST_ASSERT((stats.enqueued_count == 1),
6408 "rte_cryptodev_stats_get returned unexpected enqueued stat");
6409 TEST_ASSERT((stats.dequeued_count == 1),
6410 "rte_cryptodev_stats_get returned unexpected enqueued stat");
6411 TEST_ASSERT((stats.enqueue_err_count == 0),
6412 "rte_cryptodev_stats_get returned unexpected enqueued stat");
6413 TEST_ASSERT((stats.dequeue_err_count == 0),
6414 "rte_cryptodev_stats_get returned unexpected enqueued stat");
6416 /* invalid device but should ignore and not reset device stats*/
6417 rte_cryptodev_stats_reset(ts_params->valid_devs[0] + 300);
6418 TEST_ASSERT_SUCCESS(rte_cryptodev_stats_get(ts_params->valid_devs[0],
6420 "rte_cryptodev_stats_get failed");
6421 TEST_ASSERT((stats.enqueued_count == 1),
6422 "rte_cryptodev_stats_get returned unexpected enqueued stat");
6424 /* check that a valid reset clears stats */
6425 rte_cryptodev_stats_reset(ts_params->valid_devs[0]);
6426 TEST_ASSERT_SUCCESS(rte_cryptodev_stats_get(ts_params->valid_devs[0],
6428 "rte_cryptodev_stats_get failed");
6429 TEST_ASSERT((stats.enqueued_count == 0),
6430 "rte_cryptodev_stats_get returned unexpected enqueued stat");
6431 TEST_ASSERT((stats.dequeued_count == 0),
6432 "rte_cryptodev_stats_get returned unexpected enqueued stat");
6434 return TEST_SUCCESS;
6437 static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
6438 struct crypto_unittest_params *ut_params,
6439 enum rte_crypto_auth_operation op,
6440 const struct HMAC_MD5_vector *test_case)
6444 memcpy(key, test_case->key.data, test_case->key.len);
6446 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
6447 ut_params->auth_xform.next = NULL;
6448 ut_params->auth_xform.auth.op = op;
6450 ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_MD5_HMAC;
6452 ut_params->auth_xform.auth.digest_length = MD5_DIGEST_LEN;
6453 ut_params->auth_xform.auth.key.length = test_case->key.len;
6454 ut_params->auth_xform.auth.key.data = key;
6456 ut_params->sess = rte_cryptodev_sym_session_create(
6457 ts_params->session_mpool);
6459 rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
6460 ut_params->sess, &ut_params->auth_xform,
6461 ts_params->session_mpool);
6463 if (ut_params->sess == NULL)
6466 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
6468 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
6469 rte_pktmbuf_tailroom(ut_params->ibuf));
6474 static int MD5_HMAC_create_op(struct crypto_unittest_params *ut_params,
6475 const struct HMAC_MD5_vector *test_case,
6476 uint8_t **plaintext)
6478 uint16_t plaintext_pad_len;
6480 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
6482 plaintext_pad_len = RTE_ALIGN_CEIL(test_case->plaintext.len,
6485 *plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
6487 memcpy(*plaintext, test_case->plaintext.data,
6488 test_case->plaintext.len);
6490 sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
6491 ut_params->ibuf, MD5_DIGEST_LEN);
6492 TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
6493 "no room to append digest");
6494 sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
6495 ut_params->ibuf, plaintext_pad_len);
6497 if (ut_params->auth_xform.auth.op == RTE_CRYPTO_AUTH_OP_VERIFY) {
6498 rte_memcpy(sym_op->auth.digest.data, test_case->auth_tag.data,
6499 test_case->auth_tag.len);
6502 sym_op->auth.data.offset = 0;
6503 sym_op->auth.data.length = test_case->plaintext.len;
6505 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
6506 ut_params->op->sym->m_src = ut_params->ibuf;
6512 test_MD5_HMAC_generate(const struct HMAC_MD5_vector *test_case)
6514 uint16_t plaintext_pad_len;
6515 uint8_t *plaintext, *auth_tag;
6517 struct crypto_testsuite_params *ts_params = &testsuite_params;
6518 struct crypto_unittest_params *ut_params = &unittest_params;
6520 if (MD5_HMAC_create_session(ts_params, ut_params,
6521 RTE_CRYPTO_AUTH_OP_GENERATE, test_case))
6524 /* Generate Crypto op data structure */
6525 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
6526 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
6527 TEST_ASSERT_NOT_NULL(ut_params->op,
6528 "Failed to allocate symmetric crypto operation struct");
6530 plaintext_pad_len = RTE_ALIGN_CEIL(test_case->plaintext.len,
6533 if (MD5_HMAC_create_op(ut_params, test_case, &plaintext))
6536 TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0],
6537 ut_params->op), "failed to process sym crypto op");
6539 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
6540 "crypto op processing failed");
6542 if (ut_params->op->sym->m_dst) {
6543 auth_tag = rte_pktmbuf_mtod_offset(ut_params->op->sym->m_dst,
6544 uint8_t *, plaintext_pad_len);
6546 auth_tag = plaintext + plaintext_pad_len;
6549 TEST_ASSERT_BUFFERS_ARE_EQUAL(
6551 test_case->auth_tag.data,
6552 test_case->auth_tag.len,
6553 "HMAC_MD5 generated tag not as expected");
6555 return TEST_SUCCESS;
6559 test_MD5_HMAC_verify(const struct HMAC_MD5_vector *test_case)
6563 struct crypto_testsuite_params *ts_params = &testsuite_params;
6564 struct crypto_unittest_params *ut_params = &unittest_params;
6566 if (MD5_HMAC_create_session(ts_params, ut_params,
6567 RTE_CRYPTO_AUTH_OP_VERIFY, test_case)) {
6571 /* Generate Crypto op data structure */
6572 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
6573 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
6574 TEST_ASSERT_NOT_NULL(ut_params->op,
6575 "Failed to allocate symmetric crypto operation struct");
6577 if (MD5_HMAC_create_op(ut_params, test_case, &plaintext))
6580 TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0],
6581 ut_params->op), "failed to process sym crypto op");
6583 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
6584 "HMAC_MD5 crypto op processing failed");
6586 return TEST_SUCCESS;
6590 test_MD5_HMAC_generate_case_1(void)
6592 return test_MD5_HMAC_generate(&HMAC_MD5_test_case_1);
6596 test_MD5_HMAC_verify_case_1(void)
6598 return test_MD5_HMAC_verify(&HMAC_MD5_test_case_1);
6602 test_MD5_HMAC_generate_case_2(void)
6604 return test_MD5_HMAC_generate(&HMAC_MD5_test_case_2);
6608 test_MD5_HMAC_verify_case_2(void)
6610 return test_MD5_HMAC_verify(&HMAC_MD5_test_case_2);
6614 test_multi_session(void)
6616 struct crypto_testsuite_params *ts_params = &testsuite_params;
6617 struct crypto_unittest_params *ut_params = &unittest_params;
6619 struct rte_cryptodev_info dev_info;
6620 struct rte_cryptodev_sym_session **sessions;
6624 test_AES_CBC_HMAC_SHA512_decrypt_create_session_params(ut_params,
6625 aes_cbc_key, hmac_sha512_key);
6628 rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
6630 sessions = rte_malloc(NULL,
6631 (sizeof(struct rte_cryptodev_sym_session *) *
6632 MAX_NB_SESSIONS) + 1, 0);
6634 /* Create multiple crypto sessions*/
6635 for (i = 0; i < MAX_NB_SESSIONS; i++) {
6637 sessions[i] = rte_cryptodev_sym_session_create(
6638 ts_params->session_mpool);
6640 rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
6641 sessions[i], &ut_params->auth_xform,
6642 ts_params->session_mpool);
6643 TEST_ASSERT_NOT_NULL(sessions[i],
6644 "Session creation failed at session number %u",
6647 /* Attempt to send a request on each session */
6648 TEST_ASSERT_SUCCESS( test_AES_CBC_HMAC_SHA512_decrypt_perform(
6652 catch_22_quote_2_512_bytes_AES_CBC_ciphertext,
6653 catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA512_digest,
6655 "Failed to perform decrypt on request number %u.", i);
6656 /* free crypto operation structure */
6658 rte_crypto_op_free(ut_params->op);
6661 * free mbuf - both obuf and ibuf are usually the same,
6662 * so check if they point at the same address is necessary,
6663 * to avoid freeing the mbuf twice.
6665 if (ut_params->obuf) {
6666 rte_pktmbuf_free(ut_params->obuf);
6667 if (ut_params->ibuf == ut_params->obuf)
6668 ut_params->ibuf = 0;
6669 ut_params->obuf = 0;
6671 if (ut_params->ibuf) {
6672 rte_pktmbuf_free(ut_params->ibuf);
6673 ut_params->ibuf = 0;
6677 /* Next session create should fail */
6678 rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
6679 sessions[i], &ut_params->auth_xform,
6680 ts_params->session_mpool);
6681 TEST_ASSERT_NULL(sessions[i],
6682 "Session creation succeeded unexpectedly!");
6684 for (i = 0; i < MAX_NB_SESSIONS; i++) {
6685 rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
6687 rte_cryptodev_sym_session_free(sessions[i]);
6692 return TEST_SUCCESS;
6695 struct multi_session_params {
6696 struct crypto_unittest_params ut_params;
6697 uint8_t *cipher_key;
6699 const uint8_t *cipher;
6700 const uint8_t *digest;
6704 #define MB_SESSION_NUMBER 3
6707 test_multi_session_random_usage(void)
6709 struct crypto_testsuite_params *ts_params = &testsuite_params;
6710 struct rte_cryptodev_info dev_info;
6711 struct rte_cryptodev_sym_session **sessions;
6713 struct multi_session_params ut_paramz[] = {
6716 .cipher_key = ms_aes_cbc_key0,
6717 .hmac_key = ms_hmac_key0,
6718 .cipher = ms_aes_cbc_cipher0,
6719 .digest = ms_hmac_digest0,
6720 .iv = ms_aes_cbc_iv0
6723 .cipher_key = ms_aes_cbc_key1,
6724 .hmac_key = ms_hmac_key1,
6725 .cipher = ms_aes_cbc_cipher1,
6726 .digest = ms_hmac_digest1,
6727 .iv = ms_aes_cbc_iv1
6730 .cipher_key = ms_aes_cbc_key2,
6731 .hmac_key = ms_hmac_key2,
6732 .cipher = ms_aes_cbc_cipher2,
6733 .digest = ms_hmac_digest2,
6734 .iv = ms_aes_cbc_iv2
6739 rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
6741 sessions = rte_malloc(NULL,
6742 (sizeof(struct rte_cryptodev_sym_session *)
6743 * MAX_NB_SESSIONS) + 1, 0);
6745 for (i = 0; i < MB_SESSION_NUMBER; i++) {
6746 sessions[i] = rte_cryptodev_sym_session_create(
6747 ts_params->session_mpool);
6749 rte_memcpy(&ut_paramz[i].ut_params, &unittest_params,
6750 sizeof(struct crypto_unittest_params));
6752 test_AES_CBC_HMAC_SHA512_decrypt_create_session_params(
6753 &ut_paramz[i].ut_params,
6754 ut_paramz[i].cipher_key, ut_paramz[i].hmac_key);
6756 /* Create multiple crypto sessions*/
6757 rte_cryptodev_sym_session_init(
6758 ts_params->valid_devs[0],
6760 &ut_paramz[i].ut_params.auth_xform,
6761 ts_params->session_mpool);
6763 TEST_ASSERT_NOT_NULL(sessions[i],
6764 "Session creation failed at session number %u",
6770 for (i = 0; i < 40000; i++) {
6772 j = rand() % MB_SESSION_NUMBER;
6774 TEST_ASSERT_SUCCESS(
6775 test_AES_CBC_HMAC_SHA512_decrypt_perform(
6777 &ut_paramz[j].ut_params,
6778 ts_params, ut_paramz[j].cipher,
6779 ut_paramz[j].digest,
6781 "Failed to perform decrypt on request number %u.", i);
6783 if (ut_paramz[j].ut_params.op)
6784 rte_crypto_op_free(ut_paramz[j].ut_params.op);
6787 * free mbuf - both obuf and ibuf are usually the same,
6788 * so check if they point at the same address is necessary,
6789 * to avoid freeing the mbuf twice.
6791 if (ut_paramz[j].ut_params.obuf) {
6792 rte_pktmbuf_free(ut_paramz[j].ut_params.obuf);
6793 if (ut_paramz[j].ut_params.ibuf
6794 == ut_paramz[j].ut_params.obuf)
6795 ut_paramz[j].ut_params.ibuf = 0;
6796 ut_paramz[j].ut_params.obuf = 0;
6798 if (ut_paramz[j].ut_params.ibuf) {
6799 rte_pktmbuf_free(ut_paramz[j].ut_params.ibuf);
6800 ut_paramz[j].ut_params.ibuf = 0;
6804 for (i = 0; i < MB_SESSION_NUMBER; i++) {
6805 rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
6807 rte_cryptodev_sym_session_free(sessions[i]);
6812 return TEST_SUCCESS;
6816 test_null_cipher_only_operation(void)
6818 struct crypto_testsuite_params *ts_params = &testsuite_params;
6819 struct crypto_unittest_params *ut_params = &unittest_params;
6821 /* Generate test mbuf data and space for digest */
6822 ut_params->ibuf = setup_test_string(ts_params->mbuf_pool,
6823 catch_22_quote, QUOTE_512_BYTES, 0);
6825 /* Setup Cipher Parameters */
6826 ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
6827 ut_params->cipher_xform.next = NULL;
6829 ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_NULL;
6830 ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
6832 ut_params->sess = rte_cryptodev_sym_session_create(
6833 ts_params->session_mpool);
6835 /* Create Crypto session*/
6836 rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
6838 &ut_params->cipher_xform,
6839 ts_params->session_mpool);
6840 TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
6842 /* Generate Crypto op data structure */
6843 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
6844 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
6845 TEST_ASSERT_NOT_NULL(ut_params->op,
6846 "Failed to allocate symmetric crypto operation struct");
6848 /* Set crypto operation data parameters */
6849 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
6851 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
6853 /* set crypto operation source mbuf */
6854 sym_op->m_src = ut_params->ibuf;
6856 sym_op->cipher.data.offset = 0;
6857 sym_op->cipher.data.length = QUOTE_512_BYTES;
6859 /* Process crypto operation */
6860 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
6862 TEST_ASSERT_NOT_NULL(ut_params->op, "no crypto operation returned");
6864 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
6865 "crypto operation processing failed");
6868 TEST_ASSERT_BUFFERS_ARE_EQUAL(
6869 rte_pktmbuf_mtod(ut_params->op->sym->m_src, uint8_t *),
6872 "Ciphertext data not as expected");
6874 return TEST_SUCCESS;
6876 uint8_t orig_data[] = {0xab, 0xab, 0xab, 0xab,
6877 0xab, 0xab, 0xab, 0xab,
6878 0xab, 0xab, 0xab, 0xab,
6879 0xab, 0xab, 0xab, 0xab};
6881 test_null_auth_only_operation(void)
6883 struct crypto_testsuite_params *ts_params = &testsuite_params;
6884 struct crypto_unittest_params *ut_params = &unittest_params;
6887 /* Generate test mbuf data and space for digest */
6888 ut_params->ibuf = setup_test_string(ts_params->mbuf_pool,
6889 catch_22_quote, QUOTE_512_BYTES, 0);
6891 /* create a pointer for digest, but don't expect anything to be written
6892 * here in a NULL auth algo so no mbuf append done.
6894 digest = rte_pktmbuf_mtod_offset(ut_params->ibuf, uint8_t *,
6896 /* prefill the memory pointed to by digest */
6897 memcpy(digest, orig_data, sizeof(orig_data));
6899 /* Setup HMAC Parameters */
6900 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
6901 ut_params->auth_xform.next = NULL;
6903 ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
6904 ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
6906 ut_params->sess = rte_cryptodev_sym_session_create(
6907 ts_params->session_mpool);
6909 /* Create Crypto session*/
6910 rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
6911 ut_params->sess, &ut_params->auth_xform,
6912 ts_params->session_mpool);
6913 TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
6915 /* Generate Crypto op data structure */
6916 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
6917 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
6918 TEST_ASSERT_NOT_NULL(ut_params->op,
6919 "Failed to allocate symmetric crypto operation struct");
6921 /* Set crypto operation data parameters */
6922 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
6924 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
6926 sym_op->m_src = ut_params->ibuf;
6928 sym_op->auth.data.offset = 0;
6929 sym_op->auth.data.length = QUOTE_512_BYTES;
6930 sym_op->auth.digest.data = digest;
6931 sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(ut_params->ibuf,
6934 /* Process crypto operation */
6935 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
6937 TEST_ASSERT_NOT_NULL(ut_params->op, "no crypto operation returned");
6939 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
6940 "crypto operation processing failed");
6941 /* Make sure memory pointed to by digest hasn't been overwritten */
6942 TEST_ASSERT_BUFFERS_ARE_EQUAL(
6946 "Memory at digest ptr overwritten unexpectedly");
6948 return TEST_SUCCESS;
6953 test_null_cipher_auth_operation(void)
6955 struct crypto_testsuite_params *ts_params = &testsuite_params;
6956 struct crypto_unittest_params *ut_params = &unittest_params;
6959 /* Generate test mbuf data and space for digest */
6960 ut_params->ibuf = setup_test_string(ts_params->mbuf_pool,
6961 catch_22_quote, QUOTE_512_BYTES, 0);
6963 /* create a pointer for digest, but don't expect anything to be written
6964 * here in a NULL auth algo so no mbuf append done.
6966 digest = rte_pktmbuf_mtod_offset(ut_params->ibuf, uint8_t *,
6968 /* prefill the memory pointed to by digest */
6969 memcpy(digest, orig_data, sizeof(orig_data));
6971 /* Setup Cipher Parameters */
6972 ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
6973 ut_params->cipher_xform.next = &ut_params->auth_xform;
6975 ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_NULL;
6976 ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
6978 /* Setup HMAC Parameters */
6979 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
6980 ut_params->auth_xform.next = NULL;
6982 ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
6983 ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
6985 ut_params->sess = rte_cryptodev_sym_session_create(
6986 ts_params->session_mpool);
6988 /* Create Crypto session*/
6989 rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
6990 ut_params->sess, &ut_params->cipher_xform,
6991 ts_params->session_mpool);
6992 TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
6994 /* Generate Crypto op data structure */
6995 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
6996 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
6997 TEST_ASSERT_NOT_NULL(ut_params->op,
6998 "Failed to allocate symmetric crypto operation struct");
7000 /* Set crypto operation data parameters */
7001 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
7003 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
7005 sym_op->m_src = ut_params->ibuf;
7007 sym_op->cipher.data.offset = 0;
7008 sym_op->cipher.data.length = QUOTE_512_BYTES;
7010 sym_op->auth.data.offset = 0;
7011 sym_op->auth.data.length = QUOTE_512_BYTES;
7012 sym_op->auth.digest.data = digest;
7013 sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(ut_params->ibuf,
7016 /* Process crypto operation */
7017 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
7019 TEST_ASSERT_NOT_NULL(ut_params->op, "no crypto operation returned");
7021 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
7022 "crypto operation processing failed");
7025 TEST_ASSERT_BUFFERS_ARE_EQUAL(
7026 rte_pktmbuf_mtod(ut_params->op->sym->m_src, uint8_t *),
7029 "Ciphertext data not as expected");
7030 /* Make sure memory pointed to by digest hasn't been overwritten */
7031 TEST_ASSERT_BUFFERS_ARE_EQUAL(
7035 "Memory at digest ptr overwritten unexpectedly");
7037 return TEST_SUCCESS;
7041 test_null_auth_cipher_operation(void)
7043 struct crypto_testsuite_params *ts_params = &testsuite_params;
7044 struct crypto_unittest_params *ut_params = &unittest_params;
7047 /* Generate test mbuf data */
7048 ut_params->ibuf = setup_test_string(ts_params->mbuf_pool,
7049 catch_22_quote, QUOTE_512_BYTES, 0);
7051 /* create a pointer for digest, but don't expect anything to be written
7052 * here in a NULL auth algo so no mbuf append done.
7054 digest = rte_pktmbuf_mtod_offset(ut_params->ibuf, uint8_t *,
7056 /* prefill the memory pointed to by digest */
7057 memcpy(digest, orig_data, sizeof(orig_data));
7059 /* Setup Cipher Parameters */
7060 ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
7061 ut_params->cipher_xform.next = NULL;
7063 ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_NULL;
7064 ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
7066 /* Setup HMAC Parameters */
7067 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
7068 ut_params->auth_xform.next = &ut_params->cipher_xform;
7070 ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
7071 ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
7073 ut_params->sess = rte_cryptodev_sym_session_create(
7074 ts_params->session_mpool);
7076 /* Create Crypto session*/
7077 rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
7078 ut_params->sess, &ut_params->cipher_xform,
7079 ts_params->session_mpool);
7080 TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
7082 /* Generate Crypto op data structure */
7083 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
7084 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
7085 TEST_ASSERT_NOT_NULL(ut_params->op,
7086 "Failed to allocate symmetric crypto operation struct");
7088 /* Set crypto operation data parameters */
7089 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
7091 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
7093 sym_op->m_src = ut_params->ibuf;
7095 sym_op->cipher.data.offset = 0;
7096 sym_op->cipher.data.length = QUOTE_512_BYTES;
7098 sym_op->auth.data.offset = 0;
7099 sym_op->auth.data.length = QUOTE_512_BYTES;
7100 sym_op->auth.digest.data = digest;
7101 sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(ut_params->ibuf,
7104 /* Process crypto operation */
7105 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
7107 TEST_ASSERT_NOT_NULL(ut_params->op, "no crypto operation returned");
7109 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
7110 "crypto operation processing failed");
7113 TEST_ASSERT_BUFFERS_ARE_EQUAL(
7114 rte_pktmbuf_mtod(ut_params->op->sym->m_src, uint8_t *),
7117 "Ciphertext data not as expected");
7118 /* Make sure memory pointed to by digest hasn't been overwritten */
7119 TEST_ASSERT_BUFFERS_ARE_EQUAL(
7123 "Memory at digest ptr overwritten unexpectedly");
7125 return TEST_SUCCESS;
7130 test_null_invalid_operation(void)
7132 struct crypto_testsuite_params *ts_params = &testsuite_params;
7133 struct crypto_unittest_params *ut_params = &unittest_params;
7136 /* Setup Cipher Parameters */
7137 ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
7138 ut_params->cipher_xform.next = NULL;
7140 ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;
7141 ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
7143 ut_params->sess = rte_cryptodev_sym_session_create(
7144 ts_params->session_mpool);
7146 /* Create Crypto session*/
7147 ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
7148 ut_params->sess, &ut_params->cipher_xform,
7149 ts_params->session_mpool);
7150 TEST_ASSERT(ret < 0,
7151 "Session creation succeeded unexpectedly");
7154 /* Setup HMAC Parameters */
7155 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
7156 ut_params->auth_xform.next = NULL;
7158 ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
7159 ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
7161 ut_params->sess = rte_cryptodev_sym_session_create(
7162 ts_params->session_mpool);
7164 /* Create Crypto session*/
7165 ret = rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
7166 ut_params->sess, &ut_params->auth_xform,
7167 ts_params->session_mpool);
7168 TEST_ASSERT(ret < 0,
7169 "Session creation succeeded unexpectedly");
7171 return TEST_SUCCESS;
7175 #define NULL_BURST_LENGTH (32)
7178 test_null_burst_operation(void)
7180 struct crypto_testsuite_params *ts_params = &testsuite_params;
7181 struct crypto_unittest_params *ut_params = &unittest_params;
7183 unsigned i, burst_len = NULL_BURST_LENGTH;
7185 struct rte_crypto_op *burst[NULL_BURST_LENGTH] = { NULL };
7186 struct rte_crypto_op *burst_dequeued[NULL_BURST_LENGTH] = { NULL };
7188 /* Setup Cipher Parameters */
7189 ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
7190 ut_params->cipher_xform.next = &ut_params->auth_xform;
7192 ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_NULL;
7193 ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
7195 /* Setup HMAC Parameters */
7196 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
7197 ut_params->auth_xform.next = NULL;
7199 ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
7200 ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
7202 ut_params->sess = rte_cryptodev_sym_session_create(
7203 ts_params->session_mpool);
7205 /* Create Crypto session*/
7206 rte_cryptodev_sym_session_init(ts_params->valid_devs[0],
7207 ut_params->sess, &ut_params->cipher_xform,
7208 ts_params->session_mpool);
7209 TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
7211 TEST_ASSERT_EQUAL(rte_crypto_op_bulk_alloc(ts_params->op_mpool,
7212 RTE_CRYPTO_OP_TYPE_SYMMETRIC, burst, burst_len),
7213 burst_len, "failed to generate burst of crypto ops");
7215 /* Generate an operation for each mbuf in burst */
7216 for (i = 0; i < burst_len; i++) {
7217 struct rte_mbuf *m = rte_pktmbuf_alloc(ts_params->mbuf_pool);
7219 TEST_ASSERT_NOT_NULL(m, "Failed to allocate mbuf");
7221 unsigned *data = (unsigned *)rte_pktmbuf_append(m,
7225 rte_crypto_op_attach_sym_session(burst[i], ut_params->sess);
7227 burst[i]->sym->m_src = m;
7230 /* Process crypto operation */
7231 TEST_ASSERT_EQUAL(rte_cryptodev_enqueue_burst(ts_params->valid_devs[0],
7232 0, burst, burst_len),
7234 "Error enqueuing burst");
7236 TEST_ASSERT_EQUAL(rte_cryptodev_dequeue_burst(ts_params->valid_devs[0],
7237 0, burst_dequeued, burst_len),
7239 "Error dequeuing burst");
7242 for (i = 0; i < burst_len; i++) {
7244 *rte_pktmbuf_mtod(burst[i]->sym->m_src, uint32_t *),
7245 *rte_pktmbuf_mtod(burst_dequeued[i]->sym->m_src,
7247 "data not as expected");
7249 rte_pktmbuf_free(burst[i]->sym->m_src);
7250 rte_crypto_op_free(burst[i]);
7253 return TEST_SUCCESS;
7257 generate_gmac_large_plaintext(uint8_t *data)
7261 for (i = 32; i < GMAC_LARGE_PLAINTEXT_LENGTH; i += 32)
7262 memcpy(&data[i], &data[0], 32);
7266 create_gmac_operation(enum rte_crypto_auth_operation op,
7267 const struct gmac_test_data *tdata)
7269 struct crypto_testsuite_params *ts_params = &testsuite_params;
7270 struct crypto_unittest_params *ut_params = &unittest_params;
7271 struct rte_crypto_sym_op *sym_op;
7273 uint32_t plaintext_pad_len = RTE_ALIGN_CEIL(tdata->plaintext.len, 16);
7275 /* Generate Crypto op data structure */
7276 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
7277 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
7278 TEST_ASSERT_NOT_NULL(ut_params->op,
7279 "Failed to allocate symmetric crypto operation struct");
7281 sym_op = ut_params->op->sym;
7283 sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
7284 ut_params->ibuf, tdata->gmac_tag.len);
7285 TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
7286 "no room to append digest");
7288 sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
7289 ut_params->ibuf, plaintext_pad_len);
7291 if (op == RTE_CRYPTO_AUTH_OP_VERIFY) {
7292 rte_memcpy(sym_op->auth.digest.data, tdata->gmac_tag.data,
7293 tdata->gmac_tag.len);
7294 debug_hexdump(stdout, "digest:",
7295 sym_op->auth.digest.data,
7296 tdata->gmac_tag.len);
7299 uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op,
7300 uint8_t *, IV_OFFSET);
7302 rte_memcpy(iv_ptr, tdata->iv.data, tdata->iv.len);
7304 debug_hexdump(stdout, "iv:", iv_ptr, tdata->iv.len);
7306 sym_op->cipher.data.length = 0;
7307 sym_op->cipher.data.offset = 0;
7309 sym_op->auth.data.offset = 0;
7310 sym_op->auth.data.length = tdata->plaintext.len;
7315 static int create_gmac_session(uint8_t dev_id,
7316 const struct gmac_test_data *tdata,
7317 enum rte_crypto_auth_operation auth_op)
7319 uint8_t auth_key[tdata->key.len];
7321 struct crypto_testsuite_params *ts_params = &testsuite_params;
7322 struct crypto_unittest_params *ut_params = &unittest_params;
7324 memcpy(auth_key, tdata->key.data, tdata->key.len);
7326 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
7327 ut_params->auth_xform.next = NULL;
7329 ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_AES_GMAC;
7330 ut_params->auth_xform.auth.op = auth_op;
7331 ut_params->auth_xform.auth.digest_length = tdata->gmac_tag.len;
7332 ut_params->auth_xform.auth.key.length = tdata->key.len;
7333 ut_params->auth_xform.auth.key.data = auth_key;
7334 ut_params->auth_xform.auth.iv.offset = IV_OFFSET;
7335 ut_params->auth_xform.auth.iv.length = tdata->iv.len;
7338 ut_params->sess = rte_cryptodev_sym_session_create(
7339 ts_params->session_mpool);
7341 rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
7342 &ut_params->auth_xform,
7343 ts_params->session_mpool);
7345 TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
7351 test_AES_GMAC_authentication(const struct gmac_test_data *tdata)
7353 struct crypto_testsuite_params *ts_params = &testsuite_params;
7354 struct crypto_unittest_params *ut_params = &unittest_params;
7358 uint8_t *auth_tag, *plaintext;
7359 uint16_t plaintext_pad_len;
7361 TEST_ASSERT_NOT_EQUAL(tdata->gmac_tag.len, 0,
7362 "No GMAC length in the source data");
7364 retval = create_gmac_session(ts_params->valid_devs[0],
7365 tdata, RTE_CRYPTO_AUTH_OP_GENERATE);
7370 if (tdata->plaintext.len > MBUF_SIZE)
7371 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->large_mbuf_pool);
7373 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
7374 TEST_ASSERT_NOT_NULL(ut_params->ibuf,
7375 "Failed to allocate input buffer in mempool");
7377 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
7378 rte_pktmbuf_tailroom(ut_params->ibuf));
7380 plaintext_pad_len = RTE_ALIGN_CEIL(tdata->plaintext.len, 16);
7382 * Runtime generate the large plain text instead of use hard code
7383 * plain text vector. It is done to avoid create huge source file
7384 * with the test vector.
7386 if (tdata->plaintext.len == GMAC_LARGE_PLAINTEXT_LENGTH)
7387 generate_gmac_large_plaintext(tdata->plaintext.data);
7389 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
7391 TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext");
7393 memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len);
7394 debug_hexdump(stdout, "plaintext:", plaintext,
7395 tdata->plaintext.len);
7397 retval = create_gmac_operation(RTE_CRYPTO_AUTH_OP_GENERATE,
7403 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
7405 ut_params->op->sym->m_src = ut_params->ibuf;
7407 TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0],
7408 ut_params->op), "failed to process sym crypto op");
7410 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
7411 "crypto op processing failed");
7413 if (ut_params->op->sym->m_dst) {
7414 auth_tag = rte_pktmbuf_mtod_offset(ut_params->op->sym->m_dst,
7415 uint8_t *, plaintext_pad_len);
7417 auth_tag = plaintext + plaintext_pad_len;
7420 debug_hexdump(stdout, "auth tag:", auth_tag, tdata->gmac_tag.len);
7422 TEST_ASSERT_BUFFERS_ARE_EQUAL(
7424 tdata->gmac_tag.data,
7425 tdata->gmac_tag.len,
7426 "GMAC Generated auth tag not as expected");
7432 test_AES_GMAC_authentication_test_case_1(void)
7434 return test_AES_GMAC_authentication(&gmac_test_case_1);
7438 test_AES_GMAC_authentication_test_case_2(void)
7440 return test_AES_GMAC_authentication(&gmac_test_case_2);
7444 test_AES_GMAC_authentication_test_case_3(void)
7446 return test_AES_GMAC_authentication(&gmac_test_case_3);
7450 test_AES_GMAC_authentication_test_case_4(void)
7452 return test_AES_GMAC_authentication(&gmac_test_case_4);
7456 test_AES_GMAC_authentication_verify(const struct gmac_test_data *tdata)
7458 struct crypto_testsuite_params *ts_params = &testsuite_params;
7459 struct crypto_unittest_params *ut_params = &unittest_params;
7461 uint32_t plaintext_pad_len;
7464 TEST_ASSERT_NOT_EQUAL(tdata->gmac_tag.len, 0,
7465 "No GMAC length in the source data");
7467 retval = create_gmac_session(ts_params->valid_devs[0],
7468 tdata, RTE_CRYPTO_AUTH_OP_VERIFY);
7473 if (tdata->plaintext.len > MBUF_SIZE)
7474 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->large_mbuf_pool);
7476 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
7477 TEST_ASSERT_NOT_NULL(ut_params->ibuf,
7478 "Failed to allocate input buffer in mempool");
7480 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
7481 rte_pktmbuf_tailroom(ut_params->ibuf));
7483 plaintext_pad_len = RTE_ALIGN_CEIL(tdata->plaintext.len, 16);
7486 * Runtime generate the large plain text instead of use hard code
7487 * plain text vector. It is done to avoid create huge source file
7488 * with the test vector.
7490 if (tdata->plaintext.len == GMAC_LARGE_PLAINTEXT_LENGTH)
7491 generate_gmac_large_plaintext(tdata->plaintext.data);
7493 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
7495 TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext");
7497 memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len);
7498 debug_hexdump(stdout, "plaintext:", plaintext,
7499 tdata->plaintext.len);
7501 retval = create_gmac_operation(RTE_CRYPTO_AUTH_OP_VERIFY,
7507 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
7509 ut_params->op->sym->m_src = ut_params->ibuf;
7511 TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0],
7512 ut_params->op), "failed to process sym crypto op");
7514 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
7515 "crypto op processing failed");
7522 test_AES_GMAC_authentication_verify_test_case_1(void)
7524 return test_AES_GMAC_authentication_verify(&gmac_test_case_1);
7528 test_AES_GMAC_authentication_verify_test_case_2(void)
7530 return test_AES_GMAC_authentication_verify(&gmac_test_case_2);
7534 test_AES_GMAC_authentication_verify_test_case_3(void)
7536 return test_AES_GMAC_authentication_verify(&gmac_test_case_3);
7540 test_AES_GMAC_authentication_verify_test_case_4(void)
7542 return test_AES_GMAC_authentication_verify(&gmac_test_case_4);
7545 struct test_crypto_vector {
7546 enum rte_crypto_cipher_algorithm crypto_algo;
7559 const uint8_t *data;
7564 const uint8_t *data;
7568 enum rte_crypto_auth_algorithm auth_algo;
7576 const uint8_t *data;
7586 static const struct test_crypto_vector
7587 hmac_sha1_test_crypto_vector = {
7588 .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
7590 .data = plaintext_hash,
7595 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
7596 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
7597 0xDE, 0xF4, 0xDE, 0xAD
7603 0xC4, 0xB7, 0x0E, 0x6B, 0xDE, 0xD1, 0xE7, 0x77,
7604 0x7E, 0x2E, 0x8F, 0xFC, 0x48, 0x39, 0x46, 0x17,
7605 0x3F, 0x91, 0x64, 0x59
7611 static const struct test_crypto_vector
7612 aes128_gmac_test_vector = {
7613 .auth_algo = RTE_CRYPTO_AUTH_AES_GMAC,
7615 .data = plaintext_hash,
7620 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
7621 0x08, 0x09, 0x0A, 0x0B
7627 0x42, 0x1A, 0x7D, 0x3D, 0xF5, 0x82, 0x80, 0xF1,
7628 0xF1, 0x35, 0x5C, 0x3B, 0xDD, 0x9A, 0x65, 0xBA
7634 0xCA, 0x00, 0x99, 0x8B, 0x30, 0x7E, 0x74, 0x56,
7635 0x32, 0xA7, 0x87, 0xB5, 0xE9, 0xB2, 0x34, 0x5A
7641 static const struct test_crypto_vector
7642 aes128cbc_hmac_sha1_test_vector = {
7643 .crypto_algo = RTE_CRYPTO_CIPHER_AES_CBC,
7646 0xE4, 0x23, 0x33, 0x8A, 0x35, 0x64, 0x61, 0xE2,
7647 0x49, 0x03, 0xDD, 0xC6, 0xB8, 0xCA, 0x55, 0x7A
7653 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
7654 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
7659 .data = plaintext_hash,
7663 .data = ciphertext512_aes128cbc,
7666 .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
7669 0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
7670 0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
7671 0xDE, 0xF4, 0xDE, 0xAD
7677 0x9A, 0x4F, 0x88, 0x1B, 0xB6, 0x8F, 0xD8, 0x60,
7678 0x42, 0x1A, 0x7D, 0x3D, 0xF5, 0x82, 0x80, 0xF1,
7679 0x18, 0x8C, 0x1D, 0x32
7686 data_corruption(uint8_t *data)
7692 tag_corruption(uint8_t *data, unsigned int tag_offset)
7694 data[tag_offset] += 1;
7698 create_auth_session(struct crypto_unittest_params *ut_params,
7700 const struct test_crypto_vector *reference,
7701 enum rte_crypto_auth_operation auth_op)
7703 struct crypto_testsuite_params *ts_params = &testsuite_params;
7704 uint8_t auth_key[reference->auth_key.len + 1];
7706 memcpy(auth_key, reference->auth_key.data, reference->auth_key.len);
7708 /* Setup Authentication Parameters */
7709 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
7710 ut_params->auth_xform.auth.op = auth_op;
7711 ut_params->auth_xform.next = NULL;
7712 ut_params->auth_xform.auth.algo = reference->auth_algo;
7713 ut_params->auth_xform.auth.key.length = reference->auth_key.len;
7714 ut_params->auth_xform.auth.key.data = auth_key;
7715 ut_params->auth_xform.auth.digest_length = reference->digest.len;
7717 /* Create Crypto session*/
7718 ut_params->sess = rte_cryptodev_sym_session_create(
7719 ts_params->session_mpool);
7721 rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
7722 &ut_params->auth_xform,
7723 ts_params->session_mpool);
7725 TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
7731 create_auth_cipher_session(struct crypto_unittest_params *ut_params,
7733 const struct test_crypto_vector *reference,
7734 enum rte_crypto_auth_operation auth_op,
7735 enum rte_crypto_cipher_operation cipher_op)
7737 struct crypto_testsuite_params *ts_params = &testsuite_params;
7738 uint8_t cipher_key[reference->cipher_key.len + 1];
7739 uint8_t auth_key[reference->auth_key.len + 1];
7741 memcpy(cipher_key, reference->cipher_key.data,
7742 reference->cipher_key.len);
7743 memcpy(auth_key, reference->auth_key.data, reference->auth_key.len);
7745 /* Setup Authentication Parameters */
7746 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
7747 ut_params->auth_xform.auth.op = auth_op;
7748 ut_params->auth_xform.auth.algo = reference->auth_algo;
7749 ut_params->auth_xform.auth.key.length = reference->auth_key.len;
7750 ut_params->auth_xform.auth.key.data = auth_key;
7751 ut_params->auth_xform.auth.digest_length = reference->digest.len;
7753 if (reference->auth_algo == RTE_CRYPTO_AUTH_AES_GMAC) {
7754 ut_params->auth_xform.auth.iv.offset = IV_OFFSET;
7755 ut_params->auth_xform.auth.iv.length = reference->iv.len;
7757 ut_params->auth_xform.next = &ut_params->cipher_xform;
7759 /* Setup Cipher Parameters */
7760 ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
7761 ut_params->cipher_xform.next = NULL;
7762 ut_params->cipher_xform.cipher.algo = reference->crypto_algo;
7763 ut_params->cipher_xform.cipher.op = cipher_op;
7764 ut_params->cipher_xform.cipher.key.data = cipher_key;
7765 ut_params->cipher_xform.cipher.key.length = reference->cipher_key.len;
7766 ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
7767 ut_params->cipher_xform.cipher.iv.length = reference->iv.len;
7770 /* Create Crypto session*/
7771 ut_params->sess = rte_cryptodev_sym_session_create(
7772 ts_params->session_mpool);
7774 rte_cryptodev_sym_session_init(dev_id, ut_params->sess,
7775 &ut_params->auth_xform,
7776 ts_params->session_mpool);
7778 TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
7784 create_auth_operation(struct crypto_testsuite_params *ts_params,
7785 struct crypto_unittest_params *ut_params,
7786 const struct test_crypto_vector *reference,
7787 unsigned int auth_generate)
7789 /* Generate Crypto op data structure */
7790 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
7791 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
7792 TEST_ASSERT_NOT_NULL(ut_params->op,
7793 "Failed to allocate pktmbuf offload");
7795 /* Set crypto operation data parameters */
7796 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
7798 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
7800 /* set crypto operation source mbuf */
7801 sym_op->m_src = ut_params->ibuf;
7804 sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
7805 ut_params->ibuf, reference->digest.len);
7807 TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
7808 "no room to append auth tag");
7810 sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
7811 ut_params->ibuf, reference->plaintext.len);
7814 memset(sym_op->auth.digest.data, 0, reference->digest.len);
7816 memcpy(sym_op->auth.digest.data,
7817 reference->digest.data,
7818 reference->digest.len);
7820 debug_hexdump(stdout, "digest:",
7821 sym_op->auth.digest.data,
7822 reference->digest.len);
7824 sym_op->auth.data.length = reference->plaintext.len;
7825 sym_op->auth.data.offset = 0;
7831 create_auth_GMAC_operation(struct crypto_testsuite_params *ts_params,
7832 struct crypto_unittest_params *ut_params,
7833 const struct test_crypto_vector *reference,
7834 unsigned int auth_generate)
7836 /* Generate Crypto op data structure */
7837 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
7838 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
7839 TEST_ASSERT_NOT_NULL(ut_params->op,
7840 "Failed to allocate pktmbuf offload");
7842 /* Set crypto operation data parameters */
7843 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
7845 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
7847 /* set crypto operation source mbuf */
7848 sym_op->m_src = ut_params->ibuf;
7851 sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
7852 ut_params->ibuf, reference->digest.len);
7854 TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
7855 "no room to append auth tag");
7857 sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
7858 ut_params->ibuf, reference->ciphertext.len);
7861 memset(sym_op->auth.digest.data, 0, reference->digest.len);
7863 memcpy(sym_op->auth.digest.data,
7864 reference->digest.data,
7865 reference->digest.len);
7867 debug_hexdump(stdout, "digest:",
7868 sym_op->auth.digest.data,
7869 reference->digest.len);
7871 rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
7872 reference->iv.data, reference->iv.len);
7874 sym_op->cipher.data.length = 0;
7875 sym_op->cipher.data.offset = 0;
7877 sym_op->auth.data.length = reference->plaintext.len;
7878 sym_op->auth.data.offset = 0;
7884 create_cipher_auth_operation(struct crypto_testsuite_params *ts_params,
7885 struct crypto_unittest_params *ut_params,
7886 const struct test_crypto_vector *reference,
7887 unsigned int auth_generate)
7889 /* Generate Crypto op data structure */
7890 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
7891 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
7892 TEST_ASSERT_NOT_NULL(ut_params->op,
7893 "Failed to allocate pktmbuf offload");
7895 /* Set crypto operation data parameters */
7896 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
7898 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
7900 /* set crypto operation source mbuf */
7901 sym_op->m_src = ut_params->ibuf;
7904 sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
7905 ut_params->ibuf, reference->digest.len);
7907 TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
7908 "no room to append auth tag");
7910 sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(
7911 ut_params->ibuf, reference->ciphertext.len);
7914 memset(sym_op->auth.digest.data, 0, reference->digest.len);
7916 memcpy(sym_op->auth.digest.data,
7917 reference->digest.data,
7918 reference->digest.len);
7920 debug_hexdump(stdout, "digest:",
7921 sym_op->auth.digest.data,
7922 reference->digest.len);
7924 rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET),
7925 reference->iv.data, reference->iv.len);
7927 sym_op->cipher.data.length = reference->ciphertext.len;
7928 sym_op->cipher.data.offset = 0;
7930 sym_op->auth.data.length = reference->ciphertext.len;
7931 sym_op->auth.data.offset = 0;
7937 create_auth_verify_operation(struct crypto_testsuite_params *ts_params,
7938 struct crypto_unittest_params *ut_params,
7939 const struct test_crypto_vector *reference)
7941 return create_auth_operation(ts_params, ut_params, reference, 0);
7945 create_auth_verify_GMAC_operation(
7946 struct crypto_testsuite_params *ts_params,
7947 struct crypto_unittest_params *ut_params,
7948 const struct test_crypto_vector *reference)
7950 return create_auth_GMAC_operation(ts_params, ut_params, reference, 0);
7954 create_cipher_auth_verify_operation(struct crypto_testsuite_params *ts_params,
7955 struct crypto_unittest_params *ut_params,
7956 const struct test_crypto_vector *reference)
7958 return create_cipher_auth_operation(ts_params, ut_params, reference, 0);
7962 test_authentication_verify_fail_when_data_corruption(
7963 struct crypto_testsuite_params *ts_params,
7964 struct crypto_unittest_params *ut_params,
7965 const struct test_crypto_vector *reference,
7966 unsigned int data_corrupted)
7972 /* Create session */
7973 retval = create_auth_session(ut_params,
7974 ts_params->valid_devs[0],
7976 RTE_CRYPTO_AUTH_OP_VERIFY);
7980 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
7981 TEST_ASSERT_NOT_NULL(ut_params->ibuf,
7982 "Failed to allocate input buffer in mempool");
7984 /* clear mbuf payload */
7985 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
7986 rte_pktmbuf_tailroom(ut_params->ibuf));
7988 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
7989 reference->plaintext.len);
7990 TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext");
7991 memcpy(plaintext, reference->plaintext.data, reference->plaintext.len);
7993 debug_hexdump(stdout, "plaintext:", plaintext,
7994 reference->plaintext.len);
7996 /* Create operation */
7997 retval = create_auth_verify_operation(ts_params, ut_params, reference);
8003 data_corruption(plaintext);
8005 tag_corruption(plaintext, reference->plaintext.len);
8007 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
8009 TEST_ASSERT_NOT_NULL(ut_params->op, "failed crypto process");
8010 TEST_ASSERT_EQUAL(ut_params->op->status,
8011 RTE_CRYPTO_OP_STATUS_AUTH_FAILED,
8012 "authentication not failed");
8014 ut_params->obuf = ut_params->op->sym->m_src;
8015 TEST_ASSERT_NOT_NULL(ut_params->obuf, "failed to retrieve obuf");
8021 test_authentication_verify_GMAC_fail_when_corruption(
8022 struct crypto_testsuite_params *ts_params,
8023 struct crypto_unittest_params *ut_params,
8024 const struct test_crypto_vector *reference,
8025 unsigned int data_corrupted)
8030 /* Create session */
8031 retval = create_auth_cipher_session(ut_params,
8032 ts_params->valid_devs[0],
8034 RTE_CRYPTO_AUTH_OP_VERIFY,
8035 RTE_CRYPTO_CIPHER_OP_DECRYPT);
8039 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
8040 TEST_ASSERT_NOT_NULL(ut_params->ibuf,
8041 "Failed to allocate input buffer in mempool");
8043 /* clear mbuf payload */
8044 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
8045 rte_pktmbuf_tailroom(ut_params->ibuf));
8047 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
8048 reference->plaintext.len);
8049 TEST_ASSERT_NOT_NULL(plaintext, "no room to append plaintext");
8050 memcpy(plaintext, reference->plaintext.data, reference->plaintext.len);
8052 debug_hexdump(stdout, "plaintext:", plaintext,
8053 reference->plaintext.len);
8055 /* Create operation */
8056 retval = create_auth_verify_GMAC_operation(ts_params,
8064 data_corruption(plaintext);
8066 tag_corruption(plaintext, reference->aad.len);
8068 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
8070 TEST_ASSERT_NOT_NULL(ut_params->op, "failed crypto process");
8071 TEST_ASSERT_EQUAL(ut_params->op->status,
8072 RTE_CRYPTO_OP_STATUS_AUTH_FAILED,
8073 "authentication not failed");
8075 ut_params->obuf = ut_params->op->sym->m_src;
8076 TEST_ASSERT_NOT_NULL(ut_params->obuf, "failed to retrieve obuf");
8082 test_authenticated_decryption_fail_when_corruption(
8083 struct crypto_testsuite_params *ts_params,
8084 struct crypto_unittest_params *ut_params,
8085 const struct test_crypto_vector *reference,
8086 unsigned int data_corrupted)
8090 uint8_t *ciphertext;
8092 /* Create session */
8093 retval = create_auth_cipher_session(ut_params,
8094 ts_params->valid_devs[0],
8096 RTE_CRYPTO_AUTH_OP_VERIFY,
8097 RTE_CRYPTO_CIPHER_OP_DECRYPT);
8101 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
8102 TEST_ASSERT_NOT_NULL(ut_params->ibuf,
8103 "Failed to allocate input buffer in mempool");
8105 /* clear mbuf payload */
8106 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
8107 rte_pktmbuf_tailroom(ut_params->ibuf));
8109 ciphertext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
8110 reference->ciphertext.len);
8111 TEST_ASSERT_NOT_NULL(ciphertext, "no room to append ciphertext");
8112 memcpy(ciphertext, reference->ciphertext.data,
8113 reference->ciphertext.len);
8115 /* Create operation */
8116 retval = create_cipher_auth_verify_operation(ts_params,
8124 data_corruption(ciphertext);
8126 tag_corruption(ciphertext, reference->ciphertext.len);
8128 ut_params->op = process_crypto_request(ts_params->valid_devs[0],
8131 TEST_ASSERT_NOT_NULL(ut_params->op, "failed crypto process");
8132 TEST_ASSERT_EQUAL(ut_params->op->status,
8133 RTE_CRYPTO_OP_STATUS_AUTH_FAILED,
8134 "authentication not failed");
8136 ut_params->obuf = ut_params->op->sym->m_src;
8137 TEST_ASSERT_NOT_NULL(ut_params->obuf, "failed to retrieve obuf");
8143 create_aead_operation_SGL(enum rte_crypto_aead_operation op,
8144 const struct aead_test_data *tdata,
8145 void *digest_mem, uint64_t digest_phys)
8147 struct crypto_testsuite_params *ts_params = &testsuite_params;
8148 struct crypto_unittest_params *ut_params = &unittest_params;
8150 const unsigned int auth_tag_len = tdata->auth_tag.len;
8151 const unsigned int iv_len = tdata->iv.len;
8152 unsigned int aad_len = tdata->aad.len;
8154 /* Generate Crypto op data structure */
8155 ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
8156 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
8157 TEST_ASSERT_NOT_NULL(ut_params->op,
8158 "Failed to allocate symmetric crypto operation struct");
8160 struct rte_crypto_sym_op *sym_op = ut_params->op->sym;
8162 sym_op->aead.digest.data = digest_mem;
8164 TEST_ASSERT_NOT_NULL(sym_op->aead.digest.data,
8165 "no room to append digest");
8167 sym_op->aead.digest.phys_addr = digest_phys;
8169 if (op == RTE_CRYPTO_AEAD_OP_DECRYPT) {
8170 rte_memcpy(sym_op->aead.digest.data, tdata->auth_tag.data,
8172 debug_hexdump(stdout, "digest:",
8173 sym_op->aead.digest.data,
8177 /* Append aad data */
8178 if (tdata->algo == RTE_CRYPTO_AEAD_AES_CCM) {
8179 uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op,
8180 uint8_t *, IV_OFFSET);
8182 /* Copy IV 1 byte after the IV pointer, according to the API */
8183 rte_memcpy(iv_ptr + 1, tdata->iv.data, iv_len);
8185 aad_len = RTE_ALIGN_CEIL(aad_len + 18, 16);
8187 sym_op->aead.aad.data = (uint8_t *)rte_pktmbuf_prepend(
8188 ut_params->ibuf, aad_len);
8189 TEST_ASSERT_NOT_NULL(sym_op->aead.aad.data,
8190 "no room to prepend aad");
8191 sym_op->aead.aad.phys_addr = rte_pktmbuf_iova(
8194 memset(sym_op->aead.aad.data, 0, aad_len);
8195 /* Copy AAD 18 bytes after the AAD pointer, according to the API */
8196 rte_memcpy(sym_op->aead.aad.data, tdata->aad.data, aad_len);
8198 debug_hexdump(stdout, "iv:", iv_ptr, iv_len);
8199 debug_hexdump(stdout, "aad:",
8200 sym_op->aead.aad.data, aad_len);
8202 uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ut_params->op,
8203 uint8_t *, IV_OFFSET);
8205 rte_memcpy(iv_ptr, tdata->iv.data, iv_len);
8207 sym_op->aead.aad.data = (uint8_t *)rte_pktmbuf_prepend(
8208 ut_params->ibuf, aad_len);
8209 TEST_ASSERT_NOT_NULL(sym_op->aead.aad.data,
8210 "no room to prepend aad");
8211 sym_op->aead.aad.phys_addr = rte_pktmbuf_iova(
8214 memset(sym_op->aead.aad.data, 0, aad_len);
8215 rte_memcpy(sym_op->aead.aad.data, tdata->aad.data, aad_len);
8217 debug_hexdump(stdout, "iv:", iv_ptr, iv_len);
8218 debug_hexdump(stdout, "aad:",
8219 sym_op->aead.aad.data, aad_len);
8222 sym_op->aead.data.length = tdata->plaintext.len;
8223 sym_op->aead.data.offset = aad_len;
8228 #define SGL_MAX_NO 16
8231 test_authenticated_encryption_SGL(const struct aead_test_data *tdata,
8232 const int oop, uint32_t fragsz, uint32_t fragsz_oop)
8234 struct crypto_testsuite_params *ts_params = &testsuite_params;
8235 struct crypto_unittest_params *ut_params = &unittest_params;
8236 struct rte_mbuf *buf, *buf_oop = NULL, *buf_last_oop = NULL;
8239 int to_trn_tbl[SGL_MAX_NO];
8241 unsigned int trn_data = 0;
8242 uint8_t *plaintext, *ciphertext, *auth_tag;
8244 if (fragsz > tdata->plaintext.len)
8245 fragsz = tdata->plaintext.len;
8247 uint16_t plaintext_len = fragsz;
8248 uint16_t frag_size_oop = fragsz_oop ? fragsz_oop : fragsz;
8250 if (fragsz_oop > tdata->plaintext.len)
8251 frag_size_oop = tdata->plaintext.len;
8254 void *digest_mem = NULL;
8256 uint32_t prepend_len = tdata->aad.len;
8258 if (tdata->plaintext.len % fragsz != 0) {
8259 if (tdata->plaintext.len / fragsz + 1 > SGL_MAX_NO)
8262 if (tdata->plaintext.len / fragsz > SGL_MAX_NO)
8267 * For out-op-place we need to alloc another mbuf
8270 ut_params->obuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
8271 rte_pktmbuf_append(ut_params->obuf,
8272 frag_size_oop + prepend_len);
8273 buf_oop = ut_params->obuf;
8276 /* Create AEAD session */
8277 retval = create_aead_session(ts_params->valid_devs[0],
8279 RTE_CRYPTO_AEAD_OP_ENCRYPT,
8280 tdata->key.data, tdata->key.len,
8281 tdata->aad.len, tdata->auth_tag.len,
8286 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
8288 /* clear mbuf payload */
8289 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
8290 rte_pktmbuf_tailroom(ut_params->ibuf));
8292 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
8295 memcpy(plaintext, tdata->plaintext.data, plaintext_len);
8297 trn_data += plaintext_len;
8299 buf = ut_params->ibuf;
8302 * Loop until no more fragments
8305 while (trn_data < tdata->plaintext.len) {
8307 to_trn = (tdata->plaintext.len - trn_data < fragsz) ?
8308 (tdata->plaintext.len - trn_data) : fragsz;
8310 to_trn_tbl[ecx++] = to_trn;
8312 buf->next = rte_pktmbuf_alloc(ts_params->mbuf_pool);
8315 memset(rte_pktmbuf_mtod(buf, uint8_t *), 0,
8316 rte_pktmbuf_tailroom(buf));
8319 if (oop && !fragsz_oop) {
8320 buf_last_oop = buf_oop->next =
8321 rte_pktmbuf_alloc(ts_params->mbuf_pool);
8322 buf_oop = buf_oop->next;
8323 memset(rte_pktmbuf_mtod(buf_oop, uint8_t *),
8324 0, rte_pktmbuf_tailroom(buf_oop));
8325 rte_pktmbuf_append(buf_oop, to_trn);
8328 plaintext = (uint8_t *)rte_pktmbuf_append(buf,
8331 memcpy(plaintext, tdata->plaintext.data + trn_data,
8334 if (trn_data == tdata->plaintext.len) {
8337 digest_mem = rte_pktmbuf_append(buf_oop,
8338 tdata->auth_tag.len);
8340 digest_mem = (uint8_t *)rte_pktmbuf_append(buf,
8341 tdata->auth_tag.len);
8345 uint64_t digest_phys = 0;
8347 ut_params->ibuf->nb_segs = segs;
8350 if (fragsz_oop && oop) {
8354 if (frag_size_oop == tdata->plaintext.len) {
8355 digest_mem = rte_pktmbuf_append(ut_params->obuf,
8356 tdata->auth_tag.len);
8358 digest_phys = rte_pktmbuf_iova_offset(
8360 tdata->plaintext.len + prepend_len);
8363 trn_data = frag_size_oop;
8364 while (trn_data < tdata->plaintext.len) {
8367 (tdata->plaintext.len - trn_data <
8369 (tdata->plaintext.len - trn_data) :
8372 to_trn_tbl[ecx++] = to_trn;
8374 buf_last_oop = buf_oop->next =
8375 rte_pktmbuf_alloc(ts_params->mbuf_pool);
8376 buf_oop = buf_oop->next;
8377 memset(rte_pktmbuf_mtod(buf_oop, uint8_t *),
8378 0, rte_pktmbuf_tailroom(buf_oop));
8379 rte_pktmbuf_append(buf_oop, to_trn);
8383 if (trn_data == tdata->plaintext.len) {
8384 digest_mem = rte_pktmbuf_append(buf_oop,
8385 tdata->auth_tag.len);
8389 ut_params->obuf->nb_segs = segs;
8393 * Place digest at the end of the last buffer
8396 digest_phys = rte_pktmbuf_iova(buf) + to_trn;
8397 if (oop && buf_last_oop)
8398 digest_phys = rte_pktmbuf_iova(buf_last_oop) + to_trn;
8400 if (!digest_mem && !oop) {
8401 digest_mem = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
8402 + tdata->auth_tag.len);
8403 digest_phys = rte_pktmbuf_iova_offset(ut_params->ibuf,
8404 tdata->plaintext.len);
8407 /* Create AEAD operation */
8408 retval = create_aead_operation_SGL(RTE_CRYPTO_AEAD_OP_ENCRYPT,
8409 tdata, digest_mem, digest_phys);
8414 rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess);
8416 ut_params->op->sym->m_src = ut_params->ibuf;
8418 ut_params->op->sym->m_dst = ut_params->obuf;
8420 /* Process crypto operation */
8421 TEST_ASSERT_NOT_NULL(process_crypto_request(ts_params->valid_devs[0],
8422 ut_params->op), "failed to process sym crypto op");
8424 TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS,
8425 "crypto op processing failed");
8428 ciphertext = rte_pktmbuf_mtod_offset(ut_params->op->sym->m_src,
8429 uint8_t *, prepend_len);
8431 ciphertext = rte_pktmbuf_mtod_offset(ut_params->op->sym->m_dst,
8432 uint8_t *, prepend_len);
8436 fragsz = fragsz_oop;
8438 TEST_ASSERT_BUFFERS_ARE_EQUAL(
8440 tdata->ciphertext.data,
8442 "Ciphertext data not as expected");
8444 buf = ut_params->op->sym->m_src->next;
8446 buf = ut_params->op->sym->m_dst->next;
8448 unsigned int off = fragsz;
8452 ciphertext = rte_pktmbuf_mtod(buf,
8455 TEST_ASSERT_BUFFERS_ARE_EQUAL(
8457 tdata->ciphertext.data + off,
8459 "Ciphertext data not as expected");
8461 off += to_trn_tbl[ecx++];
8465 auth_tag = digest_mem;
8466 TEST_ASSERT_BUFFERS_ARE_EQUAL(
8468 tdata->auth_tag.data,
8469 tdata->auth_tag.len,
8470 "Generated auth tag not as expected");
8476 #define OUT_OF_PLACE 1
8479 test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_400B(void)
8481 return test_authenticated_encryption_SGL(
8482 &gcm_test_case_SGL_1, OUT_OF_PLACE, 400, 400);
8486 test_AES_GCM_auth_encrypt_SGL_out_of_place_1500B_2000B(void)
8488 return test_authenticated_encryption_SGL(
8489 &gcm_test_case_SGL_1, OUT_OF_PLACE, 1500, 2000);
8493 test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_1seg(void)
8495 return test_authenticated_encryption_SGL(
8496 &gcm_test_case_8, OUT_OF_PLACE, 400,
8497 gcm_test_case_8.plaintext.len);
8501 test_AES_GCM_auth_encrypt_SGL_in_place_1500B(void)
8504 return test_authenticated_encryption_SGL(
8505 &gcm_test_case_SGL_1, IN_PLACE, 1500, 0);
8509 test_authentication_verify_fail_when_data_corrupted(
8510 struct crypto_testsuite_params *ts_params,
8511 struct crypto_unittest_params *ut_params,
8512 const struct test_crypto_vector *reference)
8514 return test_authentication_verify_fail_when_data_corruption(
8515 ts_params, ut_params, reference, 1);
8519 test_authentication_verify_fail_when_tag_corrupted(
8520 struct crypto_testsuite_params *ts_params,
8521 struct crypto_unittest_params *ut_params,
8522 const struct test_crypto_vector *reference)
8524 return test_authentication_verify_fail_when_data_corruption(
8525 ts_params, ut_params, reference, 0);
8529 test_authentication_verify_GMAC_fail_when_data_corrupted(
8530 struct crypto_testsuite_params *ts_params,
8531 struct crypto_unittest_params *ut_params,
8532 const struct test_crypto_vector *reference)
8534 return test_authentication_verify_GMAC_fail_when_corruption(
8535 ts_params, ut_params, reference, 1);
8539 test_authentication_verify_GMAC_fail_when_tag_corrupted(
8540 struct crypto_testsuite_params *ts_params,
8541 struct crypto_unittest_params *ut_params,
8542 const struct test_crypto_vector *reference)
8544 return test_authentication_verify_GMAC_fail_when_corruption(
8545 ts_params, ut_params, reference, 0);
8549 test_authenticated_decryption_fail_when_data_corrupted(
8550 struct crypto_testsuite_params *ts_params,
8551 struct crypto_unittest_params *ut_params,
8552 const struct test_crypto_vector *reference)
8554 return test_authenticated_decryption_fail_when_corruption(
8555 ts_params, ut_params, reference, 1);
8559 test_authenticated_decryption_fail_when_tag_corrupted(
8560 struct crypto_testsuite_params *ts_params,
8561 struct crypto_unittest_params *ut_params,
8562 const struct test_crypto_vector *reference)
8564 return test_authenticated_decryption_fail_when_corruption(
8565 ts_params, ut_params, reference, 0);
8569 authentication_verify_HMAC_SHA1_fail_data_corrupt(void)
8571 return test_authentication_verify_fail_when_data_corrupted(
8572 &testsuite_params, &unittest_params,
8573 &hmac_sha1_test_crypto_vector);
8577 authentication_verify_HMAC_SHA1_fail_tag_corrupt(void)
8579 return test_authentication_verify_fail_when_tag_corrupted(
8580 &testsuite_params, &unittest_params,
8581 &hmac_sha1_test_crypto_vector);
8585 authentication_verify_AES128_GMAC_fail_data_corrupt(void)
8587 return test_authentication_verify_GMAC_fail_when_data_corrupted(
8588 &testsuite_params, &unittest_params,
8589 &aes128_gmac_test_vector);
8593 authentication_verify_AES128_GMAC_fail_tag_corrupt(void)
8595 return test_authentication_verify_GMAC_fail_when_tag_corrupted(
8596 &testsuite_params, &unittest_params,
8597 &aes128_gmac_test_vector);
8601 auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt(void)
8603 return test_authenticated_decryption_fail_when_data_corrupted(
8606 &aes128cbc_hmac_sha1_test_vector);
8610 auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt(void)
8612 return test_authenticated_decryption_fail_when_tag_corrupted(
8615 &aes128cbc_hmac_sha1_test_vector);
8618 #ifdef RTE_LIBRTE_PMD_CRYPTO_SCHEDULER
8620 /* global AESNI slave IDs for the scheduler test */
8621 uint8_t aesni_ids[2];
8624 test_scheduler_attach_slave_op(void)
8626 struct crypto_testsuite_params *ts_params = &testsuite_params;
8627 uint8_t sched_id = ts_params->valid_devs[0];
8628 uint32_t nb_devs, i, nb_devs_attached = 0;
8632 /* create 2 AESNI_MB if necessary */
8633 nb_devs = rte_cryptodev_device_count_by_driver(
8634 rte_cryptodev_driver_id_get(
8635 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)));
8637 for (i = nb_devs; i < 2; i++) {
8638 snprintf(vdev_name, sizeof(vdev_name), "%s_%u",
8639 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD),
8641 ret = rte_vdev_init(vdev_name, NULL);
8643 TEST_ASSERT(ret == 0,
8644 "Failed to create instance %u of"
8646 i, RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
8650 /* attach 2 AESNI_MB cdevs */
8651 for (i = 0; i < rte_cryptodev_count() && nb_devs_attached < 2;
8653 struct rte_cryptodev_info info;
8655 rte_cryptodev_info_get(i, &info);
8656 if (info.driver_id != rte_cryptodev_driver_id_get(
8657 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)))
8661 * Create the session mempool again, since now there are new devices
8662 * to use the mempool.
8664 if (ts_params->session_mpool) {
8665 rte_mempool_free(ts_params->session_mpool);
8666 ts_params->session_mpool = NULL;
8668 unsigned int session_size =
8669 rte_cryptodev_sym_get_private_session_size(i);
8671 if (info.sym.max_nb_sessions != 0 &&
8672 info.sym.max_nb_sessions < MAX_NB_SESSIONS) {
8674 "Device does not support "
8675 "at least %u sessions\n",
8680 * Create mempool with maximum number of sessions * 2,
8681 * to include the session headers
8683 if (ts_params->session_mpool == NULL) {
8684 ts_params->session_mpool = rte_mempool_create(
8686 MAX_NB_SESSIONS * 2,
8688 0, 0, NULL, NULL, NULL,
8689 NULL, SOCKET_ID_ANY,
8692 TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
8693 "session mempool allocation failed");
8696 ret = rte_cryptodev_scheduler_slave_attach(sched_id,
8699 TEST_ASSERT(ret == 0,
8700 "Failed to attach device %u of pmd : %s", i,
8701 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
8703 aesni_ids[nb_devs_attached] = (uint8_t)i;
8712 test_scheduler_detach_slave_op(void)
8714 struct crypto_testsuite_params *ts_params = &testsuite_params;
8715 uint8_t sched_id = ts_params->valid_devs[0];
8719 for (i = 0; i < 2; i++) {
8720 ret = rte_cryptodev_scheduler_slave_detach(sched_id,
8722 TEST_ASSERT(ret == 0,
8723 "Failed to detach device %u", aesni_ids[i]);
8730 test_scheduler_mode_op(enum rte_cryptodev_scheduler_mode scheduler_mode)
8732 struct crypto_testsuite_params *ts_params = &testsuite_params;
8733 uint8_t sched_id = ts_params->valid_devs[0];
8735 return rte_cryptodev_scheduler_mode_set(sched_id,
8740 test_scheduler_mode_roundrobin_op(void)
8742 TEST_ASSERT(test_scheduler_mode_op(CDEV_SCHED_MODE_ROUNDROBIN) ==
8743 0, "Failed to set roundrobin mode");
8749 test_scheduler_mode_multicore_op(void)
8751 TEST_ASSERT(test_scheduler_mode_op(CDEV_SCHED_MODE_MULTICORE) ==
8752 0, "Failed to set multicore mode");
8758 test_scheduler_mode_failover_op(void)
8760 TEST_ASSERT(test_scheduler_mode_op(CDEV_SCHED_MODE_FAILOVER) ==
8761 0, "Failed to set failover mode");
8767 test_scheduler_mode_pkt_size_distr_op(void)
8769 TEST_ASSERT(test_scheduler_mode_op(CDEV_SCHED_MODE_PKT_SIZE_DISTR) ==
8770 0, "Failed to set pktsize mode");
8775 static struct unit_test_suite cryptodev_scheduler_testsuite = {
8776 .suite_name = "Crypto Device Scheduler Unit Test Suite",
8777 .setup = testsuite_setup,
8778 .teardown = testsuite_teardown,
8779 .unit_test_cases = {
8781 TEST_CASE_ST(NULL, NULL, test_scheduler_attach_slave_op),
8782 TEST_CASE_ST(NULL, NULL, test_scheduler_mode_multicore_op),
8783 TEST_CASE_ST(ut_setup, ut_teardown,
8784 test_AES_chain_scheduler_all),
8785 TEST_CASE_ST(ut_setup, ut_teardown,
8786 test_AES_cipheronly_scheduler_all),
8787 TEST_CASE_ST(ut_setup, ut_teardown,
8788 test_authonly_scheduler_all),
8789 TEST_CASE_ST(NULL, NULL, test_scheduler_detach_slave_op),
8792 TEST_CASE_ST(NULL, NULL, test_scheduler_attach_slave_op),
8793 TEST_CASE_ST(NULL, NULL, test_scheduler_mode_roundrobin_op),
8794 TEST_CASE_ST(ut_setup, ut_teardown,
8795 test_AES_chain_scheduler_all),
8796 TEST_CASE_ST(ut_setup, ut_teardown,
8797 test_AES_cipheronly_scheduler_all),
8798 TEST_CASE_ST(ut_setup, ut_teardown,
8799 test_authonly_scheduler_all),
8800 TEST_CASE_ST(NULL, NULL, test_scheduler_detach_slave_op),
8803 TEST_CASE_ST(NULL, NULL, test_scheduler_attach_slave_op),
8804 TEST_CASE_ST(NULL, NULL, test_scheduler_mode_failover_op),
8805 TEST_CASE_ST(ut_setup, ut_teardown,
8806 test_AES_chain_scheduler_all),
8807 TEST_CASE_ST(ut_setup, ut_teardown,
8808 test_AES_cipheronly_scheduler_all),
8809 TEST_CASE_ST(ut_setup, ut_teardown,
8810 test_authonly_scheduler_all),
8811 TEST_CASE_ST(NULL, NULL, test_scheduler_detach_slave_op),
8814 TEST_CASE_ST(NULL, NULL, test_scheduler_attach_slave_op),
8815 TEST_CASE_ST(NULL, NULL, test_scheduler_mode_pkt_size_distr_op),
8816 TEST_CASE_ST(ut_setup, ut_teardown,
8817 test_AES_chain_scheduler_all),
8818 TEST_CASE_ST(ut_setup, ut_teardown,
8819 test_AES_cipheronly_scheduler_all),
8820 TEST_CASE_ST(ut_setup, ut_teardown,
8821 test_authonly_scheduler_all),
8822 TEST_CASE_ST(NULL, NULL, test_scheduler_detach_slave_op),
8824 TEST_CASES_END() /**< NULL terminate unit test array */
8828 #endif /* RTE_LIBRTE_PMD_CRYPTO_SCHEDULER */
8830 static struct unit_test_suite cryptodev_qat_testsuite = {
8831 .suite_name = "Crypto QAT Unit Test Suite",
8832 .setup = testsuite_setup,
8833 .teardown = testsuite_teardown,
8834 .unit_test_cases = {
8835 TEST_CASE_ST(ut_setup, ut_teardown,
8836 test_device_configure_invalid_dev_id),
8837 TEST_CASE_ST(ut_setup, ut_teardown,
8838 test_device_configure_invalid_queue_pair_ids),
8839 TEST_CASE_ST(ut_setup, ut_teardown,
8840 test_queue_pair_descriptor_setup),
8841 TEST_CASE_ST(ut_setup, ut_teardown,
8842 test_multi_session),
8844 TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_qat_all),
8845 TEST_CASE_ST(ut_setup, ut_teardown,
8846 test_AES_cipheronly_qat_all),
8847 TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_qat_all),
8848 TEST_CASE_ST(ut_setup, ut_teardown,
8849 test_3DES_cipheronly_qat_all),
8850 TEST_CASE_ST(ut_setup, ut_teardown,
8851 test_DES_cipheronly_qat_all),
8852 TEST_CASE_ST(ut_setup, ut_teardown,
8853 test_AES_docsis_qat_all),
8854 TEST_CASE_ST(ut_setup, ut_teardown,
8855 test_DES_docsis_qat_all),
8856 TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_qat_all),
8857 TEST_CASE_ST(ut_setup, ut_teardown, test_stats),
8859 /** AES CCM Authenticated Encryption 128 bits key */
8860 TEST_CASE_ST(ut_setup, ut_teardown,
8861 test_AES_CCM_authenticated_encryption_test_case_128_1),
8862 TEST_CASE_ST(ut_setup, ut_teardown,
8863 test_AES_CCM_authenticated_encryption_test_case_128_2),
8864 TEST_CASE_ST(ut_setup, ut_teardown,
8865 test_AES_CCM_authenticated_encryption_test_case_128_3),
8867 /** AES CCM Authenticated Decryption 128 bits key*/
8868 TEST_CASE_ST(ut_setup, ut_teardown,
8869 test_AES_CCM_authenticated_decryption_test_case_128_1),
8870 TEST_CASE_ST(ut_setup, ut_teardown,
8871 test_AES_CCM_authenticated_decryption_test_case_128_2),
8872 TEST_CASE_ST(ut_setup, ut_teardown,
8873 test_AES_CCM_authenticated_decryption_test_case_128_3),
8875 /** AES GCM Authenticated Encryption */
8876 TEST_CASE_ST(ut_setup, ut_teardown,
8877 test_AES_GCM_auth_encrypt_SGL_in_place_1500B),
8878 TEST_CASE_ST(ut_setup, ut_teardown,
8879 test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_400B),
8880 TEST_CASE_ST(ut_setup, ut_teardown,
8881 test_AES_GCM_auth_encrypt_SGL_out_of_place_1500B_2000B),
8882 TEST_CASE_ST(ut_setup, ut_teardown,
8883 test_AES_GCM_authenticated_encryption_test_case_1),
8884 TEST_CASE_ST(ut_setup, ut_teardown,
8885 test_AES_GCM_authenticated_encryption_test_case_2),
8886 TEST_CASE_ST(ut_setup, ut_teardown,
8887 test_AES_GCM_authenticated_encryption_test_case_3),
8888 TEST_CASE_ST(ut_setup, ut_teardown,
8889 test_AES_GCM_authenticated_encryption_test_case_4),
8890 TEST_CASE_ST(ut_setup, ut_teardown,
8891 test_AES_GCM_authenticated_encryption_test_case_5),
8892 TEST_CASE_ST(ut_setup, ut_teardown,
8893 test_AES_GCM_authenticated_encryption_test_case_6),
8894 TEST_CASE_ST(ut_setup, ut_teardown,
8895 test_AES_GCM_authenticated_encryption_test_case_7),
8897 /** AES GCM Authenticated Decryption */
8898 TEST_CASE_ST(ut_setup, ut_teardown,
8899 test_AES_GCM_authenticated_decryption_test_case_1),
8900 TEST_CASE_ST(ut_setup, ut_teardown,
8901 test_AES_GCM_authenticated_decryption_test_case_2),
8902 TEST_CASE_ST(ut_setup, ut_teardown,
8903 test_AES_GCM_authenticated_decryption_test_case_3),
8904 TEST_CASE_ST(ut_setup, ut_teardown,
8905 test_AES_GCM_authenticated_decryption_test_case_4),
8906 TEST_CASE_ST(ut_setup, ut_teardown,
8907 test_AES_GCM_authenticated_decryption_test_case_5),
8908 TEST_CASE_ST(ut_setup, ut_teardown,
8909 test_AES_GCM_authenticated_decryption_test_case_6),
8910 TEST_CASE_ST(ut_setup, ut_teardown,
8911 test_AES_GCM_authenticated_decryption_test_case_7),
8913 /** AES GCM Authenticated Encryption 192 bits key */
8914 TEST_CASE_ST(ut_setup, ut_teardown,
8915 test_AES_GCM_auth_encryption_test_case_192_1),
8916 TEST_CASE_ST(ut_setup, ut_teardown,
8917 test_AES_GCM_auth_encryption_test_case_192_2),
8918 TEST_CASE_ST(ut_setup, ut_teardown,
8919 test_AES_GCM_auth_encryption_test_case_192_3),
8920 TEST_CASE_ST(ut_setup, ut_teardown,
8921 test_AES_GCM_auth_encryption_test_case_192_4),
8922 TEST_CASE_ST(ut_setup, ut_teardown,
8923 test_AES_GCM_auth_encryption_test_case_192_5),
8924 TEST_CASE_ST(ut_setup, ut_teardown,
8925 test_AES_GCM_auth_encryption_test_case_192_6),
8926 TEST_CASE_ST(ut_setup, ut_teardown,
8927 test_AES_GCM_auth_encryption_test_case_192_7),
8929 /** AES GCM Authenticated Decryption 192 bits key */
8930 TEST_CASE_ST(ut_setup, ut_teardown,
8931 test_AES_GCM_auth_decryption_test_case_192_1),
8932 TEST_CASE_ST(ut_setup, ut_teardown,
8933 test_AES_GCM_auth_decryption_test_case_192_2),
8934 TEST_CASE_ST(ut_setup, ut_teardown,
8935 test_AES_GCM_auth_decryption_test_case_192_3),
8936 TEST_CASE_ST(ut_setup, ut_teardown,
8937 test_AES_GCM_auth_decryption_test_case_192_4),
8938 TEST_CASE_ST(ut_setup, ut_teardown,
8939 test_AES_GCM_auth_decryption_test_case_192_5),
8940 TEST_CASE_ST(ut_setup, ut_teardown,
8941 test_AES_GCM_auth_decryption_test_case_192_6),
8942 TEST_CASE_ST(ut_setup, ut_teardown,
8943 test_AES_GCM_auth_decryption_test_case_192_7),
8945 /** AES GCM Authenticated Encryption 256 bits key */
8946 TEST_CASE_ST(ut_setup, ut_teardown,
8947 test_AES_GCM_auth_encryption_test_case_256_1),
8948 TEST_CASE_ST(ut_setup, ut_teardown,
8949 test_AES_GCM_auth_encryption_test_case_256_2),
8950 TEST_CASE_ST(ut_setup, ut_teardown,
8951 test_AES_GCM_auth_encryption_test_case_256_3),
8952 TEST_CASE_ST(ut_setup, ut_teardown,
8953 test_AES_GCM_auth_encryption_test_case_256_4),
8954 TEST_CASE_ST(ut_setup, ut_teardown,
8955 test_AES_GCM_auth_encryption_test_case_256_5),
8956 TEST_CASE_ST(ut_setup, ut_teardown,
8957 test_AES_GCM_auth_encryption_test_case_256_6),
8958 TEST_CASE_ST(ut_setup, ut_teardown,
8959 test_AES_GCM_auth_encryption_test_case_256_7),
8961 /** AES GMAC Authentication */
8962 TEST_CASE_ST(ut_setup, ut_teardown,
8963 test_AES_GMAC_authentication_test_case_1),
8964 TEST_CASE_ST(ut_setup, ut_teardown,
8965 test_AES_GMAC_authentication_verify_test_case_1),
8966 TEST_CASE_ST(ut_setup, ut_teardown,
8967 test_AES_GMAC_authentication_test_case_2),
8968 TEST_CASE_ST(ut_setup, ut_teardown,
8969 test_AES_GMAC_authentication_verify_test_case_2),
8970 TEST_CASE_ST(ut_setup, ut_teardown,
8971 test_AES_GMAC_authentication_test_case_3),
8972 TEST_CASE_ST(ut_setup, ut_teardown,
8973 test_AES_GMAC_authentication_verify_test_case_3),
8975 /** SNOW 3G encrypt only (UEA2) */
8976 TEST_CASE_ST(ut_setup, ut_teardown,
8977 test_snow3g_encryption_test_case_1),
8978 TEST_CASE_ST(ut_setup, ut_teardown,
8979 test_snow3g_encryption_test_case_2),
8980 TEST_CASE_ST(ut_setup, ut_teardown,
8981 test_snow3g_encryption_test_case_3),
8982 TEST_CASE_ST(ut_setup, ut_teardown,
8983 test_snow3g_encryption_test_case_4),
8984 TEST_CASE_ST(ut_setup, ut_teardown,
8985 test_snow3g_encryption_test_case_5),
8987 TEST_CASE_ST(ut_setup, ut_teardown,
8988 test_snow3g_encryption_test_case_1_oop),
8989 TEST_CASE_ST(ut_setup, ut_teardown,
8990 test_snow3g_decryption_test_case_1_oop),
8992 /** SNOW 3G decrypt only (UEA2) */
8993 TEST_CASE_ST(ut_setup, ut_teardown,
8994 test_snow3g_decryption_test_case_1),
8995 TEST_CASE_ST(ut_setup, ut_teardown,
8996 test_snow3g_decryption_test_case_2),
8997 TEST_CASE_ST(ut_setup, ut_teardown,
8998 test_snow3g_decryption_test_case_3),
8999 TEST_CASE_ST(ut_setup, ut_teardown,
9000 test_snow3g_decryption_test_case_4),
9001 TEST_CASE_ST(ut_setup, ut_teardown,
9002 test_snow3g_decryption_test_case_5),
9003 TEST_CASE_ST(ut_setup, ut_teardown,
9004 test_snow3g_hash_generate_test_case_1),
9005 TEST_CASE_ST(ut_setup, ut_teardown,
9006 test_snow3g_hash_generate_test_case_2),
9007 TEST_CASE_ST(ut_setup, ut_teardown,
9008 test_snow3g_hash_generate_test_case_3),
9009 TEST_CASE_ST(ut_setup, ut_teardown,
9010 test_snow3g_hash_verify_test_case_1),
9011 TEST_CASE_ST(ut_setup, ut_teardown,
9012 test_snow3g_hash_verify_test_case_2),
9013 TEST_CASE_ST(ut_setup, ut_teardown,
9014 test_snow3g_hash_verify_test_case_3),
9015 TEST_CASE_ST(ut_setup, ut_teardown,
9016 test_snow3g_cipher_auth_test_case_1),
9017 TEST_CASE_ST(ut_setup, ut_teardown,
9018 test_snow3g_auth_cipher_test_case_1),
9020 /** ZUC encrypt only (EEA3) */
9021 TEST_CASE_ST(ut_setup, ut_teardown,
9022 test_zuc_encryption_test_case_1),
9023 TEST_CASE_ST(ut_setup, ut_teardown,
9024 test_zuc_encryption_test_case_2),
9025 TEST_CASE_ST(ut_setup, ut_teardown,
9026 test_zuc_encryption_test_case_3),
9027 TEST_CASE_ST(ut_setup, ut_teardown,
9028 test_zuc_encryption_test_case_4),
9029 TEST_CASE_ST(ut_setup, ut_teardown,
9030 test_zuc_encryption_test_case_5),
9032 /** ZUC authenticate (EIA3) */
9033 TEST_CASE_ST(ut_setup, ut_teardown,
9034 test_zuc_hash_generate_test_case_6),
9035 TEST_CASE_ST(ut_setup, ut_teardown,
9036 test_zuc_hash_generate_test_case_7),
9037 TEST_CASE_ST(ut_setup, ut_teardown,
9038 test_zuc_hash_generate_test_case_8),
9040 /** ZUC alg-chain (EEA3/EIA3) */
9041 TEST_CASE_ST(ut_setup, ut_teardown,
9042 test_zuc_cipher_auth_test_case_1),
9043 TEST_CASE_ST(ut_setup, ut_teardown,
9044 test_zuc_cipher_auth_test_case_2),
9046 /** HMAC_MD5 Authentication */
9047 TEST_CASE_ST(ut_setup, ut_teardown,
9048 test_MD5_HMAC_generate_case_1),
9049 TEST_CASE_ST(ut_setup, ut_teardown,
9050 test_MD5_HMAC_verify_case_1),
9051 TEST_CASE_ST(ut_setup, ut_teardown,
9052 test_MD5_HMAC_generate_case_2),
9053 TEST_CASE_ST(ut_setup, ut_teardown,
9054 test_MD5_HMAC_verify_case_2),
9057 TEST_CASE_ST(ut_setup, ut_teardown,
9058 test_null_auth_only_operation),
9059 TEST_CASE_ST(ut_setup, ut_teardown,
9060 test_null_cipher_only_operation),
9061 TEST_CASE_ST(ut_setup, ut_teardown,
9062 test_null_cipher_auth_operation),
9063 TEST_CASE_ST(ut_setup, ut_teardown,
9064 test_null_auth_cipher_operation),
9067 TEST_CASE_ST(ut_setup, ut_teardown,
9068 test_kasumi_hash_generate_test_case_1),
9069 TEST_CASE_ST(ut_setup, ut_teardown,
9070 test_kasumi_hash_generate_test_case_2),
9071 TEST_CASE_ST(ut_setup, ut_teardown,
9072 test_kasumi_hash_generate_test_case_3),
9073 TEST_CASE_ST(ut_setup, ut_teardown,
9074 test_kasumi_hash_generate_test_case_4),
9075 TEST_CASE_ST(ut_setup, ut_teardown,
9076 test_kasumi_hash_generate_test_case_5),
9077 TEST_CASE_ST(ut_setup, ut_teardown,
9078 test_kasumi_hash_generate_test_case_6),
9080 TEST_CASE_ST(ut_setup, ut_teardown,
9081 test_kasumi_hash_verify_test_case_1),
9082 TEST_CASE_ST(ut_setup, ut_teardown,
9083 test_kasumi_hash_verify_test_case_2),
9084 TEST_CASE_ST(ut_setup, ut_teardown,
9085 test_kasumi_hash_verify_test_case_3),
9086 TEST_CASE_ST(ut_setup, ut_teardown,
9087 test_kasumi_hash_verify_test_case_4),
9088 TEST_CASE_ST(ut_setup, ut_teardown,
9089 test_kasumi_hash_verify_test_case_5),
9091 TEST_CASE_ST(ut_setup, ut_teardown,
9092 test_kasumi_encryption_test_case_1),
9093 TEST_CASE_ST(ut_setup, ut_teardown,
9094 test_kasumi_encryption_test_case_3),
9095 TEST_CASE_ST(ut_setup, ut_teardown,
9096 test_kasumi_auth_cipher_test_case_1),
9097 TEST_CASE_ST(ut_setup, ut_teardown,
9098 test_kasumi_cipher_auth_test_case_1),
9100 /** Negative tests */
9101 TEST_CASE_ST(ut_setup, ut_teardown,
9102 authentication_verify_HMAC_SHA1_fail_data_corrupt),
9103 TEST_CASE_ST(ut_setup, ut_teardown,
9104 authentication_verify_HMAC_SHA1_fail_tag_corrupt),
9105 TEST_CASE_ST(ut_setup, ut_teardown,
9106 authentication_verify_AES128_GMAC_fail_data_corrupt),
9107 TEST_CASE_ST(ut_setup, ut_teardown,
9108 authentication_verify_AES128_GMAC_fail_tag_corrupt),
9109 TEST_CASE_ST(ut_setup, ut_teardown,
9110 auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
9111 TEST_CASE_ST(ut_setup, ut_teardown,
9112 auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
9114 TEST_CASES_END() /**< NULL terminate unit test array */
9118 static struct unit_test_suite cryptodev_virtio_testsuite = {
9119 .suite_name = "Crypto VIRTIO Unit Test Suite",
9120 .setup = testsuite_setup,
9121 .teardown = testsuite_teardown,
9122 .unit_test_cases = {
9123 TEST_CASE_ST(ut_setup, ut_teardown,
9124 test_AES_cipheronly_virtio_all),
9126 TEST_CASES_END() /**< NULL terminate unit test array */
9130 static struct unit_test_suite cryptodev_aesni_mb_testsuite = {
9131 .suite_name = "Crypto Device AESNI MB Unit Test Suite",
9132 .setup = testsuite_setup,
9133 .teardown = testsuite_teardown,
9134 .unit_test_cases = {
9135 TEST_CASE_ST(ut_setup, ut_teardown,
9136 test_AES_GCM_authenticated_encryption_test_case_1),
9137 TEST_CASE_ST(ut_setup, ut_teardown,
9138 test_AES_GCM_authenticated_encryption_test_case_2),
9139 TEST_CASE_ST(ut_setup, ut_teardown,
9140 test_AES_GCM_authenticated_encryption_test_case_3),
9141 TEST_CASE_ST(ut_setup, ut_teardown,
9142 test_AES_GCM_authenticated_encryption_test_case_4),
9143 TEST_CASE_ST(ut_setup, ut_teardown,
9144 test_AES_GCM_authenticated_encryption_test_case_5),
9145 TEST_CASE_ST(ut_setup, ut_teardown,
9146 test_AES_GCM_authenticated_encryption_test_case_6),
9147 TEST_CASE_ST(ut_setup, ut_teardown,
9148 test_AES_GCM_authenticated_encryption_test_case_7),
9150 /** AES GCM Authenticated Decryption */
9151 TEST_CASE_ST(ut_setup, ut_teardown,
9152 test_AES_GCM_authenticated_decryption_test_case_1),
9153 TEST_CASE_ST(ut_setup, ut_teardown,
9154 test_AES_GCM_authenticated_decryption_test_case_2),
9155 TEST_CASE_ST(ut_setup, ut_teardown,
9156 test_AES_GCM_authenticated_decryption_test_case_3),
9157 TEST_CASE_ST(ut_setup, ut_teardown,
9158 test_AES_GCM_authenticated_decryption_test_case_4),
9159 TEST_CASE_ST(ut_setup, ut_teardown,
9160 test_AES_GCM_authenticated_decryption_test_case_5),
9161 TEST_CASE_ST(ut_setup, ut_teardown,
9162 test_AES_GCM_authenticated_decryption_test_case_6),
9163 TEST_CASE_ST(ut_setup, ut_teardown,
9164 test_AES_GCM_authenticated_decryption_test_case_7),
9166 /** AES GCM Authenticated Encryption 192 bits key */
9167 TEST_CASE_ST(ut_setup, ut_teardown,
9168 test_AES_GCM_auth_encryption_test_case_192_1),
9169 TEST_CASE_ST(ut_setup, ut_teardown,
9170 test_AES_GCM_auth_encryption_test_case_192_2),
9171 TEST_CASE_ST(ut_setup, ut_teardown,
9172 test_AES_GCM_auth_encryption_test_case_192_3),
9173 TEST_CASE_ST(ut_setup, ut_teardown,
9174 test_AES_GCM_auth_encryption_test_case_192_4),
9175 TEST_CASE_ST(ut_setup, ut_teardown,
9176 test_AES_GCM_auth_encryption_test_case_192_5),
9177 TEST_CASE_ST(ut_setup, ut_teardown,
9178 test_AES_GCM_auth_encryption_test_case_192_6),
9179 TEST_CASE_ST(ut_setup, ut_teardown,
9180 test_AES_GCM_auth_encryption_test_case_192_7),
9182 /** AES GCM Authenticated Decryption 192 bits key */
9183 TEST_CASE_ST(ut_setup, ut_teardown,
9184 test_AES_GCM_auth_decryption_test_case_192_1),
9185 TEST_CASE_ST(ut_setup, ut_teardown,
9186 test_AES_GCM_auth_decryption_test_case_192_2),
9187 TEST_CASE_ST(ut_setup, ut_teardown,
9188 test_AES_GCM_auth_decryption_test_case_192_3),
9189 TEST_CASE_ST(ut_setup, ut_teardown,
9190 test_AES_GCM_auth_decryption_test_case_192_4),
9191 TEST_CASE_ST(ut_setup, ut_teardown,
9192 test_AES_GCM_auth_decryption_test_case_192_5),
9193 TEST_CASE_ST(ut_setup, ut_teardown,
9194 test_AES_GCM_auth_decryption_test_case_192_6),
9195 TEST_CASE_ST(ut_setup, ut_teardown,
9196 test_AES_GCM_auth_decryption_test_case_192_7),
9198 /** AES GCM Authenticated Encryption 256 bits key */
9199 TEST_CASE_ST(ut_setup, ut_teardown,
9200 test_AES_GCM_auth_encryption_test_case_256_1),
9201 TEST_CASE_ST(ut_setup, ut_teardown,
9202 test_AES_GCM_auth_encryption_test_case_256_2),
9203 TEST_CASE_ST(ut_setup, ut_teardown,
9204 test_AES_GCM_auth_encryption_test_case_256_3),
9205 TEST_CASE_ST(ut_setup, ut_teardown,
9206 test_AES_GCM_auth_encryption_test_case_256_4),
9207 TEST_CASE_ST(ut_setup, ut_teardown,
9208 test_AES_GCM_auth_encryption_test_case_256_5),
9209 TEST_CASE_ST(ut_setup, ut_teardown,
9210 test_AES_GCM_auth_encryption_test_case_256_6),
9211 TEST_CASE_ST(ut_setup, ut_teardown,
9212 test_AES_GCM_auth_encryption_test_case_256_7),
9214 /** AES GCM Authenticated Decryption 256 bits key */
9215 TEST_CASE_ST(ut_setup, ut_teardown,
9216 test_AES_GCM_auth_decryption_test_case_256_1),
9217 TEST_CASE_ST(ut_setup, ut_teardown,
9218 test_AES_GCM_auth_decryption_test_case_256_2),
9219 TEST_CASE_ST(ut_setup, ut_teardown,
9220 test_AES_GCM_auth_decryption_test_case_256_3),
9221 TEST_CASE_ST(ut_setup, ut_teardown,
9222 test_AES_GCM_auth_decryption_test_case_256_4),
9223 TEST_CASE_ST(ut_setup, ut_teardown,
9224 test_AES_GCM_auth_decryption_test_case_256_5),
9225 TEST_CASE_ST(ut_setup, ut_teardown,
9226 test_AES_GCM_auth_decryption_test_case_256_6),
9227 TEST_CASE_ST(ut_setup, ut_teardown,
9228 test_AES_GCM_auth_decryption_test_case_256_7),
9230 /** AES GCM Authenticated Encryption big aad size */
9231 TEST_CASE_ST(ut_setup, ut_teardown,
9232 test_AES_GCM_auth_encryption_test_case_aad_1),
9233 TEST_CASE_ST(ut_setup, ut_teardown,
9234 test_AES_GCM_auth_encryption_test_case_aad_2),
9236 /** AES GCM Authenticated Decryption big aad size */
9237 TEST_CASE_ST(ut_setup, ut_teardown,
9238 test_AES_GCM_auth_decryption_test_case_aad_1),
9239 TEST_CASE_ST(ut_setup, ut_teardown,
9240 test_AES_GCM_auth_decryption_test_case_aad_2),
9242 /** Session-less tests */
9243 TEST_CASE_ST(ut_setup, ut_teardown,
9244 test_AES_GCM_authenticated_encryption_sessionless_test_case_1),
9245 TEST_CASE_ST(ut_setup, ut_teardown,
9246 test_AES_GCM_authenticated_decryption_sessionless_test_case_1),
9249 TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_mb_all),
9250 TEST_CASE_ST(ut_setup, ut_teardown, test_AES_cipheronly_mb_all),
9251 TEST_CASE_ST(ut_setup, ut_teardown, test_AES_docsis_mb_all),
9252 TEST_CASE_ST(ut_setup, ut_teardown, test_authonly_mb_all),
9253 TEST_CASE_ST(ut_setup, ut_teardown,
9254 test_DES_cipheronly_mb_all),
9255 TEST_CASE_ST(ut_setup, ut_teardown,
9256 test_DES_docsis_mb_all),
9257 TEST_CASE_ST(ut_setup, ut_teardown,
9258 test_3DES_cipheronly_mb_all),
9259 TEST_CASE_ST(ut_setup, ut_teardown,
9260 test_AES_CCM_authenticated_encryption_test_case_128_1),
9261 TEST_CASE_ST(ut_setup, ut_teardown,
9262 test_AES_CCM_authenticated_decryption_test_case_128_1),
9263 TEST_CASE_ST(ut_setup, ut_teardown,
9264 test_AES_CCM_authenticated_encryption_test_case_128_2),
9265 TEST_CASE_ST(ut_setup, ut_teardown,
9266 test_AES_CCM_authenticated_decryption_test_case_128_2),
9267 TEST_CASE_ST(ut_setup, ut_teardown,
9268 test_AES_CCM_authenticated_encryption_test_case_128_3),
9269 TEST_CASE_ST(ut_setup, ut_teardown,
9270 test_AES_CCM_authenticated_decryption_test_case_128_3),
9272 TEST_CASES_END() /**< NULL terminate unit test array */
9276 static struct unit_test_suite cryptodev_openssl_testsuite = {
9277 .suite_name = "Crypto Device OPENSSL Unit Test Suite",
9278 .setup = testsuite_setup,
9279 .teardown = testsuite_teardown,
9280 .unit_test_cases = {
9281 TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session),
9282 TEST_CASE_ST(ut_setup, ut_teardown,
9283 test_multi_session_random_usage),
9284 TEST_CASE_ST(ut_setup, ut_teardown,
9285 test_AES_chain_openssl_all),
9286 TEST_CASE_ST(ut_setup, ut_teardown,
9287 test_AES_cipheronly_openssl_all),
9288 TEST_CASE_ST(ut_setup, ut_teardown,
9289 test_3DES_chain_openssl_all),
9290 TEST_CASE_ST(ut_setup, ut_teardown,
9291 test_3DES_cipheronly_openssl_all),
9292 TEST_CASE_ST(ut_setup, ut_teardown,
9293 test_DES_cipheronly_openssl_all),
9294 TEST_CASE_ST(ut_setup, ut_teardown,
9295 test_DES_docsis_openssl_all),
9296 TEST_CASE_ST(ut_setup, ut_teardown,
9297 test_authonly_openssl_all),
9299 /** AES GCM Authenticated Encryption */
9300 TEST_CASE_ST(ut_setup, ut_teardown,
9301 test_AES_GCM_authenticated_encryption_test_case_1),
9302 TEST_CASE_ST(ut_setup, ut_teardown,
9303 test_AES_GCM_authenticated_encryption_test_case_2),
9304 TEST_CASE_ST(ut_setup, ut_teardown,
9305 test_AES_GCM_authenticated_encryption_test_case_3),
9306 TEST_CASE_ST(ut_setup, ut_teardown,
9307 test_AES_GCM_authenticated_encryption_test_case_4),
9308 TEST_CASE_ST(ut_setup, ut_teardown,
9309 test_AES_GCM_authenticated_encryption_test_case_5),
9310 TEST_CASE_ST(ut_setup, ut_teardown,
9311 test_AES_GCM_authenticated_encryption_test_case_6),
9312 TEST_CASE_ST(ut_setup, ut_teardown,
9313 test_AES_GCM_authenticated_encryption_test_case_7),
9315 /** AES GCM Authenticated Decryption */
9316 TEST_CASE_ST(ut_setup, ut_teardown,
9317 test_AES_GCM_authenticated_decryption_test_case_1),
9318 TEST_CASE_ST(ut_setup, ut_teardown,
9319 test_AES_GCM_authenticated_decryption_test_case_2),
9320 TEST_CASE_ST(ut_setup, ut_teardown,
9321 test_AES_GCM_authenticated_decryption_test_case_3),
9322 TEST_CASE_ST(ut_setup, ut_teardown,
9323 test_AES_GCM_authenticated_decryption_test_case_4),
9324 TEST_CASE_ST(ut_setup, ut_teardown,
9325 test_AES_GCM_authenticated_decryption_test_case_5),
9326 TEST_CASE_ST(ut_setup, ut_teardown,
9327 test_AES_GCM_authenticated_decryption_test_case_6),
9328 TEST_CASE_ST(ut_setup, ut_teardown,
9329 test_AES_GCM_authenticated_decryption_test_case_7),
9332 /** AES GCM Authenticated Encryption 192 bits key */
9333 TEST_CASE_ST(ut_setup, ut_teardown,
9334 test_AES_GCM_auth_encryption_test_case_192_1),
9335 TEST_CASE_ST(ut_setup, ut_teardown,
9336 test_AES_GCM_auth_encryption_test_case_192_2),
9337 TEST_CASE_ST(ut_setup, ut_teardown,
9338 test_AES_GCM_auth_encryption_test_case_192_3),
9339 TEST_CASE_ST(ut_setup, ut_teardown,
9340 test_AES_GCM_auth_encryption_test_case_192_4),
9341 TEST_CASE_ST(ut_setup, ut_teardown,
9342 test_AES_GCM_auth_encryption_test_case_192_5),
9343 TEST_CASE_ST(ut_setup, ut_teardown,
9344 test_AES_GCM_auth_encryption_test_case_192_6),
9345 TEST_CASE_ST(ut_setup, ut_teardown,
9346 test_AES_GCM_auth_encryption_test_case_192_7),
9348 /** AES GCM Authenticated Decryption 192 bits key */
9349 TEST_CASE_ST(ut_setup, ut_teardown,
9350 test_AES_GCM_auth_decryption_test_case_192_1),
9351 TEST_CASE_ST(ut_setup, ut_teardown,
9352 test_AES_GCM_auth_decryption_test_case_192_2),
9353 TEST_CASE_ST(ut_setup, ut_teardown,
9354 test_AES_GCM_auth_decryption_test_case_192_3),
9355 TEST_CASE_ST(ut_setup, ut_teardown,
9356 test_AES_GCM_auth_decryption_test_case_192_4),
9357 TEST_CASE_ST(ut_setup, ut_teardown,
9358 test_AES_GCM_auth_decryption_test_case_192_5),
9359 TEST_CASE_ST(ut_setup, ut_teardown,
9360 test_AES_GCM_auth_decryption_test_case_192_6),
9361 TEST_CASE_ST(ut_setup, ut_teardown,
9362 test_AES_GCM_auth_decryption_test_case_192_7),
9364 /** AES GCM Authenticated Encryption 256 bits key */
9365 TEST_CASE_ST(ut_setup, ut_teardown,
9366 test_AES_GCM_auth_encryption_test_case_256_1),
9367 TEST_CASE_ST(ut_setup, ut_teardown,
9368 test_AES_GCM_auth_encryption_test_case_256_2),
9369 TEST_CASE_ST(ut_setup, ut_teardown,
9370 test_AES_GCM_auth_encryption_test_case_256_3),
9371 TEST_CASE_ST(ut_setup, ut_teardown,
9372 test_AES_GCM_auth_encryption_test_case_256_4),
9373 TEST_CASE_ST(ut_setup, ut_teardown,
9374 test_AES_GCM_auth_encryption_test_case_256_5),
9375 TEST_CASE_ST(ut_setup, ut_teardown,
9376 test_AES_GCM_auth_encryption_test_case_256_6),
9377 TEST_CASE_ST(ut_setup, ut_teardown,
9378 test_AES_GCM_auth_encryption_test_case_256_7),
9380 /** AES GCM Authenticated Decryption 256 bits key */
9381 TEST_CASE_ST(ut_setup, ut_teardown,
9382 test_AES_GCM_auth_decryption_test_case_256_1),
9383 TEST_CASE_ST(ut_setup, ut_teardown,
9384 test_AES_GCM_auth_decryption_test_case_256_2),
9385 TEST_CASE_ST(ut_setup, ut_teardown,
9386 test_AES_GCM_auth_decryption_test_case_256_3),
9387 TEST_CASE_ST(ut_setup, ut_teardown,
9388 test_AES_GCM_auth_decryption_test_case_256_4),
9389 TEST_CASE_ST(ut_setup, ut_teardown,
9390 test_AES_GCM_auth_decryption_test_case_256_5),
9391 TEST_CASE_ST(ut_setup, ut_teardown,
9392 test_AES_GCM_auth_decryption_test_case_256_6),
9393 TEST_CASE_ST(ut_setup, ut_teardown,
9394 test_AES_GCM_auth_decryption_test_case_256_7),
9396 /** AES GMAC Authentication */
9397 TEST_CASE_ST(ut_setup, ut_teardown,
9398 test_AES_GMAC_authentication_test_case_1),
9399 TEST_CASE_ST(ut_setup, ut_teardown,
9400 test_AES_GMAC_authentication_verify_test_case_1),
9401 TEST_CASE_ST(ut_setup, ut_teardown,
9402 test_AES_GMAC_authentication_test_case_2),
9403 TEST_CASE_ST(ut_setup, ut_teardown,
9404 test_AES_GMAC_authentication_verify_test_case_2),
9405 TEST_CASE_ST(ut_setup, ut_teardown,
9406 test_AES_GMAC_authentication_test_case_3),
9407 TEST_CASE_ST(ut_setup, ut_teardown,
9408 test_AES_GMAC_authentication_verify_test_case_3),
9409 TEST_CASE_ST(ut_setup, ut_teardown,
9410 test_AES_GMAC_authentication_test_case_4),
9411 TEST_CASE_ST(ut_setup, ut_teardown,
9412 test_AES_GMAC_authentication_verify_test_case_4),
9414 /** AES CCM Authenticated Encryption 128 bits key */
9415 TEST_CASE_ST(ut_setup, ut_teardown,
9416 test_AES_CCM_authenticated_encryption_test_case_128_1),
9417 TEST_CASE_ST(ut_setup, ut_teardown,
9418 test_AES_CCM_authenticated_encryption_test_case_128_2),
9419 TEST_CASE_ST(ut_setup, ut_teardown,
9420 test_AES_CCM_authenticated_encryption_test_case_128_3),
9422 /** AES CCM Authenticated Decryption 128 bits key*/
9423 TEST_CASE_ST(ut_setup, ut_teardown,
9424 test_AES_CCM_authenticated_decryption_test_case_128_1),
9425 TEST_CASE_ST(ut_setup, ut_teardown,
9426 test_AES_CCM_authenticated_decryption_test_case_128_2),
9427 TEST_CASE_ST(ut_setup, ut_teardown,
9428 test_AES_CCM_authenticated_decryption_test_case_128_3),
9430 /** AES CCM Authenticated Encryption 192 bits key */
9431 TEST_CASE_ST(ut_setup, ut_teardown,
9432 test_AES_CCM_authenticated_encryption_test_case_192_1),
9433 TEST_CASE_ST(ut_setup, ut_teardown,
9434 test_AES_CCM_authenticated_encryption_test_case_192_2),
9435 TEST_CASE_ST(ut_setup, ut_teardown,
9436 test_AES_CCM_authenticated_encryption_test_case_192_3),
9438 /** AES CCM Authenticated Decryption 192 bits key*/
9439 TEST_CASE_ST(ut_setup, ut_teardown,
9440 test_AES_CCM_authenticated_decryption_test_case_192_1),
9441 TEST_CASE_ST(ut_setup, ut_teardown,
9442 test_AES_CCM_authenticated_decryption_test_case_192_2),
9443 TEST_CASE_ST(ut_setup, ut_teardown,
9444 test_AES_CCM_authenticated_decryption_test_case_192_3),
9446 /** AES CCM Authenticated Encryption 256 bits key */
9447 TEST_CASE_ST(ut_setup, ut_teardown,
9448 test_AES_CCM_authenticated_encryption_test_case_256_1),
9449 TEST_CASE_ST(ut_setup, ut_teardown,
9450 test_AES_CCM_authenticated_encryption_test_case_256_2),
9451 TEST_CASE_ST(ut_setup, ut_teardown,
9452 test_AES_CCM_authenticated_encryption_test_case_256_3),
9454 /** AES CCM Authenticated Decryption 256 bits key*/
9455 TEST_CASE_ST(ut_setup, ut_teardown,
9456 test_AES_CCM_authenticated_decryption_test_case_256_1),
9457 TEST_CASE_ST(ut_setup, ut_teardown,
9458 test_AES_CCM_authenticated_decryption_test_case_256_2),
9459 TEST_CASE_ST(ut_setup, ut_teardown,
9460 test_AES_CCM_authenticated_decryption_test_case_256_3),
9462 /** Scatter-Gather */
9463 TEST_CASE_ST(ut_setup, ut_teardown,
9464 test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_1seg),
9466 /** Negative tests */
9467 TEST_CASE_ST(ut_setup, ut_teardown,
9468 authentication_verify_HMAC_SHA1_fail_data_corrupt),
9469 TEST_CASE_ST(ut_setup, ut_teardown,
9470 authentication_verify_HMAC_SHA1_fail_tag_corrupt),
9471 TEST_CASE_ST(ut_setup, ut_teardown,
9472 authentication_verify_AES128_GMAC_fail_data_corrupt),
9473 TEST_CASE_ST(ut_setup, ut_teardown,
9474 authentication_verify_AES128_GMAC_fail_tag_corrupt),
9475 TEST_CASE_ST(ut_setup, ut_teardown,
9476 auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
9477 TEST_CASE_ST(ut_setup, ut_teardown,
9478 auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
9480 TEST_CASES_END() /**< NULL terminate unit test array */
9484 static struct unit_test_suite cryptodev_aesni_gcm_testsuite = {
9485 .suite_name = "Crypto Device AESNI GCM Unit Test Suite",
9486 .setup = testsuite_setup,
9487 .teardown = testsuite_teardown,
9488 .unit_test_cases = {
9489 /** AES GCM Authenticated Encryption */
9490 TEST_CASE_ST(ut_setup, ut_teardown,
9491 test_AES_GCM_authenticated_encryption_test_case_1),
9492 TEST_CASE_ST(ut_setup, ut_teardown,
9493 test_AES_GCM_authenticated_encryption_test_case_2),
9494 TEST_CASE_ST(ut_setup, ut_teardown,
9495 test_AES_GCM_authenticated_encryption_test_case_3),
9496 TEST_CASE_ST(ut_setup, ut_teardown,
9497 test_AES_GCM_authenticated_encryption_test_case_4),
9498 TEST_CASE_ST(ut_setup, ut_teardown,
9499 test_AES_GCM_authenticated_encryption_test_case_5),
9500 TEST_CASE_ST(ut_setup, ut_teardown,
9501 test_AES_GCM_authenticated_encryption_test_case_6),
9502 TEST_CASE_ST(ut_setup, ut_teardown,
9503 test_AES_GCM_authenticated_encryption_test_case_7),
9505 /** AES GCM Authenticated Decryption */
9506 TEST_CASE_ST(ut_setup, ut_teardown,
9507 test_AES_GCM_authenticated_decryption_test_case_1),
9508 TEST_CASE_ST(ut_setup, ut_teardown,
9509 test_AES_GCM_authenticated_decryption_test_case_2),
9510 TEST_CASE_ST(ut_setup, ut_teardown,
9511 test_AES_GCM_authenticated_decryption_test_case_3),
9512 TEST_CASE_ST(ut_setup, ut_teardown,
9513 test_AES_GCM_authenticated_decryption_test_case_4),
9514 TEST_CASE_ST(ut_setup, ut_teardown,
9515 test_AES_GCM_authenticated_decryption_test_case_5),
9516 TEST_CASE_ST(ut_setup, ut_teardown,
9517 test_AES_GCM_authenticated_decryption_test_case_6),
9518 TEST_CASE_ST(ut_setup, ut_teardown,
9519 test_AES_GCM_authenticated_decryption_test_case_7),
9521 /** AES GCM Authenticated Encryption 192 bits key */
9522 TEST_CASE_ST(ut_setup, ut_teardown,
9523 test_AES_GCM_auth_encryption_test_case_192_1),
9524 TEST_CASE_ST(ut_setup, ut_teardown,
9525 test_AES_GCM_auth_encryption_test_case_192_2),
9526 TEST_CASE_ST(ut_setup, ut_teardown,
9527 test_AES_GCM_auth_encryption_test_case_192_3),
9528 TEST_CASE_ST(ut_setup, ut_teardown,
9529 test_AES_GCM_auth_encryption_test_case_192_4),
9530 TEST_CASE_ST(ut_setup, ut_teardown,
9531 test_AES_GCM_auth_encryption_test_case_192_5),
9532 TEST_CASE_ST(ut_setup, ut_teardown,
9533 test_AES_GCM_auth_encryption_test_case_192_6),
9534 TEST_CASE_ST(ut_setup, ut_teardown,
9535 test_AES_GCM_auth_encryption_test_case_192_7),
9537 /** AES GCM Authenticated Decryption 192 bits key */
9538 TEST_CASE_ST(ut_setup, ut_teardown,
9539 test_AES_GCM_auth_decryption_test_case_192_1),
9540 TEST_CASE_ST(ut_setup, ut_teardown,
9541 test_AES_GCM_auth_decryption_test_case_192_2),
9542 TEST_CASE_ST(ut_setup, ut_teardown,
9543 test_AES_GCM_auth_decryption_test_case_192_3),
9544 TEST_CASE_ST(ut_setup, ut_teardown,
9545 test_AES_GCM_auth_decryption_test_case_192_4),
9546 TEST_CASE_ST(ut_setup, ut_teardown,
9547 test_AES_GCM_auth_decryption_test_case_192_5),
9548 TEST_CASE_ST(ut_setup, ut_teardown,
9549 test_AES_GCM_auth_decryption_test_case_192_6),
9550 TEST_CASE_ST(ut_setup, ut_teardown,
9551 test_AES_GCM_auth_decryption_test_case_192_7),
9553 /** AES GCM Authenticated Encryption 256 bits key */
9554 TEST_CASE_ST(ut_setup, ut_teardown,
9555 test_AES_GCM_auth_encryption_test_case_256_1),
9556 TEST_CASE_ST(ut_setup, ut_teardown,
9557 test_AES_GCM_auth_encryption_test_case_256_2),
9558 TEST_CASE_ST(ut_setup, ut_teardown,
9559 test_AES_GCM_auth_encryption_test_case_256_3),
9560 TEST_CASE_ST(ut_setup, ut_teardown,
9561 test_AES_GCM_auth_encryption_test_case_256_4),
9562 TEST_CASE_ST(ut_setup, ut_teardown,
9563 test_AES_GCM_auth_encryption_test_case_256_5),
9564 TEST_CASE_ST(ut_setup, ut_teardown,
9565 test_AES_GCM_auth_encryption_test_case_256_6),
9566 TEST_CASE_ST(ut_setup, ut_teardown,
9567 test_AES_GCM_auth_encryption_test_case_256_7),
9569 /** AES GCM Authenticated Decryption 256 bits key */
9570 TEST_CASE_ST(ut_setup, ut_teardown,
9571 test_AES_GCM_auth_decryption_test_case_256_1),
9572 TEST_CASE_ST(ut_setup, ut_teardown,
9573 test_AES_GCM_auth_decryption_test_case_256_2),
9574 TEST_CASE_ST(ut_setup, ut_teardown,
9575 test_AES_GCM_auth_decryption_test_case_256_3),
9576 TEST_CASE_ST(ut_setup, ut_teardown,
9577 test_AES_GCM_auth_decryption_test_case_256_4),
9578 TEST_CASE_ST(ut_setup, ut_teardown,
9579 test_AES_GCM_auth_decryption_test_case_256_5),
9580 TEST_CASE_ST(ut_setup, ut_teardown,
9581 test_AES_GCM_auth_decryption_test_case_256_6),
9582 TEST_CASE_ST(ut_setup, ut_teardown,
9583 test_AES_GCM_auth_decryption_test_case_256_7),
9585 /** AES GCM Authenticated Encryption big aad size */
9586 TEST_CASE_ST(ut_setup, ut_teardown,
9587 test_AES_GCM_auth_encryption_test_case_aad_1),
9588 TEST_CASE_ST(ut_setup, ut_teardown,
9589 test_AES_GCM_auth_encryption_test_case_aad_2),
9591 /** AES GCM Authenticated Decryption big aad size */
9592 TEST_CASE_ST(ut_setup, ut_teardown,
9593 test_AES_GCM_auth_decryption_test_case_aad_1),
9594 TEST_CASE_ST(ut_setup, ut_teardown,
9595 test_AES_GCM_auth_decryption_test_case_aad_2),
9597 /** AES GMAC Authentication */
9598 TEST_CASE_ST(ut_setup, ut_teardown,
9599 test_AES_GMAC_authentication_test_case_1),
9600 TEST_CASE_ST(ut_setup, ut_teardown,
9601 test_AES_GMAC_authentication_verify_test_case_1),
9602 TEST_CASE_ST(ut_setup, ut_teardown,
9603 test_AES_GMAC_authentication_test_case_3),
9604 TEST_CASE_ST(ut_setup, ut_teardown,
9605 test_AES_GMAC_authentication_verify_test_case_3),
9606 TEST_CASE_ST(ut_setup, ut_teardown,
9607 test_AES_GMAC_authentication_test_case_4),
9608 TEST_CASE_ST(ut_setup, ut_teardown,
9609 test_AES_GMAC_authentication_verify_test_case_4),
9611 /** Negative tests */
9612 TEST_CASE_ST(ut_setup, ut_teardown,
9613 authentication_verify_AES128_GMAC_fail_data_corrupt),
9614 TEST_CASE_ST(ut_setup, ut_teardown,
9615 authentication_verify_AES128_GMAC_fail_tag_corrupt),
9617 /** Out of place tests */
9618 TEST_CASE_ST(ut_setup, ut_teardown,
9619 test_AES_GCM_authenticated_encryption_oop_test_case_1),
9620 TEST_CASE_ST(ut_setup, ut_teardown,
9621 test_AES_GCM_authenticated_decryption_oop_test_case_1),
9623 /** Session-less tests */
9624 TEST_CASE_ST(ut_setup, ut_teardown,
9625 test_AES_GCM_authenticated_encryption_sessionless_test_case_1),
9626 TEST_CASE_ST(ut_setup, ut_teardown,
9627 test_AES_GCM_authenticated_decryption_sessionless_test_case_1),
9629 /** Scatter-Gather */
9630 TEST_CASE_ST(ut_setup, ut_teardown,
9631 test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_1seg),
9633 TEST_CASES_END() /**< NULL terminate unit test array */
9637 static struct unit_test_suite cryptodev_sw_kasumi_testsuite = {
9638 .suite_name = "Crypto Device SW KASUMI Unit Test Suite",
9639 .setup = testsuite_setup,
9640 .teardown = testsuite_teardown,
9641 .unit_test_cases = {
9642 /** KASUMI encrypt only (UEA1) */
9643 TEST_CASE_ST(ut_setup, ut_teardown,
9644 test_kasumi_encryption_test_case_1),
9645 TEST_CASE_ST(ut_setup, ut_teardown,
9646 test_kasumi_encryption_test_case_1_sgl),
9647 TEST_CASE_ST(ut_setup, ut_teardown,
9648 test_kasumi_encryption_test_case_2),
9649 TEST_CASE_ST(ut_setup, ut_teardown,
9650 test_kasumi_encryption_test_case_3),
9651 TEST_CASE_ST(ut_setup, ut_teardown,
9652 test_kasumi_encryption_test_case_4),
9653 TEST_CASE_ST(ut_setup, ut_teardown,
9654 test_kasumi_encryption_test_case_5),
9655 /** KASUMI decrypt only (UEA1) */
9656 TEST_CASE_ST(ut_setup, ut_teardown,
9657 test_kasumi_decryption_test_case_1),
9658 TEST_CASE_ST(ut_setup, ut_teardown,
9659 test_kasumi_decryption_test_case_2),
9660 TEST_CASE_ST(ut_setup, ut_teardown,
9661 test_kasumi_decryption_test_case_3),
9662 TEST_CASE_ST(ut_setup, ut_teardown,
9663 test_kasumi_decryption_test_case_4),
9664 TEST_CASE_ST(ut_setup, ut_teardown,
9665 test_kasumi_decryption_test_case_5),
9667 TEST_CASE_ST(ut_setup, ut_teardown,
9668 test_kasumi_encryption_test_case_1_oop),
9669 TEST_CASE_ST(ut_setup, ut_teardown,
9670 test_kasumi_encryption_test_case_1_oop_sgl),
9673 TEST_CASE_ST(ut_setup, ut_teardown,
9674 test_kasumi_decryption_test_case_1_oop),
9676 /** KASUMI hash only (UIA1) */
9677 TEST_CASE_ST(ut_setup, ut_teardown,
9678 test_kasumi_hash_generate_test_case_1),
9679 TEST_CASE_ST(ut_setup, ut_teardown,
9680 test_kasumi_hash_generate_test_case_2),
9681 TEST_CASE_ST(ut_setup, ut_teardown,
9682 test_kasumi_hash_generate_test_case_3),
9683 TEST_CASE_ST(ut_setup, ut_teardown,
9684 test_kasumi_hash_generate_test_case_4),
9685 TEST_CASE_ST(ut_setup, ut_teardown,
9686 test_kasumi_hash_generate_test_case_5),
9687 TEST_CASE_ST(ut_setup, ut_teardown,
9688 test_kasumi_hash_generate_test_case_6),
9689 TEST_CASE_ST(ut_setup, ut_teardown,
9690 test_kasumi_hash_verify_test_case_1),
9691 TEST_CASE_ST(ut_setup, ut_teardown,
9692 test_kasumi_hash_verify_test_case_2),
9693 TEST_CASE_ST(ut_setup, ut_teardown,
9694 test_kasumi_hash_verify_test_case_3),
9695 TEST_CASE_ST(ut_setup, ut_teardown,
9696 test_kasumi_hash_verify_test_case_4),
9697 TEST_CASE_ST(ut_setup, ut_teardown,
9698 test_kasumi_hash_verify_test_case_5),
9699 TEST_CASE_ST(ut_setup, ut_teardown,
9700 test_kasumi_auth_cipher_test_case_1),
9701 TEST_CASE_ST(ut_setup, ut_teardown,
9702 test_kasumi_cipher_auth_test_case_1),
9703 TEST_CASES_END() /**< NULL terminate unit test array */
9706 static struct unit_test_suite cryptodev_sw_snow3g_testsuite = {
9707 .suite_name = "Crypto Device SW SNOW 3G Unit Test Suite",
9708 .setup = testsuite_setup,
9709 .teardown = testsuite_teardown,
9710 .unit_test_cases = {
9711 /** SNOW 3G encrypt only (UEA2) */
9712 TEST_CASE_ST(ut_setup, ut_teardown,
9713 test_snow3g_encryption_test_case_1),
9714 TEST_CASE_ST(ut_setup, ut_teardown,
9715 test_snow3g_encryption_test_case_2),
9716 TEST_CASE_ST(ut_setup, ut_teardown,
9717 test_snow3g_encryption_test_case_3),
9718 TEST_CASE_ST(ut_setup, ut_teardown,
9719 test_snow3g_encryption_test_case_4),
9720 TEST_CASE_ST(ut_setup, ut_teardown,
9721 test_snow3g_encryption_test_case_5),
9723 TEST_CASE_ST(ut_setup, ut_teardown,
9724 test_snow3g_encryption_test_case_1_oop),
9725 TEST_CASE_ST(ut_setup, ut_teardown,
9726 test_snow3g_encryption_test_case_1_oop_sgl),
9727 TEST_CASE_ST(ut_setup, ut_teardown,
9728 test_snow3g_decryption_test_case_1_oop),
9730 TEST_CASE_ST(ut_setup, ut_teardown,
9731 test_snow3g_encryption_test_case_1_offset_oop),
9733 /** SNOW 3G decrypt only (UEA2) */
9734 TEST_CASE_ST(ut_setup, ut_teardown,
9735 test_snow3g_decryption_test_case_1),
9736 TEST_CASE_ST(ut_setup, ut_teardown,
9737 test_snow3g_decryption_test_case_2),
9738 TEST_CASE_ST(ut_setup, ut_teardown,
9739 test_snow3g_decryption_test_case_3),
9740 TEST_CASE_ST(ut_setup, ut_teardown,
9741 test_snow3g_decryption_test_case_4),
9742 TEST_CASE_ST(ut_setup, ut_teardown,
9743 test_snow3g_decryption_test_case_5),
9744 TEST_CASE_ST(ut_setup, ut_teardown,
9745 test_snow3g_hash_generate_test_case_1),
9746 TEST_CASE_ST(ut_setup, ut_teardown,
9747 test_snow3g_hash_generate_test_case_2),
9748 TEST_CASE_ST(ut_setup, ut_teardown,
9749 test_snow3g_hash_generate_test_case_3),
9750 /* Tests with buffers which length is not byte-aligned */
9751 TEST_CASE_ST(ut_setup, ut_teardown,
9752 test_snow3g_hash_generate_test_case_4),
9753 TEST_CASE_ST(ut_setup, ut_teardown,
9754 test_snow3g_hash_generate_test_case_5),
9755 TEST_CASE_ST(ut_setup, ut_teardown,
9756 test_snow3g_hash_generate_test_case_6),
9757 TEST_CASE_ST(ut_setup, ut_teardown,
9758 test_snow3g_hash_verify_test_case_1),
9759 TEST_CASE_ST(ut_setup, ut_teardown,
9760 test_snow3g_hash_verify_test_case_2),
9761 TEST_CASE_ST(ut_setup, ut_teardown,
9762 test_snow3g_hash_verify_test_case_3),
9763 /* Tests with buffers which length is not byte-aligned */
9764 TEST_CASE_ST(ut_setup, ut_teardown,
9765 test_snow3g_hash_verify_test_case_4),
9766 TEST_CASE_ST(ut_setup, ut_teardown,
9767 test_snow3g_hash_verify_test_case_5),
9768 TEST_CASE_ST(ut_setup, ut_teardown,
9769 test_snow3g_hash_verify_test_case_6),
9770 TEST_CASE_ST(ut_setup, ut_teardown,
9771 test_snow3g_cipher_auth_test_case_1),
9772 TEST_CASE_ST(ut_setup, ut_teardown,
9773 test_snow3g_auth_cipher_test_case_1),
9775 TEST_CASES_END() /**< NULL terminate unit test array */
9779 static struct unit_test_suite cryptodev_sw_zuc_testsuite = {
9780 .suite_name = "Crypto Device SW ZUC Unit Test Suite",
9781 .setup = testsuite_setup,
9782 .teardown = testsuite_teardown,
9783 .unit_test_cases = {
9784 /** ZUC encrypt only (EEA3) */
9785 TEST_CASE_ST(ut_setup, ut_teardown,
9786 test_zuc_encryption_test_case_1),
9787 TEST_CASE_ST(ut_setup, ut_teardown,
9788 test_zuc_encryption_test_case_2),
9789 TEST_CASE_ST(ut_setup, ut_teardown,
9790 test_zuc_encryption_test_case_3),
9791 TEST_CASE_ST(ut_setup, ut_teardown,
9792 test_zuc_encryption_test_case_4),
9793 TEST_CASE_ST(ut_setup, ut_teardown,
9794 test_zuc_encryption_test_case_5),
9795 TEST_CASE_ST(ut_setup, ut_teardown,
9796 test_zuc_hash_generate_test_case_1),
9797 TEST_CASE_ST(ut_setup, ut_teardown,
9798 test_zuc_hash_generate_test_case_2),
9799 TEST_CASE_ST(ut_setup, ut_teardown,
9800 test_zuc_hash_generate_test_case_3),
9801 TEST_CASE_ST(ut_setup, ut_teardown,
9802 test_zuc_hash_generate_test_case_4),
9803 TEST_CASE_ST(ut_setup, ut_teardown,
9804 test_zuc_hash_generate_test_case_5),
9805 TEST_CASE_ST(ut_setup, ut_teardown,
9806 test_zuc_encryption_test_case_6_sgl),
9807 TEST_CASES_END() /**< NULL terminate unit test array */
9811 static struct unit_test_suite cryptodev_dpaa_sec_testsuite = {
9812 .suite_name = "Crypto DPAA_SEC Unit Test Suite",
9813 .setup = testsuite_setup,
9814 .teardown = testsuite_teardown,
9815 .unit_test_cases = {
9816 TEST_CASE_ST(ut_setup, ut_teardown,
9817 test_device_configure_invalid_dev_id),
9818 TEST_CASE_ST(ut_setup, ut_teardown,
9819 test_multi_session),
9821 TEST_CASE_ST(ut_setup, ut_teardown,
9822 test_AES_chain_dpaa_sec_all),
9823 TEST_CASE_ST(ut_setup, ut_teardown,
9824 test_3DES_chain_dpaa_sec_all),
9825 TEST_CASE_ST(ut_setup, ut_teardown,
9826 test_AES_cipheronly_dpaa_sec_all),
9827 TEST_CASE_ST(ut_setup, ut_teardown,
9828 test_3DES_cipheronly_dpaa_sec_all),
9829 TEST_CASE_ST(ut_setup, ut_teardown,
9830 test_authonly_dpaa_sec_all),
9832 /** AES GCM Authenticated Encryption */
9833 TEST_CASE_ST(ut_setup, ut_teardown,
9834 test_AES_GCM_authenticated_encryption_test_case_1),
9835 TEST_CASE_ST(ut_setup, ut_teardown,
9836 test_AES_GCM_authenticated_encryption_test_case_2),
9837 TEST_CASE_ST(ut_setup, ut_teardown,
9838 test_AES_GCM_authenticated_encryption_test_case_3),
9839 TEST_CASE_ST(ut_setup, ut_teardown,
9840 test_AES_GCM_authenticated_encryption_test_case_4),
9841 TEST_CASE_ST(ut_setup, ut_teardown,
9842 test_AES_GCM_authenticated_encryption_test_case_5),
9843 TEST_CASE_ST(ut_setup, ut_teardown,
9844 test_AES_GCM_authenticated_encryption_test_case_6),
9845 TEST_CASE_ST(ut_setup, ut_teardown,
9846 test_AES_GCM_authenticated_encryption_test_case_7),
9848 /** AES GCM Authenticated Decryption */
9849 TEST_CASE_ST(ut_setup, ut_teardown,
9850 test_AES_GCM_authenticated_decryption_test_case_1),
9851 TEST_CASE_ST(ut_setup, ut_teardown,
9852 test_AES_GCM_authenticated_decryption_test_case_2),
9853 TEST_CASE_ST(ut_setup, ut_teardown,
9854 test_AES_GCM_authenticated_decryption_test_case_3),
9855 TEST_CASE_ST(ut_setup, ut_teardown,
9856 test_AES_GCM_authenticated_decryption_test_case_4),
9857 TEST_CASE_ST(ut_setup, ut_teardown,
9858 test_AES_GCM_authenticated_decryption_test_case_5),
9859 TEST_CASE_ST(ut_setup, ut_teardown,
9860 test_AES_GCM_authenticated_decryption_test_case_6),
9861 TEST_CASE_ST(ut_setup, ut_teardown,
9862 test_AES_GCM_authenticated_decryption_test_case_7),
9864 /** AES GCM Authenticated Encryption 256 bits key */
9865 TEST_CASE_ST(ut_setup, ut_teardown,
9866 test_AES_GCM_auth_encryption_test_case_256_1),
9867 TEST_CASE_ST(ut_setup, ut_teardown,
9868 test_AES_GCM_auth_encryption_test_case_256_2),
9869 TEST_CASE_ST(ut_setup, ut_teardown,
9870 test_AES_GCM_auth_encryption_test_case_256_3),
9871 TEST_CASE_ST(ut_setup, ut_teardown,
9872 test_AES_GCM_auth_encryption_test_case_256_4),
9873 TEST_CASE_ST(ut_setup, ut_teardown,
9874 test_AES_GCM_auth_encryption_test_case_256_5),
9875 TEST_CASE_ST(ut_setup, ut_teardown,
9876 test_AES_GCM_auth_encryption_test_case_256_6),
9877 TEST_CASE_ST(ut_setup, ut_teardown,
9878 test_AES_GCM_auth_encryption_test_case_256_7),
9880 /** AES GCM Authenticated Decryption 256 bits key */
9881 TEST_CASE_ST(ut_setup, ut_teardown,
9882 test_AES_GCM_auth_decryption_test_case_256_1),
9883 TEST_CASE_ST(ut_setup, ut_teardown,
9884 test_AES_GCM_auth_decryption_test_case_256_2),
9885 TEST_CASE_ST(ut_setup, ut_teardown,
9886 test_AES_GCM_auth_decryption_test_case_256_3),
9887 TEST_CASE_ST(ut_setup, ut_teardown,
9888 test_AES_GCM_auth_decryption_test_case_256_4),
9889 TEST_CASE_ST(ut_setup, ut_teardown,
9890 test_AES_GCM_auth_decryption_test_case_256_5),
9891 TEST_CASE_ST(ut_setup, ut_teardown,
9892 test_AES_GCM_auth_decryption_test_case_256_6),
9893 TEST_CASE_ST(ut_setup, ut_teardown,
9894 test_AES_GCM_auth_decryption_test_case_256_7),
9896 /** Out of place tests */
9897 TEST_CASE_ST(ut_setup, ut_teardown,
9898 test_AES_GCM_authenticated_encryption_oop_test_case_1),
9899 TEST_CASE_ST(ut_setup, ut_teardown,
9900 test_AES_GCM_authenticated_decryption_oop_test_case_1),
9902 /** Scatter-Gather */
9903 TEST_CASE_ST(ut_setup, ut_teardown,
9904 test_AES_GCM_auth_encrypt_SGL_in_place_1500B),
9905 TEST_CASE_ST(ut_setup, ut_teardown,
9906 test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_400B),
9907 TEST_CASE_ST(ut_setup, ut_teardown,
9908 test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_1seg),
9909 TEST_CASE_ST(ut_setup, ut_teardown,
9910 test_AES_GCM_auth_encrypt_SGL_out_of_place_1500B_2000B),
9912 TEST_CASES_END() /**< NULL terminate unit test array */
9916 static struct unit_test_suite cryptodev_dpaa2_sec_testsuite = {
9917 .suite_name = "Crypto DPAA2_SEC Unit Test Suite",
9918 .setup = testsuite_setup,
9919 .teardown = testsuite_teardown,
9920 .unit_test_cases = {
9921 TEST_CASE_ST(ut_setup, ut_teardown,
9922 test_device_configure_invalid_dev_id),
9923 TEST_CASE_ST(ut_setup, ut_teardown,
9924 test_multi_session),
9926 TEST_CASE_ST(ut_setup, ut_teardown,
9927 test_AES_chain_dpaa2_sec_all),
9928 TEST_CASE_ST(ut_setup, ut_teardown,
9929 test_3DES_chain_dpaa2_sec_all),
9930 TEST_CASE_ST(ut_setup, ut_teardown,
9931 test_AES_cipheronly_dpaa2_sec_all),
9932 TEST_CASE_ST(ut_setup, ut_teardown,
9933 test_3DES_cipheronly_dpaa2_sec_all),
9934 TEST_CASE_ST(ut_setup, ut_teardown,
9935 test_authonly_dpaa2_sec_all),
9937 /** AES GCM Authenticated Encryption */
9938 TEST_CASE_ST(ut_setup, ut_teardown,
9939 test_AES_GCM_authenticated_encryption_test_case_1),
9940 TEST_CASE_ST(ut_setup, ut_teardown,
9941 test_AES_GCM_authenticated_encryption_test_case_2),
9942 TEST_CASE_ST(ut_setup, ut_teardown,
9943 test_AES_GCM_authenticated_encryption_test_case_3),
9944 TEST_CASE_ST(ut_setup, ut_teardown,
9945 test_AES_GCM_authenticated_encryption_test_case_4),
9946 TEST_CASE_ST(ut_setup, ut_teardown,
9947 test_AES_GCM_authenticated_encryption_test_case_5),
9948 TEST_CASE_ST(ut_setup, ut_teardown,
9949 test_AES_GCM_authenticated_encryption_test_case_6),
9950 TEST_CASE_ST(ut_setup, ut_teardown,
9951 test_AES_GCM_authenticated_encryption_test_case_7),
9953 /** AES GCM Authenticated Decryption */
9954 TEST_CASE_ST(ut_setup, ut_teardown,
9955 test_AES_GCM_authenticated_decryption_test_case_1),
9956 TEST_CASE_ST(ut_setup, ut_teardown,
9957 test_AES_GCM_authenticated_decryption_test_case_2),
9958 TEST_CASE_ST(ut_setup, ut_teardown,
9959 test_AES_GCM_authenticated_decryption_test_case_3),
9960 TEST_CASE_ST(ut_setup, ut_teardown,
9961 test_AES_GCM_authenticated_decryption_test_case_4),
9962 TEST_CASE_ST(ut_setup, ut_teardown,
9963 test_AES_GCM_authenticated_decryption_test_case_5),
9964 TEST_CASE_ST(ut_setup, ut_teardown,
9965 test_AES_GCM_authenticated_decryption_test_case_6),
9966 TEST_CASE_ST(ut_setup, ut_teardown,
9967 test_AES_GCM_authenticated_decryption_test_case_7),
9969 /** AES GCM Authenticated Encryption 192 bits key */
9970 TEST_CASE_ST(ut_setup, ut_teardown,
9971 test_AES_GCM_auth_encryption_test_case_192_1),
9972 TEST_CASE_ST(ut_setup, ut_teardown,
9973 test_AES_GCM_auth_encryption_test_case_192_2),
9974 TEST_CASE_ST(ut_setup, ut_teardown,
9975 test_AES_GCM_auth_encryption_test_case_192_3),
9976 TEST_CASE_ST(ut_setup, ut_teardown,
9977 test_AES_GCM_auth_encryption_test_case_192_4),
9978 TEST_CASE_ST(ut_setup, ut_teardown,
9979 test_AES_GCM_auth_encryption_test_case_192_5),
9980 TEST_CASE_ST(ut_setup, ut_teardown,
9981 test_AES_GCM_auth_encryption_test_case_192_6),
9982 TEST_CASE_ST(ut_setup, ut_teardown,
9983 test_AES_GCM_auth_encryption_test_case_192_7),
9985 /** AES GCM Authenticated Decryption 192 bits key */
9986 TEST_CASE_ST(ut_setup, ut_teardown,
9987 test_AES_GCM_auth_decryption_test_case_192_1),
9988 TEST_CASE_ST(ut_setup, ut_teardown,
9989 test_AES_GCM_auth_decryption_test_case_192_2),
9990 TEST_CASE_ST(ut_setup, ut_teardown,
9991 test_AES_GCM_auth_decryption_test_case_192_3),
9992 TEST_CASE_ST(ut_setup, ut_teardown,
9993 test_AES_GCM_auth_decryption_test_case_192_4),
9994 TEST_CASE_ST(ut_setup, ut_teardown,
9995 test_AES_GCM_auth_decryption_test_case_192_5),
9996 TEST_CASE_ST(ut_setup, ut_teardown,
9997 test_AES_GCM_auth_decryption_test_case_192_6),
9998 TEST_CASE_ST(ut_setup, ut_teardown,
9999 test_AES_GCM_auth_decryption_test_case_192_7),
10001 /** AES GCM Authenticated Encryption 256 bits key */
10002 TEST_CASE_ST(ut_setup, ut_teardown,
10003 test_AES_GCM_auth_encryption_test_case_256_1),
10004 TEST_CASE_ST(ut_setup, ut_teardown,
10005 test_AES_GCM_auth_encryption_test_case_256_2),
10006 TEST_CASE_ST(ut_setup, ut_teardown,
10007 test_AES_GCM_auth_encryption_test_case_256_3),
10008 TEST_CASE_ST(ut_setup, ut_teardown,
10009 test_AES_GCM_auth_encryption_test_case_256_4),
10010 TEST_CASE_ST(ut_setup, ut_teardown,
10011 test_AES_GCM_auth_encryption_test_case_256_5),
10012 TEST_CASE_ST(ut_setup, ut_teardown,
10013 test_AES_GCM_auth_encryption_test_case_256_6),
10014 TEST_CASE_ST(ut_setup, ut_teardown,
10015 test_AES_GCM_auth_encryption_test_case_256_7),
10017 /** AES GCM Authenticated Decryption 256 bits key */
10018 TEST_CASE_ST(ut_setup, ut_teardown,
10019 test_AES_GCM_auth_decryption_test_case_256_1),
10020 TEST_CASE_ST(ut_setup, ut_teardown,
10021 test_AES_GCM_auth_decryption_test_case_256_2),
10022 TEST_CASE_ST(ut_setup, ut_teardown,
10023 test_AES_GCM_auth_decryption_test_case_256_3),
10024 TEST_CASE_ST(ut_setup, ut_teardown,
10025 test_AES_GCM_auth_decryption_test_case_256_4),
10026 TEST_CASE_ST(ut_setup, ut_teardown,
10027 test_AES_GCM_auth_decryption_test_case_256_5),
10028 TEST_CASE_ST(ut_setup, ut_teardown,
10029 test_AES_GCM_auth_decryption_test_case_256_6),
10030 TEST_CASE_ST(ut_setup, ut_teardown,
10031 test_AES_GCM_auth_decryption_test_case_256_7),
10033 /** Out of place tests */
10034 TEST_CASE_ST(ut_setup, ut_teardown,
10035 test_AES_GCM_authenticated_encryption_oop_test_case_1),
10036 TEST_CASE_ST(ut_setup, ut_teardown,
10037 test_AES_GCM_authenticated_decryption_oop_test_case_1),
10039 /** Scatter-Gather */
10040 TEST_CASE_ST(ut_setup, ut_teardown,
10041 test_AES_GCM_auth_encrypt_SGL_in_place_1500B),
10042 TEST_CASE_ST(ut_setup, ut_teardown,
10043 test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_400B),
10044 TEST_CASE_ST(ut_setup, ut_teardown,
10045 test_AES_GCM_auth_encrypt_SGL_out_of_place_400B_1seg),
10046 TEST_CASE_ST(ut_setup, ut_teardown,
10047 test_AES_GCM_auth_encrypt_SGL_out_of_place_1500B_2000B),
10049 TEST_CASES_END() /**< NULL terminate unit test array */
10053 static struct unit_test_suite cryptodev_null_testsuite = {
10054 .suite_name = "Crypto Device NULL Unit Test Suite",
10055 .setup = testsuite_setup,
10056 .teardown = testsuite_teardown,
10057 .unit_test_cases = {
10058 TEST_CASE_ST(ut_setup, ut_teardown,
10059 test_null_auth_only_operation),
10060 TEST_CASE_ST(ut_setup, ut_teardown,
10061 test_null_cipher_only_operation),
10062 TEST_CASE_ST(ut_setup, ut_teardown,
10063 test_null_cipher_auth_operation),
10064 TEST_CASE_ST(ut_setup, ut_teardown,
10065 test_null_auth_cipher_operation),
10066 TEST_CASE_ST(ut_setup, ut_teardown,
10067 test_null_invalid_operation),
10068 TEST_CASE_ST(ut_setup, ut_teardown,
10069 test_null_burst_operation),
10071 TEST_CASES_END() /**< NULL terminate unit test array */
10075 static struct unit_test_suite cryptodev_armv8_testsuite = {
10076 .suite_name = "Crypto Device ARMv8 Unit Test Suite",
10077 .setup = testsuite_setup,
10078 .teardown = testsuite_teardown,
10079 .unit_test_cases = {
10080 TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_armv8_all),
10082 /** Negative tests */
10083 TEST_CASE_ST(ut_setup, ut_teardown,
10084 auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
10085 TEST_CASE_ST(ut_setup, ut_teardown,
10086 auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
10088 TEST_CASES_END() /**< NULL terminate unit test array */
10092 static struct unit_test_suite cryptodev_mrvl_testsuite = {
10093 .suite_name = "Crypto Device Marvell Component Test Suite",
10094 .setup = testsuite_setup,
10095 .teardown = testsuite_teardown,
10096 .unit_test_cases = {
10097 TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session),
10098 TEST_CASE_ST(ut_setup, ut_teardown,
10099 test_multi_session_random_usage),
10100 TEST_CASE_ST(ut_setup, ut_teardown,
10101 test_AES_chain_mrvl_all),
10102 TEST_CASE_ST(ut_setup, ut_teardown,
10103 test_AES_cipheronly_mrvl_all),
10104 TEST_CASE_ST(ut_setup, ut_teardown,
10105 test_authonly_mrvl_all),
10106 TEST_CASE_ST(ut_setup, ut_teardown,
10107 test_3DES_chain_mrvl_all),
10108 TEST_CASE_ST(ut_setup, ut_teardown,
10109 test_3DES_cipheronly_mrvl_all),
10111 /** Negative tests */
10112 TEST_CASE_ST(ut_setup, ut_teardown,
10113 authentication_verify_HMAC_SHA1_fail_data_corrupt),
10114 TEST_CASE_ST(ut_setup, ut_teardown,
10115 authentication_verify_HMAC_SHA1_fail_tag_corrupt),
10116 TEST_CASE_ST(ut_setup, ut_teardown,
10117 auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
10118 TEST_CASE_ST(ut_setup, ut_teardown,
10119 auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
10121 TEST_CASES_END() /**< NULL terminate unit test array */
10125 static struct unit_test_suite cryptodev_ccp_testsuite = {
10126 .suite_name = "Crypto Device CCP Unit Test Suite",
10127 .setup = testsuite_setup,
10128 .teardown = testsuite_teardown,
10129 .unit_test_cases = {
10130 TEST_CASE_ST(ut_setup, ut_teardown, test_multi_session),
10131 TEST_CASE_ST(ut_setup, ut_teardown,
10132 test_multi_session_random_usage),
10133 TEST_CASE_ST(ut_setup, ut_teardown,
10134 test_AES_chain_ccp_all),
10135 TEST_CASE_ST(ut_setup, ut_teardown,
10136 test_AES_cipheronly_ccp_all),
10137 TEST_CASE_ST(ut_setup, ut_teardown,
10138 test_3DES_chain_ccp_all),
10139 TEST_CASE_ST(ut_setup, ut_teardown,
10140 test_3DES_cipheronly_ccp_all),
10141 TEST_CASE_ST(ut_setup, ut_teardown,
10142 test_authonly_ccp_all),
10144 /** Negative tests */
10145 TEST_CASE_ST(ut_setup, ut_teardown,
10146 authentication_verify_HMAC_SHA1_fail_data_corrupt),
10147 TEST_CASE_ST(ut_setup, ut_teardown,
10148 authentication_verify_HMAC_SHA1_fail_tag_corrupt),
10149 TEST_CASE_ST(ut_setup, ut_teardown,
10150 auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
10151 TEST_CASE_ST(ut_setup, ut_teardown,
10152 auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
10154 TEST_CASES_END() /**< NULL terminate unit test array */
10158 static struct unit_test_suite cryptodev_octeontx_testsuite = {
10159 .suite_name = "Crypto Device OCTEONTX Unit Test Suite",
10160 .setup = testsuite_setup,
10161 .teardown = testsuite_teardown,
10162 .unit_test_cases = {
10163 TEST_CASE_ST(ut_setup, ut_teardown,
10164 test_AES_chain_octeontx_all),
10165 TEST_CASE_ST(ut_setup, ut_teardown,
10166 test_AES_cipheronly_octeontx_all),
10167 TEST_CASE_ST(ut_setup, ut_teardown,
10168 test_3DES_chain_octeontx_all),
10169 TEST_CASE_ST(ut_setup, ut_teardown,
10170 test_3DES_cipheronly_octeontx_all),
10171 TEST_CASE_ST(ut_setup, ut_teardown,
10172 test_authonly_octeontx_all),
10174 /** AES GCM Authenticated Encryption */
10175 TEST_CASE_ST(ut_setup, ut_teardown,
10176 test_AES_GCM_authenticated_encryption_test_case_1),
10177 TEST_CASE_ST(ut_setup, ut_teardown,
10178 test_AES_GCM_authenticated_encryption_test_case_2),
10179 TEST_CASE_ST(ut_setup, ut_teardown,
10180 test_AES_GCM_authenticated_encryption_test_case_3),
10181 TEST_CASE_ST(ut_setup, ut_teardown,
10182 test_AES_GCM_authenticated_encryption_test_case_4),
10183 TEST_CASE_ST(ut_setup, ut_teardown,
10184 test_AES_GCM_authenticated_encryption_test_case_5),
10185 TEST_CASE_ST(ut_setup, ut_teardown,
10186 test_AES_GCM_authenticated_encryption_test_case_6),
10187 TEST_CASE_ST(ut_setup, ut_teardown,
10188 test_AES_GCM_authenticated_encryption_test_case_7),
10190 /** AES GCM Authenticated Decryption */
10191 TEST_CASE_ST(ut_setup, ut_teardown,
10192 test_AES_GCM_authenticated_decryption_test_case_1),
10193 TEST_CASE_ST(ut_setup, ut_teardown,
10194 test_AES_GCM_authenticated_decryption_test_case_2),
10195 TEST_CASE_ST(ut_setup, ut_teardown,
10196 test_AES_GCM_authenticated_decryption_test_case_3),
10197 TEST_CASE_ST(ut_setup, ut_teardown,
10198 test_AES_GCM_authenticated_decryption_test_case_4),
10199 TEST_CASE_ST(ut_setup, ut_teardown,
10200 test_AES_GCM_authenticated_decryption_test_case_5),
10201 TEST_CASE_ST(ut_setup, ut_teardown,
10202 test_AES_GCM_authenticated_decryption_test_case_6),
10203 TEST_CASE_ST(ut_setup, ut_teardown,
10204 test_AES_GCM_authenticated_decryption_test_case_7),
10205 /** AES GMAC Authentication */
10206 TEST_CASE_ST(ut_setup, ut_teardown,
10207 test_AES_GMAC_authentication_test_case_1),
10208 TEST_CASE_ST(ut_setup, ut_teardown,
10209 test_AES_GMAC_authentication_verify_test_case_1),
10210 TEST_CASE_ST(ut_setup, ut_teardown,
10211 test_AES_GMAC_authentication_test_case_2),
10212 TEST_CASE_ST(ut_setup, ut_teardown,
10213 test_AES_GMAC_authentication_verify_test_case_2),
10214 TEST_CASE_ST(ut_setup, ut_teardown,
10215 test_AES_GMAC_authentication_test_case_3),
10216 TEST_CASE_ST(ut_setup, ut_teardown,
10217 test_AES_GMAC_authentication_verify_test_case_3),
10219 /** SNOW 3G encrypt only (UEA2) */
10220 TEST_CASE_ST(ut_setup, ut_teardown,
10221 test_snow3g_encryption_test_case_1),
10222 TEST_CASE_ST(ut_setup, ut_teardown,
10223 test_snow3g_encryption_test_case_2),
10224 TEST_CASE_ST(ut_setup, ut_teardown,
10225 test_snow3g_encryption_test_case_3),
10226 TEST_CASE_ST(ut_setup, ut_teardown,
10227 test_snow3g_encryption_test_case_4),
10228 TEST_CASE_ST(ut_setup, ut_teardown,
10229 test_snow3g_encryption_test_case_5),
10231 TEST_CASE_ST(ut_setup, ut_teardown,
10232 test_snow3g_encryption_test_case_1_oop),
10233 TEST_CASE_ST(ut_setup, ut_teardown,
10234 test_snow3g_decryption_test_case_1_oop),
10235 TEST_CASE_ST(ut_setup, ut_teardown,
10236 test_snow3g_encryption_test_case_1_oop_sgl),
10238 /** SNOW 3G decrypt only (UEA2) */
10239 TEST_CASE_ST(ut_setup, ut_teardown,
10240 test_snow3g_decryption_test_case_1),
10241 TEST_CASE_ST(ut_setup, ut_teardown,
10242 test_snow3g_decryption_test_case_2),
10243 TEST_CASE_ST(ut_setup, ut_teardown,
10244 test_snow3g_decryption_test_case_3),
10245 TEST_CASE_ST(ut_setup, ut_teardown,
10246 test_snow3g_decryption_test_case_4),
10247 TEST_CASE_ST(ut_setup, ut_teardown,
10248 test_snow3g_decryption_test_case_5),
10250 TEST_CASE_ST(ut_setup, ut_teardown,
10251 test_snow3g_hash_generate_test_case_1),
10252 TEST_CASE_ST(ut_setup, ut_teardown,
10253 test_snow3g_hash_generate_test_case_2),
10254 TEST_CASE_ST(ut_setup, ut_teardown,
10255 test_snow3g_hash_generate_test_case_3),
10256 TEST_CASE_ST(ut_setup, ut_teardown,
10257 test_snow3g_hash_verify_test_case_1),
10258 TEST_CASE_ST(ut_setup, ut_teardown,
10259 test_snow3g_hash_verify_test_case_2),
10260 TEST_CASE_ST(ut_setup, ut_teardown,
10261 test_snow3g_hash_verify_test_case_3),
10263 /** ZUC encrypt only (EEA3) */
10264 TEST_CASE_ST(ut_setup, ut_teardown,
10265 test_zuc_encryption_test_case_1),
10266 TEST_CASE_ST(ut_setup, ut_teardown,
10267 test_zuc_encryption_test_case_2),
10268 TEST_CASE_ST(ut_setup, ut_teardown,
10269 test_zuc_encryption_test_case_3),
10270 TEST_CASE_ST(ut_setup, ut_teardown,
10271 test_zuc_encryption_test_case_4),
10272 TEST_CASE_ST(ut_setup, ut_teardown,
10273 test_zuc_encryption_test_case_5),
10274 TEST_CASE_ST(ut_setup, ut_teardown,
10275 test_zuc_hash_generate_test_case_1),
10276 TEST_CASE_ST(ut_setup, ut_teardown,
10277 test_zuc_hash_generate_test_case_2),
10278 TEST_CASE_ST(ut_setup, ut_teardown,
10279 test_zuc_hash_generate_test_case_3),
10280 TEST_CASE_ST(ut_setup, ut_teardown,
10281 test_zuc_hash_generate_test_case_4),
10282 TEST_CASE_ST(ut_setup, ut_teardown,
10283 test_zuc_hash_generate_test_case_5),
10284 TEST_CASE_ST(ut_setup, ut_teardown,
10285 test_zuc_encryption_test_case_6_sgl),
10287 /** KASUMI encrypt only (UEA1) */
10288 TEST_CASE_ST(ut_setup, ut_teardown,
10289 test_kasumi_encryption_test_case_1),
10290 TEST_CASE_ST(ut_setup, ut_teardown,
10291 test_kasumi_encryption_test_case_2),
10292 TEST_CASE_ST(ut_setup, ut_teardown,
10293 test_kasumi_encryption_test_case_3),
10294 TEST_CASE_ST(ut_setup, ut_teardown,
10295 test_kasumi_encryption_test_case_4),
10296 TEST_CASE_ST(ut_setup, ut_teardown,
10297 test_kasumi_encryption_test_case_5),
10298 TEST_CASE_ST(ut_setup, ut_teardown,
10299 test_kasumi_encryption_test_case_1_sgl),
10300 TEST_CASE_ST(ut_setup, ut_teardown,
10301 test_kasumi_encryption_test_case_1_oop_sgl),
10302 /** KASUMI decrypt only (UEA1) */
10303 TEST_CASE_ST(ut_setup, ut_teardown,
10304 test_kasumi_decryption_test_case_1),
10305 TEST_CASE_ST(ut_setup, ut_teardown,
10306 test_kasumi_decryption_test_case_2),
10307 TEST_CASE_ST(ut_setup, ut_teardown,
10308 test_kasumi_decryption_test_case_3),
10309 TEST_CASE_ST(ut_setup, ut_teardown,
10310 test_kasumi_decryption_test_case_4),
10311 TEST_CASE_ST(ut_setup, ut_teardown,
10312 test_kasumi_decryption_test_case_5),
10314 TEST_CASE_ST(ut_setup, ut_teardown,
10315 test_kasumi_encryption_test_case_1_oop),
10316 TEST_CASE_ST(ut_setup, ut_teardown,
10317 test_kasumi_decryption_test_case_1_oop),
10319 /** KASUMI hash only (UIA1) */
10320 TEST_CASE_ST(ut_setup, ut_teardown,
10321 test_kasumi_hash_generate_test_case_1),
10322 TEST_CASE_ST(ut_setup, ut_teardown,
10323 test_kasumi_hash_generate_test_case_2),
10324 TEST_CASE_ST(ut_setup, ut_teardown,
10325 test_kasumi_hash_generate_test_case_3),
10326 TEST_CASE_ST(ut_setup, ut_teardown,
10327 test_kasumi_hash_generate_test_case_4),
10328 TEST_CASE_ST(ut_setup, ut_teardown,
10329 test_kasumi_hash_generate_test_case_5),
10330 TEST_CASE_ST(ut_setup, ut_teardown,
10331 test_kasumi_hash_generate_test_case_6),
10332 TEST_CASE_ST(ut_setup, ut_teardown,
10333 test_kasumi_hash_verify_test_case_1),
10334 TEST_CASE_ST(ut_setup, ut_teardown,
10335 test_kasumi_hash_verify_test_case_2),
10336 TEST_CASE_ST(ut_setup, ut_teardown,
10337 test_kasumi_hash_verify_test_case_3),
10338 TEST_CASE_ST(ut_setup, ut_teardown,
10339 test_kasumi_hash_verify_test_case_4),
10340 TEST_CASE_ST(ut_setup, ut_teardown,
10341 test_kasumi_hash_verify_test_case_5),
10344 TEST_CASE_ST(ut_setup, ut_teardown,
10345 test_null_cipher_only_operation),
10346 TEST_CASE_ST(ut_setup, ut_teardown,
10347 test_null_auth_only_operation),
10348 TEST_CASE_ST(ut_setup, ut_teardown,
10349 test_null_cipher_auth_operation),
10350 TEST_CASE_ST(ut_setup, ut_teardown,
10351 test_null_auth_cipher_operation),
10353 /** Negative tests */
10354 TEST_CASE_ST(ut_setup, ut_teardown,
10355 authentication_verify_HMAC_SHA1_fail_data_corrupt),
10356 TEST_CASE_ST(ut_setup, ut_teardown,
10357 authentication_verify_HMAC_SHA1_fail_tag_corrupt),
10358 TEST_CASE_ST(ut_setup, ut_teardown,
10359 authentication_verify_AES128_GMAC_fail_data_corrupt),
10360 TEST_CASE_ST(ut_setup, ut_teardown,
10361 authentication_verify_AES128_GMAC_fail_tag_corrupt),
10362 TEST_CASE_ST(ut_setup, ut_teardown,
10363 auth_decryption_AES128CBC_HMAC_SHA1_fail_data_corrupt),
10364 TEST_CASE_ST(ut_setup, ut_teardown,
10365 auth_decryption_AES128CBC_HMAC_SHA1_fail_tag_corrupt),
10366 TEST_CASES_END() /**< NULL terminate unit test array */
10371 test_cryptodev_qat(void /*argv __rte_unused, int argc __rte_unused*/)
10373 gbl_driver_id = rte_cryptodev_driver_id_get(
10374 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
10376 if (gbl_driver_id == -1) {
10377 RTE_LOG(ERR, USER1, "QAT PMD must be loaded. Check that both "
10378 "CONFIG_RTE_LIBRTE_PMD_QAT and CONFIG_RTE_LIBRTE_PMD_QAT_SYM "
10379 "are enabled in config file to run this testsuite.\n");
10380 return TEST_SKIPPED;
10383 return unit_test_suite_runner(&cryptodev_qat_testsuite);
10387 test_cryptodev_virtio(void /*argv __rte_unused, int argc __rte_unused*/)
10389 gbl_driver_id = rte_cryptodev_driver_id_get(
10390 RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD));
10392 if (gbl_driver_id == -1) {
10393 RTE_LOG(ERR, USER1, "VIRTIO PMD must be loaded. Check if "
10394 "CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO is enabled "
10395 "in config file to run this testsuite.\n");
10396 return TEST_FAILED;
10399 return unit_test_suite_runner(&cryptodev_virtio_testsuite);
10403 test_cryptodev_aesni_mb(void /*argv __rte_unused, int argc __rte_unused*/)
10405 gbl_driver_id = rte_cryptodev_driver_id_get(
10406 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
10408 if (gbl_driver_id == -1) {
10409 RTE_LOG(ERR, USER1, "AESNI MB PMD must be loaded. Check if "
10410 "CONFIG_RTE_LIBRTE_PMD_AESNI_MB is enabled "
10411 "in config file to run this testsuite.\n");
10412 return TEST_SKIPPED;
10415 return unit_test_suite_runner(&cryptodev_aesni_mb_testsuite);
10419 test_cryptodev_openssl(void)
10421 gbl_driver_id = rte_cryptodev_driver_id_get(
10422 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
10424 if (gbl_driver_id == -1) {
10425 RTE_LOG(ERR, USER1, "OPENSSL PMD must be loaded. Check if "
10426 "CONFIG_RTE_LIBRTE_PMD_OPENSSL is enabled "
10427 "in config file to run this testsuite.\n");
10428 return TEST_SKIPPED;
10431 return unit_test_suite_runner(&cryptodev_openssl_testsuite);
10435 test_cryptodev_aesni_gcm(void)
10437 gbl_driver_id = rte_cryptodev_driver_id_get(
10438 RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
10440 if (gbl_driver_id == -1) {
10441 RTE_LOG(ERR, USER1, "AESNI GCM PMD must be loaded. Check if "
10442 "CONFIG_RTE_LIBRTE_PMD_AESNI_GCM is enabled "
10443 "in config file to run this testsuite.\n");
10444 return TEST_SKIPPED;
10447 return unit_test_suite_runner(&cryptodev_aesni_gcm_testsuite);
10451 test_cryptodev_null(void)
10453 gbl_driver_id = rte_cryptodev_driver_id_get(
10454 RTE_STR(CRYPTODEV_NAME_NULL_PMD));
10456 if (gbl_driver_id == -1) {
10457 RTE_LOG(ERR, USER1, "NULL PMD must be loaded. Check if "
10458 "CONFIG_RTE_LIBRTE_PMD_NULL is enabled "
10459 "in config file to run this testsuite.\n");
10460 return TEST_SKIPPED;
10463 return unit_test_suite_runner(&cryptodev_null_testsuite);
10467 test_cryptodev_sw_snow3g(void /*argv __rte_unused, int argc __rte_unused*/)
10469 gbl_driver_id = rte_cryptodev_driver_id_get(
10470 RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
10472 if (gbl_driver_id == -1) {
10473 RTE_LOG(ERR, USER1, "SNOW3G PMD must be loaded. Check if "
10474 "CONFIG_RTE_LIBRTE_PMD_SNOW3G is enabled "
10475 "in config file to run this testsuite.\n");
10476 return TEST_SKIPPED;
10479 return unit_test_suite_runner(&cryptodev_sw_snow3g_testsuite);
10483 test_cryptodev_sw_kasumi(void /*argv __rte_unused, int argc __rte_unused*/)
10485 gbl_driver_id = rte_cryptodev_driver_id_get(
10486 RTE_STR(CRYPTODEV_NAME_KASUMI_PMD));
10488 if (gbl_driver_id == -1) {
10489 RTE_LOG(ERR, USER1, "ZUC PMD must be loaded. Check if "
10490 "CONFIG_RTE_LIBRTE_PMD_KASUMI is enabled "
10491 "in config file to run this testsuite.\n");
10492 return TEST_SKIPPED;
10495 return unit_test_suite_runner(&cryptodev_sw_kasumi_testsuite);
10499 test_cryptodev_sw_zuc(void /*argv __rte_unused, int argc __rte_unused*/)
10501 gbl_driver_id = rte_cryptodev_driver_id_get(
10502 RTE_STR(CRYPTODEV_NAME_ZUC_PMD));
10504 if (gbl_driver_id == -1) {
10505 RTE_LOG(ERR, USER1, "ZUC PMD must be loaded. Check if "
10506 "CONFIG_RTE_LIBRTE_PMD_ZUC is enabled "
10507 "in config file to run this testsuite.\n");
10508 return TEST_SKIPPED;
10511 return unit_test_suite_runner(&cryptodev_sw_zuc_testsuite);
10515 test_cryptodev_armv8(void)
10517 gbl_driver_id = rte_cryptodev_driver_id_get(
10518 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
10520 if (gbl_driver_id == -1) {
10521 RTE_LOG(ERR, USER1, "ARMV8 PMD must be loaded. Check if "
10522 "CONFIG_RTE_LIBRTE_PMD_ARMV8 is enabled "
10523 "in config file to run this testsuite.\n");
10524 return TEST_SKIPPED;
10527 return unit_test_suite_runner(&cryptodev_armv8_testsuite);
10531 test_cryptodev_mrvl(void)
10533 gbl_driver_id = rte_cryptodev_driver_id_get(
10534 RTE_STR(CRYPTODEV_NAME_MVSAM_PMD));
10536 if (gbl_driver_id == -1) {
10537 RTE_LOG(ERR, USER1, "MVSAM PMD must be loaded. Check if "
10538 "CONFIG_RTE_LIBRTE_PMD_MVSAM_CRYPTO is enabled "
10539 "in config file to run this testsuite.\n");
10540 return TEST_SKIPPED;
10543 return unit_test_suite_runner(&cryptodev_mrvl_testsuite);
10546 #ifdef RTE_LIBRTE_PMD_CRYPTO_SCHEDULER
10549 test_cryptodev_scheduler(void /*argv __rte_unused, int argc __rte_unused*/)
10551 gbl_driver_id = rte_cryptodev_driver_id_get(
10552 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
10554 if (gbl_driver_id == -1) {
10555 RTE_LOG(ERR, USER1, "SCHEDULER PMD must be loaded. Check if "
10556 "CONFIG_RTE_LIBRTE_PMD_SCHEDULER is enabled "
10557 "in config file to run this testsuite.\n");
10558 return TEST_SKIPPED;
10561 if (rte_cryptodev_driver_id_get(
10562 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)) == -1) {
10563 RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_MB must be"
10564 " enabled in config file to run this testsuite.\n");
10565 return TEST_SKIPPED;
10567 return unit_test_suite_runner(&cryptodev_scheduler_testsuite);
10570 REGISTER_TEST_COMMAND(cryptodev_scheduler_autotest, test_cryptodev_scheduler);
10575 test_cryptodev_dpaa2_sec(void /*argv __rte_unused, int argc __rte_unused*/)
10577 gbl_driver_id = rte_cryptodev_driver_id_get(
10578 RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
10580 if (gbl_driver_id == -1) {
10581 RTE_LOG(ERR, USER1, "DPAA2 SEC PMD must be loaded. Check if "
10582 "CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC is enabled "
10583 "in config file to run this testsuite.\n");
10584 return TEST_SKIPPED;
10587 return unit_test_suite_runner(&cryptodev_dpaa2_sec_testsuite);
10591 test_cryptodev_dpaa_sec(void /*argv __rte_unused, int argc __rte_unused*/)
10593 gbl_driver_id = rte_cryptodev_driver_id_get(
10594 RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD));
10596 if (gbl_driver_id == -1) {
10597 RTE_LOG(ERR, USER1, "DPAA SEC PMD must be loaded. Check if "
10598 "CONFIG_RTE_LIBRTE_PMD_DPAA_SEC is enabled "
10599 "in config file to run this testsuite.\n");
10600 return TEST_SKIPPED;
10603 return unit_test_suite_runner(&cryptodev_dpaa_sec_testsuite);
10607 test_cryptodev_ccp(void)
10609 gbl_driver_id = rte_cryptodev_driver_id_get(
10610 RTE_STR(CRYPTODEV_NAME_CCP_PMD));
10612 if (gbl_driver_id == -1) {
10613 RTE_LOG(ERR, USER1, "CCP PMD must be loaded. Check if "
10614 "CONFIG_RTE_LIBRTE_PMD_CCP is enabled "
10615 "in config file to run this testsuite.\n");
10616 return TEST_FAILED;
10619 return unit_test_suite_runner(&cryptodev_ccp_testsuite);
10623 test_cryptodev_octeontx(void)
10625 gbl_driver_id = rte_cryptodev_driver_id_get(
10626 RTE_STR(CRYPTODEV_NAME_OCTEONTX_SYM_PMD));
10627 if (gbl_driver_id == -1) {
10628 RTE_LOG(ERR, USER1, "OCTEONTX PMD must be loaded. Check if "
10629 "CONFIG_RTE_LIBRTE_PMD_OCTEONTX_CRYPTO is "
10630 "enabled in config file to run this "
10632 return TEST_FAILED;
10634 return unit_test_suite_runner(&cryptodev_octeontx_testsuite);
10637 REGISTER_TEST_COMMAND(cryptodev_qat_autotest, test_cryptodev_qat);
10638 REGISTER_TEST_COMMAND(cryptodev_aesni_mb_autotest, test_cryptodev_aesni_mb);
10639 REGISTER_TEST_COMMAND(cryptodev_openssl_autotest, test_cryptodev_openssl);
10640 REGISTER_TEST_COMMAND(cryptodev_aesni_gcm_autotest, test_cryptodev_aesni_gcm);
10641 REGISTER_TEST_COMMAND(cryptodev_null_autotest, test_cryptodev_null);
10642 REGISTER_TEST_COMMAND(cryptodev_sw_snow3g_autotest, test_cryptodev_sw_snow3g);
10643 REGISTER_TEST_COMMAND(cryptodev_sw_kasumi_autotest, test_cryptodev_sw_kasumi);
10644 REGISTER_TEST_COMMAND(cryptodev_sw_zuc_autotest, test_cryptodev_sw_zuc);
10645 REGISTER_TEST_COMMAND(cryptodev_sw_armv8_autotest, test_cryptodev_armv8);
10646 REGISTER_TEST_COMMAND(cryptodev_sw_mvsam_autotest, test_cryptodev_mrvl);
10647 REGISTER_TEST_COMMAND(cryptodev_dpaa2_sec_autotest, test_cryptodev_dpaa2_sec);
10648 REGISTER_TEST_COMMAND(cryptodev_dpaa_sec_autotest, test_cryptodev_dpaa_sec);
10649 REGISTER_TEST_COMMAND(cryptodev_ccp_autotest, test_cryptodev_ccp);
10650 REGISTER_TEST_COMMAND(cryptodev_virtio_autotest, test_cryptodev_virtio);
10651 REGISTER_TEST_COMMAND(cryptodev_octeontx_autotest, test_cryptodev_octeontx);