test/crypto-perf: move IV to crypto op private data
[dpdk.git] / test / test / test_cryptodev_perf.c
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2015-2017 Intel Corporation. All rights reserved.
5  *
6  *   Redistribution and use in source and binary forms, with or without
7  *   modification, are permitted provided that the following conditions
8  *   are met:
9  *
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
15  *         distribution.
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.
19  *
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.
31  */
32
33 #include <rte_common.h>
34 #include <rte_mbuf.h>
35 #include <rte_malloc.h>
36 #include <rte_memcpy.h>
37
38 #include <rte_crypto.h>
39 #include <rte_cryptodev.h>
40 #include <rte_cycles.h>
41
42 #include "test.h"
43 #include "test_cryptodev.h"
44 #include "test_cryptodev_gcm_test_vectors.h"
45
46
47 #define PERF_NUM_OPS_INFLIGHT           (128)
48 #define DEFAULT_NUM_REQS_TO_SUBMIT      (10000000)
49
50 struct crypto_testsuite_params {
51         struct rte_mempool *mbuf_mp;
52         struct rte_mempool *op_mpool;
53
54         uint16_t nb_queue_pairs;
55
56         struct rte_cryptodev_config conf;
57         struct rte_cryptodev_qp_conf qp_conf;
58         uint8_t dev_id;
59 };
60
61 enum chain_mode {
62         CIPHER_HASH,
63         HASH_CIPHER,
64         CIPHER_ONLY,
65         HASH_ONLY
66 };
67
68
69 struct symmetric_op {
70         const uint8_t *iv_data;
71         uint32_t iv_len;
72
73         const uint8_t *aad_data;
74         uint32_t aad_len;
75
76         const uint8_t *p_data;
77         uint32_t p_len;
78
79         const uint8_t *c_data;
80         uint32_t c_len;
81
82         const uint8_t *t_data;
83         uint32_t t_len;
84
85 };
86
87 struct symmetric_session_attrs {
88         enum rte_crypto_cipher_operation cipher;
89         enum rte_crypto_auth_operation auth;
90
91         enum rte_crypto_cipher_algorithm cipher_algorithm;
92         const uint8_t *key_cipher_data;
93         uint32_t key_cipher_len;
94
95         enum rte_crypto_auth_algorithm auth_algorithm;
96         const uint8_t *key_auth_data;
97         uint32_t key_auth_len;
98
99         uint32_t digest_len;
100 };
101
102 #define ALIGN_POW2_ROUNDUP(num, align) \
103         (((num) + (align) - 1) & ~((align) - 1))
104
105 /*
106  * This struct is needed to avoid unnecessary allocation or checking
107  * of allocation of crypto params with current alloc on the fly
108  * implementation.
109  */
110
111 struct crypto_params {
112         uint8_t *aad;
113         uint8_t *digest;
114 };
115
116 struct perf_test_params {
117
118         unsigned total_operations;
119         unsigned burst_size;
120         unsigned buf_size;
121
122         enum chain_mode chain;
123
124         enum rte_crypto_cipher_algorithm cipher_algo;
125         unsigned cipher_key_length;
126         enum rte_crypto_auth_algorithm auth_algo;
127
128         struct symmetric_session_attrs *session_attrs;
129
130         struct symmetric_op *symmetric_op;
131 };
132
133 #define MAX_NUM_OF_OPS_PER_UT   (128)
134
135 struct crypto_unittest_params {
136         struct rte_crypto_sym_xform cipher_xform;
137         struct rte_crypto_sym_xform auth_xform;
138
139         struct rte_cryptodev_sym_session *sess;
140
141         struct rte_crypto_op *op;
142
143         struct rte_mbuf *obuf[MAX_NUM_OF_OPS_PER_UT];
144         struct rte_mbuf *ibuf[MAX_NUM_OF_OPS_PER_UT];
145
146         uint8_t *digest;
147 };
148
149 static struct rte_cryptodev_sym_session *
150 test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain,
151                 enum rte_crypto_cipher_algorithm cipher_algo,
152                 unsigned int cipher_key_len,
153                 enum rte_crypto_auth_algorithm auth_algo);
154 static struct rte_cryptodev_sym_session *
155 test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
156                 enum rte_crypto_cipher_algorithm cipher_algo,
157                 unsigned int cipher_key_len,
158                 enum rte_crypto_auth_algorithm auth_algo);
159 static struct rte_cryptodev_sym_session *
160 test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
161                 enum rte_crypto_cipher_algorithm cipher_algo,
162                 unsigned int cipher_key_len,
163                 enum rte_crypto_auth_algorithm auth_algo);
164
165 static struct rte_mbuf *
166 test_perf_create_pktmbuf(struct rte_mempool *mpool, unsigned buf_sz);
167 static inline struct rte_crypto_op *
168 test_perf_set_crypto_op_snow3g(struct rte_crypto_op *op, struct rte_mbuf *m,
169                 struct rte_cryptodev_sym_session *sess, unsigned data_len,
170                 unsigned digest_len);
171 static inline struct rte_crypto_op *
172 test_perf_set_crypto_op_aes(struct rte_crypto_op *op, struct rte_mbuf *m,
173                 struct rte_cryptodev_sym_session *sess, unsigned int data_len,
174                 unsigned int digest_len, enum chain_mode chain);
175 static inline struct rte_crypto_op *
176 test_perf_set_crypto_op_aes_gcm(struct rte_crypto_op *op, struct rte_mbuf *m,
177                 struct rte_cryptodev_sym_session *sess, unsigned int data_len,
178                 unsigned int digest_len, enum chain_mode chain __rte_unused);
179 static inline struct rte_crypto_op *
180 test_perf_set_crypto_op_3des(struct rte_crypto_op *op, struct rte_mbuf *m,
181                 struct rte_cryptodev_sym_session *sess, unsigned int data_len,
182                 unsigned int digest_len, enum chain_mode chain __rte_unused);
183 static uint32_t get_auth_digest_length(enum rte_crypto_auth_algorithm algo);
184
185
186 static const char *chain_mode_name(enum chain_mode mode)
187 {
188         switch (mode) {
189         case CIPHER_HASH: return "cipher_hash"; break;
190         case HASH_CIPHER: return "hash_cipher"; break;
191         case CIPHER_ONLY: return "cipher_only"; break;
192         case HASH_ONLY: return "hash_only"; break;
193         default: return ""; break;
194         }
195 }
196
197 static const char *pmd_name(enum rte_cryptodev_type pmd)
198 {
199         switch (pmd) {
200         case RTE_CRYPTODEV_NULL_PMD: return RTE_STR(CRYPTODEV_NAME_NULL_PMD); break;
201         case RTE_CRYPTODEV_AESNI_GCM_PMD:
202                 return RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD);
203         case RTE_CRYPTODEV_AESNI_MB_PMD:
204                 return RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD);
205         case RTE_CRYPTODEV_QAT_SYM_PMD:
206                 return RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD);
207         case RTE_CRYPTODEV_SNOW3G_PMD:
208                 return RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD);
209         case RTE_CRYPTODEV_DPAA2_SEC_PMD:
210                 return RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD);
211         default:
212                 return "";
213         }
214 }
215
216 static struct rte_mbuf *
217 setup_test_string(struct rte_mempool *mpool,
218                 const uint8_t *data, size_t len, uint8_t blocksize)
219 {
220         struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
221         size_t t_len = len - (blocksize ? (len % blocksize) : 0);
222
223         if (m) {
224                 char *dst = rte_pktmbuf_append(m, t_len);
225
226                 if (!dst) {
227                         rte_pktmbuf_free(m);
228                         return NULL;
229                 }
230
231                 rte_memcpy(dst, (const void *)data, t_len);
232         }
233         return m;
234 }
235
236 static struct crypto_testsuite_params testsuite_params = { NULL };
237 static struct crypto_unittest_params unittest_params;
238 static enum rte_cryptodev_type gbl_cryptodev_perftest_devtype;
239
240 static int
241 testsuite_setup(void)
242 {
243         struct crypto_testsuite_params *ts_params = &testsuite_params;
244         struct rte_cryptodev_info info;
245         unsigned i, nb_devs, valid_dev_id = 0;
246         int ret;
247         uint16_t qp_id;
248
249         ts_params->mbuf_mp = rte_mempool_lookup("CRYPTO_PERF_MBUFPOOL");
250         if (ts_params->mbuf_mp == NULL) {
251                 /* Not already created so create */
252                 ts_params->mbuf_mp = rte_pktmbuf_pool_create(
253                                 "CRYPTO_PERF_MBUFPOOL",
254                                 NUM_MBUFS, MBUF_CACHE_SIZE, 0, MBUF_SIZE,
255                                 rte_socket_id());
256                 if (ts_params->mbuf_mp == NULL) {
257                         RTE_LOG(ERR, USER1, "Can't create CRYPTO_PERF_MBUFPOOL\n");
258                         return TEST_FAILED;
259                 }
260         }
261
262
263         ts_params->op_mpool = rte_crypto_op_pool_create("CRYPTO_OP_POOL",
264                         RTE_CRYPTO_OP_TYPE_SYMMETRIC,
265                         NUM_MBUFS, MBUF_CACHE_SIZE,
266                         DEFAULT_NUM_XFORMS *
267                         sizeof(struct rte_crypto_sym_xform) +
268                         MAXIMUM_IV_LENGTH,
269                         rte_socket_id());
270                 if (ts_params->op_mpool == NULL) {
271                         RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n");
272                         return TEST_FAILED;
273                 }
274
275         /* Create an AESNI MB device if required */
276         if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_AESNI_MB_PMD) {
277 #ifndef RTE_LIBRTE_PMD_AESNI_MB
278                 RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_MB must be"
279                         " enabled in config file to run this testsuite.\n");
280                 return TEST_FAILED;
281 #endif
282                 nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_AESNI_MB_PMD);
283                 if (nb_devs < 1) {
284                         ret = rte_vdev_init(
285                                 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL);
286
287                         TEST_ASSERT(ret == 0,
288                                 "Failed to create instance of pmd : %s",
289                                 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
290                 }
291         }
292
293         /* Create an AESNI GCM device if required */
294         if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_AESNI_GCM_PMD) {
295 #ifndef RTE_LIBRTE_PMD_AESNI_GCM
296                 RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_GCM must be"
297                         " enabled in config file to run this testsuite.\n");
298                 return TEST_FAILED;
299 #endif
300                 nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_AESNI_GCM_PMD);
301                 if (nb_devs < 1) {
302                         ret = rte_vdev_init(
303                                 RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), NULL);
304
305                         TEST_ASSERT(ret == 0,
306                                 "Failed to create instance of pmd : %s",
307                                 RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
308                 }
309         }
310
311         /* Create a SNOW3G device if required */
312         if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_SNOW3G_PMD) {
313 #ifndef RTE_LIBRTE_PMD_SNOW3G
314                 RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_SNOW3G must be"
315                         " enabled in config file to run this testsuite.\n");
316                 return TEST_FAILED;
317 #endif
318                 nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_SNOW3G_PMD);
319                 if (nb_devs < 1) {
320                         ret = rte_vdev_init(
321                                 RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), NULL);
322
323                         TEST_ASSERT(ret == 0,
324                                 "Failed to create instance of pmd : %s",
325                                 RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
326                 }
327         }
328
329         /* Create an OPENSSL device if required */
330         if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_OPENSSL_PMD) {
331 #ifndef RTE_LIBRTE_PMD_OPENSSL
332                 RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_OPENSSL must be"
333                         " enabled in config file to run this testsuite.\n");
334                 return TEST_FAILED;
335 #endif
336                 nb_devs = rte_cryptodev_count_devtype(
337                                 RTE_CRYPTODEV_OPENSSL_PMD);
338                 if (nb_devs < 1) {
339                         ret = rte_vdev_init(
340                                 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD),
341                                 NULL);
342
343                         TEST_ASSERT(ret == 0, "Failed to create "
344                                 "instance of pmd : %s",
345                                 RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
346                 }
347         }
348
349         /* Create an ARMv8 device if required */
350         if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_ARMV8_PMD) {
351 #ifndef RTE_LIBRTE_PMD_ARMV8_CRYPTO
352                 RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO must be"
353                         " enabled in config file to run this testsuite.\n");
354                 return TEST_FAILED;
355 #endif
356                 nb_devs = rte_cryptodev_count_devtype(
357                                 RTE_CRYPTODEV_ARMV8_PMD);
358                 if (nb_devs < 1) {
359                         ret = rte_vdev_init(
360                                 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD),
361                                 NULL);
362
363                         TEST_ASSERT(ret == 0, "Failed to create "
364                                 "instance of pmd : %s",
365                                 RTE_STR(CRYPTODEV_NAME_ARMV8_PMD));
366                 }
367         }
368
369 #ifndef RTE_LIBRTE_PMD_QAT
370         if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_QAT_SYM_PMD) {
371                 RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_QAT must be enabled "
372                                 "in config file to run this testsuite.\n");
373                 return TEST_FAILED;
374         }
375 #endif
376
377         nb_devs = rte_cryptodev_count();
378         if (nb_devs < 1) {
379                 RTE_LOG(ERR, USER1, "No crypto devices found?\n");
380                 return TEST_FAILED;
381         }
382
383         /* Search for the first valid */
384         for (i = 0; i < nb_devs; i++) {
385                 rte_cryptodev_info_get(i, &info);
386                 if (info.dev_type == gbl_cryptodev_perftest_devtype) {
387                         ts_params->dev_id = i;
388                         valid_dev_id = 1;
389                         break;
390                 }
391         }
392
393         if (!valid_dev_id)
394                 return TEST_FAILED;
395
396         /*
397          * Using Crypto Device Id 0 by default.
398          * Set up all the qps on this device
399          */
400
401         rte_cryptodev_info_get(ts_params->dev_id, &info);
402
403         ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs;
404         ts_params->conf.socket_id = SOCKET_ID_ANY;
405         ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions;
406
407         TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->dev_id,
408                         &ts_params->conf),
409                         "Failed to configure cryptodev %u",
410                         ts_params->dev_id);
411
412         ts_params->qp_conf.nb_descriptors = PERF_NUM_OPS_INFLIGHT;
413         for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) {
414
415                 TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
416                         ts_params->dev_id, qp_id,
417                                 &ts_params->qp_conf,
418                                 rte_cryptodev_socket_id(ts_params->dev_id)),
419                                 "Failed to setup queue pair %u on cryptodev %u",
420                                 qp_id, ts_params->dev_id);
421         }
422
423         return TEST_SUCCESS;
424 }
425 static void
426 testsuite_teardown(void)
427 {
428         struct crypto_testsuite_params *ts_params =
429                         &testsuite_params;
430
431         if (ts_params->mbuf_mp != NULL)
432                 RTE_LOG(DEBUG, USER1, "CRYPTO_PERF_MBUFPOOL count %u\n",
433                 rte_mempool_avail_count(ts_params->mbuf_mp));
434         if (ts_params->op_mpool != NULL)
435                 RTE_LOG(DEBUG, USER1, "CRYPTO_PERF_OP POOL count %u\n",
436                 rte_mempool_avail_count(ts_params->op_mpool));
437 }
438
439 static int
440 ut_setup(void)
441 {
442         struct crypto_testsuite_params *ts_params = &testsuite_params;
443         struct crypto_unittest_params *ut_params = &unittest_params;
444
445         /* Clear unit test parameters before running test */
446         memset(ut_params, 0, sizeof(*ut_params));
447
448         rte_cryptodev_stats_reset(ts_params->dev_id);
449
450         /* Start the device */
451         TEST_ASSERT_SUCCESS(rte_cryptodev_start(ts_params->dev_id),
452                         "Failed to start cryptodev %u",
453                         ts_params->dev_id);
454
455         return TEST_SUCCESS;
456 }
457
458 static void
459 ut_teardown(void)
460 {
461         struct crypto_testsuite_params *ts_params = &testsuite_params;
462         struct crypto_unittest_params *ut_params = &unittest_params;
463         struct rte_cryptodev_stats stats;
464
465         unsigned i;
466
467         /* free crypto session structure */
468         if (ut_params->sess)
469                 rte_cryptodev_sym_session_free(ts_params->dev_id,
470                                 ut_params->sess);
471
472         /* free crypto operation structure */
473         if (ut_params->op)
474                 rte_crypto_op_free(ut_params->op);
475
476         for (i = 0; i < MAX_NUM_OF_OPS_PER_UT; i++) {
477                 if (ut_params->obuf[i])
478                         rte_pktmbuf_free(ut_params->obuf[i]);
479                 else if (ut_params->ibuf[i])
480                         rte_pktmbuf_free(ut_params->ibuf[i]);
481         }
482
483         if (ts_params->mbuf_mp != NULL)
484                 RTE_LOG(DEBUG, USER1, "CRYPTO_PERF_MBUFPOOL count %u\n",
485                         rte_mempool_avail_count(ts_params->mbuf_mp));
486
487         rte_cryptodev_stats_get(ts_params->dev_id, &stats);
488
489         /* Stop the device */
490         rte_cryptodev_stop(ts_params->dev_id);
491 }
492
493 const char plaintext_quote[] =
494                 "THE COUNT OF MONTE CRISTO by Alexandre Dumas, Pere Chapter 1. "
495                 "Marseilles--The Arrival. On the 24th of February, 1815, the "
496                 "look-out at Notre-Dame de la Garde signalled the three-master,"
497                 " the Pharaon from Smyrna, Trieste, and Naples. As usual, a "
498                 "pilot put off immediately, and rounding the Chateau d'If, got "
499                 "on board the vessel between Cape Morgion and Rion island. "
500                 "Immediately, and according to custom, the ramparts of Fort "
501                 "Saint-Jean were covered with spectators; it is always an event "
502                 "at Marseilles for a ship to come into port, especially when "
503                 "this ship, like the Pharaon, has been built, rigged, and laden"
504                 " at the old Phocee docks, and belongs to an owner of the city."
505                 " The ship drew on and had safely passed the strait, which some"
506                 " volcanic shock has made between the Calasareigne and Jaros "
507                 "islands; had doubled Pomegue, and approached the harbor under"
508                 " topsails, jib, and spanker, but so slowly and sedately that"
509                 " the idlers, with that instinct which is the forerunner of "
510                 "evil, asked one another what misfortune could have happened "
511                 "on board. However, those experienced in navigation saw plainly"
512                 " that if any accident had occurred, it was not to the vessel "
513                 "herself, for she bore down with all the evidence of being "
514                 "skilfully handled, the anchor a-cockbill, the jib-boom guys "
515                 "already eased off, and standing by the side of the pilot, who"
516                 " was steering the Pharaon towards the narrow entrance of the"
517                 " inner port, was a young man, who, with activity and vigilant"
518                 " eye, watched every motion of the ship, and repeated each "
519                 "direction of the pilot. The vague disquietude which prevailed "
520                 "among the spectators had so much affected one of the crowd "
521                 "that he did not await the arrival of the vessel in harbor, but"
522                 " jumping into a small skiff, desired to be pulled alongside "
523                 "the Pharaon, which he reached as she rounded into La Reserve "
524                 "basin. When the young man on board saw this person approach, "
525                 "he left his station by the pilot, and, hat in hand, leaned "
526                 "over the ship's bulwarks. He was a fine, tall, slim young "
527                 "fellow of eighteen or twenty, with black eyes, and hair as "
528                 "dark as a raven's wing; and his whole appearance bespoke that "
529                 "calmness and resolution peculiar to men accustomed from their "
530                 "cradle to contend with danger. \"Ah, is it you, Dantes?\" "
531                 "cried the man in the skiff. \"What's the matter? and why have "
532                 "you such an air of sadness aboard?\" \"A great misfortune, M. "
533                 "Morrel,\" replied the young man,--\"a great misfortune, for me"
534                 " especially! Off Civita Vecchia we lost our brave Captain "
535                 "Leclere.\" \"And the cargo?\" inquired the owner, eagerly. "
536                 "\"Is all safe, M. Morrel; and I think you will be satisfied on"
537                 " that head. But poor Captain Leclere--\" \"What happened to "
538                 "him?\" asked the owner, with an air of considerable "
539                 "resignation. \"What happened to the worthy captain?\" \"He "
540                 "died.\" \"Fell into the sea?\" \"No, sir, he died of "
541                 "brain-fever in dreadful agony.\" Then turning to the crew, "
542                 "he said, \"Bear a hand there, to take in sail!\" All hands "
543                 "obeyed, and at once the eight or ten seamen who composed the "
544                 "crew, sprang to their respective stations at the spanker "
545                 "brails and outhaul, topsail sheets and halyards, the jib "
546                 "downhaul, and the topsail clewlines and buntlines. The young "
547                 "sailor gave a look to see that his orders were promptly and "
548                 "accurately obeyed, and then turned again to the owner. \"And "
549                 "how did this misfortune occur?\" inquired the latter, resuming"
550                 " the interrupted conversation. \"Alas, sir, in the most "
551                 "unexpected manner. After a long talk with the harbor-master, "
552                 "Captain Leclere left Naples greatly disturbed in mind. In "
553                 "twenty-four hours he was attacked by a fever, and died three "
554                 "days afterwards. We performed the usual burial service, and he"
555                 " is at his rest, sewn up in his hammock with a thirty-six "
556                 "pound shot at his head and his heels, off El Giglio island. "
557                 "We bring to his widow his sword and cross of honor. It was "
558                 "worth while, truly,\" added the young man with a melancholy "
559                 "smile, \"to make war against the English for ten years, and "
560                 "to die in his bed at last, like everybody else.";
561
562 #define QUOTE_LEN_64B           (64)
563 #define QUOTE_LEN_128B          (128)
564 #define QUOTE_LEN_256B          (256)
565 #define QUOTE_LEN_512B          (512)
566 #define QUOTE_LEN_768B          (768)
567 #define QUOTE_LEN_1024B         (1024)
568 #define QUOTE_LEN_1280B         (1280)
569 #define QUOTE_LEN_1536B         (1536)
570 #define QUOTE_LEN_1792B         (1792)
571 #define QUOTE_LEN_2048B         (2048)
572
573
574 /* ***** AES-CBC / HMAC-SHA256 Performance Tests ***** */
575
576 #define HMAC_KEY_LENGTH_SHA256  (DIGEST_BYTE_LENGTH_SHA256)
577
578 #define CIPHER_KEY_LENGTH_AES_CBC       (16)
579 #define CIPHER_IV_LENGTH_AES_CBC        (CIPHER_KEY_LENGTH_AES_CBC)
580
581 static uint8_t aes_cbc_128_key[] = {
582                 0xE4, 0x23, 0x33, 0x8A, 0x35, 0x64, 0x61, 0xE2,
583                 0xF1, 0x35, 0x5C, 0x3B, 0xDD, 0x9A, 0x65, 0xBA };
584
585 static uint8_t aes_cbc_128_iv[] = {
586                 0xf5, 0xd3, 0x89, 0x0f, 0x47, 0x00, 0xcb, 0x52,
587                 0x42, 0x1a, 0x7d, 0x3d, 0xf5, 0x82, 0x80, 0xf1 };
588
589 static uint8_t hmac_sha256_key[] = {
590                 0xff, 0xcb, 0x37, 0x30, 0x1d, 0x4a, 0xc2, 0x41,
591                 0x49, 0x03, 0xDD, 0xC6, 0xB8, 0xCA, 0x55, 0x7A,
592                 0x58, 0x34, 0x85, 0x61, 0x1C, 0x42, 0x10, 0x76,
593                 0x9a, 0x4f, 0x88, 0x1b, 0xb6, 0x8f, 0xd8, 0x60 };
594
595
596 /* Cipher text output */
597
598 static const uint8_t AES_CBC_ciphertext_64B[] = {
599                 0x05, 0x15, 0x77, 0x32, 0xc9, 0x66, 0x91, 0x50,
600                 0x93, 0x9f, 0xbb, 0x4e, 0x2e, 0x5a, 0x02, 0xd0,
601                 0x2d, 0x9d, 0x31, 0x5d, 0xc8, 0x9e, 0x86, 0x36,
602                 0x54, 0x5c, 0x50, 0xe8, 0x75, 0x54, 0x74, 0x5e,
603                 0xd5, 0xa2, 0x84, 0x21, 0x2d, 0xc5, 0xf8, 0x1c,
604                 0x55, 0x1a, 0xba, 0x91, 0xce, 0xb5, 0xa3, 0x1e,
605                 0x31, 0xbf, 0xe9, 0xa1, 0x97, 0x5c, 0x2b, 0xd6,
606                 0x57, 0xa5, 0x9f, 0xab, 0xbd, 0xb0, 0x9b, 0x9c
607 };
608
609 static const uint8_t AES_CBC_ciphertext_128B[] = {
610                 0x79, 0x92, 0x65, 0xc8, 0xfb, 0x0a, 0xc7, 0xc4,
611                 0x9b, 0x3b, 0xbe, 0x69, 0x7f, 0x7c, 0xf4, 0x4e,
612                 0xa5, 0x0d, 0xf6, 0x33, 0xc4, 0xdf, 0xf3, 0x0d,
613                 0xdb, 0xb9, 0x68, 0x34, 0xb0, 0x0d, 0xbd, 0xb9,
614                 0xa7, 0xf3, 0x86, 0x50, 0x2a, 0xbe, 0x50, 0x5d,
615                 0xb3, 0xbe, 0x72, 0xf9, 0x02, 0xb1, 0x69, 0x0b,
616                 0x8c, 0x96, 0x4c, 0x3c, 0x0c, 0x1e, 0x76, 0xe5,
617                 0x7e, 0x75, 0xdd, 0xd0, 0xa9, 0x75, 0x00, 0x13,
618                 0x6b, 0x1e, 0xc0, 0xad, 0xfc, 0x03, 0xb5, 0x99,
619                 0xdc, 0x37, 0x35, 0xfc, 0x16, 0x34, 0xfd, 0xb4,
620                 0xea, 0x1e, 0xb6, 0x51, 0xdf, 0xab, 0x87, 0xd6,
621                 0x87, 0x41, 0xfa, 0x1c, 0xc6, 0x78, 0xa6, 0x3c,
622                 0x1d, 0x76, 0xfe, 0xff, 0x65, 0xfc, 0x63, 0x1e,
623                 0x1f, 0xe2, 0x7c, 0x9b, 0xa2, 0x72, 0xc3, 0x34,
624                 0x23, 0xdf, 0x01, 0xf0, 0xfd, 0x02, 0x8b, 0x97,
625                 0x00, 0x2b, 0x97, 0x4e, 0xab, 0x98, 0x21, 0x3c
626 };
627
628 static const uint8_t AES_CBC_ciphertext_256B[] = {
629                 0xc7, 0x71, 0x2b, 0xed, 0x2c, 0x97, 0x59, 0xfa,
630                 0xcf, 0x5a, 0xb9, 0x31, 0x92, 0xe0, 0xc9, 0x92,
631                 0xc0, 0x2d, 0xd5, 0x9c, 0x84, 0xbf, 0x70, 0x36,
632                 0x13, 0x48, 0xe0, 0xb1, 0xbf, 0x6c, 0xcd, 0x91,
633                 0xa0, 0xc3, 0x57, 0x6c, 0x3f, 0x0e, 0x34, 0x41,
634                 0xe7, 0x9c, 0xc0, 0xec, 0x18, 0x0c, 0x05, 0x52,
635                 0x78, 0xe2, 0x3c, 0x6e, 0xdf, 0xa5, 0x49, 0xc7,
636                 0xf2, 0x55, 0x00, 0x8f, 0x65, 0x6d, 0x4b, 0xd0,
637                 0xcb, 0xd4, 0xd2, 0x0b, 0xea, 0xf4, 0xb0, 0x85,
638                 0x61, 0x9e, 0x36, 0xc0, 0x71, 0xb7, 0x80, 0xad,
639                 0x40, 0x78, 0xb4, 0x70, 0x2b, 0xe8, 0x80, 0xc5,
640                 0x19, 0x35, 0x96, 0x55, 0x3b, 0x40, 0x03, 0xbb,
641                 0x9f, 0xa6, 0xc2, 0x82, 0x92, 0x04, 0xc3, 0xa6,
642                 0x96, 0xc4, 0x7f, 0x4c, 0x3e, 0x3c, 0x79, 0x82,
643                 0x88, 0x8b, 0x3f, 0x8b, 0xc5, 0x9f, 0x44, 0xbe,
644                 0x71, 0xe7, 0x09, 0xa2, 0x40, 0xa2, 0x23, 0x4e,
645                 0x9f, 0x31, 0xab, 0x6f, 0xdf, 0x59, 0x40, 0xe1,
646                 0x12, 0x15, 0x55, 0x4b, 0xea, 0x3f, 0xa1, 0x41,
647                 0x4f, 0xaf, 0xcd, 0x27, 0x2a, 0x61, 0xa1, 0x9e,
648                 0x82, 0x30, 0x05, 0x05, 0x55, 0xce, 0x99, 0xd3,
649                 0x8f, 0x3f, 0x86, 0x79, 0xdc, 0x9f, 0x33, 0x07,
650                 0x75, 0x26, 0xc8, 0x72, 0x81, 0x0f, 0x9b, 0xf7,
651                 0xb1, 0xfb, 0xd3, 0x91, 0x36, 0x08, 0xab, 0x26,
652                 0x70, 0x53, 0x0c, 0x99, 0xfd, 0xa9, 0x07, 0xb4,
653                 0xe9, 0xce, 0xc1, 0xd6, 0xd2, 0x2c, 0x71, 0x80,
654                 0xec, 0x59, 0x61, 0x0b, 0x24, 0xf0, 0x6d, 0x33,
655                 0x73, 0x45, 0x6e, 0x80, 0x03, 0x45, 0xf2, 0x76,
656                 0xa5, 0x8a, 0xc9, 0xcf, 0xaf, 0x4a, 0xed, 0x35,
657                 0xc0, 0x97, 0x52, 0xc5, 0x00, 0xdf, 0xef, 0xc7,
658                 0x9f, 0xf2, 0xe8, 0x15, 0x3e, 0xb3, 0x30, 0xe7,
659                 0x00, 0xd0, 0x4e, 0xeb, 0x79, 0xf6, 0xf6, 0xcf,
660                 0xf0, 0xe7, 0x61, 0xd5, 0x3d, 0x6a, 0x73, 0x9d
661 };
662
663 static const uint8_t AES_CBC_ciphertext_512B[] = {
664                 0xb4, 0xc6, 0xc6, 0x5f, 0x7e, 0xca, 0x05, 0x70,
665                 0x21, 0x7b, 0x92, 0x9e, 0x23, 0xe7, 0x92, 0xb8,
666                 0x27, 0x3d, 0x20, 0x29, 0x57, 0xfa, 0x1f, 0x26,
667                 0x0a, 0x04, 0x34, 0xa6, 0xf2, 0xdc, 0x44, 0xb6,
668                 0x43, 0x40, 0x62, 0xde, 0x0c, 0xde, 0x1c, 0x30,
669                 0x43, 0x85, 0x0b, 0xe8, 0x93, 0x1f, 0xa1, 0x2a,
670                 0x8a, 0x27, 0x35, 0x39, 0x14, 0x9f, 0x37, 0x64,
671                 0x59, 0xb5, 0x0e, 0x96, 0x82, 0x5d, 0x63, 0x45,
672                 0xd6, 0x93, 0x89, 0x46, 0xe4, 0x71, 0x31, 0xeb,
673                 0x0e, 0xd1, 0x7b, 0xda, 0x90, 0xb5, 0x81, 0xac,
674                 0x76, 0x54, 0x54, 0x85, 0x0b, 0xa9, 0x46, 0x9c,
675                 0xf0, 0xfd, 0xde, 0x5d, 0xa8, 0xe3, 0xee, 0xe9,
676                 0xf4, 0x9d, 0x34, 0x76, 0x39, 0xe7, 0xc3, 0x4a,
677                 0x84, 0x38, 0x92, 0x61, 0xf1, 0x12, 0x9f, 0x05,
678                 0xda, 0xdb, 0xc1, 0xd4, 0xb0, 0xa0, 0x27, 0x19,
679                 0xa0, 0x56, 0x5d, 0x9b, 0xcc, 0x47, 0x7c, 0x15,
680                 0x1d, 0x52, 0x66, 0xd5, 0xff, 0xef, 0x12, 0x23,
681                 0x86, 0xe2, 0xee, 0x81, 0x2c, 0x3d, 0x7d, 0x28,
682                 0xd5, 0x42, 0xdf, 0xdb, 0x75, 0x1c, 0xeb, 0xdf,
683                 0x13, 0x23, 0xd5, 0x17, 0x89, 0xea, 0xd7, 0x01,
684                 0xff, 0x57, 0x6a, 0x44, 0x61, 0xf4, 0xea, 0xbe,
685                 0x97, 0x9b, 0xc2, 0xb1, 0x9c, 0x5d, 0xff, 0x4f,
686                 0x73, 0x2d, 0x3f, 0x57, 0x28, 0x38, 0xbf, 0x3d,
687                 0x9f, 0xda, 0x49, 0x55, 0x8f, 0xb2, 0x77, 0xec,
688                 0x0f, 0xbc, 0xce, 0xb8, 0xc6, 0xe1, 0x03, 0xed,
689                 0x35, 0x9c, 0xf2, 0x4d, 0xa4, 0x29, 0x6c, 0xd6,
690                 0x6e, 0x05, 0x53, 0x46, 0xc1, 0x41, 0x09, 0x36,
691                 0x0b, 0x7d, 0xf4, 0x9e, 0x0f, 0xba, 0x86, 0x33,
692                 0xdd, 0xf1, 0xa7, 0xf7, 0xd5, 0x29, 0xa8, 0xa7,
693                 0x4d, 0xce, 0x0c, 0xf5, 0xb4, 0x6c, 0xd8, 0x27,
694                 0xb0, 0x87, 0x2a, 0x6f, 0x7f, 0x3f, 0x8f, 0xc3,
695                 0xe2, 0x3e, 0x94, 0xcf, 0x61, 0x4a, 0x09, 0x3d,
696                 0xf9, 0x55, 0x19, 0x31, 0xf2, 0xd2, 0x4a, 0x3e,
697                 0xc1, 0xf5, 0xed, 0x7c, 0x45, 0xb0, 0x0c, 0x7b,
698                 0xdd, 0xa6, 0x0a, 0x26, 0x66, 0xec, 0x85, 0x49,
699                 0x00, 0x38, 0x05, 0x7c, 0x9c, 0x1c, 0x92, 0xf5,
700                 0xf7, 0xdb, 0x5d, 0xbd, 0x61, 0x0c, 0xc9, 0xaf,
701                 0xfd, 0x57, 0x3f, 0xee, 0x2b, 0xad, 0x73, 0xef,
702                 0xa3, 0xc1, 0x66, 0x26, 0x44, 0x5e, 0xf9, 0x12,
703                 0x86, 0x66, 0xa9, 0x61, 0x75, 0xa1, 0xbc, 0x40,
704                 0x7f, 0xa8, 0x08, 0x02, 0xc0, 0x76, 0x0e, 0x76,
705                 0xb3, 0x26, 0x3d, 0x1c, 0x40, 0x65, 0xe4, 0x18,
706                 0x0f, 0x62, 0x17, 0x8f, 0x1e, 0x61, 0xb8, 0x08,
707                 0x83, 0x54, 0x42, 0x11, 0x03, 0x30, 0x8e, 0xb7,
708                 0xc1, 0x9c, 0xec, 0x69, 0x52, 0x95, 0xfb, 0x7b,
709                 0x1a, 0x0c, 0x20, 0x24, 0xf7, 0xb8, 0x38, 0x0c,
710                 0xb8, 0x7b, 0xb6, 0x69, 0x70, 0xd0, 0x61, 0xb9,
711                 0x70, 0x06, 0xc2, 0x5b, 0x20, 0x47, 0xf7, 0xd9,
712                 0x32, 0xc2, 0xf2, 0x90, 0xb6, 0x4d, 0xcd, 0x3c,
713                 0x6d, 0x74, 0xea, 0x82, 0x35, 0x1b, 0x08, 0x44,
714                 0xba, 0xb7, 0x33, 0x82, 0x33, 0x27, 0x54, 0x77,
715                 0x6e, 0x58, 0xfe, 0x46, 0x5a, 0xb4, 0x88, 0x53,
716                 0x8d, 0x9b, 0xb1, 0xab, 0xdf, 0x04, 0xe1, 0xfb,
717                 0xd7, 0x1e, 0xd7, 0x38, 0x64, 0x54, 0xba, 0xb0,
718                 0x6c, 0x84, 0x7a, 0x0f, 0xa7, 0x80, 0x6b, 0x86,
719                 0xd9, 0xc9, 0xc6, 0x31, 0x95, 0xfa, 0x8a, 0x2c,
720                 0x14, 0xe1, 0x85, 0x66, 0x27, 0xfd, 0x63, 0x3e,
721                 0xf0, 0xfa, 0x81, 0xc9, 0x89, 0x4f, 0xe2, 0x6a,
722                 0x8c, 0x17, 0xb5, 0xc7, 0x9f, 0x5d, 0x3f, 0x6b,
723                 0x3f, 0xcd, 0x13, 0x7a, 0x3c, 0xe6, 0x4e, 0xfa,
724                 0x7a, 0x10, 0xb8, 0x7c, 0x40, 0xec, 0x93, 0x11,
725                 0x1f, 0xd0, 0x9e, 0xc3, 0x56, 0xb9, 0xf5, 0x21,
726                 0x18, 0x41, 0x31, 0xea, 0x01, 0x8d, 0xea, 0x1c,
727                 0x95, 0x5e, 0x56, 0x33, 0xbc, 0x7a, 0x3f, 0x6f
728 };
729
730 static const uint8_t AES_CBC_ciphertext_768B[] = {
731                 0x3e, 0x7f, 0x9e, 0x4c, 0x88, 0x15, 0x68, 0x69,
732                 0x10, 0x09, 0xe1, 0xa7, 0x0f, 0x27, 0x88, 0x2d,
733                 0x90, 0x73, 0x4f, 0x67, 0xd3, 0x8b, 0xaf, 0xa1,
734                 0x2c, 0x37, 0xa5, 0x6c, 0x7c, 0xbd, 0x95, 0x4c,
735                 0x82, 0xcf, 0x05, 0x49, 0x16, 0x5c, 0xe7, 0x06,
736                 0xd4, 0xcb, 0x55, 0x65, 0x9a, 0xd0, 0xe1, 0x46,
737                 0x3a, 0x37, 0x71, 0xad, 0xb0, 0xb4, 0x99, 0x1e,
738                 0x23, 0x57, 0x48, 0x96, 0x9c, 0xc5, 0xc4, 0xdb,
739                 0x64, 0x3e, 0xc9, 0x7f, 0x90, 0x5a, 0xa0, 0x08,
740                 0x75, 0x4c, 0x09, 0x06, 0x31, 0x6e, 0x59, 0x29,
741                 0xfc, 0x2f, 0x72, 0xde, 0xf2, 0x40, 0x5a, 0xfe,
742                 0xd3, 0x66, 0x64, 0xb8, 0x9c, 0xc9, 0xa6, 0x1f,
743                 0xc3, 0x52, 0xcd, 0xb5, 0xd1, 0x4f, 0x43, 0x3f,
744                 0xf4, 0x59, 0x25, 0xc4, 0xdd, 0x3e, 0x58, 0x7c,
745                 0x21, 0xd6, 0x21, 0xce, 0xa4, 0xbe, 0x08, 0x23,
746                 0x46, 0x68, 0xc0, 0x00, 0x91, 0x47, 0xca, 0x9b,
747                 0xe0, 0xb4, 0xe3, 0xab, 0xbf, 0xcf, 0x68, 0x26,
748                 0x97, 0x23, 0x09, 0x93, 0x64, 0x8f, 0x57, 0x59,
749                 0xe2, 0x41, 0x7c, 0xa2, 0x48, 0x7e, 0xd5, 0x2c,
750                 0x54, 0x09, 0x1b, 0x07, 0x94, 0xca, 0x39, 0x83,
751                 0xdd, 0xf4, 0x7a, 0x1d, 0x2d, 0xdd, 0x67, 0xf7,
752                 0x3c, 0x30, 0x89, 0x3e, 0xc1, 0xdc, 0x1d, 0x8f,
753                 0xfc, 0xb1, 0xe9, 0x13, 0x31, 0xb0, 0x16, 0xdb,
754                 0x88, 0xf2, 0x32, 0x7e, 0x73, 0xa3, 0xdf, 0x08,
755                 0x6b, 0x53, 0x92, 0x08, 0xc9, 0x9d, 0x98, 0xb2,
756                 0xf4, 0x8c, 0xb1, 0x95, 0xdc, 0xb6, 0xfc, 0xec,
757                 0xf1, 0xc9, 0x0d, 0x6d, 0x42, 0x2c, 0xf5, 0x38,
758                 0x29, 0xf4, 0xd8, 0x98, 0x0f, 0xb0, 0x81, 0xa5,
759                 0xaa, 0xe6, 0x1f, 0x6e, 0x87, 0x32, 0x1b, 0x02,
760                 0x07, 0x57, 0x38, 0x83, 0xf3, 0xe4, 0x54, 0x7c,
761                 0xa8, 0x43, 0xdf, 0x3f, 0x42, 0xfd, 0x67, 0x28,
762                 0x06, 0x4d, 0xea, 0xce, 0x1f, 0x84, 0x4a, 0xcd,
763                 0x8c, 0x61, 0x5e, 0x8f, 0x61, 0xed, 0x84, 0x03,
764                 0x53, 0x6a, 0x9e, 0xbf, 0x68, 0x83, 0xa7, 0x42,
765                 0x56, 0x57, 0xcd, 0x45, 0x29, 0xfc, 0x7b, 0x07,
766                 0xfc, 0xe9, 0xb9, 0x42, 0xfd, 0x29, 0xd5, 0xfd,
767                 0x98, 0x11, 0xd1, 0x8d, 0x67, 0x29, 0x47, 0x61,
768                 0xd8, 0x27, 0x37, 0x79, 0x29, 0xd1, 0x94, 0x6f,
769                 0x8d, 0xf3, 0x1b, 0x3d, 0x6a, 0xb1, 0x59, 0xef,
770                 0x1b, 0xd4, 0x70, 0x0e, 0xac, 0xab, 0xa0, 0x2b,
771                 0x1f, 0x5e, 0x04, 0xf0, 0x0e, 0x35, 0x72, 0x90,
772                 0xfc, 0xcf, 0x86, 0x43, 0xea, 0x45, 0x6d, 0x22,
773                 0x63, 0x06, 0x1a, 0x58, 0xd7, 0x2d, 0xc5, 0xb0,
774                 0x60, 0x69, 0xe8, 0x53, 0xc2, 0xa2, 0x57, 0x83,
775                 0xc4, 0x31, 0xb4, 0xc6, 0xb3, 0xa1, 0x77, 0xb3,
776                 0x1c, 0xca, 0x89, 0x3f, 0xf5, 0x10, 0x3b, 0x36,
777                 0x31, 0x7d, 0x00, 0x46, 0x00, 0x92, 0xa0, 0xa0,
778                 0x34, 0xd8, 0x5e, 0x62, 0xa9, 0xe0, 0x23, 0x37,
779                 0x50, 0x85, 0xc7, 0x3a, 0x20, 0xa3, 0x98, 0xc0,
780                 0xac, 0x20, 0x06, 0x0f, 0x17, 0x3c, 0xfc, 0x43,
781                 0x8c, 0x9d, 0xec, 0xf5, 0x9a, 0x35, 0x96, 0xf7,
782                 0xb7, 0x4c, 0xf9, 0x69, 0xf8, 0xd4, 0x1e, 0x9e,
783                 0xf9, 0x7c, 0xc4, 0xd2, 0x11, 0x14, 0x41, 0xb9,
784                 0x89, 0xd6, 0x07, 0xd2, 0x37, 0x07, 0x5e, 0x5e,
785                 0xae, 0x60, 0xdc, 0xe4, 0xeb, 0x38, 0x48, 0x6d,
786                 0x95, 0x8d, 0x71, 0xf2, 0xba, 0xda, 0x5f, 0x08,
787                 0x9d, 0x4a, 0x0f, 0x56, 0x90, 0x64, 0xab, 0xb6,
788                 0x88, 0x22, 0xa8, 0x90, 0x1f, 0x76, 0x2c, 0x83,
789                 0x43, 0xce, 0x32, 0x55, 0x45, 0x84, 0x57, 0x43,
790                 0xf9, 0xa8, 0xd1, 0x4f, 0xe3, 0xc1, 0x72, 0x9c,
791                 0xeb, 0x64, 0xf7, 0xe4, 0x61, 0x2b, 0x93, 0xd1,
792                 0x1f, 0xbb, 0x5c, 0xff, 0xa1, 0x59, 0x69, 0xcf,
793                 0xf7, 0xaf, 0x58, 0x45, 0xd5, 0x3e, 0x98, 0x7d,
794                 0x26, 0x39, 0x5c, 0x75, 0x3c, 0x4a, 0xbf, 0x5e,
795                 0x12, 0x10, 0xb0, 0x93, 0x0f, 0x86, 0x82, 0xcf,
796                 0xb2, 0xec, 0x70, 0x5c, 0x0b, 0xad, 0x5d, 0x63,
797                 0x65, 0x32, 0xa6, 0x04, 0x58, 0x03, 0x91, 0x2b,
798                 0xdb, 0x8f, 0xd3, 0xa3, 0x2b, 0x3a, 0xf5, 0xa1,
799                 0x62, 0x6c, 0xb6, 0xf0, 0x13, 0x3b, 0x8c, 0x07,
800                 0x10, 0x82, 0xc9, 0x56, 0x24, 0x87, 0xfc, 0x56,
801                 0xe8, 0xef, 0x90, 0x8b, 0xd6, 0x48, 0xda, 0x53,
802                 0x04, 0x49, 0x41, 0xa4, 0x67, 0xe0, 0x33, 0x24,
803                 0x6b, 0x9c, 0x07, 0x55, 0x4c, 0x5d, 0xe9, 0x35,
804                 0xfa, 0xbd, 0xea, 0xa8, 0x3f, 0xe9, 0xf5, 0x20,
805                 0x5c, 0x60, 0x0f, 0x0d, 0x24, 0xcb, 0x1a, 0xd6,
806                 0xe8, 0x5c, 0xa8, 0x42, 0xae, 0xd0, 0xd2, 0xf2,
807                 0xa8, 0xbe, 0xea, 0x0f, 0x8d, 0xfb, 0x81, 0xa3,
808                 0xa4, 0xef, 0xb7, 0x3e, 0x91, 0xbd, 0x26, 0x0f,
809                 0x8e, 0xf1, 0xb2, 0xa5, 0x47, 0x06, 0xfa, 0x40,
810                 0x8b, 0x31, 0x7a, 0x5a, 0x74, 0x2a, 0x0a, 0x7c,
811                 0x62, 0x5d, 0x39, 0xa4, 0xae, 0x14, 0x85, 0x08,
812                 0x5b, 0x20, 0x85, 0xf1, 0x57, 0x6e, 0x71, 0x13,
813                 0x4e, 0x2b, 0x49, 0x87, 0x01, 0xdf, 0x37, 0xed,
814                 0x28, 0xee, 0x4d, 0xa1, 0xf4, 0xb3, 0x3b, 0xba,
815                 0x2d, 0xb3, 0x46, 0x17, 0x84, 0x80, 0x9d, 0xd7,
816                 0x93, 0x1f, 0x28, 0x7c, 0xf5, 0xf9, 0xd6, 0x85,
817                 0x8c, 0xa5, 0x44, 0xe9, 0x2c, 0x65, 0x51, 0x5f,
818                 0x53, 0x7a, 0x09, 0xd9, 0x30, 0x16, 0x95, 0x89,
819                 0x9c, 0x0b, 0xef, 0x90, 0x6d, 0x23, 0xd3, 0x48,
820                 0x57, 0x3b, 0x55, 0x69, 0x96, 0xfc, 0xf7, 0x52,
821                 0x92, 0x38, 0x36, 0xbf, 0xa9, 0x0a, 0xbb, 0x68,
822                 0x45, 0x08, 0x25, 0xee, 0x59, 0xfe, 0xee, 0xf2,
823                 0x2c, 0xd4, 0x5f, 0x78, 0x59, 0x0d, 0x90, 0xf1,
824                 0xd7, 0xe4, 0x39, 0x0e, 0x46, 0x36, 0xf5, 0x75,
825                 0x03, 0x3c, 0x28, 0xfb, 0xfa, 0x8f, 0xef, 0xc9,
826                 0x61, 0x00, 0x94, 0xc3, 0xd2, 0x0f, 0xd9, 0xda
827 };
828
829 static const uint8_t AES_CBC_ciphertext_1024B[] = {
830                 0x7d, 0x01, 0x7e, 0x2f, 0x92, 0xb3, 0xea, 0x72,
831                 0x4a, 0x3f, 0x10, 0xf9, 0x2b, 0xb0, 0xd5, 0xb9,
832                 0x19, 0x68, 0x94, 0xe9, 0x93, 0xe9, 0xd5, 0x26,
833                 0x20, 0x44, 0xe2, 0x47, 0x15, 0x8d, 0x75, 0x48,
834                 0x8e, 0xe4, 0x40, 0x81, 0xb5, 0x06, 0xa8, 0xb8,
835                 0x0e, 0x0f, 0x3b, 0xbc, 0x5b, 0xbe, 0x3b, 0xa2,
836                 0x2a, 0x0c, 0x48, 0x98, 0x19, 0xdf, 0xe9, 0x25,
837                 0x75, 0xab, 0x93, 0x44, 0xb1, 0x72, 0x70, 0xbb,
838                 0x20, 0xcf, 0x78, 0xe9, 0x4d, 0xc6, 0xa9, 0xa9,
839                 0x84, 0x78, 0xc5, 0xc0, 0xc4, 0xc9, 0x79, 0x1a,
840                 0xbc, 0x61, 0x25, 0x5f, 0xac, 0x01, 0x03, 0xb7,
841                 0xef, 0x07, 0xf2, 0x62, 0x98, 0xee, 0xe3, 0xad,
842                 0x94, 0x75, 0x30, 0x67, 0xb9, 0x15, 0x00, 0xe7,
843                 0x11, 0x32, 0x2e, 0x6b, 0x55, 0x9f, 0xac, 0x68,
844                 0xde, 0x61, 0x05, 0x80, 0x01, 0xf3, 0xad, 0xab,
845                 0xaf, 0x45, 0xe0, 0xf4, 0x68, 0x5c, 0xc0, 0x52,
846                 0x92, 0xc8, 0x21, 0xb6, 0xf5, 0x8a, 0x1d, 0xbb,
847                 0xfc, 0x4a, 0x11, 0x62, 0xa2, 0xc4, 0xf1, 0x2d,
848                 0x0e, 0xb2, 0xc7, 0x17, 0x34, 0xb4, 0x2a, 0x54,
849                 0x81, 0xc2, 0x1e, 0xcf, 0x51, 0x0a, 0x76, 0x54,
850                 0xf1, 0x48, 0x0d, 0x5c, 0xcd, 0x38, 0x3e, 0x38,
851                 0x3e, 0xf8, 0x46, 0x1d, 0x00, 0xf5, 0x62, 0xe1,
852                 0x5c, 0xb7, 0x8d, 0xce, 0xd0, 0x3f, 0xbb, 0x22,
853                 0xf1, 0xe5, 0xb1, 0xa0, 0x58, 0x5e, 0x3c, 0x0f,
854                 0x15, 0xd1, 0xac, 0x3e, 0xc7, 0x72, 0xc4, 0xde,
855                 0x8b, 0x95, 0x3e, 0x91, 0xf7, 0x1d, 0x04, 0x9a,
856                 0xc8, 0xe4, 0xbf, 0xd3, 0x22, 0xca, 0x4a, 0xdc,
857                 0xb6, 0x16, 0x79, 0x81, 0x75, 0x2f, 0x6b, 0xa7,
858                 0x04, 0x98, 0xa7, 0x4e, 0xc1, 0x19, 0x90, 0x33,
859                 0x33, 0x3c, 0x7f, 0xdd, 0xac, 0x09, 0x0c, 0xc3,
860                 0x91, 0x34, 0x74, 0xab, 0xa5, 0x35, 0x0a, 0x13,
861                 0xc3, 0x56, 0x67, 0x6d, 0x1a, 0x3e, 0xbf, 0x56,
862                 0x06, 0x67, 0x15, 0x5f, 0xfc, 0x8b, 0xa2, 0x3c,
863                 0x5e, 0xaf, 0x56, 0x1f, 0xe3, 0x2e, 0x9d, 0x0a,
864                 0xf9, 0x9b, 0xc7, 0xb5, 0x03, 0x1c, 0x68, 0x99,
865                 0xfa, 0x3c, 0x37, 0x59, 0xc1, 0xf7, 0x6a, 0x83,
866                 0x22, 0xee, 0xca, 0x7f, 0x7d, 0x49, 0xe6, 0x48,
867                 0x84, 0x54, 0x7a, 0xff, 0xb3, 0x72, 0x21, 0xd8,
868                 0x7a, 0x5d, 0xb1, 0x4b, 0xcc, 0x01, 0x6f, 0x90,
869                 0xc6, 0x68, 0x1c, 0x2c, 0xa1, 0xe2, 0x74, 0x40,
870                 0x26, 0x9b, 0x57, 0x53, 0xa3, 0x7c, 0x0b, 0x0d,
871                 0xcf, 0x05, 0x5d, 0x62, 0x4f, 0x75, 0x06, 0x62,
872                 0x1f, 0x26, 0x32, 0xaa, 0x25, 0xcc, 0x26, 0x8d,
873                 0xae, 0x01, 0x47, 0xa3, 0x00, 0x42, 0xe2, 0x4c,
874                 0xee, 0x29, 0xa2, 0x81, 0xa0, 0xfd, 0xeb, 0xff,
875                 0x9a, 0x66, 0x6e, 0x47, 0x5b, 0xab, 0x93, 0x5a,
876                 0x02, 0x6d, 0x6f, 0xf2, 0x6e, 0x02, 0x9d, 0xb1,
877                 0xab, 0x56, 0xdc, 0x8b, 0x9b, 0x17, 0xa8, 0xfb,
878                 0x87, 0x42, 0x7c, 0x91, 0x1e, 0x14, 0xc6, 0x6f,
879                 0xdc, 0xf0, 0x27, 0x30, 0xfa, 0x3f, 0xc4, 0xad,
880                 0x57, 0x85, 0xd2, 0xc9, 0x32, 0x2c, 0x13, 0xa6,
881                 0x04, 0x04, 0x50, 0x05, 0x2f, 0x72, 0xd9, 0x44,
882                 0x55, 0x6e, 0x93, 0x40, 0xed, 0x7e, 0xd4, 0x40,
883                 0x3e, 0x88, 0x3b, 0x8b, 0xb6, 0xeb, 0xc6, 0x5d,
884                 0x9c, 0x99, 0xa1, 0xcf, 0x30, 0xb2, 0xdc, 0x48,
885                 0x8a, 0x01, 0xa7, 0x61, 0x77, 0x50, 0x14, 0xf3,
886                 0x0c, 0x49, 0x53, 0xb3, 0xb4, 0xb4, 0x28, 0x41,
887                 0x4a, 0x2d, 0xd2, 0x4d, 0x2a, 0x30, 0x31, 0x83,
888                 0x03, 0x5e, 0xaa, 0xd3, 0xa3, 0xd1, 0xa1, 0xca,
889                 0x62, 0xf0, 0xe1, 0xf2, 0xff, 0xf0, 0x19, 0xa6,
890                 0xde, 0x22, 0x47, 0xb5, 0x28, 0x7d, 0xf7, 0x07,
891                 0x16, 0x0d, 0xb1, 0x55, 0x81, 0x95, 0xe5, 0x1d,
892                 0x4d, 0x78, 0xa9, 0x3e, 0xce, 0xe3, 0x1c, 0xf9,
893                 0x47, 0xc8, 0xec, 0xc5, 0xc5, 0x93, 0x4c, 0x34,
894                 0x20, 0x6b, 0xee, 0x9a, 0xe6, 0x86, 0x57, 0x58,
895                 0xd5, 0x58, 0xf1, 0x33, 0x10, 0x29, 0x9e, 0x93,
896                 0x2f, 0xf5, 0x90, 0x00, 0x17, 0x67, 0x4f, 0x39,
897                 0x18, 0xe1, 0xcf, 0x55, 0x78, 0xbb, 0xe6, 0x29,
898                 0x3e, 0x77, 0xd5, 0x48, 0xb7, 0x42, 0x72, 0x53,
899                 0x27, 0xfa, 0x5b, 0xe0, 0x36, 0x14, 0x97, 0xb8,
900                 0x9b, 0x3c, 0x09, 0x77, 0xc1, 0x0a, 0xe4, 0xa2,
901                 0x63, 0xfc, 0xbe, 0x5c, 0x17, 0xcf, 0x01, 0xf5,
902                 0x03, 0x0f, 0x17, 0xbc, 0x93, 0xdd, 0x5f, 0xe2,
903                 0xf3, 0x08, 0xa8, 0xb1, 0x85, 0xb6, 0x34, 0x3f,
904                 0x87, 0x42, 0xa5, 0x42, 0x3b, 0x0e, 0xd6, 0x83,
905                 0x6a, 0xfd, 0x5d, 0xc9, 0x67, 0xd5, 0x51, 0xc9,
906                 0x2a, 0x4e, 0x91, 0xb0, 0x59, 0xb2, 0x0f, 0xa2,
907                 0xe6, 0x47, 0x73, 0xc2, 0xa2, 0xae, 0xbb, 0xc8,
908                 0x42, 0xa3, 0x2a, 0x27, 0x29, 0x48, 0x8c, 0x54,
909                 0x6c, 0xec, 0x00, 0x2a, 0x42, 0xa3, 0x7a, 0x0f,
910                 0x12, 0x66, 0x6b, 0x96, 0xf6, 0xd0, 0x56, 0x4f,
911                 0x49, 0x5c, 0x47, 0xec, 0x05, 0x62, 0x54, 0xb2,
912                 0x64, 0x5a, 0x69, 0x1f, 0x19, 0xb4, 0x84, 0x5c,
913                 0xbe, 0x48, 0x8e, 0xfc, 0x58, 0x21, 0xce, 0xfa,
914                 0xaa, 0x84, 0xd2, 0xc1, 0x08, 0xb3, 0x87, 0x0f,
915                 0x4f, 0xa3, 0x3a, 0xb6, 0x44, 0xbe, 0x2e, 0x9a,
916                 0xdd, 0xb5, 0x44, 0x80, 0xca, 0xf4, 0xc3, 0x6e,
917                 0xba, 0x93, 0x77, 0xe0, 0x53, 0xfb, 0x37, 0xfb,
918                 0x88, 0xc3, 0x1f, 0x25, 0xde, 0x3e, 0x11, 0xf4,
919                 0x89, 0xe7, 0xd1, 0x3b, 0xb4, 0x23, 0xcb, 0x70,
920                 0xba, 0x35, 0x97, 0x7c, 0xbe, 0x84, 0x13, 0xcf,
921                 0xe0, 0x4d, 0x33, 0x91, 0x71, 0x85, 0xbb, 0x4b,
922                 0x97, 0x32, 0x5d, 0xa0, 0xb9, 0x8f, 0xdc, 0x27,
923                 0x5a, 0xeb, 0x71, 0xf1, 0xd5, 0x0d, 0x65, 0xb4,
924                 0x22, 0x81, 0xde, 0xa7, 0x58, 0x20, 0x0b, 0x18,
925                 0x11, 0x76, 0x5c, 0xe6, 0x6a, 0x2c, 0x99, 0x69,
926                 0xdc, 0xed, 0x67, 0x08, 0x5d, 0x5e, 0xe9, 0x1e,
927                 0x55, 0x70, 0xc1, 0x5a, 0x76, 0x1b, 0x8d, 0x2e,
928                 0x0d, 0xf9, 0xcc, 0x30, 0x8c, 0x44, 0x0f, 0x63,
929                 0x8c, 0x42, 0x8a, 0x9f, 0x4c, 0xd1, 0x48, 0x28,
930                 0x8a, 0xf5, 0x56, 0x2e, 0x23, 0x12, 0xfe, 0x67,
931                 0x9a, 0x13, 0x65, 0x75, 0x83, 0xf1, 0x3c, 0x98,
932                 0x07, 0x6b, 0xb7, 0x27, 0x5b, 0xf0, 0x70, 0xda,
933                 0x30, 0xf8, 0x74, 0x4e, 0x7a, 0x32, 0x84, 0xcc,
934                 0x0e, 0xcd, 0x80, 0x8b, 0x82, 0x31, 0x9a, 0x48,
935                 0xcf, 0x75, 0x00, 0x1f, 0x4f, 0xe0, 0x8e, 0xa3,
936                 0x6a, 0x2c, 0xd4, 0x73, 0x4c, 0x63, 0x7c, 0xa6,
937                 0x4d, 0x5e, 0xfd, 0x43, 0x3b, 0x27, 0xe1, 0x5e,
938                 0xa3, 0xa9, 0x5c, 0x3b, 0x60, 0xdd, 0xc6, 0x8d,
939                 0x5a, 0xf1, 0x3e, 0x89, 0x4b, 0x24, 0xcf, 0x01,
940                 0x3a, 0x2d, 0x44, 0xe7, 0xda, 0xe7, 0xa1, 0xac,
941                 0x11, 0x05, 0x0c, 0xa9, 0x7a, 0x82, 0x8c, 0x5c,
942                 0x29, 0x68, 0x9c, 0x73, 0x13, 0xcc, 0x67, 0x32,
943                 0x11, 0x5e, 0xe5, 0xcc, 0x8c, 0xf5, 0xa7, 0x52,
944                 0x83, 0x9a, 0x70, 0xef, 0xde, 0x55, 0x9c, 0xc7,
945                 0x8a, 0xed, 0xad, 0x28, 0x4a, 0xc5, 0x92, 0x6d,
946                 0x8e, 0x47, 0xca, 0xe3, 0xf8, 0x77, 0xb5, 0x26,
947                 0x64, 0x84, 0xc2, 0xf1, 0xd7, 0xae, 0x0c, 0xb9,
948                 0x39, 0x0f, 0x43, 0x6b, 0xe9, 0xe0, 0x09, 0x4b,
949                 0xe5, 0xe3, 0x17, 0xa6, 0x68, 0x69, 0x46, 0xf4,
950                 0xf0, 0x68, 0x7f, 0x2f, 0x1c, 0x7e, 0x4c, 0xd2,
951                 0xb5, 0xc6, 0x16, 0x85, 0xcf, 0x02, 0x4c, 0x89,
952                 0x0b, 0x25, 0xb0, 0xeb, 0xf3, 0x77, 0x08, 0x6a,
953                 0x46, 0x5c, 0xf6, 0x2f, 0xf1, 0x24, 0xc3, 0x4d,
954                 0x80, 0x60, 0x4d, 0x69, 0x98, 0xde, 0xc7, 0xa1,
955                 0xf6, 0x4e, 0x18, 0x0c, 0x2a, 0xb0, 0xb2, 0xe0,
956                 0x46, 0xe7, 0x49, 0x37, 0xc8, 0x5a, 0x23, 0x24,
957                 0xe3, 0x0f, 0xcc, 0x92, 0xb4, 0x8d, 0xdc, 0x9e
958 };
959
960 static const uint8_t AES_CBC_ciphertext_1280B[] = {
961                 0x91, 0x99, 0x5e, 0x9e, 0x84, 0xff, 0x59, 0x45,
962                 0xc1, 0xf4, 0xbc, 0x9c, 0xb9, 0x30, 0x6c, 0x51,
963                 0x73, 0x52, 0xb4, 0x44, 0x09, 0x79, 0xe2, 0x89,
964                 0x75, 0xeb, 0x54, 0x26, 0xce, 0xd8, 0x24, 0x98,
965                 0xaa, 0xf8, 0x13, 0x16, 0x68, 0x58, 0xc4, 0x82,
966                 0x0e, 0x31, 0xd3, 0x6a, 0x13, 0x58, 0x31, 0xe9,
967                 0x3a, 0xc1, 0x8b, 0xc5, 0x3f, 0x50, 0x42, 0xd1,
968                 0x93, 0xe4, 0x9b, 0x65, 0x2b, 0xf4, 0x1d, 0x9e,
969                 0x2d, 0xdb, 0x48, 0xef, 0x9a, 0x01, 0x68, 0xb6,
970                 0xea, 0x7a, 0x2b, 0xad, 0xfe, 0x77, 0x44, 0x7e,
971                 0x5a, 0xc5, 0x64, 0xb4, 0xfe, 0x5c, 0x80, 0xf3,
972                 0x20, 0x7e, 0xaf, 0x5b, 0xf8, 0xd1, 0x38, 0xa0,
973                 0x8d, 0x09, 0x77, 0x06, 0xfe, 0xf5, 0xf4, 0xe4,
974                 0xee, 0xb8, 0x95, 0x27, 0xed, 0x07, 0xb8, 0xaa,
975                 0x25, 0xb4, 0xe1, 0x4c, 0xeb, 0x3f, 0xdb, 0x39,
976                 0x66, 0x28, 0x1b, 0x60, 0x42, 0x8b, 0x99, 0xd9,
977                 0x49, 0xd6, 0x8c, 0xa4, 0x9d, 0xd8, 0x93, 0x58,
978                 0x8f, 0xfa, 0xd3, 0xf7, 0x37, 0x9c, 0x88, 0xab,
979                 0x16, 0x50, 0xfe, 0x01, 0x1f, 0x88, 0x48, 0xbe,
980                 0x21, 0xa9, 0x90, 0x9e, 0x73, 0xe9, 0x82, 0xf7,
981                 0xbf, 0x4b, 0x43, 0xf4, 0xbf, 0x22, 0x3c, 0x45,
982                 0x47, 0x95, 0x5b, 0x49, 0x71, 0x07, 0x1c, 0x8b,
983                 0x49, 0xa4, 0xa3, 0x49, 0xc4, 0x5f, 0xb1, 0xf5,
984                 0xe3, 0x6b, 0xf1, 0xdc, 0xea, 0x92, 0x7b, 0x29,
985                 0x40, 0xc9, 0x39, 0x5f, 0xdb, 0xbd, 0xf3, 0x6a,
986                 0x09, 0x9b, 0x2a, 0x5e, 0xc7, 0x0b, 0x25, 0x94,
987                 0x55, 0x71, 0x9c, 0x7e, 0x0e, 0xb4, 0x08, 0x12,
988                 0x8c, 0x6e, 0x77, 0xb8, 0x29, 0xf1, 0xc6, 0x71,
989                 0x04, 0x40, 0x77, 0x18, 0x3f, 0x01, 0x09, 0x9c,
990                 0x23, 0x2b, 0x5d, 0x2a, 0x88, 0x20, 0x23, 0x59,
991                 0x74, 0x2a, 0x67, 0x8f, 0xb7, 0xba, 0x38, 0x9f,
992                 0x0f, 0xcf, 0x94, 0xdf, 0xe1, 0x8f, 0x35, 0x5e,
993                 0x34, 0x0c, 0x32, 0x92, 0x2b, 0x23, 0x81, 0xf4,
994                 0x73, 0xa0, 0x5a, 0x2a, 0xbd, 0xa6, 0x6b, 0xae,
995                 0x43, 0xe2, 0xdc, 0x01, 0xc1, 0xc6, 0xc3, 0x04,
996                 0x06, 0xbb, 0xb0, 0x89, 0xb3, 0x4e, 0xbd, 0x81,
997                 0x1b, 0x03, 0x63, 0x93, 0xed, 0x4e, 0xf6, 0xe5,
998                 0x94, 0x6f, 0xd6, 0xf3, 0x20, 0xf3, 0xbc, 0x30,
999                 0xc5, 0xd6, 0xbe, 0x1c, 0x05, 0x34, 0x26, 0x4d,
1000                 0x46, 0x5e, 0x56, 0x63, 0xfb, 0xdb, 0xcd, 0xed,
1001                 0xb0, 0x7f, 0x83, 0x94, 0x55, 0x54, 0x2f, 0xab,
1002                 0xc9, 0xb7, 0x16, 0x4f, 0x9e, 0x93, 0x25, 0xd7,
1003                 0x9f, 0x39, 0x2b, 0x63, 0xcf, 0x1e, 0xa3, 0x0e,
1004                 0x28, 0x47, 0x8a, 0x5f, 0x40, 0x02, 0x89, 0x1f,
1005                 0x83, 0xe7, 0x87, 0xd1, 0x90, 0x17, 0xb8, 0x27,
1006                 0x64, 0xe1, 0xe1, 0x48, 0x5a, 0x55, 0x74, 0x99,
1007                 0x27, 0x9d, 0x05, 0x67, 0xda, 0x70, 0x12, 0x8f,
1008                 0x94, 0x96, 0xfd, 0x36, 0xa4, 0x1d, 0x22, 0xe5,
1009                 0x0b, 0xe5, 0x2f, 0x38, 0x55, 0xa3, 0x5d, 0x0b,
1010                 0xcf, 0xd4, 0xa9, 0xb8, 0xd6, 0x9a, 0x16, 0x2e,
1011                 0x6c, 0x4a, 0x25, 0x51, 0x7a, 0x09, 0x48, 0xdd,
1012                 0xf0, 0xa3, 0x5b, 0x08, 0x1e, 0x2f, 0x03, 0x91,
1013                 0x80, 0xe8, 0x0f, 0xe9, 0x5a, 0x2f, 0x90, 0xd3,
1014                 0x64, 0xed, 0xd7, 0x51, 0x17, 0x66, 0x53, 0x40,
1015                 0x43, 0x74, 0xef, 0x0a, 0x0d, 0x49, 0x41, 0xf2,
1016                 0x67, 0x6e, 0xea, 0x14, 0xc8, 0x74, 0xd6, 0xa9,
1017                 0xb9, 0x6a, 0xe3, 0xec, 0x7d, 0xe8, 0x6a, 0x21,
1018                 0x3a, 0x52, 0x42, 0xfe, 0x9a, 0x15, 0x6d, 0x60,
1019                 0x64, 0x88, 0xc5, 0xb2, 0x8b, 0x15, 0x2c, 0xff,
1020                 0xe2, 0x35, 0xc3, 0xee, 0x9f, 0xcd, 0x82, 0xd9,
1021                 0x14, 0x35, 0x2a, 0xb7, 0xf5, 0x2f, 0x7b, 0xbc,
1022                 0x01, 0xfd, 0xa8, 0xe0, 0x21, 0x4e, 0x73, 0xf9,
1023                 0xf2, 0xb0, 0x79, 0xc9, 0x10, 0x52, 0x8f, 0xa8,
1024                 0x3e, 0x3b, 0xbe, 0xc5, 0xde, 0xf6, 0x53, 0xe3,
1025                 0x1c, 0x25, 0x3a, 0x1f, 0x13, 0xbf, 0x13, 0xbb,
1026                 0x94, 0xc2, 0x97, 0x43, 0x64, 0x47, 0x8f, 0x76,
1027                 0xd7, 0xaa, 0xeb, 0xa4, 0x03, 0x50, 0x0c, 0x10,
1028                 0x50, 0xd8, 0xf7, 0x75, 0x52, 0x42, 0xe2, 0x94,
1029                 0x67, 0xf4, 0x60, 0xfb, 0x21, 0x9b, 0x7a, 0x05,
1030                 0x50, 0x7c, 0x1b, 0x4a, 0x8b, 0x29, 0xe1, 0xac,
1031                 0xd7, 0x99, 0xfd, 0x0d, 0x65, 0x92, 0xcd, 0x23,
1032                 0xa7, 0x35, 0x8e, 0x13, 0xf2, 0xe4, 0x10, 0x74,
1033                 0xc6, 0x4f, 0x19, 0xf7, 0x01, 0x0b, 0x46, 0xab,
1034                 0xef, 0x8d, 0x4a, 0x4a, 0xfa, 0xda, 0xf3, 0xfb,
1035                 0x40, 0x28, 0x88, 0xa2, 0x65, 0x98, 0x4d, 0x88,
1036                 0xc7, 0xbf, 0x00, 0xc8, 0xd0, 0x91, 0xcb, 0x89,
1037                 0x2f, 0xb0, 0x85, 0xfc, 0xa1, 0xc1, 0x9e, 0x83,
1038                 0x88, 0xad, 0x95, 0xc0, 0x31, 0xa0, 0xad, 0xa2,
1039                 0x42, 0xb5, 0xe7, 0x55, 0xd4, 0x93, 0x5a, 0x74,
1040                 0x4e, 0x41, 0xc3, 0xcf, 0x96, 0x83, 0x46, 0xa1,
1041                 0xb7, 0x5b, 0xb1, 0x34, 0x67, 0x4e, 0xb1, 0xd7,
1042                 0x40, 0x20, 0x72, 0xe9, 0xc8, 0x74, 0xb7, 0xde,
1043                 0x72, 0x29, 0x77, 0x4c, 0x74, 0x7e, 0xcc, 0x18,
1044                 0xa5, 0x8d, 0x79, 0x8c, 0xd6, 0x6e, 0xcb, 0xd9,
1045                 0xe1, 0x61, 0xe7, 0x36, 0xbc, 0x37, 0xea, 0xee,
1046                 0xd8, 0x3c, 0x5e, 0x7c, 0x47, 0x50, 0xd5, 0xec,
1047                 0x37, 0xc5, 0x63, 0xc3, 0xc9, 0x99, 0x23, 0x9f,
1048                 0x64, 0x39, 0xdf, 0x13, 0x96, 0x6d, 0xea, 0x08,
1049                 0x0c, 0x27, 0x2d, 0xfe, 0x0f, 0xc2, 0xa3, 0x97,
1050                 0x04, 0x12, 0x66, 0x0d, 0x94, 0xbf, 0xbe, 0x3e,
1051                 0xb9, 0xcf, 0x8e, 0xc1, 0x9d, 0xb1, 0x64, 0x17,
1052                 0x54, 0x92, 0x3f, 0x0a, 0x51, 0xc8, 0xf5, 0x82,
1053                 0x98, 0x73, 0x03, 0xc0, 0x5a, 0x51, 0x01, 0x67,
1054                 0xb4, 0x01, 0x04, 0x06, 0xbc, 0x37, 0xde, 0x96,
1055                 0x23, 0x3c, 0xce, 0x98, 0x3f, 0xd6, 0x51, 0x1b,
1056                 0x01, 0x83, 0x0a, 0x1c, 0xf9, 0xeb, 0x7e, 0x72,
1057                 0xa9, 0x51, 0x23, 0xc8, 0xd7, 0x2f, 0x12, 0xbc,
1058                 0x08, 0xac, 0x07, 0xe7, 0xa7, 0xe6, 0x46, 0xae,
1059                 0x54, 0xa3, 0xc2, 0xf2, 0x05, 0x2d, 0x06, 0x5e,
1060                 0xfc, 0xe2, 0xa2, 0x23, 0xac, 0x86, 0xf2, 0x54,
1061                 0x83, 0x4a, 0xb6, 0x48, 0x93, 0xa1, 0x78, 0xc2,
1062                 0x07, 0xec, 0x82, 0xf0, 0x74, 0xa9, 0x18, 0xe9,
1063                 0x53, 0x44, 0x49, 0xc2, 0x94, 0xf8, 0x94, 0x92,
1064                 0x08, 0x3f, 0xbf, 0xa6, 0xe5, 0xc6, 0x03, 0x8a,
1065                 0xc6, 0x90, 0x48, 0x6c, 0xee, 0xbd, 0x44, 0x92,
1066                 0x1f, 0x2a, 0xce, 0x1d, 0xb8, 0x31, 0xa2, 0x9d,
1067                 0x24, 0x93, 0xa8, 0x9f, 0x36, 0x00, 0x04, 0x7b,
1068                 0xcb, 0x93, 0x59, 0xa1, 0x53, 0xdb, 0x13, 0x7a,
1069                 0x54, 0xb1, 0x04, 0xdb, 0xce, 0x48, 0x4f, 0xe5,
1070                 0x2f, 0xcb, 0xdf, 0x8f, 0x50, 0x7c, 0xfc, 0x76,
1071                 0x80, 0xb4, 0xdc, 0x3b, 0xc8, 0x98, 0x95, 0xf5,
1072                 0x50, 0xba, 0x70, 0x5a, 0x97, 0xd5, 0xfc, 0x98,
1073                 0x4d, 0xf3, 0x61, 0x0f, 0xcf, 0xac, 0x49, 0x0a,
1074                 0xdb, 0xc1, 0x42, 0x8f, 0xb6, 0x29, 0xd5, 0x65,
1075                 0xef, 0x83, 0xf1, 0x30, 0x4b, 0x84, 0xd0, 0x69,
1076                 0xde, 0xd2, 0x99, 0xe5, 0xec, 0xd3, 0x90, 0x86,
1077                 0x39, 0x2a, 0x6e, 0xd5, 0x32, 0xe3, 0x0d, 0x2d,
1078                 0x01, 0x8b, 0x17, 0x55, 0x1d, 0x65, 0x57, 0xbf,
1079                 0xd8, 0x75, 0xa4, 0x85, 0xb6, 0x4e, 0x35, 0x14,
1080                 0x58, 0xe4, 0x89, 0xb8, 0x7a, 0x58, 0x86, 0x0c,
1081                 0xbd, 0x8b, 0x05, 0x7b, 0x63, 0xc0, 0x86, 0x80,
1082                 0x33, 0x46, 0xd4, 0x9b, 0xb6, 0x0a, 0xeb, 0x6c,
1083                 0xae, 0xd6, 0x57, 0x7a, 0xc7, 0x59, 0x33, 0xa0,
1084                 0xda, 0xa4, 0x12, 0xbf, 0x52, 0x22, 0x05, 0x8d,
1085                 0xeb, 0xee, 0xd5, 0xec, 0xea, 0x29, 0x9b, 0x76,
1086                 0x95, 0x50, 0x6d, 0x99, 0xe1, 0x45, 0x63, 0x09,
1087                 0x16, 0x5f, 0xb0, 0xf2, 0x5b, 0x08, 0x33, 0xdd,
1088                 0x8f, 0xb7, 0x60, 0x7a, 0x8e, 0xc6, 0xfc, 0xac,
1089                 0xa9, 0x56, 0x2c, 0xa9, 0x8b, 0x74, 0x33, 0xad,
1090                 0x2a, 0x7e, 0x96, 0xb6, 0xba, 0x22, 0x28, 0xcf,
1091                 0x4d, 0x96, 0xb7, 0xd1, 0xfa, 0x99, 0x4a, 0x61,
1092                 0xe6, 0x84, 0xd1, 0x94, 0xca, 0xf5, 0x86, 0xb0,
1093                 0xba, 0x34, 0x7a, 0x04, 0xcc, 0xd4, 0x81, 0xcd,
1094                 0xd9, 0x86, 0xb6, 0xe0, 0x5a, 0x6f, 0x9b, 0x99,
1095                 0xf0, 0xdf, 0x49, 0xae, 0x6d, 0xc2, 0x54, 0x67,
1096                 0xe0, 0xb4, 0x34, 0x2d, 0x1c, 0x46, 0xdf, 0x73,
1097                 0x3b, 0x45, 0x43, 0xe7, 0x1f, 0xa3, 0x36, 0x35,
1098                 0x25, 0x33, 0xd9, 0xc0, 0x54, 0x38, 0x6e, 0x6b,
1099                 0x80, 0xcf, 0x50, 0xa4, 0xb6, 0x21, 0x17, 0xfd,
1100                 0x9b, 0x5c, 0x36, 0xca, 0xcc, 0x73, 0x73, 0xad,
1101                 0xe0, 0x57, 0x77, 0x90, 0x0e, 0x7f, 0x0f, 0x87,
1102                 0x7f, 0xdb, 0x73, 0xbf, 0xda, 0xc2, 0xb3, 0x05,
1103                 0x22, 0x06, 0xf5, 0xa3, 0xfc, 0x1e, 0x8f, 0xda,
1104                 0xcf, 0x49, 0xd6, 0xb3, 0x66, 0x2c, 0xb5, 0x00,
1105                 0xaf, 0x85, 0x6e, 0xb8, 0x5b, 0x8c, 0xa1, 0xa4,
1106                 0x21, 0xce, 0x40, 0xf3, 0x98, 0xac, 0xec, 0x88,
1107                 0x62, 0x43, 0x2a, 0xac, 0xca, 0xcf, 0xb9, 0x30,
1108                 0xeb, 0xfc, 0xef, 0xf0, 0x6e, 0x64, 0x6d, 0xe7,
1109                 0x54, 0x88, 0x6b, 0x22, 0x29, 0xbe, 0xa5, 0x8c,
1110                 0x31, 0x23, 0x3b, 0x4a, 0x80, 0x37, 0xe6, 0xd0,
1111                 0x05, 0xfc, 0x10, 0x0e, 0xdd, 0xbb, 0x00, 0xc5,
1112                 0x07, 0x20, 0x59, 0xd3, 0x41, 0x17, 0x86, 0x46,
1113                 0xab, 0x68, 0xf6, 0x48, 0x3c, 0xea, 0x5a, 0x06,
1114                 0x30, 0x21, 0x19, 0xed, 0x74, 0xbe, 0x0b, 0x97,
1115                 0xee, 0x91, 0x35, 0x94, 0x1f, 0xcb, 0x68, 0x7f,
1116                 0xe4, 0x48, 0xb0, 0x16, 0xfb, 0xf0, 0x74, 0xdb,
1117                 0x06, 0x59, 0x2e, 0x5a, 0x9c, 0xce, 0x8f, 0x7d,
1118                 0xba, 0x48, 0xd5, 0x3f, 0x5c, 0xb0, 0xc2, 0x33,
1119                 0x48, 0x60, 0x17, 0x08, 0x85, 0xba, 0xff, 0xb9,
1120                 0x34, 0x0a, 0x3d, 0x8f, 0x21, 0x13, 0x12, 0x1b
1121 };
1122
1123 static const uint8_t AES_CBC_ciphertext_1536B[] = {
1124                 0x89, 0x93, 0x05, 0x99, 0xa9, 0xed, 0xea, 0x62,
1125                 0xc9, 0xda, 0x51, 0x15, 0xce, 0x42, 0x91, 0xc3,
1126                 0x80, 0xc8, 0x03, 0x88, 0xc2, 0x63, 0xda, 0x53,
1127                 0x1a, 0xf3, 0xeb, 0xd5, 0xba, 0x6f, 0x23, 0xb2,
1128                 0xed, 0x8f, 0x89, 0xb1, 0xb3, 0xca, 0x90, 0x7a,
1129                 0xdd, 0x3f, 0xf6, 0xca, 0x86, 0x58, 0x54, 0xbc,
1130                 0xab, 0x0f, 0xf4, 0xab, 0x6d, 0x5d, 0x42, 0xd0,
1131                 0x17, 0x49, 0x17, 0xd1, 0x93, 0xea, 0xe8, 0x22,
1132                 0xc1, 0x34, 0x9f, 0x3a, 0x3b, 0xaa, 0xe9, 0x1b,
1133                 0x93, 0xff, 0x6b, 0x68, 0xba, 0xe6, 0xd2, 0x39,
1134                 0x3d, 0x55, 0x34, 0x8f, 0x98, 0x86, 0xb4, 0xd8,
1135                 0x7c, 0x0d, 0x3e, 0x01, 0x63, 0x04, 0x01, 0xff,
1136                 0x16, 0x0f, 0x51, 0x5f, 0x73, 0x53, 0xf0, 0x3a,
1137                 0x38, 0xb4, 0x4d, 0x8d, 0xaf, 0xa3, 0xca, 0x2f,
1138                 0x6f, 0xdf, 0xc0, 0x41, 0x6c, 0x48, 0x60, 0x1a,
1139                 0xe4, 0xe7, 0x8a, 0x65, 0x6f, 0x8d, 0xd7, 0xe1,
1140                 0x10, 0xab, 0x78, 0x5b, 0xb9, 0x69, 0x1f, 0xe0,
1141                 0x5c, 0xf1, 0x19, 0x12, 0x21, 0xc7, 0x51, 0xbc,
1142                 0x61, 0x5f, 0xc0, 0x36, 0x17, 0xc0, 0x28, 0xd9,
1143                 0x51, 0xcb, 0x43, 0xd9, 0xfa, 0xd1, 0xad, 0x79,
1144                 0x69, 0x86, 0x49, 0xc5, 0xe5, 0x69, 0x27, 0xce,
1145                 0x22, 0xd0, 0xe1, 0x6a, 0xf9, 0x02, 0xca, 0x6c,
1146                 0x34, 0xc7, 0xb8, 0x02, 0xc1, 0x38, 0x7f, 0xd5,
1147                 0x15, 0xf5, 0xd6, 0xeb, 0xf9, 0x30, 0x40, 0x43,
1148                 0xea, 0x87, 0xde, 0x35, 0xf6, 0x83, 0x59, 0x09,
1149                 0x68, 0x62, 0x00, 0x87, 0xb8, 0xe7, 0xca, 0x05,
1150                 0x0f, 0xac, 0x42, 0x58, 0x45, 0xaa, 0xc9, 0x9b,
1151                 0xfd, 0x2a, 0xda, 0x65, 0x33, 0x93, 0x9d, 0xc6,
1152                 0x93, 0x8d, 0xe2, 0xc5, 0x71, 0xc1, 0x5c, 0x13,
1153                 0xde, 0x7b, 0xd4, 0xb9, 0x4c, 0x35, 0x61, 0x85,
1154                 0x90, 0x78, 0xf7, 0x81, 0x98, 0x45, 0x99, 0x24,
1155                 0x58, 0x73, 0x28, 0xf8, 0x31, 0xab, 0x54, 0x2e,
1156                 0xc0, 0x38, 0x77, 0x25, 0x5c, 0x06, 0x9c, 0xc3,
1157                 0x69, 0x21, 0x92, 0x76, 0xe1, 0x16, 0xdc, 0xa9,
1158                 0xee, 0xb6, 0x80, 0x66, 0x43, 0x11, 0x24, 0xb3,
1159                 0x07, 0x17, 0x89, 0x0f, 0xcb, 0xe0, 0x60, 0xa8,
1160                 0x9d, 0x06, 0x4b, 0x6e, 0x72, 0xb7, 0xbc, 0x4f,
1161                 0xb8, 0xc0, 0x80, 0xa2, 0xfb, 0x46, 0x5b, 0x8f,
1162                 0x11, 0x01, 0x92, 0x9d, 0x37, 0x09, 0x98, 0xc8,
1163                 0x0a, 0x46, 0xae, 0x12, 0xac, 0x61, 0x3f, 0xe7,
1164                 0x41, 0x1a, 0xaa, 0x2e, 0xdc, 0xd7, 0x2a, 0x47,
1165                 0xee, 0xdf, 0x08, 0xd1, 0xff, 0xea, 0x13, 0xc6,
1166                 0x05, 0xdb, 0x29, 0xcc, 0x03, 0xba, 0x7b, 0x6d,
1167                 0x40, 0xc1, 0xc9, 0x76, 0x75, 0x03, 0x7a, 0x71,
1168                 0xc9, 0x5f, 0xd9, 0xe0, 0x61, 0x69, 0x36, 0x8f,
1169                 0xb2, 0xbc, 0x28, 0xf3, 0x90, 0x71, 0xda, 0x5f,
1170                 0x08, 0xd5, 0x0d, 0xc1, 0xe6, 0xbd, 0x2b, 0xc6,
1171                 0x6c, 0x42, 0xfd, 0xbf, 0x10, 0xe8, 0x5f, 0x87,
1172                 0x3d, 0x21, 0x42, 0x85, 0x01, 0x0a, 0xbf, 0x8e,
1173                 0x49, 0xd3, 0x9c, 0x89, 0x3b, 0xea, 0xe1, 0xbf,
1174                 0xe9, 0x9b, 0x5e, 0x0e, 0xb8, 0xeb, 0xcd, 0x3a,
1175                 0xf6, 0x29, 0x41, 0x35, 0xdd, 0x9b, 0x13, 0x24,
1176                 0xe0, 0x1d, 0x8a, 0xcb, 0x20, 0xf8, 0x41, 0x51,
1177                 0x3e, 0x23, 0x8c, 0x67, 0x98, 0x39, 0x53, 0x77,
1178                 0x2a, 0x68, 0xf4, 0x3c, 0x7e, 0xd6, 0xc4, 0x6e,
1179                 0xf1, 0x53, 0xe9, 0xd8, 0x5c, 0xc1, 0xa9, 0x38,
1180                 0x6f, 0x5e, 0xe4, 0xd4, 0x29, 0x1c, 0x6c, 0xee,
1181                 0x2f, 0xea, 0xde, 0x61, 0x71, 0x5a, 0xea, 0xce,
1182                 0x23, 0x6e, 0x1b, 0x16, 0x43, 0xb7, 0xc0, 0xe3,
1183                 0x87, 0xa1, 0x95, 0x1e, 0x97, 0x4d, 0xea, 0xa6,
1184                 0xf7, 0x25, 0xac, 0x82, 0x2a, 0xd3, 0xa6, 0x99,
1185                 0x75, 0xdd, 0xc1, 0x55, 0x32, 0x6b, 0xea, 0x33,
1186                 0x88, 0xce, 0x06, 0xac, 0x15, 0x39, 0x19, 0xa3,
1187                 0x59, 0xaf, 0x7a, 0x1f, 0xd9, 0x72, 0x5e, 0xf7,
1188                 0x4c, 0xf3, 0x5d, 0x6b, 0xf2, 0x16, 0x92, 0xa8,
1189                 0x9e, 0x3d, 0xd4, 0x4c, 0x72, 0x55, 0x4e, 0x4a,
1190                 0xf7, 0x8b, 0x2f, 0x67, 0x5a, 0x90, 0xb7, 0xcf,
1191                 0x16, 0xd3, 0x7b, 0x5a, 0x9a, 0xc8, 0x9f, 0xbf,
1192                 0x01, 0x76, 0x3b, 0x86, 0x2c, 0x2a, 0x78, 0x10,
1193                 0x70, 0x05, 0x38, 0xf9, 0xdd, 0x2a, 0x1d, 0x00,
1194                 0x25, 0xb7, 0x10, 0xac, 0x3b, 0x3c, 0x4d, 0x3c,
1195                 0x01, 0x68, 0x3c, 0x5a, 0x29, 0xc2, 0xa0, 0x1b,
1196                 0x95, 0x67, 0xf9, 0x0a, 0x60, 0xb7, 0x11, 0x9c,
1197                 0x40, 0x45, 0xd7, 0xb0, 0xda, 0x49, 0x87, 0xcd,
1198                 0xb0, 0x9b, 0x61, 0x8c, 0xf4, 0x0d, 0x94, 0x1d,
1199                 0x79, 0x66, 0x13, 0x0b, 0xc6, 0x6b, 0x19, 0xee,
1200                 0xa0, 0x6b, 0x64, 0x7d, 0xc4, 0xff, 0x98, 0x72,
1201                 0x60, 0xab, 0x7f, 0x0f, 0x4d, 0x5d, 0x6b, 0xc3,
1202                 0xba, 0x5e, 0x0d, 0x04, 0xd9, 0x59, 0x17, 0xd0,
1203                 0x64, 0xbe, 0xfb, 0x58, 0xfc, 0xed, 0x18, 0xf6,
1204                 0xac, 0x19, 0xa4, 0xfd, 0x16, 0x59, 0x80, 0x58,
1205                 0xb8, 0x0f, 0x79, 0x24, 0x60, 0x18, 0x62, 0xa9,
1206                 0xa3, 0xa0, 0xe8, 0x81, 0xd6, 0xec, 0x5b, 0xfe,
1207                 0x5b, 0xb8, 0xa4, 0x00, 0xa9, 0xd0, 0x90, 0x17,
1208                 0xe5, 0x50, 0x3d, 0x2b, 0x12, 0x6e, 0x2a, 0x13,
1209                 0x65, 0x7c, 0xdf, 0xdf, 0xa7, 0xdd, 0x9f, 0x78,
1210                 0x5f, 0x8f, 0x4e, 0x90, 0xa6, 0x10, 0xe4, 0x7b,
1211                 0x68, 0x6b, 0xfd, 0xa9, 0x6d, 0x47, 0xfa, 0xec,
1212                 0x42, 0x35, 0x07, 0x12, 0x3e, 0x78, 0x23, 0x15,
1213                 0xff, 0xe2, 0x65, 0xc7, 0x47, 0x89, 0x2f, 0x97,
1214                 0x7c, 0xd7, 0x6b, 0x69, 0x35, 0x79, 0x6f, 0x85,
1215                 0xb4, 0xa9, 0x75, 0x04, 0x32, 0x9a, 0xfe, 0xf0,
1216                 0xce, 0xe3, 0xf1, 0xab, 0x15, 0x47, 0xe4, 0x9c,
1217                 0xc1, 0x48, 0x32, 0x3c, 0xbe, 0x44, 0x72, 0xc9,
1218                 0xaa, 0x50, 0x37, 0xa6, 0xbe, 0x41, 0xcf, 0xe8,
1219                 0x17, 0x4e, 0x37, 0xbe, 0xf1, 0x34, 0x2c, 0xd9,
1220                 0x60, 0x48, 0x09, 0xa5, 0x26, 0x00, 0x31, 0x77,
1221                 0x4e, 0xac, 0x7c, 0x89, 0x75, 0xe3, 0xde, 0x26,
1222                 0x4c, 0x32, 0x54, 0x27, 0x8e, 0x92, 0x26, 0x42,
1223                 0x85, 0x76, 0x01, 0x76, 0x62, 0x4c, 0x29, 0xe9,
1224                 0x38, 0x05, 0x51, 0x54, 0x97, 0xa3, 0x03, 0x59,
1225                 0x5e, 0xec, 0x0c, 0xe4, 0x96, 0xb7, 0x15, 0xa8,
1226                 0x41, 0x06, 0x2b, 0x78, 0x95, 0x24, 0xf6, 0x32,
1227                 0xc5, 0xec, 0xd7, 0x89, 0x28, 0x1e, 0xec, 0xb1,
1228                 0xc7, 0x21, 0x0c, 0xd3, 0x80, 0x7c, 0x5a, 0xe6,
1229                 0xb1, 0x3a, 0x52, 0x33, 0x84, 0x4e, 0x32, 0x6e,
1230                 0x7a, 0xf6, 0x43, 0x15, 0x5b, 0xa6, 0xba, 0xeb,
1231                 0xa8, 0xe4, 0xff, 0x4f, 0xbd, 0xbd, 0xa8, 0x5e,
1232                 0xbe, 0x27, 0xaf, 0xc5, 0xf7, 0x9e, 0xdf, 0x48,
1233                 0x22, 0xca, 0x6a, 0x0b, 0x3c, 0xd7, 0xe0, 0xdc,
1234                 0xf3, 0x71, 0x08, 0xdc, 0x28, 0x13, 0x08, 0xf2,
1235                 0x08, 0x1d, 0x9d, 0x7b, 0xd9, 0xde, 0x6f, 0xe6,
1236                 0xe8, 0x88, 0x18, 0xc2, 0xcd, 0x93, 0xc5, 0x38,
1237                 0x21, 0x68, 0x4c, 0x9a, 0xfb, 0xb6, 0x18, 0x16,
1238                 0x73, 0x2c, 0x1d, 0x6f, 0x95, 0xfb, 0x65, 0x4f,
1239                 0x7c, 0xec, 0x8d, 0x6c, 0xa8, 0xc0, 0x55, 0x28,
1240                 0xc6, 0xc3, 0xea, 0xeb, 0x05, 0xf5, 0x65, 0xeb,
1241                 0x53, 0xe1, 0x54, 0xef, 0xb8, 0x64, 0x98, 0x2d,
1242                 0x98, 0x9e, 0xc8, 0xfe, 0xa2, 0x07, 0x30, 0xf7,
1243                 0xf7, 0xae, 0xdb, 0x32, 0xf8, 0x71, 0x9d, 0x06,
1244                 0xdf, 0x9b, 0xda, 0x61, 0x7d, 0xdb, 0xae, 0x06,
1245                 0x24, 0x63, 0x74, 0xb6, 0xf3, 0x1b, 0x66, 0x09,
1246                 0x60, 0xff, 0x2b, 0x29, 0xf5, 0xa9, 0x9d, 0x61,
1247                 0x5d, 0x55, 0x10, 0x82, 0x21, 0xbb, 0x64, 0x0d,
1248                 0xef, 0x5c, 0xe3, 0x30, 0x1b, 0x60, 0x1e, 0x5b,
1249                 0xfe, 0x6c, 0xf5, 0x15, 0xa3, 0x86, 0x27, 0x58,
1250                 0x46, 0x00, 0x20, 0xcb, 0x86, 0x9a, 0x52, 0x29,
1251                 0x20, 0x68, 0x4d, 0x67, 0x88, 0x70, 0xc2, 0x31,
1252                 0xd8, 0xbb, 0xa5, 0xa7, 0x88, 0x7f, 0x66, 0xbc,
1253                 0xaa, 0x0f, 0xe1, 0x78, 0x7b, 0x97, 0x3c, 0xb7,
1254                 0xd7, 0xd8, 0x04, 0xe0, 0x09, 0x60, 0xc8, 0xd0,
1255                 0x9e, 0xe5, 0x6b, 0x31, 0x7f, 0x88, 0xfe, 0xc3,
1256                 0xfd, 0x89, 0xec, 0x76, 0x4b, 0xb3, 0xa7, 0x37,
1257                 0x03, 0xb7, 0xc6, 0x10, 0x7c, 0x9d, 0x0c, 0x75,
1258                 0xd3, 0x08, 0x14, 0x94, 0x03, 0x42, 0x25, 0x26,
1259                 0x85, 0xf7, 0xf0, 0x90, 0x06, 0x3e, 0x6f, 0x60,
1260                 0x52, 0x55, 0xd5, 0x0f, 0x79, 0x64, 0x69, 0x69,
1261                 0x46, 0xf9, 0x7f, 0x7f, 0x03, 0xf1, 0x1f, 0xdb,
1262                 0x39, 0x05, 0xba, 0x4a, 0x8f, 0x17, 0xe7, 0xba,
1263                 0xe2, 0x07, 0x7c, 0x1d, 0x9e, 0xbc, 0x94, 0xc0,
1264                 0x61, 0x59, 0x8e, 0x72, 0xaf, 0xfc, 0x99, 0xe4,
1265                 0xd5, 0xa8, 0xee, 0x0a, 0x48, 0x2d, 0x82, 0x8b,
1266                 0x34, 0x54, 0x8a, 0xce, 0xc7, 0xfa, 0xdd, 0xba,
1267                 0x54, 0xdf, 0xb3, 0x30, 0x33, 0x73, 0x2e, 0xd5,
1268                 0x52, 0xab, 0x49, 0x91, 0x4e, 0x0a, 0xd6, 0x2f,
1269                 0x67, 0xe4, 0xdd, 0x64, 0x48, 0x16, 0xd9, 0x85,
1270                 0xaa, 0x52, 0xa5, 0x0b, 0xd3, 0xb4, 0x2d, 0x77,
1271                 0x5e, 0x52, 0x77, 0x17, 0xcf, 0xbe, 0x88, 0x04,
1272                 0x01, 0x52, 0xe2, 0xf1, 0x46, 0xe2, 0x91, 0x30,
1273                 0x65, 0xcf, 0xc0, 0x65, 0x45, 0xc3, 0x7e, 0xf4,
1274                 0x2e, 0xb5, 0xaf, 0x6f, 0xab, 0x1a, 0xfa, 0x70,
1275                 0x35, 0xb8, 0x4f, 0x2d, 0x78, 0x90, 0x33, 0xb5,
1276                 0x9a, 0x67, 0xdb, 0x2f, 0x28, 0x32, 0xb6, 0x54,
1277                 0xab, 0x4c, 0x6b, 0x85, 0xed, 0x6c, 0x3e, 0x05,
1278                 0x2a, 0xc7, 0x32, 0xe8, 0xf5, 0xa3, 0x7b, 0x4e,
1279                 0x7b, 0x58, 0x24, 0x73, 0xf7, 0xfd, 0xc7, 0xc8,
1280                 0x6c, 0x71, 0x68, 0xb1, 0xf6, 0xc5, 0x9e, 0x1e,
1281                 0xe3, 0x5c, 0x25, 0xc0, 0x5b, 0x3e, 0x59, 0xa1,
1282                 0x18, 0x5a, 0xe8, 0xb5, 0xd1, 0x44, 0x13, 0xa3,
1283                 0xe6, 0x05, 0x76, 0xd2, 0x8d, 0x6e, 0x54, 0x68,
1284                 0x0c, 0xa4, 0x7b, 0x8b, 0xd3, 0x8c, 0x42, 0x13,
1285                 0x87, 0xda, 0xdf, 0x8f, 0xa5, 0x83, 0x7a, 0x42,
1286                 0x99, 0xb7, 0xeb, 0xe2, 0x79, 0xe0, 0xdb, 0xda,
1287                 0x33, 0xa8, 0x50, 0x3a, 0xd7, 0xe7, 0xd3, 0x61,
1288                 0x18, 0xb8, 0xaa, 0x2d, 0xc8, 0xd8, 0x2c, 0x28,
1289                 0xe5, 0x97, 0x0a, 0x7c, 0x6c, 0x7f, 0x09, 0xd7,
1290                 0x88, 0x80, 0xac, 0x12, 0xed, 0xf8, 0xc6, 0xb5,
1291                 0x2d, 0xd6, 0x63, 0x9b, 0x98, 0x35, 0x26, 0xde,
1292                 0xf6, 0x31, 0xee, 0x7e, 0xa0, 0xfb, 0x16, 0x98,
1293                 0xb1, 0x96, 0x1d, 0xee, 0xe3, 0x2f, 0xfb, 0x41,
1294                 0xdd, 0xea, 0x10, 0x1e, 0x03, 0x89, 0x18, 0xd2,
1295                 0x47, 0x0c, 0xa0, 0x57, 0xda, 0x76, 0x3a, 0x37,
1296                 0x2c, 0xe4, 0xf9, 0x77, 0xc8, 0x43, 0x5f, 0xcb,
1297                 0xd6, 0x85, 0xf7, 0x22, 0xe4, 0x32, 0x25, 0xa8,
1298                 0xdc, 0x21, 0xc0, 0xf5, 0x95, 0xb2, 0xf8, 0x83,
1299                 0xf0, 0x65, 0x61, 0x15, 0x48, 0x94, 0xb7, 0x03,
1300                 0x7f, 0x66, 0xa1, 0x39, 0x1f, 0xdd, 0xce, 0x96,
1301                 0xfe, 0x58, 0x81, 0x3d, 0x41, 0x11, 0x87, 0x13,
1302                 0x26, 0x1b, 0x6d, 0xf3, 0xca, 0x2e, 0x2c, 0x76,
1303                 0xd3, 0x2f, 0x6d, 0x49, 0x70, 0x53, 0x05, 0x96,
1304                 0xcc, 0x30, 0x2b, 0x83, 0xf2, 0xc6, 0xb2, 0x4b,
1305                 0x22, 0x13, 0x95, 0x42, 0xeb, 0x56, 0x4d, 0x22,
1306                 0xe6, 0x43, 0x6f, 0xba, 0xe7, 0x3b, 0xe5, 0x59,
1307                 0xce, 0x57, 0x88, 0x85, 0xb6, 0xbf, 0x15, 0x37,
1308                 0xb3, 0x7a, 0x7e, 0xc4, 0xbc, 0x99, 0xfc, 0xe4,
1309                 0x89, 0x00, 0x68, 0x39, 0xbc, 0x5a, 0xba, 0xab,
1310                 0x52, 0xab, 0xe6, 0x81, 0xfd, 0x93, 0x62, 0xe9,
1311                 0xb7, 0x12, 0xd1, 0x18, 0x1a, 0xb9, 0x55, 0x4a,
1312                 0x0f, 0xae, 0x35, 0x11, 0x04, 0x27, 0xf3, 0x42,
1313                 0x4e, 0xca, 0xdf, 0x9f, 0x12, 0x62, 0xea, 0x03,
1314                 0xc0, 0xa9, 0x22, 0x7b, 0x6c, 0x6c, 0xe3, 0xdf,
1315                 0x16, 0xad, 0x03, 0xc9, 0xfe, 0xa4, 0xdd, 0x4f
1316 };
1317
1318 static const uint8_t AES_CBC_ciphertext_1792B[] = {
1319                 0x59, 0xcc, 0xfe, 0x8f, 0xb4, 0x9d, 0x0e, 0xd1,
1320                 0x85, 0xfc, 0x9b, 0x43, 0xc1, 0xb7, 0x54, 0x67,
1321                 0x01, 0xef, 0xb8, 0x71, 0x36, 0xdb, 0x50, 0x48,
1322                 0x7a, 0xea, 0xcf, 0xce, 0xba, 0x30, 0x10, 0x2e,
1323                 0x96, 0x2b, 0xfd, 0xcf, 0x00, 0xe3, 0x1f, 0xac,
1324                 0x66, 0x14, 0x30, 0x86, 0x49, 0xdb, 0x01, 0x8b,
1325                 0x07, 0xdd, 0x00, 0x9d, 0x0d, 0x5c, 0x19, 0x11,
1326                 0xe8, 0x44, 0x2b, 0x25, 0x70, 0xed, 0x7c, 0x33,
1327                 0x0d, 0xe3, 0x34, 0x93, 0x63, 0xad, 0x26, 0xb1,
1328                 0x11, 0x91, 0x34, 0x2e, 0x1d, 0x50, 0xaa, 0xd4,
1329                 0xef, 0x3a, 0x6d, 0xd7, 0x33, 0x20, 0x0d, 0x3f,
1330                 0x9b, 0xdd, 0xc3, 0xa5, 0xc5, 0xf1, 0x99, 0xdc,
1331                 0xea, 0x52, 0xda, 0x55, 0xea, 0xa2, 0x7a, 0xc5,
1332                 0x78, 0x44, 0x4a, 0x02, 0x33, 0x19, 0x62, 0x37,
1333                 0xf8, 0x8b, 0xd1, 0x0c, 0x21, 0xdf, 0x40, 0x19,
1334                 0x81, 0xea, 0xfb, 0x1c, 0xa7, 0xcc, 0x60, 0xfe,
1335                 0x63, 0x25, 0x8f, 0xf3, 0x73, 0x0f, 0x45, 0xe6,
1336                 0x6a, 0x18, 0xbf, 0xbe, 0xad, 0x92, 0x2a, 0x1e,
1337                 0x15, 0x65, 0x6f, 0xef, 0x92, 0xcd, 0x0e, 0x19,
1338                 0x3d, 0x42, 0xa8, 0xfc, 0x0d, 0x32, 0x58, 0xe0,
1339                 0x56, 0x9f, 0xd6, 0x9b, 0x8b, 0xec, 0xe0, 0x45,
1340                 0x4d, 0x7e, 0x73, 0x87, 0xff, 0x74, 0x92, 0x59,
1341                 0x60, 0x13, 0x93, 0xda, 0xec, 0xbf, 0xfa, 0x20,
1342                 0xb6, 0xe7, 0xdf, 0xc7, 0x10, 0xf5, 0x79, 0xb4,
1343                 0xd7, 0xac, 0xaf, 0x2b, 0x37, 0x52, 0x30, 0x1d,
1344                 0xbe, 0x0f, 0x60, 0x77, 0x3d, 0x03, 0x63, 0xa9,
1345                 0xae, 0xb1, 0xf3, 0xca, 0xca, 0xb4, 0x21, 0xd7,
1346                 0x6f, 0x2e, 0x5e, 0x9b, 0x68, 0x53, 0x80, 0xab,
1347                 0x30, 0x23, 0x0a, 0x72, 0x6b, 0xb1, 0xd8, 0x25,
1348                 0x5d, 0x3a, 0x62, 0x9b, 0x4f, 0x59, 0x3b, 0x79,
1349                 0xa8, 0x9e, 0x08, 0x6d, 0x37, 0xb0, 0xfc, 0x42,
1350                 0x51, 0x25, 0x86, 0xbd, 0x54, 0x5a, 0x95, 0x20,
1351                 0x6c, 0xac, 0xb9, 0x30, 0x1c, 0x03, 0xc9, 0x49,
1352                 0x38, 0x55, 0x31, 0x49, 0xed, 0xa9, 0x0e, 0xc3,
1353                 0x65, 0xb4, 0x68, 0x6b, 0x07, 0x4c, 0x0a, 0xf9,
1354                 0x21, 0x69, 0x7c, 0x9f, 0x28, 0x80, 0xe9, 0x49,
1355                 0x22, 0x7c, 0xec, 0x97, 0xf7, 0x70, 0xb4, 0xb8,
1356                 0x25, 0xe7, 0x80, 0x2c, 0x43, 0x24, 0x8a, 0x2e,
1357                 0xac, 0xa2, 0x84, 0x20, 0xe7, 0xf4, 0x6b, 0x86,
1358                 0x37, 0x05, 0xc7, 0x59, 0x04, 0x49, 0x2a, 0x99,
1359                 0x80, 0x46, 0x32, 0x19, 0xe6, 0x30, 0xce, 0xc0,
1360                 0xef, 0x6e, 0xec, 0xe5, 0x2f, 0x24, 0xc1, 0x78,
1361                 0x45, 0x02, 0xd3, 0x64, 0x99, 0xf5, 0xc7, 0xbc,
1362                 0x8f, 0x8c, 0x75, 0xb1, 0x0a, 0xc8, 0xc3, 0xbd,
1363                 0x5e, 0x7e, 0xbd, 0x0e, 0xdf, 0x4b, 0x96, 0x6a,
1364                 0xfd, 0x03, 0xdb, 0xd1, 0x31, 0x1e, 0x27, 0xf9,
1365                 0xe5, 0x83, 0x9a, 0xfc, 0x13, 0x4c, 0xd3, 0x04,
1366                 0xdb, 0xdb, 0x3f, 0x35, 0x93, 0x4e, 0x14, 0x6b,
1367                 0x00, 0x5c, 0xb6, 0x11, 0x50, 0xee, 0x61, 0x5c,
1368                 0x10, 0x5c, 0xd0, 0x90, 0x02, 0x2e, 0x12, 0xe0,
1369                 0x50, 0x44, 0xad, 0x75, 0xcd, 0x94, 0xcf, 0x92,
1370                 0xcb, 0xe3, 0xe8, 0x77, 0x4b, 0xd7, 0x1a, 0x7c,
1371                 0xdd, 0x6b, 0x49, 0x21, 0x7c, 0xe8, 0x2c, 0x25,
1372                 0x49, 0x86, 0x1e, 0x54, 0xae, 0xfc, 0x0e, 0x80,
1373                 0xb1, 0xd5, 0xa5, 0x23, 0xcf, 0xcc, 0x0e, 0x11,
1374                 0xe2, 0x7c, 0x3c, 0x25, 0x78, 0x64, 0x03, 0xa1,
1375                 0xdd, 0x9f, 0x74, 0x12, 0x7b, 0x21, 0xb5, 0x73,
1376                 0x15, 0x3c, 0xed, 0xad, 0x07, 0x62, 0x21, 0x79,
1377                 0xd4, 0x2f, 0x0d, 0x72, 0xe9, 0x7c, 0x6b, 0x96,
1378                 0x6e, 0xe5, 0x36, 0x4a, 0xd2, 0x38, 0xe1, 0xff,
1379                 0x6e, 0x26, 0xa4, 0xac, 0x83, 0x07, 0xe6, 0x67,
1380                 0x74, 0x6c, 0xec, 0x8b, 0x4b, 0x79, 0x33, 0x50,
1381                 0x2f, 0x8f, 0xa0, 0x8f, 0xfa, 0x38, 0x6a, 0xa2,
1382                 0x3a, 0x42, 0x85, 0x15, 0x90, 0xd0, 0xb3, 0x0d,
1383                 0x8a, 0xe4, 0x60, 0x03, 0xef, 0xf9, 0x65, 0x8a,
1384                 0x4e, 0x50, 0x8c, 0x65, 0xba, 0x61, 0x16, 0xc3,
1385                 0x93, 0xb7, 0x75, 0x21, 0x98, 0x25, 0x60, 0x6e,
1386                 0x3d, 0x68, 0xba, 0x7c, 0xe4, 0xf3, 0xd9, 0x9b,
1387                 0xfb, 0x7a, 0xed, 0x1f, 0xb3, 0x4b, 0x88, 0x74,
1388                 0x2c, 0xb8, 0x8c, 0x22, 0x95, 0xce, 0x90, 0xf1,
1389                 0xdb, 0x80, 0xa6, 0x39, 0xae, 0x82, 0xa1, 0xef,
1390                 0x75, 0xec, 0xfe, 0xf1, 0xe8, 0x04, 0xfd, 0x99,
1391                 0x1b, 0x5f, 0x45, 0x87, 0x4f, 0xfa, 0xa2, 0x3e,
1392                 0x3e, 0xb5, 0x01, 0x4b, 0x46, 0xeb, 0x13, 0x9a,
1393                 0xe4, 0x7d, 0x03, 0x87, 0xb1, 0x59, 0x91, 0x8e,
1394                 0x37, 0xd3, 0x16, 0xce, 0xef, 0x4b, 0xe9, 0x46,
1395                 0x8d, 0x2a, 0x50, 0x2f, 0x41, 0xd3, 0x7b, 0xcf,
1396                 0xf0, 0xb7, 0x8b, 0x65, 0x0f, 0xa3, 0x27, 0x10,
1397                 0xe9, 0xa9, 0xe9, 0x2c, 0xbe, 0xbb, 0x82, 0xe3,
1398                 0x7b, 0x0b, 0x81, 0x3e, 0xa4, 0x6a, 0x4f, 0x3b,
1399                 0xd5, 0x61, 0xf8, 0x47, 0x04, 0x99, 0x5b, 0xff,
1400                 0xf3, 0x14, 0x6e, 0x57, 0x5b, 0xbf, 0x1b, 0xb4,
1401                 0x3f, 0xf9, 0x31, 0xf6, 0x95, 0xd5, 0x10, 0xa9,
1402                 0x72, 0x28, 0x23, 0xa9, 0x6a, 0xa2, 0xcf, 0x7d,
1403                 0xe3, 0x18, 0x95, 0xda, 0xbc, 0x6f, 0xe9, 0xd8,
1404                 0xef, 0x49, 0x3f, 0xd3, 0xef, 0x1f, 0xe1, 0x50,
1405                 0xe8, 0x8a, 0xc0, 0xce, 0xcc, 0xb7, 0x5e, 0x0e,
1406                 0x8b, 0x95, 0x80, 0xfd, 0x58, 0x2a, 0x9b, 0xc8,
1407                 0xb4, 0x17, 0x04, 0x46, 0x74, 0xd4, 0x68, 0x91,
1408                 0x33, 0xc8, 0x31, 0x15, 0x84, 0x16, 0x35, 0x03,
1409                 0x64, 0x6d, 0xa9, 0x4e, 0x20, 0xeb, 0xa9, 0x3f,
1410                 0x21, 0x5e, 0x9b, 0x09, 0xc3, 0x45, 0xf8, 0x7c,
1411                 0x59, 0x62, 0x29, 0x9a, 0x5c, 0xcf, 0xb4, 0x27,
1412                 0x5e, 0x13, 0xea, 0xb3, 0xef, 0xd9, 0x01, 0x2a,
1413                 0x65, 0x5f, 0x14, 0xf4, 0xbf, 0x28, 0x89, 0x3d,
1414                 0xdd, 0x9d, 0x52, 0xbd, 0x9e, 0x5b, 0x3b, 0xd2,
1415                 0xc2, 0x81, 0x35, 0xb6, 0xac, 0xdd, 0x27, 0xc3,
1416                 0x7b, 0x01, 0x5a, 0x6d, 0x4c, 0x5e, 0x2c, 0x30,
1417                 0xcb, 0x3a, 0xfa, 0xc1, 0xd7, 0x31, 0x67, 0x3e,
1418                 0x08, 0x6a, 0xe8, 0x8c, 0x75, 0xac, 0x1a, 0x6a,
1419                 0x52, 0xf7, 0x51, 0xcd, 0x85, 0x3f, 0x3c, 0xa7,
1420                 0xea, 0xbc, 0xd7, 0x18, 0x9e, 0x27, 0x73, 0xe6,
1421                 0x2b, 0x58, 0xb6, 0xd2, 0x29, 0x68, 0xd5, 0x8f,
1422                 0x00, 0x4d, 0x55, 0xf6, 0x61, 0x5a, 0xcc, 0x51,
1423                 0xa6, 0x5e, 0x85, 0xcb, 0x0b, 0xfd, 0x06, 0xca,
1424                 0xf5, 0xbf, 0x0d, 0x13, 0x74, 0x78, 0x6d, 0x9e,
1425                 0x20, 0x11, 0x84, 0x3e, 0x78, 0x17, 0x04, 0x4f,
1426                 0x64, 0x2c, 0x3b, 0x3e, 0x93, 0x7b, 0x58, 0x33,
1427                 0x07, 0x52, 0xf7, 0x60, 0x6a, 0xa8, 0x3b, 0x19,
1428                 0x27, 0x7a, 0x93, 0xc5, 0x53, 0xad, 0xec, 0xf6,
1429                 0xc8, 0x94, 0xee, 0x92, 0xea, 0xee, 0x7e, 0xea,
1430                 0xb9, 0x5f, 0xac, 0x59, 0x5d, 0x2e, 0x78, 0x53,
1431                 0x72, 0x81, 0x92, 0xdd, 0x1c, 0x63, 0xbe, 0x02,
1432                 0xeb, 0xa8, 0x1b, 0x2a, 0x6e, 0x72, 0xe3, 0x2d,
1433                 0x84, 0x0d, 0x8a, 0x22, 0xf6, 0xba, 0xab, 0x04,
1434                 0x8e, 0x04, 0x24, 0xdb, 0xcc, 0xe2, 0x69, 0xeb,
1435                 0x4e, 0xfa, 0x6b, 0x5b, 0xc8, 0xc0, 0xd9, 0x25,
1436                 0xcb, 0x40, 0x8d, 0x4b, 0x8e, 0xa0, 0xd4, 0x72,
1437                 0x98, 0x36, 0x46, 0x3b, 0x4f, 0x5f, 0x96, 0x84,
1438                 0x03, 0x28, 0x86, 0x4d, 0xa1, 0x8a, 0xd7, 0xb2,
1439                 0x5b, 0x27, 0x01, 0x80, 0x62, 0x49, 0x56, 0xb9,
1440                 0xa0, 0xa1, 0xe3, 0x6e, 0x22, 0x2a, 0x5d, 0x03,
1441                 0x86, 0x40, 0x36, 0x22, 0x5e, 0xd2, 0xe5, 0xc0,
1442                 0x6b, 0xfa, 0xac, 0x80, 0x4e, 0x09, 0x99, 0xbc,
1443                 0x2f, 0x9b, 0xcc, 0xf3, 0x4e, 0xf7, 0x99, 0x98,
1444                 0x11, 0x6e, 0x6f, 0x62, 0x22, 0x6b, 0x92, 0x95,
1445                 0x3b, 0xc3, 0xd2, 0x8e, 0x0f, 0x07, 0xc2, 0x51,
1446                 0x5c, 0x4d, 0xb2, 0x6e, 0xc0, 0x27, 0x73, 0xcd,
1447                 0x57, 0xb7, 0xf0, 0xe9, 0x2e, 0xc8, 0xe2, 0x0c,
1448                 0xd1, 0xb5, 0x0f, 0xff, 0xf9, 0xec, 0x38, 0xba,
1449                 0x97, 0xd6, 0x94, 0x9b, 0xd1, 0x79, 0xb6, 0x6a,
1450                 0x01, 0x17, 0xe4, 0x7e, 0xa6, 0xd5, 0x86, 0x19,
1451                 0xae, 0xf3, 0xf0, 0x62, 0x73, 0xc0, 0xf0, 0x0a,
1452                 0x7a, 0x96, 0x93, 0x72, 0x89, 0x7e, 0x25, 0x57,
1453                 0xf8, 0xf7, 0xd5, 0x1e, 0xe5, 0xac, 0xd6, 0x38,
1454                 0x4f, 0xe8, 0x81, 0xd1, 0x53, 0x41, 0x07, 0x2d,
1455                 0x58, 0x34, 0x1c, 0xef, 0x74, 0x2e, 0x61, 0xca,
1456                 0xd3, 0xeb, 0xd6, 0x93, 0x0a, 0xf2, 0xf2, 0x86,
1457                 0x9c, 0xe3, 0x7a, 0x52, 0xf5, 0x42, 0xf1, 0x8b,
1458                 0x10, 0xf2, 0x25, 0x68, 0x7e, 0x61, 0xb1, 0x19,
1459                 0xcf, 0x8f, 0x5a, 0x53, 0xb7, 0x68, 0x4f, 0x1a,
1460                 0x71, 0xe9, 0x83, 0x91, 0x3a, 0x78, 0x0f, 0xf7,
1461                 0xd4, 0x74, 0xf5, 0x06, 0xd2, 0x88, 0xb0, 0x06,
1462                 0xe5, 0xc0, 0xfb, 0xb3, 0x91, 0xad, 0xc0, 0x84,
1463                 0x31, 0xf2, 0x3a, 0xcf, 0x63, 0xe6, 0x4a, 0xd3,
1464                 0x78, 0xbe, 0xde, 0x73, 0x3e, 0x02, 0x8e, 0xb8,
1465                 0x3a, 0xf6, 0x55, 0xa7, 0xf8, 0x5a, 0xb5, 0x0e,
1466                 0x0c, 0xc5, 0xe5, 0x66, 0xd5, 0xd2, 0x18, 0xf3,
1467                 0xef, 0xa5, 0xc9, 0x68, 0x69, 0xe0, 0xcd, 0x00,
1468                 0x33, 0x99, 0x6e, 0xea, 0xcb, 0x06, 0x7a, 0xe1,
1469                 0xe1, 0x19, 0x0b, 0xe7, 0x08, 0xcd, 0x09, 0x1b,
1470                 0x85, 0xec, 0xc4, 0xd4, 0x75, 0xf0, 0xd6, 0xfb,
1471                 0x84, 0x95, 0x07, 0x44, 0xca, 0xa5, 0x2a, 0x6c,
1472                 0xc2, 0x00, 0x58, 0x08, 0x87, 0x9e, 0x0a, 0xd4,
1473                 0x06, 0xe2, 0x91, 0x5f, 0xb7, 0x1b, 0x11, 0xfa,
1474                 0x85, 0xfc, 0x7c, 0xf2, 0x0f, 0x6e, 0x3c, 0x8a,
1475                 0xe1, 0x0f, 0xa0, 0x33, 0x84, 0xce, 0x81, 0x4d,
1476                 0x32, 0x4d, 0xeb, 0x41, 0xcf, 0x5a, 0x05, 0x60,
1477                 0x47, 0x6c, 0x2a, 0xc4, 0x17, 0xd5, 0x16, 0x3a,
1478                 0xe4, 0xe7, 0xab, 0x84, 0x94, 0x22, 0xff, 0x56,
1479                 0xb0, 0x0c, 0x92, 0x6c, 0x19, 0x11, 0x4c, 0xb3,
1480                 0xed, 0x58, 0x48, 0x84, 0x2a, 0xe2, 0x19, 0x2a,
1481                 0xe1, 0xc0, 0x56, 0x82, 0x3c, 0x83, 0xb4, 0x58,
1482                 0x2d, 0xf0, 0xb5, 0x1e, 0x76, 0x85, 0x51, 0xc2,
1483                 0xe4, 0x95, 0x27, 0x96, 0xd1, 0x90, 0xc3, 0x17,
1484                 0x75, 0xa1, 0xbb, 0x46, 0x5f, 0xa6, 0xf2, 0xef,
1485                 0x71, 0x56, 0x92, 0xc5, 0x8a, 0x85, 0x52, 0xe4,
1486                 0x63, 0x21, 0x6f, 0x55, 0x85, 0x2b, 0x6b, 0x0d,
1487                 0xc9, 0x92, 0x77, 0x67, 0xe3, 0xff, 0x2a, 0x2b,
1488                 0x90, 0x01, 0x3d, 0x74, 0x63, 0x04, 0x61, 0x3c,
1489                 0x8e, 0xf8, 0xfc, 0x04, 0xdd, 0x21, 0x85, 0x92,
1490                 0x1e, 0x4d, 0x51, 0x8d, 0xb5, 0x6b, 0xf1, 0xda,
1491                 0x96, 0xf5, 0x8e, 0x3c, 0x38, 0x5a, 0xac, 0x9b,
1492                 0xba, 0x0c, 0x84, 0x5d, 0x50, 0x12, 0xc7, 0xc5,
1493                 0x7a, 0xcb, 0xb1, 0xfa, 0x16, 0x93, 0xdf, 0x98,
1494                 0xda, 0x3f, 0x49, 0xa3, 0x94, 0x78, 0x70, 0xc7,
1495                 0x0b, 0xb6, 0x91, 0xa6, 0x16, 0x2e, 0xcf, 0xfd,
1496                 0x51, 0x6a, 0x5b, 0xad, 0x7a, 0xdd, 0xa9, 0x48,
1497                 0x48, 0xac, 0xd6, 0x45, 0xbc, 0x23, 0x31, 0x1d,
1498                 0x86, 0x54, 0x8a, 0x7f, 0x04, 0x97, 0x71, 0x9e,
1499                 0xbc, 0x2e, 0x6b, 0xd9, 0x33, 0xc8, 0x20, 0xc9,
1500                 0xe0, 0x25, 0x86, 0x59, 0x15, 0xcf, 0x63, 0xe5,
1501                 0x99, 0xf1, 0x24, 0xf1, 0xba, 0xc4, 0x15, 0x02,
1502                 0xe2, 0xdb, 0xfe, 0x4a, 0xf8, 0x3b, 0x91, 0x13,
1503                 0x8d, 0x03, 0x81, 0x9f, 0xb3, 0x3f, 0x04, 0x03,
1504                 0x58, 0xc0, 0xef, 0x27, 0x82, 0x14, 0xd2, 0x7f,
1505                 0x93, 0x70, 0xb7, 0xb2, 0x02, 0x21, 0xb3, 0x07,
1506                 0x7f, 0x1c, 0xef, 0x88, 0xee, 0x29, 0x7a, 0x0b,
1507                 0x3d, 0x75, 0x5a, 0x93, 0xfe, 0x7f, 0x14, 0xf7,
1508                 0x4e, 0x4b, 0x7f, 0x21, 0x02, 0xad, 0xf9, 0x43,
1509                 0x29, 0x1a, 0xe8, 0x1b, 0xf5, 0x32, 0xb2, 0x96,
1510                 0xe6, 0xe8, 0x96, 0x20, 0x9b, 0x96, 0x8e, 0x7b,
1511                 0xfe, 0xd8, 0xc9, 0x9c, 0x65, 0x16, 0xd6, 0x68,
1512                 0x95, 0xf8, 0x22, 0xe2, 0xae, 0x84, 0x03, 0xfd,
1513                 0x87, 0xa2, 0x72, 0x79, 0x74, 0x95, 0xfa, 0xe1,
1514                 0xfe, 0xd0, 0x4e, 0x3d, 0x39, 0x2e, 0x67, 0x55,
1515                 0x71, 0x6c, 0x89, 0x33, 0x49, 0x0c, 0x1b, 0x46,
1516                 0x92, 0x31, 0x6f, 0xa6, 0xf0, 0x09, 0xbd, 0x2d,
1517                 0xe2, 0xca, 0xda, 0x18, 0x33, 0xce, 0x67, 0x37,
1518                 0xfd, 0x6f, 0xcb, 0x9d, 0xbd, 0x42, 0xbc, 0xb2,
1519                 0x9c, 0x28, 0xcd, 0x65, 0x3c, 0x61, 0xbc, 0xde,
1520                 0x9d, 0xe1, 0x2a, 0x3e, 0xbf, 0xee, 0x3c, 0xcb,
1521                 0xb1, 0x50, 0xa9, 0x2c, 0xbe, 0xb5, 0x43, 0xd0,
1522                 0xec, 0x29, 0xf9, 0x16, 0x6f, 0x31, 0xd9, 0x9b,
1523                 0x92, 0xb1, 0x32, 0xae, 0x0f, 0xb6, 0x9d, 0x0e,
1524                 0x25, 0x7f, 0x89, 0x1f, 0x1d, 0x01, 0x68, 0xab,
1525                 0x3d, 0xd1, 0x74, 0x5b, 0x4c, 0x38, 0x7f, 0x3d,
1526                 0x33, 0xa5, 0xa2, 0x9f, 0xda, 0x84, 0xa5, 0x82,
1527                 0x2d, 0x16, 0x66, 0x46, 0x08, 0x30, 0x14, 0x48,
1528                 0x5e, 0xca, 0xe3, 0xf4, 0x8c, 0xcb, 0x32, 0xc6,
1529                 0xf1, 0x43, 0x62, 0xc6, 0xef, 0x16, 0xfa, 0x43,
1530                 0xae, 0x9c, 0x53, 0xe3, 0x49, 0x45, 0x80, 0xfd,
1531                 0x1d, 0x8c, 0xa9, 0x6d, 0x77, 0x76, 0xaa, 0x40,
1532                 0xc4, 0x4e, 0x7b, 0x78, 0x6b, 0xe0, 0x1d, 0xce,
1533                 0x56, 0x3d, 0xf0, 0x11, 0xfe, 0x4f, 0x6a, 0x6d,
1534                 0x0f, 0x4f, 0x90, 0x38, 0x92, 0x17, 0xfa, 0x56,
1535                 0x12, 0xa6, 0xa1, 0x0a, 0xea, 0x2f, 0x50, 0xf9,
1536                 0x60, 0x66, 0x6c, 0x7d, 0x5a, 0x08, 0x8e, 0x3c,
1537                 0xf3, 0xf0, 0x33, 0x02, 0x11, 0x02, 0xfe, 0x4c,
1538                 0x56, 0x2b, 0x9f, 0x0c, 0xbd, 0x65, 0x8a, 0x83,
1539                 0xde, 0x7c, 0x05, 0x26, 0x93, 0x19, 0xcc, 0xf3,
1540                 0x71, 0x0e, 0xad, 0x2f, 0xb3, 0xc9, 0x38, 0x50,
1541                 0x64, 0xd5, 0x4c, 0x60, 0x5f, 0x02, 0x13, 0x34,
1542                 0xc9, 0x75, 0xc4, 0x60, 0xab, 0x2e, 0x17, 0x7d
1543 };
1544
1545 static const uint8_t AES_CBC_ciphertext_2048B[] = {
1546                 0x8b, 0x55, 0xbd, 0xfd, 0x2b, 0x35, 0x76, 0x5c,
1547                 0xd1, 0x90, 0xd7, 0x6a, 0x63, 0x1e, 0x39, 0x71,
1548                 0x0d, 0x5c, 0xd8, 0x03, 0x00, 0x75, 0xf1, 0x07,
1549                 0x03, 0x8d, 0x76, 0xeb, 0x3b, 0x00, 0x1e, 0x33,
1550                 0x88, 0xfc, 0x8f, 0x08, 0x4d, 0x33, 0xf1, 0x3c,
1551                 0xee, 0xd0, 0x5d, 0x19, 0x8b, 0x3c, 0x50, 0x86,
1552                 0xfd, 0x8d, 0x58, 0x21, 0xb4, 0xae, 0x0f, 0x81,
1553                 0xe9, 0x9f, 0xc9, 0xc0, 0x90, 0xf7, 0x04, 0x6f,
1554                 0x39, 0x1d, 0x8a, 0x3f, 0x8d, 0x32, 0x23, 0xb5,
1555                 0x1f, 0xcc, 0x8a, 0x12, 0x2d, 0x46, 0x82, 0x5e,
1556                 0x6a, 0x34, 0x8c, 0xb1, 0x93, 0x70, 0x3b, 0xde,
1557                 0x55, 0xaf, 0x16, 0x35, 0x99, 0x84, 0xd5, 0x88,
1558                 0xc9, 0x54, 0xb1, 0xb2, 0xd3, 0xeb, 0x9e, 0x55,
1559                 0x9a, 0xa9, 0xa7, 0xf5, 0xda, 0x29, 0xcf, 0xe1,
1560                 0x98, 0x64, 0x45, 0x77, 0xf2, 0x12, 0x69, 0x8f,
1561                 0x78, 0xd8, 0x82, 0x41, 0xb2, 0x9f, 0xe2, 0x1c,
1562                 0x63, 0x9b, 0x24, 0x81, 0x67, 0x95, 0xa2, 0xff,
1563                 0x26, 0x9d, 0x65, 0x48, 0x61, 0x30, 0x66, 0x41,
1564                 0x68, 0x84, 0xbb, 0x59, 0x14, 0x8e, 0x9a, 0x62,
1565                 0xb6, 0xca, 0xda, 0xbe, 0x7c, 0x41, 0x52, 0x6e,
1566                 0x1b, 0x86, 0xbf, 0x08, 0xeb, 0x37, 0x84, 0x60,
1567                 0xe4, 0xc4, 0x1e, 0xa8, 0x4c, 0x84, 0x60, 0x2f,
1568                 0x70, 0x90, 0xf2, 0x26, 0xe7, 0x65, 0x0c, 0xc4,
1569                 0x58, 0x36, 0x8e, 0x4d, 0xdf, 0xff, 0x9a, 0x39,
1570                 0x93, 0x01, 0xcf, 0x6f, 0x6d, 0xde, 0xef, 0x79,
1571                 0xb0, 0xce, 0xe2, 0x98, 0xdb, 0x85, 0x8d, 0x62,
1572                 0x9d, 0xb9, 0x63, 0xfd, 0xf0, 0x35, 0xb5, 0xa9,
1573                 0x1b, 0xf9, 0xe5, 0xd4, 0x2e, 0x22, 0x2d, 0xcc,
1574                 0x42, 0xbf, 0x0e, 0x51, 0xf7, 0x15, 0x07, 0x32,
1575                 0x75, 0x5b, 0x74, 0xbb, 0x00, 0xef, 0xd4, 0x66,
1576                 0x8b, 0xad, 0x71, 0x53, 0x94, 0xd7, 0x7d, 0x2c,
1577                 0x40, 0x3e, 0x69, 0xa0, 0x4c, 0x86, 0x5e, 0x06,
1578                 0xed, 0xdf, 0x22, 0xe2, 0x24, 0x25, 0x4e, 0x9b,
1579                 0x5f, 0x49, 0x74, 0xba, 0xed, 0xb1, 0xa6, 0xeb,
1580                 0xae, 0x3f, 0xc6, 0x9e, 0x0b, 0x29, 0x28, 0x9a,
1581                 0xb6, 0xb2, 0x74, 0x58, 0xec, 0xa6, 0x4a, 0xed,
1582                 0xe5, 0x10, 0x00, 0x85, 0xe1, 0x63, 0x41, 0x61,
1583                 0x30, 0x7c, 0x97, 0xcf, 0x75, 0xcf, 0xb6, 0xf3,
1584                 0xf7, 0xda, 0x35, 0x3f, 0x85, 0x8c, 0x64, 0xca,
1585                 0xb7, 0xea, 0x7f, 0xe4, 0xa3, 0x4d, 0x30, 0x84,
1586                 0x8c, 0x9c, 0x80, 0x5a, 0x50, 0xa5, 0x64, 0xae,
1587                 0x26, 0xd3, 0xb5, 0x01, 0x73, 0x36, 0x8a, 0x92,
1588                 0x49, 0xc4, 0x1a, 0x94, 0x81, 0x9d, 0xf5, 0x6c,
1589                 0x50, 0xe1, 0x58, 0x0b, 0x75, 0xdd, 0x6b, 0x6a,
1590                 0xca, 0x69, 0xea, 0xc3, 0x33, 0x90, 0x9f, 0x3b,
1591                 0x65, 0x5d, 0x5e, 0xee, 0x31, 0xb7, 0x32, 0xfd,
1592                 0x56, 0x83, 0xb6, 0xfb, 0xa8, 0x04, 0xfc, 0x1e,
1593                 0x11, 0xfb, 0x02, 0x23, 0x53, 0x49, 0x45, 0xb1,
1594                 0x07, 0xfc, 0xba, 0xe7, 0x5f, 0x5d, 0x2d, 0x7f,
1595                 0x9e, 0x46, 0xba, 0xe9, 0xb0, 0xdb, 0x32, 0x04,
1596                 0xa4, 0xa7, 0x98, 0xab, 0x91, 0xcd, 0x02, 0x05,
1597                 0xf5, 0x74, 0x31, 0x98, 0x83, 0x3d, 0x33, 0x11,
1598                 0x0e, 0xe3, 0x8d, 0xa8, 0xc9, 0x0e, 0xf3, 0xb9,
1599                 0x47, 0x67, 0xe9, 0x79, 0x2b, 0x34, 0xcd, 0x9b,
1600                 0x45, 0x75, 0x29, 0xf0, 0xbf, 0xcc, 0xda, 0x3a,
1601                 0x91, 0xb2, 0x15, 0x27, 0x7a, 0xe5, 0xf5, 0x6a,
1602                 0x5e, 0xbe, 0x2c, 0x98, 0xe8, 0x40, 0x96, 0x4f,
1603                 0x8a, 0x09, 0xfd, 0xf6, 0xb2, 0xe7, 0x45, 0xb6,
1604                 0x08, 0xc1, 0x69, 0xe1, 0xb3, 0xc4, 0x24, 0x34,
1605                 0x07, 0x85, 0xd5, 0xa9, 0x78, 0xca, 0xfa, 0x4b,
1606                 0x01, 0x19, 0x4d, 0x95, 0xdc, 0xa5, 0xc1, 0x9c,
1607                 0xec, 0x27, 0x5b, 0xa6, 0x54, 0x25, 0xbd, 0xc8,
1608                 0x0a, 0xb7, 0x11, 0xfb, 0x4e, 0xeb, 0x65, 0x2e,
1609                 0xe1, 0x08, 0x9c, 0x3a, 0x45, 0x44, 0x33, 0xef,
1610                 0x0d, 0xb9, 0xff, 0x3e, 0x68, 0x9c, 0x61, 0x2b,
1611                 0x11, 0xb8, 0x5c, 0x47, 0x0f, 0x94, 0xf2, 0xf8,
1612                 0x0b, 0xbb, 0x99, 0x18, 0x85, 0xa3, 0xba, 0x44,
1613                 0xf3, 0x79, 0xb3, 0x63, 0x2c, 0x1f, 0x2a, 0x35,
1614                 0x3b, 0x23, 0x98, 0xab, 0xf4, 0x16, 0x36, 0xf8,
1615                 0xde, 0x86, 0xa4, 0xd4, 0x75, 0xff, 0x51, 0xf9,
1616                 0xeb, 0x42, 0x5f, 0x55, 0xe2, 0xbe, 0xd1, 0x5b,
1617                 0xb5, 0x38, 0xeb, 0xb4, 0x4d, 0xec, 0xec, 0x99,
1618                 0xe1, 0x39, 0x43, 0xaa, 0x64, 0xf7, 0xc9, 0xd8,
1619                 0xf2, 0x9a, 0x71, 0x43, 0x39, 0x17, 0xe8, 0xa8,
1620                 0xa2, 0xe2, 0xa4, 0x2c, 0x18, 0x11, 0x49, 0xdf,
1621                 0x18, 0xdd, 0x85, 0x6e, 0x65, 0x96, 0xe2, 0xba,
1622                 0xa1, 0x0a, 0x2c, 0xca, 0xdc, 0x5f, 0xe4, 0xf4,
1623                 0x35, 0x03, 0xb2, 0xa9, 0xda, 0xcf, 0xb7, 0x6d,
1624                 0x65, 0x82, 0x82, 0x67, 0x9d, 0x0e, 0xf3, 0xe8,
1625                 0x85, 0x6c, 0x69, 0xb8, 0x4c, 0xa6, 0xc6, 0x2e,
1626                 0x40, 0xb5, 0x54, 0x28, 0x95, 0xe4, 0x57, 0xe0,
1627                 0x5b, 0xf8, 0xde, 0x59, 0xe0, 0xfd, 0x89, 0x48,
1628                 0xac, 0x56, 0x13, 0x54, 0xb9, 0x1b, 0xf5, 0x59,
1629                 0x97, 0xb6, 0xb3, 0xe8, 0xac, 0x2d, 0xfc, 0xd2,
1630                 0xea, 0x57, 0x96, 0x57, 0xa8, 0x26, 0x97, 0x2c,
1631                 0x01, 0x89, 0x56, 0xea, 0xec, 0x8c, 0x53, 0xd5,
1632                 0xd7, 0x9e, 0xc9, 0x98, 0x0b, 0xad, 0x03, 0x75,
1633                 0xa0, 0x6e, 0x98, 0x8b, 0x97, 0x8d, 0x8d, 0x85,
1634                 0x7d, 0x74, 0xa7, 0x2d, 0xde, 0x67, 0x0c, 0xcd,
1635                 0x54, 0xb8, 0x15, 0x7b, 0xeb, 0xf5, 0x84, 0xb9,
1636                 0x78, 0xab, 0xd8, 0x68, 0x91, 0x1f, 0x6a, 0xa6,
1637                 0x28, 0x22, 0xf7, 0x00, 0x49, 0x00, 0xbe, 0x41,
1638                 0x71, 0x0a, 0xf5, 0xe7, 0x9f, 0xb4, 0x11, 0x41,
1639                 0x3f, 0xcd, 0xa9, 0xa9, 0x01, 0x8b, 0x6a, 0xeb,
1640                 0x54, 0x4c, 0x58, 0x92, 0x68, 0x02, 0x0e, 0xe9,
1641                 0xed, 0x65, 0x4c, 0xfb, 0x95, 0x48, 0x58, 0xa2,
1642                 0xaa, 0x57, 0x69, 0x13, 0x82, 0x0c, 0x2c, 0x4b,
1643                 0x5d, 0x4e, 0x18, 0x30, 0xef, 0x1c, 0xb1, 0x9d,
1644                 0x05, 0x05, 0x02, 0x1c, 0x97, 0xc9, 0x48, 0xfe,
1645                 0x5e, 0x7b, 0x77, 0xa3, 0x1f, 0x2a, 0x81, 0x42,
1646                 0xf0, 0x4b, 0x85, 0x12, 0x9c, 0x1f, 0x44, 0xb1,
1647                 0x14, 0x91, 0x92, 0x65, 0x77, 0xb1, 0x87, 0xa2,
1648                 0xfc, 0xa4, 0xe7, 0xd2, 0x9b, 0xf2, 0x17, 0xf0,
1649                 0x30, 0x1c, 0x8d, 0x33, 0xbc, 0x25, 0x28, 0x48,
1650                 0xfd, 0x30, 0x79, 0x0a, 0x99, 0x3e, 0xb4, 0x0f,
1651                 0x1e, 0xa6, 0x68, 0x76, 0x19, 0x76, 0x29, 0xac,
1652                 0x5d, 0xb8, 0x1e, 0x42, 0xd6, 0x85, 0x04, 0xbf,
1653                 0x64, 0x1c, 0x2d, 0x53, 0xe9, 0x92, 0x78, 0xf8,
1654                 0xc3, 0xda, 0x96, 0x92, 0x10, 0x6f, 0x45, 0x85,
1655                 0xaf, 0x5e, 0xcc, 0xa8, 0xc0, 0xc6, 0x2e, 0x73,
1656                 0x51, 0x3f, 0x5e, 0xd7, 0x52, 0x33, 0x71, 0x12,
1657                 0x6d, 0x85, 0xee, 0xea, 0x85, 0xa8, 0x48, 0x2b,
1658                 0x40, 0x64, 0x6d, 0x28, 0x73, 0x16, 0xd7, 0x82,
1659                 0xd9, 0x90, 0xed, 0x1f, 0xa7, 0x5c, 0xb1, 0x5c,
1660                 0x27, 0xb9, 0x67, 0x8b, 0xb4, 0x17, 0x13, 0x83,
1661                 0x5f, 0x09, 0x72, 0x0a, 0xd7, 0xa0, 0xec, 0x81,
1662                 0x59, 0x19, 0xb9, 0xa6, 0x5a, 0x37, 0x34, 0x14,
1663                 0x47, 0xf6, 0xe7, 0x6c, 0xd2, 0x09, 0x10, 0xe7,
1664                 0xdd, 0xbb, 0x02, 0xd1, 0x28, 0xfa, 0x01, 0x2c,
1665                 0x93, 0x64, 0x2e, 0x1b, 0x4c, 0x02, 0x52, 0xcb,
1666                 0x07, 0xa1, 0xb6, 0x46, 0x02, 0x80, 0xd9, 0x8f,
1667                 0x5c, 0x62, 0xbe, 0x78, 0x9e, 0x75, 0xc4, 0x97,
1668                 0x91, 0x39, 0x12, 0x65, 0xb9, 0x3b, 0xc2, 0xd1,
1669                 0xaf, 0xf2, 0x1f, 0x4e, 0x4d, 0xd1, 0xf0, 0x9f,
1670                 0xb7, 0x12, 0xfd, 0xe8, 0x75, 0x18, 0xc0, 0x9d,
1671                 0x8c, 0x70, 0xff, 0x77, 0x05, 0xb6, 0x1a, 0x1f,
1672                 0x96, 0x48, 0xf6, 0xfe, 0xd5, 0x5d, 0x98, 0xa5,
1673                 0x72, 0x1c, 0x84, 0x76, 0x3e, 0xb8, 0x87, 0x37,
1674                 0xdd, 0xd4, 0x3a, 0x45, 0xdd, 0x09, 0xd8, 0xe7,
1675                 0x09, 0x2f, 0x3e, 0x33, 0x9e, 0x7b, 0x8c, 0xe4,
1676                 0x85, 0x12, 0x4e, 0xf8, 0x06, 0xb7, 0xb1, 0x85,
1677                 0x24, 0x96, 0xd8, 0xfe, 0x87, 0x92, 0x81, 0xb1,
1678                 0xa3, 0x38, 0xb9, 0x56, 0xe1, 0xf6, 0x36, 0x41,
1679                 0xbb, 0xd6, 0x56, 0x69, 0x94, 0x57, 0xb3, 0xa4,
1680                 0xca, 0xa4, 0xe1, 0x02, 0x3b, 0x96, 0x71, 0xe0,
1681                 0xb2, 0x2f, 0x85, 0x48, 0x1b, 0x4a, 0x41, 0x80,
1682                 0x4b, 0x9c, 0xe0, 0xc9, 0x39, 0xb8, 0xb1, 0xca,
1683                 0x64, 0x77, 0x46, 0x58, 0xe6, 0x84, 0xd5, 0x2b,
1684                 0x65, 0xce, 0xe9, 0x09, 0xa3, 0xaa, 0xfb, 0x83,
1685                 0xa9, 0x28, 0x68, 0xfd, 0xcd, 0xfd, 0x76, 0x83,
1686                 0xe1, 0x20, 0x22, 0x77, 0x3a, 0xa3, 0xb2, 0x93,
1687                 0x14, 0x91, 0xfc, 0xe2, 0x17, 0x63, 0x2b, 0xa6,
1688                 0x29, 0x38, 0x7b, 0x9b, 0x8b, 0x15, 0x77, 0xd6,
1689                 0xaa, 0x92, 0x51, 0x53, 0x50, 0xff, 0xa0, 0x35,
1690                 0xa0, 0x59, 0x7d, 0xf0, 0x11, 0x23, 0x49, 0xdf,
1691                 0x5a, 0x21, 0xc2, 0xfe, 0x35, 0xa0, 0x1d, 0xe2,
1692                 0xae, 0xa2, 0x8a, 0x61, 0x5b, 0xf7, 0xf1, 0x1c,
1693                 0x1c, 0xec, 0xc4, 0xf6, 0xdc, 0xaa, 0xc8, 0xc2,
1694                 0xe5, 0xa1, 0x2e, 0x14, 0xe5, 0xc6, 0xc9, 0x73,
1695                 0x03, 0x78, 0xeb, 0xed, 0xe0, 0x3e, 0xc5, 0xf4,
1696                 0xf1, 0x50, 0xb2, 0x01, 0x91, 0x96, 0xf5, 0xbb,
1697                 0xe1, 0x32, 0xcd, 0xa8, 0x66, 0xbf, 0x73, 0x85,
1698                 0x94, 0xd6, 0x7e, 0x68, 0xc5, 0xe4, 0xed, 0xd5,
1699                 0xe3, 0x67, 0x4c, 0xa5, 0xb3, 0x1f, 0xdf, 0xf8,
1700                 0xb3, 0x73, 0x5a, 0xac, 0xeb, 0x46, 0x16, 0x24,
1701                 0xab, 0xca, 0xa4, 0xdd, 0x87, 0x0e, 0x24, 0x83,
1702                 0x32, 0x04, 0x4c, 0xd8, 0xda, 0x7d, 0xdc, 0xe3,
1703                 0x01, 0x93, 0xf3, 0xc1, 0x5b, 0xbd, 0xc3, 0x1d,
1704                 0x40, 0x62, 0xde, 0x94, 0x03, 0x85, 0x91, 0x2a,
1705                 0xa0, 0x25, 0x10, 0xd3, 0x32, 0x9f, 0x93, 0x00,
1706                 0xa7, 0x8a, 0xfa, 0x77, 0x7c, 0xaf, 0x4d, 0xc8,
1707                 0x7a, 0xf3, 0x16, 0x2b, 0xba, 0xeb, 0x74, 0x51,
1708                 0xb8, 0xdd, 0x32, 0xad, 0x68, 0x7d, 0xdd, 0xca,
1709                 0x60, 0x98, 0xc9, 0x9b, 0xb6, 0x5d, 0x4d, 0x3a,
1710                 0x66, 0x8a, 0xbe, 0x05, 0xf9, 0x0c, 0xc5, 0xba,
1711                 0x52, 0x82, 0x09, 0x1f, 0x5a, 0x66, 0x89, 0x69,
1712                 0xa3, 0x5d, 0x93, 0x50, 0x7d, 0x44, 0xc3, 0x2a,
1713                 0xb8, 0xab, 0xec, 0xa6, 0x5a, 0xae, 0x4a, 0x6a,
1714                 0xcd, 0xfd, 0xb6, 0xff, 0x3d, 0x98, 0x05, 0xd9,
1715                 0x5b, 0x29, 0xc4, 0x6f, 0xe0, 0x76, 0xe2, 0x3f,
1716                 0xec, 0xd7, 0xa4, 0x91, 0x63, 0xf5, 0x4e, 0x4b,
1717                 0xab, 0x20, 0x8c, 0x3a, 0x41, 0xed, 0x8b, 0x4b,
1718                 0xb9, 0x01, 0x21, 0xc0, 0x6d, 0xfd, 0x70, 0x5b,
1719                 0x20, 0x92, 0x41, 0x89, 0x74, 0xb7, 0xe9, 0x8b,
1720                 0xfc, 0x6d, 0x17, 0x3f, 0x7f, 0x89, 0x3d, 0x6b,
1721                 0x8f, 0xbc, 0xd2, 0x57, 0xe9, 0xc9, 0x6e, 0xa7,
1722                 0x19, 0x26, 0x18, 0xad, 0xef, 0xb5, 0x87, 0xbf,
1723                 0xb8, 0xa8, 0xd6, 0x7d, 0xdd, 0x5f, 0x94, 0x54,
1724                 0x09, 0x92, 0x2b, 0xf5, 0x04, 0xf7, 0x36, 0x69,
1725                 0x8e, 0xf4, 0xdc, 0x1d, 0x6e, 0x55, 0xbb, 0xe9,
1726                 0x13, 0x05, 0x83, 0x35, 0x9c, 0xed, 0xcf, 0x8c,
1727                 0x26, 0x8c, 0x7b, 0xc7, 0x0b, 0xba, 0xfd, 0xe2,
1728                 0x84, 0x5c, 0x2a, 0x79, 0x43, 0x99, 0xb2, 0xc3,
1729                 0x82, 0x87, 0xc8, 0xcd, 0x37, 0x6d, 0xa1, 0x2b,
1730                 0x39, 0xb2, 0x38, 0x99, 0xd9, 0xfc, 0x02, 0x15,
1731                 0x55, 0x21, 0x62, 0x59, 0xeb, 0x00, 0x86, 0x08,
1732                 0x20, 0xbe, 0x1a, 0x62, 0x4d, 0x7e, 0xdf, 0x68,
1733                 0x73, 0x5b, 0x5f, 0xaf, 0x84, 0x96, 0x2e, 0x1f,
1734                 0x6b, 0x03, 0xc9, 0xa6, 0x75, 0x18, 0xe9, 0xd4,
1735                 0xbd, 0xc8, 0xec, 0x9a, 0x5a, 0xb3, 0x99, 0xab,
1736                 0x5f, 0x7c, 0x08, 0x7f, 0x69, 0x4d, 0x52, 0xa2,
1737                 0x30, 0x17, 0x3b, 0x16, 0x15, 0x1b, 0x11, 0x62,
1738                 0x3e, 0x80, 0x4b, 0x85, 0x7c, 0x9c, 0xd1, 0x3a,
1739                 0x13, 0x01, 0x5e, 0x45, 0xf1, 0xc8, 0x5f, 0xcd,
1740                 0x0e, 0x21, 0xf5, 0x82, 0xd4, 0x7b, 0x5c, 0x45,
1741                 0x27, 0x6b, 0xef, 0xfe, 0xb8, 0xc0, 0x6f, 0xdc,
1742                 0x60, 0x7b, 0xe4, 0xd5, 0x75, 0x71, 0xe6, 0xe8,
1743                 0x7d, 0x6b, 0x6d, 0x80, 0xaf, 0x76, 0x41, 0x58,
1744                 0xb7, 0xac, 0xb7, 0x13, 0x2f, 0x81, 0xcc, 0xf9,
1745                 0x19, 0x97, 0xe8, 0xee, 0x40, 0x91, 0xfc, 0x89,
1746                 0x13, 0x1e, 0x67, 0x9a, 0xdb, 0x8f, 0x8f, 0xc7,
1747                 0x4a, 0xc9, 0xaf, 0x2f, 0x67, 0x01, 0x3c, 0xb8,
1748                 0xa8, 0x3e, 0x78, 0x93, 0x1b, 0xdf, 0xbb, 0x34,
1749                 0x0b, 0x1a, 0xfa, 0xc2, 0x2d, 0xc5, 0x1c, 0xec,
1750                 0x97, 0x4f, 0x48, 0x41, 0x15, 0x0e, 0x75, 0xed,
1751                 0x66, 0x8c, 0x17, 0x7f, 0xb1, 0x48, 0x13, 0xc1,
1752                 0xfb, 0x60, 0x06, 0xf9, 0x72, 0x41, 0x3e, 0xcf,
1753                 0x6e, 0xb6, 0xc8, 0xeb, 0x4b, 0x5a, 0xd2, 0x0c,
1754                 0x28, 0xda, 0x02, 0x7a, 0x46, 0x21, 0x42, 0xb5,
1755                 0x34, 0xda, 0xcb, 0x5e, 0xbd, 0x66, 0x5c, 0xca,
1756                 0xff, 0x52, 0x43, 0x89, 0xf9, 0x10, 0x9a, 0x9e,
1757                 0x9b, 0xe3, 0xb0, 0x51, 0xe9, 0xf3, 0x0a, 0x35,
1758                 0x77, 0x54, 0xcc, 0xac, 0xa6, 0xf1, 0x2e, 0x36,
1759                 0x89, 0xac, 0xc5, 0xc6, 0x62, 0x5a, 0xc0, 0x6d,
1760                 0xc4, 0xe1, 0xf7, 0x64, 0x30, 0xff, 0x11, 0x40,
1761                 0x13, 0x89, 0xd8, 0xd7, 0x73, 0x3f, 0x93, 0x08,
1762                 0x68, 0xab, 0x66, 0x09, 0x1a, 0xea, 0x78, 0xc9,
1763                 0x52, 0xf2, 0xfd, 0x93, 0x1b, 0x94, 0xbe, 0x5c,
1764                 0xe5, 0x00, 0x6e, 0x00, 0xb9, 0xea, 0x27, 0xaa,
1765                 0xb3, 0xee, 0xe3, 0xc8, 0x6a, 0xb0, 0xc1, 0x8e,
1766                 0x9b, 0x54, 0x40, 0x10, 0x96, 0x06, 0xe8, 0xb3,
1767                 0xf5, 0x55, 0x77, 0xd7, 0x5c, 0x94, 0xc1, 0x74,
1768                 0xf3, 0x07, 0x64, 0xac, 0x1c, 0xde, 0xc7, 0x22,
1769                 0xb0, 0xbf, 0x2a, 0x5a, 0xc0, 0x8f, 0x8a, 0x83,
1770                 0x50, 0xc2, 0x5e, 0x97, 0xa0, 0xbe, 0x49, 0x7e,
1771                 0x47, 0xaf, 0xa7, 0x20, 0x02, 0x35, 0xa4, 0x57,
1772                 0xd9, 0x26, 0x63, 0xdb, 0xf1, 0x34, 0x42, 0x89,
1773                 0x36, 0xd1, 0x77, 0x6f, 0xb1, 0xea, 0x79, 0x7e,
1774                 0x95, 0x10, 0x5a, 0xee, 0xa3, 0xae, 0x6f, 0xba,
1775                 0xa9, 0xef, 0x5a, 0x7e, 0x34, 0x03, 0x04, 0x07,
1776                 0x92, 0xd6, 0x07, 0x79, 0xaa, 0x14, 0x90, 0x97,
1777                 0x05, 0x4d, 0xa6, 0x27, 0x10, 0x5c, 0x25, 0x24,
1778                 0xcb, 0xcc, 0xf6, 0x77, 0x9e, 0x43, 0x23, 0xd4,
1779                 0x98, 0xef, 0x22, 0xa8, 0xad, 0xf2, 0x26, 0x08,
1780                 0x59, 0x69, 0xa4, 0xc3, 0x97, 0xe0, 0x5c, 0x6f,
1781                 0xeb, 0x3d, 0xd4, 0x62, 0x6e, 0x80, 0x61, 0x02,
1782                 0xf4, 0xfc, 0x94, 0x79, 0xbb, 0x4e, 0x6d, 0xd7,
1783                 0x30, 0x5b, 0x10, 0x11, 0x5a, 0x3d, 0xa7, 0x50,
1784                 0x1d, 0x9a, 0x13, 0x5f, 0x4f, 0xa8, 0xa7, 0xb6,
1785                 0x39, 0xc7, 0xea, 0xe6, 0x19, 0x61, 0x69, 0xc7,
1786                 0x9a, 0x3a, 0xeb, 0x9d, 0xdc, 0xf7, 0x06, 0x37,
1787                 0xbd, 0xac, 0xe3, 0x18, 0xff, 0xfe, 0x11, 0xdb,
1788                 0x67, 0x42, 0xb4, 0xea, 0xa8, 0xbd, 0xb0, 0x76,
1789                 0xd2, 0x74, 0x32, 0xc2, 0xa4, 0x9c, 0xe7, 0x60,
1790                 0xc5, 0x30, 0x9a, 0x57, 0x66, 0xcd, 0x0f, 0x02,
1791                 0x4c, 0xea, 0xe9, 0xd3, 0x2a, 0x5c, 0x09, 0xc2,
1792                 0xff, 0x6a, 0xde, 0x5d, 0xb7, 0xe9, 0x75, 0x6b,
1793                 0x29, 0x94, 0xd6, 0xf7, 0xc3, 0xdf, 0xfb, 0x70,
1794                 0xec, 0xb5, 0x8c, 0xb0, 0x78, 0x7a, 0xee, 0x52,
1795                 0x5f, 0x8c, 0xae, 0x85, 0xe5, 0x98, 0xa2, 0xb7,
1796                 0x7c, 0x02, 0x2a, 0xcc, 0x9e, 0xde, 0x99, 0x5f,
1797                 0x84, 0x20, 0xbb, 0xdc, 0xf2, 0xd2, 0x13, 0x46,
1798                 0x3c, 0xd6, 0x4d, 0xe7, 0x50, 0xef, 0x55, 0xc3,
1799                 0x96, 0x9f, 0xec, 0x6c, 0xd8, 0xe2, 0xea, 0xed,
1800                 0xc7, 0x33, 0xc9, 0xb3, 0x1c, 0x4f, 0x1d, 0x83,
1801                 0x1d, 0xe4, 0xdd, 0xb2, 0x24, 0x8f, 0xf9, 0xf5
1802 };
1803
1804
1805 static const uint8_t HMAC_SHA256_ciphertext_64B_digest[] = {
1806                 0xc5, 0x6d, 0x4f, 0x29, 0xf4, 0xd2, 0xcc, 0x87,
1807                 0x3c, 0x81, 0x02, 0x6d, 0x38, 0x7a, 0x67, 0x3e,
1808                 0x95, 0x9c, 0x5c, 0x8f, 0xda, 0x5c, 0x06, 0xe0,
1809                 0x65, 0xf1, 0x6c, 0x51, 0x52, 0x49, 0x3e, 0x5f
1810 };
1811
1812 static const uint8_t HMAC_SHA256_ciphertext_128B_digest[] = {
1813                 0x76, 0x64, 0x2d, 0x69, 0x71, 0x5d, 0x6a, 0xd8,
1814                 0x9f, 0x74, 0x11, 0x2f, 0x58, 0xe0, 0x4a, 0x2f,
1815                 0x6c, 0x88, 0x5e, 0x4d, 0x9c, 0x79, 0x83, 0x1c,
1816                 0x8a, 0x14, 0xd0, 0x07, 0xfb, 0xbf, 0x6c, 0x8f
1817 };
1818
1819 static const uint8_t HMAC_SHA256_ciphertext_256B_digest[] = {
1820                 0x05, 0xa7, 0x44, 0xcd, 0x91, 0x8c, 0x95, 0xcf,
1821                 0x7b, 0x8f, 0xd3, 0x90, 0x86, 0x7e, 0x7b, 0xb9,
1822                 0x05, 0xd6, 0x6e, 0x7a, 0xc1, 0x7b, 0x26, 0xff,
1823                 0xd3, 0x4b, 0xe0, 0x22, 0x8b, 0xa8, 0x47, 0x52
1824 };
1825
1826 static const uint8_t HMAC_SHA256_ciphertext_512B_digest[] = {
1827                 0x08, 0xb7, 0x29, 0x54, 0x18, 0x7e, 0x97, 0x49,
1828                 0xc6, 0x7c, 0x9f, 0x94, 0xa5, 0x4f, 0xa2, 0x25,
1829                 0xd0, 0xe2, 0x30, 0x7b, 0xad, 0x93, 0xc9, 0x12,
1830                 0x0f, 0xf0, 0xf0, 0x71, 0xc2, 0xf6, 0x53, 0x8f
1831 };
1832
1833 static const uint8_t HMAC_SHA256_ciphertext_768B_digest[] = {
1834                 0xe4, 0x3e, 0x73, 0x93, 0x03, 0xaf, 0x6f, 0x9c,
1835                 0xca, 0x57, 0x3b, 0x4a, 0x6e, 0x83, 0x58, 0xf5,
1836                 0x66, 0xc2, 0xb4, 0xa7, 0xe0, 0xee, 0x63, 0x6b,
1837                 0x48, 0xb7, 0x50, 0x45, 0x69, 0xdf, 0x5c, 0x5b
1838 };
1839
1840 static const uint8_t HMAC_SHA256_ciphertext_1024B_digest[] = {
1841                 0x03, 0xb9, 0x96, 0x26, 0xdc, 0x1c, 0xab, 0xe2,
1842                 0xf5, 0x70, 0x55, 0x15, 0x67, 0x6e, 0x48, 0x11,
1843                 0xe7, 0x67, 0xea, 0xfa, 0x5c, 0x6b, 0x28, 0x22,
1844                 0xc9, 0x0e, 0x67, 0x04, 0xb3, 0x71, 0x7f, 0x88
1845 };
1846
1847 static const uint8_t HMAC_SHA256_ciphertext_1280B_digest[] = {
1848                 0x01, 0x91, 0xb8, 0x78, 0xd3, 0x21, 0x74, 0xa5,
1849                 0x1c, 0x8b, 0xd4, 0xd2, 0xc0, 0x49, 0xd7, 0xd2,
1850                 0x16, 0x46, 0x66, 0x85, 0x50, 0x6d, 0x08, 0xcc,
1851                 0xc7, 0x0a, 0xa3, 0x71, 0xcc, 0xde, 0xee, 0xdc
1852 };
1853
1854 static const uint8_t HMAC_SHA256_ciphertext_1536B_digest[] = {
1855                 0xf2, 0xe5, 0xe9, 0x57, 0x53, 0xd7, 0x69, 0x28,
1856                 0x7b, 0x69, 0xb5, 0x49, 0xa3, 0x31, 0x56, 0x5f,
1857                 0xa4, 0xe9, 0x87, 0x26, 0x2f, 0xe0, 0x2d, 0xd6,
1858                 0x08, 0x44, 0x01, 0x71, 0x0c, 0x93, 0x85, 0x84
1859 };
1860
1861 static const uint8_t HMAC_SHA256_ciphertext_1792B_digest[] = {
1862                 0xf6, 0x57, 0x62, 0x01, 0xbf, 0x2d, 0xea, 0x4a,
1863                 0xef, 0x43, 0x85, 0x60, 0x18, 0xdf, 0x8b, 0xb4,
1864                 0x60, 0xc0, 0xfd, 0x2f, 0x90, 0x15, 0xe6, 0x91,
1865                 0x56, 0x61, 0x68, 0x7f, 0x5e, 0x92, 0xa8, 0xdd
1866 };
1867
1868 static const uint8_t HMAC_SHA256_ciphertext_2048B_digest[] = {
1869                 0x81, 0x1a, 0x29, 0xbc, 0x6b, 0x9f, 0xbb, 0xb8,
1870                 0xef, 0x71, 0x7b, 0x1f, 0x6f, 0xd4, 0x7e, 0x68,
1871                 0x3a, 0x9c, 0xb9, 0x98, 0x22, 0x81, 0xfa, 0x95,
1872                 0xee, 0xbc, 0x7f, 0x23, 0x29, 0x88, 0x76, 0xb8
1873 };
1874
1875 struct crypto_data_params {
1876         const char *name;
1877         uint16_t length;
1878         const char *plaintext;
1879         struct crypto_expected_output {
1880                 const uint8_t *ciphertext;
1881                 const uint8_t *digest;
1882         } expected;
1883 };
1884
1885 #define MAX_PACKET_SIZE_INDEX   10
1886
1887 struct crypto_data_params aes_cbc_hmac_sha256_output[MAX_PACKET_SIZE_INDEX] = {
1888         { "64B", 64, &plaintext_quote[sizeof(plaintext_quote) - 1 - 64],
1889                 { AES_CBC_ciphertext_64B, HMAC_SHA256_ciphertext_64B_digest } },
1890         { "128B", 128, &plaintext_quote[sizeof(plaintext_quote) - 1 - 128],
1891                 { AES_CBC_ciphertext_128B, HMAC_SHA256_ciphertext_128B_digest } },
1892         { "256B", 256, &plaintext_quote[sizeof(plaintext_quote) - 1 - 256],
1893                 { AES_CBC_ciphertext_256B, HMAC_SHA256_ciphertext_256B_digest } },
1894         { "512B", 512, &plaintext_quote[sizeof(plaintext_quote) - 1 - 512],
1895                 { AES_CBC_ciphertext_512B, HMAC_SHA256_ciphertext_512B_digest } },
1896         { "768B", 768, &plaintext_quote[sizeof(plaintext_quote) - 1 - 768],
1897                 { AES_CBC_ciphertext_768B, HMAC_SHA256_ciphertext_768B_digest } },
1898         { "1024B", 1024, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1024],
1899                 { AES_CBC_ciphertext_1024B, HMAC_SHA256_ciphertext_1024B_digest } },
1900         { "1280B", 1280, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1280],
1901                 { AES_CBC_ciphertext_1280B, HMAC_SHA256_ciphertext_1280B_digest } },
1902         { "1536B", 1536, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1536],
1903                 { AES_CBC_ciphertext_1536B, HMAC_SHA256_ciphertext_1536B_digest } },
1904         { "1792B", 1792, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1792],
1905                 { AES_CBC_ciphertext_1792B, HMAC_SHA256_ciphertext_1792B_digest } },
1906         { "2048B", 2048, &plaintext_quote[sizeof(plaintext_quote) - 1 - 2048],
1907                 { AES_CBC_ciphertext_2048B, HMAC_SHA256_ciphertext_2048B_digest } }
1908 };
1909
1910 static int
1911 test_perf_crypto_qp_vary_burst_size(uint16_t dev_num)
1912 {
1913         uint32_t num_to_submit = 4096;
1914         struct rte_crypto_op *c_ops[num_to_submit];
1915         struct rte_crypto_op *proc_ops[num_to_submit];
1916         uint64_t failed_polls, retries, start_cycles, end_cycles, total_cycles = 0;
1917         uint32_t burst_sent, burst_received;
1918         uint32_t i, burst_size, num_sent, num_received;
1919         struct crypto_testsuite_params *ts_params = &testsuite_params;
1920         struct crypto_unittest_params *ut_params = &unittest_params;
1921         struct crypto_data_params *data_params = aes_cbc_hmac_sha256_output;
1922
1923         if (rte_cryptodev_count() == 0) {
1924                 printf("\nNo crypto devices available. Is kernel driver loaded?\n");
1925                 return TEST_FAILED;
1926         }
1927
1928         /* Setup Cipher Parameters */
1929         ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
1930         ut_params->cipher_xform.next = &ut_params->auth_xform;
1931
1932         ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;
1933         ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;
1934         ut_params->cipher_xform.cipher.key.data = aes_cbc_128_key;
1935         ut_params->cipher_xform.cipher.key.length = CIPHER_IV_LENGTH_AES_CBC;
1936
1937
1938         /* Setup HMAC Parameters */
1939         ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
1940         ut_params->auth_xform.next = NULL;
1941
1942         ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
1943         ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA256_HMAC;
1944         ut_params->auth_xform.auth.key.data = hmac_sha256_key;
1945         ut_params->auth_xform.auth.key.length = HMAC_KEY_LENGTH_SHA256;
1946         ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA256;
1947
1948         /* Create Crypto session*/
1949         ut_params->sess = rte_cryptodev_sym_session_create(ts_params->dev_id,
1950                 &ut_params->cipher_xform);
1951
1952         TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
1953
1954         /* Generate Crypto op data structure(s) */
1955         for (i = 0; i < num_to_submit ; i++) {
1956                 struct rte_mbuf *m = setup_test_string(ts_params->mbuf_mp,
1957                                 data_params[0].expected.ciphertext,
1958                                 data_params[0].length, 0);
1959                 TEST_ASSERT_NOT_NULL(m, "Failed to allocate tx_buf");
1960
1961                 ut_params->digest = (uint8_t *)rte_pktmbuf_append(m,
1962                                 DIGEST_BYTE_LENGTH_SHA256);
1963                 TEST_ASSERT_NOT_NULL(ut_params->digest,
1964                                 "no room to append digest");
1965
1966                 rte_memcpy(ut_params->digest, data_params[0].expected.digest,
1967                         DIGEST_BYTE_LENGTH_SHA256);
1968
1969
1970                 struct rte_crypto_op *op =
1971                                 rte_crypto_op_alloc(ts_params->op_mpool,
1972                                                 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
1973
1974                 rte_crypto_op_attach_sym_session(op, ut_params->sess);
1975
1976                 op->sym->auth.digest.data = ut_params->digest;
1977                 op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m,
1978                                 data_params[0].length);
1979                 op->sym->auth.digest.length = DIGEST_BYTE_LENGTH_SHA256;
1980
1981                 op->sym->auth.data.offset = 0;
1982                 op->sym->auth.data.length = data_params[0].length;
1983
1984
1985                 op->sym->cipher.iv.data = rte_crypto_op_ctod_offset(op,
1986                                 uint8_t *, IV_OFFSET);
1987                 op->sym->cipher.iv.phys_addr = rte_crypto_op_ctophys_offset(op,
1988                                 IV_OFFSET);
1989                 op->sym->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC;
1990
1991                 rte_memcpy(op->sym->cipher.iv.data, aes_cbc_128_iv,
1992                                 CIPHER_IV_LENGTH_AES_CBC);
1993
1994                 op->sym->cipher.data.offset = 0;
1995                 op->sym->cipher.data.length = data_params[0].length;
1996
1997                 op->sym->m_src = m;
1998
1999                 c_ops[i] = op;
2000         }
2001
2002         printf("\nTest to measure the IA cycle cost using AES128_CBC_SHA256_HMAC "
2003                         "algorithm with a constant request size of %u.",
2004                         data_params[0].length);
2005         printf("\nThis test will keep retries at 0 and only measure IA cycle "
2006                         "cost for each request.");
2007         printf("\nDev No\tQP No\tNum Sent\tNum Received\tTx/Rx burst");
2008         printf("\tRetries (Device Busy)\tAverage IA cycle cost "
2009                         "(assuming 0 retries)");
2010         for (i = 2; i <= 128 ; i *= 2) {
2011                 num_sent = 0;
2012                 num_received = 0;
2013                 retries = 0;
2014                 failed_polls = 0;
2015                 burst_size = i;
2016                 total_cycles = 0;
2017                 while (num_sent < num_to_submit) {
2018                         start_cycles = rte_rdtsc_precise();
2019                         burst_sent = rte_cryptodev_enqueue_burst(dev_num,
2020                                         0, &c_ops[num_sent],
2021                                         ((num_to_submit-num_sent) < burst_size) ?
2022                                         num_to_submit-num_sent : burst_size);
2023                         if (burst_sent == 0)
2024                                 retries++;
2025                         else
2026                                 num_sent += burst_sent;
2027                         end_cycles = rte_rdtsc_precise();
2028                         total_cycles += (end_cycles - start_cycles);
2029                         /*
2030                          * Wait until requests have been sent.
2031                          */
2032                         rte_delay_ms(1);
2033
2034                         start_cycles = rte_rdtsc_precise();
2035                         burst_received = rte_cryptodev_dequeue_burst(
2036                                         dev_num, 0, proc_ops, burst_size);
2037                         if (burst_received == 0)
2038                                 failed_polls++;
2039                         else
2040                                 num_received += burst_received;
2041                         end_cycles = rte_rdtsc_precise();
2042                         total_cycles += end_cycles - start_cycles;
2043                 }
2044
2045                 while (num_received != num_to_submit) {
2046                         if (gbl_cryptodev_perftest_devtype ==
2047                                         RTE_CRYPTODEV_AESNI_MB_PMD)
2048                                 rte_cryptodev_enqueue_burst(dev_num, 0,
2049                                                 NULL, 0);
2050
2051                         burst_received = rte_cryptodev_dequeue_burst(
2052                                         dev_num, 0, proc_ops, burst_size);
2053                         if (burst_received == 0)
2054                                 failed_polls++;
2055                         else
2056                                 num_received += burst_received;
2057                 }
2058
2059                 printf("\n%u\t%u\t%u\t\t%u\t\t%u", dev_num, 0,
2060                                         num_sent, num_received, burst_size);
2061                 printf("\t\t%"PRIu64, retries);
2062                 printf("\t\t\t%"PRIu64, total_cycles/num_received);
2063         }
2064         printf("\n");
2065
2066         for (i = 0; i < num_to_submit ; i++) {
2067                 rte_pktmbuf_free(c_ops[i]->sym->m_src);
2068                 rte_crypto_op_free(c_ops[i]);
2069         }
2070         return TEST_SUCCESS;
2071 }
2072
2073 static int
2074 test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
2075 {
2076         uint32_t num_to_submit = pparams->total_operations;
2077         struct rte_crypto_op *c_ops[num_to_submit];
2078         struct rte_crypto_op *proc_ops[num_to_submit];
2079         uint64_t failed_polls, retries, start_cycles, end_cycles, total_cycles = 0;
2080         uint32_t burst_sent = 0, burst_received = 0;
2081         uint32_t i, burst_size, num_sent, num_ops_received;
2082         struct crypto_testsuite_params *ts_params = &testsuite_params;
2083         static struct rte_cryptodev_sym_session *sess;
2084
2085         if (rte_cryptodev_count() == 0) {
2086                 printf("\nNo crypto devices found. Is PMD build configured?\n");
2087                 printf("\nAnd is kernel driver loaded for HW PMDs?\n");
2088                 return TEST_FAILED;
2089         }
2090
2091         /* Create Crypto session*/
2092         sess = test_perf_create_snow3g_session(ts_params->dev_id,
2093                         pparams->chain, pparams->cipher_algo,
2094                         pparams->cipher_key_length, pparams->auth_algo);
2095         TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
2096
2097         /* Generate Crypto op data structure(s)*/
2098         for (i = 0; i < num_to_submit ; i++) {
2099                 struct rte_mbuf *m = test_perf_create_pktmbuf(
2100                                                 ts_params->mbuf_mp,
2101                                                 pparams->buf_size);
2102                 TEST_ASSERT_NOT_NULL(m, "Failed to allocate tx_buf");
2103
2104                 struct rte_crypto_op *op =
2105                                 rte_crypto_op_alloc(ts_params->op_mpool,
2106                                                 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
2107                 TEST_ASSERT_NOT_NULL(op, "Failed to allocate op");
2108
2109                 op = test_perf_set_crypto_op_snow3g(op, m, sess, pparams->buf_size,
2110                                         get_auth_digest_length(pparams->auth_algo));
2111                 TEST_ASSERT_NOT_NULL(op, "Failed to attach op to session");
2112
2113                 c_ops[i] = op;
2114         }
2115
2116         printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, auth_algo:%s, "
2117                         "Packet Size %u bytes",
2118                         pmd_name(gbl_cryptodev_perftest_devtype),
2119                         ts_params->dev_id, 0,
2120                         chain_mode_name(pparams->chain),
2121                         rte_crypto_cipher_algorithm_strings[pparams->cipher_algo],
2122                         rte_crypto_auth_algorithm_strings[pparams->auth_algo],
2123                         pparams->buf_size);
2124         printf("\nOps Tx\tOps Rx\tOps/burst  ");
2125         printf("Retries  EmptyPolls\tIACycles/CyOp\tIACycles/Burst\tIACycles/Byte");
2126
2127         for (i = 2; i <= 128 ; i *= 2) {
2128                 num_sent = 0;
2129                 num_ops_received = 0;
2130                 retries = 0;
2131                 failed_polls = 0;
2132                 burst_size = i;
2133                 total_cycles = 0;
2134                 while (num_sent < num_to_submit) {
2135                         start_cycles = rte_rdtsc_precise();
2136                         burst_sent = rte_cryptodev_enqueue_burst(ts_params->dev_id,
2137                                         0, &c_ops[num_sent],
2138                                         ((num_to_submit-num_sent) < burst_size) ?
2139                                         num_to_submit-num_sent : burst_size);
2140                         end_cycles = rte_rdtsc_precise();
2141                         if (burst_sent == 0)
2142                                 retries++;
2143                         num_sent += burst_sent;
2144                         total_cycles += (end_cycles - start_cycles);
2145
2146                         /* Wait until requests have been sent. */
2147
2148                         rte_delay_ms(1);
2149
2150                         start_cycles = rte_rdtsc_precise();
2151                         burst_received = rte_cryptodev_dequeue_burst(
2152                                         ts_params->dev_id, 0, proc_ops, burst_size);
2153                         end_cycles = rte_rdtsc_precise();
2154                         if (burst_received < burst_sent)
2155                                 failed_polls++;
2156                         num_ops_received += burst_received;
2157
2158                         total_cycles += end_cycles - start_cycles;
2159                 }
2160
2161                 while (num_ops_received != num_to_submit) {
2162                         if (gbl_cryptodev_perftest_devtype ==
2163                                         RTE_CRYPTODEV_AESNI_MB_PMD)
2164                                 rte_cryptodev_enqueue_burst(ts_params->dev_id, 0,
2165                                                 NULL, 0);
2166                         start_cycles = rte_rdtsc_precise();
2167                         burst_received = rte_cryptodev_dequeue_burst(
2168                                         ts_params->dev_id, 0, proc_ops, burst_size);
2169                         end_cycles = rte_rdtsc_precise();
2170                         total_cycles += end_cycles - start_cycles;
2171                         if (burst_received == 0)
2172                                 failed_polls++;
2173                         num_ops_received += burst_received;
2174                 }
2175
2176                 printf("\n%u\t%u\t%u", num_sent, num_ops_received, burst_size);
2177                 printf("\t\t%"PRIu64, retries);
2178                 printf("\t%"PRIu64, failed_polls);
2179                 printf("\t\t%"PRIu64, total_cycles/num_ops_received);
2180                 printf("\t\t%"PRIu64, (total_cycles/num_ops_received)*burst_size);
2181                 printf("\t\t%"PRIu64, total_cycles/(num_ops_received*pparams->buf_size));
2182         }
2183         printf("\n");
2184
2185         for (i = 0; i < num_to_submit ; i++) {
2186                 rte_pktmbuf_free(c_ops[i]->sym->m_src);
2187                 rte_crypto_op_free(c_ops[i]);
2188         }
2189         rte_cryptodev_sym_session_free(ts_params->dev_id, sess);
2190
2191         return TEST_SUCCESS;
2192 }
2193
2194 static int
2195 test_perf_snow3G_vary_burst_size(void)
2196 {
2197         unsigned total_operations = 4096;
2198         /*no need to vary pkt size for QAT, should have no effect on IA cycles */
2199         uint16_t buf_lengths[] = {40};
2200         uint8_t i, j;
2201
2202         struct perf_test_params params_set[] = {
2203                         {
2204                                         .chain = CIPHER_ONLY,
2205                                         .cipher_algo  = RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
2206                                         .cipher_key_length = 16,
2207                                         .auth_algo  = RTE_CRYPTO_AUTH_NULL,
2208                         },
2209                         {
2210                                         .chain = HASH_ONLY,
2211                                         .cipher_algo = RTE_CRYPTO_CIPHER_NULL,
2212                                         .auth_algo  = RTE_CRYPTO_AUTH_SNOW3G_UIA2,
2213                                         .cipher_key_length = 16
2214                         },
2215         };
2216
2217         printf("\n\nStart %s.", __func__);
2218         printf("\nThis Test measures the average IA cycle cost using a "
2219                         "constant request(packet) size. ");
2220         printf("Cycle cost is only valid when indicators show device is not busy,"
2221                         " i.e. Retries and EmptyPolls = 0");
2222
2223         for (i = 0; i < RTE_DIM(params_set); i++) {
2224                 printf("\n");
2225                 params_set[i].total_operations = total_operations;
2226
2227                 for (j = 0;
2228                         j < RTE_DIM(buf_lengths);
2229                         j++) {
2230
2231                         params_set[i].buf_size = buf_lengths[j];
2232
2233                         test_perf_snow3G_optimise_cyclecount(&params_set[i]);
2234                 }
2235
2236         }
2237
2238         return 0;
2239 }
2240
2241 static int
2242 test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
2243 {
2244         uint32_t num_to_submit = pparams->total_operations;
2245         struct rte_crypto_op *c_ops[num_to_submit];
2246         struct rte_crypto_op *proc_ops[num_to_submit];
2247         uint64_t failed_polls, retries, start_cycles,
2248                 end_cycles, total_cycles = 0;
2249         uint32_t burst_sent = 0, burst_received = 0;
2250         uint32_t i, burst_size, num_sent, num_ops_received;
2251
2252         struct crypto_testsuite_params *ts_params = &testsuite_params;
2253
2254         static struct rte_cryptodev_sym_session *sess;
2255
2256         static struct rte_crypto_op *(*test_perf_set_crypto_op)
2257                         (struct rte_crypto_op *, struct rte_mbuf *,
2258                                         struct rte_cryptodev_sym_session *,
2259                                         unsigned int, unsigned int,
2260                                         enum chain_mode);
2261
2262         unsigned int digest_length = get_auth_digest_length(pparams->auth_algo);
2263
2264         if (rte_cryptodev_count() == 0) {
2265                 printf("\nNo crypto devices found. Is PMD build configured?\n");
2266                 return TEST_FAILED;
2267         }
2268
2269         /* Create Crypto session*/
2270         sess = test_perf_create_openssl_session(ts_params->dev_id,
2271                         pparams->chain, pparams->cipher_algo,
2272                         pparams->cipher_key_length, pparams->auth_algo);
2273         TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
2274
2275         /* Generate Crypto op data structure(s)*/
2276         for (i = 0; i < num_to_submit ; i++) {
2277                 struct rte_mbuf *m = test_perf_create_pktmbuf(
2278                                                 ts_params->mbuf_mp,
2279                                                 pparams->buf_size);
2280                 TEST_ASSERT_NOT_NULL(m, "Failed to allocate tx_buf");
2281
2282                 struct rte_crypto_op *op =
2283                                 rte_crypto_op_alloc(ts_params->op_mpool,
2284                                                 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
2285                 TEST_ASSERT_NOT_NULL(op, "Failed to allocate op");
2286
2287                 switch (pparams->cipher_algo) {
2288                 case RTE_CRYPTO_CIPHER_3DES_CBC:
2289                 case RTE_CRYPTO_CIPHER_3DES_CTR:
2290                         test_perf_set_crypto_op = test_perf_set_crypto_op_3des;
2291                         break;
2292                 case RTE_CRYPTO_CIPHER_AES_CBC:
2293                 case RTE_CRYPTO_CIPHER_AES_CTR:
2294                         test_perf_set_crypto_op = test_perf_set_crypto_op_aes;
2295                         break;
2296                 case RTE_CRYPTO_CIPHER_AES_GCM:
2297                         test_perf_set_crypto_op =
2298                                                 test_perf_set_crypto_op_aes_gcm;
2299                         break;
2300                 default:
2301                         return TEST_FAILED;
2302                 }
2303
2304                 op = test_perf_set_crypto_op(op, m, sess, pparams->buf_size,
2305                                 digest_length, pparams->chain);
2306                 TEST_ASSERT_NOT_NULL(op, "Failed to attach op to session");
2307
2308                 c_ops[i] = op;
2309         }
2310
2311         printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, cipher key length:%u, "
2312                         "auth_algo:%s, Packet Size %u bytes",
2313                         pmd_name(gbl_cryptodev_perftest_devtype),
2314                         ts_params->dev_id, 0,
2315                         chain_mode_name(pparams->chain),
2316                         rte_crypto_cipher_algorithm_strings[pparams->cipher_algo],
2317                         pparams->cipher_key_length,
2318                         rte_crypto_auth_algorithm_strings[pparams->auth_algo],
2319                         pparams->buf_size);
2320         printf("\nOps Tx\tOps Rx\tOps/burst  ");
2321         printf("Retries  EmptyPolls\tIACycles/CyOp\tIACycles/Burst\t"
2322                         "IACycles/Byte");
2323
2324         for (i = 2; i <= 128 ; i *= 2) {
2325                 num_sent = 0;
2326                 num_ops_received = 0;
2327                 retries = 0;
2328                 failed_polls = 0;
2329                 burst_size = i;
2330                 total_cycles = 0;
2331                 while (num_sent < num_to_submit) {
2332                         start_cycles = rte_rdtsc_precise();
2333                         burst_sent = rte_cryptodev_enqueue_burst(
2334                                         ts_params->dev_id,
2335                                         0, &c_ops[num_sent],
2336                                         ((num_to_submit - num_sent) <
2337                                                 burst_size) ?
2338                                         num_to_submit - num_sent : burst_size);
2339                         end_cycles = rte_rdtsc_precise();
2340                         if (burst_sent == 0)
2341                                 retries++;
2342                         num_sent += burst_sent;
2343                         total_cycles += (end_cycles - start_cycles);
2344
2345                         /* Wait until requests have been sent. */
2346                         rte_delay_ms(1);
2347
2348                         start_cycles = rte_rdtsc_precise();
2349                         burst_received = rte_cryptodev_dequeue_burst(
2350                                         ts_params->dev_id, 0, proc_ops,
2351                                         burst_size);
2352                         end_cycles = rte_rdtsc_precise();
2353                         if (burst_received < burst_sent)
2354                                 failed_polls++;
2355                         num_ops_received += burst_received;
2356
2357                         total_cycles += end_cycles - start_cycles;
2358                 }
2359
2360                 while (num_ops_received != num_to_submit) {
2361                         /* Sending 0 length burst to flush sw crypto device */
2362                         rte_cryptodev_enqueue_burst(ts_params->dev_id, 0,
2363                                         NULL, 0);
2364
2365                         start_cycles = rte_rdtsc_precise();
2366                         burst_received = rte_cryptodev_dequeue_burst(
2367                                         ts_params->dev_id, 0, proc_ops,
2368                                         burst_size);
2369                         end_cycles = rte_rdtsc_precise();
2370
2371                         total_cycles += end_cycles - start_cycles;
2372                         if (burst_received == 0)
2373                                 failed_polls++;
2374                         num_ops_received += burst_received;
2375                 }
2376
2377                 printf("\n%u\t%u\t%u", num_sent, num_ops_received, burst_size);
2378                 printf("\t\t%"PRIu64, retries);
2379                 printf("\t%"PRIu64, failed_polls);
2380                 printf("\t\t%"PRIu64, total_cycles/num_ops_received);
2381                 printf("\t\t%"PRIu64, (total_cycles/num_ops_received) *
2382                                 burst_size);
2383                 printf("\t\t%"PRIu64,
2384                                 total_cycles /
2385                                 (num_ops_received * pparams->buf_size));
2386         }
2387         printf("\n");
2388
2389         for (i = 0; i < num_to_submit ; i++) {
2390                 rte_pktmbuf_free(c_ops[i]->sym->m_src);
2391                 rte_crypto_op_free(c_ops[i]);
2392         }
2393         rte_cryptodev_sym_session_free(ts_params->dev_id, sess);
2394
2395         return TEST_SUCCESS;
2396 }
2397
2398 static int
2399 test_perf_armv8_optimise_cyclecount(struct perf_test_params *pparams)
2400 {
2401         uint32_t num_to_submit = pparams->total_operations;
2402         struct rte_crypto_op *c_ops[num_to_submit];
2403         struct rte_crypto_op *proc_ops[num_to_submit];
2404         uint64_t failed_polls, retries, start_cycles, end_cycles,
2405                  total_cycles = 0;
2406         uint32_t burst_sent = 0, burst_received = 0;
2407         uint32_t i, burst_size, num_sent, num_ops_received;
2408         uint32_t nb_ops;
2409
2410         struct crypto_testsuite_params *ts_params = &testsuite_params;
2411
2412         static struct rte_cryptodev_sym_session *sess;
2413
2414         unsigned int digest_length = get_auth_digest_length(pparams->auth_algo);
2415
2416         if (rte_cryptodev_count() == 0) {
2417                 printf("\nNo crypto devices found. Is PMD build configured?\n");
2418                 return TEST_FAILED;
2419         }
2420
2421         /* Create Crypto session*/
2422         sess = test_perf_create_armv8_session(ts_params->dev_id,
2423                         pparams->chain, pparams->cipher_algo,
2424                         pparams->cipher_key_length, pparams->auth_algo);
2425         TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
2426
2427         /* Generate Crypto op data structure(s)*/
2428         for (i = 0; i < num_to_submit ; i++) {
2429                 struct rte_mbuf *m = test_perf_create_pktmbuf(
2430                                                 ts_params->mbuf_mp,
2431                                                 pparams->buf_size);
2432                 TEST_ASSERT_NOT_NULL(m, "Failed to allocate tx_buf");
2433
2434                 struct rte_crypto_op *op =
2435                                 rte_crypto_op_alloc(ts_params->op_mpool,
2436                                                 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
2437                 TEST_ASSERT_NOT_NULL(op, "Failed to allocate op");
2438
2439                 op = test_perf_set_crypto_op_aes(op, m, sess, pparams->buf_size,
2440                                 digest_length, pparams->chain);
2441                 TEST_ASSERT_NOT_NULL(op, "Failed to attach op to session");
2442
2443                 c_ops[i] = op;
2444         }
2445
2446         printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, cipher key length:%u, "
2447                         "auth_algo:%s, Packet Size %u bytes",
2448                         pmd_name(gbl_cryptodev_perftest_devtype),
2449                         ts_params->dev_id, 0,
2450                         chain_mode_name(pparams->chain),
2451                         rte_crypto_cipher_algorithm_strings[pparams->cipher_algo],
2452                         pparams->cipher_key_length,
2453                         rte_crypto_auth_algorithm_strings[pparams->auth_algo],
2454                         pparams->buf_size);
2455         printf("\nOps Tx\tOps Rx\tOps/burst  ");
2456         printf("Retries  "
2457                 "EmptyPolls\tIACycles/CyOp\tIACycles/Burst\tIACycles/Byte");
2458
2459         for (i = 2; i <= 128 ; i *= 2) {
2460                 num_sent = 0;
2461                 num_ops_received = 0;
2462                 retries = 0;
2463                 failed_polls = 0;
2464                 burst_size = i;
2465                 total_cycles = 0;
2466                 while (num_sent < num_to_submit) {
2467                         if ((num_to_submit - num_sent) < burst_size)
2468                                 nb_ops = num_to_submit - num_sent;
2469                         else
2470                                 nb_ops = burst_size;
2471
2472                         start_cycles = rte_rdtsc();
2473                         burst_sent = rte_cryptodev_enqueue_burst(
2474                                 ts_params->dev_id,
2475                                 0, &c_ops[num_sent],
2476                                 nb_ops);
2477                         end_cycles = rte_rdtsc();
2478
2479                         if (burst_sent == 0)
2480                                 retries++;
2481                         num_sent += burst_sent;
2482                         total_cycles += (end_cycles - start_cycles);
2483
2484                         start_cycles = rte_rdtsc();
2485                         burst_received = rte_cryptodev_dequeue_burst(
2486                                         ts_params->dev_id, 0, proc_ops,
2487                                         burst_size);
2488                         end_cycles = rte_rdtsc();
2489                         if (burst_received < burst_sent)
2490                                 failed_polls++;
2491                         num_ops_received += burst_received;
2492
2493                         total_cycles += end_cycles - start_cycles;
2494                 }
2495
2496                 while (num_ops_received != num_to_submit) {
2497                         /* Sending 0 length burst to flush sw crypto device */
2498                         rte_cryptodev_enqueue_burst(
2499                                                 ts_params->dev_id, 0, NULL, 0);
2500
2501                         start_cycles = rte_rdtsc();
2502                         burst_received = rte_cryptodev_dequeue_burst(
2503                                 ts_params->dev_id, 0, proc_ops, burst_size);
2504                         end_cycles = rte_rdtsc();
2505
2506                         total_cycles += end_cycles - start_cycles;
2507                         if (burst_received == 0)
2508                                 failed_polls++;
2509                         num_ops_received += burst_received;
2510                 }
2511
2512                 printf("\n%u\t%u\t%u", num_sent, num_ops_received, burst_size);
2513                 printf("\t\t%"PRIu64, retries);
2514                 printf("\t%"PRIu64, failed_polls);
2515                 printf("\t\t%"PRIu64, total_cycles/num_ops_received);
2516                 printf("\t\t%"PRIu64,
2517                         (total_cycles/num_ops_received)*burst_size);
2518                 printf("\t\t%"PRIu64,
2519                         total_cycles/(num_ops_received*pparams->buf_size));
2520         }
2521         printf("\n");
2522
2523         for (i = 0; i < num_to_submit ; i++) {
2524                 rte_pktmbuf_free(c_ops[i]->sym->m_src);
2525                 rte_crypto_op_free(c_ops[i]);
2526         }
2527
2528         return TEST_SUCCESS;
2529 }
2530
2531 static uint32_t get_auth_key_max_length(enum rte_crypto_auth_algorithm algo)
2532 {
2533         switch (algo) {
2534         case RTE_CRYPTO_AUTH_SNOW3G_UIA2:
2535                 return 16;
2536         case RTE_CRYPTO_AUTH_SHA1_HMAC:
2537                 return 64;
2538         case RTE_CRYPTO_AUTH_SHA224_HMAC:
2539                 return 64;
2540         case RTE_CRYPTO_AUTH_SHA256_HMAC:
2541                 return 64;
2542         case RTE_CRYPTO_AUTH_SHA384_HMAC:
2543                 return 128;
2544         case RTE_CRYPTO_AUTH_SHA512_HMAC:
2545                 return 128;
2546         case RTE_CRYPTO_AUTH_AES_GCM:
2547                 return 0;
2548         default:
2549                 return 0;
2550         }
2551 }
2552
2553 static uint32_t get_auth_digest_length(enum rte_crypto_auth_algorithm algo)
2554 {
2555         switch (algo) {
2556         case RTE_CRYPTO_AUTH_SNOW3G_UIA2:
2557                 return 4;
2558         case RTE_CRYPTO_AUTH_SHA1_HMAC:
2559                 return TRUNCATED_DIGEST_BYTE_LENGTH_SHA1;
2560         case RTE_CRYPTO_AUTH_SHA224_HMAC:
2561                 return TRUNCATED_DIGEST_BYTE_LENGTH_SHA224;
2562         case RTE_CRYPTO_AUTH_SHA256_HMAC:
2563                 return TRUNCATED_DIGEST_BYTE_LENGTH_SHA256;
2564         case RTE_CRYPTO_AUTH_SHA384_HMAC:
2565                 return TRUNCATED_DIGEST_BYTE_LENGTH_SHA384;
2566         case RTE_CRYPTO_AUTH_SHA512_HMAC:
2567                 return TRUNCATED_DIGEST_BYTE_LENGTH_SHA512;
2568         case RTE_CRYPTO_AUTH_AES_GCM:
2569                 return DIGEST_BYTE_LENGTH_AES_GCM;
2570         default:
2571                 return 0;
2572         }
2573 }
2574
2575 static uint8_t aes_key[] = {
2576                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2577                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2578                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2579                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2580 };
2581
2582 static uint8_t aes_iv[] = {
2583                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2584                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2585 };
2586
2587 static uint8_t aes_gcm_aad[] = {
2588                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2589                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2590 };
2591
2592 static uint8_t triple_des_key[] = {
2593                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2594                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2595                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2596 };
2597
2598 static uint8_t triple_des_iv[] = {
2599                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2600 };
2601
2602 static uint8_t hmac_sha_key[] = {
2603                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2604                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2605                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2606                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2607                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2608                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2609                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2610                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2611                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2612                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2613                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2614                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2615                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2616                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2617                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2618                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2619 };
2620
2621 static uint8_t snow3g_cipher_key[] = {
2622                 0x2B, 0xD6, 0x45, 0x9F, 0x82, 0xC5, 0xB3, 0x00,
2623                 0x95, 0x2C, 0x49, 0x10, 0x48, 0x81, 0xFF, 0x48
2624 };
2625
2626 static uint8_t snow3g_iv[] = {
2627                 0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00,
2628                 0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00
2629 };
2630
2631 static uint8_t snow3g_hash_key[] = {
2632                 0xC7, 0x36, 0xC6, 0xAA, 0xB2, 0x2B, 0xFF, 0xF9,
2633                 0x1E, 0x26, 0x98, 0xD2, 0xE2, 0x2A, 0xD5, 0x7E
2634 };
2635
2636 static struct rte_cryptodev_sym_session *
2637 test_perf_create_aes_sha_session(uint8_t dev_id, enum chain_mode chain,
2638                 enum rte_crypto_cipher_algorithm cipher_algo,
2639                 unsigned cipher_key_len,
2640                 enum rte_crypto_auth_algorithm auth_algo)
2641 {
2642         struct rte_crypto_sym_xform cipher_xform = { 0 };
2643         struct rte_crypto_sym_xform auth_xform = { 0 };
2644
2645
2646         /* Setup Cipher Parameters */
2647         cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
2648         cipher_xform.cipher.algo = cipher_algo;
2649         cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
2650
2651         cipher_xform.cipher.key.data = aes_key;
2652         cipher_xform.cipher.key.length = cipher_key_len;
2653         if (chain != CIPHER_ONLY) {
2654                 /* Setup HMAC Parameters */
2655                 auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
2656                 auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
2657                 auth_xform.auth.algo = auth_algo;
2658                 auth_xform.auth.key.data = hmac_sha_key;
2659                 auth_xform.auth.key.length = get_auth_key_max_length(auth_algo);
2660                 auth_xform.auth.digest_length =
2661                                         get_auth_digest_length(auth_algo);
2662         }
2663         switch (chain) {
2664         case CIPHER_HASH:
2665                 cipher_xform.next = &auth_xform;
2666                 auth_xform.next = NULL;
2667                 /* Create Crypto session*/
2668                 return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
2669         case HASH_CIPHER:
2670                 auth_xform.next = &cipher_xform;
2671                 cipher_xform.next = NULL;
2672                 /* Create Crypto session*/
2673                 return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
2674         case CIPHER_ONLY:
2675                 cipher_xform.next = NULL;
2676                 /* Create Crypto session*/
2677                 return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
2678         default:
2679                 return NULL;
2680         }
2681 }
2682
2683 #define SNOW3G_CIPHER_IV_LENGTH 16
2684
2685 static struct rte_cryptodev_sym_session *
2686 test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain,
2687                 enum rte_crypto_cipher_algorithm cipher_algo, unsigned cipher_key_len,
2688                 enum rte_crypto_auth_algorithm auth_algo)
2689 {
2690         struct rte_crypto_sym_xform cipher_xform = {0};
2691         struct rte_crypto_sym_xform auth_xform = {0};
2692
2693
2694         /* Setup Cipher Parameters */
2695         cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
2696         cipher_xform.cipher.algo = cipher_algo;
2697         cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
2698
2699         cipher_xform.cipher.key.data = snow3g_cipher_key;
2700         cipher_xform.cipher.key.length = cipher_key_len;
2701
2702         /* Setup HMAC Parameters */
2703         auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
2704         auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
2705         auth_xform.auth.algo = auth_algo;
2706
2707         auth_xform.auth.add_auth_data_length = SNOW3G_CIPHER_IV_LENGTH;
2708         auth_xform.auth.key.data = snow3g_hash_key;
2709         auth_xform.auth.key.length =  get_auth_key_max_length(auth_algo);
2710         auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
2711
2712         switch (chain) {
2713         case CIPHER_HASH:
2714                 cipher_xform.next = &auth_xform;
2715                 auth_xform.next = NULL;
2716                 /* Create Crypto session*/
2717                 return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
2718         case HASH_CIPHER:
2719                 auth_xform.next = &cipher_xform;
2720                 cipher_xform.next = NULL;
2721                 /* Create Crypto session*/
2722                 return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
2723         case CIPHER_ONLY:
2724                 cipher_xform.next = NULL;
2725                 /* Create Crypto session*/
2726                 return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
2727         case HASH_ONLY:
2728                 auth_xform.next = NULL;
2729                 /* Create Crypto session */
2730                 return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
2731         default:
2732                 return NULL;
2733         }
2734 }
2735
2736 static struct rte_cryptodev_sym_session *
2737 test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
2738                 enum rte_crypto_cipher_algorithm cipher_algo,
2739                 unsigned int cipher_key_len,
2740                 enum rte_crypto_auth_algorithm auth_algo)
2741 {
2742         struct rte_crypto_sym_xform cipher_xform = { 0 };
2743         struct rte_crypto_sym_xform auth_xform = { 0 };
2744
2745         /* Setup Cipher Parameters */
2746         cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
2747         cipher_xform.cipher.algo = cipher_algo;
2748         cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
2749
2750         switch (cipher_algo) {
2751         case RTE_CRYPTO_CIPHER_3DES_CBC:
2752         case RTE_CRYPTO_CIPHER_3DES_CTR:
2753                 cipher_xform.cipher.key.data = triple_des_key;
2754                 break;
2755         case RTE_CRYPTO_CIPHER_AES_CBC:
2756         case RTE_CRYPTO_CIPHER_AES_CTR:
2757         case RTE_CRYPTO_CIPHER_AES_GCM:
2758                 cipher_xform.cipher.key.data = aes_key;
2759                 break;
2760         default:
2761                 return NULL;
2762         }
2763
2764         cipher_xform.cipher.key.length = cipher_key_len;
2765
2766         /* Setup Auth Parameters */
2767         auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
2768         auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
2769         auth_xform.auth.algo = auth_algo;
2770
2771         switch (auth_algo) {
2772         case RTE_CRYPTO_AUTH_SHA1_HMAC:
2773                 auth_xform.auth.key.data = hmac_sha_key;
2774                 break;
2775         case RTE_CRYPTO_AUTH_AES_GCM:
2776                 auth_xform.auth.key.data = NULL;
2777                 break;
2778         default:
2779                 return NULL;
2780         }
2781
2782         auth_xform.auth.key.length =  get_auth_key_max_length(auth_algo);
2783         auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
2784
2785         switch (chain) {
2786         case CIPHER_HASH:
2787                 cipher_xform.next = &auth_xform;
2788                 auth_xform.next = NULL;
2789                 /* Create Crypto session*/
2790                 return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
2791         case HASH_CIPHER:
2792                 auth_xform.next = &cipher_xform;
2793                 cipher_xform.next = NULL;
2794                 /* Create Crypto session*/
2795                 return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
2796         default:
2797                 return NULL;
2798         }
2799 }
2800
2801 static struct rte_cryptodev_sym_session *
2802 test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
2803                 enum rte_crypto_cipher_algorithm cipher_algo,
2804                 unsigned int cipher_key_len,
2805                 enum rte_crypto_auth_algorithm auth_algo)
2806 {
2807         struct rte_crypto_sym_xform cipher_xform = { 0 };
2808         struct rte_crypto_sym_xform auth_xform = { 0 };
2809
2810         /* Setup Cipher Parameters */
2811         cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
2812         cipher_xform.cipher.algo = cipher_algo;
2813
2814         switch (cipher_algo) {
2815         case RTE_CRYPTO_CIPHER_AES_CBC:
2816                 cipher_xform.cipher.key.data = aes_cbc_128_key;
2817                 break;
2818         default:
2819                 return NULL;
2820         }
2821
2822         cipher_xform.cipher.key.length = cipher_key_len;
2823
2824         /* Setup Auth Parameters */
2825         auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
2826         auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
2827         auth_xform.auth.algo = auth_algo;
2828
2829         auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
2830
2831         switch (chain) {
2832         case CIPHER_HASH:
2833                 cipher_xform.next = &auth_xform;
2834                 auth_xform.next = NULL;
2835                 /* Encrypt and hash the result */
2836                 cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
2837                 /* Create Crypto session*/
2838                 return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
2839         case HASH_CIPHER:
2840                 auth_xform.next = &cipher_xform;
2841                 cipher_xform.next = NULL;
2842                 /* Hash encrypted message and decrypt */
2843                 cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;
2844                 /* Create Crypto session*/
2845                 return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
2846         default:
2847                 return NULL;
2848         }
2849 }
2850
2851 #define AES_CIPHER_IV_LENGTH 16
2852 #define AES_GCM_AAD_LENGTH 16
2853 #define TRIPLE_DES_CIPHER_IV_LENGTH 8
2854
2855 static struct rte_mbuf *
2856 test_perf_create_pktmbuf(struct rte_mempool *mpool, unsigned buf_sz)
2857 {
2858         struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
2859
2860         if (rte_pktmbuf_append(m, buf_sz) == NULL) {
2861                 rte_pktmbuf_free(m);
2862                 return NULL;
2863         }
2864
2865         memset(rte_pktmbuf_mtod(m, uint8_t *), 0, buf_sz);
2866
2867         return m;
2868 }
2869
2870 static inline struct rte_crypto_op *
2871 test_perf_set_crypto_op_aes(struct rte_crypto_op *op, struct rte_mbuf *m,
2872                 struct rte_cryptodev_sym_session *sess, unsigned int data_len,
2873                 unsigned int digest_len, enum chain_mode chain)
2874 {
2875         if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
2876                 rte_crypto_op_free(op);
2877                 return NULL;
2878         }
2879
2880         /* Authentication Parameters */
2881         if (chain == CIPHER_ONLY) {
2882                 op->sym->auth.digest.data = NULL;
2883                 op->sym->auth.digest.phys_addr = 0;
2884                 op->sym->auth.digest.length = 0;
2885                 op->sym->auth.aad.data = NULL;
2886                 op->sym->auth.aad.length = 0;
2887                 op->sym->auth.data.offset = 0;
2888                 op->sym->auth.data.length = 0;
2889         } else {
2890                 op->sym->auth.digest.data = rte_pktmbuf_mtod_offset(m,
2891                                  uint8_t *, data_len);
2892                 op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m,
2893                                 data_len);
2894                 op->sym->auth.digest.length = digest_len;
2895                 op->sym->auth.data.offset = 0;
2896                 op->sym->auth.data.length = data_len;
2897         }
2898
2899
2900         /* Cipher Parameters */
2901         op->sym->cipher.iv.data = rte_crypto_op_ctod_offset(op,
2902                         uint8_t *, IV_OFFSET);
2903         op->sym->cipher.iv.phys_addr = rte_crypto_op_ctophys_offset(op,
2904                         IV_OFFSET);
2905         op->sym->cipher.iv.length = AES_CIPHER_IV_LENGTH;
2906
2907         rte_memcpy(op->sym->cipher.iv.data, aes_iv, AES_CIPHER_IV_LENGTH);
2908
2909         op->sym->cipher.data.offset = 0;
2910         op->sym->cipher.data.length = data_len;
2911
2912         op->sym->m_src = m;
2913
2914         return op;
2915 }
2916
2917 static inline struct rte_crypto_op *
2918 test_perf_set_crypto_op_aes_gcm(struct rte_crypto_op *op, struct rte_mbuf *m,
2919                 struct rte_cryptodev_sym_session *sess, unsigned int data_len,
2920                 unsigned int digest_len, enum chain_mode chain __rte_unused)
2921 {
2922         if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
2923                 rte_crypto_op_free(op);
2924                 return NULL;
2925         }
2926
2927         /* Authentication Parameters */
2928         op->sym->auth.digest.data = (uint8_t *)m->buf_addr +
2929                                         (m->data_off + data_len);
2930         op->sym->auth.digest.phys_addr =
2931                                 rte_pktmbuf_mtophys_offset(m, data_len);
2932         op->sym->auth.digest.length = digest_len;
2933         op->sym->auth.aad.data = aes_gcm_aad;
2934         op->sym->auth.aad.length = AES_GCM_AAD_LENGTH;
2935
2936         /* Cipher Parameters */
2937         op->sym->cipher.iv.data = rte_crypto_op_ctod_offset(op,
2938                         uint8_t *, IV_OFFSET);
2939         op->sym->cipher.iv.phys_addr = rte_crypto_op_ctophys_offset(op,
2940                         IV_OFFSET);
2941         op->sym->cipher.iv.length = AES_CIPHER_IV_LENGTH;
2942         rte_memcpy(op->sym->cipher.iv.data, aes_iv, AES_CIPHER_IV_LENGTH);
2943
2944         /* Data lengths/offsets Parameters */
2945         op->sym->auth.data.offset = 0;
2946         op->sym->auth.data.length = data_len;
2947
2948         op->sym->cipher.data.offset = 0;
2949         op->sym->cipher.data.length = data_len;
2950
2951         op->sym->m_src = m;
2952
2953         return op;
2954 }
2955
2956 static inline struct rte_crypto_op *
2957 test_perf_set_crypto_op_snow3g(struct rte_crypto_op *op, struct rte_mbuf *m,
2958                 struct rte_cryptodev_sym_session *sess, unsigned data_len,
2959                 unsigned digest_len)
2960 {
2961         uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op,
2962                         uint8_t *, IV_OFFSET);
2963
2964         if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
2965                 rte_crypto_op_free(op);
2966                 return NULL;
2967         }
2968
2969         rte_memcpy(iv_ptr, snow3g_iv, SNOW3G_CIPHER_IV_LENGTH);
2970
2971         /* Authentication Parameters */
2972         op->sym->auth.digest.data = (uint8_t *)m->buf_addr +
2973                                                 (m->data_off + data_len);
2974         op->sym->auth.digest.phys_addr =
2975                                 rte_pktmbuf_mtophys_offset(m, data_len);
2976         op->sym->auth.digest.length = digest_len;
2977         op->sym->auth.aad.data = iv_ptr;
2978         op->sym->auth.aad.phys_addr = rte_crypto_op_ctophys_offset(op,
2979                         IV_OFFSET);
2980         op->sym->auth.aad.length = SNOW3G_CIPHER_IV_LENGTH;
2981
2982         /* Cipher Parameters */
2983         op->sym->cipher.iv.data = iv_ptr;
2984         op->sym->cipher.iv.phys_addr = rte_crypto_op_ctophys_offset(op,
2985                         IV_OFFSET);
2986         op->sym->cipher.iv.length = SNOW3G_CIPHER_IV_LENGTH;
2987
2988         /* Data lengths/offsets Parameters */
2989         op->sym->auth.data.offset = 0;
2990         op->sym->auth.data.length = data_len << 3;
2991
2992         op->sym->cipher.data.offset = 0;
2993         op->sym->cipher.data.length = data_len << 3;
2994
2995         op->sym->m_src = m;
2996
2997         return op;
2998 }
2999
3000 static inline struct rte_crypto_op *
3001 test_perf_set_crypto_op_snow3g_cipher(struct rte_crypto_op *op,
3002                 struct rte_mbuf *m,
3003                 struct rte_cryptodev_sym_session *sess,
3004                 unsigned data_len)
3005 {
3006         if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
3007                 rte_crypto_op_free(op);
3008                 return NULL;
3009         }
3010
3011         /* Cipher Parameters */
3012         op->sym->cipher.iv.data = rte_crypto_op_ctod_offset(op,
3013                         uint8_t *, IV_OFFSET);
3014         op->sym->cipher.iv.phys_addr = rte_crypto_op_ctophys_offset(op,
3015                         IV_OFFSET);
3016         op->sym->cipher.iv.length = SNOW3G_CIPHER_IV_LENGTH;
3017         rte_memcpy(op->sym->cipher.iv.data, snow3g_iv, SNOW3G_CIPHER_IV_LENGTH);
3018
3019         op->sym->cipher.data.offset = 0;
3020         op->sym->cipher.data.length = data_len << 3;
3021
3022         op->sym->m_src = m;
3023
3024         return op;
3025 }
3026
3027
3028 static inline struct rte_crypto_op *
3029 test_perf_set_crypto_op_snow3g_hash(struct rte_crypto_op *op,
3030                 struct rte_mbuf *m,
3031                 struct rte_cryptodev_sym_session *sess,
3032                 unsigned data_len,
3033                 unsigned digest_len)
3034 {
3035         if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
3036                 rte_crypto_op_free(op);
3037                 return NULL;
3038         }
3039
3040         /* Authentication Parameters */
3041
3042         op->sym->auth.digest.data =
3043                         (uint8_t *)rte_pktmbuf_mtod_offset(m, uint8_t *,
3044                         data_len);
3045         op->sym->auth.digest.phys_addr =
3046                                 rte_pktmbuf_mtophys_offset(m, data_len +
3047                                         SNOW3G_CIPHER_IV_LENGTH);
3048         op->sym->auth.digest.length = digest_len;
3049         op->sym->auth.aad.data = rte_crypto_op_ctod_offset(op,
3050                         uint8_t *, IV_OFFSET);
3051         op->sym->auth.aad.phys_addr = rte_crypto_op_ctophys_offset(op,
3052                         IV_OFFSET);
3053         op->sym->auth.aad.length = SNOW3G_CIPHER_IV_LENGTH;
3054         rte_memcpy(op->sym->auth.aad.data, snow3g_iv,
3055                         SNOW3G_CIPHER_IV_LENGTH);
3056
3057         /* Data lengths/offsets Parameters */
3058         op->sym->auth.data.offset = 0;
3059         op->sym->auth.data.length = data_len << 3;
3060
3061         op->sym->m_src = m;
3062
3063         return op;
3064 }
3065
3066
3067 static inline struct rte_crypto_op *
3068 test_perf_set_crypto_op_3des(struct rte_crypto_op *op, struct rte_mbuf *m,
3069                 struct rte_cryptodev_sym_session *sess, unsigned int data_len,
3070                 unsigned int digest_len, enum chain_mode chain __rte_unused)
3071 {
3072         if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
3073                 rte_crypto_op_free(op);
3074                 return NULL;
3075         }
3076
3077         /* Authentication Parameters */
3078         op->sym->auth.digest.data = (uint8_t *)m->buf_addr +
3079                                         (m->data_off + data_len);
3080         op->sym->auth.digest.phys_addr =
3081                                 rte_pktmbuf_mtophys_offset(m, data_len);
3082         op->sym->auth.digest.length = digest_len;
3083
3084         /* Cipher Parameters */
3085         op->sym->cipher.iv.data = rte_crypto_op_ctod_offset(op,
3086                         uint8_t *, IV_OFFSET);
3087         op->sym->cipher.iv.phys_addr = rte_crypto_op_ctophys_offset(op,
3088                         IV_OFFSET);
3089         op->sym->cipher.iv.length = TRIPLE_DES_CIPHER_IV_LENGTH;
3090         rte_memcpy(op->sym->cipher.iv.data, triple_des_iv,
3091                         TRIPLE_DES_CIPHER_IV_LENGTH);
3092
3093         /* Data lengths/offsets Parameters */
3094         op->sym->auth.data.offset = 0;
3095         op->sym->auth.data.length = data_len;
3096
3097         op->sym->cipher.data.offset = 0;
3098         op->sym->cipher.data.length = data_len;
3099
3100         op->sym->m_src = m;
3101
3102         return op;
3103 }
3104
3105 /* An mbuf set is used in each burst. An mbuf can be used by multiple bursts at
3106  * same time, i.e. as they're not dereferenced there's no need to wait until
3107  * finished with to re-use */
3108 #define NUM_MBUF_SETS 8
3109
3110 static int
3111 test_perf_aes_sha(uint8_t dev_id, uint16_t queue_id,
3112                 struct perf_test_params *pparams)
3113 {
3114         uint16_t i, k, l, m;
3115         uint16_t j = 0;
3116         uint16_t ops_unused = 0;
3117
3118         uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0;
3119         uint64_t processed = 0, failed_polls = 0, retries = 0;
3120         uint64_t tsc_start = 0, tsc_end = 0;
3121
3122         uint16_t digest_length = get_auth_digest_length(pparams->auth_algo);
3123
3124         struct rte_crypto_op *ops[pparams->burst_size];
3125         struct rte_crypto_op *proc_ops[pparams->burst_size];
3126
3127         struct rte_mbuf *mbufs[pparams->burst_size * 8];
3128
3129         struct crypto_testsuite_params *ts_params = &testsuite_params;
3130
3131         static struct rte_cryptodev_sym_session *sess;
3132
3133         if (rte_cryptodev_count() == 0) {
3134                 printf("\nNo crypto devices available. Is kernel driver loaded?\n");
3135                 return TEST_FAILED;
3136         }
3137
3138         /* Create Crypto session*/
3139         sess = test_perf_create_aes_sha_session(ts_params->dev_id,
3140                         pparams->chain, pparams->cipher_algo,
3141                         pparams->cipher_key_length, pparams->auth_algo);
3142         TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
3143
3144         /* Generate a burst of crypto operations */
3145         for (i = 0; i < (pparams->burst_size * NUM_MBUF_SETS); i++) {
3146                 mbufs[i] = test_perf_create_pktmbuf(
3147                                 ts_params->mbuf_mp,
3148                                 pparams->buf_size);
3149
3150                 if (mbufs[i] == NULL) {
3151                         printf("\nFailed to get mbuf - freeing the rest.\n");
3152                         for (k = 0; k < i; k++)
3153                                 rte_pktmbuf_free(mbufs[k]);
3154                         return -1;
3155                 }
3156
3157                 /* Make room for Digest in mbuf */
3158                 if (pparams->chain != CIPHER_ONLY)
3159                         rte_pktmbuf_append(mbufs[i], digest_length);
3160         }
3161
3162
3163         tsc_start = rte_rdtsc_precise();
3164
3165         while (total_enqueued < pparams->total_operations) {
3166                 uint16_t burst_size =
3167                 total_enqueued+pparams->burst_size <= pparams->total_operations ?
3168                 pparams->burst_size : pparams->total_operations-total_enqueued;
3169                 uint16_t ops_needed = burst_size-ops_unused;
3170
3171                 if (ops_needed != rte_crypto_op_bulk_alloc(ts_params->op_mpool,
3172                                 RTE_CRYPTO_OP_TYPE_SYMMETRIC, ops, ops_needed)){
3173                         printf("\nFailed to alloc enough ops, finish dequeuing "
3174                                 "and free ops below.");
3175                 } else {
3176                         for (i = 0; i < ops_needed; i++)
3177                                 ops[i] = test_perf_set_crypto_op_aes(ops[i],
3178                                         mbufs[i + (pparams->burst_size *
3179                                                 (j % NUM_MBUF_SETS))],
3180                                         sess, pparams->buf_size, digest_length,
3181                                         pparams->chain);
3182
3183                         /* enqueue burst */
3184                         burst_enqueued = rte_cryptodev_enqueue_burst(dev_id,
3185                                         queue_id, ops, burst_size);
3186
3187                         if (burst_enqueued < burst_size)
3188                                 retries++;
3189
3190                         ops_unused = burst_size-burst_enqueued;
3191                         total_enqueued += burst_enqueued;
3192                 }
3193
3194                 /* dequeue burst */
3195                 burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
3196                                 proc_ops, pparams->burst_size);
3197                 if (burst_dequeued == 0)
3198                         failed_polls++;
3199                 else {
3200                         processed += burst_dequeued;
3201
3202                         for (l = 0; l < burst_dequeued; l++)
3203                                 rte_crypto_op_free(proc_ops[l]);
3204                 }
3205                 j++;
3206         }
3207
3208         /* Dequeue any operations still in the crypto device */
3209         while (processed < pparams->total_operations) {
3210                 /* Sending 0 length burst to flush sw crypto device */
3211                 rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0);
3212
3213                 /* dequeue burst */
3214                 burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
3215                                 proc_ops, pparams->burst_size);
3216                 if (burst_dequeued == 0)
3217                         failed_polls++;
3218                 else {
3219                         processed += burst_dequeued;
3220
3221                         for (m = 0; m < burst_dequeued; m++)
3222                                 rte_crypto_op_free(proc_ops[m]);
3223                 }
3224         }
3225
3226         tsc_end = rte_rdtsc_precise();
3227
3228         double ops_s = ((double)processed / (tsc_end - tsc_start)) * rte_get_tsc_hz();
3229         double throughput = (ops_s * pparams->buf_size * 8) / 1000000000;
3230
3231         printf("\t%u\t%6.2f\t%10.2f\t%8"PRIu64"\t%8"PRIu64, pparams->buf_size, ops_s/1000000,
3232                         throughput, retries, failed_polls);
3233
3234         for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
3235                 rte_pktmbuf_free(mbufs[i]);
3236         rte_cryptodev_sym_session_free(dev_id, sess);
3237
3238         printf("\n");
3239         return TEST_SUCCESS;
3240 }
3241
3242
3243 static int
3244 test_perf_snow3g(uint8_t dev_id, uint16_t queue_id,
3245                 struct perf_test_params *pparams)
3246 {
3247         uint16_t i, k, l, m;
3248         uint16_t j = 0;
3249         uint16_t ops_unused = 0;
3250         uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0;
3251         uint64_t processed = 0, failed_polls = 0, retries = 0;
3252         uint64_t tsc_start = 0, tsc_end = 0;
3253
3254         uint16_t digest_length = get_auth_digest_length(pparams->auth_algo);
3255
3256         struct rte_crypto_op *ops[pparams->burst_size];
3257         struct rte_crypto_op *proc_ops[pparams->burst_size];
3258
3259         struct rte_mbuf *mbufs[pparams->burst_size * NUM_MBUF_SETS];
3260
3261         struct crypto_testsuite_params *ts_params = &testsuite_params;
3262
3263         static struct rte_cryptodev_sym_session *sess;
3264
3265         if (rte_cryptodev_count() == 0) {
3266                 printf("\nNo crypto devices found. Is PMD build configured?\n");
3267                 printf("\nAnd is kernel driver loaded for HW PMDs?\n");
3268                 return TEST_FAILED;
3269         }
3270
3271         /* Create Crypto session*/
3272         sess = test_perf_create_snow3g_session(ts_params->dev_id,
3273                         pparams->chain, pparams->cipher_algo,
3274                         pparams->cipher_key_length, pparams->auth_algo);
3275         TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
3276
3277         /* Generate a burst of crypto operations */
3278         for (i = 0; i < (pparams->burst_size * NUM_MBUF_SETS); i++) {
3279                 /*
3280                  * Buffer size is allocated, for perf tests they
3281                  * are equal + digest len.
3282                  */
3283                 mbufs[i] = test_perf_create_pktmbuf(
3284                                 ts_params->mbuf_mp,
3285                                 pparams->buf_size  +
3286                                 digest_length);
3287
3288                 if (mbufs[i] == NULL) {
3289                         printf("\nFailed to get mbuf - freeing the rest.\n");
3290                         for (k = 0; k < i; k++)
3291                                 rte_pktmbuf_free(mbufs[k]);
3292                         return -1;
3293                 }
3294
3295         }
3296
3297         tsc_start = rte_rdtsc_precise();
3298
3299         while (total_enqueued < pparams->total_operations) {
3300                 uint16_t burst_size =
3301                                 (total_enqueued+pparams->burst_size)
3302                                                 <= pparams->total_operations ?
3303                 pparams->burst_size : pparams->total_operations-total_enqueued;
3304                 uint16_t ops_needed = burst_size-ops_unused;
3305                 /* Handle the last burst correctly */
3306                 uint16_t op_offset = pparams->burst_size - burst_size;
3307
3308                 if (ops_needed !=
3309                         rte_crypto_op_bulk_alloc(ts_params->op_mpool,
3310                                                 RTE_CRYPTO_OP_TYPE_SYMMETRIC,
3311                                                 ops+op_offset, ops_needed)) {
3312                         printf("\nFailed to alloc enough ops.");
3313                         /*Don't exit, dequeue, more ops should become available*/
3314                 } else {
3315                         for (i = 0; i < ops_needed; i++) {
3316                                 if (pparams->chain == HASH_ONLY)
3317                                         ops[i+op_offset] =
3318                                         test_perf_set_crypto_op_snow3g_hash(ops[i+op_offset],
3319                                         mbufs[i +
3320                                           (pparams->burst_size * (j % NUM_MBUF_SETS))],
3321                                         sess,
3322                                         pparams->buf_size, digest_length);
3323                                 else if (pparams->chain == CIPHER_ONLY)
3324                                         ops[i+op_offset] =
3325                                         test_perf_set_crypto_op_snow3g_cipher(ops[i+op_offset],
3326                                         mbufs[i +
3327                                           (pparams->burst_size * (j % NUM_MBUF_SETS))],
3328                                         sess,
3329                                         pparams->buf_size);
3330                                 else
3331                                         return 1;
3332                         }
3333
3334                         /* enqueue burst */
3335                         burst_enqueued =
3336                                 rte_cryptodev_enqueue_burst(dev_id, queue_id,
3337                                                 ops+op_offset, burst_size);
3338
3339                         if (burst_enqueued < burst_size)
3340                                 retries++;
3341
3342                         ops_unused = burst_size-burst_enqueued;
3343                         total_enqueued += burst_enqueued;
3344                 }
3345
3346                 /* dequeue burst */
3347                 burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
3348                                         proc_ops, pparams->burst_size);
3349                 if (burst_dequeued == 0) {
3350                         failed_polls++;
3351                 } else {
3352                         processed += burst_dequeued;
3353                         for (l = 0; l < burst_dequeued; l++)
3354                                 rte_crypto_op_free(proc_ops[l]);
3355                 }
3356                 j++;
3357         }
3358
3359         /* Dequeue any operations still in the crypto device */
3360         while (processed < pparams->total_operations) {
3361                 /* Sending 0 length burst to flush sw crypto device */
3362                 rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0);
3363
3364                 /* dequeue burst */
3365                 burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
3366                                 proc_ops, pparams->burst_size);
3367                 if (burst_dequeued == 0)
3368                         failed_polls++;
3369                 else {
3370                         processed += burst_dequeued;
3371                         for (m = 0; m < burst_dequeued; m++)
3372                                 rte_crypto_op_free(proc_ops[m]);
3373                 }
3374         }
3375
3376         tsc_end = rte_rdtsc_precise();
3377
3378         double ops_s = ((double)processed / (tsc_end - tsc_start)) * rte_get_tsc_hz();
3379         double cycles_burst = (double) (tsc_end - tsc_start) /
3380                                         (double) processed * pparams->burst_size;
3381         double cycles_buff = (double) (tsc_end - tsc_start) / (double) processed;
3382         double cycles_B = cycles_buff / pparams->buf_size;
3383         double throughput = (ops_s * pparams->buf_size * 8) / 1000000;
3384
3385         if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_QAT_SYM_PMD) {
3386                 /* Cycle count misleading on HW devices for this test, so don't print */
3387                 printf("%4u\t%6.2f\t%10.2f\t n/a \t\t n/a "
3388                         "\t\t n/a \t\t%8"PRIu64"\t%8"PRIu64,
3389                         pparams->buf_size, ops_s/1000000,
3390                         throughput, retries, failed_polls);
3391         } else {
3392                 printf("%4u\t%6.2f\t%10.2f\t%10.2f\t%8.2f"
3393                         "\t%8.2f\t%8"PRIu64"\t%8"PRIu64,
3394                         pparams->buf_size, ops_s/1000000, throughput, cycles_burst,
3395                         cycles_buff, cycles_B, retries, failed_polls);
3396         }
3397
3398         for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
3399                 rte_pktmbuf_free(mbufs[i]);
3400         rte_cryptodev_sym_session_free(dev_id, sess);
3401
3402         printf("\n");
3403         return TEST_SUCCESS;
3404 }
3405
3406 static int
3407 test_perf_openssl(uint8_t dev_id, uint16_t queue_id,
3408                 struct perf_test_params *pparams)
3409 {
3410         uint16_t i, k, l, m;
3411         uint16_t j = 0;
3412         uint16_t ops_unused = 0;
3413
3414         uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0;
3415         uint64_t processed = 0, failed_polls = 0, retries = 0;
3416         uint64_t tsc_start = 0, tsc_end = 0;
3417
3418         unsigned int digest_length = get_auth_digest_length(pparams->auth_algo);
3419
3420         struct rte_crypto_op *ops[pparams->burst_size];
3421         struct rte_crypto_op *proc_ops[pparams->burst_size];
3422
3423         struct rte_mbuf *mbufs[pparams->burst_size * NUM_MBUF_SETS];
3424
3425         struct crypto_testsuite_params *ts_params = &testsuite_params;
3426
3427         static struct rte_cryptodev_sym_session *sess;
3428
3429         static struct rte_crypto_op *(*test_perf_set_crypto_op)
3430                         (struct rte_crypto_op *, struct rte_mbuf *,
3431                                         struct rte_cryptodev_sym_session *,
3432                                         unsigned int, unsigned int,
3433                                         enum chain_mode);
3434
3435         switch (pparams->cipher_algo) {
3436         case RTE_CRYPTO_CIPHER_3DES_CBC:
3437         case RTE_CRYPTO_CIPHER_3DES_CTR:
3438                 test_perf_set_crypto_op = test_perf_set_crypto_op_3des;
3439                 break;
3440         case RTE_CRYPTO_CIPHER_AES_CBC:
3441         case RTE_CRYPTO_CIPHER_AES_CTR:
3442                 test_perf_set_crypto_op = test_perf_set_crypto_op_aes;
3443                 break;
3444         case RTE_CRYPTO_CIPHER_AES_GCM:
3445                 test_perf_set_crypto_op = test_perf_set_crypto_op_aes_gcm;
3446                 break;
3447         default:
3448                 return TEST_FAILED;
3449         }
3450
3451         if (rte_cryptodev_count() == 0) {
3452                 printf("\nNo crypto devices found. Is PMD build configured?\n");
3453                 return TEST_FAILED;
3454         }
3455
3456         /* Create Crypto session*/
3457         sess = test_perf_create_openssl_session(ts_params->dev_id,
3458                         pparams->chain, pparams->cipher_algo,
3459                         pparams->cipher_key_length, pparams->auth_algo);
3460         TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
3461
3462         /* Generate a burst of crypto operations */
3463         for (i = 0; i < (pparams->burst_size * NUM_MBUF_SETS); i++) {
3464                 mbufs[i] = test_perf_create_pktmbuf(
3465                                 ts_params->mbuf_mp,
3466                                 pparams->buf_size);
3467
3468                 if (mbufs[i] == NULL) {
3469                         printf("\nFailed to get mbuf - freeing the rest.\n");
3470                         for (k = 0; k < i; k++)
3471                                 rte_pktmbuf_free(mbufs[k]);
3472                         return -1;
3473                 }
3474         }
3475
3476         tsc_start = rte_rdtsc_precise();
3477
3478         while (total_enqueued < pparams->total_operations) {
3479                 uint16_t burst_size =
3480                 total_enqueued + pparams->burst_size <=
3481                 pparams->total_operations ? pparams->burst_size :
3482                                 pparams->total_operations - total_enqueued;
3483                 uint16_t ops_needed = burst_size - ops_unused;
3484
3485                 if (ops_needed != rte_crypto_op_bulk_alloc(ts_params->op_mpool,
3486                                 RTE_CRYPTO_OP_TYPE_SYMMETRIC, ops, ops_needed)){
3487                         printf("\nFailed to alloc enough ops, finish dequeuing "
3488                                 "and free ops below.");
3489                 } else {
3490                         for (i = 0; i < ops_needed; i++)
3491                                 ops[i] = test_perf_set_crypto_op(ops[i],
3492                                         mbufs[i + (pparams->burst_size *
3493                                                 (j % NUM_MBUF_SETS))],
3494                                         sess, pparams->buf_size, digest_length,
3495                                         pparams->chain);
3496
3497                         /* enqueue burst */
3498                         burst_enqueued = rte_cryptodev_enqueue_burst(dev_id,
3499                                         queue_id, ops, burst_size);
3500
3501                         if (burst_enqueued < burst_size)
3502                                 retries++;
3503
3504                         ops_unused = burst_size - burst_enqueued;
3505                         total_enqueued += burst_enqueued;
3506                 }
3507
3508                 /* dequeue burst */
3509                 burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
3510                                 proc_ops, pparams->burst_size);
3511                 if (burst_dequeued == 0)
3512                         failed_polls++;
3513                 else {
3514                         processed += burst_dequeued;
3515
3516                         for (l = 0; l < burst_dequeued; l++)
3517                                 rte_crypto_op_free(proc_ops[l]);
3518                 }
3519                 j++;
3520         }
3521
3522         /* Dequeue any operations still in the crypto device */
3523         while (processed < pparams->total_operations) {
3524                 /* Sending 0 length burst to flush sw crypto device */
3525                 rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0);
3526
3527                 /* dequeue burst */
3528                 burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
3529                                 proc_ops, pparams->burst_size);
3530                 if (burst_dequeued == 0)
3531                         failed_polls++;
3532                 else {
3533                         processed += burst_dequeued;
3534
3535                         for (m = 0; m < burst_dequeued; m++)
3536                                 rte_crypto_op_free(proc_ops[m]);
3537                 }
3538         }
3539
3540         tsc_end = rte_rdtsc_precise();
3541
3542         double ops_s = ((double)processed / (tsc_end - tsc_start))
3543                                         * rte_get_tsc_hz();
3544         double throughput = (ops_s * pparams->buf_size * NUM_MBUF_SETS)
3545                                         / 1000000000;
3546
3547         printf("\t%u\t%6.2f\t%10.2f\t%8"PRIu64"\t%8"PRIu64, pparams->buf_size,
3548                         ops_s / 1000000, throughput, retries, failed_polls);
3549
3550         for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
3551                 rte_pktmbuf_free(mbufs[i]);
3552         rte_cryptodev_sym_session_free(dev_id, sess);
3553
3554         printf("\n");
3555         return TEST_SUCCESS;
3556 }
3557
3558 static int
3559 test_perf_armv8(uint8_t dev_id, uint16_t queue_id,
3560                 struct perf_test_params *pparams)
3561 {
3562         uint16_t i, k, l, m;
3563         uint16_t j = 0;
3564         uint16_t ops_unused = 0;
3565         uint16_t burst_size;
3566         uint16_t ops_needed;
3567
3568         uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0;
3569         uint64_t processed = 0, failed_polls = 0, retries = 0;
3570         uint64_t tsc_start = 0, tsc_end = 0;
3571
3572         unsigned int digest_length = get_auth_digest_length(pparams->auth_algo);
3573
3574         struct rte_crypto_op *ops[pparams->burst_size];
3575         struct rte_crypto_op *proc_ops[pparams->burst_size];
3576
3577         struct rte_mbuf *mbufs[pparams->burst_size * NUM_MBUF_SETS];
3578
3579         struct crypto_testsuite_params *ts_params = &testsuite_params;
3580
3581         static struct rte_cryptodev_sym_session *sess;
3582
3583         if (rte_cryptodev_count() == 0) {
3584                 printf("\nNo crypto devices found. Is PMD build configured?\n");
3585                 return TEST_FAILED;
3586         }
3587
3588         /* Create Crypto session*/
3589         sess = test_perf_create_armv8_session(ts_params->dev_id,
3590                         pparams->chain, pparams->cipher_algo,
3591                         pparams->cipher_key_length, pparams->auth_algo);
3592         TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
3593
3594         /* Generate a burst of crypto operations */
3595         for (i = 0; i < (pparams->burst_size * NUM_MBUF_SETS); i++) {
3596                 mbufs[i] = test_perf_create_pktmbuf(
3597                                 ts_params->mbuf_mp,
3598                                 pparams->buf_size);
3599
3600                 if (mbufs[i] == NULL) {
3601                         printf("\nFailed to get mbuf - freeing the rest.\n");
3602                         for (k = 0; k < i; k++)
3603                                 rte_pktmbuf_free(mbufs[k]);
3604                         return -1;
3605                 }
3606         }
3607
3608         tsc_start = rte_rdtsc();
3609
3610         while (total_enqueued < pparams->total_operations) {
3611                 if ((total_enqueued + pparams->burst_size) <=
3612                                         pparams->total_operations)
3613                         burst_size = pparams->burst_size;
3614                 else
3615                         burst_size = pparams->total_operations - total_enqueued;
3616
3617                 ops_needed = burst_size - ops_unused;
3618
3619                 if (ops_needed != rte_crypto_op_bulk_alloc(ts_params->op_mpool,
3620                                 RTE_CRYPTO_OP_TYPE_SYMMETRIC, ops, ops_needed)){
3621                         printf("\nFailed to alloc enough ops, finish dequeuing "
3622                                 "and free ops below.");
3623                 } else {
3624                         for (i = 0; i < ops_needed; i++)
3625                                 ops[i] = test_perf_set_crypto_op_aes(ops[i],
3626                                         mbufs[i + (pparams->burst_size *
3627                                                 (j % NUM_MBUF_SETS))], sess,
3628                                         pparams->buf_size, digest_length,
3629                                         pparams->chain);
3630
3631                         /* enqueue burst */
3632                         burst_enqueued = rte_cryptodev_enqueue_burst(dev_id,
3633                                         queue_id, ops, burst_size);
3634
3635                         if (burst_enqueued < burst_size)
3636                                 retries++;
3637
3638                         ops_unused = burst_size - burst_enqueued;
3639                         total_enqueued += burst_enqueued;
3640                 }
3641
3642                 /* dequeue burst */
3643                 burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
3644                                 proc_ops, pparams->burst_size);
3645                 if (burst_dequeued == 0)
3646                         failed_polls++;
3647                 else {
3648                         processed += burst_dequeued;
3649
3650                         for (l = 0; l < burst_dequeued; l++)
3651                                 rte_crypto_op_free(proc_ops[l]);
3652                 }
3653                 j++;
3654         }
3655
3656         /* Dequeue any operations still in the crypto device */
3657         while (processed < pparams->total_operations) {
3658                 /* Sending 0 length burst to flush sw crypto device */
3659                 rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0);
3660
3661                 /* dequeue burst */
3662                 burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
3663                                 proc_ops, pparams->burst_size);
3664                 if (burst_dequeued == 0)
3665                         failed_polls++;
3666                 else {
3667                         processed += burst_dequeued;
3668
3669                         for (m = 0; m < burst_dequeued; m++)
3670                                 rte_crypto_op_free(proc_ops[m]);
3671                 }
3672         }
3673
3674         tsc_end = rte_rdtsc();
3675
3676         double ops_s = ((double)processed / (tsc_end - tsc_start))
3677                                         * rte_get_tsc_hz();
3678         double throughput = (ops_s * pparams->buf_size * NUM_MBUF_SETS)
3679                                         / 1000000000;
3680
3681         printf("\t%u\t%6.2f\t%10.2f\t%8"PRIu64"\t%8"PRIu64, pparams->buf_size,
3682                         ops_s / 1000000, throughput, retries, failed_polls);
3683
3684         for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
3685                 rte_pktmbuf_free(mbufs[i]);
3686
3687         printf("\n");
3688         return TEST_SUCCESS;
3689 }
3690
3691 /*
3692
3693     perf_test_aes_sha("avx2", HASH_CIPHER, 16, CBC, SHA1);
3694     perf_test_aes_sha("avx2", HASH_CIPHER, 16, CBC, SHA_256);
3695     perf_test_aes_sha("avx2", HASH_CIPHER, 16, CBC, SHA_512);
3696
3697     perf_test_aes_sha("avx2", CIPHER_HASH, 32, CBC, SHA1);
3698     perf_test_aes_sha("avx2", CIPHER_HASH, 32, CBC, SHA_256);
3699     perf_test_aes_sha("avx2", CIPHER_HASH, 32, CBC, SHA_512);
3700
3701     perf_test_aes_sha("avx2", HASH_CIPHER, 32, CBC, SHA1);
3702     perf_test_aes_sha("avx2", HASH_CIPHER, 32, CBC, SHA_256);
3703     perf_test_aes_sha("avx2", HASH_CIPHER, 32, CBC, SHA_512);
3704  */
3705 static int
3706 test_perf_aes_cbc_encrypt_digest_vary_pkt_size(void)
3707 {
3708         unsigned total_operations = 1000000;
3709         unsigned burst_size = 32;
3710         unsigned buf_lengths[] = { 64, 128, 256, 512, 768, 1024, 1280, 1536, 1792, 2048 };
3711         uint8_t i, j;
3712
3713         struct perf_test_params params_set[] = {
3714                 {
3715                         .chain = CIPHER_ONLY,
3716                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
3717                         .cipher_key_length = 16,
3718                         .auth_algo = RTE_CRYPTO_AUTH_NULL
3719                 },
3720                 {
3721                         .chain = CIPHER_HASH,
3722                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
3723                         .cipher_key_length = 16,
3724                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
3725                 },
3726                 {
3727                         .chain = CIPHER_HASH,
3728
3729                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
3730                         .cipher_key_length = 16,
3731                         .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
3732                 },
3733                 {
3734                         .chain = CIPHER_HASH,
3735
3736                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
3737                         .cipher_key_length = 16,
3738                         .auth_algo = RTE_CRYPTO_AUTH_SHA512_HMAC
3739                 },
3740                 {
3741                         .chain = CIPHER_HASH,
3742
3743                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
3744                         .cipher_key_length = 32,
3745                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
3746                 },
3747                 {
3748                         .chain = CIPHER_HASH,
3749
3750                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
3751                         .cipher_key_length = 32,
3752                         .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
3753                 },
3754                 {
3755                         .chain = CIPHER_HASH,
3756
3757                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
3758                         .cipher_key_length = 32,
3759                         .auth_algo = RTE_CRYPTO_AUTH_SHA512_HMAC
3760                 },
3761         };
3762
3763         for (i = 0; i < RTE_DIM(params_set); i++) {
3764
3765                 params_set[i].total_operations = total_operations;
3766                 params_set[i].burst_size = burst_size;
3767                 printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u."
3768                         " burst_size: %d ops\n",
3769                         chain_mode_name(params_set[i].chain),
3770                         rte_crypto_cipher_algorithm_strings[params_set[i].cipher_algo],
3771                         rte_crypto_auth_algorithm_strings[params_set[i].auth_algo],
3772                         params_set[i].cipher_key_length,
3773                         burst_size);
3774                 printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t"
3775                         "Retries\tEmptyPolls\n");
3776                 for (j = 0; j < RTE_DIM(buf_lengths); j++) {
3777                         params_set[i].buf_size = buf_lengths[j];
3778                         test_perf_aes_sha(testsuite_params.dev_id, 0,
3779                                         &params_set[i]);
3780                 }
3781         }
3782         return 0;
3783 }
3784
3785 static int
3786 test_perf_snow3G_vary_pkt_size(void)
3787 {
3788         unsigned total_operations = 1000000;
3789         uint8_t i, j;
3790         unsigned k;
3791         uint16_t burst_sizes[] = { 64 };
3792         uint16_t buf_lengths[] = { 40, 64, 80, 120, 240, 256, 400, 512, 600, 1024, 2048 };
3793
3794         struct perf_test_params params_set[] = {
3795                 {
3796                         .chain = CIPHER_ONLY,
3797                         .cipher_algo  = RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
3798                         .cipher_key_length = 16,
3799                         .auth_algo  = RTE_CRYPTO_AUTH_NULL,
3800                 },
3801                 {
3802                         .chain = HASH_ONLY,
3803                         .cipher_algo = RTE_CRYPTO_CIPHER_NULL,
3804                         .auth_algo  = RTE_CRYPTO_AUTH_SNOW3G_UIA2,
3805                         .cipher_key_length = 16
3806                 },
3807         };
3808
3809         printf("\n\nStart %s.", __func__);
3810         printf("\nTest to measure max throughput at various pkt sizes.");
3811         printf("\nOn HW devices t'put maximised when high Retries and EmptyPolls"
3812                         " so cycle cost not relevant (n/a displayed).");
3813
3814         for (i = 0; i < RTE_DIM(params_set); i++) {
3815                 printf("\n\n");
3816                 params_set[i].total_operations = total_operations;
3817                 for (k = 0; k < RTE_DIM(burst_sizes); k++) {
3818                         enum rte_crypto_cipher_algorithm cipher_algo =
3819                                 params_set[i].cipher_algo;
3820                         enum rte_crypto_auth_algorithm auth_algo =
3821                                 params_set[i].auth_algo;
3822                         printf("\nOn %s dev%u qp%u, %s, "
3823                                 "cipher algo:%s, auth algo:%s, burst_size: %d ops",
3824                                 pmd_name(gbl_cryptodev_perftest_devtype),
3825                                 testsuite_params.dev_id, 0,
3826                                 chain_mode_name(params_set[i].chain),
3827                                 rte_crypto_cipher_algorithm_strings[cipher_algo],
3828                                 rte_crypto_auth_algorithm_strings[auth_algo],
3829                                 burst_sizes[k]);
3830
3831                         params_set[i].burst_size = burst_sizes[k];
3832                         printf("\nPktSzB\tOp/s(M)\tThruput(Mbps)\tCycles/Burst\t"
3833                                 "Cycles/buf\tCycles/B\tRetries\t\tEmptyPolls\n");
3834                         for (j = 0; j < RTE_DIM(buf_lengths); j++) {
3835
3836                                 params_set[i].buf_size = buf_lengths[j];
3837
3838                                 test_perf_snow3g(testsuite_params.dev_id, 0, &params_set[i]);
3839                         }
3840                 }
3841         }
3842
3843         return 0;
3844 }
3845
3846 static int
3847 test_perf_openssl_vary_pkt_size(void)
3848 {
3849         unsigned int total_operations = 10000;
3850         unsigned int burst_size = { 64 };
3851         unsigned int buf_lengths[] = { 64, 128, 256, 512, 768, 1024, 1280, 1536,
3852                         1792, 2048 };
3853         uint8_t i, j;
3854
3855         struct perf_test_params params_set[] = {
3856                 {
3857                         .chain = CIPHER_HASH,
3858
3859                         .cipher_algo  = RTE_CRYPTO_CIPHER_3DES_CBC,
3860                         .cipher_key_length = 16,
3861                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
3862                 },
3863                 {
3864                         .chain = CIPHER_HASH,
3865
3866                         .cipher_algo  = RTE_CRYPTO_CIPHER_3DES_CBC,
3867                         .cipher_key_length = 24,
3868                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
3869                 },
3870                 {
3871                         .chain = CIPHER_HASH,
3872
3873                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CTR,
3874                         .cipher_key_length = 16,
3875                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
3876                 },
3877                 {
3878                         .chain = CIPHER_HASH,
3879
3880                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CTR,
3881                         .cipher_key_length = 32,
3882                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
3883                 },
3884                 {
3885                         .chain = CIPHER_HASH,
3886
3887                         .cipher_algo  = RTE_CRYPTO_CIPHER_3DES_CTR,
3888                         .cipher_key_length = 16,
3889                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
3890                 },
3891                 {
3892                         .chain = CIPHER_HASH,
3893
3894                         .cipher_algo  = RTE_CRYPTO_CIPHER_3DES_CTR,
3895                         .cipher_key_length = 24,
3896                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
3897                 },
3898                 {
3899                         .chain = CIPHER_HASH,
3900
3901                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_GCM,
3902                         .cipher_key_length = 16,
3903                         .auth_algo = RTE_CRYPTO_AUTH_AES_GCM
3904                 },
3905         };
3906
3907         for (i = 0; i < RTE_DIM(params_set); i++) {
3908                 params_set[i].total_operations = total_operations;
3909                 params_set[i].burst_size = burst_size;
3910                 printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u."
3911                         " burst_size: %d ops\n",
3912                         chain_mode_name(params_set[i].chain),
3913                         rte_crypto_cipher_algorithm_strings[params_set[i].cipher_algo],
3914                         rte_crypto_auth_algorithm_strings[params_set[i].auth_algo],
3915                         params_set[i].cipher_key_length,
3916                         burst_size);
3917                 printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\tRetries\t"
3918                                 "EmptyPolls\n");
3919                 for (j = 0; j < RTE_DIM(buf_lengths); j++) {
3920                         params_set[i].buf_size = buf_lengths[j];
3921                         test_perf_openssl(testsuite_params.dev_id, 0,
3922                                         &params_set[i]);
3923                 }
3924         }
3925
3926         return 0;
3927 }
3928
3929 static int
3930 test_perf_openssl_vary_burst_size(void)
3931 {
3932         unsigned int total_operations = 4096;
3933         uint16_t buf_lengths[] = { 40 };
3934         uint8_t i, j;
3935
3936         struct perf_test_params params_set[] = {
3937                 {
3938                         .chain = CIPHER_HASH,
3939
3940                         .cipher_algo  = RTE_CRYPTO_CIPHER_3DES_CBC,
3941                         .cipher_key_length = 16,
3942                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
3943                 },
3944                 {
3945                         .chain = CIPHER_HASH,
3946
3947                         .cipher_algo  = RTE_CRYPTO_CIPHER_3DES_CBC,
3948                         .cipher_key_length = 24,
3949                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
3950                 },
3951                 {
3952                         .chain = CIPHER_HASH,
3953
3954                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CTR,
3955                         .cipher_key_length = 16,
3956                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
3957                 },
3958                 {
3959                         .chain = CIPHER_HASH,
3960
3961                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CTR,
3962                         .cipher_key_length = 32,
3963                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
3964                 },
3965                 {
3966                         .chain = CIPHER_HASH,
3967
3968                         .cipher_algo  = RTE_CRYPTO_CIPHER_3DES_CTR,
3969                         .cipher_key_length = 16,
3970                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
3971                 },
3972                 {
3973                         .chain = CIPHER_HASH,
3974
3975                         .cipher_algo  = RTE_CRYPTO_CIPHER_3DES_CTR,
3976                         .cipher_key_length = 24,
3977                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
3978                 },
3979                 {
3980                         .chain = CIPHER_HASH,
3981
3982                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_GCM,
3983                         .cipher_key_length = 16,
3984                         .auth_algo = RTE_CRYPTO_AUTH_AES_GCM
3985                 },
3986         };
3987
3988         printf("\n\nStart %s.", __func__);
3989         printf("\nThis Test measures the average IA cycle cost using a "
3990                         "constant request(packet) size. ");
3991         printf("Cycle cost is only valid when indicators show device is not"
3992                         " busy, i.e. Retries and EmptyPolls = 0");
3993
3994         for (i = 0; i < RTE_DIM(params_set); i++) {
3995                 printf("\n");
3996                 params_set[i].total_operations = total_operations;
3997
3998         for (j = 0; j < RTE_DIM(buf_lengths); j++) {
3999                 params_set[i].buf_size = buf_lengths[j];
4000                 test_perf_openssl_optimise_cyclecount(&params_set[i]);
4001                 }
4002         }
4003
4004         return 0;
4005 }
4006
4007 static int
4008 test_perf_armv8_vary_pkt_size(void)
4009 {
4010         unsigned int total_operations = 100000;
4011         unsigned int burst_size = { 64 };
4012         unsigned int buf_lengths[] = { 64, 128, 256, 512, 768, 1024, 1280, 1536,
4013                         1792, 2048 };
4014         uint8_t i, j;
4015
4016         struct perf_test_params params_set[] = {
4017                 {
4018                         .chain = CIPHER_HASH,
4019
4020                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
4021                         .cipher_key_length = 16,
4022                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
4023                 },
4024                 {
4025                         .chain = HASH_CIPHER,
4026
4027                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
4028                         .cipher_key_length = 16,
4029                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
4030                 },
4031                 {
4032                         .chain = CIPHER_HASH,
4033
4034                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
4035                         .cipher_key_length = 16,
4036                         .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
4037                 },
4038                 {
4039                         .chain = HASH_CIPHER,
4040
4041                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
4042                         .cipher_key_length = 16,
4043                         .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
4044                 },
4045         };
4046
4047         for (i = 0; i < RTE_DIM(params_set); i++) {
4048                 params_set[i].total_operations = total_operations;
4049                 params_set[i].burst_size = burst_size;
4050                 printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u."
4051                         " burst_size: %d ops\n",
4052                         chain_mode_name(params_set[i].chain),
4053                         rte_crypto_cipher_algorithm_strings[params_set[i].cipher_algo],
4054                         rte_crypto_auth_algorithm_strings[params_set[i].auth_algo],
4055                         params_set[i].cipher_key_length,
4056                         burst_size);
4057                 printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\tRetries\t"
4058                                 "EmptyPolls\n");
4059                 for (j = 0; j < RTE_DIM(buf_lengths); j++) {
4060                         params_set[i].buf_size = buf_lengths[j];
4061                         test_perf_armv8(testsuite_params.dev_id, 0,
4062                                                         &params_set[i]);
4063                 }
4064         }
4065
4066         return 0;
4067 }
4068
4069 static int
4070 test_perf_armv8_vary_burst_size(void)
4071 {
4072         unsigned int total_operations = 4096;
4073         uint16_t buf_lengths[] = { 64 };
4074         uint8_t i, j;
4075
4076         struct perf_test_params params_set[] = {
4077                 {
4078                         .chain = CIPHER_HASH,
4079
4080                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
4081                         .cipher_key_length = 16,
4082                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
4083                 },
4084                 {
4085                         .chain = HASH_CIPHER,
4086
4087                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
4088                         .cipher_key_length = 16,
4089                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
4090                 },
4091                 {
4092                         .chain = CIPHER_HASH,
4093
4094                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
4095                         .cipher_key_length = 16,
4096                         .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
4097                 },
4098                 {
4099                         .chain = HASH_CIPHER,
4100
4101                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
4102                         .cipher_key_length = 16,
4103                         .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
4104                 },
4105         };
4106
4107         printf("\n\nStart %s.", __func__);
4108         printf("\nThis Test measures the average IA cycle cost using a "
4109                         "constant request(packet) size. ");
4110         printf("Cycle cost is only valid when indicators show device is "
4111                         "not busy, i.e. Retries and EmptyPolls = 0");
4112
4113         for (i = 0; i < RTE_DIM(params_set); i++) {
4114                 printf("\n");
4115                 params_set[i].total_operations = total_operations;
4116
4117                 for (j = 0; j < RTE_DIM(buf_lengths); j++) {
4118                         params_set[i].buf_size = buf_lengths[j];
4119                         test_perf_armv8_optimise_cyclecount(&params_set[i]);
4120                 }
4121         }
4122
4123         return 0;
4124 }
4125
4126 static int
4127 test_perf_aes_cbc_vary_burst_size(void)
4128 {
4129         return test_perf_crypto_qp_vary_burst_size(testsuite_params.dev_id);
4130 }
4131
4132
4133 static struct rte_cryptodev_sym_session *
4134 test_perf_create_session(uint8_t dev_id, struct perf_test_params *pparams)
4135 {
4136         static struct rte_cryptodev_sym_session *sess;
4137         struct rte_crypto_sym_xform cipher_xform = { 0 };
4138         struct rte_crypto_sym_xform auth_xform = { 0 };
4139
4140         uint8_t cipher_key[pparams->session_attrs->key_cipher_len];
4141         uint8_t auth_key[pparams->session_attrs->key_auth_len];
4142
4143         memcpy(cipher_key, pparams->session_attrs->key_cipher_data,
4144                  pparams->session_attrs->key_cipher_len);
4145         memcpy(auth_key, pparams->session_attrs->key_auth_data,
4146                  pparams->session_attrs->key_auth_len);
4147
4148         cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
4149         cipher_xform.next = NULL;
4150
4151         cipher_xform.cipher.algo = pparams->session_attrs->cipher_algorithm;
4152         cipher_xform.cipher.op = pparams->session_attrs->cipher;
4153         cipher_xform.cipher.key.data = cipher_key;
4154         cipher_xform.cipher.key.length = pparams->session_attrs->key_cipher_len;
4155
4156         auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
4157         auth_xform.next = NULL;
4158
4159         auth_xform.auth.op = pparams->session_attrs->auth;
4160         auth_xform.auth.algo = pparams->session_attrs->auth_algorithm;
4161
4162         auth_xform.auth.digest_length = pparams->session_attrs->digest_len;
4163         auth_xform.auth.key.length = pparams->session_attrs->key_auth_len;
4164
4165
4166         cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
4167         if (cipher_xform.cipher.op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) {
4168                 cipher_xform.next = &auth_xform;
4169                 sess = rte_cryptodev_sym_session_create(dev_id,
4170                                 &cipher_xform);
4171         } else {
4172                 auth_xform.next = &cipher_xform;
4173                 sess = rte_cryptodev_sym_session_create(dev_id,
4174                                 &auth_xform);
4175         }
4176
4177         return sess;
4178 }
4179
4180 static inline struct rte_crypto_op *
4181 perf_gcm_set_crypto_op(struct rte_crypto_op *op, struct rte_mbuf *m,
4182                 struct rte_cryptodev_sym_session *sess,
4183                 struct crypto_params *m_hlp,
4184                 struct perf_test_params *params)
4185 {
4186         if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
4187                 rte_crypto_op_free(op);
4188                 return NULL;
4189         }
4190
4191         op->sym->auth.digest.data = m_hlp->digest;
4192         op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
4193                                           m,
4194                                           params->symmetric_op->aad_len +
4195                                           params->symmetric_op->p_len);
4196
4197         op->sym->auth.digest.length = params->symmetric_op->t_len;
4198
4199         op->sym->auth.aad.data = m_hlp->aad;
4200         op->sym->auth.aad.length = params->symmetric_op->aad_len;
4201         op->sym->auth.aad.phys_addr = rte_pktmbuf_mtophys(m);
4202
4203         rte_memcpy(op->sym->auth.aad.data, params->symmetric_op->aad_data,
4204                        params->symmetric_op->aad_len);
4205
4206         op->sym->cipher.iv.data = rte_crypto_op_ctod_offset(op,
4207                         uint8_t *, IV_OFFSET);
4208         op->sym->cipher.iv.phys_addr = rte_crypto_op_ctophys_offset(op,
4209                         IV_OFFSET);
4210         rte_memcpy(op->sym->cipher.iv.data, params->symmetric_op->iv_data,
4211                        params->symmetric_op->iv_len);
4212         if (params->symmetric_op->iv_len == 12)
4213                 op->sym->cipher.iv.data[15] = 1;
4214
4215         op->sym->cipher.iv.length = params->symmetric_op->iv_len;
4216
4217         op->sym->auth.data.offset =
4218                         params->symmetric_op->aad_len;
4219         op->sym->auth.data.length = params->symmetric_op->p_len;
4220
4221         op->sym->cipher.data.offset =
4222                         params->symmetric_op->aad_len;
4223         op->sym->cipher.data.length = params->symmetric_op->p_len;
4224
4225         op->sym->m_src = m;
4226
4227         return op;
4228 }
4229
4230 static struct rte_mbuf *
4231 test_perf_create_pktmbuf_fill(struct rte_mempool *mpool,
4232                 struct perf_test_params *params,
4233                 unsigned buf_sz, struct crypto_params *m_hlp)
4234 {
4235         struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
4236         uint16_t aad_len = params->symmetric_op->aad_len;
4237         uint16_t digest_size = params->symmetric_op->t_len;
4238         char *p;
4239
4240         p = rte_pktmbuf_append(m, aad_len);
4241         if (p == NULL) {
4242                 rte_pktmbuf_free(m);
4243                 return NULL;
4244         }
4245         m_hlp->aad = (uint8_t *)p;
4246
4247         p = rte_pktmbuf_append(m, buf_sz);
4248         if (p == NULL) {
4249                 rte_pktmbuf_free(m);
4250                 return NULL;
4251         }
4252         rte_memcpy(p, params->symmetric_op->p_data, buf_sz);
4253
4254         p = rte_pktmbuf_append(m, digest_size);
4255         if (p == NULL) {
4256                 rte_pktmbuf_free(m);
4257                 return NULL;
4258         }
4259         m_hlp->digest = (uint8_t *)p;
4260
4261         return m;
4262 }
4263
4264 static int
4265 perf_AES_GCM(uint8_t dev_id, uint16_t queue_id,
4266              struct perf_test_params *pparams, uint32_t test_ops)
4267 {
4268         int j = 0;
4269         struct crypto_testsuite_params *ts_params = &testsuite_params;
4270         struct rte_cryptodev_sym_session *sess;
4271         struct rte_crypto_op *ops[pparams->burst_size];
4272         struct rte_crypto_op *proc_ops[pparams->burst_size];
4273         uint32_t total_operations = pparams->total_operations;
4274
4275         uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0;
4276         uint64_t processed = 0, failed_polls = 0, retries = 0;
4277         uint64_t tsc_start = 0, tsc_end = 0;
4278
4279         uint16_t i = 0, l = 0, m = 0;
4280         uint16_t burst = pparams->burst_size * NUM_MBUF_SETS;
4281         uint16_t ops_unused = 0;
4282
4283         struct rte_mbuf *mbufs[burst];
4284         struct crypto_params m_hlp[burst];
4285
4286         if (rte_cryptodev_count() == 0) {
4287                 printf("\nNo crypto devices available. "
4288                                 "Is kernel driver loaded?\n");
4289                 return TEST_FAILED;
4290         }
4291
4292         sess = test_perf_create_session(dev_id, pparams);
4293         TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
4294
4295         for (i = 0; i < burst; i++) {
4296                 mbufs[i] = test_perf_create_pktmbuf_fill(
4297                                 ts_params->mbuf_mp,
4298                                 pparams, pparams->symmetric_op->p_len,
4299                                 &m_hlp[i]);
4300         }
4301
4302         if (test_ops)
4303                 total_operations = test_ops;
4304
4305         tsc_start = rte_rdtsc_precise();
4306         while (total_enqueued < total_operations) {
4307                 uint16_t burst_size =
4308                 total_enqueued+pparams->burst_size <= total_operations ?
4309                 pparams->burst_size : total_operations-total_enqueued;
4310                 uint16_t ops_needed = burst_size-ops_unused;
4311
4312                 if (ops_needed != rte_crypto_op_bulk_alloc(ts_params->op_mpool,
4313                                 RTE_CRYPTO_OP_TYPE_SYMMETRIC, ops, ops_needed)){
4314                         printf("\nFailed to alloc enough ops, "
4315                                         "finish dequeuing");
4316                 } else {
4317                         for (i = 0; i < ops_needed; i++)
4318                                 ops[i] = perf_gcm_set_crypto_op(ops[i],
4319                                         mbufs[i + (pparams->burst_size *
4320                                                 (j % NUM_MBUF_SETS))],
4321                                         sess, &m_hlp[i + (pparams->burst_size *
4322                                                 (j % NUM_MBUF_SETS))], pparams);
4323
4324                         /* enqueue burst */
4325                         burst_enqueued = rte_cryptodev_enqueue_burst(dev_id,
4326                                         queue_id, ops, burst_size);
4327
4328                         if (burst_enqueued < burst_size)
4329                                 retries++;
4330
4331                         ops_unused = burst_size-burst_enqueued;
4332                         total_enqueued += burst_enqueued;
4333                 }
4334
4335                 /* dequeue burst */
4336                 burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
4337                                 proc_ops, pparams->burst_size);
4338                 if (burst_dequeued == 0)
4339                         failed_polls++;
4340                 else {
4341                         processed += burst_dequeued;
4342
4343                         for (l = 0; l < burst_dequeued; l++)
4344                                 rte_crypto_op_free(proc_ops[l]);
4345                 }
4346
4347                 j++;
4348         }
4349
4350         /* Dequeue any operations still in the crypto device */
4351         while (processed < total_operations) {
4352                 /* Sending 0 length burst to flush sw crypto device */
4353                 rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0);
4354
4355                 /* dequeue burst */
4356                 burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
4357                                 proc_ops, pparams->burst_size);
4358                 if (burst_dequeued == 0)
4359                         failed_polls++;
4360                 else {
4361                         processed += burst_dequeued;
4362
4363                 for (m = 0; m < burst_dequeued; m++) {
4364                         if (test_ops) {
4365                                 uint8_t *pkt = rte_pktmbuf_mtod(
4366                                         proc_ops[m]->sym->m_src,
4367                                         uint8_t *);
4368
4369                                 TEST_ASSERT_BUFFERS_ARE_EQUAL(
4370                                         pparams->symmetric_op->c_data,
4371                                         pkt +
4372                                         pparams->symmetric_op->aad_len,
4373                                         pparams->symmetric_op->c_len,
4374                                         "GCM Ciphertext data not as expected");
4375
4376                                 TEST_ASSERT_BUFFERS_ARE_EQUAL(
4377                                         pparams->symmetric_op->t_data,
4378                                         pkt +
4379                                         pparams->symmetric_op->aad_len +
4380                                         pparams->symmetric_op->c_len,
4381                                         pparams->symmetric_op->t_len,
4382                                         "GCM MAC data not as expected");
4383
4384                                 }
4385                                 rte_crypto_op_free(proc_ops[m]);
4386                         }
4387                 }
4388         }
4389
4390         tsc_end = rte_rdtsc_precise();
4391
4392         double ops_s = ((double)processed / (tsc_end - tsc_start))
4393                         * rte_get_tsc_hz();
4394         double throughput = (ops_s * pparams->symmetric_op->p_len * 8)
4395                         / 1000000000;
4396
4397         if (!test_ops) {
4398                 printf("\n%u\t\t%6.2f\t%16.2f\t%8"PRIu64"\t%10"PRIu64,
4399                 pparams->symmetric_op->p_len,
4400                 ops_s/1000000, throughput, retries, failed_polls);
4401         }
4402
4403         for (i = 0; i < burst; i++)
4404                 rte_pktmbuf_free(mbufs[i]);
4405         rte_cryptodev_sym_session_free(dev_id, sess);
4406
4407         return 0;
4408 }
4409
4410 static int
4411 test_perf_AES_GCM(int continual_buf_len, int continual_size)
4412 {
4413         uint16_t i, j, k, loops = 1;
4414
4415         uint16_t buf_lengths[] = { 64, 128, 256, 512, 1024, 1536, 2048 };
4416
4417         static const struct cryptodev_perf_test_data *gcm_tests[] = {
4418                         &AES_GCM_128_12IV_0AAD
4419         };
4420
4421         if (continual_buf_len)
4422                 loops = continual_size;
4423
4424         int TEST_CASES_GCM = RTE_DIM(gcm_tests);
4425
4426         const unsigned burst_size = 32;
4427
4428         struct symmetric_op ops_set[TEST_CASES_GCM];
4429         struct perf_test_params params_set[TEST_CASES_GCM];
4430         struct symmetric_session_attrs session_attrs[TEST_CASES_GCM];
4431         static const struct cryptodev_perf_test_data *gcm_test;
4432
4433         for (i = 0; i < TEST_CASES_GCM; ++i) {
4434
4435                 gcm_test = gcm_tests[i];
4436
4437                 session_attrs[i].cipher =
4438                                 RTE_CRYPTO_CIPHER_OP_ENCRYPT;
4439                 session_attrs[i].cipher_algorithm =
4440                                 RTE_CRYPTO_CIPHER_AES_GCM;
4441                 session_attrs[i].key_cipher_data =
4442                                 gcm_test->key.data;
4443                 session_attrs[i].key_cipher_len =
4444                                 gcm_test->key.len;
4445                 session_attrs[i].auth_algorithm =
4446                                 RTE_CRYPTO_AUTH_AES_GCM;
4447                 session_attrs[i].auth =
4448                         RTE_CRYPTO_AUTH_OP_GENERATE;
4449                 session_attrs[i].key_auth_data = NULL;
4450                 session_attrs[i].key_auth_len = 0;
4451                 session_attrs[i].digest_len =
4452                                 gcm_test->auth_tag.len;
4453
4454                 ops_set[i].aad_data = gcm_test->aad.data;
4455                 ops_set[i].aad_len = gcm_test->aad.len;
4456                 ops_set[i].iv_data = gcm_test->iv.data;
4457                 ops_set[i].iv_len = gcm_test->iv.len;
4458                 ops_set[i].p_data = gcm_test->plaintext.data;
4459                 ops_set[i].p_len = buf_lengths[i];
4460                 ops_set[i].c_data = gcm_test->ciphertext.data;
4461                 ops_set[i].c_len = buf_lengths[i];
4462                 ops_set[i].t_data = gcm_test->auth_tags[i].data;
4463                 ops_set[i].t_len = gcm_test->auth_tags[i].len;
4464
4465                 params_set[i].chain = CIPHER_HASH;
4466                 params_set[i].session_attrs = &session_attrs[i];
4467                 params_set[i].symmetric_op = &ops_set[i];
4468                 if (continual_buf_len)
4469                         params_set[i].total_operations = 0xFFFFFF;
4470                 else
4471                         params_set[i].total_operations = 1000000;
4472
4473                 params_set[i].burst_size = burst_size;
4474
4475         }
4476
4477         if (continual_buf_len)
4478                 printf("\nCipher algo: %s Cipher hash: %s cipher key size: %ub"
4479                         " burst size: %u", "AES_GCM", "AES_GCM",
4480                         gcm_test->key.len << 3, burst_size);
4481
4482         for (i = 0; i < RTE_DIM(gcm_tests); i++) {
4483
4484                 if (!continual_buf_len) {
4485                         printf("\nCipher algo: %s Cipher hash: %s cipher key size: %ub"
4486                                 " burst size: %u", "AES_GCM", "AES_GCM",
4487                                 gcm_test->key.len << 3, burst_size);
4488                         printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t"
4489                                 " Retries\tEmptyPolls");
4490                 }
4491
4492                 uint16_t len = RTE_DIM(buf_lengths);
4493                 uint16_t p = 0;
4494
4495                 if (continual_buf_len) {
4496                         for (k = 0; k < RTE_DIM(buf_lengths); k++)
4497                                 if (buf_lengths[k] == continual_buf_len) {
4498                                         len = k + 1;
4499                                         p = k;
4500                                         break;
4501                                 }
4502                 }
4503                 for (j = p; j < len; ++j) {
4504
4505                         params_set[i].symmetric_op->c_len = buf_lengths[j];
4506                         params_set[i].symmetric_op->p_len = buf_lengths[j];
4507
4508                         ops_set[i].t_data = gcm_tests[i]->auth_tags[j].data;
4509                         ops_set[i].t_len = gcm_tests[i]->auth_tags[j].len;
4510
4511                         /* Run is twice, one for encryption/hash checks,
4512                          * one for perf
4513                          */
4514                         if (perf_AES_GCM(testsuite_params.dev_id, 0,
4515                                         &params_set[i], 1))
4516                                 return TEST_FAILED;
4517
4518                         for (k = 0; k < loops; k++) {
4519                                 if (continual_buf_len)
4520                                         printf("\n\nBuffer Size(B)\tOPS(M)\t"
4521                                                 "Throughput(Gbps)\t"
4522                                                 "Retries\tEmptyPolls");
4523                                 if (perf_AES_GCM(testsuite_params.dev_id, 0,
4524                                                 &params_set[i], 0))
4525                                         return TEST_FAILED;
4526                                 if (continual_buf_len)
4527                                         printf("\n\nCompleted loop %i of %i ...",
4528                                                 k+1, loops);
4529                         }
4530                 }
4531
4532         }
4533         printf("\n");
4534         return 0;
4535 }
4536
4537 static int test_cryptodev_perf_AES_GCM(void)
4538 {
4539         return test_perf_AES_GCM(0, 0);
4540 }
4541 /*
4542  * This function calls AES GCM performance tests providing
4543  * size of packet as an argument. If size of packet is not
4544  * in the buf_lengths array, all sizes will be used
4545  */
4546 static int test_continual_perf_AES_GCM(void)
4547 {
4548         return test_perf_AES_GCM(1024, 10);
4549 }
4550
4551 static int
4552 test_perf_continual_performance_test(void)
4553 {
4554         unsigned int total_operations = 0xFFFFFF;
4555         unsigned int total_loops = 10;
4556         unsigned int burst_size = 32;
4557         uint8_t i;
4558
4559         struct perf_test_params params_set = {
4560                 .total_operations = total_operations,
4561                 .burst_size = burst_size,
4562                 .buf_size = 1024,
4563
4564                 .chain = CIPHER_HASH,
4565
4566                 .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
4567                 .cipher_key_length = 16,
4568                 .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
4569         };
4570
4571         for (i = 1; i <= total_loops; ++i) {
4572                 printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u."
4573                         " burst_size: %d ops\n",
4574                         chain_mode_name(params_set.chain),
4575                         rte_crypto_cipher_algorithm_strings[params_set.cipher_algo],
4576                         rte_crypto_auth_algorithm_strings[params_set.auth_algo],
4577                         params_set.cipher_key_length,
4578                         burst_size);
4579                 printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t"
4580                                 "Retries\tEmptyPolls\n");
4581                                 test_perf_aes_sha(testsuite_params.dev_id, 0,
4582                                         &params_set);
4583                 printf("\nCompleted loop %i of %i ...", i, total_loops);
4584         }
4585         return 0;
4586 }
4587
4588 static struct unit_test_suite cryptodev_qat_continual_testsuite  = {
4589         .suite_name = "Crypto Device Continual Performance Test",
4590         .setup = testsuite_setup,
4591         .teardown = testsuite_teardown,
4592         .unit_test_cases = {
4593                 TEST_CASE_ST(ut_setup, ut_teardown,
4594                                 test_perf_continual_performance_test),
4595                 TEST_CASE_ST(ut_setup, ut_teardown,
4596                                 test_continual_perf_AES_GCM),
4597                 TEST_CASES_END() /**< NULL terminate unit test array */
4598         }
4599 };
4600
4601 static struct unit_test_suite cryptodev_testsuite  = {
4602         .suite_name = "Crypto Device Unit Test Suite",
4603         .setup = testsuite_setup,
4604         .teardown = testsuite_teardown,
4605         .unit_test_cases = {
4606                 TEST_CASE_ST(ut_setup, ut_teardown,
4607                                 test_perf_aes_cbc_encrypt_digest_vary_pkt_size),
4608                 TEST_CASE_ST(ut_setup, ut_teardown,
4609                                 test_cryptodev_perf_AES_GCM),
4610                 TEST_CASE_ST(ut_setup, ut_teardown,
4611                                 test_perf_aes_cbc_vary_burst_size),
4612                 TEST_CASES_END() /**< NULL terminate unit test array */
4613         }
4614 };
4615
4616 static struct unit_test_suite cryptodev_dpaa2_sec_testsuite  = {
4617         .suite_name = "Crypto Device DPAA2_SEC Unit Test Suite",
4618         .setup = testsuite_setup,
4619         .teardown = testsuite_teardown,
4620         .unit_test_cases = {
4621                 TEST_CASE_ST(ut_setup, ut_teardown,
4622                              test_perf_aes_cbc_encrypt_digest_vary_pkt_size),
4623                 TEST_CASES_END() /**< NULL terminate unit test array */
4624         }
4625 };
4626
4627 static struct unit_test_suite cryptodev_gcm_testsuite  = {
4628         .suite_name = "Crypto Device AESNI GCM Unit Test Suite",
4629         .setup = testsuite_setup,
4630         .teardown = testsuite_teardown,
4631         .unit_test_cases = {
4632                 TEST_CASE_ST(ut_setup, ut_teardown,
4633                                 test_cryptodev_perf_AES_GCM),
4634                 TEST_CASES_END() /**< NULL terminate unit test array */
4635         }
4636 };
4637
4638 static struct unit_test_suite cryptodev_aes_testsuite  = {
4639         .suite_name = "Crypto Device AESNI MB Unit Test Suite",
4640         .setup = testsuite_setup,
4641         .teardown = testsuite_teardown,
4642         .unit_test_cases = {
4643                 TEST_CASE_ST(ut_setup, ut_teardown,
4644                                 test_perf_aes_cbc_encrypt_digest_vary_pkt_size),
4645                 TEST_CASES_END() /**< NULL terminate unit test array */
4646         }
4647 };
4648
4649 static struct unit_test_suite cryptodev_snow3g_testsuite  = {
4650         .suite_name = "Crypto Device SNOW3G Unit Test Suite",
4651         .setup = testsuite_setup,
4652         .teardown = testsuite_teardown,
4653         .unit_test_cases = {
4654                 TEST_CASE_ST(ut_setup, ut_teardown,
4655                                 test_perf_snow3G_vary_pkt_size),
4656                 TEST_CASE_ST(ut_setup, ut_teardown,
4657                                 test_perf_snow3G_vary_burst_size),
4658                 TEST_CASES_END() /**< NULL terminate unit test array */
4659         }
4660 };
4661
4662 static struct unit_test_suite cryptodev_openssl_testsuite  = {
4663         .suite_name = "Crypto Device OPENSSL Unit Test Suite",
4664         .setup = testsuite_setup,
4665         .teardown = testsuite_teardown,
4666         .unit_test_cases = {
4667                 TEST_CASE_ST(ut_setup, ut_teardown,
4668                                 test_perf_openssl_vary_pkt_size),
4669                 TEST_CASE_ST(ut_setup, ut_teardown,
4670                                 test_perf_openssl_vary_burst_size),
4671                 TEST_CASES_END() /**< NULL terminate unit test array */
4672         }
4673 };
4674
4675 static struct unit_test_suite cryptodev_armv8_testsuite  = {
4676         .suite_name = "Crypto Device ARMv8 Unit Test Suite",
4677         .setup = testsuite_setup,
4678         .teardown = testsuite_teardown,
4679         .unit_test_cases = {
4680                 TEST_CASE_ST(ut_setup, ut_teardown,
4681                                 test_perf_armv8_vary_pkt_size),
4682                 TEST_CASE_ST(ut_setup, ut_teardown,
4683                                 test_perf_armv8_vary_burst_size),
4684                 TEST_CASES_END() /**< NULL terminate unit test array */
4685         }
4686 };
4687
4688 static int
4689 perftest_aesni_gcm_cryptodev(void)
4690 {
4691         gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_AESNI_GCM_PMD;
4692
4693         return unit_test_suite_runner(&cryptodev_gcm_testsuite);
4694 }
4695
4696 static int
4697 perftest_aesni_mb_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
4698 {
4699         gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_AESNI_MB_PMD;
4700
4701         return unit_test_suite_runner(&cryptodev_aes_testsuite);
4702 }
4703
4704 static int
4705 perftest_qat_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
4706 {
4707         gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_QAT_SYM_PMD;
4708
4709         return unit_test_suite_runner(&cryptodev_testsuite);
4710 }
4711
4712 static int
4713 perftest_sw_snow3g_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
4714 {
4715         gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_SNOW3G_PMD;
4716
4717         return unit_test_suite_runner(&cryptodev_snow3g_testsuite);
4718 }
4719
4720 static int
4721 perftest_qat_snow3g_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
4722 {
4723         gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_QAT_SYM_PMD;
4724
4725         return unit_test_suite_runner(&cryptodev_snow3g_testsuite);
4726 }
4727
4728 static int
4729 perftest_openssl_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
4730 {
4731         gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_OPENSSL_PMD;
4732
4733         return unit_test_suite_runner(&cryptodev_openssl_testsuite);
4734 }
4735
4736 static int
4737 perftest_qat_continual_cryptodev(void)
4738 {
4739         gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_QAT_SYM_PMD;
4740
4741         return unit_test_suite_runner(&cryptodev_qat_continual_testsuite);
4742 }
4743
4744 static int
4745 perftest_sw_armv8_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
4746 {
4747         gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_ARMV8_PMD;
4748
4749         return unit_test_suite_runner(&cryptodev_armv8_testsuite);
4750 }
4751
4752 static int
4753 perftest_dpaa2_sec_cryptodev(void)
4754 {
4755         gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_DPAA2_SEC_PMD;
4756
4757         return unit_test_suite_runner(&cryptodev_dpaa2_sec_testsuite);
4758 }
4759
4760 REGISTER_TEST_COMMAND(cryptodev_aesni_mb_perftest, perftest_aesni_mb_cryptodev);
4761 REGISTER_TEST_COMMAND(cryptodev_qat_perftest, perftest_qat_cryptodev);
4762 REGISTER_TEST_COMMAND(cryptodev_sw_snow3g_perftest, perftest_sw_snow3g_cryptodev);
4763 REGISTER_TEST_COMMAND(cryptodev_qat_snow3g_perftest, perftest_qat_snow3g_cryptodev);
4764 REGISTER_TEST_COMMAND(cryptodev_aesni_gcm_perftest, perftest_aesni_gcm_cryptodev);
4765 REGISTER_TEST_COMMAND(cryptodev_openssl_perftest,
4766                 perftest_openssl_cryptodev);
4767 REGISTER_TEST_COMMAND(cryptodev_qat_continual_perftest,
4768                 perftest_qat_continual_cryptodev);
4769 REGISTER_TEST_COMMAND(cryptodev_sw_armv8_perftest,
4770                 perftest_sw_armv8_cryptodev);
4771 REGISTER_TEST_COMMAND(cryptodev_dpaa2_sec_perftest,
4772                       perftest_dpaa2_sec_cryptodev);