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_aes.h"
46 #ifndef AES_TEST_MSG_LEN
47 #define AES_TEST_MSG_LEN 256
50 #define AES_TEST_OP_ENCRYPT 0x01
51 #define AES_TEST_OP_DECRYPT 0x02
52 #define AES_TEST_OP_AUTH_GEN 0x04
53 #define AES_TEST_OP_AUTH_VERIFY 0x08
55 #define AES_TEST_FEATURE_OOP 0x01
56 #define AES_TEST_FEATURE_SESSIONLESS 0x02
57 #define AES_TEST_FEATURE_STOPPER 0x04 /* stop upon failing */
59 #define AES_TEST_TARGET_PMD_MB 0x0001 /* Multi-buffer flag */
60 #define AES_TEST_TARGET_PMD_QAT 0x0002 /* QAT flag */
62 #define AES_TEST_OP_CIPHER (AES_TEST_OP_ENCRYPT | \
65 #define AES_TEST_OP_AUTH (AES_TEST_OP_AUTH_GEN | \
66 AES_TEST_OP_AUTH_VERIFY)
68 #define AES_TEST_OP_ENC_AUTH_GEN (AES_TEST_OP_ENCRYPT | \
71 #define AES_TEST_OP_AUTH_VERIFY_DEC (AES_TEST_OP_DECRYPT | \
72 AES_TEST_OP_AUTH_VERIFY)
74 struct aes_test_case {
75 const char *test_descr; /* test description */
76 const struct aes_test_data *test_data;
77 uint8_t op_mask; /* operation mask */
82 static const struct aes_test_case aes_test_cases[] = {
84 .test_descr = "AES-128-CTR HMAC-SHA1 Encryption Digest",
85 .test_data = &aes_test_data_1,
86 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
87 .pmd_mask = AES_TEST_TARGET_PMD_MB |
88 AES_TEST_TARGET_PMD_QAT
91 .test_descr = "AES-128-CTR HMAC-SHA1 Decryption Digest "
93 .test_data = &aes_test_data_1,
94 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
95 .pmd_mask = AES_TEST_TARGET_PMD_MB |
96 AES_TEST_TARGET_PMD_QAT
99 .test_descr = "AES-192-CTR XCBC Encryption Digest",
100 .test_data = &aes_test_data_2,
101 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
102 .pmd_mask = AES_TEST_TARGET_PMD_MB |
103 AES_TEST_TARGET_PMD_QAT
106 .test_descr = "AES-192-CTR XCBC Decryption Digest Verify",
107 .test_data = &aes_test_data_2,
108 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
109 .pmd_mask = AES_TEST_TARGET_PMD_MB |
110 AES_TEST_TARGET_PMD_QAT
113 .test_descr = "AES-256-CTR HMAC-SHA1 Encryption Digest",
114 .test_data = &aes_test_data_3,
115 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
116 .pmd_mask = AES_TEST_TARGET_PMD_MB |
117 AES_TEST_TARGET_PMD_QAT
120 .test_descr = "AES-256-CTR HMAC-SHA1 Decryption Digest "
122 .test_data = &aes_test_data_3,
123 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
124 .pmd_mask = AES_TEST_TARGET_PMD_MB |
125 AES_TEST_TARGET_PMD_QAT
128 .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest",
129 .test_data = &aes_test_data_4,
130 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
131 .pmd_mask = AES_TEST_TARGET_PMD_MB |
132 AES_TEST_TARGET_PMD_QAT
135 .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest "
137 .test_data = &aes_test_data_4,
138 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
139 .pmd_mask = AES_TEST_TARGET_PMD_MB |
140 AES_TEST_TARGET_PMD_QAT
143 .test_descr = "AES-128-CBC HMAC-SHA256 Encryption Digest",
144 .test_data = &aes_test_data_5,
145 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
146 .pmd_mask = AES_TEST_TARGET_PMD_MB |
147 AES_TEST_TARGET_PMD_QAT
150 .test_descr = "AES-128-CBC HMAC-SHA256 Decryption Digest "
152 .test_data = &aes_test_data_5,
153 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
154 .pmd_mask = AES_TEST_TARGET_PMD_MB |
155 AES_TEST_TARGET_PMD_QAT
158 .test_descr = "AES-128-CBC HMAC-SHA512 Encryption Digest",
159 .test_data = &aes_test_data_6,
160 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
161 .pmd_mask = AES_TEST_TARGET_PMD_MB |
162 AES_TEST_TARGET_PMD_QAT
165 .test_descr = "AES-128-CBC HMAC-SHA512 Encryption Digest "
167 .test_data = &aes_test_data_6,
168 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
169 .feature_mask = AES_TEST_FEATURE_SESSIONLESS,
170 .pmd_mask = AES_TEST_TARGET_PMD_MB
173 .test_descr = "AES-128-CBC HMAC-SHA512 Decryption Digest "
175 .test_data = &aes_test_data_6,
176 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
177 .pmd_mask = AES_TEST_TARGET_PMD_MB |
178 AES_TEST_TARGET_PMD_QAT
181 .test_descr = "AES-128-CBC XCBC Encryption Digest",
182 .test_data = &aes_test_data_7,
183 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
184 .pmd_mask = AES_TEST_TARGET_PMD_MB |
185 AES_TEST_TARGET_PMD_QAT
188 .test_descr = "AES-128-CBC XCBC Decryption Digest Verify",
189 .test_data = &aes_test_data_7,
190 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
191 .pmd_mask = AES_TEST_TARGET_PMD_MB |
192 AES_TEST_TARGET_PMD_QAT
195 .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest "
197 .test_data = &aes_test_data_4,
198 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
199 .feature_mask = AES_TEST_FEATURE_OOP,
200 .pmd_mask = AES_TEST_TARGET_PMD_QAT
203 .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest "
205 .test_data = &aes_test_data_4,
206 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
207 .feature_mask = AES_TEST_FEATURE_OOP,
208 .pmd_mask = AES_TEST_TARGET_PMD_QAT
211 .test_descr = "AES-128-CBC HMAC-SHA224 Encryption Digest",
212 .test_data = &aes_test_data_8,
213 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
214 .pmd_mask = AES_TEST_TARGET_PMD_MB |
215 AES_TEST_TARGET_PMD_QAT
218 .test_descr = "AES-128-CBC HMAC-SHA224 Decryption Digest "
220 .test_data = &aes_test_data_8,
221 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
222 .pmd_mask = AES_TEST_TARGET_PMD_MB |
223 AES_TEST_TARGET_PMD_QAT
226 .test_descr = "AES-128-CBC HMAC-SHA384 Encryption Digest",
227 .test_data = &aes_test_data_9,
228 .op_mask = AES_TEST_OP_ENC_AUTH_GEN,
229 .pmd_mask = AES_TEST_TARGET_PMD_MB
232 .test_descr = "AES-128-CBC HMAC-SHA384 Decryption Digest "
234 .test_data = &aes_test_data_9,
235 .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC,
236 .pmd_mask = AES_TEST_TARGET_PMD_MB
241 test_AES_one_case(const struct aes_test_case *t,
242 struct rte_mempool *mbuf_pool,
243 struct rte_mempool *op_mpool,
245 enum rte_cryptodev_type cryptodev_type,
248 struct rte_mbuf *ibuf = NULL;
249 struct rte_mbuf *obuf = NULL;
250 struct rte_mbuf *iobuf;
251 struct rte_crypto_sym_xform *cipher_xform = NULL;
252 struct rte_crypto_sym_xform *auth_xform = NULL;
253 struct rte_crypto_sym_xform *init_xform = NULL;
254 struct rte_crypto_sym_op *sym_op = NULL;
255 struct rte_crypto_op *op = NULL;
256 struct rte_cryptodev_sym_session *sess = NULL;
258 int status = TEST_SUCCESS;
259 const struct aes_test_data *tdata = t->test_data;
260 uint8_t cipher_key[tdata->cipher_key.len];
261 uint8_t auth_key[tdata->auth_key.len];
262 uint32_t buf_len = tdata->ciphertext.len;
263 uint32_t digest_len = 0;
266 if (tdata->cipher_key.len)
267 memcpy(cipher_key, tdata->cipher_key.data,
268 tdata->cipher_key.len);
269 if (tdata->auth_key.len)
270 memcpy(auth_key, tdata->auth_key.data,
271 tdata->auth_key.len);
273 switch (cryptodev_type) {
274 case RTE_CRYPTODEV_QAT_SYM_PMD:
275 digest_len = tdata->digest.len;
277 case RTE_CRYPTODEV_AESNI_MB_PMD:
278 digest_len = tdata->digest.truncated_len;
281 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u FAILED: %s",
282 __LINE__, "Unsupported PMD type");
283 status = TEST_FAILED;
288 ibuf = rte_pktmbuf_alloc(mbuf_pool);
290 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u FAILED: %s",
291 __LINE__, "Allocation of rte_mbuf failed");
292 status = TEST_FAILED;
296 if (t->op_mask & AES_TEST_OP_CIPHER)
297 buf_len += tdata->iv.len;
298 if (t->op_mask & AES_TEST_OP_AUTH)
299 buf_len += digest_len;
301 buf_p = rte_pktmbuf_append(ibuf, buf_len);
303 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u FAILED: %s",
304 __LINE__, "No room to append mbuf");
305 status = TEST_FAILED;
309 if (t->op_mask & AES_TEST_OP_CIPHER) {
310 rte_memcpy(buf_p, tdata->iv.data, tdata->iv.len);
311 buf_p += tdata->iv.len;
314 /* only encryption requires plaintext.data input,
315 * decryption/(digest gen)/(digest verify) use ciphertext.data
317 if (t->op_mask & AES_TEST_OP_ENCRYPT) {
318 rte_memcpy(buf_p, tdata->plaintext.data,
319 tdata->plaintext.len);
320 buf_p += tdata->plaintext.len;
322 rte_memcpy(buf_p, tdata->ciphertext.data,
323 tdata->ciphertext.len);
324 buf_p += tdata->ciphertext.len;
327 if (t->op_mask & AES_TEST_OP_AUTH_VERIFY)
328 rte_memcpy(buf_p, tdata->digest.data, digest_len);
330 memset(buf_p, 0, digest_len);
332 if (t->feature_mask & AES_TEST_FEATURE_OOP) {
333 obuf = rte_pktmbuf_alloc(mbuf_pool);
335 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
336 "FAILED: %s", __LINE__,
337 "Allocation of rte_mbuf failed");
338 status = TEST_FAILED;
342 buf_p = rte_pktmbuf_append(obuf, buf_len);
344 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
345 "FAILED: %s", __LINE__,
346 "No room to append mbuf");
347 status = TEST_FAILED;
350 memset(buf_p, 0, buf_len);
353 /* Generate Crypto op data structure */
354 op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_SYMMETRIC);
356 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u FAILED: %s",
357 __LINE__, "Failed to allocate symmetric crypto "
359 status = TEST_FAILED;
365 sym_op->m_src = ibuf;
367 if (t->feature_mask & AES_TEST_FEATURE_OOP) {
368 sym_op->m_dst = obuf;
371 sym_op->m_dst = NULL;
375 /* sessionless op requires allocate xform using
376 * rte_crypto_op_sym_xforms_alloc(), otherwise rte_zmalloc()
378 if (t->feature_mask & AES_TEST_FEATURE_SESSIONLESS) {
379 uint32_t n_xforms = 0;
381 if (t->op_mask & AES_TEST_OP_CIPHER)
383 if (t->op_mask & AES_TEST_OP_AUTH)
386 if (rte_crypto_op_sym_xforms_alloc(op, n_xforms)
388 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
389 "FAILED: %s", __LINE__, "Failed to "
390 "allocate space for crypto transforms");
391 status = TEST_FAILED;
395 cipher_xform = rte_zmalloc(NULL,
396 sizeof(struct rte_crypto_sym_xform), 0);
398 auth_xform = rte_zmalloc(NULL,
399 sizeof(struct rte_crypto_sym_xform), 0);
401 if (!cipher_xform || !auth_xform) {
402 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
403 "FAILED: %s", __LINE__, "Failed to "
404 "allocate memory for crypto transforms");
405 status = TEST_FAILED;
410 /* preparing xform, for sessioned op, init_xform is initialized
411 * here and later as param in rte_cryptodev_sym_session_create()
413 if (t->op_mask == AES_TEST_OP_ENC_AUTH_GEN) {
414 if (t->feature_mask & AES_TEST_FEATURE_SESSIONLESS) {
415 cipher_xform = op->sym->xform;
416 auth_xform = cipher_xform->next;
417 auth_xform->next = NULL;
419 cipher_xform->next = auth_xform;
420 auth_xform->next = NULL;
421 init_xform = cipher_xform;
423 } else if (t->op_mask == AES_TEST_OP_AUTH_VERIFY_DEC) {
424 if (t->feature_mask & AES_TEST_FEATURE_SESSIONLESS) {
425 auth_xform = op->sym->xform;
426 cipher_xform = auth_xform->next;
427 cipher_xform->next = NULL;
429 auth_xform->next = cipher_xform;
430 cipher_xform->next = NULL;
431 init_xform = auth_xform;
433 } else if ((t->op_mask == AES_TEST_OP_ENCRYPT) ||
434 (t->op_mask == AES_TEST_OP_DECRYPT)) {
435 if (t->feature_mask & AES_TEST_FEATURE_SESSIONLESS)
436 cipher_xform = op->sym->xform;
438 init_xform = cipher_xform;
439 cipher_xform->next = NULL;
440 } else if ((t->op_mask == AES_TEST_OP_AUTH_GEN) ||
441 (t->op_mask == AES_TEST_OP_AUTH_VERIFY)) {
442 if (t->feature_mask & AES_TEST_FEATURE_SESSIONLESS)
443 auth_xform = op->sym->xform;
445 init_xform = auth_xform;
446 auth_xform->next = NULL;
448 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u FAILED: %s",
449 __LINE__, "Unrecognized operation");
450 status = TEST_FAILED;
454 /*configure xforms & sym_op cipher and auth data*/
455 if (t->op_mask & AES_TEST_OP_CIPHER) {
456 cipher_xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
457 cipher_xform->cipher.algo = tdata->crypto_algo;
458 if (t->op_mask & AES_TEST_OP_ENCRYPT)
459 cipher_xform->cipher.op =
460 RTE_CRYPTO_CIPHER_OP_ENCRYPT;
462 cipher_xform->cipher.op =
463 RTE_CRYPTO_CIPHER_OP_DECRYPT;
464 cipher_xform->cipher.key.data = cipher_key;
465 cipher_xform->cipher.key.length = tdata->cipher_key.len;
467 sym_op->cipher.data.offset = tdata->iv.len;
468 sym_op->cipher.data.length = tdata->ciphertext.len;
469 sym_op->cipher.iv.data = rte_pktmbuf_mtod(sym_op->m_src,
471 sym_op->cipher.iv.length = tdata->iv.len;
472 sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(
476 if (t->op_mask & AES_TEST_OP_AUTH) {
477 uint32_t auth_data_offset = 0;
478 uint32_t digest_offset = tdata->ciphertext.len;
480 if (t->op_mask & AES_TEST_OP_CIPHER) {
481 digest_offset += tdata->iv.len;
482 auth_data_offset += tdata->iv.len;
485 auth_xform->type = RTE_CRYPTO_SYM_XFORM_AUTH;
486 auth_xform->auth.algo = tdata->auth_algo;
487 auth_xform->auth.key.length = tdata->auth_key.len;
488 auth_xform->auth.key.data = auth_key;
489 auth_xform->auth.digest_length = digest_len;
491 if (t->op_mask & AES_TEST_OP_AUTH_GEN) {
492 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
493 sym_op->auth.digest.data = rte_pktmbuf_mtod_offset
494 (iobuf, uint8_t *, digest_offset);
495 sym_op->auth.digest.phys_addr =
496 rte_pktmbuf_mtophys_offset(iobuf,
499 auth_xform->auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
500 sym_op->auth.digest.data = rte_pktmbuf_mtod_offset
501 (sym_op->m_src, uint8_t *, digest_offset);
502 sym_op->auth.digest.phys_addr =
503 rte_pktmbuf_mtophys_offset(sym_op->m_src,
507 sym_op->auth.data.offset = auth_data_offset;
508 sym_op->auth.data.length = tdata->ciphertext.len;
509 sym_op->auth.digest.length = digest_len;
512 /* create session for sessioned op */
513 if (!(t->feature_mask & AES_TEST_FEATURE_SESSIONLESS)) {
514 sess = rte_cryptodev_sym_session_create(dev_id,
517 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
518 "FAILED: %s", __LINE__,
519 "Session creation failed");
520 status = TEST_FAILED;
524 /* attach symmetric crypto session to crypto operations */
525 rte_crypto_op_attach_sym_session(op, sess);
528 /* Process crypto operation */
529 if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
530 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u FAILED: %s",
531 __LINE__, "Error sending packet for encryption");
532 status = TEST_FAILED;
538 while (rte_cryptodev_dequeue_burst(dev_id, 0, &op, 1) == 0)
542 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u FAILED: %s",
543 __LINE__, "Failed to process sym crypto op");
544 status = TEST_FAILED;
548 TEST_HEXDUMP(stdout, "m_src:",
549 rte_pktmbuf_mtod(sym_op->m_src, uint8_t *), buf_len);
550 if (t->feature_mask & AES_TEST_FEATURE_OOP)
551 TEST_HEXDUMP(stdout, "m_dst:",
552 rte_pktmbuf_mtod(sym_op->m_dst, uint8_t *),
556 if (op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) {
557 if (t->op_mask & AES_TEST_OP_AUTH_VERIFY)
558 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
559 "FAILED: Digest verification failed "
560 "(0x%X)", __LINE__, op->status);
562 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
563 "FAILED: Digest verification failed "
564 "(0x%X)", __LINE__, op->status);
565 status = TEST_FAILED;
569 if (t->op_mask & AES_TEST_OP_CIPHER) {
571 const uint8_t *compare_ref;
572 uint32_t compare_len;
574 crypto_res = rte_pktmbuf_mtod_offset(iobuf, uint8_t *,
577 if (t->op_mask & AES_TEST_OP_ENCRYPT) {
578 compare_ref = tdata->ciphertext.data;
579 compare_len = tdata->ciphertext.len;
581 compare_ref = tdata->plaintext.data;
582 compare_len = tdata->plaintext.len;
585 if (memcmp(crypto_res, compare_ref, compare_len)) {
586 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
587 "FAILED: %s", __LINE__,
588 "Crypto data not as expected");
589 status = TEST_FAILED;
594 if (t->op_mask & AES_TEST_OP_AUTH_GEN) {
597 if (t->op_mask & AES_TEST_OP_CIPHER)
598 auth_res = rte_pktmbuf_mtod_offset(iobuf,
600 tdata->iv.len + tdata->ciphertext.len);
602 auth_res = rte_pktmbuf_mtod_offset(iobuf,
603 uint8_t *, tdata->ciphertext.len);
605 if (memcmp(auth_res, tdata->digest.data, digest_len)) {
606 snprintf(test_msg, AES_TEST_MSG_LEN, "line %u "
607 "FAILED: %s", __LINE__, "Generated "
608 "digest data not as expected");
609 status = TEST_FAILED;
614 snprintf(test_msg, AES_TEST_MSG_LEN, "PASS");
617 if (!(t->feature_mask & AES_TEST_FEATURE_SESSIONLESS)) {
619 rte_cryptodev_sym_session_free(dev_id, sess);
621 rte_free(cipher_xform);
623 rte_free(auth_xform);
627 rte_crypto_op_free(op);
630 rte_pktmbuf_free(obuf);
633 rte_pktmbuf_free(ibuf);
639 test_AES_all_tests(struct rte_mempool *mbuf_pool,
640 struct rte_mempool *op_mpool,
642 enum rte_cryptodev_type cryptodev_type)
644 int status, overall_status = TEST_SUCCESS;
645 uint32_t i, test_index = 0;
646 char test_msg[AES_TEST_MSG_LEN + 1];
647 uint32_t n_test_cases = sizeof(aes_test_cases) /
648 sizeof(aes_test_cases[0]);
649 uint32_t target_pmd_mask = 0;
651 switch (cryptodev_type) {
652 case RTE_CRYPTODEV_AESNI_MB_PMD:
653 target_pmd_mask = AES_TEST_TARGET_PMD_MB;
655 case RTE_CRYPTODEV_QAT_SYM_PMD:
656 target_pmd_mask = AES_TEST_TARGET_PMD_QAT;
659 TEST_ASSERT(-1, "Unrecognized cryptodev type");
663 for (i = 0; i < n_test_cases; i++) {
664 const struct aes_test_case *tc = &aes_test_cases[i];
666 if (!(tc->pmd_mask & target_pmd_mask))
669 status = test_AES_one_case(tc, mbuf_pool, op_mpool,
670 dev_id, cryptodev_type, test_msg);
672 printf(" %u) TestCase %s %s\n", test_index ++,
673 tc->test_descr, test_msg);
675 if (status != TEST_SUCCESS) {
676 if (overall_status == TEST_SUCCESS)
677 overall_status = status;
679 if (tc->feature_mask & AES_TEST_FEATURE_STOPPER)
684 return overall_status;