4 * Copyright(c) 2015-2017 Intel Corporation. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
16 * * Neither the name of Intel Corporation nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #include <rte_common.h>
34 #include <rte_hexdump.h>
36 #include <rte_malloc.h>
37 #include <rte_memcpy.h>
38 #include <rte_pause.h>
40 #include <rte_crypto.h>
41 #include <rte_cryptodev.h>
42 #include <rte_cryptodev_pmd.h>
45 #include "test_cryptodev.h"
46 #include "test_cryptodev_blockcipher.h"
47 #include "test_cryptodev_aes_test_vectors.h"
48 #include "test_cryptodev_des_test_vectors.h"
49 #include "test_cryptodev_hash_test_vectors.h"
50 #include "test_cryptodev.h"
53 test_blockcipher_one_case(const struct blockcipher_test_case *t,
54 struct rte_mempool *mbuf_pool,
55 struct rte_mempool *op_mpool,
56 struct rte_mempool *sess_mpool,
61 struct rte_mbuf *ibuf = NULL;
62 struct rte_mbuf *obuf = NULL;
63 struct rte_mbuf *iobuf;
64 struct rte_crypto_sym_xform *cipher_xform = NULL;
65 struct rte_crypto_sym_xform *auth_xform = NULL;
66 struct rte_crypto_sym_xform *init_xform = NULL;
67 struct rte_crypto_sym_op *sym_op = NULL;
68 struct rte_crypto_op *op = NULL;
69 struct rte_cryptodev_info dev_info;
70 struct rte_cryptodev_sym_session *sess = NULL;
72 int status = TEST_SUCCESS;
73 const struct blockcipher_test_data *tdata = t->test_data;
74 uint8_t cipher_key[tdata->cipher_key.len];
75 uint8_t auth_key[tdata->auth_key.len];
76 uint32_t buf_len = tdata->ciphertext.len;
77 uint32_t digest_len = 0;
79 uint8_t src_pattern = 0xa5;
80 uint8_t dst_pattern = 0xb6;
81 uint8_t tmp_src_buf[MBUF_SIZE];
82 uint8_t tmp_dst_buf[MBUF_SIZE];
84 int openssl_pmd = rte_cryptodev_driver_id_get(
85 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
86 int scheduler_pmd = rte_cryptodev_driver_id_get(
87 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
88 int armv8_pmd = rte_cryptodev_driver_id_get(
89 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
90 int aesni_mb_pmd = rte_cryptodev_driver_id_get(
91 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
92 int qat_pmd = rte_cryptodev_driver_id_get(
93 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
94 int dpaa2_sec_pmd = rte_cryptodev_driver_id_get(
95 RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
99 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SG) {
100 rte_cryptodev_info_get(dev_id, &dev_info);
101 if (!(dev_info.feature_flags &
102 RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) {
103 printf("Device doesn't support scatter-gather. "
110 if (tdata->cipher_key.len)
111 memcpy(cipher_key, tdata->cipher_key.data,
112 tdata->cipher_key.len);
113 if (tdata->auth_key.len)
114 memcpy(auth_key, tdata->auth_key.data,
115 tdata->auth_key.len);
117 if (driver_id == dpaa2_sec_pmd ||
118 driver_id == qat_pmd ||
119 driver_id == openssl_pmd ||
120 driver_id == armv8_pmd) { /* Fall through */
121 digest_len = tdata->digest.len;
122 } else if (driver_id == aesni_mb_pmd ||
123 driver_id == scheduler_pmd) {
124 digest_len = tdata->digest.truncated_len;
126 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
127 "line %u FAILED: %s",
128 __LINE__, "Unsupported PMD type");
129 status = TEST_FAILED;
134 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
135 buf_len += digest_len;
137 /* for contiguous mbuf, nb_segs is 1 */
138 ibuf = create_segmented_mbuf(mbuf_pool,
139 tdata->ciphertext.len, nb_segs, src_pattern);
141 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
142 "line %u FAILED: %s",
143 __LINE__, "Cannot create source mbuf");
144 status = TEST_FAILED;
148 /* only encryption requires plaintext.data input,
149 * decryption/(digest gen)/(digest verify) use ciphertext.data
152 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
153 pktmbuf_write(ibuf, 0, tdata->plaintext.len,
154 tdata->plaintext.data);
156 pktmbuf_write(ibuf, 0, tdata->ciphertext.len,
157 tdata->ciphertext.data);
159 buf_p = rte_pktmbuf_append(ibuf, digest_len);
160 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
161 rte_memcpy(buf_p, tdata->digest.data, digest_len);
163 memset(buf_p, 0, digest_len);
165 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
166 obuf = rte_pktmbuf_alloc(mbuf_pool);
168 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
169 "FAILED: %s", __LINE__,
170 "Allocation of rte_mbuf failed");
171 status = TEST_FAILED;
174 memset(obuf->buf_addr, dst_pattern, obuf->buf_len);
176 buf_p = rte_pktmbuf_append(obuf, buf_len);
178 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
179 "FAILED: %s", __LINE__,
180 "No room to append mbuf");
181 status = TEST_FAILED;
184 memset(buf_p, 0, buf_len);
187 /* Generate Crypto op data structure */
188 op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC);
190 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
191 "line %u FAILED: %s",
192 __LINE__, "Failed to allocate symmetric crypto "
194 status = TEST_FAILED;
200 sym_op->m_src = ibuf;
202 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
203 sym_op->m_dst = obuf;
206 sym_op->m_dst = NULL;
210 /* sessionless op requires allocate xform using
211 * rte_crypto_op_sym_xforms_alloc(), otherwise rte_zmalloc()
214 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
215 uint32_t n_xforms = 0;
217 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
219 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
222 if (rte_crypto_op_sym_xforms_alloc(op, n_xforms)
224 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
225 "FAILED: %s", __LINE__, "Failed to "
226 "allocate space for crypto transforms");
227 status = TEST_FAILED;
231 cipher_xform = rte_zmalloc(NULL,
232 sizeof(struct rte_crypto_sym_xform), 0);
234 auth_xform = rte_zmalloc(NULL,
235 sizeof(struct rte_crypto_sym_xform), 0);
237 if (!cipher_xform || !auth_xform) {
238 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
239 "FAILED: %s", __LINE__, "Failed to "
240 "allocate memory for crypto transforms");
241 status = TEST_FAILED;
246 /* preparing xform, for sessioned op, init_xform is initialized
247 * here and later as param in rte_cryptodev_sym_session_create() call
249 if (t->op_mask == BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN) {
250 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
251 cipher_xform = op->sym->xform;
252 auth_xform = cipher_xform->next;
253 auth_xform->next = NULL;
255 cipher_xform->next = auth_xform;
256 auth_xform->next = NULL;
257 init_xform = cipher_xform;
259 } else if (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC) {
260 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
261 auth_xform = op->sym->xform;
262 cipher_xform = auth_xform->next;
263 cipher_xform->next = NULL;
265 auth_xform->next = cipher_xform;
266 cipher_xform->next = NULL;
267 init_xform = auth_xform;
269 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_ENCRYPT) ||
270 (t->op_mask == BLOCKCIPHER_TEST_OP_DECRYPT)) {
271 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
272 cipher_xform = op->sym->xform;
274 init_xform = cipher_xform;
275 cipher_xform->next = NULL;
276 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_GEN) ||
277 (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY)) {
278 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
279 auth_xform = op->sym->xform;
281 init_xform = auth_xform;
282 auth_xform->next = NULL;
284 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
285 "line %u FAILED: %s",
286 __LINE__, "Unrecognized operation");
287 status = TEST_FAILED;
291 /*configure xforms & sym_op cipher and auth data*/
292 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
293 cipher_xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
294 cipher_xform->cipher.algo = tdata->crypto_algo;
295 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
296 cipher_xform->cipher.op =
297 RTE_CRYPTO_CIPHER_OP_ENCRYPT;
299 cipher_xform->cipher.op =
300 RTE_CRYPTO_CIPHER_OP_DECRYPT;
301 cipher_xform->cipher.key.data = cipher_key;
302 cipher_xform->cipher.key.length = tdata->cipher_key.len;
303 cipher_xform->cipher.iv.offset = IV_OFFSET;
304 cipher_xform->cipher.iv.length = tdata->iv.len;
306 sym_op->cipher.data.offset = 0;
307 sym_op->cipher.data.length = tdata->ciphertext.len;
308 rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
313 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
314 uint32_t digest_offset = tdata->ciphertext.len;
316 auth_xform->type = RTE_CRYPTO_SYM_XFORM_AUTH;
317 auth_xform->auth.algo = tdata->auth_algo;
318 auth_xform->auth.key.length = tdata->auth_key.len;
319 auth_xform->auth.key.data = auth_key;
320 auth_xform->auth.digest_length = digest_len;
322 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
323 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
324 sym_op->auth.digest.data = pktmbuf_mtod_offset
325 (iobuf, digest_offset);
326 sym_op->auth.digest.phys_addr =
327 pktmbuf_mtophys_offset(iobuf,
330 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
331 sym_op->auth.digest.data = pktmbuf_mtod_offset
332 (sym_op->m_src, digest_offset);
333 sym_op->auth.digest.phys_addr =
334 pktmbuf_mtophys_offset(sym_op->m_src,
338 sym_op->auth.data.offset = 0;
339 sym_op->auth.data.length = tdata->ciphertext.len;
342 /* create session for sessioned op */
343 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
344 sess = rte_cryptodev_sym_session_create(sess_mpool);
346 rte_cryptodev_sym_session_init(dev_id, sess, init_xform,
349 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
350 "FAILED: %s", __LINE__,
351 "Session creation failed");
352 status = TEST_FAILED;
356 /* attach symmetric crypto session to crypto operations */
357 rte_crypto_op_attach_sym_session(op, sess);
360 TEST_HEXDUMP(stdout, "m_src(before):",
361 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
362 rte_memcpy(tmp_src_buf, sym_op->m_src->buf_addr,
363 sym_op->m_src->buf_len);
364 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
365 TEST_HEXDUMP(stdout, "m_dst(before):",
366 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
367 rte_memcpy(tmp_dst_buf, sym_op->m_dst->buf_addr,
368 sym_op->m_dst->buf_len);
371 /* Process crypto operation */
372 if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
373 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
374 "line %u FAILED: %s",
375 __LINE__, "Error sending packet for encryption");
376 status = TEST_FAILED;
382 while (rte_cryptodev_dequeue_burst(dev_id, 0, &op, 1) == 0)
386 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
387 "line %u FAILED: %s",
388 __LINE__, "Failed to process sym crypto op");
389 status = TEST_FAILED;
393 TEST_HEXDUMP(stdout, "m_src(after):",
394 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
395 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP)
396 TEST_HEXDUMP(stdout, "m_dst(after):",
397 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
400 if (op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
401 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
402 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
403 "FAILED: Digest verification failed "
404 "(0x%X)", __LINE__, op->status);
406 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
407 "FAILED: Digest verification failed "
408 "(0x%X)", __LINE__, op->status);
409 status = TEST_FAILED;
413 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
414 uint8_t buffer[2048];
415 const uint8_t *compare_ref;
416 uint32_t compare_len;
418 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT) {
419 compare_ref = tdata->ciphertext.data;
420 compare_len = tdata->ciphertext.len;
422 compare_ref = tdata->plaintext.data;
423 compare_len = tdata->plaintext.len;
426 if (memcmp(rte_pktmbuf_read(iobuf, 0, compare_len,
427 buffer), compare_ref, compare_len)) {
428 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
429 "FAILED: %s", __LINE__,
430 "Crypto data not as expected");
431 status = TEST_FAILED;
436 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
437 uint8_t *auth_res = pktmbuf_mtod_offset(iobuf,
438 tdata->ciphertext.len);
440 if (memcmp(auth_res, tdata->digest.data, digest_len)) {
441 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
442 "FAILED: %s", __LINE__, "Generated "
443 "digest data not as expected");
444 status = TEST_FAILED;
449 /* The only parts that should have changed in the buffer are
450 * plaintext/ciphertext and digest.
451 * In OOP only the dest buffer should change.
453 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
454 struct rte_mbuf *mbuf;
456 uint32_t head_unchanged_len = 0, changed_len = 0;
459 mbuf = sym_op->m_src;
460 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) {
461 /* white-box test: PMDs use some of the
462 * tailroom as temp storage in verify case
464 head_unchanged_len = rte_pktmbuf_headroom(mbuf)
465 + rte_pktmbuf_data_len(mbuf);
466 changed_len = digest_len;
468 head_unchanged_len = mbuf->buf_len;
472 for (i = 0; i < mbuf->buf_len; i++) {
473 if (i == head_unchanged_len)
475 value = *((uint8_t *)(mbuf->buf_addr)+i);
476 if (value != tmp_src_buf[i]) {
477 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
478 "line %u FAILED: OOP src outer mbuf data (0x%x) not as expected (0x%x)",
479 __LINE__, value, tmp_src_buf[i]);
480 status = TEST_FAILED;
485 mbuf = sym_op->m_dst;
486 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
487 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
488 sym_op->auth.data.offset;
489 changed_len = sym_op->auth.data.length;
490 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
491 changed_len += digest_len;
494 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
495 sym_op->cipher.data.offset;
496 changed_len = sym_op->cipher.data.length;
499 for (i = 0; i < mbuf->buf_len; i++) {
500 if (i == head_unchanged_len)
502 value = *((uint8_t *)(mbuf->buf_addr)+i);
503 if (value != tmp_dst_buf[i]) {
504 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
505 "line %u FAILED: OOP dst outer mbuf data "
506 "(0x%x) not as expected (0x%x)",
507 __LINE__, value, tmp_dst_buf[i]);
508 status = TEST_FAILED;
513 /* In-place operation */
514 struct rte_mbuf *mbuf;
516 uint32_t head_unchanged_len = 0, changed_len = 0;
519 mbuf = sym_op->m_src;
520 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
521 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
522 sym_op->cipher.data.offset;
523 changed_len = sym_op->cipher.data.length;
526 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
527 sym_op->auth.data.offset +
528 sym_op->auth.data.length;
532 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
533 changed_len += digest_len;
535 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) {
536 /* white-box test: PMDs use some of the
537 * tailroom as temp storage in verify case
539 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
540 /* This is simplified, not checking digest*/
541 changed_len += digest_len*2;
543 head_unchanged_len += digest_len;
544 changed_len += digest_len;
548 for (i = 0; i < mbuf->buf_len; i++) {
549 if (i == head_unchanged_len)
551 value = *((uint8_t *)(mbuf->buf_addr)+i);
552 if (value != tmp_src_buf[i]) {
553 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
554 "line %u FAILED: outer mbuf data (0x%x) "
555 "not as expected (0x%x)",
556 __LINE__, value, tmp_src_buf[i]);
557 status = TEST_FAILED;
563 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "PASS");
566 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
568 rte_cryptodev_sym_session_clear(dev_id, sess);
569 rte_cryptodev_sym_session_free(sess);
572 rte_free(cipher_xform);
574 rte_free(auth_xform);
578 rte_crypto_op_free(op);
581 rte_pktmbuf_free(obuf);
584 rte_pktmbuf_free(ibuf);
590 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
591 struct rte_mempool *op_mpool,
592 struct rte_mempool *sess_mpool,
595 enum blockcipher_test_type test_type)
597 int status, overall_status = TEST_SUCCESS;
598 uint32_t i, test_index = 0;
599 char test_msg[BLOCKCIPHER_TEST_MSG_LEN + 1];
600 uint32_t n_test_cases = 0;
601 uint32_t target_pmd_mask = 0;
602 const struct blockcipher_test_case *tcs = NULL;
604 int openssl_pmd = rte_cryptodev_driver_id_get(
605 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
606 int dpaa2_pmd = rte_cryptodev_driver_id_get(
607 RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
608 int scheduler_pmd = rte_cryptodev_driver_id_get(
609 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
610 int armv8_pmd = rte_cryptodev_driver_id_get(
611 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
612 int aesni_mb_pmd = rte_cryptodev_driver_id_get(
613 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
614 int qat_pmd = rte_cryptodev_driver_id_get(
615 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
618 case BLKCIPHER_AES_CHAIN_TYPE:
619 n_test_cases = sizeof(aes_chain_test_cases) /
620 sizeof(aes_chain_test_cases[0]);
621 tcs = aes_chain_test_cases;
623 case BLKCIPHER_AES_CIPHERONLY_TYPE:
624 n_test_cases = sizeof(aes_cipheronly_test_cases) /
625 sizeof(aes_cipheronly_test_cases[0]);
626 tcs = aes_cipheronly_test_cases;
628 case BLKCIPHER_AES_DOCSIS_TYPE:
629 n_test_cases = sizeof(aes_docsis_test_cases) /
630 sizeof(aes_docsis_test_cases[0]);
631 tcs = aes_docsis_test_cases;
633 case BLKCIPHER_3DES_CHAIN_TYPE:
634 n_test_cases = sizeof(triple_des_chain_test_cases) /
635 sizeof(triple_des_chain_test_cases[0]);
636 tcs = triple_des_chain_test_cases;
638 case BLKCIPHER_3DES_CIPHERONLY_TYPE:
639 n_test_cases = sizeof(triple_des_cipheronly_test_cases) /
640 sizeof(triple_des_cipheronly_test_cases[0]);
641 tcs = triple_des_cipheronly_test_cases;
643 case BLKCIPHER_DES_CIPHERONLY_TYPE:
644 n_test_cases = sizeof(des_cipheronly_test_cases) /
645 sizeof(des_cipheronly_test_cases[0]);
646 tcs = des_cipheronly_test_cases;
648 case BLKCIPHER_DES_DOCSIS_TYPE:
649 n_test_cases = sizeof(des_docsis_test_cases) /
650 sizeof(des_docsis_test_cases[0]);
651 tcs = des_docsis_test_cases;
653 case BLKCIPHER_AUTHONLY_TYPE:
654 n_test_cases = sizeof(hash_test_cases) /
655 sizeof(hash_test_cases[0]);
656 tcs = hash_test_cases;
662 if (driver_id == aesni_mb_pmd)
663 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB;
664 else if (driver_id == qat_pmd)
665 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT;
666 else if (driver_id == openssl_pmd)
667 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL;
668 else if (driver_id == armv8_pmd)
669 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8;
670 else if (driver_id == scheduler_pmd)
671 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER;
672 else if (driver_id == dpaa2_pmd)
673 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC;
675 TEST_ASSERT(0, "Unrecognized cryptodev type");
677 for (i = 0; i < n_test_cases; i++) {
678 const struct blockcipher_test_case *tc = &tcs[i];
680 if (!(tc->pmd_mask & target_pmd_mask))
683 status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
684 sess_mpool, dev_id, driver_id, test_msg);
686 printf(" %u) TestCase %s %s\n", test_index ++,
687 tc->test_descr, test_msg);
689 if (status != TEST_SUCCESS) {
690 if (overall_status == TEST_SUCCESS)
691 overall_status = status;
693 if (tc->feature_mask & BLOCKCIPHER_TEST_FEATURE_STOPPER)
698 return overall_status;