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>
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 case RTE_CRYPTODEV_SCHEDULER_PMD:
110 digest_len = tdata->digest.truncated_len;
113 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
114 "line %u FAILED: %s",
115 __LINE__, "Unsupported PMD type");
116 status = TEST_FAILED;
121 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
122 buf_len += tdata->iv.len;
123 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
124 buf_len += digest_len;
126 /* for contiguous mbuf, nb_segs is 1 */
127 ibuf = create_segmented_mbuf(mbuf_pool,
128 tdata->ciphertext.len, nb_segs, src_pattern);
130 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
131 "line %u FAILED: %s",
132 __LINE__, "Cannot create source mbuf");
133 status = TEST_FAILED;
137 /* only encryption requires plaintext.data input,
138 * decryption/(digest gen)/(digest verify) use ciphertext.data
141 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
142 pktmbuf_write(ibuf, 0, tdata->plaintext.len,
143 tdata->plaintext.data);
145 pktmbuf_write(ibuf, 0, tdata->ciphertext.len,
146 tdata->ciphertext.data);
148 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
149 rte_memcpy(rte_pktmbuf_prepend(ibuf, tdata->iv.len),
150 tdata->iv.data, tdata->iv.len);
152 buf_p = rte_pktmbuf_append(ibuf, digest_len);
153 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
154 rte_memcpy(buf_p, tdata->digest.data, digest_len);
156 memset(buf_p, 0, digest_len);
158 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
159 obuf = rte_pktmbuf_alloc(mbuf_pool);
161 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
162 "FAILED: %s", __LINE__,
163 "Allocation of rte_mbuf failed");
164 status = TEST_FAILED;
167 memset(obuf->buf_addr, dst_pattern, obuf->buf_len);
169 buf_p = rte_pktmbuf_append(obuf, buf_len);
171 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
172 "FAILED: %s", __LINE__,
173 "No room to append mbuf");
174 status = TEST_FAILED;
177 memset(buf_p, 0, buf_len);
180 /* Generate Crypto op data structure */
181 op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC);
183 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
184 "line %u FAILED: %s",
185 __LINE__, "Failed to allocate symmetric crypto "
187 status = TEST_FAILED;
193 sym_op->m_src = ibuf;
195 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
196 sym_op->m_dst = obuf;
199 sym_op->m_dst = NULL;
203 /* sessionless op requires allocate xform using
204 * rte_crypto_op_sym_xforms_alloc(), otherwise rte_zmalloc()
207 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
208 uint32_t n_xforms = 0;
210 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
212 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH)
215 if (rte_crypto_op_sym_xforms_alloc(op, n_xforms)
217 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
218 "FAILED: %s", __LINE__, "Failed to "
219 "allocate space for crypto transforms");
220 status = TEST_FAILED;
224 cipher_xform = rte_zmalloc(NULL,
225 sizeof(struct rte_crypto_sym_xform), 0);
227 auth_xform = rte_zmalloc(NULL,
228 sizeof(struct rte_crypto_sym_xform), 0);
230 if (!cipher_xform || !auth_xform) {
231 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
232 "FAILED: %s", __LINE__, "Failed to "
233 "allocate memory for crypto transforms");
234 status = TEST_FAILED;
239 /* preparing xform, for sessioned op, init_xform is initialized
240 * here and later as param in rte_cryptodev_sym_session_create() call
242 if (t->op_mask == BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN) {
243 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
244 cipher_xform = op->sym->xform;
245 auth_xform = cipher_xform->next;
246 auth_xform->next = NULL;
248 cipher_xform->next = auth_xform;
249 auth_xform->next = NULL;
250 init_xform = cipher_xform;
252 } else if (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC) {
253 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS) {
254 auth_xform = op->sym->xform;
255 cipher_xform = auth_xform->next;
256 cipher_xform->next = NULL;
258 auth_xform->next = cipher_xform;
259 cipher_xform->next = NULL;
260 init_xform = auth_xform;
262 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_ENCRYPT) ||
263 (t->op_mask == BLOCKCIPHER_TEST_OP_DECRYPT)) {
264 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
265 cipher_xform = op->sym->xform;
267 init_xform = cipher_xform;
268 cipher_xform->next = NULL;
269 } else if ((t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_GEN) ||
270 (t->op_mask == BLOCKCIPHER_TEST_OP_AUTH_VERIFY)) {
271 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)
272 auth_xform = op->sym->xform;
274 init_xform = auth_xform;
275 auth_xform->next = NULL;
277 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
278 "line %u FAILED: %s",
279 __LINE__, "Unrecognized operation");
280 status = TEST_FAILED;
284 /*configure xforms & sym_op cipher and auth data*/
285 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
286 cipher_xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
287 cipher_xform->cipher.algo = tdata->crypto_algo;
288 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT)
289 cipher_xform->cipher.op =
290 RTE_CRYPTO_CIPHER_OP_ENCRYPT;
292 cipher_xform->cipher.op =
293 RTE_CRYPTO_CIPHER_OP_DECRYPT;
294 cipher_xform->cipher.key.data = cipher_key;
295 cipher_xform->cipher.key.length = tdata->cipher_key.len;
297 sym_op->cipher.data.offset = tdata->iv.len;
298 sym_op->cipher.data.length = tdata->ciphertext.len;
299 sym_op->cipher.iv.data = rte_pktmbuf_mtod(sym_op->m_src,
301 sym_op->cipher.iv.length = tdata->iv.len;
302 sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(
306 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
307 uint32_t auth_data_offset = 0;
308 uint32_t digest_offset = tdata->ciphertext.len;
310 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
311 digest_offset += tdata->iv.len;
312 auth_data_offset += tdata->iv.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 = auth_data_offset;
338 sym_op->auth.data.length = tdata->ciphertext.len;
339 sym_op->auth.digest.length = digest_len;
342 /* create session for sessioned op */
343 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
344 sess = rte_cryptodev_sym_session_create(dev_id,
347 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
348 "FAILED: %s", __LINE__,
349 "Session creation failed");
350 status = TEST_FAILED;
354 /* attach symmetric crypto session to crypto operations */
355 rte_crypto_op_attach_sym_session(op, sess);
358 TEST_HEXDUMP(stdout, "m_src(before):",
359 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
360 rte_memcpy(tmp_src_buf, sym_op->m_src->buf_addr,
361 sym_op->m_src->buf_len);
362 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
363 TEST_HEXDUMP(stdout, "m_dst(before):",
364 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
365 rte_memcpy(tmp_dst_buf, sym_op->m_dst->buf_addr,
366 sym_op->m_dst->buf_len);
369 /* Process crypto operation */
370 if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
371 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
372 "line %u FAILED: %s",
373 __LINE__, "Error sending packet for encryption");
374 status = TEST_FAILED;
380 while (rte_cryptodev_dequeue_burst(dev_id, 0, &op, 1) == 0)
384 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
385 "line %u FAILED: %s",
386 __LINE__, "Failed to process sym crypto op");
387 status = TEST_FAILED;
391 TEST_HEXDUMP(stdout, "m_src(after):",
392 sym_op->m_src->buf_addr, sym_op->m_src->buf_len);
393 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP)
394 TEST_HEXDUMP(stdout, "m_dst(after):",
395 sym_op->m_dst->buf_addr, sym_op->m_dst->buf_len);
398 if (op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
399 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY)
400 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
401 "FAILED: Digest verification failed "
402 "(0x%X)", __LINE__, op->status);
404 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
405 "FAILED: Digest verification failed "
406 "(0x%X)", __LINE__, op->status);
407 status = TEST_FAILED;
411 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
412 uint8_t buffer[2048];
413 const uint8_t *compare_ref;
414 uint32_t compare_len;
416 if (t->op_mask & BLOCKCIPHER_TEST_OP_ENCRYPT) {
417 compare_ref = tdata->ciphertext.data;
418 compare_len = tdata->ciphertext.len;
420 compare_ref = tdata->plaintext.data;
421 compare_len = tdata->plaintext.len;
424 if (memcmp(rte_pktmbuf_read(iobuf, tdata->iv.len, compare_len,
425 buffer), compare_ref, compare_len)) {
426 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
427 "FAILED: %s", __LINE__,
428 "Crypto data not as expected");
429 status = TEST_FAILED;
434 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN) {
437 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER)
438 auth_res = pktmbuf_mtod_offset(iobuf,
439 tdata->iv.len + tdata->ciphertext.len);
441 auth_res = pktmbuf_mtod_offset(iobuf,
442 tdata->ciphertext.len);
444 if (memcmp(auth_res, tdata->digest.data, digest_len)) {
445 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "line %u "
446 "FAILED: %s", __LINE__, "Generated "
447 "digest data not as expected");
448 status = TEST_FAILED;
453 /* The only parts that should have changed in the buffer are
454 * plaintext/ciphertext and digest.
455 * In OOP only the dest buffer should change.
457 if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
458 struct rte_mbuf *mbuf;
460 uint32_t head_unchanged_len = 0, changed_len = 0;
463 mbuf = sym_op->m_src;
464 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) {
465 /* white-box test: PMDs use some of the
466 * tailroom as temp storage in verify case
468 head_unchanged_len = rte_pktmbuf_headroom(mbuf)
469 + rte_pktmbuf_data_len(mbuf);
470 changed_len = digest_len;
472 head_unchanged_len = mbuf->buf_len;
476 for (i = 0; i < mbuf->buf_len; i++) {
477 if (i == head_unchanged_len)
479 value = *((uint8_t *)(mbuf->buf_addr)+i);
480 if (value != tmp_src_buf[i]) {
481 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
482 "line %u FAILED: OOP src outer mbuf data (0x%x) not as expected (0x%x)",
483 __LINE__, value, tmp_src_buf[i]);
484 status = TEST_FAILED;
489 mbuf = sym_op->m_dst;
490 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
491 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
492 sym_op->auth.data.offset;
493 changed_len = sym_op->auth.data.length;
494 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
495 changed_len += sym_op->auth.digest.length;
498 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
499 sym_op->cipher.data.offset;
500 changed_len = sym_op->cipher.data.length;
503 for (i = 0; i < mbuf->buf_len; i++) {
504 if (i == head_unchanged_len)
506 value = *((uint8_t *)(mbuf->buf_addr)+i);
507 if (value != tmp_dst_buf[i]) {
508 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
509 "line %u FAILED: OOP dst outer mbuf data "
510 "(0x%x) not as expected (0x%x)",
511 __LINE__, value, tmp_dst_buf[i]);
512 status = TEST_FAILED;
517 /* In-place operation */
518 struct rte_mbuf *mbuf;
520 uint32_t head_unchanged_len = 0, changed_len = 0;
523 mbuf = sym_op->m_src;
524 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
525 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
526 sym_op->cipher.data.offset;
527 changed_len = sym_op->cipher.data.length;
530 head_unchanged_len = rte_pktmbuf_headroom(mbuf) +
531 sym_op->auth.data.offset +
532 sym_op->auth.data.length;
536 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
537 changed_len += sym_op->auth.digest.length;
539 if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_VERIFY) {
540 /* white-box test: PMDs use some of the
541 * tailroom as temp storage in verify case
543 if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
544 /* This is simplified, not checking digest*/
545 changed_len += digest_len*2;
547 head_unchanged_len += digest_len;
548 changed_len += digest_len;
552 for (i = 0; i < mbuf->buf_len; i++) {
553 if (i == head_unchanged_len)
555 value = *((uint8_t *)(mbuf->buf_addr)+i);
556 if (value != tmp_src_buf[i]) {
557 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
558 "line %u FAILED: outer mbuf data (0x%x) "
559 "not as expected (0x%x)",
560 __LINE__, value, tmp_src_buf[i]);
561 status = TEST_FAILED;
567 snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "PASS");
570 if (!(t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SESSIONLESS)) {
572 rte_cryptodev_sym_session_free(dev_id, sess);
574 rte_free(cipher_xform);
576 rte_free(auth_xform);
580 rte_crypto_op_free(op);
583 rte_pktmbuf_free(obuf);
586 rte_pktmbuf_free(ibuf);
592 test_blockcipher_all_tests(struct rte_mempool *mbuf_pool,
593 struct rte_mempool *op_mpool,
595 enum rte_cryptodev_type cryptodev_type,
596 enum blockcipher_test_type test_type)
598 int status, overall_status = TEST_SUCCESS;
599 uint32_t i, test_index = 0;
600 char test_msg[BLOCKCIPHER_TEST_MSG_LEN + 1];
601 uint32_t n_test_cases = 0;
602 uint32_t target_pmd_mask = 0;
603 const struct blockcipher_test_case *tcs = NULL;
606 case BLKCIPHER_AES_CHAIN_TYPE:
607 n_test_cases = sizeof(aes_chain_test_cases) /
608 sizeof(aes_chain_test_cases[0]);
609 tcs = aes_chain_test_cases;
611 case BLKCIPHER_AES_CIPHERONLY_TYPE:
612 n_test_cases = sizeof(aes_cipheronly_test_cases) /
613 sizeof(aes_cipheronly_test_cases[0]);
614 tcs = aes_cipheronly_test_cases;
616 case BLKCIPHER_3DES_CHAIN_TYPE:
617 n_test_cases = sizeof(triple_des_chain_test_cases) /
618 sizeof(triple_des_chain_test_cases[0]);
619 tcs = triple_des_chain_test_cases;
621 case BLKCIPHER_3DES_CIPHERONLY_TYPE:
622 n_test_cases = sizeof(triple_des_cipheronly_test_cases) /
623 sizeof(triple_des_cipheronly_test_cases[0]);
624 tcs = triple_des_cipheronly_test_cases;
626 case BLKCIPHER_DES_CIPHERONLY_TYPE:
627 n_test_cases = sizeof(des_cipheronly_test_cases) /
628 sizeof(des_cipheronly_test_cases[0]);
629 tcs = des_cipheronly_test_cases;
631 case BLKCIPHER_AUTHONLY_TYPE:
632 n_test_cases = sizeof(hash_test_cases) /
633 sizeof(hash_test_cases[0]);
634 tcs = hash_test_cases;
640 switch (cryptodev_type) {
641 case RTE_CRYPTODEV_AESNI_MB_PMD:
642 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB;
644 case RTE_CRYPTODEV_QAT_SYM_PMD:
645 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_QAT;
647 case RTE_CRYPTODEV_OPENSSL_PMD:
648 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL;
650 case RTE_CRYPTODEV_ARMV8_PMD:
651 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_ARMV8;
653 case RTE_CRYPTODEV_SCHEDULER_PMD:
654 target_pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER;
657 TEST_ASSERT(0, "Unrecognized cryptodev type");
661 for (i = 0; i < n_test_cases; i++) {
662 const struct blockcipher_test_case *tc = &tcs[i];
664 if (!(tc->pmd_mask & target_pmd_mask))
667 status = test_blockcipher_one_case(tc, mbuf_pool, op_mpool,
668 dev_id, cryptodev_type, test_msg);
670 printf(" %u) TestCase %s %s\n", test_index ++,
671 tc->test_descr, test_msg);
673 if (status != TEST_SUCCESS) {
674 if (overall_status == TEST_SUCCESS)
675 overall_status = status;
677 if (tc->feature_mask & BLOCKCIPHER_TEST_FEATURE_STOPPER)
682 return overall_status;