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