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,
60 struct rte_mbuf *ibuf = NULL;
61 struct rte_mbuf *obuf = NULL;
62 struct rte_mbuf *iobuf;
63 struct rte_crypto_sym_xform *cipher_xform = NULL;
64 struct rte_crypto_sym_xform *auth_xform = NULL;
65 struct rte_crypto_sym_xform *init_xform = NULL;
66 struct rte_crypto_sym_op *sym_op = NULL;
67 struct rte_crypto_op *op = NULL;
68 struct rte_cryptodev_sym_session *sess = NULL;
69 struct rte_cryptodev_info dev_info;
71 int status = TEST_SUCCESS;
72 const struct blockcipher_test_data *tdata = t->test_data;
73 uint8_t cipher_key[tdata->cipher_key.len];
74 uint8_t auth_key[tdata->auth_key.len];
75 uint32_t buf_len = tdata->ciphertext.len;
76 uint32_t digest_len = 0;
78 uint8_t src_pattern = 0xa5;
79 uint8_t dst_pattern = 0xb6;
80 uint8_t tmp_src_buf[MBUF_SIZE];
81 uint8_t tmp_dst_buf[MBUF_SIZE];
83 int openssl_pmd = rte_cryptodev_driver_id_get(
84 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
85 int scheduler_pmd = rte_cryptodev_driver_id_get(
86 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
87 int armv8_pmd = rte_cryptodev_driver_id_get(
88 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
89 int aesni_mb_pmd = rte_cryptodev_driver_id_get(
90 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
91 int qat_pmd = rte_cryptodev_driver_id_get(
92 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
93 int dpaa2_sec_pmd = rte_cryptodev_driver_id_get(
94 RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
98 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SG) {
99 rte_cryptodev_info_get(dev_id, &dev_info);
100 if (!(dev_info.feature_flags &
101 RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) {
102 printf("Device doesn't support scatter-gather. "
109 if (tdata->cipher_key.len)
110 memcpy(cipher_key, tdata->cipher_key.data,
111 tdata->cipher_key.len);
112 if (tdata->auth_key.len)
113 memcpy(auth_key, tdata->auth_key.data,
114 tdata->auth_key.len);
116 if (driver_id == dpaa2_sec_pmd ||
117 driver_id == qat_pmd ||
118 driver_id == openssl_pmd ||
119 driver_id == armv8_pmd) { /* Fall through */
120 digest_len = tdata->digest.len;
121 } else if (driver_id == aesni_mb_pmd ||
122 driver_id == scheduler_pmd) {
123 digest_len = tdata->digest.truncated_len;
125 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
126 "line %u FAILED: %s",
127 __LINE__, "Unsupported PMD type");
128 status = TEST_FAILED;
133 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
134 buf_len += digest_len;
136 /* for contiguous mbuf, nb_segs is 1 */
137 ibuf = create_segmented_mbuf(mbuf_pool,
138 tdata->ciphertext.len, nb_segs, src_pattern);
140 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
141 "line %u FAILED: %s",
142 __LINE__, "Cannot create source mbuf");
143 status = TEST_FAILED;
147 /* only encryption requires plaintext.data input,
148 * decryption/(digest gen)/(digest verify) use ciphertext.data
151 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
152 pktmbuf_write(ibuf, 0, tdata->plaintext.len,
153 tdata->plaintext.data);
155 pktmbuf_write(ibuf, 0, tdata->ciphertext.len,
156 tdata->ciphertext.data);
158 buf_p = rte_pktmbuf_append(ibuf, digest_len);
159 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
160 rte_memcpy(buf_p, tdata->digest.data, digest_len);
162 memset(buf_p, 0, digest_len);
164 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
165 obuf = rte_pktmbuf_alloc(mbuf_pool);
167 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
168 "FAILED: %s", __LINE__,
169 "Allocation of rte_mbuf failed");
170 status = TEST_FAILED;
173 memset(obuf->buf_addr, dst_pattern, obuf->buf_len);
175 buf_p = rte_pktmbuf_append(obuf, buf_len);
177 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
178 "FAILED: %s", __LINE__,
179 "No room to append mbuf");
180 status = TEST_FAILED;
183 memset(buf_p, 0, buf_len);
186 /* Generate Crypto op data structure */
187 op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC);
189 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
190 "line %u FAILED: %s",
191 __LINE__, "Failed to allocate symmetric crypto "
193 status = TEST_FAILED;
199 sym_op->m_src = ibuf;
201 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
202 sym_op->m_dst = obuf;
205 sym_op->m_dst = NULL;
209 /* sessionless op requires allocate xform using
210 * rte_crypto_op_sym_xforms_alloc(), otherwise rte_zmalloc()
213 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
214 uint32_t n_xforms = 0;
216 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
218 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
221 if (rte_crypto_op_sym_xforms_alloc(op, n_xforms)
223 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
224 "FAILED: %s", __LINE__, "Failed to "
225 "allocate space for crypto transforms");
226 status = TEST_FAILED;
230 cipher_xform = rte_zmalloc(NULL,
231 sizeof(struct rte_crypto_sym_xform), 0);
233 auth_xform = rte_zmalloc(NULL,
234 sizeof(struct rte_crypto_sym_xform), 0);
236 if (!cipher_xform || !auth_xform) {
237 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
238 "FAILED: %s", __LINE__, "Failed to "
239 "allocate memory for crypto transforms");
240 status = TEST_FAILED;
245 /* preparing xform, for sessioned op, init_xform is initialized
246 * here and later as param in rte_cryptodev_sym_session_create() call
248 if (t->op_mask == BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN) {
249 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
250 cipher_xform = op->sym->xform;
251 auth_xform = cipher_xform->next;
252 auth_xform->next = NULL;
254 cipher_xform->next = auth_xform;
255 auth_xform->next = NULL;
256 init_xform = cipher_xform;
258 } else if (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC) {
259 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
260 auth_xform = op->sym->xform;
261 cipher_xform = auth_xform->next;
262 cipher_xform->next = NULL;
264 auth_xform->next = cipher_xform;
265 cipher_xform->next = NULL;
266 init_xform = auth_xform;
268 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_ENCRYPT) ||
269 (t->op_mask == BLOCKCIPHER_TEST_OP_DECRYPT)) {
270 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
271 cipher_xform = op->sym->xform;
273 init_xform = cipher_xform;
274 cipher_xform->next = NULL;
275 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_GEN) ||
276 (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY)) {
277 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
278 auth_xform = op->sym->xform;
280 init_xform = auth_xform;
281 auth_xform->next = NULL;
283 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
284 "line %u FAILED: %s",
285 __LINE__, "Unrecognized operation");
286 status = TEST_FAILED;
290 /*configure xforms & sym_op cipher and auth data*/
291 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
292 cipher_xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
293 cipher_xform->cipher.algo = tdata->crypto_algo;
294 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
295 cipher_xform->cipher.op =
296 RTE_CRYPTO_CIPHER_OP_ENCRYPT;
298 cipher_xform->cipher.op =
299 RTE_CRYPTO_CIPHER_OP_DECRYPT;
300 cipher_xform->cipher.key.data = cipher_key;
301 cipher_xform->cipher.key.length = tdata->cipher_key.len;
302 cipher_xform->cipher.iv.offset = IV_OFFSET;
303 cipher_xform->cipher.iv.length = tdata->iv.len;
305 sym_op->cipher.data.offset = 0;
306 sym_op->cipher.data.length = tdata->ciphertext.len;
307 rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
312 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
313 uint32_t digest_offset = tdata->ciphertext.len;
315 auth_xform->type = RTE_CRYPTO_SYM_XFORM_AUTH;
316 auth_xform->auth.algo = tdata->auth_algo;
317 auth_xform->auth.key.length = tdata->auth_key.len;
318 auth_xform->auth.key.data = auth_key;
319 auth_xform->auth.digest_length = digest_len;
321 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
322 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
323 sym_op->auth.digest.data = pktmbuf_mtod_offset
324 (iobuf, digest_offset);
325 sym_op->auth.digest.phys_addr =
326 pktmbuf_mtophys_offset(iobuf,
329 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
330 sym_op->auth.digest.data = pktmbuf_mtod_offset
331 (sym_op->m_src, digest_offset);
332 sym_op->auth.digest.phys_addr =
333 pktmbuf_mtophys_offset(sym_op->m_src,
337 sym_op->auth.data.offset = 0;
338 sym_op->auth.data.length = tdata->ciphertext.len;
341 /* create session for sessioned op */
342 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
343 sess = rte_cryptodev_sym_session_create(dev_id,
346 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
347 "FAILED: %s", __LINE__,
348 "Session creation failed");
349 status = TEST_FAILED;
353 /* attach symmetric crypto session to crypto operations */
354 rte_crypto_op_attach_sym_session(op, sess);
357 TEST_HEXDUMP(stdout, "m_src(before):",
358 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
359 rte_memcpy(tmp_src_buf, sym_op->m_src->buf_addr,
360 sym_op->m_src->buf_len);
361 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
362 TEST_HEXDUMP(stdout, "m_dst(before):",
363 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
364 rte_memcpy(tmp_dst_buf, sym_op->m_dst->buf_addr,
365 sym_op->m_dst->buf_len);
368 /* Process crypto operation */
369 if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
370 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
371 "line %u FAILED: %s",
372 __LINE__, "Error sending packet for encryption");
373 status = TEST_FAILED;
379 while (rte_cryptodev_dequeue_burst(dev_id, 0, &op, 1) == 0)
383 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
384 "line %u FAILED: %s",
385 __LINE__, "Failed to process sym crypto op");
386 status = TEST_FAILED;
390 TEST_HEXDUMP(stdout, "m_src(after):",
391 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
392 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP)
393 TEST_HEXDUMP(stdout, "m_dst(after):",
394 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
397 if (op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
398 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
399 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
400 "FAILED: Digest verification failed "
401 "(0x%X)", __LINE__, op->status);
403 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
404 "FAILED: Digest verification failed "
405 "(0x%X)", __LINE__, op->status);
406 status = TEST_FAILED;
410 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
411 uint8_t buffer[2048];
412 const uint8_t *compare_ref;
413 uint32_t compare_len;
415 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT) {
416 compare_ref = tdata->ciphertext.data;
417 compare_len = tdata->ciphertext.len;
419 compare_ref = tdata->plaintext.data;
420 compare_len = tdata->plaintext.len;
423 if (memcmp(rte_pktmbuf_read(iobuf, 0, compare_len,
424 buffer), compare_ref, compare_len)) {
425 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
426 "FAILED: %s", __LINE__,
427 "Crypto data not as expected");
428 status = TEST_FAILED;
433 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
434 uint8_t *auth_res = pktmbuf_mtod_offset(iobuf,
435 tdata->ciphertext.len);
437 if (memcmp(auth_res, tdata->digest.data, digest_len)) {
438 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
439 "FAILED: %s", __LINE__, "Generated "
440 "digest data not as expected");
441 status = TEST_FAILED;
446 /* The only parts that should have changed in the buffer are
447 * plaintext/ciphertext and digest.
448 * In OOP only the dest buffer should change.
450 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
451 struct rte_mbuf *mbuf;
453 uint32_t head_unchanged_len = 0, changed_len = 0;
456 mbuf = sym_op->m_src;
457 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) {
458 /* white-box test: PMDs use some of the
459 * tailroom as temp storage in verify case
461 head_unchanged_len = rte_pktmbuf_headroom(mbuf)
462 + rte_pktmbuf_data_len(mbuf);
463 changed_len = digest_len;
465 head_unchanged_len = mbuf->buf_len;
469 for (i = 0; i < mbuf->buf_len; i++) {
470 if (i == head_unchanged_len)
472 value = *((uint8_t *)(mbuf->buf_addr)+i);
473 if (value != tmp_src_buf[i]) {
474 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
475 "line %u FAILED: OOP src outer mbuf data (0x%x) not as expected (0x%x)",
476 __LINE__, value, tmp_src_buf[i]);
477 status = TEST_FAILED;
482 mbuf = sym_op->m_dst;
483 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
484 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
485 sym_op->auth.data.offset;
486 changed_len = sym_op->auth.data.length;
487 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
488 changed_len += digest_len;
491 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
492 sym_op->cipher.data.offset;
493 changed_len = sym_op->cipher.data.length;
496 for (i = 0; i < mbuf->buf_len; i++) {
497 if (i == head_unchanged_len)
499 value = *((uint8_t *)(mbuf->buf_addr)+i);
500 if (value != tmp_dst_buf[i]) {
501 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
502 "line %u FAILED: OOP dst outer mbuf data "
503 "(0x%x) not as expected (0x%x)",
504 __LINE__, value, tmp_dst_buf[i]);
505 status = TEST_FAILED;
510 /* In-place operation */
511 struct rte_mbuf *mbuf;
513 uint32_t head_unchanged_len = 0, changed_len = 0;
516 mbuf = sym_op->m_src;
517 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
518 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
519 sym_op->cipher.data.offset;
520 changed_len = sym_op->cipher.data.length;
523 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
524 sym_op->auth.data.offset +
525 sym_op->auth.data.length;
529 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
530 changed_len += digest_len;
532 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) {
533 /* white-box test: PMDs use some of the
534 * tailroom as temp storage in verify case
536 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
537 /* This is simplified, not checking digest*/
538 changed_len += digest_len*2;
540 head_unchanged_len += digest_len;
541 changed_len += digest_len;
545 for (i = 0; i < mbuf->buf_len; i++) {
546 if (i == head_unchanged_len)
548 value = *((uint8_t *)(mbuf->buf_addr)+i);
549 if (value != tmp_src_buf[i]) {
550 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
551 "line %u FAILED: outer mbuf data (0x%x) "
552 "not as expected (0x%x)",
553 __LINE__, value, tmp_src_buf[i]);
554 status = TEST_FAILED;
560 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "PASS");
563 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
565 rte_cryptodev_sym_session_free(dev_id, sess);
567 rte_free(cipher_xform);
569 rte_free(auth_xform);
573 rte_crypto_op_free(op);
576 rte_pktmbuf_free(obuf);
579 rte_pktmbuf_free(ibuf);
585 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
586 struct rte_mempool *op_mpool,
589 enum blockcipher_test_type test_type)
591 int status, overall_status = TEST_SUCCESS;
592 uint32_t i, test_index = 0;
593 char test_msg[BLOCKCIPHER_TEST_MSG_LEN + 1];
594 uint32_t n_test_cases = 0;
595 uint32_t target_pmd_mask = 0;
596 const struct blockcipher_test_case *tcs = NULL;
598 int openssl_pmd = rte_cryptodev_driver_id_get(
599 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
600 int dpaa2_pmd = rte_cryptodev_driver_id_get(
601 RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
602 int scheduler_pmd = rte_cryptodev_driver_id_get(
603 RTE_STR(CRYPTODEV_NAME_SCHEDULER_PMD));
604 int armv8_pmd = rte_cryptodev_driver_id_get(
605 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
606 int aesni_mb_pmd = rte_cryptodev_driver_id_get(
607 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
608 int qat_pmd = rte_cryptodev_driver_id_get(
609 RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
612 case BLKCIPHER_AES_CHAIN_TYPE:
613 n_test_cases = sizeof(aes_chain_test_cases) /
614 sizeof(aes_chain_test_cases[0]);
615 tcs = aes_chain_test_cases;
617 case BLKCIPHER_AES_CIPHERONLY_TYPE:
618 n_test_cases = sizeof(aes_cipheronly_test_cases) /
619 sizeof(aes_cipheronly_test_cases[0]);
620 tcs = aes_cipheronly_test_cases;
622 case BLKCIPHER_AES_DOCSIS_TYPE:
623 n_test_cases = sizeof(aes_docsis_test_cases) /
624 sizeof(aes_docsis_test_cases[0]);
625 tcs = aes_docsis_test_cases;
627 case BLKCIPHER_3DES_CHAIN_TYPE:
628 n_test_cases = sizeof(triple_des_chain_test_cases) /
629 sizeof(triple_des_chain_test_cases[0]);
630 tcs = triple_des_chain_test_cases;
632 case BLKCIPHER_3DES_CIPHERONLY_TYPE:
633 n_test_cases = sizeof(triple_des_cipheronly_test_cases) /
634 sizeof(triple_des_cipheronly_test_cases[0]);
635 tcs = triple_des_cipheronly_test_cases;
637 case BLKCIPHER_DES_CIPHERONLY_TYPE:
638 n_test_cases = sizeof(des_cipheronly_test_cases) /
639 sizeof(des_cipheronly_test_cases[0]);
640 tcs = des_cipheronly_test_cases;
642 case BLKCIPHER_DES_DOCSIS_TYPE:
643 n_test_cases = sizeof(des_docsis_test_cases) /
644 sizeof(des_docsis_test_cases[0]);
645 tcs = des_docsis_test_cases;
647 case BLKCIPHER_AUTHONLY_TYPE:
648 n_test_cases = sizeof(hash_test_cases) /
649 sizeof(hash_test_cases[0]);
650 tcs = hash_test_cases;
656 if (driver_id == aesni_mb_pmd)
657 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB;
658 else if (driver_id == qat_pmd)
659 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT;
660 else if (driver_id == openssl_pmd)
661 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL;
662 else if (driver_id == armv8_pmd)
663 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8;
664 else if (driver_id == scheduler_pmd)
665 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER;
666 else if (driver_id == dpaa2_pmd)
667 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC;
669 TEST_ASSERT(0, "Unrecognized cryptodev type");
671 for (i = 0; i < n_test_cases; i++) {
672 const struct blockcipher_test_case *tc = &tcs[i];
674 if (!(tc->pmd_mask & target_pmd_mask))
677 status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
678 dev_id, driver_id, test_msg);
680 printf(" %u) TestCase %s %s\n", test_index ++,
681 tc->test_descr, test_msg);
683 if (status != TEST_SUCCESS) {
684 if (overall_status == TEST_SUCCESS)
685 overall_status = status;
687 if (tc->feature_mask & BLOCKCIPHER_TEST_FEATURE_STOPPER)
692 return overall_status;