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