4 * Copyright(c) 2015-2016 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>
39 #include <rte_crypto.h>
40 #include <rte_cryptodev.h>
41 #include <rte_cryptodev_pmd.h>
44 #include "test_cryptodev.h"
45 #include "test_cryptodev_blockcipher.h"
46 #include "test_cryptodev_aes_test_vectors.h"
47 #include "test_cryptodev_des_test_vectors.h"
48 #include "test_cryptodev_hash_test_vectors.h"
49 #include "test_cryptodev.h"
52 test_blockcipher_one_case(const struct blockcipher_test_case *t,
53 struct rte_mempool *mbuf_pool,
54 struct rte_mempool *op_mpool,
56 enum rte_cryptodev_type cryptodev_type,
59 struct rte_mbuf *ibuf = NULL;
60 struct rte_mbuf *obuf = NULL;
61 struct rte_mbuf *iobuf;
62 struct rte_crypto_sym_xform *cipher_xform = NULL;
63 struct rte_crypto_sym_xform *auth_xform = NULL;
64 struct rte_crypto_sym_xform *init_xform = NULL;
65 struct rte_crypto_sym_op *sym_op = NULL;
66 struct rte_crypto_op *op = NULL;
67 struct rte_cryptodev_sym_session *sess = NULL;
68 struct rte_cryptodev_info dev_info;
70 int status = TEST_SUCCESS;
71 const struct blockcipher_test_data *tdata = t->test_data;
72 uint8_t cipher_key[tdata->cipher_key.len];
73 uint8_t auth_key[tdata->auth_key.len];
74 uint32_t buf_len = tdata->ciphertext.len;
75 uint32_t digest_len = 0;
77 uint8_t src_pattern = 0xa5;
78 uint8_t dst_pattern = 0xb6;
79 uint8_t tmp_src_buf[MBUF_SIZE];
80 uint8_t tmp_dst_buf[MBUF_SIZE];
84 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SG) {
85 rte_cryptodev_info_get(dev_id, &dev_info);
86 if (!(dev_info.feature_flags &
87 RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) {
88 printf("Device doesn't support scatter-gather. "
95 if (tdata->cipher_key.len)
96 memcpy(cipher_key, tdata->cipher_key.data,
97 tdata->cipher_key.len);
98 if (tdata->auth_key.len)
99 memcpy(auth_key, tdata->auth_key.data,
100 tdata->auth_key.len);
102 switch (cryptodev_type) {
103 case RTE_CRYPTODEV_QAT_SYM_PMD:
104 case RTE_CRYPTODEV_OPENSSL_PMD:
105 case RTE_CRYPTODEV_ARMV8_PMD: /* Fall through */
106 digest_len = tdata->digest.len;
108 case RTE_CRYPTODEV_AESNI_MB_PMD:
109 digest_len = tdata->digest.truncated_len;
112 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
113 "line %u FAILED: %s",
114 __LINE__, "Unsupported PMD type");
115 status = TEST_FAILED;
120 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
121 buf_len += tdata->iv.len;
122 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
123 buf_len += digest_len;
125 /* for contiguous mbuf, nb_segs is 1 */
126 ibuf = create_segmented_mbuf(mbuf_pool,
127 tdata->ciphertext.len, nb_segs, src_pattern);
129 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
130 "line %u FAILED: %s",
131 __LINE__, "Cannot create source mbuf");
132 status = TEST_FAILED;
136 /* only encryption requires plaintext.data input,
137 * decryption/(digest gen)/(digest verify) use ciphertext.data
140 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
141 pktmbuf_write(ibuf, 0, tdata->plaintext.len,
142 tdata->plaintext.data);
144 pktmbuf_write(ibuf, 0, tdata->ciphertext.len,
145 tdata->ciphertext.data);
147 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
148 rte_memcpy(rte_pktmbuf_prepend(ibuf, tdata->iv.len),
149 tdata->iv.data, tdata->iv.len);
151 buf_p = rte_pktmbuf_append(ibuf, digest_len);
152 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
153 rte_memcpy(buf_p, tdata->digest.data, digest_len);
155 memset(buf_p, 0, digest_len);
157 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
158 obuf = rte_pktmbuf_alloc(mbuf_pool);
160 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
161 "FAILED: %s", __LINE__,
162 "Allocation of rte_mbuf failed");
163 status = TEST_FAILED;
166 memset(obuf->buf_addr, dst_pattern, obuf->buf_len);
168 buf_p = rte_pktmbuf_append(obuf, buf_len);
170 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
171 "FAILED: %s", __LINE__,
172 "No room to append mbuf");
173 status = TEST_FAILED;
176 memset(buf_p, 0, buf_len);
179 /* Generate Crypto op data structure */
180 op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC);
182 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
183 "line %u FAILED: %s",
184 __LINE__, "Failed to allocate symmetric crypto "
186 status = TEST_FAILED;
192 sym_op->m_src = ibuf;
194 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
195 sym_op->m_dst = obuf;
198 sym_op->m_dst = NULL;
202 /* sessionless op requires allocate xform using
203 * rte_crypto_op_sym_xforms_alloc(), otherwise rte_zmalloc()
206 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
207 uint32_t n_xforms = 0;
209 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
211 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
214 if (rte_crypto_op_sym_xforms_alloc(op, n_xforms)
216 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
217 "FAILED: %s", __LINE__, "Failed to "
218 "allocate space for crypto transforms");
219 status = TEST_FAILED;
223 cipher_xform = rte_zmalloc(NULL,
224 sizeof(struct rte_crypto_sym_xform), 0);
226 auth_xform = rte_zmalloc(NULL,
227 sizeof(struct rte_crypto_sym_xform), 0);
229 if (!cipher_xform || !auth_xform) {
230 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
231 "FAILED: %s", __LINE__, "Failed to "
232 "allocate memory for crypto transforms");
233 status = TEST_FAILED;
238 /* preparing xform, for sessioned op, init_xform is initialized
239 * here and later as param in rte_cryptodev_sym_session_create() call
241 if (t->op_mask == BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN) {
242 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
243 cipher_xform = op->sym->xform;
244 auth_xform = cipher_xform->next;
245 auth_xform->next = NULL;
247 cipher_xform->next = auth_xform;
248 auth_xform->next = NULL;
249 init_xform = cipher_xform;
251 } else if (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC) {
252 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
253 auth_xform = op->sym->xform;
254 cipher_xform = auth_xform->next;
255 cipher_xform->next = NULL;
257 auth_xform->next = cipher_xform;
258 cipher_xform->next = NULL;
259 init_xform = auth_xform;
261 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_ENCRYPT) ||
262 (t->op_mask == BLOCKCIPHER_TEST_OP_DECRYPT)) {
263 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
264 cipher_xform = op->sym->xform;
266 init_xform = cipher_xform;
267 cipher_xform->next = NULL;
268 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_GEN) ||
269 (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY)) {
270 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
271 auth_xform = op->sym->xform;
273 init_xform = auth_xform;
274 auth_xform->next = NULL;
276 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
277 "line %u FAILED: %s",
278 __LINE__, "Unrecognized operation");
279 status = TEST_FAILED;
283 /*configure xforms & sym_op cipher and auth data*/
284 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
285 cipher_xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
286 cipher_xform->cipher.algo = tdata->crypto_algo;
287 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
288 cipher_xform->cipher.op =
289 RTE_CRYPTO_CIPHER_OP_ENCRYPT;
291 cipher_xform->cipher.op =
292 RTE_CRYPTO_CIPHER_OP_DECRYPT;
293 cipher_xform->cipher.key.data = cipher_key;
294 cipher_xform->cipher.key.length = tdata->cipher_key.len;
296 sym_op->cipher.data.offset = tdata->iv.len;
297 sym_op->cipher.data.length = tdata->ciphertext.len;
298 sym_op->cipher.iv.data = rte_pktmbuf_mtod(sym_op->m_src,
300 sym_op->cipher.iv.length = tdata->iv.len;
301 sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(
305 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
306 uint32_t auth_data_offset = 0;
307 uint32_t digest_offset = tdata->ciphertext.len;
309 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
310 digest_offset += tdata->iv.len;
311 auth_data_offset += tdata->iv.len;
314 auth_xform->type = RTE_CRYPTO_SYM_XFORM_AUTH;
315 auth_xform->auth.algo = tdata->auth_algo;
316 auth_xform->auth.key.length = tdata->auth_key.len;
317 auth_xform->auth.key.data = auth_key;
318 auth_xform->auth.digest_length = digest_len;
320 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
321 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
322 sym_op->auth.digest.data = pktmbuf_mtod_offset
323 (iobuf, digest_offset);
324 sym_op->auth.digest.phys_addr =
325 pktmbuf_mtophys_offset(iobuf,
328 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
329 sym_op->auth.digest.data = pktmbuf_mtod_offset
330 (sym_op->m_src, digest_offset);
331 sym_op->auth.digest.phys_addr =
332 pktmbuf_mtophys_offset(sym_op->m_src,
336 sym_op->auth.data.offset = auth_data_offset;
337 sym_op->auth.data.length = tdata->ciphertext.len;
338 sym_op->auth.digest.length = digest_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, tdata->iv.len, 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) {
436 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
437 auth_res = pktmbuf_mtod_offset(iobuf,
438 tdata->iv.len + tdata->ciphertext.len);
440 auth_res = pktmbuf_mtod_offset(iobuf,
441 tdata->ciphertext.len);
443 if (memcmp(auth_res, tdata->digest.data, digest_len)) {
444 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
445 "FAILED: %s", __LINE__, "Generated "
446 "digest data not as expected");
447 status = TEST_FAILED;
452 /* The only parts that should have changed in the buffer are
453 * plaintext/ciphertext and digest.
454 * In OOP only the dest buffer should change.
456 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
457 struct rte_mbuf *mbuf;
459 uint32_t head_unchanged_len = 0, changed_len = 0;
462 mbuf = sym_op->m_src;
463 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) {
464 /* white-box test: PMDs use some of the
465 * tailroom as temp storage in verify case
467 head_unchanged_len = rte_pktmbuf_headroom(mbuf)
468 + rte_pktmbuf_data_len(mbuf);
469 changed_len = digest_len;
471 head_unchanged_len = mbuf->buf_len;
475 for (i = 0; i < mbuf->buf_len; i++) {
476 if (i == head_unchanged_len)
478 value = *((uint8_t *)(mbuf->buf_addr)+i);
479 if (value != tmp_src_buf[i]) {
480 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
481 "line %u FAILED: OOP src outer mbuf data (0x%x) not as expected (0x%x)",
482 __LINE__, value, tmp_src_buf[i]);
483 status = TEST_FAILED;
488 mbuf = sym_op->m_dst;
489 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
490 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
491 sym_op->auth.data.offset;
492 changed_len = sym_op->auth.data.length;
493 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
494 changed_len += sym_op->auth.digest.length;
497 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
498 sym_op->cipher.data.offset;
499 changed_len = sym_op->cipher.data.length;
502 for (i = 0; i < mbuf->buf_len; i++) {
503 if (i == head_unchanged_len)
505 value = *((uint8_t *)(mbuf->buf_addr)+i);
506 if (value != tmp_dst_buf[i]) {
507 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
508 "line %u FAILED: OOP dst outer mbuf data "
509 "(0x%x) not as expected (0x%x)",
510 __LINE__, value, tmp_dst_buf[i]);
511 status = TEST_FAILED;
516 /* In-place operation */
517 struct rte_mbuf *mbuf;
519 uint32_t head_unchanged_len = 0, changed_len = 0;
522 mbuf = sym_op->m_src;
523 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
524 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
525 sym_op->cipher.data.offset;
526 changed_len = sym_op->cipher.data.length;
529 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
530 sym_op->auth.data.offset +
531 sym_op->auth.data.length;
535 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
536 changed_len += sym_op->auth.digest.length;
538 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) {
539 /* white-box test: PMDs use some of the
540 * tailroom as temp storage in verify case
542 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
543 /* This is simplified, not checking digest*/
544 changed_len += digest_len*2;
546 head_unchanged_len += digest_len;
547 changed_len += digest_len;
551 for (i = 0; i < mbuf->buf_len; i++) {
552 if (i == head_unchanged_len)
554 value = *((uint8_t *)(mbuf->buf_addr)+i);
555 if (value != tmp_src_buf[i]) {
556 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
557 "line %u FAILED: outer mbuf data (0x%x) "
558 "not as expected (0x%x)",
559 __LINE__, value, tmp_src_buf[i]);
560 status = TEST_FAILED;
566 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "PASS");
569 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
571 rte_cryptodev_sym_session_free(dev_id, sess);
573 rte_free(cipher_xform);
575 rte_free(auth_xform);
579 rte_crypto_op_free(op);
582 rte_pktmbuf_free(obuf);
585 rte_pktmbuf_free(ibuf);
591 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
592 struct rte_mempool *op_mpool,
594 enum rte_cryptodev_type cryptodev_type,
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;
605 case BLKCIPHER_AES_CHAIN_TYPE:
606 n_test_cases = sizeof(aes_chain_test_cases) /
607 sizeof(aes_chain_test_cases[0]);
608 tcs = aes_chain_test_cases;
610 case BLKCIPHER_AES_CIPHERONLY_TYPE:
611 n_test_cases = sizeof(aes_cipheronly_test_cases) /
612 sizeof(aes_cipheronly_test_cases[0]);
613 tcs = aes_cipheronly_test_cases;
615 case BLKCIPHER_3DES_CHAIN_TYPE:
616 n_test_cases = sizeof(triple_des_chain_test_cases) /
617 sizeof(triple_des_chain_test_cases[0]);
618 tcs = triple_des_chain_test_cases;
620 case BLKCIPHER_3DES_CIPHERONLY_TYPE:
621 n_test_cases = sizeof(triple_des_cipheronly_test_cases) /
622 sizeof(triple_des_cipheronly_test_cases[0]);
623 tcs = triple_des_cipheronly_test_cases;
625 case BLKCIPHER_DES_CIPHERONLY_TYPE:
626 n_test_cases = sizeof(des_cipheronly_test_cases) /
627 sizeof(des_cipheronly_test_cases[0]);
628 tcs = des_cipheronly_test_cases;
630 case BLKCIPHER_AUTHONLY_TYPE:
631 n_test_cases = sizeof(hash_test_cases) /
632 sizeof(hash_test_cases[0]);
633 tcs = hash_test_cases;
639 switch (cryptodev_type) {
640 case RTE_CRYPTODEV_AESNI_MB_PMD:
641 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB;
643 case RTE_CRYPTODEV_QAT_SYM_PMD:
644 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT;
646 case RTE_CRYPTODEV_OPENSSL_PMD:
647 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL;
649 case RTE_CRYPTODEV_ARMV8_PMD:
650 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8;
653 TEST_ASSERT(0, "Unrecognized cryptodev type");
657 for (i = 0; i < n_test_cases; i++) {
658 const struct blockcipher_test_case *tc = &tcs[i];
660 if (!(tc->pmd_mask & target_pmd_mask))
663 status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
664 dev_id, cryptodev_type, test_msg);
666 printf(" %u) TestCase %s %s\n", test_index ++,
667 tc->test_descr, test_msg);
669 if (status != TEST_SUCCESS) {
670 if (overall_status == TEST_SUCCESS)
671 overall_status = status;
673 if (tc->feature_mask & BLOCKCIPHER_TEST_FEATURE_STOPPER)
678 return overall_status;