app/test: add AES GCM performance test
[dpdk.git] / app / test / test_cryptodev_perf.c
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
5  *
6  *   Redistribution and use in source and binary forms, with or without
7  *   modification, are permitted provided that the following conditions
8  *   are met:
9  *
10  *       * Redistributions of source code must retain the above copyright
11  *         notice, this list of conditions and the following disclaimer.
12  *       * Redistributions in binary form must reproduce the above copyright
13  *         notice, this list of conditions and the following disclaimer in
14  *         the documentation and/or other materials provided with the
15  *         distribution.
16  *       * Neither the name of Intel Corporation nor the names of its
17  *         contributors may be used to endorse or promote products derived
18  *         from this software without specific prior written permission.
19  *
20  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 #include <rte_common.h>
34 #include <rte_mbuf.h>
35 #include <rte_malloc.h>
36 #include <rte_memcpy.h>
37
38 #include <rte_crypto.h>
39 #include <rte_cryptodev.h>
40 #include <rte_cycles.h>
41
42 #include "test.h"
43 #include "test_cryptodev.h"
44 #include "test_cryptodev_gcm_test_vectors.h"
45
46
47 #define PERF_NUM_OPS_INFLIGHT           (128)
48 #define DEFAULT_NUM_REQS_TO_SUBMIT      (10000000)
49
50 struct crypto_testsuite_params {
51         struct rte_mempool *mbuf_mp;
52         struct rte_mempool *op_mpool;
53
54         uint16_t nb_queue_pairs;
55
56         struct rte_cryptodev_config conf;
57         struct rte_cryptodev_qp_conf qp_conf;
58         uint8_t dev_id;
59 };
60
61 enum chain_mode {
62         CIPHER_HASH,
63         HASH_CIPHER,
64         CIPHER_ONLY,
65         HASH_ONLY
66 };
67
68
69 struct symmetric_op {
70         const uint8_t *iv_data;
71         uint32_t iv_len;
72
73         const uint8_t *aad_data;
74         uint32_t aad_len;
75
76         const uint8_t *p_data;
77         uint32_t p_len;
78
79         const uint8_t *c_data;
80         uint32_t c_len;
81
82         const uint8_t *t_data;
83         uint32_t t_len;
84
85 };
86
87 struct symmetric_session_attrs {
88         enum rte_crypto_cipher_operation cipher;
89         enum rte_crypto_auth_operation auth;
90
91         enum rte_crypto_cipher_algorithm cipher_algorithm;
92         const uint8_t *key_cipher_data;
93         uint32_t key_cipher_len;
94
95         enum rte_crypto_auth_algorithm auth_algorithm;
96         const uint8_t *key_auth_data;
97         uint32_t key_auth_len;
98
99         uint32_t digest_len;
100 };
101
102 #define ALIGN_POW2_ROUNDUP(num, align) \
103         (((num) + (align) - 1) & ~((align) - 1))
104
105 /*
106  * This struct is needed to avoid unnecessary allocation or checking
107  * of allocation of crypto params with current alloc on the fly
108  * implementation.
109  */
110
111 struct crypto_params {
112         uint8_t *aad;
113         uint8_t *iv;
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, unsigned cipher_key_len,
153                 enum rte_crypto_auth_algorithm auth_algo);
154 static struct rte_mbuf *
155 test_perf_create_pktmbuf(struct rte_mempool *mpool, unsigned buf_sz);
156 static inline struct rte_crypto_op *
157 test_perf_set_crypto_op_snow3g(struct rte_crypto_op *op, struct rte_mbuf *m,
158                 struct rte_cryptodev_sym_session *sess, unsigned data_len,
159                 unsigned digest_len);
160 static uint32_t get_auth_digest_length(enum rte_crypto_auth_algorithm algo);
161
162
163 static const char *chain_mode_name(enum chain_mode mode)
164 {
165         switch (mode) {
166         case CIPHER_HASH: return "cipher_hash"; break;
167         case HASH_CIPHER: return "hash_cipher"; break;
168         case CIPHER_ONLY: return "cipher_only"; break;
169         case HASH_ONLY: return "hash_only"; break;
170         default: return ""; break;
171         }
172 }
173
174 static const char *pmd_name(enum rte_cryptodev_type pmd)
175 {
176         switch (pmd) {
177         case RTE_CRYPTODEV_NULL_PMD: return RTE_STR(CRYPTODEV_NAME_NULL_PMD); break;
178         case RTE_CRYPTODEV_AESNI_GCM_PMD:
179                 return RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD);
180         case RTE_CRYPTODEV_AESNI_MB_PMD:
181                 return RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD);
182         case RTE_CRYPTODEV_QAT_SYM_PMD:
183                 return RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD);
184         case RTE_CRYPTODEV_SNOW3G_PMD:
185                 return RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD);
186         default:
187                 return "";
188         }
189 }
190
191 static const char *cipher_algo_name(enum rte_crypto_cipher_algorithm cipher_algo)
192 {
193         switch (cipher_algo) {
194         case RTE_CRYPTO_CIPHER_NULL: return "NULL";
195         case RTE_CRYPTO_CIPHER_3DES_CBC: return "3DES_CBC";
196         case RTE_CRYPTO_CIPHER_3DES_CTR: return "3DES_CTR";
197         case RTE_CRYPTO_CIPHER_3DES_ECB: return "3DES_ECB";
198         case RTE_CRYPTO_CIPHER_AES_CBC: return "AES_CBC";
199         case RTE_CRYPTO_CIPHER_AES_CCM: return "AES_CCM";
200         case RTE_CRYPTO_CIPHER_AES_CTR: return "AES_CTR";
201         case RTE_CRYPTO_CIPHER_AES_ECB: return "AES_ECB";
202         case RTE_CRYPTO_CIPHER_AES_F8: return "AES_F8";
203         case RTE_CRYPTO_CIPHER_AES_GCM: return "AES_GCM";
204         case RTE_CRYPTO_CIPHER_AES_XTS: return "AES_XTS";
205         case RTE_CRYPTO_CIPHER_ARC4: return "ARC4";
206         case RTE_CRYPTO_CIPHER_KASUMI_F8: return "KASUMI_F8";
207         case RTE_CRYPTO_CIPHER_SNOW3G_UEA2: return "SNOW3G_UEA2";
208         case RTE_CRYPTO_CIPHER_ZUC_EEA3: return "ZUC_EEA3";
209         default: return "Another cipher algo";
210         }
211 }
212
213 static const char *auth_algo_name(enum rte_crypto_auth_algorithm auth_algo)
214 {
215         switch (auth_algo) {
216         case RTE_CRYPTO_AUTH_NULL: return "NULL"; break;
217         case RTE_CRYPTO_AUTH_AES_CBC_MAC: return "AES_CBC_MAC"; break;
218         case RTE_CRYPTO_AUTH_AES_CCM: return "AES_CCM"; break;
219         case RTE_CRYPTO_AUTH_AES_CMAC: return "AES_CMAC,"; break;
220         case RTE_CRYPTO_AUTH_AES_GCM: return "AES_GCM"; break;
221         case RTE_CRYPTO_AUTH_AES_GMAC: return "AES_GMAC"; break;
222         case RTE_CRYPTO_AUTH_AES_XCBC_MAC: return "AES_XCBC_MAC"; break;
223         case RTE_CRYPTO_AUTH_KASUMI_F9: return "KASUMI_F9"; break;
224         case RTE_CRYPTO_AUTH_MD5: return "MD5"; break;
225         case RTE_CRYPTO_AUTH_MD5_HMAC: return "MD5_HMAC,"; break;
226         case RTE_CRYPTO_AUTH_SHA1: return "SHA1"; break;
227         case RTE_CRYPTO_AUTH_SHA1_HMAC: return "SHA1_HMAC"; break;
228         case RTE_CRYPTO_AUTH_SHA224: return "SHA224"; break;
229         case RTE_CRYPTO_AUTH_SHA224_HMAC: return "SHA224_HMAC"; break;
230         case RTE_CRYPTO_AUTH_SHA256: return "SHA256"; break;
231         case RTE_CRYPTO_AUTH_SHA256_HMAC: return "SHA256_HMAC"; break;
232         case RTE_CRYPTO_AUTH_SHA384: return "SHA384,"; break;
233         case RTE_CRYPTO_AUTH_SHA384_HMAC: return "SHA384_HMAC,"; break;
234         case RTE_CRYPTO_AUTH_SHA512: return "SHA512,"; break;
235         case RTE_CRYPTO_AUTH_SHA512_HMAC: return "SHA512_HMAC,"; break;
236         case RTE_CRYPTO_AUTH_SNOW3G_UIA2: return "SNOW3G_UIA2"; break;
237         case RTE_CRYPTO_AUTH_ZUC_EIA3: return "RTE_CRYPTO_AUTH_ZUC_EIA3"; break;
238         default: return "Another auth algo"; break;
239         };
240 }
241
242 static struct rte_mbuf *
243 setup_test_string(struct rte_mempool *mpool,
244                 const uint8_t *data, size_t len, uint8_t blocksize)
245 {
246         struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
247         size_t t_len = len - (blocksize ? (len % blocksize) : 0);
248
249         if (m) {
250                 char *dst = rte_pktmbuf_append(m, t_len);
251
252                 if (!dst) {
253                         rte_pktmbuf_free(m);
254                         return NULL;
255                 }
256
257                 rte_memcpy(dst, (const void *)data, t_len);
258         }
259         return m;
260 }
261
262 static struct crypto_testsuite_params testsuite_params = { NULL };
263 static struct crypto_unittest_params unittest_params;
264 static enum rte_cryptodev_type gbl_cryptodev_perftest_devtype;
265
266 static int
267 testsuite_setup(void)
268 {
269         struct crypto_testsuite_params *ts_params = &testsuite_params;
270         struct rte_cryptodev_info info;
271         unsigned i, nb_devs, valid_dev_id = 0;
272         int ret;
273         uint16_t qp_id;
274
275         ts_params->mbuf_mp = rte_mempool_lookup("CRYPTO_PERF_MBUFPOOL");
276         if (ts_params->mbuf_mp == NULL) {
277                 /* Not already created so create */
278                 ts_params->mbuf_mp = rte_pktmbuf_pool_create(
279                                 "CRYPTO_PERF_MBUFPOOL",
280                                 NUM_MBUFS, MBUF_CACHE_SIZE, 0, MBUF_SIZE,
281                                 rte_socket_id());
282                 if (ts_params->mbuf_mp == NULL) {
283                         RTE_LOG(ERR, USER1, "Can't create CRYPTO_PERF_MBUFPOOL\n");
284                         return TEST_FAILED;
285                 }
286         }
287
288
289         ts_params->op_mpool = rte_crypto_op_pool_create("CRYPTO_OP_POOL",
290                         RTE_CRYPTO_OP_TYPE_SYMMETRIC,
291                         NUM_MBUFS, MBUF_CACHE_SIZE,
292                         DEFAULT_NUM_XFORMS *
293                         sizeof(struct rte_crypto_sym_xform),
294                         rte_socket_id());
295                 if (ts_params->op_mpool == NULL) {
296                         RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n");
297                         return TEST_FAILED;
298                 }
299
300         /* Create 2 AESNI MB devices if required */
301         if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_AESNI_MB_PMD) {
302                 nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_AESNI_MB_PMD);
303                 if (nb_devs < 2) {
304                         for (i = nb_devs; i < 2; i++) {
305                                 ret = rte_eal_vdev_init(
306                                         RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL);
307
308                                 TEST_ASSERT(ret == 0,
309                                         "Failed to create instance %u of pmd : %s",
310                                         i, RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
311                         }
312                 }
313         }
314
315         /* Create 2 AESNI GCM devices if required */
316         if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_AESNI_GCM_PMD) {
317                 nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_AESNI_GCM_PMD);
318                 if (nb_devs < 2) {
319                         for (i = nb_devs; i < 2; i++) {
320                                 ret = rte_eal_vdev_init(
321                                         RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), NULL);
322
323                                 TEST_ASSERT(ret == 0,
324                                         "Failed to create instance %u of pmd : %s",
325                                         i, RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
326                         }
327                 }
328         }
329
330         /* Create 2 SNOW3G devices if required */
331         if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_SNOW3G_PMD) {
332                 nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_SNOW3G_PMD);
333                 if (nb_devs < 2) {
334                         for (i = nb_devs; i < 2; i++) {
335                                 ret = rte_eal_vdev_init(
336                                         RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), NULL);
337
338                                 TEST_ASSERT(ret == 0,
339                                         "Failed to create instance %u of pmd : %s",
340                                         i, RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
341                         }
342                 }
343         }
344
345         nb_devs = rte_cryptodev_count();
346         if (nb_devs < 1) {
347                 RTE_LOG(ERR, USER1, "No crypto devices found?");
348                 return TEST_FAILED;
349         }
350
351         /* Search for the first valid */
352         for (i = 0; i < nb_devs; i++) {
353                 rte_cryptodev_info_get(i, &info);
354                 if (info.dev_type == gbl_cryptodev_perftest_devtype) {
355                         ts_params->dev_id = i;
356                         valid_dev_id = 1;
357                         break;
358                 }
359         }
360
361         if (!valid_dev_id)
362                 return TEST_FAILED;
363
364         /*
365          * Using Crypto Device Id 0 by default.
366          * Since we can't free and re-allocate queue memory always set the queues
367          * on this device up to max size first so enough memory is allocated for
368          * any later re-configures needed by other tests
369          */
370
371         rte_cryptodev_info_get(ts_params->dev_id, &info);
372
373         ts_params->conf.nb_queue_pairs = DEFAULT_NUM_QPS_PER_QAT_DEVICE;
374         ts_params->conf.socket_id = SOCKET_ID_ANY;
375         ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions;
376
377         TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->dev_id,
378                         &ts_params->conf),
379                         "Failed to configure cryptodev %u",
380                         ts_params->dev_id);
381
382
383         ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT;
384
385         for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) {
386                 TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
387                         ts_params->dev_id, qp_id,
388                         &ts_params->qp_conf,
389                         rte_cryptodev_socket_id(ts_params->dev_id)),
390                         "Failed to setup queue pair %u on cryptodev %u",
391                         qp_id, ts_params->dev_id);
392         }
393
394         /*Now reconfigure queues to size we actually want to use in this testsuite.*/
395         ts_params->qp_conf.nb_descriptors = PERF_NUM_OPS_INFLIGHT;
396         for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) {
397
398                 TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
399                         ts_params->dev_id, qp_id,
400                                 &ts_params->qp_conf,
401                                 rte_cryptodev_socket_id(ts_params->dev_id)),
402                                 "Failed to setup queue pair %u on cryptodev %u",
403                                 qp_id, ts_params->dev_id);
404         }
405
406         return TEST_SUCCESS;
407 }
408 static void
409 testsuite_teardown(void)
410 {
411         struct crypto_testsuite_params *ts_params =
412                         &testsuite_params;
413
414         if (ts_params->mbuf_mp != NULL)
415                 RTE_LOG(DEBUG, USER1, "CRYPTO_PERF_MBUFPOOL count %u\n",
416                 rte_mempool_avail_count(ts_params->mbuf_mp));
417         if (ts_params->op_mpool != NULL)
418                 RTE_LOG(DEBUG, USER1, "CRYPTO_PERF_OP POOL count %u\n",
419                 rte_mempool_avail_count(ts_params->op_mpool));
420 }
421
422 static int
423 ut_setup(void)
424 {
425         struct crypto_testsuite_params *ts_params = &testsuite_params;
426         struct crypto_unittest_params *ut_params = &unittest_params;
427
428         /* Clear unit test parameters before running test */
429         memset(ut_params, 0, sizeof(*ut_params));
430
431         rte_cryptodev_stats_reset(ts_params->dev_id);
432
433         /* Start the device */
434         TEST_ASSERT_SUCCESS(rte_cryptodev_start(ts_params->dev_id),
435                         "Failed to start cryptodev %u",
436                         ts_params->dev_id);
437
438         return TEST_SUCCESS;
439 }
440
441 static void
442 ut_teardown(void)
443 {
444         struct crypto_testsuite_params *ts_params = &testsuite_params;
445         struct crypto_unittest_params *ut_params = &unittest_params;
446         struct rte_cryptodev_stats stats;
447
448         unsigned i;
449
450         /* free crypto session structure */
451         if (ut_params->sess)
452                 rte_cryptodev_sym_session_free(ts_params->dev_id,
453                                 ut_params->sess);
454
455         /* free crypto operation structure */
456         if (ut_params->op)
457                 rte_crypto_op_free(ut_params->op);
458
459         for (i = 0; i < MAX_NUM_OF_OPS_PER_UT; i++) {
460                 if (ut_params->obuf[i])
461                         rte_pktmbuf_free(ut_params->obuf[i]);
462                 else if (ut_params->ibuf[i])
463                         rte_pktmbuf_free(ut_params->ibuf[i]);
464         }
465
466         if (ts_params->mbuf_mp != NULL)
467                 RTE_LOG(DEBUG, USER1, "CRYPTO_PERF_MBUFPOOL count %u\n",
468                         rte_mempool_avail_count(ts_params->mbuf_mp));
469
470         rte_cryptodev_stats_get(ts_params->dev_id, &stats);
471
472         /* Stop the device */
473         rte_cryptodev_stop(ts_params->dev_id);
474 }
475
476 const char plaintext_quote[] =
477                 "THE COUNT OF MONTE CRISTO by Alexandre Dumas, Pere Chapter 1. "
478                 "Marseilles--The Arrival. On the 24th of February, 1815, the "
479                 "look-out at Notre-Dame de la Garde signalled the three-master,"
480                 " the Pharaon from Smyrna, Trieste, and Naples. As usual, a "
481                 "pilot put off immediately, and rounding the Chateau d'If, got "
482                 "on board the vessel between Cape Morgion and Rion island. "
483                 "Immediately, and according to custom, the ramparts of Fort "
484                 "Saint-Jean were covered with spectators; it is always an event "
485                 "at Marseilles for a ship to come into port, especially when "
486                 "this ship, like the Pharaon, has been built, rigged, and laden"
487                 " at the old Phocee docks, and belongs to an owner of the city."
488                 " The ship drew on and had safely passed the strait, which some"
489                 " volcanic shock has made between the Calasareigne and Jaros "
490                 "islands; had doubled Pomegue, and approached the harbor under"
491                 " topsails, jib, and spanker, but so slowly and sedately that"
492                 " the idlers, with that instinct which is the forerunner of "
493                 "evil, asked one another what misfortune could have happened "
494                 "on board. However, those experienced in navigation saw plainly"
495                 " that if any accident had occurred, it was not to the vessel "
496                 "herself, for she bore down with all the evidence of being "
497                 "skilfully handled, the anchor a-cockbill, the jib-boom guys "
498                 "already eased off, and standing by the side of the pilot, who"
499                 " was steering the Pharaon towards the narrow entrance of the"
500                 " inner port, was a young man, who, with activity and vigilant"
501                 " eye, watched every motion of the ship, and repeated each "
502                 "direction of the pilot. The vague disquietude which prevailed "
503                 "among the spectators had so much affected one of the crowd "
504                 "that he did not await the arrival of the vessel in harbor, but"
505                 " jumping into a small skiff, desired to be pulled alongside "
506                 "the Pharaon, which he reached as she rounded into La Reserve "
507                 "basin. When the young man on board saw this person approach, "
508                 "he left his station by the pilot, and, hat in hand, leaned "
509                 "over the ship's bulwarks. He was a fine, tall, slim young "
510                 "fellow of eighteen or twenty, with black eyes, and hair as "
511                 "dark as a raven's wing; and his whole appearance bespoke that "
512                 "calmness and resolution peculiar to men accustomed from their "
513                 "cradle to contend with danger. \"Ah, is it you, Dantes?\" "
514                 "cried the man in the skiff. \"What's the matter? and why have "
515                 "you such an air of sadness aboard?\" \"A great misfortune, M. "
516                 "Morrel,\" replied the young man,--\"a great misfortune, for me"
517                 " especially! Off Civita Vecchia we lost our brave Captain "
518                 "Leclere.\" \"And the cargo?\" inquired the owner, eagerly. "
519                 "\"Is all safe, M. Morrel; and I think you will be satisfied on"
520                 " that head. But poor Captain Leclere--\" \"What happened to "
521                 "him?\" asked the owner, with an air of considerable "
522                 "resignation. \"What happened to the worthy captain?\" \"He "
523                 "died.\" \"Fell into the sea?\" \"No, sir, he died of "
524                 "brain-fever in dreadful agony.\" Then turning to the crew, "
525                 "he said, \"Bear a hand there, to take in sail!\" All hands "
526                 "obeyed, and at once the eight or ten seamen who composed the "
527                 "crew, sprang to their respective stations at the spanker "
528                 "brails and outhaul, topsail sheets and halyards, the jib "
529                 "downhaul, and the topsail clewlines and buntlines. The young "
530                 "sailor gave a look to see that his orders were promptly and "
531                 "accurately obeyed, and then turned again to the owner. \"And "
532                 "how did this misfortune occur?\" inquired the latter, resuming"
533                 " the interrupted conversation. \"Alas, sir, in the most "
534                 "unexpected manner. After a long talk with the harbor-master, "
535                 "Captain Leclere left Naples greatly disturbed in mind. In "
536                 "twenty-four hours he was attacked by a fever, and died three "
537                 "days afterwards. We performed the usual burial service, and he"
538                 " is at his rest, sewn up in his hammock with a thirty-six "
539                 "pound shot at his head and his heels, off El Giglio island. "
540                 "We bring to his widow his sword and cross of honor. It was "
541                 "worth while, truly,\" added the young man with a melancholy "
542                 "smile, \"to make war against the English for ten years, and "
543                 "to die in his bed at last, like everybody else.";
544
545 #define QUOTE_LEN_64B           (64)
546 #define QUOTE_LEN_128B          (128)
547 #define QUOTE_LEN_256B          (256)
548 #define QUOTE_LEN_512B          (512)
549 #define QUOTE_LEN_768B          (768)
550 #define QUOTE_LEN_1024B         (1024)
551 #define QUOTE_LEN_1280B         (1280)
552 #define QUOTE_LEN_1536B         (1536)
553 #define QUOTE_LEN_1792B         (1792)
554 #define QUOTE_LEN_2048B         (2048)
555
556
557 /* ***** AES-CBC / HMAC-SHA256 Performance Tests ***** */
558
559 #define HMAC_KEY_LENGTH_SHA256  (DIGEST_BYTE_LENGTH_SHA256)
560
561 #define CIPHER_KEY_LENGTH_AES_CBC       (16)
562 #define CIPHER_IV_LENGTH_AES_CBC        (CIPHER_KEY_LENGTH_AES_CBC)
563
564 static uint8_t aes_cbc_128_key[] = {
565                 0xE4, 0x23, 0x33, 0x8A, 0x35, 0x64, 0x61, 0xE2,
566                 0xF1, 0x35, 0x5C, 0x3B, 0xDD, 0x9A, 0x65, 0xBA };
567
568 static uint8_t aes_cbc_128_iv[] = {
569                 0xf5, 0xd3, 0x89, 0x0f, 0x47, 0x00, 0xcb, 0x52,
570                 0x42, 0x1a, 0x7d, 0x3d, 0xf5, 0x82, 0x80, 0xf1 };
571
572 static uint8_t hmac_sha256_key[] = {
573                 0xff, 0xcb, 0x37, 0x30, 0x1d, 0x4a, 0xc2, 0x41,
574                 0x49, 0x03, 0xDD, 0xC6, 0xB8, 0xCA, 0x55, 0x7A,
575                 0x58, 0x34, 0x85, 0x61, 0x1C, 0x42, 0x10, 0x76,
576                 0x9a, 0x4f, 0x88, 0x1b, 0xb6, 0x8f, 0xd8, 0x60 };
577
578
579 /* Cipher text output */
580
581 static const uint8_t AES_CBC_ciphertext_64B[] = {
582                 0x05, 0x15, 0x77, 0x32, 0xc9, 0x66, 0x91, 0x50,
583                 0x93, 0x9f, 0xbb, 0x4e, 0x2e, 0x5a, 0x02, 0xd0,
584                 0x2d, 0x9d, 0x31, 0x5d, 0xc8, 0x9e, 0x86, 0x36,
585                 0x54, 0x5c, 0x50, 0xe8, 0x75, 0x54, 0x74, 0x5e,
586                 0xd5, 0xa2, 0x84, 0x21, 0x2d, 0xc5, 0xf8, 0x1c,
587                 0x55, 0x1a, 0xba, 0x91, 0xce, 0xb5, 0xa3, 0x1e,
588                 0x31, 0xbf, 0xe9, 0xa1, 0x97, 0x5c, 0x2b, 0xd6,
589                 0x57, 0xa5, 0x9f, 0xab, 0xbd, 0xb0, 0x9b, 0x9c
590 };
591
592 static const uint8_t AES_CBC_ciphertext_128B[] = {
593                 0x79, 0x92, 0x65, 0xc8, 0xfb, 0x0a, 0xc7, 0xc4,
594                 0x9b, 0x3b, 0xbe, 0x69, 0x7f, 0x7c, 0xf4, 0x4e,
595                 0xa5, 0x0d, 0xf6, 0x33, 0xc4, 0xdf, 0xf3, 0x0d,
596                 0xdb, 0xb9, 0x68, 0x34, 0xb0, 0x0d, 0xbd, 0xb9,
597                 0xa7, 0xf3, 0x86, 0x50, 0x2a, 0xbe, 0x50, 0x5d,
598                 0xb3, 0xbe, 0x72, 0xf9, 0x02, 0xb1, 0x69, 0x0b,
599                 0x8c, 0x96, 0x4c, 0x3c, 0x0c, 0x1e, 0x76, 0xe5,
600                 0x7e, 0x75, 0xdd, 0xd0, 0xa9, 0x75, 0x00, 0x13,
601                 0x6b, 0x1e, 0xc0, 0xad, 0xfc, 0x03, 0xb5, 0x99,
602                 0xdc, 0x37, 0x35, 0xfc, 0x16, 0x34, 0xfd, 0xb4,
603                 0xea, 0x1e, 0xb6, 0x51, 0xdf, 0xab, 0x87, 0xd6,
604                 0x87, 0x41, 0xfa, 0x1c, 0xc6, 0x78, 0xa6, 0x3c,
605                 0x1d, 0x76, 0xfe, 0xff, 0x65, 0xfc, 0x63, 0x1e,
606                 0x1f, 0xe2, 0x7c, 0x9b, 0xa2, 0x72, 0xc3, 0x34,
607                 0x23, 0xdf, 0x01, 0xf0, 0xfd, 0x02, 0x8b, 0x97,
608                 0x00, 0x2b, 0x97, 0x4e, 0xab, 0x98, 0x21, 0x3c
609 };
610
611 static const uint8_t AES_CBC_ciphertext_256B[] = {
612                 0xc7, 0x71, 0x2b, 0xed, 0x2c, 0x97, 0x59, 0xfa,
613                 0xcf, 0x5a, 0xb9, 0x31, 0x92, 0xe0, 0xc9, 0x92,
614                 0xc0, 0x2d, 0xd5, 0x9c, 0x84, 0xbf, 0x70, 0x36,
615                 0x13, 0x48, 0xe0, 0xb1, 0xbf, 0x6c, 0xcd, 0x91,
616                 0xa0, 0xc3, 0x57, 0x6c, 0x3f, 0x0e, 0x34, 0x41,
617                 0xe7, 0x9c, 0xc0, 0xec, 0x18, 0x0c, 0x05, 0x52,
618                 0x78, 0xe2, 0x3c, 0x6e, 0xdf, 0xa5, 0x49, 0xc7,
619                 0xf2, 0x55, 0x00, 0x8f, 0x65, 0x6d, 0x4b, 0xd0,
620                 0xcb, 0xd4, 0xd2, 0x0b, 0xea, 0xf4, 0xb0, 0x85,
621                 0x61, 0x9e, 0x36, 0xc0, 0x71, 0xb7, 0x80, 0xad,
622                 0x40, 0x78, 0xb4, 0x70, 0x2b, 0xe8, 0x80, 0xc5,
623                 0x19, 0x35, 0x96, 0x55, 0x3b, 0x40, 0x03, 0xbb,
624                 0x9f, 0xa6, 0xc2, 0x82, 0x92, 0x04, 0xc3, 0xa6,
625                 0x96, 0xc4, 0x7f, 0x4c, 0x3e, 0x3c, 0x79, 0x82,
626                 0x88, 0x8b, 0x3f, 0x8b, 0xc5, 0x9f, 0x44, 0xbe,
627                 0x71, 0xe7, 0x09, 0xa2, 0x40, 0xa2, 0x23, 0x4e,
628                 0x9f, 0x31, 0xab, 0x6f, 0xdf, 0x59, 0x40, 0xe1,
629                 0x12, 0x15, 0x55, 0x4b, 0xea, 0x3f, 0xa1, 0x41,
630                 0x4f, 0xaf, 0xcd, 0x27, 0x2a, 0x61, 0xa1, 0x9e,
631                 0x82, 0x30, 0x05, 0x05, 0x55, 0xce, 0x99, 0xd3,
632                 0x8f, 0x3f, 0x86, 0x79, 0xdc, 0x9f, 0x33, 0x07,
633                 0x75, 0x26, 0xc8, 0x72, 0x81, 0x0f, 0x9b, 0xf7,
634                 0xb1, 0xfb, 0xd3, 0x91, 0x36, 0x08, 0xab, 0x26,
635                 0x70, 0x53, 0x0c, 0x99, 0xfd, 0xa9, 0x07, 0xb4,
636                 0xe9, 0xce, 0xc1, 0xd6, 0xd2, 0x2c, 0x71, 0x80,
637                 0xec, 0x59, 0x61, 0x0b, 0x24, 0xf0, 0x6d, 0x33,
638                 0x73, 0x45, 0x6e, 0x80, 0x03, 0x45, 0xf2, 0x76,
639                 0xa5, 0x8a, 0xc9, 0xcf, 0xaf, 0x4a, 0xed, 0x35,
640                 0xc0, 0x97, 0x52, 0xc5, 0x00, 0xdf, 0xef, 0xc7,
641                 0x9f, 0xf2, 0xe8, 0x15, 0x3e, 0xb3, 0x30, 0xe7,
642                 0x00, 0xd0, 0x4e, 0xeb, 0x79, 0xf6, 0xf6, 0xcf,
643                 0xf0, 0xe7, 0x61, 0xd5, 0x3d, 0x6a, 0x73, 0x9d
644 };
645
646 static const uint8_t AES_CBC_ciphertext_512B[] = {
647                 0xb4, 0xc6, 0xc6, 0x5f, 0x7e, 0xca, 0x05, 0x70,
648                 0x21, 0x7b, 0x92, 0x9e, 0x23, 0xe7, 0x92, 0xb8,
649                 0x27, 0x3d, 0x20, 0x29, 0x57, 0xfa, 0x1f, 0x26,
650                 0x0a, 0x04, 0x34, 0xa6, 0xf2, 0xdc, 0x44, 0xb6,
651                 0x43, 0x40, 0x62, 0xde, 0x0c, 0xde, 0x1c, 0x30,
652                 0x43, 0x85, 0x0b, 0xe8, 0x93, 0x1f, 0xa1, 0x2a,
653                 0x8a, 0x27, 0x35, 0x39, 0x14, 0x9f, 0x37, 0x64,
654                 0x59, 0xb5, 0x0e, 0x96, 0x82, 0x5d, 0x63, 0x45,
655                 0xd6, 0x93, 0x89, 0x46, 0xe4, 0x71, 0x31, 0xeb,
656                 0x0e, 0xd1, 0x7b, 0xda, 0x90, 0xb5, 0x81, 0xac,
657                 0x76, 0x54, 0x54, 0x85, 0x0b, 0xa9, 0x46, 0x9c,
658                 0xf0, 0xfd, 0xde, 0x5d, 0xa8, 0xe3, 0xee, 0xe9,
659                 0xf4, 0x9d, 0x34, 0x76, 0x39, 0xe7, 0xc3, 0x4a,
660                 0x84, 0x38, 0x92, 0x61, 0xf1, 0x12, 0x9f, 0x05,
661                 0xda, 0xdb, 0xc1, 0xd4, 0xb0, 0xa0, 0x27, 0x19,
662                 0xa0, 0x56, 0x5d, 0x9b, 0xcc, 0x47, 0x7c, 0x15,
663                 0x1d, 0x52, 0x66, 0xd5, 0xff, 0xef, 0x12, 0x23,
664                 0x86, 0xe2, 0xee, 0x81, 0x2c, 0x3d, 0x7d, 0x28,
665                 0xd5, 0x42, 0xdf, 0xdb, 0x75, 0x1c, 0xeb, 0xdf,
666                 0x13, 0x23, 0xd5, 0x17, 0x89, 0xea, 0xd7, 0x01,
667                 0xff, 0x57, 0x6a, 0x44, 0x61, 0xf4, 0xea, 0xbe,
668                 0x97, 0x9b, 0xc2, 0xb1, 0x9c, 0x5d, 0xff, 0x4f,
669                 0x73, 0x2d, 0x3f, 0x57, 0x28, 0x38, 0xbf, 0x3d,
670                 0x9f, 0xda, 0x49, 0x55, 0x8f, 0xb2, 0x77, 0xec,
671                 0x0f, 0xbc, 0xce, 0xb8, 0xc6, 0xe1, 0x03, 0xed,
672                 0x35, 0x9c, 0xf2, 0x4d, 0xa4, 0x29, 0x6c, 0xd6,
673                 0x6e, 0x05, 0x53, 0x46, 0xc1, 0x41, 0x09, 0x36,
674                 0x0b, 0x7d, 0xf4, 0x9e, 0x0f, 0xba, 0x86, 0x33,
675                 0xdd, 0xf1, 0xa7, 0xf7, 0xd5, 0x29, 0xa8, 0xa7,
676                 0x4d, 0xce, 0x0c, 0xf5, 0xb4, 0x6c, 0xd8, 0x27,
677                 0xb0, 0x87, 0x2a, 0x6f, 0x7f, 0x3f, 0x8f, 0xc3,
678                 0xe2, 0x3e, 0x94, 0xcf, 0x61, 0x4a, 0x09, 0x3d,
679                 0xf9, 0x55, 0x19, 0x31, 0xf2, 0xd2, 0x4a, 0x3e,
680                 0xc1, 0xf5, 0xed, 0x7c, 0x45, 0xb0, 0x0c, 0x7b,
681                 0xdd, 0xa6, 0x0a, 0x26, 0x66, 0xec, 0x85, 0x49,
682                 0x00, 0x38, 0x05, 0x7c, 0x9c, 0x1c, 0x92, 0xf5,
683                 0xf7, 0xdb, 0x5d, 0xbd, 0x61, 0x0c, 0xc9, 0xaf,
684                 0xfd, 0x57, 0x3f, 0xee, 0x2b, 0xad, 0x73, 0xef,
685                 0xa3, 0xc1, 0x66, 0x26, 0x44, 0x5e, 0xf9, 0x12,
686                 0x86, 0x66, 0xa9, 0x61, 0x75, 0xa1, 0xbc, 0x40,
687                 0x7f, 0xa8, 0x08, 0x02, 0xc0, 0x76, 0x0e, 0x76,
688                 0xb3, 0x26, 0x3d, 0x1c, 0x40, 0x65, 0xe4, 0x18,
689                 0x0f, 0x62, 0x17, 0x8f, 0x1e, 0x61, 0xb8, 0x08,
690                 0x83, 0x54, 0x42, 0x11, 0x03, 0x30, 0x8e, 0xb7,
691                 0xc1, 0x9c, 0xec, 0x69, 0x52, 0x95, 0xfb, 0x7b,
692                 0x1a, 0x0c, 0x20, 0x24, 0xf7, 0xb8, 0x38, 0x0c,
693                 0xb8, 0x7b, 0xb6, 0x69, 0x70, 0xd0, 0x61, 0xb9,
694                 0x70, 0x06, 0xc2, 0x5b, 0x20, 0x47, 0xf7, 0xd9,
695                 0x32, 0xc2, 0xf2, 0x90, 0xb6, 0x4d, 0xcd, 0x3c,
696                 0x6d, 0x74, 0xea, 0x82, 0x35, 0x1b, 0x08, 0x44,
697                 0xba, 0xb7, 0x33, 0x82, 0x33, 0x27, 0x54, 0x77,
698                 0x6e, 0x58, 0xfe, 0x46, 0x5a, 0xb4, 0x88, 0x53,
699                 0x8d, 0x9b, 0xb1, 0xab, 0xdf, 0x04, 0xe1, 0xfb,
700                 0xd7, 0x1e, 0xd7, 0x38, 0x64, 0x54, 0xba, 0xb0,
701                 0x6c, 0x84, 0x7a, 0x0f, 0xa7, 0x80, 0x6b, 0x86,
702                 0xd9, 0xc9, 0xc6, 0x31, 0x95, 0xfa, 0x8a, 0x2c,
703                 0x14, 0xe1, 0x85, 0x66, 0x27, 0xfd, 0x63, 0x3e,
704                 0xf0, 0xfa, 0x81, 0xc9, 0x89, 0x4f, 0xe2, 0x6a,
705                 0x8c, 0x17, 0xb5, 0xc7, 0x9f, 0x5d, 0x3f, 0x6b,
706                 0x3f, 0xcd, 0x13, 0x7a, 0x3c, 0xe6, 0x4e, 0xfa,
707                 0x7a, 0x10, 0xb8, 0x7c, 0x40, 0xec, 0x93, 0x11,
708                 0x1f, 0xd0, 0x9e, 0xc3, 0x56, 0xb9, 0xf5, 0x21,
709                 0x18, 0x41, 0x31, 0xea, 0x01, 0x8d, 0xea, 0x1c,
710                 0x95, 0x5e, 0x56, 0x33, 0xbc, 0x7a, 0x3f, 0x6f
711 };
712
713 static const uint8_t AES_CBC_ciphertext_768B[] = {
714                 0x3e, 0x7f, 0x9e, 0x4c, 0x88, 0x15, 0x68, 0x69,
715                 0x10, 0x09, 0xe1, 0xa7, 0x0f, 0x27, 0x88, 0x2d,
716                 0x90, 0x73, 0x4f, 0x67, 0xd3, 0x8b, 0xaf, 0xa1,
717                 0x2c, 0x37, 0xa5, 0x6c, 0x7c, 0xbd, 0x95, 0x4c,
718                 0x82, 0xcf, 0x05, 0x49, 0x16, 0x5c, 0xe7, 0x06,
719                 0xd4, 0xcb, 0x55, 0x65, 0x9a, 0xd0, 0xe1, 0x46,
720                 0x3a, 0x37, 0x71, 0xad, 0xb0, 0xb4, 0x99, 0x1e,
721                 0x23, 0x57, 0x48, 0x96, 0x9c, 0xc5, 0xc4, 0xdb,
722                 0x64, 0x3e, 0xc9, 0x7f, 0x90, 0x5a, 0xa0, 0x08,
723                 0x75, 0x4c, 0x09, 0x06, 0x31, 0x6e, 0x59, 0x29,
724                 0xfc, 0x2f, 0x72, 0xde, 0xf2, 0x40, 0x5a, 0xfe,
725                 0xd3, 0x66, 0x64, 0xb8, 0x9c, 0xc9, 0xa6, 0x1f,
726                 0xc3, 0x52, 0xcd, 0xb5, 0xd1, 0x4f, 0x43, 0x3f,
727                 0xf4, 0x59, 0x25, 0xc4, 0xdd, 0x3e, 0x58, 0x7c,
728                 0x21, 0xd6, 0x21, 0xce, 0xa4, 0xbe, 0x08, 0x23,
729                 0x46, 0x68, 0xc0, 0x00, 0x91, 0x47, 0xca, 0x9b,
730                 0xe0, 0xb4, 0xe3, 0xab, 0xbf, 0xcf, 0x68, 0x26,
731                 0x97, 0x23, 0x09, 0x93, 0x64, 0x8f, 0x57, 0x59,
732                 0xe2, 0x41, 0x7c, 0xa2, 0x48, 0x7e, 0xd5, 0x2c,
733                 0x54, 0x09, 0x1b, 0x07, 0x94, 0xca, 0x39, 0x83,
734                 0xdd, 0xf4, 0x7a, 0x1d, 0x2d, 0xdd, 0x67, 0xf7,
735                 0x3c, 0x30, 0x89, 0x3e, 0xc1, 0xdc, 0x1d, 0x8f,
736                 0xfc, 0xb1, 0xe9, 0x13, 0x31, 0xb0, 0x16, 0xdb,
737                 0x88, 0xf2, 0x32, 0x7e, 0x73, 0xa3, 0xdf, 0x08,
738                 0x6b, 0x53, 0x92, 0x08, 0xc9, 0x9d, 0x98, 0xb2,
739                 0xf4, 0x8c, 0xb1, 0x95, 0xdc, 0xb6, 0xfc, 0xec,
740                 0xf1, 0xc9, 0x0d, 0x6d, 0x42, 0x2c, 0xf5, 0x38,
741                 0x29, 0xf4, 0xd8, 0x98, 0x0f, 0xb0, 0x81, 0xa5,
742                 0xaa, 0xe6, 0x1f, 0x6e, 0x87, 0x32, 0x1b, 0x02,
743                 0x07, 0x57, 0x38, 0x83, 0xf3, 0xe4, 0x54, 0x7c,
744                 0xa8, 0x43, 0xdf, 0x3f, 0x42, 0xfd, 0x67, 0x28,
745                 0x06, 0x4d, 0xea, 0xce, 0x1f, 0x84, 0x4a, 0xcd,
746                 0x8c, 0x61, 0x5e, 0x8f, 0x61, 0xed, 0x84, 0x03,
747                 0x53, 0x6a, 0x9e, 0xbf, 0x68, 0x83, 0xa7, 0x42,
748                 0x56, 0x57, 0xcd, 0x45, 0x29, 0xfc, 0x7b, 0x07,
749                 0xfc, 0xe9, 0xb9, 0x42, 0xfd, 0x29, 0xd5, 0xfd,
750                 0x98, 0x11, 0xd1, 0x8d, 0x67, 0x29, 0x47, 0x61,
751                 0xd8, 0x27, 0x37, 0x79, 0x29, 0xd1, 0x94, 0x6f,
752                 0x8d, 0xf3, 0x1b, 0x3d, 0x6a, 0xb1, 0x59, 0xef,
753                 0x1b, 0xd4, 0x70, 0x0e, 0xac, 0xab, 0xa0, 0x2b,
754                 0x1f, 0x5e, 0x04, 0xf0, 0x0e, 0x35, 0x72, 0x90,
755                 0xfc, 0xcf, 0x86, 0x43, 0xea, 0x45, 0x6d, 0x22,
756                 0x63, 0x06, 0x1a, 0x58, 0xd7, 0x2d, 0xc5, 0xb0,
757                 0x60, 0x69, 0xe8, 0x53, 0xc2, 0xa2, 0x57, 0x83,
758                 0xc4, 0x31, 0xb4, 0xc6, 0xb3, 0xa1, 0x77, 0xb3,
759                 0x1c, 0xca, 0x89, 0x3f, 0xf5, 0x10, 0x3b, 0x36,
760                 0x31, 0x7d, 0x00, 0x46, 0x00, 0x92, 0xa0, 0xa0,
761                 0x34, 0xd8, 0x5e, 0x62, 0xa9, 0xe0, 0x23, 0x37,
762                 0x50, 0x85, 0xc7, 0x3a, 0x20, 0xa3, 0x98, 0xc0,
763                 0xac, 0x20, 0x06, 0x0f, 0x17, 0x3c, 0xfc, 0x43,
764                 0x8c, 0x9d, 0xec, 0xf5, 0x9a, 0x35, 0x96, 0xf7,
765                 0xb7, 0x4c, 0xf9, 0x69, 0xf8, 0xd4, 0x1e, 0x9e,
766                 0xf9, 0x7c, 0xc4, 0xd2, 0x11, 0x14, 0x41, 0xb9,
767                 0x89, 0xd6, 0x07, 0xd2, 0x37, 0x07, 0x5e, 0x5e,
768                 0xae, 0x60, 0xdc, 0xe4, 0xeb, 0x38, 0x48, 0x6d,
769                 0x95, 0x8d, 0x71, 0xf2, 0xba, 0xda, 0x5f, 0x08,
770                 0x9d, 0x4a, 0x0f, 0x56, 0x90, 0x64, 0xab, 0xb6,
771                 0x88, 0x22, 0xa8, 0x90, 0x1f, 0x76, 0x2c, 0x83,
772                 0x43, 0xce, 0x32, 0x55, 0x45, 0x84, 0x57, 0x43,
773                 0xf9, 0xa8, 0xd1, 0x4f, 0xe3, 0xc1, 0x72, 0x9c,
774                 0xeb, 0x64, 0xf7, 0xe4, 0x61, 0x2b, 0x93, 0xd1,
775                 0x1f, 0xbb, 0x5c, 0xff, 0xa1, 0x59, 0x69, 0xcf,
776                 0xf7, 0xaf, 0x58, 0x45, 0xd5, 0x3e, 0x98, 0x7d,
777                 0x26, 0x39, 0x5c, 0x75, 0x3c, 0x4a, 0xbf, 0x5e,
778                 0x12, 0x10, 0xb0, 0x93, 0x0f, 0x86, 0x82, 0xcf,
779                 0xb2, 0xec, 0x70, 0x5c, 0x0b, 0xad, 0x5d, 0x63,
780                 0x65, 0x32, 0xa6, 0x04, 0x58, 0x03, 0x91, 0x2b,
781                 0xdb, 0x8f, 0xd3, 0xa3, 0x2b, 0x3a, 0xf5, 0xa1,
782                 0x62, 0x6c, 0xb6, 0xf0, 0x13, 0x3b, 0x8c, 0x07,
783                 0x10, 0x82, 0xc9, 0x56, 0x24, 0x87, 0xfc, 0x56,
784                 0xe8, 0xef, 0x90, 0x8b, 0xd6, 0x48, 0xda, 0x53,
785                 0x04, 0x49, 0x41, 0xa4, 0x67, 0xe0, 0x33, 0x24,
786                 0x6b, 0x9c, 0x07, 0x55, 0x4c, 0x5d, 0xe9, 0x35,
787                 0xfa, 0xbd, 0xea, 0xa8, 0x3f, 0xe9, 0xf5, 0x20,
788                 0x5c, 0x60, 0x0f, 0x0d, 0x24, 0xcb, 0x1a, 0xd6,
789                 0xe8, 0x5c, 0xa8, 0x42, 0xae, 0xd0, 0xd2, 0xf2,
790                 0xa8, 0xbe, 0xea, 0x0f, 0x8d, 0xfb, 0x81, 0xa3,
791                 0xa4, 0xef, 0xb7, 0x3e, 0x91, 0xbd, 0x26, 0x0f,
792                 0x8e, 0xf1, 0xb2, 0xa5, 0x47, 0x06, 0xfa, 0x40,
793                 0x8b, 0x31, 0x7a, 0x5a, 0x74, 0x2a, 0x0a, 0x7c,
794                 0x62, 0x5d, 0x39, 0xa4, 0xae, 0x14, 0x85, 0x08,
795                 0x5b, 0x20, 0x85, 0xf1, 0x57, 0x6e, 0x71, 0x13,
796                 0x4e, 0x2b, 0x49, 0x87, 0x01, 0xdf, 0x37, 0xed,
797                 0x28, 0xee, 0x4d, 0xa1, 0xf4, 0xb3, 0x3b, 0xba,
798                 0x2d, 0xb3, 0x46, 0x17, 0x84, 0x80, 0x9d, 0xd7,
799                 0x93, 0x1f, 0x28, 0x7c, 0xf5, 0xf9, 0xd6, 0x85,
800                 0x8c, 0xa5, 0x44, 0xe9, 0x2c, 0x65, 0x51, 0x5f,
801                 0x53, 0x7a, 0x09, 0xd9, 0x30, 0x16, 0x95, 0x89,
802                 0x9c, 0x0b, 0xef, 0x90, 0x6d, 0x23, 0xd3, 0x48,
803                 0x57, 0x3b, 0x55, 0x69, 0x96, 0xfc, 0xf7, 0x52,
804                 0x92, 0x38, 0x36, 0xbf, 0xa9, 0x0a, 0xbb, 0x68,
805                 0x45, 0x08, 0x25, 0xee, 0x59, 0xfe, 0xee, 0xf2,
806                 0x2c, 0xd4, 0x5f, 0x78, 0x59, 0x0d, 0x90, 0xf1,
807                 0xd7, 0xe4, 0x39, 0x0e, 0x46, 0x36, 0xf5, 0x75,
808                 0x03, 0x3c, 0x28, 0xfb, 0xfa, 0x8f, 0xef, 0xc9,
809                 0x61, 0x00, 0x94, 0xc3, 0xd2, 0x0f, 0xd9, 0xda
810 };
811
812 static const uint8_t AES_CBC_ciphertext_1024B[] = {
813                 0x7d, 0x01, 0x7e, 0x2f, 0x92, 0xb3, 0xea, 0x72,
814                 0x4a, 0x3f, 0x10, 0xf9, 0x2b, 0xb0, 0xd5, 0xb9,
815                 0x19, 0x68, 0x94, 0xe9, 0x93, 0xe9, 0xd5, 0x26,
816                 0x20, 0x44, 0xe2, 0x47, 0x15, 0x8d, 0x75, 0x48,
817                 0x8e, 0xe4, 0x40, 0x81, 0xb5, 0x06, 0xa8, 0xb8,
818                 0x0e, 0x0f, 0x3b, 0xbc, 0x5b, 0xbe, 0x3b, 0xa2,
819                 0x2a, 0x0c, 0x48, 0x98, 0x19, 0xdf, 0xe9, 0x25,
820                 0x75, 0xab, 0x93, 0x44, 0xb1, 0x72, 0x70, 0xbb,
821                 0x20, 0xcf, 0x78, 0xe9, 0x4d, 0xc6, 0xa9, 0xa9,
822                 0x84, 0x78, 0xc5, 0xc0, 0xc4, 0xc9, 0x79, 0x1a,
823                 0xbc, 0x61, 0x25, 0x5f, 0xac, 0x01, 0x03, 0xb7,
824                 0xef, 0x07, 0xf2, 0x62, 0x98, 0xee, 0xe3, 0xad,
825                 0x94, 0x75, 0x30, 0x67, 0xb9, 0x15, 0x00, 0xe7,
826                 0x11, 0x32, 0x2e, 0x6b, 0x55, 0x9f, 0xac, 0x68,
827                 0xde, 0x61, 0x05, 0x80, 0x01, 0xf3, 0xad, 0xab,
828                 0xaf, 0x45, 0xe0, 0xf4, 0x68, 0x5c, 0xc0, 0x52,
829                 0x92, 0xc8, 0x21, 0xb6, 0xf5, 0x8a, 0x1d, 0xbb,
830                 0xfc, 0x4a, 0x11, 0x62, 0xa2, 0xc4, 0xf1, 0x2d,
831                 0x0e, 0xb2, 0xc7, 0x17, 0x34, 0xb4, 0x2a, 0x54,
832                 0x81, 0xc2, 0x1e, 0xcf, 0x51, 0x0a, 0x76, 0x54,
833                 0xf1, 0x48, 0x0d, 0x5c, 0xcd, 0x38, 0x3e, 0x38,
834                 0x3e, 0xf8, 0x46, 0x1d, 0x00, 0xf5, 0x62, 0xe1,
835                 0x5c, 0xb7, 0x8d, 0xce, 0xd0, 0x3f, 0xbb, 0x22,
836                 0xf1, 0xe5, 0xb1, 0xa0, 0x58, 0x5e, 0x3c, 0x0f,
837                 0x15, 0xd1, 0xac, 0x3e, 0xc7, 0x72, 0xc4, 0xde,
838                 0x8b, 0x95, 0x3e, 0x91, 0xf7, 0x1d, 0x04, 0x9a,
839                 0xc8, 0xe4, 0xbf, 0xd3, 0x22, 0xca, 0x4a, 0xdc,
840                 0xb6, 0x16, 0x79, 0x81, 0x75, 0x2f, 0x6b, 0xa7,
841                 0x04, 0x98, 0xa7, 0x4e, 0xc1, 0x19, 0x90, 0x33,
842                 0x33, 0x3c, 0x7f, 0xdd, 0xac, 0x09, 0x0c, 0xc3,
843                 0x91, 0x34, 0x74, 0xab, 0xa5, 0x35, 0x0a, 0x13,
844                 0xc3, 0x56, 0x67, 0x6d, 0x1a, 0x3e, 0xbf, 0x56,
845                 0x06, 0x67, 0x15, 0x5f, 0xfc, 0x8b, 0xa2, 0x3c,
846                 0x5e, 0xaf, 0x56, 0x1f, 0xe3, 0x2e, 0x9d, 0x0a,
847                 0xf9, 0x9b, 0xc7, 0xb5, 0x03, 0x1c, 0x68, 0x99,
848                 0xfa, 0x3c, 0x37, 0x59, 0xc1, 0xf7, 0x6a, 0x83,
849                 0x22, 0xee, 0xca, 0x7f, 0x7d, 0x49, 0xe6, 0x48,
850                 0x84, 0x54, 0x7a, 0xff, 0xb3, 0x72, 0x21, 0xd8,
851                 0x7a, 0x5d, 0xb1, 0x4b, 0xcc, 0x01, 0x6f, 0x90,
852                 0xc6, 0x68, 0x1c, 0x2c, 0xa1, 0xe2, 0x74, 0x40,
853                 0x26, 0x9b, 0x57, 0x53, 0xa3, 0x7c, 0x0b, 0x0d,
854                 0xcf, 0x05, 0x5d, 0x62, 0x4f, 0x75, 0x06, 0x62,
855                 0x1f, 0x26, 0x32, 0xaa, 0x25, 0xcc, 0x26, 0x8d,
856                 0xae, 0x01, 0x47, 0xa3, 0x00, 0x42, 0xe2, 0x4c,
857                 0xee, 0x29, 0xa2, 0x81, 0xa0, 0xfd, 0xeb, 0xff,
858                 0x9a, 0x66, 0x6e, 0x47, 0x5b, 0xab, 0x93, 0x5a,
859                 0x02, 0x6d, 0x6f, 0xf2, 0x6e, 0x02, 0x9d, 0xb1,
860                 0xab, 0x56, 0xdc, 0x8b, 0x9b, 0x17, 0xa8, 0xfb,
861                 0x87, 0x42, 0x7c, 0x91, 0x1e, 0x14, 0xc6, 0x6f,
862                 0xdc, 0xf0, 0x27, 0x30, 0xfa, 0x3f, 0xc4, 0xad,
863                 0x57, 0x85, 0xd2, 0xc9, 0x32, 0x2c, 0x13, 0xa6,
864                 0x04, 0x04, 0x50, 0x05, 0x2f, 0x72, 0xd9, 0x44,
865                 0x55, 0x6e, 0x93, 0x40, 0xed, 0x7e, 0xd4, 0x40,
866                 0x3e, 0x88, 0x3b, 0x8b, 0xb6, 0xeb, 0xc6, 0x5d,
867                 0x9c, 0x99, 0xa1, 0xcf, 0x30, 0xb2, 0xdc, 0x48,
868                 0x8a, 0x01, 0xa7, 0x61, 0x77, 0x50, 0x14, 0xf3,
869                 0x0c, 0x49, 0x53, 0xb3, 0xb4, 0xb4, 0x28, 0x41,
870                 0x4a, 0x2d, 0xd2, 0x4d, 0x2a, 0x30, 0x31, 0x83,
871                 0x03, 0x5e, 0xaa, 0xd3, 0xa3, 0xd1, 0xa1, 0xca,
872                 0x62, 0xf0, 0xe1, 0xf2, 0xff, 0xf0, 0x19, 0xa6,
873                 0xde, 0x22, 0x47, 0xb5, 0x28, 0x7d, 0xf7, 0x07,
874                 0x16, 0x0d, 0xb1, 0x55, 0x81, 0x95, 0xe5, 0x1d,
875                 0x4d, 0x78, 0xa9, 0x3e, 0xce, 0xe3, 0x1c, 0xf9,
876                 0x47, 0xc8, 0xec, 0xc5, 0xc5, 0x93, 0x4c, 0x34,
877                 0x20, 0x6b, 0xee, 0x9a, 0xe6, 0x86, 0x57, 0x58,
878                 0xd5, 0x58, 0xf1, 0x33, 0x10, 0x29, 0x9e, 0x93,
879                 0x2f, 0xf5, 0x90, 0x00, 0x17, 0x67, 0x4f, 0x39,
880                 0x18, 0xe1, 0xcf, 0x55, 0x78, 0xbb, 0xe6, 0x29,
881                 0x3e, 0x77, 0xd5, 0x48, 0xb7, 0x42, 0x72, 0x53,
882                 0x27, 0xfa, 0x5b, 0xe0, 0x36, 0x14, 0x97, 0xb8,
883                 0x9b, 0x3c, 0x09, 0x77, 0xc1, 0x0a, 0xe4, 0xa2,
884                 0x63, 0xfc, 0xbe, 0x5c, 0x17, 0xcf, 0x01, 0xf5,
885                 0x03, 0x0f, 0x17, 0xbc, 0x93, 0xdd, 0x5f, 0xe2,
886                 0xf3, 0x08, 0xa8, 0xb1, 0x85, 0xb6, 0x34, 0x3f,
887                 0x87, 0x42, 0xa5, 0x42, 0x3b, 0x0e, 0xd6, 0x83,
888                 0x6a, 0xfd, 0x5d, 0xc9, 0x67, 0xd5, 0x51, 0xc9,
889                 0x2a, 0x4e, 0x91, 0xb0, 0x59, 0xb2, 0x0f, 0xa2,
890                 0xe6, 0x47, 0x73, 0xc2, 0xa2, 0xae, 0xbb, 0xc8,
891                 0x42, 0xa3, 0x2a, 0x27, 0x29, 0x48, 0x8c, 0x54,
892                 0x6c, 0xec, 0x00, 0x2a, 0x42, 0xa3, 0x7a, 0x0f,
893                 0x12, 0x66, 0x6b, 0x96, 0xf6, 0xd0, 0x56, 0x4f,
894                 0x49, 0x5c, 0x47, 0xec, 0x05, 0x62, 0x54, 0xb2,
895                 0x64, 0x5a, 0x69, 0x1f, 0x19, 0xb4, 0x84, 0x5c,
896                 0xbe, 0x48, 0x8e, 0xfc, 0x58, 0x21, 0xce, 0xfa,
897                 0xaa, 0x84, 0xd2, 0xc1, 0x08, 0xb3, 0x87, 0x0f,
898                 0x4f, 0xa3, 0x3a, 0xb6, 0x44, 0xbe, 0x2e, 0x9a,
899                 0xdd, 0xb5, 0x44, 0x80, 0xca, 0xf4, 0xc3, 0x6e,
900                 0xba, 0x93, 0x77, 0xe0, 0x53, 0xfb, 0x37, 0xfb,
901                 0x88, 0xc3, 0x1f, 0x25, 0xde, 0x3e, 0x11, 0xf4,
902                 0x89, 0xe7, 0xd1, 0x3b, 0xb4, 0x23, 0xcb, 0x70,
903                 0xba, 0x35, 0x97, 0x7c, 0xbe, 0x84, 0x13, 0xcf,
904                 0xe0, 0x4d, 0x33, 0x91, 0x71, 0x85, 0xbb, 0x4b,
905                 0x97, 0x32, 0x5d, 0xa0, 0xb9, 0x8f, 0xdc, 0x27,
906                 0x5a, 0xeb, 0x71, 0xf1, 0xd5, 0x0d, 0x65, 0xb4,
907                 0x22, 0x81, 0xde, 0xa7, 0x58, 0x20, 0x0b, 0x18,
908                 0x11, 0x76, 0x5c, 0xe6, 0x6a, 0x2c, 0x99, 0x69,
909                 0xdc, 0xed, 0x67, 0x08, 0x5d, 0x5e, 0xe9, 0x1e,
910                 0x55, 0x70, 0xc1, 0x5a, 0x76, 0x1b, 0x8d, 0x2e,
911                 0x0d, 0xf9, 0xcc, 0x30, 0x8c, 0x44, 0x0f, 0x63,
912                 0x8c, 0x42, 0x8a, 0x9f, 0x4c, 0xd1, 0x48, 0x28,
913                 0x8a, 0xf5, 0x56, 0x2e, 0x23, 0x12, 0xfe, 0x67,
914                 0x9a, 0x13, 0x65, 0x75, 0x83, 0xf1, 0x3c, 0x98,
915                 0x07, 0x6b, 0xb7, 0x27, 0x5b, 0xf0, 0x70, 0xda,
916                 0x30, 0xf8, 0x74, 0x4e, 0x7a, 0x32, 0x84, 0xcc,
917                 0x0e, 0xcd, 0x80, 0x8b, 0x82, 0x31, 0x9a, 0x48,
918                 0xcf, 0x75, 0x00, 0x1f, 0x4f, 0xe0, 0x8e, 0xa3,
919                 0x6a, 0x2c, 0xd4, 0x73, 0x4c, 0x63, 0x7c, 0xa6,
920                 0x4d, 0x5e, 0xfd, 0x43, 0x3b, 0x27, 0xe1, 0x5e,
921                 0xa3, 0xa9, 0x5c, 0x3b, 0x60, 0xdd, 0xc6, 0x8d,
922                 0x5a, 0xf1, 0x3e, 0x89, 0x4b, 0x24, 0xcf, 0x01,
923                 0x3a, 0x2d, 0x44, 0xe7, 0xda, 0xe7, 0xa1, 0xac,
924                 0x11, 0x05, 0x0c, 0xa9, 0x7a, 0x82, 0x8c, 0x5c,
925                 0x29, 0x68, 0x9c, 0x73, 0x13, 0xcc, 0x67, 0x32,
926                 0x11, 0x5e, 0xe5, 0xcc, 0x8c, 0xf5, 0xa7, 0x52,
927                 0x83, 0x9a, 0x70, 0xef, 0xde, 0x55, 0x9c, 0xc7,
928                 0x8a, 0xed, 0xad, 0x28, 0x4a, 0xc5, 0x92, 0x6d,
929                 0x8e, 0x47, 0xca, 0xe3, 0xf8, 0x77, 0xb5, 0x26,
930                 0x64, 0x84, 0xc2, 0xf1, 0xd7, 0xae, 0x0c, 0xb9,
931                 0x39, 0x0f, 0x43, 0x6b, 0xe9, 0xe0, 0x09, 0x4b,
932                 0xe5, 0xe3, 0x17, 0xa6, 0x68, 0x69, 0x46, 0xf4,
933                 0xf0, 0x68, 0x7f, 0x2f, 0x1c, 0x7e, 0x4c, 0xd2,
934                 0xb5, 0xc6, 0x16, 0x85, 0xcf, 0x02, 0x4c, 0x89,
935                 0x0b, 0x25, 0xb0, 0xeb, 0xf3, 0x77, 0x08, 0x6a,
936                 0x46, 0x5c, 0xf6, 0x2f, 0xf1, 0x24, 0xc3, 0x4d,
937                 0x80, 0x60, 0x4d, 0x69, 0x98, 0xde, 0xc7, 0xa1,
938                 0xf6, 0x4e, 0x18, 0x0c, 0x2a, 0xb0, 0xb2, 0xe0,
939                 0x46, 0xe7, 0x49, 0x37, 0xc8, 0x5a, 0x23, 0x24,
940                 0xe3, 0x0f, 0xcc, 0x92, 0xb4, 0x8d, 0xdc, 0x9e
941 };
942
943 static const uint8_t AES_CBC_ciphertext_1280B[] = {
944                 0x91, 0x99, 0x5e, 0x9e, 0x84, 0xff, 0x59, 0x45,
945                 0xc1, 0xf4, 0xbc, 0x9c, 0xb9, 0x30, 0x6c, 0x51,
946                 0x73, 0x52, 0xb4, 0x44, 0x09, 0x79, 0xe2, 0x89,
947                 0x75, 0xeb, 0x54, 0x26, 0xce, 0xd8, 0x24, 0x98,
948                 0xaa, 0xf8, 0x13, 0x16, 0x68, 0x58, 0xc4, 0x82,
949                 0x0e, 0x31, 0xd3, 0x6a, 0x13, 0x58, 0x31, 0xe9,
950                 0x3a, 0xc1, 0x8b, 0xc5, 0x3f, 0x50, 0x42, 0xd1,
951                 0x93, 0xe4, 0x9b, 0x65, 0x2b, 0xf4, 0x1d, 0x9e,
952                 0x2d, 0xdb, 0x48, 0xef, 0x9a, 0x01, 0x68, 0xb6,
953                 0xea, 0x7a, 0x2b, 0xad, 0xfe, 0x77, 0x44, 0x7e,
954                 0x5a, 0xc5, 0x64, 0xb4, 0xfe, 0x5c, 0x80, 0xf3,
955                 0x20, 0x7e, 0xaf, 0x5b, 0xf8, 0xd1, 0x38, 0xa0,
956                 0x8d, 0x09, 0x77, 0x06, 0xfe, 0xf5, 0xf4, 0xe4,
957                 0xee, 0xb8, 0x95, 0x27, 0xed, 0x07, 0xb8, 0xaa,
958                 0x25, 0xb4, 0xe1, 0x4c, 0xeb, 0x3f, 0xdb, 0x39,
959                 0x66, 0x28, 0x1b, 0x60, 0x42, 0x8b, 0x99, 0xd9,
960                 0x49, 0xd6, 0x8c, 0xa4, 0x9d, 0xd8, 0x93, 0x58,
961                 0x8f, 0xfa, 0xd3, 0xf7, 0x37, 0x9c, 0x88, 0xab,
962                 0x16, 0x50, 0xfe, 0x01, 0x1f, 0x88, 0x48, 0xbe,
963                 0x21, 0xa9, 0x90, 0x9e, 0x73, 0xe9, 0x82, 0xf7,
964                 0xbf, 0x4b, 0x43, 0xf4, 0xbf, 0x22, 0x3c, 0x45,
965                 0x47, 0x95, 0x5b, 0x49, 0x71, 0x07, 0x1c, 0x8b,
966                 0x49, 0xa4, 0xa3, 0x49, 0xc4, 0x5f, 0xb1, 0xf5,
967                 0xe3, 0x6b, 0xf1, 0xdc, 0xea, 0x92, 0x7b, 0x29,
968                 0x40, 0xc9, 0x39, 0x5f, 0xdb, 0xbd, 0xf3, 0x6a,
969                 0x09, 0x9b, 0x2a, 0x5e, 0xc7, 0x0b, 0x25, 0x94,
970                 0x55, 0x71, 0x9c, 0x7e, 0x0e, 0xb4, 0x08, 0x12,
971                 0x8c, 0x6e, 0x77, 0xb8, 0x29, 0xf1, 0xc6, 0x71,
972                 0x04, 0x40, 0x77, 0x18, 0x3f, 0x01, 0x09, 0x9c,
973                 0x23, 0x2b, 0x5d, 0x2a, 0x88, 0x20, 0x23, 0x59,
974                 0x74, 0x2a, 0x67, 0x8f, 0xb7, 0xba, 0x38, 0x9f,
975                 0x0f, 0xcf, 0x94, 0xdf, 0xe1, 0x8f, 0x35, 0x5e,
976                 0x34, 0x0c, 0x32, 0x92, 0x2b, 0x23, 0x81, 0xf4,
977                 0x73, 0xa0, 0x5a, 0x2a, 0xbd, 0xa6, 0x6b, 0xae,
978                 0x43, 0xe2, 0xdc, 0x01, 0xc1, 0xc6, 0xc3, 0x04,
979                 0x06, 0xbb, 0xb0, 0x89, 0xb3, 0x4e, 0xbd, 0x81,
980                 0x1b, 0x03, 0x63, 0x93, 0xed, 0x4e, 0xf6, 0xe5,
981                 0x94, 0x6f, 0xd6, 0xf3, 0x20, 0xf3, 0xbc, 0x30,
982                 0xc5, 0xd6, 0xbe, 0x1c, 0x05, 0x34, 0x26, 0x4d,
983                 0x46, 0x5e, 0x56, 0x63, 0xfb, 0xdb, 0xcd, 0xed,
984                 0xb0, 0x7f, 0x83, 0x94, 0x55, 0x54, 0x2f, 0xab,
985                 0xc9, 0xb7, 0x16, 0x4f, 0x9e, 0x93, 0x25, 0xd7,
986                 0x9f, 0x39, 0x2b, 0x63, 0xcf, 0x1e, 0xa3, 0x0e,
987                 0x28, 0x47, 0x8a, 0x5f, 0x40, 0x02, 0x89, 0x1f,
988                 0x83, 0xe7, 0x87, 0xd1, 0x90, 0x17, 0xb8, 0x27,
989                 0x64, 0xe1, 0xe1, 0x48, 0x5a, 0x55, 0x74, 0x99,
990                 0x27, 0x9d, 0x05, 0x67, 0xda, 0x70, 0x12, 0x8f,
991                 0x94, 0x96, 0xfd, 0x36, 0xa4, 0x1d, 0x22, 0xe5,
992                 0x0b, 0xe5, 0x2f, 0x38, 0x55, 0xa3, 0x5d, 0x0b,
993                 0xcf, 0xd4, 0xa9, 0xb8, 0xd6, 0x9a, 0x16, 0x2e,
994                 0x6c, 0x4a, 0x25, 0x51, 0x7a, 0x09, 0x48, 0xdd,
995                 0xf0, 0xa3, 0x5b, 0x08, 0x1e, 0x2f, 0x03, 0x91,
996                 0x80, 0xe8, 0x0f, 0xe9, 0x5a, 0x2f, 0x90, 0xd3,
997                 0x64, 0xed, 0xd7, 0x51, 0x17, 0x66, 0x53, 0x40,
998                 0x43, 0x74, 0xef, 0x0a, 0x0d, 0x49, 0x41, 0xf2,
999                 0x67, 0x6e, 0xea, 0x14, 0xc8, 0x74, 0xd6, 0xa9,
1000                 0xb9, 0x6a, 0xe3, 0xec, 0x7d, 0xe8, 0x6a, 0x21,
1001                 0x3a, 0x52, 0x42, 0xfe, 0x9a, 0x15, 0x6d, 0x60,
1002                 0x64, 0x88, 0xc5, 0xb2, 0x8b, 0x15, 0x2c, 0xff,
1003                 0xe2, 0x35, 0xc3, 0xee, 0x9f, 0xcd, 0x82, 0xd9,
1004                 0x14, 0x35, 0x2a, 0xb7, 0xf5, 0x2f, 0x7b, 0xbc,
1005                 0x01, 0xfd, 0xa8, 0xe0, 0x21, 0x4e, 0x73, 0xf9,
1006                 0xf2, 0xb0, 0x79, 0xc9, 0x10, 0x52, 0x8f, 0xa8,
1007                 0x3e, 0x3b, 0xbe, 0xc5, 0xde, 0xf6, 0x53, 0xe3,
1008                 0x1c, 0x25, 0x3a, 0x1f, 0x13, 0xbf, 0x13, 0xbb,
1009                 0x94, 0xc2, 0x97, 0x43, 0x64, 0x47, 0x8f, 0x76,
1010                 0xd7, 0xaa, 0xeb, 0xa4, 0x03, 0x50, 0x0c, 0x10,
1011                 0x50, 0xd8, 0xf7, 0x75, 0x52, 0x42, 0xe2, 0x94,
1012                 0x67, 0xf4, 0x60, 0xfb, 0x21, 0x9b, 0x7a, 0x05,
1013                 0x50, 0x7c, 0x1b, 0x4a, 0x8b, 0x29, 0xe1, 0xac,
1014                 0xd7, 0x99, 0xfd, 0x0d, 0x65, 0x92, 0xcd, 0x23,
1015                 0xa7, 0x35, 0x8e, 0x13, 0xf2, 0xe4, 0x10, 0x74,
1016                 0xc6, 0x4f, 0x19, 0xf7, 0x01, 0x0b, 0x46, 0xab,
1017                 0xef, 0x8d, 0x4a, 0x4a, 0xfa, 0xda, 0xf3, 0xfb,
1018                 0x40, 0x28, 0x88, 0xa2, 0x65, 0x98, 0x4d, 0x88,
1019                 0xc7, 0xbf, 0x00, 0xc8, 0xd0, 0x91, 0xcb, 0x89,
1020                 0x2f, 0xb0, 0x85, 0xfc, 0xa1, 0xc1, 0x9e, 0x83,
1021                 0x88, 0xad, 0x95, 0xc0, 0x31, 0xa0, 0xad, 0xa2,
1022                 0x42, 0xb5, 0xe7, 0x55, 0xd4, 0x93, 0x5a, 0x74,
1023                 0x4e, 0x41, 0xc3, 0xcf, 0x96, 0x83, 0x46, 0xa1,
1024                 0xb7, 0x5b, 0xb1, 0x34, 0x67, 0x4e, 0xb1, 0xd7,
1025                 0x40, 0x20, 0x72, 0xe9, 0xc8, 0x74, 0xb7, 0xde,
1026                 0x72, 0x29, 0x77, 0x4c, 0x74, 0x7e, 0xcc, 0x18,
1027                 0xa5, 0x8d, 0x79, 0x8c, 0xd6, 0x6e, 0xcb, 0xd9,
1028                 0xe1, 0x61, 0xe7, 0x36, 0xbc, 0x37, 0xea, 0xee,
1029                 0xd8, 0x3c, 0x5e, 0x7c, 0x47, 0x50, 0xd5, 0xec,
1030                 0x37, 0xc5, 0x63, 0xc3, 0xc9, 0x99, 0x23, 0x9f,
1031                 0x64, 0x39, 0xdf, 0x13, 0x96, 0x6d, 0xea, 0x08,
1032                 0x0c, 0x27, 0x2d, 0xfe, 0x0f, 0xc2, 0xa3, 0x97,
1033                 0x04, 0x12, 0x66, 0x0d, 0x94, 0xbf, 0xbe, 0x3e,
1034                 0xb9, 0xcf, 0x8e, 0xc1, 0x9d, 0xb1, 0x64, 0x17,
1035                 0x54, 0x92, 0x3f, 0x0a, 0x51, 0xc8, 0xf5, 0x82,
1036                 0x98, 0x73, 0x03, 0xc0, 0x5a, 0x51, 0x01, 0x67,
1037                 0xb4, 0x01, 0x04, 0x06, 0xbc, 0x37, 0xde, 0x96,
1038                 0x23, 0x3c, 0xce, 0x98, 0x3f, 0xd6, 0x51, 0x1b,
1039                 0x01, 0x83, 0x0a, 0x1c, 0xf9, 0xeb, 0x7e, 0x72,
1040                 0xa9, 0x51, 0x23, 0xc8, 0xd7, 0x2f, 0x12, 0xbc,
1041                 0x08, 0xac, 0x07, 0xe7, 0xa7, 0xe6, 0x46, 0xae,
1042                 0x54, 0xa3, 0xc2, 0xf2, 0x05, 0x2d, 0x06, 0x5e,
1043                 0xfc, 0xe2, 0xa2, 0x23, 0xac, 0x86, 0xf2, 0x54,
1044                 0x83, 0x4a, 0xb6, 0x48, 0x93, 0xa1, 0x78, 0xc2,
1045                 0x07, 0xec, 0x82, 0xf0, 0x74, 0xa9, 0x18, 0xe9,
1046                 0x53, 0x44, 0x49, 0xc2, 0x94, 0xf8, 0x94, 0x92,
1047                 0x08, 0x3f, 0xbf, 0xa6, 0xe5, 0xc6, 0x03, 0x8a,
1048                 0xc6, 0x90, 0x48, 0x6c, 0xee, 0xbd, 0x44, 0x92,
1049                 0x1f, 0x2a, 0xce, 0x1d, 0xb8, 0x31, 0xa2, 0x9d,
1050                 0x24, 0x93, 0xa8, 0x9f, 0x36, 0x00, 0x04, 0x7b,
1051                 0xcb, 0x93, 0x59, 0xa1, 0x53, 0xdb, 0x13, 0x7a,
1052                 0x54, 0xb1, 0x04, 0xdb, 0xce, 0x48, 0x4f, 0xe5,
1053                 0x2f, 0xcb, 0xdf, 0x8f, 0x50, 0x7c, 0xfc, 0x76,
1054                 0x80, 0xb4, 0xdc, 0x3b, 0xc8, 0x98, 0x95, 0xf5,
1055                 0x50, 0xba, 0x70, 0x5a, 0x97, 0xd5, 0xfc, 0x98,
1056                 0x4d, 0xf3, 0x61, 0x0f, 0xcf, 0xac, 0x49, 0x0a,
1057                 0xdb, 0xc1, 0x42, 0x8f, 0xb6, 0x29, 0xd5, 0x65,
1058                 0xef, 0x83, 0xf1, 0x30, 0x4b, 0x84, 0xd0, 0x69,
1059                 0xde, 0xd2, 0x99, 0xe5, 0xec, 0xd3, 0x90, 0x86,
1060                 0x39, 0x2a, 0x6e, 0xd5, 0x32, 0xe3, 0x0d, 0x2d,
1061                 0x01, 0x8b, 0x17, 0x55, 0x1d, 0x65, 0x57, 0xbf,
1062                 0xd8, 0x75, 0xa4, 0x85, 0xb6, 0x4e, 0x35, 0x14,
1063                 0x58, 0xe4, 0x89, 0xb8, 0x7a, 0x58, 0x86, 0x0c,
1064                 0xbd, 0x8b, 0x05, 0x7b, 0x63, 0xc0, 0x86, 0x80,
1065                 0x33, 0x46, 0xd4, 0x9b, 0xb6, 0x0a, 0xeb, 0x6c,
1066                 0xae, 0xd6, 0x57, 0x7a, 0xc7, 0x59, 0x33, 0xa0,
1067                 0xda, 0xa4, 0x12, 0xbf, 0x52, 0x22, 0x05, 0x8d,
1068                 0xeb, 0xee, 0xd5, 0xec, 0xea, 0x29, 0x9b, 0x76,
1069                 0x95, 0x50, 0x6d, 0x99, 0xe1, 0x45, 0x63, 0x09,
1070                 0x16, 0x5f, 0xb0, 0xf2, 0x5b, 0x08, 0x33, 0xdd,
1071                 0x8f, 0xb7, 0x60, 0x7a, 0x8e, 0xc6, 0xfc, 0xac,
1072                 0xa9, 0x56, 0x2c, 0xa9, 0x8b, 0x74, 0x33, 0xad,
1073                 0x2a, 0x7e, 0x96, 0xb6, 0xba, 0x22, 0x28, 0xcf,
1074                 0x4d, 0x96, 0xb7, 0xd1, 0xfa, 0x99, 0x4a, 0x61,
1075                 0xe6, 0x84, 0xd1, 0x94, 0xca, 0xf5, 0x86, 0xb0,
1076                 0xba, 0x34, 0x7a, 0x04, 0xcc, 0xd4, 0x81, 0xcd,
1077                 0xd9, 0x86, 0xb6, 0xe0, 0x5a, 0x6f, 0x9b, 0x99,
1078                 0xf0, 0xdf, 0x49, 0xae, 0x6d, 0xc2, 0x54, 0x67,
1079                 0xe0, 0xb4, 0x34, 0x2d, 0x1c, 0x46, 0xdf, 0x73,
1080                 0x3b, 0x45, 0x43, 0xe7, 0x1f, 0xa3, 0x36, 0x35,
1081                 0x25, 0x33, 0xd9, 0xc0, 0x54, 0x38, 0x6e, 0x6b,
1082                 0x80, 0xcf, 0x50, 0xa4, 0xb6, 0x21, 0x17, 0xfd,
1083                 0x9b, 0x5c, 0x36, 0xca, 0xcc, 0x73, 0x73, 0xad,
1084                 0xe0, 0x57, 0x77, 0x90, 0x0e, 0x7f, 0x0f, 0x87,
1085                 0x7f, 0xdb, 0x73, 0xbf, 0xda, 0xc2, 0xb3, 0x05,
1086                 0x22, 0x06, 0xf5, 0xa3, 0xfc, 0x1e, 0x8f, 0xda,
1087                 0xcf, 0x49, 0xd6, 0xb3, 0x66, 0x2c, 0xb5, 0x00,
1088                 0xaf, 0x85, 0x6e, 0xb8, 0x5b, 0x8c, 0xa1, 0xa4,
1089                 0x21, 0xce, 0x40, 0xf3, 0x98, 0xac, 0xec, 0x88,
1090                 0x62, 0x43, 0x2a, 0xac, 0xca, 0xcf, 0xb9, 0x30,
1091                 0xeb, 0xfc, 0xef, 0xf0, 0x6e, 0x64, 0x6d, 0xe7,
1092                 0x54, 0x88, 0x6b, 0x22, 0x29, 0xbe, 0xa5, 0x8c,
1093                 0x31, 0x23, 0x3b, 0x4a, 0x80, 0x37, 0xe6, 0xd0,
1094                 0x05, 0xfc, 0x10, 0x0e, 0xdd, 0xbb, 0x00, 0xc5,
1095                 0x07, 0x20, 0x59, 0xd3, 0x41, 0x17, 0x86, 0x46,
1096                 0xab, 0x68, 0xf6, 0x48, 0x3c, 0xea, 0x5a, 0x06,
1097                 0x30, 0x21, 0x19, 0xed, 0x74, 0xbe, 0x0b, 0x97,
1098                 0xee, 0x91, 0x35, 0x94, 0x1f, 0xcb, 0x68, 0x7f,
1099                 0xe4, 0x48, 0xb0, 0x16, 0xfb, 0xf0, 0x74, 0xdb,
1100                 0x06, 0x59, 0x2e, 0x5a, 0x9c, 0xce, 0x8f, 0x7d,
1101                 0xba, 0x48, 0xd5, 0x3f, 0x5c, 0xb0, 0xc2, 0x33,
1102                 0x48, 0x60, 0x17, 0x08, 0x85, 0xba, 0xff, 0xb9,
1103                 0x34, 0x0a, 0x3d, 0x8f, 0x21, 0x13, 0x12, 0x1b
1104 };
1105
1106 static const uint8_t AES_CBC_ciphertext_1536B[] = {
1107                 0x89, 0x93, 0x05, 0x99, 0xa9, 0xed, 0xea, 0x62,
1108                 0xc9, 0xda, 0x51, 0x15, 0xce, 0x42, 0x91, 0xc3,
1109                 0x80, 0xc8, 0x03, 0x88, 0xc2, 0x63, 0xda, 0x53,
1110                 0x1a, 0xf3, 0xeb, 0xd5, 0xba, 0x6f, 0x23, 0xb2,
1111                 0xed, 0x8f, 0x89, 0xb1, 0xb3, 0xca, 0x90, 0x7a,
1112                 0xdd, 0x3f, 0xf6, 0xca, 0x86, 0x58, 0x54, 0xbc,
1113                 0xab, 0x0f, 0xf4, 0xab, 0x6d, 0x5d, 0x42, 0xd0,
1114                 0x17, 0x49, 0x17, 0xd1, 0x93, 0xea, 0xe8, 0x22,
1115                 0xc1, 0x34, 0x9f, 0x3a, 0x3b, 0xaa, 0xe9, 0x1b,
1116                 0x93, 0xff, 0x6b, 0x68, 0xba, 0xe6, 0xd2, 0x39,
1117                 0x3d, 0x55, 0x34, 0x8f, 0x98, 0x86, 0xb4, 0xd8,
1118                 0x7c, 0x0d, 0x3e, 0x01, 0x63, 0x04, 0x01, 0xff,
1119                 0x16, 0x0f, 0x51, 0x5f, 0x73, 0x53, 0xf0, 0x3a,
1120                 0x38, 0xb4, 0x4d, 0x8d, 0xaf, 0xa3, 0xca, 0x2f,
1121                 0x6f, 0xdf, 0xc0, 0x41, 0x6c, 0x48, 0x60, 0x1a,
1122                 0xe4, 0xe7, 0x8a, 0x65, 0x6f, 0x8d, 0xd7, 0xe1,
1123                 0x10, 0xab, 0x78, 0x5b, 0xb9, 0x69, 0x1f, 0xe0,
1124                 0x5c, 0xf1, 0x19, 0x12, 0x21, 0xc7, 0x51, 0xbc,
1125                 0x61, 0x5f, 0xc0, 0x36, 0x17, 0xc0, 0x28, 0xd9,
1126                 0x51, 0xcb, 0x43, 0xd9, 0xfa, 0xd1, 0xad, 0x79,
1127                 0x69, 0x86, 0x49, 0xc5, 0xe5, 0x69, 0x27, 0xce,
1128                 0x22, 0xd0, 0xe1, 0x6a, 0xf9, 0x02, 0xca, 0x6c,
1129                 0x34, 0xc7, 0xb8, 0x02, 0xc1, 0x38, 0x7f, 0xd5,
1130                 0x15, 0xf5, 0xd6, 0xeb, 0xf9, 0x30, 0x40, 0x43,
1131                 0xea, 0x87, 0xde, 0x35, 0xf6, 0x83, 0x59, 0x09,
1132                 0x68, 0x62, 0x00, 0x87, 0xb8, 0xe7, 0xca, 0x05,
1133                 0x0f, 0xac, 0x42, 0x58, 0x45, 0xaa, 0xc9, 0x9b,
1134                 0xfd, 0x2a, 0xda, 0x65, 0x33, 0x93, 0x9d, 0xc6,
1135                 0x93, 0x8d, 0xe2, 0xc5, 0x71, 0xc1, 0x5c, 0x13,
1136                 0xde, 0x7b, 0xd4, 0xb9, 0x4c, 0x35, 0x61, 0x85,
1137                 0x90, 0x78, 0xf7, 0x81, 0x98, 0x45, 0x99, 0x24,
1138                 0x58, 0x73, 0x28, 0xf8, 0x31, 0xab, 0x54, 0x2e,
1139                 0xc0, 0x38, 0x77, 0x25, 0x5c, 0x06, 0x9c, 0xc3,
1140                 0x69, 0x21, 0x92, 0x76, 0xe1, 0x16, 0xdc, 0xa9,
1141                 0xee, 0xb6, 0x80, 0x66, 0x43, 0x11, 0x24, 0xb3,
1142                 0x07, 0x17, 0x89, 0x0f, 0xcb, 0xe0, 0x60, 0xa8,
1143                 0x9d, 0x06, 0x4b, 0x6e, 0x72, 0xb7, 0xbc, 0x4f,
1144                 0xb8, 0xc0, 0x80, 0xa2, 0xfb, 0x46, 0x5b, 0x8f,
1145                 0x11, 0x01, 0x92, 0x9d, 0x37, 0x09, 0x98, 0xc8,
1146                 0x0a, 0x46, 0xae, 0x12, 0xac, 0x61, 0x3f, 0xe7,
1147                 0x41, 0x1a, 0xaa, 0x2e, 0xdc, 0xd7, 0x2a, 0x47,
1148                 0xee, 0xdf, 0x08, 0xd1, 0xff, 0xea, 0x13, 0xc6,
1149                 0x05, 0xdb, 0x29, 0xcc, 0x03, 0xba, 0x7b, 0x6d,
1150                 0x40, 0xc1, 0xc9, 0x76, 0x75, 0x03, 0x7a, 0x71,
1151                 0xc9, 0x5f, 0xd9, 0xe0, 0x61, 0x69, 0x36, 0x8f,
1152                 0xb2, 0xbc, 0x28, 0xf3, 0x90, 0x71, 0xda, 0x5f,
1153                 0x08, 0xd5, 0x0d, 0xc1, 0xe6, 0xbd, 0x2b, 0xc6,
1154                 0x6c, 0x42, 0xfd, 0xbf, 0x10, 0xe8, 0x5f, 0x87,
1155                 0x3d, 0x21, 0x42, 0x85, 0x01, 0x0a, 0xbf, 0x8e,
1156                 0x49, 0xd3, 0x9c, 0x89, 0x3b, 0xea, 0xe1, 0xbf,
1157                 0xe9, 0x9b, 0x5e, 0x0e, 0xb8, 0xeb, 0xcd, 0x3a,
1158                 0xf6, 0x29, 0x41, 0x35, 0xdd, 0x9b, 0x13, 0x24,
1159                 0xe0, 0x1d, 0x8a, 0xcb, 0x20, 0xf8, 0x41, 0x51,
1160                 0x3e, 0x23, 0x8c, 0x67, 0x98, 0x39, 0x53, 0x77,
1161                 0x2a, 0x68, 0xf4, 0x3c, 0x7e, 0xd6, 0xc4, 0x6e,
1162                 0xf1, 0x53, 0xe9, 0xd8, 0x5c, 0xc1, 0xa9, 0x38,
1163                 0x6f, 0x5e, 0xe4, 0xd4, 0x29, 0x1c, 0x6c, 0xee,
1164                 0x2f, 0xea, 0xde, 0x61, 0x71, 0x5a, 0xea, 0xce,
1165                 0x23, 0x6e, 0x1b, 0x16, 0x43, 0xb7, 0xc0, 0xe3,
1166                 0x87, 0xa1, 0x95, 0x1e, 0x97, 0x4d, 0xea, 0xa6,
1167                 0xf7, 0x25, 0xac, 0x82, 0x2a, 0xd3, 0xa6, 0x99,
1168                 0x75, 0xdd, 0xc1, 0x55, 0x32, 0x6b, 0xea, 0x33,
1169                 0x88, 0xce, 0x06, 0xac, 0x15, 0x39, 0x19, 0xa3,
1170                 0x59, 0xaf, 0x7a, 0x1f, 0xd9, 0x72, 0x5e, 0xf7,
1171                 0x4c, 0xf3, 0x5d, 0x6b, 0xf2, 0x16, 0x92, 0xa8,
1172                 0x9e, 0x3d, 0xd4, 0x4c, 0x72, 0x55, 0x4e, 0x4a,
1173                 0xf7, 0x8b, 0x2f, 0x67, 0x5a, 0x90, 0xb7, 0xcf,
1174                 0x16, 0xd3, 0x7b, 0x5a, 0x9a, 0xc8, 0x9f, 0xbf,
1175                 0x01, 0x76, 0x3b, 0x86, 0x2c, 0x2a, 0x78, 0x10,
1176                 0x70, 0x05, 0x38, 0xf9, 0xdd, 0x2a, 0x1d, 0x00,
1177                 0x25, 0xb7, 0x10, 0xac, 0x3b, 0x3c, 0x4d, 0x3c,
1178                 0x01, 0x68, 0x3c, 0x5a, 0x29, 0xc2, 0xa0, 0x1b,
1179                 0x95, 0x67, 0xf9, 0x0a, 0x60, 0xb7, 0x11, 0x9c,
1180                 0x40, 0x45, 0xd7, 0xb0, 0xda, 0x49, 0x87, 0xcd,
1181                 0xb0, 0x9b, 0x61, 0x8c, 0xf4, 0x0d, 0x94, 0x1d,
1182                 0x79, 0x66, 0x13, 0x0b, 0xc6, 0x6b, 0x19, 0xee,
1183                 0xa0, 0x6b, 0x64, 0x7d, 0xc4, 0xff, 0x98, 0x72,
1184                 0x60, 0xab, 0x7f, 0x0f, 0x4d, 0x5d, 0x6b, 0xc3,
1185                 0xba, 0x5e, 0x0d, 0x04, 0xd9, 0x59, 0x17, 0xd0,
1186                 0x64, 0xbe, 0xfb, 0x58, 0xfc, 0xed, 0x18, 0xf6,
1187                 0xac, 0x19, 0xa4, 0xfd, 0x16, 0x59, 0x80, 0x58,
1188                 0xb8, 0x0f, 0x79, 0x24, 0x60, 0x18, 0x62, 0xa9,
1189                 0xa3, 0xa0, 0xe8, 0x81, 0xd6, 0xec, 0x5b, 0xfe,
1190                 0x5b, 0xb8, 0xa4, 0x00, 0xa9, 0xd0, 0x90, 0x17,
1191                 0xe5, 0x50, 0x3d, 0x2b, 0x12, 0x6e, 0x2a, 0x13,
1192                 0x65, 0x7c, 0xdf, 0xdf, 0xa7, 0xdd, 0x9f, 0x78,
1193                 0x5f, 0x8f, 0x4e, 0x90, 0xa6, 0x10, 0xe4, 0x7b,
1194                 0x68, 0x6b, 0xfd, 0xa9, 0x6d, 0x47, 0xfa, 0xec,
1195                 0x42, 0x35, 0x07, 0x12, 0x3e, 0x78, 0x23, 0x15,
1196                 0xff, 0xe2, 0x65, 0xc7, 0x47, 0x89, 0x2f, 0x97,
1197                 0x7c, 0xd7, 0x6b, 0x69, 0x35, 0x79, 0x6f, 0x85,
1198                 0xb4, 0xa9, 0x75, 0x04, 0x32, 0x9a, 0xfe, 0xf0,
1199                 0xce, 0xe3, 0xf1, 0xab, 0x15, 0x47, 0xe4, 0x9c,
1200                 0xc1, 0x48, 0x32, 0x3c, 0xbe, 0x44, 0x72, 0xc9,
1201                 0xaa, 0x50, 0x37, 0xa6, 0xbe, 0x41, 0xcf, 0xe8,
1202                 0x17, 0x4e, 0x37, 0xbe, 0xf1, 0x34, 0x2c, 0xd9,
1203                 0x60, 0x48, 0x09, 0xa5, 0x26, 0x00, 0x31, 0x77,
1204                 0x4e, 0xac, 0x7c, 0x89, 0x75, 0xe3, 0xde, 0x26,
1205                 0x4c, 0x32, 0x54, 0x27, 0x8e, 0x92, 0x26, 0x42,
1206                 0x85, 0x76, 0x01, 0x76, 0x62, 0x4c, 0x29, 0xe9,
1207                 0x38, 0x05, 0x51, 0x54, 0x97, 0xa3, 0x03, 0x59,
1208                 0x5e, 0xec, 0x0c, 0xe4, 0x96, 0xb7, 0x15, 0xa8,
1209                 0x41, 0x06, 0x2b, 0x78, 0x95, 0x24, 0xf6, 0x32,
1210                 0xc5, 0xec, 0xd7, 0x89, 0x28, 0x1e, 0xec, 0xb1,
1211                 0xc7, 0x21, 0x0c, 0xd3, 0x80, 0x7c, 0x5a, 0xe6,
1212                 0xb1, 0x3a, 0x52, 0x33, 0x84, 0x4e, 0x32, 0x6e,
1213                 0x7a, 0xf6, 0x43, 0x15, 0x5b, 0xa6, 0xba, 0xeb,
1214                 0xa8, 0xe4, 0xff, 0x4f, 0xbd, 0xbd, 0xa8, 0x5e,
1215                 0xbe, 0x27, 0xaf, 0xc5, 0xf7, 0x9e, 0xdf, 0x48,
1216                 0x22, 0xca, 0x6a, 0x0b, 0x3c, 0xd7, 0xe0, 0xdc,
1217                 0xf3, 0x71, 0x08, 0xdc, 0x28, 0x13, 0x08, 0xf2,
1218                 0x08, 0x1d, 0x9d, 0x7b, 0xd9, 0xde, 0x6f, 0xe6,
1219                 0xe8, 0x88, 0x18, 0xc2, 0xcd, 0x93, 0xc5, 0x38,
1220                 0x21, 0x68, 0x4c, 0x9a, 0xfb, 0xb6, 0x18, 0x16,
1221                 0x73, 0x2c, 0x1d, 0x6f, 0x95, 0xfb, 0x65, 0x4f,
1222                 0x7c, 0xec, 0x8d, 0x6c, 0xa8, 0xc0, 0x55, 0x28,
1223                 0xc6, 0xc3, 0xea, 0xeb, 0x05, 0xf5, 0x65, 0xeb,
1224                 0x53, 0xe1, 0x54, 0xef, 0xb8, 0x64, 0x98, 0x2d,
1225                 0x98, 0x9e, 0xc8, 0xfe, 0xa2, 0x07, 0x30, 0xf7,
1226                 0xf7, 0xae, 0xdb, 0x32, 0xf8, 0x71, 0x9d, 0x06,
1227                 0xdf, 0x9b, 0xda, 0x61, 0x7d, 0xdb, 0xae, 0x06,
1228                 0x24, 0x63, 0x74, 0xb6, 0xf3, 0x1b, 0x66, 0x09,
1229                 0x60, 0xff, 0x2b, 0x29, 0xf5, 0xa9, 0x9d, 0x61,
1230                 0x5d, 0x55, 0x10, 0x82, 0x21, 0xbb, 0x64, 0x0d,
1231                 0xef, 0x5c, 0xe3, 0x30, 0x1b, 0x60, 0x1e, 0x5b,
1232                 0xfe, 0x6c, 0xf5, 0x15, 0xa3, 0x86, 0x27, 0x58,
1233                 0x46, 0x00, 0x20, 0xcb, 0x86, 0x9a, 0x52, 0x29,
1234                 0x20, 0x68, 0x4d, 0x67, 0x88, 0x70, 0xc2, 0x31,
1235                 0xd8, 0xbb, 0xa5, 0xa7, 0x88, 0x7f, 0x66, 0xbc,
1236                 0xaa, 0x0f, 0xe1, 0x78, 0x7b, 0x97, 0x3c, 0xb7,
1237                 0xd7, 0xd8, 0x04, 0xe0, 0x09, 0x60, 0xc8, 0xd0,
1238                 0x9e, 0xe5, 0x6b, 0x31, 0x7f, 0x88, 0xfe, 0xc3,
1239                 0xfd, 0x89, 0xec, 0x76, 0x4b, 0xb3, 0xa7, 0x37,
1240                 0x03, 0xb7, 0xc6, 0x10, 0x7c, 0x9d, 0x0c, 0x75,
1241                 0xd3, 0x08, 0x14, 0x94, 0x03, 0x42, 0x25, 0x26,
1242                 0x85, 0xf7, 0xf0, 0x90, 0x06, 0x3e, 0x6f, 0x60,
1243                 0x52, 0x55, 0xd5, 0x0f, 0x79, 0x64, 0x69, 0x69,
1244                 0x46, 0xf9, 0x7f, 0x7f, 0x03, 0xf1, 0x1f, 0xdb,
1245                 0x39, 0x05, 0xba, 0x4a, 0x8f, 0x17, 0xe7, 0xba,
1246                 0xe2, 0x07, 0x7c, 0x1d, 0x9e, 0xbc, 0x94, 0xc0,
1247                 0x61, 0x59, 0x8e, 0x72, 0xaf, 0xfc, 0x99, 0xe4,
1248                 0xd5, 0xa8, 0xee, 0x0a, 0x48, 0x2d, 0x82, 0x8b,
1249                 0x34, 0x54, 0x8a, 0xce, 0xc7, 0xfa, 0xdd, 0xba,
1250                 0x54, 0xdf, 0xb3, 0x30, 0x33, 0x73, 0x2e, 0xd5,
1251                 0x52, 0xab, 0x49, 0x91, 0x4e, 0x0a, 0xd6, 0x2f,
1252                 0x67, 0xe4, 0xdd, 0x64, 0x48, 0x16, 0xd9, 0x85,
1253                 0xaa, 0x52, 0xa5, 0x0b, 0xd3, 0xb4, 0x2d, 0x77,
1254                 0x5e, 0x52, 0x77, 0x17, 0xcf, 0xbe, 0x88, 0x04,
1255                 0x01, 0x52, 0xe2, 0xf1, 0x46, 0xe2, 0x91, 0x30,
1256                 0x65, 0xcf, 0xc0, 0x65, 0x45, 0xc3, 0x7e, 0xf4,
1257                 0x2e, 0xb5, 0xaf, 0x6f, 0xab, 0x1a, 0xfa, 0x70,
1258                 0x35, 0xb8, 0x4f, 0x2d, 0x78, 0x90, 0x33, 0xb5,
1259                 0x9a, 0x67, 0xdb, 0x2f, 0x28, 0x32, 0xb6, 0x54,
1260                 0xab, 0x4c, 0x6b, 0x85, 0xed, 0x6c, 0x3e, 0x05,
1261                 0x2a, 0xc7, 0x32, 0xe8, 0xf5, 0xa3, 0x7b, 0x4e,
1262                 0x7b, 0x58, 0x24, 0x73, 0xf7, 0xfd, 0xc7, 0xc8,
1263                 0x6c, 0x71, 0x68, 0xb1, 0xf6, 0xc5, 0x9e, 0x1e,
1264                 0xe3, 0x5c, 0x25, 0xc0, 0x5b, 0x3e, 0x59, 0xa1,
1265                 0x18, 0x5a, 0xe8, 0xb5, 0xd1, 0x44, 0x13, 0xa3,
1266                 0xe6, 0x05, 0x76, 0xd2, 0x8d, 0x6e, 0x54, 0x68,
1267                 0x0c, 0xa4, 0x7b, 0x8b, 0xd3, 0x8c, 0x42, 0x13,
1268                 0x87, 0xda, 0xdf, 0x8f, 0xa5, 0x83, 0x7a, 0x42,
1269                 0x99, 0xb7, 0xeb, 0xe2, 0x79, 0xe0, 0xdb, 0xda,
1270                 0x33, 0xa8, 0x50, 0x3a, 0xd7, 0xe7, 0xd3, 0x61,
1271                 0x18, 0xb8, 0xaa, 0x2d, 0xc8, 0xd8, 0x2c, 0x28,
1272                 0xe5, 0x97, 0x0a, 0x7c, 0x6c, 0x7f, 0x09, 0xd7,
1273                 0x88, 0x80, 0xac, 0x12, 0xed, 0xf8, 0xc6, 0xb5,
1274                 0x2d, 0xd6, 0x63, 0x9b, 0x98, 0x35, 0x26, 0xde,
1275                 0xf6, 0x31, 0xee, 0x7e, 0xa0, 0xfb, 0x16, 0x98,
1276                 0xb1, 0x96, 0x1d, 0xee, 0xe3, 0x2f, 0xfb, 0x41,
1277                 0xdd, 0xea, 0x10, 0x1e, 0x03, 0x89, 0x18, 0xd2,
1278                 0x47, 0x0c, 0xa0, 0x57, 0xda, 0x76, 0x3a, 0x37,
1279                 0x2c, 0xe4, 0xf9, 0x77, 0xc8, 0x43, 0x5f, 0xcb,
1280                 0xd6, 0x85, 0xf7, 0x22, 0xe4, 0x32, 0x25, 0xa8,
1281                 0xdc, 0x21, 0xc0, 0xf5, 0x95, 0xb2, 0xf8, 0x83,
1282                 0xf0, 0x65, 0x61, 0x15, 0x48, 0x94, 0xb7, 0x03,
1283                 0x7f, 0x66, 0xa1, 0x39, 0x1f, 0xdd, 0xce, 0x96,
1284                 0xfe, 0x58, 0x81, 0x3d, 0x41, 0x11, 0x87, 0x13,
1285                 0x26, 0x1b, 0x6d, 0xf3, 0xca, 0x2e, 0x2c, 0x76,
1286                 0xd3, 0x2f, 0x6d, 0x49, 0x70, 0x53, 0x05, 0x96,
1287                 0xcc, 0x30, 0x2b, 0x83, 0xf2, 0xc6, 0xb2, 0x4b,
1288                 0x22, 0x13, 0x95, 0x42, 0xeb, 0x56, 0x4d, 0x22,
1289                 0xe6, 0x43, 0x6f, 0xba, 0xe7, 0x3b, 0xe5, 0x59,
1290                 0xce, 0x57, 0x88, 0x85, 0xb6, 0xbf, 0x15, 0x37,
1291                 0xb3, 0x7a, 0x7e, 0xc4, 0xbc, 0x99, 0xfc, 0xe4,
1292                 0x89, 0x00, 0x68, 0x39, 0xbc, 0x5a, 0xba, 0xab,
1293                 0x52, 0xab, 0xe6, 0x81, 0xfd, 0x93, 0x62, 0xe9,
1294                 0xb7, 0x12, 0xd1, 0x18, 0x1a, 0xb9, 0x55, 0x4a,
1295                 0x0f, 0xae, 0x35, 0x11, 0x04, 0x27, 0xf3, 0x42,
1296                 0x4e, 0xca, 0xdf, 0x9f, 0x12, 0x62, 0xea, 0x03,
1297                 0xc0, 0xa9, 0x22, 0x7b, 0x6c, 0x6c, 0xe3, 0xdf,
1298                 0x16, 0xad, 0x03, 0xc9, 0xfe, 0xa4, 0xdd, 0x4f
1299 };
1300
1301 static const uint8_t AES_CBC_ciphertext_1792B[] = {
1302                 0x59, 0xcc, 0xfe, 0x8f, 0xb4, 0x9d, 0x0e, 0xd1,
1303                 0x85, 0xfc, 0x9b, 0x43, 0xc1, 0xb7, 0x54, 0x67,
1304                 0x01, 0xef, 0xb8, 0x71, 0x36, 0xdb, 0x50, 0x48,
1305                 0x7a, 0xea, 0xcf, 0xce, 0xba, 0x30, 0x10, 0x2e,
1306                 0x96, 0x2b, 0xfd, 0xcf, 0x00, 0xe3, 0x1f, 0xac,
1307                 0x66, 0x14, 0x30, 0x86, 0x49, 0xdb, 0x01, 0x8b,
1308                 0x07, 0xdd, 0x00, 0x9d, 0x0d, 0x5c, 0x19, 0x11,
1309                 0xe8, 0x44, 0x2b, 0x25, 0x70, 0xed, 0x7c, 0x33,
1310                 0x0d, 0xe3, 0x34, 0x93, 0x63, 0xad, 0x26, 0xb1,
1311                 0x11, 0x91, 0x34, 0x2e, 0x1d, 0x50, 0xaa, 0xd4,
1312                 0xef, 0x3a, 0x6d, 0xd7, 0x33, 0x20, 0x0d, 0x3f,
1313                 0x9b, 0xdd, 0xc3, 0xa5, 0xc5, 0xf1, 0x99, 0xdc,
1314                 0xea, 0x52, 0xda, 0x55, 0xea, 0xa2, 0x7a, 0xc5,
1315                 0x78, 0x44, 0x4a, 0x02, 0x33, 0x19, 0x62, 0x37,
1316                 0xf8, 0x8b, 0xd1, 0x0c, 0x21, 0xdf, 0x40, 0x19,
1317                 0x81, 0xea, 0xfb, 0x1c, 0xa7, 0xcc, 0x60, 0xfe,
1318                 0x63, 0x25, 0x8f, 0xf3, 0x73, 0x0f, 0x45, 0xe6,
1319                 0x6a, 0x18, 0xbf, 0xbe, 0xad, 0x92, 0x2a, 0x1e,
1320                 0x15, 0x65, 0x6f, 0xef, 0x92, 0xcd, 0x0e, 0x19,
1321                 0x3d, 0x42, 0xa8, 0xfc, 0x0d, 0x32, 0x58, 0xe0,
1322                 0x56, 0x9f, 0xd6, 0x9b, 0x8b, 0xec, 0xe0, 0x45,
1323                 0x4d, 0x7e, 0x73, 0x87, 0xff, 0x74, 0x92, 0x59,
1324                 0x60, 0x13, 0x93, 0xda, 0xec, 0xbf, 0xfa, 0x20,
1325                 0xb6, 0xe7, 0xdf, 0xc7, 0x10, 0xf5, 0x79, 0xb4,
1326                 0xd7, 0xac, 0xaf, 0x2b, 0x37, 0x52, 0x30, 0x1d,
1327                 0xbe, 0x0f, 0x60, 0x77, 0x3d, 0x03, 0x63, 0xa9,
1328                 0xae, 0xb1, 0xf3, 0xca, 0xca, 0xb4, 0x21, 0xd7,
1329                 0x6f, 0x2e, 0x5e, 0x9b, 0x68, 0x53, 0x80, 0xab,
1330                 0x30, 0x23, 0x0a, 0x72, 0x6b, 0xb1, 0xd8, 0x25,
1331                 0x5d, 0x3a, 0x62, 0x9b, 0x4f, 0x59, 0x3b, 0x79,
1332                 0xa8, 0x9e, 0x08, 0x6d, 0x37, 0xb0, 0xfc, 0x42,
1333                 0x51, 0x25, 0x86, 0xbd, 0x54, 0x5a, 0x95, 0x20,
1334                 0x6c, 0xac, 0xb9, 0x30, 0x1c, 0x03, 0xc9, 0x49,
1335                 0x38, 0x55, 0x31, 0x49, 0xed, 0xa9, 0x0e, 0xc3,
1336                 0x65, 0xb4, 0x68, 0x6b, 0x07, 0x4c, 0x0a, 0xf9,
1337                 0x21, 0x69, 0x7c, 0x9f, 0x28, 0x80, 0xe9, 0x49,
1338                 0x22, 0x7c, 0xec, 0x97, 0xf7, 0x70, 0xb4, 0xb8,
1339                 0x25, 0xe7, 0x80, 0x2c, 0x43, 0x24, 0x8a, 0x2e,
1340                 0xac, 0xa2, 0x84, 0x20, 0xe7, 0xf4, 0x6b, 0x86,
1341                 0x37, 0x05, 0xc7, 0x59, 0x04, 0x49, 0x2a, 0x99,
1342                 0x80, 0x46, 0x32, 0x19, 0xe6, 0x30, 0xce, 0xc0,
1343                 0xef, 0x6e, 0xec, 0xe5, 0x2f, 0x24, 0xc1, 0x78,
1344                 0x45, 0x02, 0xd3, 0x64, 0x99, 0xf5, 0xc7, 0xbc,
1345                 0x8f, 0x8c, 0x75, 0xb1, 0x0a, 0xc8, 0xc3, 0xbd,
1346                 0x5e, 0x7e, 0xbd, 0x0e, 0xdf, 0x4b, 0x96, 0x6a,
1347                 0xfd, 0x03, 0xdb, 0xd1, 0x31, 0x1e, 0x27, 0xf9,
1348                 0xe5, 0x83, 0x9a, 0xfc, 0x13, 0x4c, 0xd3, 0x04,
1349                 0xdb, 0xdb, 0x3f, 0x35, 0x93, 0x4e, 0x14, 0x6b,
1350                 0x00, 0x5c, 0xb6, 0x11, 0x50, 0xee, 0x61, 0x5c,
1351                 0x10, 0x5c, 0xd0, 0x90, 0x02, 0x2e, 0x12, 0xe0,
1352                 0x50, 0x44, 0xad, 0x75, 0xcd, 0x94, 0xcf, 0x92,
1353                 0xcb, 0xe3, 0xe8, 0x77, 0x4b, 0xd7, 0x1a, 0x7c,
1354                 0xdd, 0x6b, 0x49, 0x21, 0x7c, 0xe8, 0x2c, 0x25,
1355                 0x49, 0x86, 0x1e, 0x54, 0xae, 0xfc, 0x0e, 0x80,
1356                 0xb1, 0xd5, 0xa5, 0x23, 0xcf, 0xcc, 0x0e, 0x11,
1357                 0xe2, 0x7c, 0x3c, 0x25, 0x78, 0x64, 0x03, 0xa1,
1358                 0xdd, 0x9f, 0x74, 0x12, 0x7b, 0x21, 0xb5, 0x73,
1359                 0x15, 0x3c, 0xed, 0xad, 0x07, 0x62, 0x21, 0x79,
1360                 0xd4, 0x2f, 0x0d, 0x72, 0xe9, 0x7c, 0x6b, 0x96,
1361                 0x6e, 0xe5, 0x36, 0x4a, 0xd2, 0x38, 0xe1, 0xff,
1362                 0x6e, 0x26, 0xa4, 0xac, 0x83, 0x07, 0xe6, 0x67,
1363                 0x74, 0x6c, 0xec, 0x8b, 0x4b, 0x79, 0x33, 0x50,
1364                 0x2f, 0x8f, 0xa0, 0x8f, 0xfa, 0x38, 0x6a, 0xa2,
1365                 0x3a, 0x42, 0x85, 0x15, 0x90, 0xd0, 0xb3, 0x0d,
1366                 0x8a, 0xe4, 0x60, 0x03, 0xef, 0xf9, 0x65, 0x8a,
1367                 0x4e, 0x50, 0x8c, 0x65, 0xba, 0x61, 0x16, 0xc3,
1368                 0x93, 0xb7, 0x75, 0x21, 0x98, 0x25, 0x60, 0x6e,
1369                 0x3d, 0x68, 0xba, 0x7c, 0xe4, 0xf3, 0xd9, 0x9b,
1370                 0xfb, 0x7a, 0xed, 0x1f, 0xb3, 0x4b, 0x88, 0x74,
1371                 0x2c, 0xb8, 0x8c, 0x22, 0x95, 0xce, 0x90, 0xf1,
1372                 0xdb, 0x80, 0xa6, 0x39, 0xae, 0x82, 0xa1, 0xef,
1373                 0x75, 0xec, 0xfe, 0xf1, 0xe8, 0x04, 0xfd, 0x99,
1374                 0x1b, 0x5f, 0x45, 0x87, 0x4f, 0xfa, 0xa2, 0x3e,
1375                 0x3e, 0xb5, 0x01, 0x4b, 0x46, 0xeb, 0x13, 0x9a,
1376                 0xe4, 0x7d, 0x03, 0x87, 0xb1, 0x59, 0x91, 0x8e,
1377                 0x37, 0xd3, 0x16, 0xce, 0xef, 0x4b, 0xe9, 0x46,
1378                 0x8d, 0x2a, 0x50, 0x2f, 0x41, 0xd3, 0x7b, 0xcf,
1379                 0xf0, 0xb7, 0x8b, 0x65, 0x0f, 0xa3, 0x27, 0x10,
1380                 0xe9, 0xa9, 0xe9, 0x2c, 0xbe, 0xbb, 0x82, 0xe3,
1381                 0x7b, 0x0b, 0x81, 0x3e, 0xa4, 0x6a, 0x4f, 0x3b,
1382                 0xd5, 0x61, 0xf8, 0x47, 0x04, 0x99, 0x5b, 0xff,
1383                 0xf3, 0x14, 0x6e, 0x57, 0x5b, 0xbf, 0x1b, 0xb4,
1384                 0x3f, 0xf9, 0x31, 0xf6, 0x95, 0xd5, 0x10, 0xa9,
1385                 0x72, 0x28, 0x23, 0xa9, 0x6a, 0xa2, 0xcf, 0x7d,
1386                 0xe3, 0x18, 0x95, 0xda, 0xbc, 0x6f, 0xe9, 0xd8,
1387                 0xef, 0x49, 0x3f, 0xd3, 0xef, 0x1f, 0xe1, 0x50,
1388                 0xe8, 0x8a, 0xc0, 0xce, 0xcc, 0xb7, 0x5e, 0x0e,
1389                 0x8b, 0x95, 0x80, 0xfd, 0x58, 0x2a, 0x9b, 0xc8,
1390                 0xb4, 0x17, 0x04, 0x46, 0x74, 0xd4, 0x68, 0x91,
1391                 0x33, 0xc8, 0x31, 0x15, 0x84, 0x16, 0x35, 0x03,
1392                 0x64, 0x6d, 0xa9, 0x4e, 0x20, 0xeb, 0xa9, 0x3f,
1393                 0x21, 0x5e, 0x9b, 0x09, 0xc3, 0x45, 0xf8, 0x7c,
1394                 0x59, 0x62, 0x29, 0x9a, 0x5c, 0xcf, 0xb4, 0x27,
1395                 0x5e, 0x13, 0xea, 0xb3, 0xef, 0xd9, 0x01, 0x2a,
1396                 0x65, 0x5f, 0x14, 0xf4, 0xbf, 0x28, 0x89, 0x3d,
1397                 0xdd, 0x9d, 0x52, 0xbd, 0x9e, 0x5b, 0x3b, 0xd2,
1398                 0xc2, 0x81, 0x35, 0xb6, 0xac, 0xdd, 0x27, 0xc3,
1399                 0x7b, 0x01, 0x5a, 0x6d, 0x4c, 0x5e, 0x2c, 0x30,
1400                 0xcb, 0x3a, 0xfa, 0xc1, 0xd7, 0x31, 0x67, 0x3e,
1401                 0x08, 0x6a, 0xe8, 0x8c, 0x75, 0xac, 0x1a, 0x6a,
1402                 0x52, 0xf7, 0x51, 0xcd, 0x85, 0x3f, 0x3c, 0xa7,
1403                 0xea, 0xbc, 0xd7, 0x18, 0x9e, 0x27, 0x73, 0xe6,
1404                 0x2b, 0x58, 0xb6, 0xd2, 0x29, 0x68, 0xd5, 0x8f,
1405                 0x00, 0x4d, 0x55, 0xf6, 0x61, 0x5a, 0xcc, 0x51,
1406                 0xa6, 0x5e, 0x85, 0xcb, 0x0b, 0xfd, 0x06, 0xca,
1407                 0xf5, 0xbf, 0x0d, 0x13, 0x74, 0x78, 0x6d, 0x9e,
1408                 0x20, 0x11, 0x84, 0x3e, 0x78, 0x17, 0x04, 0x4f,
1409                 0x64, 0x2c, 0x3b, 0x3e, 0x93, 0x7b, 0x58, 0x33,
1410                 0x07, 0x52, 0xf7, 0x60, 0x6a, 0xa8, 0x3b, 0x19,
1411                 0x27, 0x7a, 0x93, 0xc5, 0x53, 0xad, 0xec, 0xf6,
1412                 0xc8, 0x94, 0xee, 0x92, 0xea, 0xee, 0x7e, 0xea,
1413                 0xb9, 0x5f, 0xac, 0x59, 0x5d, 0x2e, 0x78, 0x53,
1414                 0x72, 0x81, 0x92, 0xdd, 0x1c, 0x63, 0xbe, 0x02,
1415                 0xeb, 0xa8, 0x1b, 0x2a, 0x6e, 0x72, 0xe3, 0x2d,
1416                 0x84, 0x0d, 0x8a, 0x22, 0xf6, 0xba, 0xab, 0x04,
1417                 0x8e, 0x04, 0x24, 0xdb, 0xcc, 0xe2, 0x69, 0xeb,
1418                 0x4e, 0xfa, 0x6b, 0x5b, 0xc8, 0xc0, 0xd9, 0x25,
1419                 0xcb, 0x40, 0x8d, 0x4b, 0x8e, 0xa0, 0xd4, 0x72,
1420                 0x98, 0x36, 0x46, 0x3b, 0x4f, 0x5f, 0x96, 0x84,
1421                 0x03, 0x28, 0x86, 0x4d, 0xa1, 0x8a, 0xd7, 0xb2,
1422                 0x5b, 0x27, 0x01, 0x80, 0x62, 0x49, 0x56, 0xb9,
1423                 0xa0, 0xa1, 0xe3, 0x6e, 0x22, 0x2a, 0x5d, 0x03,
1424                 0x86, 0x40, 0x36, 0x22, 0x5e, 0xd2, 0xe5, 0xc0,
1425                 0x6b, 0xfa, 0xac, 0x80, 0x4e, 0x09, 0x99, 0xbc,
1426                 0x2f, 0x9b, 0xcc, 0xf3, 0x4e, 0xf7, 0x99, 0x98,
1427                 0x11, 0x6e, 0x6f, 0x62, 0x22, 0x6b, 0x92, 0x95,
1428                 0x3b, 0xc3, 0xd2, 0x8e, 0x0f, 0x07, 0xc2, 0x51,
1429                 0x5c, 0x4d, 0xb2, 0x6e, 0xc0, 0x27, 0x73, 0xcd,
1430                 0x57, 0xb7, 0xf0, 0xe9, 0x2e, 0xc8, 0xe2, 0x0c,
1431                 0xd1, 0xb5, 0x0f, 0xff, 0xf9, 0xec, 0x38, 0xba,
1432                 0x97, 0xd6, 0x94, 0x9b, 0xd1, 0x79, 0xb6, 0x6a,
1433                 0x01, 0x17, 0xe4, 0x7e, 0xa6, 0xd5, 0x86, 0x19,
1434                 0xae, 0xf3, 0xf0, 0x62, 0x73, 0xc0, 0xf0, 0x0a,
1435                 0x7a, 0x96, 0x93, 0x72, 0x89, 0x7e, 0x25, 0x57,
1436                 0xf8, 0xf7, 0xd5, 0x1e, 0xe5, 0xac, 0xd6, 0x38,
1437                 0x4f, 0xe8, 0x81, 0xd1, 0x53, 0x41, 0x07, 0x2d,
1438                 0x58, 0x34, 0x1c, 0xef, 0x74, 0x2e, 0x61, 0xca,
1439                 0xd3, 0xeb, 0xd6, 0x93, 0x0a, 0xf2, 0xf2, 0x86,
1440                 0x9c, 0xe3, 0x7a, 0x52, 0xf5, 0x42, 0xf1, 0x8b,
1441                 0x10, 0xf2, 0x25, 0x68, 0x7e, 0x61, 0xb1, 0x19,
1442                 0xcf, 0x8f, 0x5a, 0x53, 0xb7, 0x68, 0x4f, 0x1a,
1443                 0x71, 0xe9, 0x83, 0x91, 0x3a, 0x78, 0x0f, 0xf7,
1444                 0xd4, 0x74, 0xf5, 0x06, 0xd2, 0x88, 0xb0, 0x06,
1445                 0xe5, 0xc0, 0xfb, 0xb3, 0x91, 0xad, 0xc0, 0x84,
1446                 0x31, 0xf2, 0x3a, 0xcf, 0x63, 0xe6, 0x4a, 0xd3,
1447                 0x78, 0xbe, 0xde, 0x73, 0x3e, 0x02, 0x8e, 0xb8,
1448                 0x3a, 0xf6, 0x55, 0xa7, 0xf8, 0x5a, 0xb5, 0x0e,
1449                 0x0c, 0xc5, 0xe5, 0x66, 0xd5, 0xd2, 0x18, 0xf3,
1450                 0xef, 0xa5, 0xc9, 0x68, 0x69, 0xe0, 0xcd, 0x00,
1451                 0x33, 0x99, 0x6e, 0xea, 0xcb, 0x06, 0x7a, 0xe1,
1452                 0xe1, 0x19, 0x0b, 0xe7, 0x08, 0xcd, 0x09, 0x1b,
1453                 0x85, 0xec, 0xc4, 0xd4, 0x75, 0xf0, 0xd6, 0xfb,
1454                 0x84, 0x95, 0x07, 0x44, 0xca, 0xa5, 0x2a, 0x6c,
1455                 0xc2, 0x00, 0x58, 0x08, 0x87, 0x9e, 0x0a, 0xd4,
1456                 0x06, 0xe2, 0x91, 0x5f, 0xb7, 0x1b, 0x11, 0xfa,
1457                 0x85, 0xfc, 0x7c, 0xf2, 0x0f, 0x6e, 0x3c, 0x8a,
1458                 0xe1, 0x0f, 0xa0, 0x33, 0x84, 0xce, 0x81, 0x4d,
1459                 0x32, 0x4d, 0xeb, 0x41, 0xcf, 0x5a, 0x05, 0x60,
1460                 0x47, 0x6c, 0x2a, 0xc4, 0x17, 0xd5, 0x16, 0x3a,
1461                 0xe4, 0xe7, 0xab, 0x84, 0x94, 0x22, 0xff, 0x56,
1462                 0xb0, 0x0c, 0x92, 0x6c, 0x19, 0x11, 0x4c, 0xb3,
1463                 0xed, 0x58, 0x48, 0x84, 0x2a, 0xe2, 0x19, 0x2a,
1464                 0xe1, 0xc0, 0x56, 0x82, 0x3c, 0x83, 0xb4, 0x58,
1465                 0x2d, 0xf0, 0xb5, 0x1e, 0x76, 0x85, 0x51, 0xc2,
1466                 0xe4, 0x95, 0x27, 0x96, 0xd1, 0x90, 0xc3, 0x17,
1467                 0x75, 0xa1, 0xbb, 0x46, 0x5f, 0xa6, 0xf2, 0xef,
1468                 0x71, 0x56, 0x92, 0xc5, 0x8a, 0x85, 0x52, 0xe4,
1469                 0x63, 0x21, 0x6f, 0x55, 0x85, 0x2b, 0x6b, 0x0d,
1470                 0xc9, 0x92, 0x77, 0x67, 0xe3, 0xff, 0x2a, 0x2b,
1471                 0x90, 0x01, 0x3d, 0x74, 0x63, 0x04, 0x61, 0x3c,
1472                 0x8e, 0xf8, 0xfc, 0x04, 0xdd, 0x21, 0x85, 0x92,
1473                 0x1e, 0x4d, 0x51, 0x8d, 0xb5, 0x6b, 0xf1, 0xda,
1474                 0x96, 0xf5, 0x8e, 0x3c, 0x38, 0x5a, 0xac, 0x9b,
1475                 0xba, 0x0c, 0x84, 0x5d, 0x50, 0x12, 0xc7, 0xc5,
1476                 0x7a, 0xcb, 0xb1, 0xfa, 0x16, 0x93, 0xdf, 0x98,
1477                 0xda, 0x3f, 0x49, 0xa3, 0x94, 0x78, 0x70, 0xc7,
1478                 0x0b, 0xb6, 0x91, 0xa6, 0x16, 0x2e, 0xcf, 0xfd,
1479                 0x51, 0x6a, 0x5b, 0xad, 0x7a, 0xdd, 0xa9, 0x48,
1480                 0x48, 0xac, 0xd6, 0x45, 0xbc, 0x23, 0x31, 0x1d,
1481                 0x86, 0x54, 0x8a, 0x7f, 0x04, 0x97, 0x71, 0x9e,
1482                 0xbc, 0x2e, 0x6b, 0xd9, 0x33, 0xc8, 0x20, 0xc9,
1483                 0xe0, 0x25, 0x86, 0x59, 0x15, 0xcf, 0x63, 0xe5,
1484                 0x99, 0xf1, 0x24, 0xf1, 0xba, 0xc4, 0x15, 0x02,
1485                 0xe2, 0xdb, 0xfe, 0x4a, 0xf8, 0x3b, 0x91, 0x13,
1486                 0x8d, 0x03, 0x81, 0x9f, 0xb3, 0x3f, 0x04, 0x03,
1487                 0x58, 0xc0, 0xef, 0x27, 0x82, 0x14, 0xd2, 0x7f,
1488                 0x93, 0x70, 0xb7, 0xb2, 0x02, 0x21, 0xb3, 0x07,
1489                 0x7f, 0x1c, 0xef, 0x88, 0xee, 0x29, 0x7a, 0x0b,
1490                 0x3d, 0x75, 0x5a, 0x93, 0xfe, 0x7f, 0x14, 0xf7,
1491                 0x4e, 0x4b, 0x7f, 0x21, 0x02, 0xad, 0xf9, 0x43,
1492                 0x29, 0x1a, 0xe8, 0x1b, 0xf5, 0x32, 0xb2, 0x96,
1493                 0xe6, 0xe8, 0x96, 0x20, 0x9b, 0x96, 0x8e, 0x7b,
1494                 0xfe, 0xd8, 0xc9, 0x9c, 0x65, 0x16, 0xd6, 0x68,
1495                 0x95, 0xf8, 0x22, 0xe2, 0xae, 0x84, 0x03, 0xfd,
1496                 0x87, 0xa2, 0x72, 0x79, 0x74, 0x95, 0xfa, 0xe1,
1497                 0xfe, 0xd0, 0x4e, 0x3d, 0x39, 0x2e, 0x67, 0x55,
1498                 0x71, 0x6c, 0x89, 0x33, 0x49, 0x0c, 0x1b, 0x46,
1499                 0x92, 0x31, 0x6f, 0xa6, 0xf0, 0x09, 0xbd, 0x2d,
1500                 0xe2, 0xca, 0xda, 0x18, 0x33, 0xce, 0x67, 0x37,
1501                 0xfd, 0x6f, 0xcb, 0x9d, 0xbd, 0x42, 0xbc, 0xb2,
1502                 0x9c, 0x28, 0xcd, 0x65, 0x3c, 0x61, 0xbc, 0xde,
1503                 0x9d, 0xe1, 0x2a, 0x3e, 0xbf, 0xee, 0x3c, 0xcb,
1504                 0xb1, 0x50, 0xa9, 0x2c, 0xbe, 0xb5, 0x43, 0xd0,
1505                 0xec, 0x29, 0xf9, 0x16, 0x6f, 0x31, 0xd9, 0x9b,
1506                 0x92, 0xb1, 0x32, 0xae, 0x0f, 0xb6, 0x9d, 0x0e,
1507                 0x25, 0x7f, 0x89, 0x1f, 0x1d, 0x01, 0x68, 0xab,
1508                 0x3d, 0xd1, 0x74, 0x5b, 0x4c, 0x38, 0x7f, 0x3d,
1509                 0x33, 0xa5, 0xa2, 0x9f, 0xda, 0x84, 0xa5, 0x82,
1510                 0x2d, 0x16, 0x66, 0x46, 0x08, 0x30, 0x14, 0x48,
1511                 0x5e, 0xca, 0xe3, 0xf4, 0x8c, 0xcb, 0x32, 0xc6,
1512                 0xf1, 0x43, 0x62, 0xc6, 0xef, 0x16, 0xfa, 0x43,
1513                 0xae, 0x9c, 0x53, 0xe3, 0x49, 0x45, 0x80, 0xfd,
1514                 0x1d, 0x8c, 0xa9, 0x6d, 0x77, 0x76, 0xaa, 0x40,
1515                 0xc4, 0x4e, 0x7b, 0x78, 0x6b, 0xe0, 0x1d, 0xce,
1516                 0x56, 0x3d, 0xf0, 0x11, 0xfe, 0x4f, 0x6a, 0x6d,
1517                 0x0f, 0x4f, 0x90, 0x38, 0x92, 0x17, 0xfa, 0x56,
1518                 0x12, 0xa6, 0xa1, 0x0a, 0xea, 0x2f, 0x50, 0xf9,
1519                 0x60, 0x66, 0x6c, 0x7d, 0x5a, 0x08, 0x8e, 0x3c,
1520                 0xf3, 0xf0, 0x33, 0x02, 0x11, 0x02, 0xfe, 0x4c,
1521                 0x56, 0x2b, 0x9f, 0x0c, 0xbd, 0x65, 0x8a, 0x83,
1522                 0xde, 0x7c, 0x05, 0x26, 0x93, 0x19, 0xcc, 0xf3,
1523                 0x71, 0x0e, 0xad, 0x2f, 0xb3, 0xc9, 0x38, 0x50,
1524                 0x64, 0xd5, 0x4c, 0x60, 0x5f, 0x02, 0x13, 0x34,
1525                 0xc9, 0x75, 0xc4, 0x60, 0xab, 0x2e, 0x17, 0x7d
1526 };
1527
1528 static const uint8_t AES_CBC_ciphertext_2048B[] = {
1529                 0x8b, 0x55, 0xbd, 0xfd, 0x2b, 0x35, 0x76, 0x5c,
1530                 0xd1, 0x90, 0xd7, 0x6a, 0x63, 0x1e, 0x39, 0x71,
1531                 0x0d, 0x5c, 0xd8, 0x03, 0x00, 0x75, 0xf1, 0x07,
1532                 0x03, 0x8d, 0x76, 0xeb, 0x3b, 0x00, 0x1e, 0x33,
1533                 0x88, 0xfc, 0x8f, 0x08, 0x4d, 0x33, 0xf1, 0x3c,
1534                 0xee, 0xd0, 0x5d, 0x19, 0x8b, 0x3c, 0x50, 0x86,
1535                 0xfd, 0x8d, 0x58, 0x21, 0xb4, 0xae, 0x0f, 0x81,
1536                 0xe9, 0x9f, 0xc9, 0xc0, 0x90, 0xf7, 0x04, 0x6f,
1537                 0x39, 0x1d, 0x8a, 0x3f, 0x8d, 0x32, 0x23, 0xb5,
1538                 0x1f, 0xcc, 0x8a, 0x12, 0x2d, 0x46, 0x82, 0x5e,
1539                 0x6a, 0x34, 0x8c, 0xb1, 0x93, 0x70, 0x3b, 0xde,
1540                 0x55, 0xaf, 0x16, 0x35, 0x99, 0x84, 0xd5, 0x88,
1541                 0xc9, 0x54, 0xb1, 0xb2, 0xd3, 0xeb, 0x9e, 0x55,
1542                 0x9a, 0xa9, 0xa7, 0xf5, 0xda, 0x29, 0xcf, 0xe1,
1543                 0x98, 0x64, 0x45, 0x77, 0xf2, 0x12, 0x69, 0x8f,
1544                 0x78, 0xd8, 0x82, 0x41, 0xb2, 0x9f, 0xe2, 0x1c,
1545                 0x63, 0x9b, 0x24, 0x81, 0x67, 0x95, 0xa2, 0xff,
1546                 0x26, 0x9d, 0x65, 0x48, 0x61, 0x30, 0x66, 0x41,
1547                 0x68, 0x84, 0xbb, 0x59, 0x14, 0x8e, 0x9a, 0x62,
1548                 0xb6, 0xca, 0xda, 0xbe, 0x7c, 0x41, 0x52, 0x6e,
1549                 0x1b, 0x86, 0xbf, 0x08, 0xeb, 0x37, 0x84, 0x60,
1550                 0xe4, 0xc4, 0x1e, 0xa8, 0x4c, 0x84, 0x60, 0x2f,
1551                 0x70, 0x90, 0xf2, 0x26, 0xe7, 0x65, 0x0c, 0xc4,
1552                 0x58, 0x36, 0x8e, 0x4d, 0xdf, 0xff, 0x9a, 0x39,
1553                 0x93, 0x01, 0xcf, 0x6f, 0x6d, 0xde, 0xef, 0x79,
1554                 0xb0, 0xce, 0xe2, 0x98, 0xdb, 0x85, 0x8d, 0x62,
1555                 0x9d, 0xb9, 0x63, 0xfd, 0xf0, 0x35, 0xb5, 0xa9,
1556                 0x1b, 0xf9, 0xe5, 0xd4, 0x2e, 0x22, 0x2d, 0xcc,
1557                 0x42, 0xbf, 0x0e, 0x51, 0xf7, 0x15, 0x07, 0x32,
1558                 0x75, 0x5b, 0x74, 0xbb, 0x00, 0xef, 0xd4, 0x66,
1559                 0x8b, 0xad, 0x71, 0x53, 0x94, 0xd7, 0x7d, 0x2c,
1560                 0x40, 0x3e, 0x69, 0xa0, 0x4c, 0x86, 0x5e, 0x06,
1561                 0xed, 0xdf, 0x22, 0xe2, 0x24, 0x25, 0x4e, 0x9b,
1562                 0x5f, 0x49, 0x74, 0xba, 0xed, 0xb1, 0xa6, 0xeb,
1563                 0xae, 0x3f, 0xc6, 0x9e, 0x0b, 0x29, 0x28, 0x9a,
1564                 0xb6, 0xb2, 0x74, 0x58, 0xec, 0xa6, 0x4a, 0xed,
1565                 0xe5, 0x10, 0x00, 0x85, 0xe1, 0x63, 0x41, 0x61,
1566                 0x30, 0x7c, 0x97, 0xcf, 0x75, 0xcf, 0xb6, 0xf3,
1567                 0xf7, 0xda, 0x35, 0x3f, 0x85, 0x8c, 0x64, 0xca,
1568                 0xb7, 0xea, 0x7f, 0xe4, 0xa3, 0x4d, 0x30, 0x84,
1569                 0x8c, 0x9c, 0x80, 0x5a, 0x50, 0xa5, 0x64, 0xae,
1570                 0x26, 0xd3, 0xb5, 0x01, 0x73, 0x36, 0x8a, 0x92,
1571                 0x49, 0xc4, 0x1a, 0x94, 0x81, 0x9d, 0xf5, 0x6c,
1572                 0x50, 0xe1, 0x58, 0x0b, 0x75, 0xdd, 0x6b, 0x6a,
1573                 0xca, 0x69, 0xea, 0xc3, 0x33, 0x90, 0x9f, 0x3b,
1574                 0x65, 0x5d, 0x5e, 0xee, 0x31, 0xb7, 0x32, 0xfd,
1575                 0x56, 0x83, 0xb6, 0xfb, 0xa8, 0x04, 0xfc, 0x1e,
1576                 0x11, 0xfb, 0x02, 0x23, 0x53, 0x49, 0x45, 0xb1,
1577                 0x07, 0xfc, 0xba, 0xe7, 0x5f, 0x5d, 0x2d, 0x7f,
1578                 0x9e, 0x46, 0xba, 0xe9, 0xb0, 0xdb, 0x32, 0x04,
1579                 0xa4, 0xa7, 0x98, 0xab, 0x91, 0xcd, 0x02, 0x05,
1580                 0xf5, 0x74, 0x31, 0x98, 0x83, 0x3d, 0x33, 0x11,
1581                 0x0e, 0xe3, 0x8d, 0xa8, 0xc9, 0x0e, 0xf3, 0xb9,
1582                 0x47, 0x67, 0xe9, 0x79, 0x2b, 0x34, 0xcd, 0x9b,
1583                 0x45, 0x75, 0x29, 0xf0, 0xbf, 0xcc, 0xda, 0x3a,
1584                 0x91, 0xb2, 0x15, 0x27, 0x7a, 0xe5, 0xf5, 0x6a,
1585                 0x5e, 0xbe, 0x2c, 0x98, 0xe8, 0x40, 0x96, 0x4f,
1586                 0x8a, 0x09, 0xfd, 0xf6, 0xb2, 0xe7, 0x45, 0xb6,
1587                 0x08, 0xc1, 0x69, 0xe1, 0xb3, 0xc4, 0x24, 0x34,
1588                 0x07, 0x85, 0xd5, 0xa9, 0x78, 0xca, 0xfa, 0x4b,
1589                 0x01, 0x19, 0x4d, 0x95, 0xdc, 0xa5, 0xc1, 0x9c,
1590                 0xec, 0x27, 0x5b, 0xa6, 0x54, 0x25, 0xbd, 0xc8,
1591                 0x0a, 0xb7, 0x11, 0xfb, 0x4e, 0xeb, 0x65, 0x2e,
1592                 0xe1, 0x08, 0x9c, 0x3a, 0x45, 0x44, 0x33, 0xef,
1593                 0x0d, 0xb9, 0xff, 0x3e, 0x68, 0x9c, 0x61, 0x2b,
1594                 0x11, 0xb8, 0x5c, 0x47, 0x0f, 0x94, 0xf2, 0xf8,
1595                 0x0b, 0xbb, 0x99, 0x18, 0x85, 0xa3, 0xba, 0x44,
1596                 0xf3, 0x79, 0xb3, 0x63, 0x2c, 0x1f, 0x2a, 0x35,
1597                 0x3b, 0x23, 0x98, 0xab, 0xf4, 0x16, 0x36, 0xf8,
1598                 0xde, 0x86, 0xa4, 0xd4, 0x75, 0xff, 0x51, 0xf9,
1599                 0xeb, 0x42, 0x5f, 0x55, 0xe2, 0xbe, 0xd1, 0x5b,
1600                 0xb5, 0x38, 0xeb, 0xb4, 0x4d, 0xec, 0xec, 0x99,
1601                 0xe1, 0x39, 0x43, 0xaa, 0x64, 0xf7, 0xc9, 0xd8,
1602                 0xf2, 0x9a, 0x71, 0x43, 0x39, 0x17, 0xe8, 0xa8,
1603                 0xa2, 0xe2, 0xa4, 0x2c, 0x18, 0x11, 0x49, 0xdf,
1604                 0x18, 0xdd, 0x85, 0x6e, 0x65, 0x96, 0xe2, 0xba,
1605                 0xa1, 0x0a, 0x2c, 0xca, 0xdc, 0x5f, 0xe4, 0xf4,
1606                 0x35, 0x03, 0xb2, 0xa9, 0xda, 0xcf, 0xb7, 0x6d,
1607                 0x65, 0x82, 0x82, 0x67, 0x9d, 0x0e, 0xf3, 0xe8,
1608                 0x85, 0x6c, 0x69, 0xb8, 0x4c, 0xa6, 0xc6, 0x2e,
1609                 0x40, 0xb5, 0x54, 0x28, 0x95, 0xe4, 0x57, 0xe0,
1610                 0x5b, 0xf8, 0xde, 0x59, 0xe0, 0xfd, 0x89, 0x48,
1611                 0xac, 0x56, 0x13, 0x54, 0xb9, 0x1b, 0xf5, 0x59,
1612                 0x97, 0xb6, 0xb3, 0xe8, 0xac, 0x2d, 0xfc, 0xd2,
1613                 0xea, 0x57, 0x96, 0x57, 0xa8, 0x26, 0x97, 0x2c,
1614                 0x01, 0x89, 0x56, 0xea, 0xec, 0x8c, 0x53, 0xd5,
1615                 0xd7, 0x9e, 0xc9, 0x98, 0x0b, 0xad, 0x03, 0x75,
1616                 0xa0, 0x6e, 0x98, 0x8b, 0x97, 0x8d, 0x8d, 0x85,
1617                 0x7d, 0x74, 0xa7, 0x2d, 0xde, 0x67, 0x0c, 0xcd,
1618                 0x54, 0xb8, 0x15, 0x7b, 0xeb, 0xf5, 0x84, 0xb9,
1619                 0x78, 0xab, 0xd8, 0x68, 0x91, 0x1f, 0x6a, 0xa6,
1620                 0x28, 0x22, 0xf7, 0x00, 0x49, 0x00, 0xbe, 0x41,
1621                 0x71, 0x0a, 0xf5, 0xe7, 0x9f, 0xb4, 0x11, 0x41,
1622                 0x3f, 0xcd, 0xa9, 0xa9, 0x01, 0x8b, 0x6a, 0xeb,
1623                 0x54, 0x4c, 0x58, 0x92, 0x68, 0x02, 0x0e, 0xe9,
1624                 0xed, 0x65, 0x4c, 0xfb, 0x95, 0x48, 0x58, 0xa2,
1625                 0xaa, 0x57, 0x69, 0x13, 0x82, 0x0c, 0x2c, 0x4b,
1626                 0x5d, 0x4e, 0x18, 0x30, 0xef, 0x1c, 0xb1, 0x9d,
1627                 0x05, 0x05, 0x02, 0x1c, 0x97, 0xc9, 0x48, 0xfe,
1628                 0x5e, 0x7b, 0x77, 0xa3, 0x1f, 0x2a, 0x81, 0x42,
1629                 0xf0, 0x4b, 0x85, 0x12, 0x9c, 0x1f, 0x44, 0xb1,
1630                 0x14, 0x91, 0x92, 0x65, 0x77, 0xb1, 0x87, 0xa2,
1631                 0xfc, 0xa4, 0xe7, 0xd2, 0x9b, 0xf2, 0x17, 0xf0,
1632                 0x30, 0x1c, 0x8d, 0x33, 0xbc, 0x25, 0x28, 0x48,
1633                 0xfd, 0x30, 0x79, 0x0a, 0x99, 0x3e, 0xb4, 0x0f,
1634                 0x1e, 0xa6, 0x68, 0x76, 0x19, 0x76, 0x29, 0xac,
1635                 0x5d, 0xb8, 0x1e, 0x42, 0xd6, 0x85, 0x04, 0xbf,
1636                 0x64, 0x1c, 0x2d, 0x53, 0xe9, 0x92, 0x78, 0xf8,
1637                 0xc3, 0xda, 0x96, 0x92, 0x10, 0x6f, 0x45, 0x85,
1638                 0xaf, 0x5e, 0xcc, 0xa8, 0xc0, 0xc6, 0x2e, 0x73,
1639                 0x51, 0x3f, 0x5e, 0xd7, 0x52, 0x33, 0x71, 0x12,
1640                 0x6d, 0x85, 0xee, 0xea, 0x85, 0xa8, 0x48, 0x2b,
1641                 0x40, 0x64, 0x6d, 0x28, 0x73, 0x16, 0xd7, 0x82,
1642                 0xd9, 0x90, 0xed, 0x1f, 0xa7, 0x5c, 0xb1, 0x5c,
1643                 0x27, 0xb9, 0x67, 0x8b, 0xb4, 0x17, 0x13, 0x83,
1644                 0x5f, 0x09, 0x72, 0x0a, 0xd7, 0xa0, 0xec, 0x81,
1645                 0x59, 0x19, 0xb9, 0xa6, 0x5a, 0x37, 0x34, 0x14,
1646                 0x47, 0xf6, 0xe7, 0x6c, 0xd2, 0x09, 0x10, 0xe7,
1647                 0xdd, 0xbb, 0x02, 0xd1, 0x28, 0xfa, 0x01, 0x2c,
1648                 0x93, 0x64, 0x2e, 0x1b, 0x4c, 0x02, 0x52, 0xcb,
1649                 0x07, 0xa1, 0xb6, 0x46, 0x02, 0x80, 0xd9, 0x8f,
1650                 0x5c, 0x62, 0xbe, 0x78, 0x9e, 0x75, 0xc4, 0x97,
1651                 0x91, 0x39, 0x12, 0x65, 0xb9, 0x3b, 0xc2, 0xd1,
1652                 0xaf, 0xf2, 0x1f, 0x4e, 0x4d, 0xd1, 0xf0, 0x9f,
1653                 0xb7, 0x12, 0xfd, 0xe8, 0x75, 0x18, 0xc0, 0x9d,
1654                 0x8c, 0x70, 0xff, 0x77, 0x05, 0xb6, 0x1a, 0x1f,
1655                 0x96, 0x48, 0xf6, 0xfe, 0xd5, 0x5d, 0x98, 0xa5,
1656                 0x72, 0x1c, 0x84, 0x76, 0x3e, 0xb8, 0x87, 0x37,
1657                 0xdd, 0xd4, 0x3a, 0x45, 0xdd, 0x09, 0xd8, 0xe7,
1658                 0x09, 0x2f, 0x3e, 0x33, 0x9e, 0x7b, 0x8c, 0xe4,
1659                 0x85, 0x12, 0x4e, 0xf8, 0x06, 0xb7, 0xb1, 0x85,
1660                 0x24, 0x96, 0xd8, 0xfe, 0x87, 0x92, 0x81, 0xb1,
1661                 0xa3, 0x38, 0xb9, 0x56, 0xe1, 0xf6, 0x36, 0x41,
1662                 0xbb, 0xd6, 0x56, 0x69, 0x94, 0x57, 0xb3, 0xa4,
1663                 0xca, 0xa4, 0xe1, 0x02, 0x3b, 0x96, 0x71, 0xe0,
1664                 0xb2, 0x2f, 0x85, 0x48, 0x1b, 0x4a, 0x41, 0x80,
1665                 0x4b, 0x9c, 0xe0, 0xc9, 0x39, 0xb8, 0xb1, 0xca,
1666                 0x64, 0x77, 0x46, 0x58, 0xe6, 0x84, 0xd5, 0x2b,
1667                 0x65, 0xce, 0xe9, 0x09, 0xa3, 0xaa, 0xfb, 0x83,
1668                 0xa9, 0x28, 0x68, 0xfd, 0xcd, 0xfd, 0x76, 0x83,
1669                 0xe1, 0x20, 0x22, 0x77, 0x3a, 0xa3, 0xb2, 0x93,
1670                 0x14, 0x91, 0xfc, 0xe2, 0x17, 0x63, 0x2b, 0xa6,
1671                 0x29, 0x38, 0x7b, 0x9b, 0x8b, 0x15, 0x77, 0xd6,
1672                 0xaa, 0x92, 0x51, 0x53, 0x50, 0xff, 0xa0, 0x35,
1673                 0xa0, 0x59, 0x7d, 0xf0, 0x11, 0x23, 0x49, 0xdf,
1674                 0x5a, 0x21, 0xc2, 0xfe, 0x35, 0xa0, 0x1d, 0xe2,
1675                 0xae, 0xa2, 0x8a, 0x61, 0x5b, 0xf7, 0xf1, 0x1c,
1676                 0x1c, 0xec, 0xc4, 0xf6, 0xdc, 0xaa, 0xc8, 0xc2,
1677                 0xe5, 0xa1, 0x2e, 0x14, 0xe5, 0xc6, 0xc9, 0x73,
1678                 0x03, 0x78, 0xeb, 0xed, 0xe0, 0x3e, 0xc5, 0xf4,
1679                 0xf1, 0x50, 0xb2, 0x01, 0x91, 0x96, 0xf5, 0xbb,
1680                 0xe1, 0x32, 0xcd, 0xa8, 0x66, 0xbf, 0x73, 0x85,
1681                 0x94, 0xd6, 0x7e, 0x68, 0xc5, 0xe4, 0xed, 0xd5,
1682                 0xe3, 0x67, 0x4c, 0xa5, 0xb3, 0x1f, 0xdf, 0xf8,
1683                 0xb3, 0x73, 0x5a, 0xac, 0xeb, 0x46, 0x16, 0x24,
1684                 0xab, 0xca, 0xa4, 0xdd, 0x87, 0x0e, 0x24, 0x83,
1685                 0x32, 0x04, 0x4c, 0xd8, 0xda, 0x7d, 0xdc, 0xe3,
1686                 0x01, 0x93, 0xf3, 0xc1, 0x5b, 0xbd, 0xc3, 0x1d,
1687                 0x40, 0x62, 0xde, 0x94, 0x03, 0x85, 0x91, 0x2a,
1688                 0xa0, 0x25, 0x10, 0xd3, 0x32, 0x9f, 0x93, 0x00,
1689                 0xa7, 0x8a, 0xfa, 0x77, 0x7c, 0xaf, 0x4d, 0xc8,
1690                 0x7a, 0xf3, 0x16, 0x2b, 0xba, 0xeb, 0x74, 0x51,
1691                 0xb8, 0xdd, 0x32, 0xad, 0x68, 0x7d, 0xdd, 0xca,
1692                 0x60, 0x98, 0xc9, 0x9b, 0xb6, 0x5d, 0x4d, 0x3a,
1693                 0x66, 0x8a, 0xbe, 0x05, 0xf9, 0x0c, 0xc5, 0xba,
1694                 0x52, 0x82, 0x09, 0x1f, 0x5a, 0x66, 0x89, 0x69,
1695                 0xa3, 0x5d, 0x93, 0x50, 0x7d, 0x44, 0xc3, 0x2a,
1696                 0xb8, 0xab, 0xec, 0xa6, 0x5a, 0xae, 0x4a, 0x6a,
1697                 0xcd, 0xfd, 0xb6, 0xff, 0x3d, 0x98, 0x05, 0xd9,
1698                 0x5b, 0x29, 0xc4, 0x6f, 0xe0, 0x76, 0xe2, 0x3f,
1699                 0xec, 0xd7, 0xa4, 0x91, 0x63, 0xf5, 0x4e, 0x4b,
1700                 0xab, 0x20, 0x8c, 0x3a, 0x41, 0xed, 0x8b, 0x4b,
1701                 0xb9, 0x01, 0x21, 0xc0, 0x6d, 0xfd, 0x70, 0x5b,
1702                 0x20, 0x92, 0x41, 0x89, 0x74, 0xb7, 0xe9, 0x8b,
1703                 0xfc, 0x6d, 0x17, 0x3f, 0x7f, 0x89, 0x3d, 0x6b,
1704                 0x8f, 0xbc, 0xd2, 0x57, 0xe9, 0xc9, 0x6e, 0xa7,
1705                 0x19, 0x26, 0x18, 0xad, 0xef, 0xb5, 0x87, 0xbf,
1706                 0xb8, 0xa8, 0xd6, 0x7d, 0xdd, 0x5f, 0x94, 0x54,
1707                 0x09, 0x92, 0x2b, 0xf5, 0x04, 0xf7, 0x36, 0x69,
1708                 0x8e, 0xf4, 0xdc, 0x1d, 0x6e, 0x55, 0xbb, 0xe9,
1709                 0x13, 0x05, 0x83, 0x35, 0x9c, 0xed, 0xcf, 0x8c,
1710                 0x26, 0x8c, 0x7b, 0xc7, 0x0b, 0xba, 0xfd, 0xe2,
1711                 0x84, 0x5c, 0x2a, 0x79, 0x43, 0x99, 0xb2, 0xc3,
1712                 0x82, 0x87, 0xc8, 0xcd, 0x37, 0x6d, 0xa1, 0x2b,
1713                 0x39, 0xb2, 0x38, 0x99, 0xd9, 0xfc, 0x02, 0x15,
1714                 0x55, 0x21, 0x62, 0x59, 0xeb, 0x00, 0x86, 0x08,
1715                 0x20, 0xbe, 0x1a, 0x62, 0x4d, 0x7e, 0xdf, 0x68,
1716                 0x73, 0x5b, 0x5f, 0xaf, 0x84, 0x96, 0x2e, 0x1f,
1717                 0x6b, 0x03, 0xc9, 0xa6, 0x75, 0x18, 0xe9, 0xd4,
1718                 0xbd, 0xc8, 0xec, 0x9a, 0x5a, 0xb3, 0x99, 0xab,
1719                 0x5f, 0x7c, 0x08, 0x7f, 0x69, 0x4d, 0x52, 0xa2,
1720                 0x30, 0x17, 0x3b, 0x16, 0x15, 0x1b, 0x11, 0x62,
1721                 0x3e, 0x80, 0x4b, 0x85, 0x7c, 0x9c, 0xd1, 0x3a,
1722                 0x13, 0x01, 0x5e, 0x45, 0xf1, 0xc8, 0x5f, 0xcd,
1723                 0x0e, 0x21, 0xf5, 0x82, 0xd4, 0x7b, 0x5c, 0x45,
1724                 0x27, 0x6b, 0xef, 0xfe, 0xb8, 0xc0, 0x6f, 0xdc,
1725                 0x60, 0x7b, 0xe4, 0xd5, 0x75, 0x71, 0xe6, 0xe8,
1726                 0x7d, 0x6b, 0x6d, 0x80, 0xaf, 0x76, 0x41, 0x58,
1727                 0xb7, 0xac, 0xb7, 0x13, 0x2f, 0x81, 0xcc, 0xf9,
1728                 0x19, 0x97, 0xe8, 0xee, 0x40, 0x91, 0xfc, 0x89,
1729                 0x13, 0x1e, 0x67, 0x9a, 0xdb, 0x8f, 0x8f, 0xc7,
1730                 0x4a, 0xc9, 0xaf, 0x2f, 0x67, 0x01, 0x3c, 0xb8,
1731                 0xa8, 0x3e, 0x78, 0x93, 0x1b, 0xdf, 0xbb, 0x34,
1732                 0x0b, 0x1a, 0xfa, 0xc2, 0x2d, 0xc5, 0x1c, 0xec,
1733                 0x97, 0x4f, 0x48, 0x41, 0x15, 0x0e, 0x75, 0xed,
1734                 0x66, 0x8c, 0x17, 0x7f, 0xb1, 0x48, 0x13, 0xc1,
1735                 0xfb, 0x60, 0x06, 0xf9, 0x72, 0x41, 0x3e, 0xcf,
1736                 0x6e, 0xb6, 0xc8, 0xeb, 0x4b, 0x5a, 0xd2, 0x0c,
1737                 0x28, 0xda, 0x02, 0x7a, 0x46, 0x21, 0x42, 0xb5,
1738                 0x34, 0xda, 0xcb, 0x5e, 0xbd, 0x66, 0x5c, 0xca,
1739                 0xff, 0x52, 0x43, 0x89, 0xf9, 0x10, 0x9a, 0x9e,
1740                 0x9b, 0xe3, 0xb0, 0x51, 0xe9, 0xf3, 0x0a, 0x35,
1741                 0x77, 0x54, 0xcc, 0xac, 0xa6, 0xf1, 0x2e, 0x36,
1742                 0x89, 0xac, 0xc5, 0xc6, 0x62, 0x5a, 0xc0, 0x6d,
1743                 0xc4, 0xe1, 0xf7, 0x64, 0x30, 0xff, 0x11, 0x40,
1744                 0x13, 0x89, 0xd8, 0xd7, 0x73, 0x3f, 0x93, 0x08,
1745                 0x68, 0xab, 0x66, 0x09, 0x1a, 0xea, 0x78, 0xc9,
1746                 0x52, 0xf2, 0xfd, 0x93, 0x1b, 0x94, 0xbe, 0x5c,
1747                 0xe5, 0x00, 0x6e, 0x00, 0xb9, 0xea, 0x27, 0xaa,
1748                 0xb3, 0xee, 0xe3, 0xc8, 0x6a, 0xb0, 0xc1, 0x8e,
1749                 0x9b, 0x54, 0x40, 0x10, 0x96, 0x06, 0xe8, 0xb3,
1750                 0xf5, 0x55, 0x77, 0xd7, 0x5c, 0x94, 0xc1, 0x74,
1751                 0xf3, 0x07, 0x64, 0xac, 0x1c, 0xde, 0xc7, 0x22,
1752                 0xb0, 0xbf, 0x2a, 0x5a, 0xc0, 0x8f, 0x8a, 0x83,
1753                 0x50, 0xc2, 0x5e, 0x97, 0xa0, 0xbe, 0x49, 0x7e,
1754                 0x47, 0xaf, 0xa7, 0x20, 0x02, 0x35, 0xa4, 0x57,
1755                 0xd9, 0x26, 0x63, 0xdb, 0xf1, 0x34, 0x42, 0x89,
1756                 0x36, 0xd1, 0x77, 0x6f, 0xb1, 0xea, 0x79, 0x7e,
1757                 0x95, 0x10, 0x5a, 0xee, 0xa3, 0xae, 0x6f, 0xba,
1758                 0xa9, 0xef, 0x5a, 0x7e, 0x34, 0x03, 0x04, 0x07,
1759                 0x92, 0xd6, 0x07, 0x79, 0xaa, 0x14, 0x90, 0x97,
1760                 0x05, 0x4d, 0xa6, 0x27, 0x10, 0x5c, 0x25, 0x24,
1761                 0xcb, 0xcc, 0xf6, 0x77, 0x9e, 0x43, 0x23, 0xd4,
1762                 0x98, 0xef, 0x22, 0xa8, 0xad, 0xf2, 0x26, 0x08,
1763                 0x59, 0x69, 0xa4, 0xc3, 0x97, 0xe0, 0x5c, 0x6f,
1764                 0xeb, 0x3d, 0xd4, 0x62, 0x6e, 0x80, 0x61, 0x02,
1765                 0xf4, 0xfc, 0x94, 0x79, 0xbb, 0x4e, 0x6d, 0xd7,
1766                 0x30, 0x5b, 0x10, 0x11, 0x5a, 0x3d, 0xa7, 0x50,
1767                 0x1d, 0x9a, 0x13, 0x5f, 0x4f, 0xa8, 0xa7, 0xb6,
1768                 0x39, 0xc7, 0xea, 0xe6, 0x19, 0x61, 0x69, 0xc7,
1769                 0x9a, 0x3a, 0xeb, 0x9d, 0xdc, 0xf7, 0x06, 0x37,
1770                 0xbd, 0xac, 0xe3, 0x18, 0xff, 0xfe, 0x11, 0xdb,
1771                 0x67, 0x42, 0xb4, 0xea, 0xa8, 0xbd, 0xb0, 0x76,
1772                 0xd2, 0x74, 0x32, 0xc2, 0xa4, 0x9c, 0xe7, 0x60,
1773                 0xc5, 0x30, 0x9a, 0x57, 0x66, 0xcd, 0x0f, 0x02,
1774                 0x4c, 0xea, 0xe9, 0xd3, 0x2a, 0x5c, 0x09, 0xc2,
1775                 0xff, 0x6a, 0xde, 0x5d, 0xb7, 0xe9, 0x75, 0x6b,
1776                 0x29, 0x94, 0xd6, 0xf7, 0xc3, 0xdf, 0xfb, 0x70,
1777                 0xec, 0xb5, 0x8c, 0xb0, 0x78, 0x7a, 0xee, 0x52,
1778                 0x5f, 0x8c, 0xae, 0x85, 0xe5, 0x98, 0xa2, 0xb7,
1779                 0x7c, 0x02, 0x2a, 0xcc, 0x9e, 0xde, 0x99, 0x5f,
1780                 0x84, 0x20, 0xbb, 0xdc, 0xf2, 0xd2, 0x13, 0x46,
1781                 0x3c, 0xd6, 0x4d, 0xe7, 0x50, 0xef, 0x55, 0xc3,
1782                 0x96, 0x9f, 0xec, 0x6c, 0xd8, 0xe2, 0xea, 0xed,
1783                 0xc7, 0x33, 0xc9, 0xb3, 0x1c, 0x4f, 0x1d, 0x83,
1784                 0x1d, 0xe4, 0xdd, 0xb2, 0x24, 0x8f, 0xf9, 0xf5
1785 };
1786
1787
1788 static const uint8_t HMAC_SHA256_ciphertext_64B_digest[] = {
1789                 0xc5, 0x6d, 0x4f, 0x29, 0xf4, 0xd2, 0xcc, 0x87,
1790                 0x3c, 0x81, 0x02, 0x6d, 0x38, 0x7a, 0x67, 0x3e,
1791                 0x95, 0x9c, 0x5c, 0x8f, 0xda, 0x5c, 0x06, 0xe0,
1792                 0x65, 0xf1, 0x6c, 0x51, 0x52, 0x49, 0x3e, 0x5f
1793 };
1794
1795 static const uint8_t HMAC_SHA256_ciphertext_128B_digest[] = {
1796                 0x76, 0x64, 0x2d, 0x69, 0x71, 0x5d, 0x6a, 0xd8,
1797                 0x9f, 0x74, 0x11, 0x2f, 0x58, 0xe0, 0x4a, 0x2f,
1798                 0x6c, 0x88, 0x5e, 0x4d, 0x9c, 0x79, 0x83, 0x1c,
1799                 0x8a, 0x14, 0xd0, 0x07, 0xfb, 0xbf, 0x6c, 0x8f
1800 };
1801
1802 static const uint8_t HMAC_SHA256_ciphertext_256B_digest[] = {
1803                 0x05, 0xa7, 0x44, 0xcd, 0x91, 0x8c, 0x95, 0xcf,
1804                 0x7b, 0x8f, 0xd3, 0x90, 0x86, 0x7e, 0x7b, 0xb9,
1805                 0x05, 0xd6, 0x6e, 0x7a, 0xc1, 0x7b, 0x26, 0xff,
1806                 0xd3, 0x4b, 0xe0, 0x22, 0x8b, 0xa8, 0x47, 0x52
1807 };
1808
1809 static const uint8_t HMAC_SHA256_ciphertext_512B_digest[] = {
1810                 0x08, 0xb7, 0x29, 0x54, 0x18, 0x7e, 0x97, 0x49,
1811                 0xc6, 0x7c, 0x9f, 0x94, 0xa5, 0x4f, 0xa2, 0x25,
1812                 0xd0, 0xe2, 0x30, 0x7b, 0xad, 0x93, 0xc9, 0x12,
1813                 0x0f, 0xf0, 0xf0, 0x71, 0xc2, 0xf6, 0x53, 0x8f
1814 };
1815
1816 static const uint8_t HMAC_SHA256_ciphertext_768B_digest[] = {
1817                 0xe4, 0x3e, 0x73, 0x93, 0x03, 0xaf, 0x6f, 0x9c,
1818                 0xca, 0x57, 0x3b, 0x4a, 0x6e, 0x83, 0x58, 0xf5,
1819                 0x66, 0xc2, 0xb4, 0xa7, 0xe0, 0xee, 0x63, 0x6b,
1820                 0x48, 0xb7, 0x50, 0x45, 0x69, 0xdf, 0x5c, 0x5b
1821 };
1822
1823 static const uint8_t HMAC_SHA256_ciphertext_1024B_digest[] = {
1824                 0x03, 0xb9, 0x96, 0x26, 0xdc, 0x1c, 0xab, 0xe2,
1825                 0xf5, 0x70, 0x55, 0x15, 0x67, 0x6e, 0x48, 0x11,
1826                 0xe7, 0x67, 0xea, 0xfa, 0x5c, 0x6b, 0x28, 0x22,
1827                 0xc9, 0x0e, 0x67, 0x04, 0xb3, 0x71, 0x7f, 0x88
1828 };
1829
1830 static const uint8_t HMAC_SHA256_ciphertext_1280B_digest[] = {
1831                 0x01, 0x91, 0xb8, 0x78, 0xd3, 0x21, 0x74, 0xa5,
1832                 0x1c, 0x8b, 0xd4, 0xd2, 0xc0, 0x49, 0xd7, 0xd2,
1833                 0x16, 0x46, 0x66, 0x85, 0x50, 0x6d, 0x08, 0xcc,
1834                 0xc7, 0x0a, 0xa3, 0x71, 0xcc, 0xde, 0xee, 0xdc
1835 };
1836
1837 static const uint8_t HMAC_SHA256_ciphertext_1536B_digest[] = {
1838                 0xf2, 0xe5, 0xe9, 0x57, 0x53, 0xd7, 0x69, 0x28,
1839                 0x7b, 0x69, 0xb5, 0x49, 0xa3, 0x31, 0x56, 0x5f,
1840                 0xa4, 0xe9, 0x87, 0x26, 0x2f, 0xe0, 0x2d, 0xd6,
1841                 0x08, 0x44, 0x01, 0x71, 0x0c, 0x93, 0x85, 0x84
1842 };
1843
1844 static const uint8_t HMAC_SHA256_ciphertext_1792B_digest[] = {
1845                 0xf6, 0x57, 0x62, 0x01, 0xbf, 0x2d, 0xea, 0x4a,
1846                 0xef, 0x43, 0x85, 0x60, 0x18, 0xdf, 0x8b, 0xb4,
1847                 0x60, 0xc0, 0xfd, 0x2f, 0x90, 0x15, 0xe6, 0x91,
1848                 0x56, 0x61, 0x68, 0x7f, 0x5e, 0x92, 0xa8, 0xdd
1849 };
1850
1851 static const uint8_t HMAC_SHA256_ciphertext_2048B_digest[] = {
1852                 0x81, 0x1a, 0x29, 0xbc, 0x6b, 0x9f, 0xbb, 0xb8,
1853                 0xef, 0x71, 0x7b, 0x1f, 0x6f, 0xd4, 0x7e, 0x68,
1854                 0x3a, 0x9c, 0xb9, 0x98, 0x22, 0x81, 0xfa, 0x95,
1855                 0xee, 0xbc, 0x7f, 0x23, 0x29, 0x88, 0x76, 0xb8
1856 };
1857
1858 struct crypto_data_params {
1859         const char *name;
1860         uint16_t length;
1861         const char *plaintext;
1862         struct crypto_expected_output {
1863                 const uint8_t *ciphertext;
1864                 const uint8_t *digest;
1865         } expected;
1866 };
1867
1868 #define MAX_PACKET_SIZE_INDEX   10
1869
1870 struct crypto_data_params aes_cbc_hmac_sha256_output[MAX_PACKET_SIZE_INDEX] = {
1871         { "64B", 64, &plaintext_quote[sizeof(plaintext_quote) - 1 - 64],
1872                 { AES_CBC_ciphertext_64B, HMAC_SHA256_ciphertext_64B_digest } },
1873         { "128B", 128, &plaintext_quote[sizeof(plaintext_quote) - 1 - 128],
1874                 { AES_CBC_ciphertext_128B, HMAC_SHA256_ciphertext_128B_digest } },
1875         { "256B", 256, &plaintext_quote[sizeof(plaintext_quote) - 1 - 256],
1876                 { AES_CBC_ciphertext_256B, HMAC_SHA256_ciphertext_256B_digest } },
1877         { "512B", 512, &plaintext_quote[sizeof(plaintext_quote) - 1 - 512],
1878                 { AES_CBC_ciphertext_512B, HMAC_SHA256_ciphertext_512B_digest } },
1879         { "768B", 768, &plaintext_quote[sizeof(plaintext_quote) - 1 - 768],
1880                 { AES_CBC_ciphertext_768B, HMAC_SHA256_ciphertext_768B_digest } },
1881         { "1024B", 1024, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1024],
1882                 { AES_CBC_ciphertext_1024B, HMAC_SHA256_ciphertext_1024B_digest } },
1883         { "1280B", 1280, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1280],
1884                 { AES_CBC_ciphertext_1280B, HMAC_SHA256_ciphertext_1280B_digest } },
1885         { "1536B", 1536, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1536],
1886                 { AES_CBC_ciphertext_1536B, HMAC_SHA256_ciphertext_1536B_digest } },
1887         { "1792B", 1792, &plaintext_quote[sizeof(plaintext_quote) - 1 - 1792],
1888                 { AES_CBC_ciphertext_1792B, HMAC_SHA256_ciphertext_1792B_digest } },
1889         { "2048B", 2048, &plaintext_quote[sizeof(plaintext_quote) - 1 - 2048],
1890                 { AES_CBC_ciphertext_2048B, HMAC_SHA256_ciphertext_2048B_digest } }
1891 };
1892
1893 static int
1894 test_perf_crypto_qp_vary_burst_size(uint16_t dev_num)
1895 {
1896         uint32_t num_to_submit = 4096;
1897         struct rte_crypto_op *c_ops[num_to_submit];
1898         struct rte_crypto_op *proc_ops[num_to_submit];
1899         uint64_t failed_polls, retries, start_cycles, end_cycles, total_cycles = 0;
1900         uint32_t burst_sent, burst_received;
1901         uint32_t i, burst_size, num_sent, num_received;
1902         struct crypto_testsuite_params *ts_params = &testsuite_params;
1903         struct crypto_unittest_params *ut_params = &unittest_params;
1904         struct crypto_data_params *data_params = aes_cbc_hmac_sha256_output;
1905
1906         if (rte_cryptodev_count() == 0) {
1907                 printf("\nNo crypto devices available. Is kernel driver loaded?\n");
1908                 return TEST_FAILED;
1909         }
1910
1911         /* Setup Cipher Parameters */
1912         ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
1913         ut_params->cipher_xform.next = &ut_params->auth_xform;
1914
1915         ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;
1916         ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;
1917         ut_params->cipher_xform.cipher.key.data = aes_cbc_128_key;
1918         ut_params->cipher_xform.cipher.key.length = CIPHER_IV_LENGTH_AES_CBC;
1919
1920
1921         /* Setup HMAC Parameters */
1922         ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
1923         ut_params->auth_xform.next = NULL;
1924
1925         ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
1926         ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA256_HMAC;
1927         ut_params->auth_xform.auth.key.data = hmac_sha256_key;
1928         ut_params->auth_xform.auth.key.length = HMAC_KEY_LENGTH_SHA256;
1929         ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA256;
1930
1931         /* Create Crypto session*/
1932         ut_params->sess = rte_cryptodev_sym_session_create(ts_params->dev_id,
1933                 &ut_params->cipher_xform);
1934
1935         TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
1936
1937         /* Generate Crypto op data structure(s) */
1938         for (i = 0; i < num_to_submit ; i++) {
1939                 struct rte_mbuf *m = setup_test_string(ts_params->mbuf_mp,
1940                                 data_params[0].expected.ciphertext,
1941                                 data_params[0].length, 0);
1942                 TEST_ASSERT_NOT_NULL(m, "Failed to allocate tx_buf");
1943
1944                 ut_params->digest = (uint8_t *)rte_pktmbuf_append(m,
1945                                 DIGEST_BYTE_LENGTH_SHA256);
1946                 TEST_ASSERT_NOT_NULL(ut_params->digest,
1947                                 "no room to append digest");
1948
1949                 rte_memcpy(ut_params->digest, data_params[0].expected.digest,
1950                         DIGEST_BYTE_LENGTH_SHA256);
1951
1952
1953                 struct rte_crypto_op *op =
1954                                 rte_crypto_op_alloc(ts_params->op_mpool,
1955                                                 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
1956
1957                 rte_crypto_op_attach_sym_session(op, ut_params->sess);
1958
1959                 op->sym->auth.digest.data = ut_params->digest;
1960                 op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m,
1961                                 data_params[0].length);
1962                 op->sym->auth.digest.length = DIGEST_BYTE_LENGTH_SHA256;
1963
1964                 op->sym->auth.data.offset = CIPHER_IV_LENGTH_AES_CBC;
1965                 op->sym->auth.data.length = data_params[0].length;
1966
1967
1968                 op->sym->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(m,
1969                                 CIPHER_IV_LENGTH_AES_CBC);
1970                 op->sym->cipher.iv.phys_addr = rte_pktmbuf_mtophys(m);
1971                 op->sym->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC;
1972
1973                 rte_memcpy(op->sym->cipher.iv.data, aes_cbc_128_iv,
1974                                 CIPHER_IV_LENGTH_AES_CBC);
1975
1976                 op->sym->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC;
1977                 op->sym->cipher.data.length = data_params[0].length;
1978
1979                 op->sym->m_src = m;
1980
1981                 c_ops[i] = op;
1982         }
1983
1984         printf("\nTest to measure the IA cycle cost using AES128_CBC_SHA256_HMAC "
1985                         "algorithm with a constant request size of %u.",
1986                         data_params[0].length);
1987         printf("\nThis test will keep retries at 0 and only measure IA cycle "
1988                         "cost for each request.");
1989         printf("\nDev No\tQP No\tNum Sent\tNum Received\tTx/Rx burst");
1990         printf("\tRetries (Device Busy)\tAverage IA cycle cost "
1991                         "(assuming 0 retries)");
1992         for (i = 2; i <= 128 ; i *= 2) {
1993                 num_sent = 0;
1994                 num_received = 0;
1995                 retries = 0;
1996                 failed_polls = 0;
1997                 burst_size = i;
1998                 total_cycles = 0;
1999                 while (num_sent < num_to_submit) {
2000                         start_cycles = rte_rdtsc_precise();
2001                         burst_sent = rte_cryptodev_enqueue_burst(dev_num,
2002                                         0, &c_ops[num_sent],
2003                                         ((num_to_submit-num_sent) < burst_size) ?
2004                                         num_to_submit-num_sent : burst_size);
2005                         if (burst_sent == 0)
2006                                 retries++;
2007                         else
2008                                 num_sent += burst_sent;
2009                         end_cycles = rte_rdtsc_precise();
2010                         total_cycles += (end_cycles - start_cycles);
2011                         /*
2012                          * Wait until requests have been sent.
2013                          */
2014                         rte_delay_ms(1);
2015
2016                         start_cycles = rte_rdtsc_precise();
2017                         burst_received = rte_cryptodev_dequeue_burst(
2018                                         dev_num, 0, proc_ops, burst_size);
2019                         if (burst_received == 0)
2020                                 failed_polls++;
2021                         else
2022                                 num_received += burst_received;
2023                         end_cycles = rte_rdtsc_precise();
2024                         total_cycles += end_cycles - start_cycles;
2025                 }
2026
2027                 while (num_received != num_to_submit) {
2028                         if (gbl_cryptodev_perftest_devtype ==
2029                                         RTE_CRYPTODEV_AESNI_MB_PMD)
2030                                 rte_cryptodev_enqueue_burst(dev_num, 0,
2031                                                 NULL, 0);
2032
2033                         burst_received = rte_cryptodev_dequeue_burst(
2034                                         dev_num, 0, proc_ops, burst_size);
2035                         if (burst_received == 0)
2036                                 failed_polls++;
2037                         else
2038                                 num_received += burst_received;
2039                 }
2040
2041                 printf("\n%u\t%u\t%u\t\t%u\t\t%u", dev_num, 0,
2042                                         num_sent, num_received, burst_size);
2043                 printf("\t\t%"PRIu64, retries);
2044                 printf("\t\t\t%"PRIu64, total_cycles/num_received);
2045         }
2046         printf("\n");
2047
2048         for (i = 0; i < num_to_submit ; i++) {
2049                 rte_pktmbuf_free(c_ops[i]->sym->m_src);
2050                 rte_crypto_op_free(c_ops[i]);
2051         }
2052         return TEST_SUCCESS;
2053 }
2054
2055 static int
2056 test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
2057 {
2058         uint32_t num_to_submit = pparams->total_operations;
2059         struct rte_crypto_op *c_ops[num_to_submit];
2060         struct rte_crypto_op *proc_ops[num_to_submit];
2061         uint64_t failed_polls, retries, start_cycles, end_cycles, total_cycles = 0;
2062         uint32_t burst_sent = 0, burst_received = 0;
2063         uint32_t i, burst_size, num_sent, num_ops_received;
2064         struct crypto_testsuite_params *ts_params = &testsuite_params;
2065         static struct rte_cryptodev_sym_session *sess;
2066
2067         if (rte_cryptodev_count() == 0) {
2068                 printf("\nNo crypto devices found. Is PMD build configured?\n");
2069                 printf("\nAnd is kernel driver loaded for HW PMDs?\n");
2070                 return TEST_FAILED;
2071         }
2072
2073         /* Create Crypto session*/
2074         sess = test_perf_create_snow3g_session(ts_params->dev_id,
2075                         pparams->chain, pparams->cipher_algo,
2076                         pparams->cipher_key_length, pparams->auth_algo);
2077         TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
2078
2079         /* Generate Crypto op data structure(s)*/
2080         for (i = 0; i < num_to_submit ; i++) {
2081                 struct rte_mbuf *m = test_perf_create_pktmbuf(
2082                                                 ts_params->mbuf_mp,
2083                                                 pparams->buf_size);
2084                 TEST_ASSERT_NOT_NULL(m, "Failed to allocate tx_buf");
2085
2086                 struct rte_crypto_op *op =
2087                                 rte_crypto_op_alloc(ts_params->op_mpool,
2088                                                 RTE_CRYPTO_OP_TYPE_SYMMETRIC);
2089                 TEST_ASSERT_NOT_NULL(op, "Failed to allocate op");
2090
2091                 op = test_perf_set_crypto_op_snow3g(op, m, sess, pparams->buf_size,
2092                                         get_auth_digest_length(pparams->auth_algo));
2093                 TEST_ASSERT_NOT_NULL(op, "Failed to attach op to session");
2094
2095                 c_ops[i] = op;
2096         }
2097
2098         printf("\nOn %s dev%u qp%u, %s, cipher algo:%s, auth_algo:%s, "
2099                         "Packet Size %u bytes",
2100                         pmd_name(gbl_cryptodev_perftest_devtype),
2101                         ts_params->dev_id, 0,
2102                         chain_mode_name(pparams->chain),
2103                         cipher_algo_name(pparams->cipher_algo),
2104                         auth_algo_name(pparams->auth_algo),
2105                         pparams->buf_size);
2106         printf("\nOps Tx\tOps Rx\tOps/burst  ");
2107         printf("Retries  EmptyPolls\tIACycles/CyOp\tIACycles/Burst\tIACycles/Byte");
2108
2109         for (i = 2; i <= 128 ; i *= 2) {
2110                 num_sent = 0;
2111                 num_ops_received = 0;
2112                 retries = 0;
2113                 failed_polls = 0;
2114                 burst_size = i;
2115                 total_cycles = 0;
2116                 while (num_sent < num_to_submit) {
2117                         start_cycles = rte_rdtsc_precise();
2118                         burst_sent = rte_cryptodev_enqueue_burst(ts_params->dev_id,
2119                                         0, &c_ops[num_sent],
2120                                         ((num_to_submit-num_sent) < burst_size) ?
2121                                         num_to_submit-num_sent : burst_size);
2122                         end_cycles = rte_rdtsc_precise();
2123                         if (burst_sent == 0)
2124                                 retries++;
2125                         num_sent += burst_sent;
2126                         total_cycles += (end_cycles - start_cycles);
2127
2128                         /* Wait until requests have been sent. */
2129
2130                         rte_delay_ms(1);
2131
2132                         start_cycles = rte_rdtsc_precise();
2133                         burst_received = rte_cryptodev_dequeue_burst(
2134                                         ts_params->dev_id, 0, proc_ops, burst_size);
2135                         end_cycles = rte_rdtsc_precise();
2136                         if (burst_received < burst_sent)
2137                                 failed_polls++;
2138                         num_ops_received += burst_received;
2139
2140                         total_cycles += end_cycles - start_cycles;
2141                 }
2142
2143                 while (num_ops_received != num_to_submit) {
2144                         if (gbl_cryptodev_perftest_devtype ==
2145                                         RTE_CRYPTODEV_AESNI_MB_PMD)
2146                                 rte_cryptodev_enqueue_burst(ts_params->dev_id, 0,
2147                                                 NULL, 0);
2148                         start_cycles = rte_rdtsc_precise();
2149                         burst_received = rte_cryptodev_dequeue_burst(
2150                                         ts_params->dev_id, 0, proc_ops, burst_size);
2151                         end_cycles = rte_rdtsc_precise();
2152                         total_cycles += end_cycles - start_cycles;
2153                         if (burst_received == 0)
2154                                 failed_polls++;
2155                         num_ops_received += burst_received;
2156                 }
2157
2158                 printf("\n%u\t%u\t%u", num_sent, num_ops_received, burst_size);
2159                 printf("\t\t%"PRIu64, retries);
2160                 printf("\t%"PRIu64, failed_polls);
2161                 printf("\t\t%"PRIu64, total_cycles/num_ops_received);
2162                 printf("\t\t%"PRIu64, (total_cycles/num_ops_received)*burst_size);
2163                 printf("\t\t%"PRIu64, total_cycles/(num_ops_received*pparams->buf_size));
2164         }
2165         printf("\n");
2166
2167         for (i = 0; i < num_to_submit ; i++) {
2168                 rte_pktmbuf_free(c_ops[i]->sym->m_src);
2169                 rte_crypto_op_free(c_ops[i]);
2170         }
2171
2172         return TEST_SUCCESS;
2173 }
2174
2175 static int
2176 test_perf_snow3G_vary_burst_size(void)
2177 {
2178         unsigned total_operations = 4096;
2179         /*no need to vary pkt size for QAT, should have no effect on IA cycles */
2180         uint16_t buf_lengths[] = {40};
2181         uint8_t i, j;
2182
2183         struct perf_test_params params_set[] = {
2184                         {
2185                                         .chain = CIPHER_ONLY,
2186                                         .cipher_algo  = RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
2187                                         .cipher_key_length = 16,
2188                                         .auth_algo  = RTE_CRYPTO_AUTH_NULL,
2189                         },
2190                         {
2191                                         .chain = HASH_ONLY,
2192                                         .cipher_algo = RTE_CRYPTO_CIPHER_NULL,
2193                                         .auth_algo  = RTE_CRYPTO_AUTH_SNOW3G_UIA2,
2194                                         .cipher_key_length = 16
2195                         },
2196         };
2197
2198         printf("\n\nStart %s.", __func__);
2199         printf("\nThis Test measures the average IA cycle cost using a "
2200                         "constant request(packet) size. ");
2201         printf("Cycle cost is only valid when indicators show device is not busy,"
2202                         " i.e. Retries and EmptyPolls = 0");
2203
2204         for (i = 0; i < RTE_DIM(params_set); i++) {
2205                 printf("\n");
2206                 params_set[i].total_operations = total_operations;
2207
2208                 for (j = 0;
2209                         j < RTE_DIM(buf_lengths);
2210                         j++) {
2211
2212                         params_set[i].buf_size = buf_lengths[j];
2213
2214                         test_perf_snow3G_optimise_cyclecount(&params_set[i]);
2215                 }
2216
2217         }
2218
2219         return 0;
2220 }
2221
2222 static uint32_t get_auth_key_max_length(enum rte_crypto_auth_algorithm algo)
2223 {
2224         switch (algo) {
2225         case RTE_CRYPTO_AUTH_SNOW3G_UIA2:
2226                 return 16;
2227         case RTE_CRYPTO_AUTH_SHA1_HMAC:
2228                 return 64;
2229         case RTE_CRYPTO_AUTH_SHA224_HMAC:
2230                 return 64;
2231         case RTE_CRYPTO_AUTH_SHA256_HMAC:
2232                 return 64;
2233         case RTE_CRYPTO_AUTH_SHA384_HMAC:
2234                 return 128;
2235         case RTE_CRYPTO_AUTH_SHA512_HMAC:
2236                 return 128;
2237         default:
2238                 return 0;
2239         }
2240 }
2241
2242 static uint32_t get_auth_digest_length(enum rte_crypto_auth_algorithm algo)
2243 {
2244         switch (algo) {
2245         case RTE_CRYPTO_AUTH_SNOW3G_UIA2:
2246                 return 4;
2247         case RTE_CRYPTO_AUTH_SHA1_HMAC:
2248                 return TRUNCATED_DIGEST_BYTE_LENGTH_SHA1;
2249         case RTE_CRYPTO_AUTH_SHA224_HMAC:
2250                 return TRUNCATED_DIGEST_BYTE_LENGTH_SHA224;
2251         case RTE_CRYPTO_AUTH_SHA256_HMAC:
2252                 return TRUNCATED_DIGEST_BYTE_LENGTH_SHA256;
2253         case RTE_CRYPTO_AUTH_SHA384_HMAC:
2254                 return TRUNCATED_DIGEST_BYTE_LENGTH_SHA384;
2255         case RTE_CRYPTO_AUTH_SHA512_HMAC:
2256                 return TRUNCATED_DIGEST_BYTE_LENGTH_SHA512;
2257         default:
2258                 return 0;
2259         }
2260 }
2261
2262 static uint8_t aes_cbc_key[] = {
2263                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2264                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2265                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2266                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2267 };
2268
2269 static uint8_t aes_cbc_iv[] = {
2270                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2271                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2272 };
2273
2274 static uint8_t hmac_sha_key[] = {
2275                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2276                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2277                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2278                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2279                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2280                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2281                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2282                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2283                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2284                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2285                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2286                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2287                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2288                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2289                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2290                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2291 };
2292
2293 static uint8_t snow3g_cipher_key[] = {
2294                 0x2B, 0xD6, 0x45, 0x9F, 0x82, 0xC5, 0xB3, 0x00,
2295                 0x95, 0x2C, 0x49, 0x10, 0x48, 0x81, 0xFF, 0x48
2296 };
2297
2298 static uint8_t snow3g_iv[] = {
2299                 0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00,
2300                 0x72, 0xA4, 0xF2, 0x0F, 0x64, 0x00, 0x00, 0x00
2301 };
2302
2303 static uint8_t snow3g_hash_key[] = {
2304                 0xC7, 0x36, 0xC6, 0xAA, 0xB2, 0x2B, 0xFF, 0xF9,
2305                 0x1E, 0x26, 0x98, 0xD2, 0xE2, 0x2A, 0xD5, 0x7E
2306 };
2307
2308 static struct rte_cryptodev_sym_session *
2309 test_perf_create_aes_sha_session(uint8_t dev_id, enum chain_mode chain,
2310                 enum rte_crypto_cipher_algorithm cipher_algo,
2311                 unsigned cipher_key_len,
2312                 enum rte_crypto_auth_algorithm auth_algo)
2313 {
2314         struct rte_crypto_sym_xform cipher_xform = { 0 };
2315         struct rte_crypto_sym_xform auth_xform = { 0 };
2316
2317
2318         /* Setup Cipher Parameters */
2319         cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
2320         cipher_xform.cipher.algo = cipher_algo;
2321         cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
2322
2323         cipher_xform.cipher.key.data = aes_cbc_key;
2324         cipher_xform.cipher.key.length = cipher_key_len;
2325
2326         /* Setup HMAC Parameters */
2327         auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
2328         auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
2329         auth_xform.auth.algo = auth_algo;
2330
2331         auth_xform.auth.key.data = hmac_sha_key;
2332         auth_xform.auth.key.length =  get_auth_key_max_length(auth_algo);
2333         auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
2334
2335         switch (chain) {
2336         case CIPHER_HASH:
2337                 cipher_xform.next = &auth_xform;
2338                 auth_xform.next = NULL;
2339                 /* Create Crypto session*/
2340                 return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
2341         case HASH_CIPHER:
2342                 auth_xform.next = &cipher_xform;
2343                 cipher_xform.next = NULL;
2344                 /* Create Crypto session*/
2345                 return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
2346         default:
2347                 return NULL;
2348         }
2349 }
2350
2351 static struct rte_cryptodev_sym_session *
2352 test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain,
2353                 enum rte_crypto_cipher_algorithm cipher_algo, unsigned cipher_key_len,
2354                 enum rte_crypto_auth_algorithm auth_algo)
2355 {
2356         struct rte_crypto_sym_xform cipher_xform = {0};
2357         struct rte_crypto_sym_xform auth_xform = {0};
2358
2359
2360         /* Setup Cipher Parameters */
2361         cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
2362         cipher_xform.cipher.algo = cipher_algo;
2363         cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
2364
2365         cipher_xform.cipher.key.data = snow3g_cipher_key;
2366         cipher_xform.cipher.key.length = cipher_key_len;
2367
2368         /* Setup HMAC Parameters */
2369         auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
2370         auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
2371         auth_xform.auth.algo = auth_algo;
2372
2373         auth_xform.auth.key.data = snow3g_hash_key;
2374         auth_xform.auth.key.length =  get_auth_key_max_length(auth_algo);
2375         auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
2376
2377         switch (chain) {
2378         case CIPHER_HASH:
2379                 cipher_xform.next = &auth_xform;
2380                 auth_xform.next = NULL;
2381                 /* Create Crypto session*/
2382                 return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
2383         case HASH_CIPHER:
2384                 auth_xform.next = &cipher_xform;
2385                 cipher_xform.next = NULL;
2386                 /* Create Crypto session*/
2387                 return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
2388         case CIPHER_ONLY:
2389                 cipher_xform.next = NULL;
2390                 /* Create Crypto session*/
2391                 return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
2392         case HASH_ONLY:
2393                 auth_xform.next = NULL;
2394                 /* Create Crypto session */
2395                 return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
2396         default:
2397                 return NULL;
2398         }
2399 }
2400
2401 #define AES_CBC_BLOCK_SIZE 16
2402 #define AES_CBC_CIPHER_IV_LENGTH 16
2403 #define SNOW3G_CIPHER_IV_LENGTH 16
2404
2405 static struct rte_mbuf *
2406 test_perf_create_pktmbuf(struct rte_mempool *mpool, unsigned buf_sz)
2407 {
2408         struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
2409
2410         if (rte_pktmbuf_append(m, buf_sz) == NULL) {
2411                 rte_pktmbuf_free(m);
2412                 return NULL;
2413         }
2414
2415         memset(rte_pktmbuf_mtod(m, uint8_t *), 0, buf_sz);
2416
2417         return m;
2418 }
2419
2420 static inline struct rte_crypto_op *
2421 test_perf_set_crypto_op(struct rte_crypto_op *op, struct rte_mbuf *m,
2422                 struct rte_cryptodev_sym_session *sess, unsigned data_len,
2423                 unsigned digest_len)
2424 {
2425         if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
2426                 rte_crypto_op_free(op);
2427                 return NULL;
2428         }
2429
2430         /* Authentication Parameters */
2431         op->sym->auth.digest.data = (uint8_t *)m->buf_addr +
2432                                         (m->data_off + data_len);
2433         op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m, data_len);
2434         op->sym->auth.digest.length = digest_len;
2435         op->sym->auth.aad.data = aes_cbc_iv;
2436         op->sym->auth.aad.length = AES_CBC_CIPHER_IV_LENGTH;
2437
2438         /* Cipher Parameters */
2439         op->sym->cipher.iv.data = aes_cbc_iv;
2440         op->sym->cipher.iv.length = AES_CBC_CIPHER_IV_LENGTH;
2441
2442         /* Data lengths/offsets Parameters */
2443         op->sym->auth.data.offset = 0;
2444         op->sym->auth.data.length = data_len;
2445
2446         op->sym->cipher.data.offset = AES_CBC_BLOCK_SIZE;
2447         op->sym->cipher.data.length = data_len - AES_CBC_BLOCK_SIZE;
2448
2449         op->sym->m_src = m;
2450
2451         return op;
2452 }
2453
2454 static inline struct rte_crypto_op *
2455 test_perf_set_crypto_op_snow3g(struct rte_crypto_op *op, struct rte_mbuf *m,
2456                 struct rte_cryptodev_sym_session *sess, unsigned data_len,
2457                 unsigned digest_len)
2458 {
2459         if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
2460                 rte_crypto_op_free(op);
2461                 return NULL;
2462         }
2463
2464         /* Authentication Parameters */
2465         op->sym->auth.digest.data = (uint8_t *)m->buf_addr +
2466                                                 (m->data_off + data_len);
2467         op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m, data_len);
2468         op->sym->auth.digest.length = digest_len;
2469         op->sym->auth.aad.data = snow3g_iv;
2470         op->sym->auth.aad.length = SNOW3G_CIPHER_IV_LENGTH;
2471
2472         /* Cipher Parameters */
2473         op->sym->cipher.iv.data = snow3g_iv;
2474         op->sym->cipher.iv.length = SNOW3G_CIPHER_IV_LENGTH;
2475
2476         /* Data lengths/offsets Parameters */
2477         op->sym->auth.data.offset = 0;
2478         op->sym->auth.data.length = data_len << 3;
2479
2480         op->sym->cipher.data.offset = 0;
2481         op->sym->cipher.data.length = data_len << 3;
2482
2483         op->sym->m_src = m;
2484
2485         return op;
2486 }
2487
2488
2489
2490 /* An mbuf set is used in each burst. An mbuf can be used by multiple bursts at
2491  * same time, i.e. as they're not dereferenced there's no need to wait until
2492  * finished with to re-use */
2493 #define NUM_MBUF_SETS 8
2494
2495 static int
2496 test_perf_aes_sha(uint8_t dev_id, uint16_t queue_id,
2497                 struct perf_test_params *pparams)
2498 {
2499         uint16_t i, k, l, m;
2500         uint16_t j = 0;
2501         uint16_t ops_unused = 0;
2502
2503         uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0;
2504         uint64_t processed = 0, failed_polls = 0, retries = 0;
2505         uint64_t tsc_start = 0, tsc_end = 0;
2506
2507         uint16_t digest_length = get_auth_digest_length(pparams->auth_algo);
2508
2509         struct rte_crypto_op *ops[pparams->burst_size];
2510         struct rte_crypto_op *proc_ops[pparams->burst_size];
2511
2512         struct rte_mbuf *mbufs[pparams->burst_size * 8];
2513
2514         struct crypto_testsuite_params *ts_params = &testsuite_params;
2515
2516         static struct rte_cryptodev_sym_session *sess;
2517
2518         if (rte_cryptodev_count() == 0) {
2519                 printf("\nNo crypto devices available. Is kernel driver loaded?\n");
2520                 return TEST_FAILED;
2521         }
2522
2523         /* Create Crypto session*/
2524         sess = test_perf_create_aes_sha_session(ts_params->dev_id,
2525                         pparams->chain, pparams->cipher_algo,
2526                         pparams->cipher_key_length, pparams->auth_algo);
2527         TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
2528
2529         /* Generate a burst of crypto operations */
2530         for (i = 0; i < (pparams->burst_size * NUM_MBUF_SETS); i++) {
2531                 mbufs[i] = test_perf_create_pktmbuf(
2532                                 ts_params->mbuf_mp,
2533                                 pparams->buf_size);
2534
2535                 if (mbufs[i] == NULL) {
2536                         printf("\nFailed to get mbuf - freeing the rest.\n");
2537                         for (k = 0; k < i; k++)
2538                                 rte_pktmbuf_free(mbufs[k]);
2539                         return -1;
2540                 }
2541
2542         }
2543
2544
2545         tsc_start = rte_rdtsc_precise();
2546
2547         while (total_enqueued < pparams->total_operations) {
2548                 uint16_t burst_size =
2549                 total_enqueued+pparams->burst_size <= pparams->total_operations ?
2550                 pparams->burst_size : pparams->total_operations-total_enqueued;
2551                 uint16_t ops_needed = burst_size-ops_unused;
2552
2553                 if (ops_needed != rte_crypto_op_bulk_alloc(ts_params->op_mpool,
2554                                 RTE_CRYPTO_OP_TYPE_SYMMETRIC, ops, ops_needed)){
2555                         printf("\nFailed to alloc enough ops, finish dequeuing "
2556                                 "and free ops below.");
2557                 } else {
2558                         for (i = 0; i < ops_needed; i++)
2559                                 ops[i] = test_perf_set_crypto_op(ops[i],
2560                                         mbufs[i + (pparams->burst_size *
2561                                                 (j % NUM_MBUF_SETS))],
2562                                         sess, pparams->buf_size, digest_length);
2563
2564                         /* enqueue burst */
2565                         burst_enqueued = rte_cryptodev_enqueue_burst(dev_id,
2566                                         queue_id, ops, burst_size);
2567
2568                         if (burst_enqueued < burst_size)
2569                                 retries++;
2570
2571                         ops_unused = burst_size-burst_enqueued;
2572                         total_enqueued += burst_enqueued;
2573                 }
2574
2575                 /* dequeue burst */
2576                 burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
2577                                 proc_ops, pparams->burst_size);
2578                 if (burst_dequeued == 0)
2579                         failed_polls++;
2580                 else {
2581                         processed += burst_dequeued;
2582
2583                         for (l = 0; l < burst_dequeued; l++)
2584                                 rte_crypto_op_free(proc_ops[l]);
2585                 }
2586                 j++;
2587         }
2588
2589         /* Dequeue any operations still in the crypto device */
2590         while (processed < pparams->total_operations) {
2591                 /* Sending 0 length burst to flush sw crypto device */
2592                 rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0);
2593
2594                 /* dequeue burst */
2595                 burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
2596                                 proc_ops, pparams->burst_size);
2597                 if (burst_dequeued == 0)
2598                         failed_polls++;
2599                 else {
2600                         processed += burst_dequeued;
2601
2602                         for (m = 0; m < burst_dequeued; m++)
2603                                 rte_crypto_op_free(proc_ops[m]);
2604                 }
2605         }
2606
2607         tsc_end = rte_rdtsc_precise();
2608
2609         double ops_s = ((double)processed / (tsc_end - tsc_start)) * rte_get_tsc_hz();
2610         double throughput = (ops_s * pparams->buf_size * 8) / 1000000000;
2611
2612         printf("\t%u\t%6.2f\t%10.2f\t%8"PRIu64"\t%8"PRIu64, pparams->buf_size, ops_s/1000000,
2613                         throughput, retries, failed_polls);
2614
2615         for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
2616                 rte_pktmbuf_free(mbufs[i]);
2617
2618         printf("\n");
2619         return TEST_SUCCESS;
2620 }
2621
2622
2623 static int
2624 test_perf_snow3g(uint8_t dev_id, uint16_t queue_id,
2625                 struct perf_test_params *pparams)
2626 {
2627         uint16_t i, k, l, m;
2628         uint16_t j = 0;
2629         uint16_t ops_unused = 0;
2630         uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0;
2631         uint64_t processed = 0, failed_polls = 0, retries = 0;
2632         uint64_t tsc_start = 0, tsc_end = 0;
2633
2634         uint16_t digest_length = get_auth_digest_length(pparams->auth_algo);
2635
2636         struct rte_crypto_op *ops[pparams->burst_size];
2637         struct rte_crypto_op *proc_ops[pparams->burst_size];
2638
2639         struct rte_mbuf *mbufs[pparams->burst_size * NUM_MBUF_SETS];
2640
2641         struct crypto_testsuite_params *ts_params = &testsuite_params;
2642
2643         static struct rte_cryptodev_sym_session *sess;
2644
2645         if (rte_cryptodev_count() == 0) {
2646                 printf("\nNo crypto devices found. Is PMD build configured?\n");
2647                 printf("\nAnd is kernel driver loaded for HW PMDs?\n");
2648                 return TEST_FAILED;
2649         }
2650
2651         /* Create Crypto session*/
2652         sess = test_perf_create_snow3g_session(ts_params->dev_id,
2653                         pparams->chain, pparams->cipher_algo,
2654                         pparams->cipher_key_length, pparams->auth_algo);
2655         TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
2656
2657         /* Generate a burst of crypto operations */
2658         for (i = 0; i < (pparams->burst_size * NUM_MBUF_SETS); i++) {
2659                 mbufs[i] = test_perf_create_pktmbuf(
2660                                 ts_params->mbuf_mp,
2661                                 pparams->buf_size);
2662
2663                 if (mbufs[i] == NULL) {
2664                         printf("\nFailed to get mbuf - freeing the rest.\n");
2665                         for (k = 0; k < i; k++)
2666                                 rte_pktmbuf_free(mbufs[k]);
2667                         return -1;
2668                 }
2669
2670         }
2671
2672         tsc_start = rte_rdtsc_precise();
2673
2674         while (total_enqueued < pparams->total_operations) {
2675                 uint16_t burst_size =
2676                                 (total_enqueued+pparams->burst_size)
2677                                                 <= pparams->total_operations ?
2678                 pparams->burst_size : pparams->total_operations-total_enqueued;
2679                 uint16_t ops_needed = burst_size-ops_unused;
2680                 /* Handle the last burst correctly */
2681                 uint16_t op_offset = pparams->burst_size - burst_size;
2682
2683                 if (ops_needed !=
2684                         rte_crypto_op_bulk_alloc(ts_params->op_mpool,
2685                                                 RTE_CRYPTO_OP_TYPE_SYMMETRIC,
2686                                                 ops+op_offset, ops_needed)) {
2687                         printf("\nFailed to alloc enough ops.");
2688                         /*Don't exit, dequeue, more ops should become available*/
2689                 } else {
2690                         for (i = 0; i < ops_needed; i++) {
2691                                 ops[i+op_offset] =
2692                                 test_perf_set_crypto_op_snow3g(ops[i+op_offset],
2693                                 mbufs[i +
2694                                   (pparams->burst_size * (j % NUM_MBUF_SETS))],
2695                                 sess,
2696                                 pparams->buf_size, digest_length);
2697                         }
2698
2699                         /* enqueue burst */
2700                         burst_enqueued =
2701                                 rte_cryptodev_enqueue_burst(dev_id, queue_id,
2702                                                 ops+op_offset, burst_size);
2703
2704                         if (burst_enqueued < burst_size)
2705                                 retries++;
2706
2707                         ops_unused = burst_size-burst_enqueued;
2708                         total_enqueued += burst_enqueued;
2709                 }
2710
2711                 /* dequeue burst */
2712                 burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
2713                                         proc_ops, pparams->burst_size);
2714                 if (burst_dequeued == 0) {
2715                         failed_polls++;
2716                 } else {
2717                         processed += burst_dequeued;
2718                         for (l = 0; l < burst_dequeued; l++)
2719                                 rte_crypto_op_free(proc_ops[l]);
2720                 }
2721                 j++;
2722         }
2723
2724         /* Dequeue any operations still in the crypto device */
2725         while (processed < pparams->total_operations) {
2726                 /* Sending 0 length burst to flush sw crypto device */
2727                 rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0);
2728
2729                 /* dequeue burst */
2730                 burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
2731                                 proc_ops, pparams->burst_size);
2732                 if (burst_dequeued == 0)
2733                         failed_polls++;
2734                 else {
2735                         processed += burst_dequeued;
2736                         for (m = 0; m < burst_dequeued; m++)
2737                                 rte_crypto_op_free(proc_ops[m]);
2738                 }
2739         }
2740
2741         tsc_end = rte_rdtsc_precise();
2742
2743         double ops_s = ((double)processed / (tsc_end - tsc_start)) * rte_get_tsc_hz();
2744         double cycles_burst = (double) (tsc_end - tsc_start) /
2745                                         (double) processed * pparams->burst_size;
2746         double cycles_buff = (double) (tsc_end - tsc_start) / (double) processed;
2747         double cycles_B = cycles_buff / pparams->buf_size;
2748         double throughput = (ops_s * pparams->buf_size * 8) / 1000000;
2749
2750         if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_QAT_SYM_PMD) {
2751                 /* Cycle count misleading on HW devices for this test, so don't print */
2752                 printf("%4u\t%6.2f\t%10.2f\t n/a \t\t n/a "
2753                         "\t\t n/a \t\t%8"PRIu64"\t%8"PRIu64,
2754                         pparams->buf_size, ops_s/1000000,
2755                         throughput, retries, failed_polls);
2756         } else {
2757                 printf("%4u\t%6.2f\t%10.2f\t%10.2f\t%8.2f"
2758                         "\t%8.2f\t%8"PRIu64"\t%8"PRIu64,
2759                         pparams->buf_size, ops_s/1000000, throughput, cycles_burst,
2760                         cycles_buff, cycles_B, retries, failed_polls);
2761         }
2762
2763         for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
2764                 rte_pktmbuf_free(mbufs[i]);
2765
2766         printf("\n");
2767         return TEST_SUCCESS;
2768 }
2769
2770 /*
2771
2772     perf_test_aes_sha("avx2", HASH_CIPHER, 16, CBC, SHA1);
2773     perf_test_aes_sha("avx2", HASH_CIPHER, 16, CBC, SHA_256);
2774     perf_test_aes_sha("avx2", HASH_CIPHER, 16, CBC, SHA_512);
2775
2776     perf_test_aes_sha("avx2", CIPHER_HASH, 32, CBC, SHA1);
2777     perf_test_aes_sha("avx2", CIPHER_HASH, 32, CBC, SHA_256);
2778     perf_test_aes_sha("avx2", CIPHER_HASH, 32, CBC, SHA_512);
2779
2780     perf_test_aes_sha("avx2", HASH_CIPHER, 32, CBC, SHA1);
2781     perf_test_aes_sha("avx2", HASH_CIPHER, 32, CBC, SHA_256);
2782     perf_test_aes_sha("avx2", HASH_CIPHER, 32, CBC, SHA_512);
2783  */
2784 static int
2785 test_perf_aes_cbc_encrypt_digest_vary_pkt_size(void)
2786 {
2787         unsigned total_operations = 1000000;
2788         unsigned burst_size = 32;
2789         unsigned buf_lengths[] = { 64, 128, 256, 512, 768, 1024, 1280, 1536, 1792, 2048 };
2790         uint8_t i, j;
2791
2792         struct perf_test_params params_set[] = {
2793                 {
2794                         .chain = CIPHER_HASH,
2795
2796                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
2797                         .cipher_key_length = 16,
2798                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
2799                 },
2800                 {
2801                         .chain = CIPHER_HASH,
2802
2803                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
2804                         .cipher_key_length = 16,
2805                         .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
2806                 },
2807                 {
2808                         .chain = CIPHER_HASH,
2809
2810                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
2811                         .cipher_key_length = 16,
2812                         .auth_algo = RTE_CRYPTO_AUTH_SHA512_HMAC
2813                 },
2814                 {
2815                         .chain = CIPHER_HASH,
2816
2817                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
2818                         .cipher_key_length = 32,
2819                         .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
2820                 },
2821                 {
2822                         .chain = CIPHER_HASH,
2823
2824                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
2825                         .cipher_key_length = 32,
2826                         .auth_algo = RTE_CRYPTO_AUTH_SHA256_HMAC
2827                 },
2828                 {
2829                         .chain = CIPHER_HASH,
2830
2831                         .cipher_algo  = RTE_CRYPTO_CIPHER_AES_CBC,
2832                         .cipher_key_length = 32,
2833                         .auth_algo = RTE_CRYPTO_AUTH_SHA512_HMAC
2834                 },
2835         };
2836
2837         for (i = 0; i < RTE_DIM(params_set); i++) {
2838
2839                 params_set[i].total_operations = total_operations;
2840                 params_set[i].burst_size = burst_size;
2841                 printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u."
2842                                 " burst_size: %d ops\n",
2843                                 chain_mode_name(params_set[i].chain),
2844                                 cipher_algo_name(params_set[i].cipher_algo),
2845                                 auth_algo_name(params_set[i].auth_algo),
2846                                 params_set[i].cipher_key_length,
2847                                 burst_size);
2848                 printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t"
2849                         "Retries\tEmptyPolls\n");
2850                 for (j = 0; j < RTE_DIM(buf_lengths); j++) {
2851                         params_set[i].buf_size = buf_lengths[j];
2852                         test_perf_aes_sha(testsuite_params.dev_id, 0,
2853                                         &params_set[i]);
2854                 }
2855         }
2856         return 0;
2857 }
2858
2859 static int
2860 test_perf_snow3G_vary_pkt_size(void)
2861 {
2862         unsigned total_operations = 1000000;
2863         uint8_t i, j;
2864         unsigned k;
2865         uint16_t burst_sizes[] = {64};
2866         uint16_t buf_lengths[] = {40, 64, 80, 120, 240, 256, 400, 512, 600, 1024, 2048};
2867
2868         struct perf_test_params params_set[] = {
2869                 {
2870                         .chain = CIPHER_ONLY,
2871                         .cipher_algo  = RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
2872                         .cipher_key_length = 16,
2873                         .auth_algo  = RTE_CRYPTO_AUTH_NULL,
2874                 },
2875                 {
2876                         .chain = HASH_ONLY,
2877                         .cipher_algo = RTE_CRYPTO_CIPHER_NULL,
2878                         .auth_algo  = RTE_CRYPTO_AUTH_SNOW3G_UIA2,
2879                         .cipher_key_length = 16
2880                 },
2881         };
2882
2883         printf("\n\nStart %s.", __func__);
2884         printf("\nTest to measure max throughput at various pkt sizes.");
2885         printf("\nOn HW devices t'put maximised when high Retries and EmptyPolls"
2886                         " so cycle cost not relevant (n/a displayed).");
2887
2888         for (i = 0; i < RTE_DIM(params_set); i++) {
2889                 printf("\n\n");
2890                 params_set[i].total_operations = total_operations;
2891                 for (k = 0; k < RTE_DIM(burst_sizes); k++) {
2892                         printf("\nOn %s dev%u qp%u, %s, "
2893                                 "cipher algo:%s, auth algo:%s, burst_size: %d ops",
2894                                 pmd_name(gbl_cryptodev_perftest_devtype),
2895                                 testsuite_params.dev_id, 0,
2896                                 chain_mode_name(params_set[i].chain),
2897                                 cipher_algo_name(params_set[i].cipher_algo),
2898                                 auth_algo_name(params_set[i].auth_algo),
2899                                 burst_sizes[k]);
2900
2901                         params_set[i].burst_size = burst_sizes[k];
2902                         printf("\nPktSzB\tOp/s(M)\tThruput(Mbps)\tCycles/Burst\t"
2903                                 "Cycles/buf\tCycles/B\tRetries\t\tEmptyPolls\n");
2904                         for (j = 0; j < RTE_DIM(buf_lengths); j++) {
2905
2906                                 params_set[i].buf_size = buf_lengths[j];
2907
2908                                 test_perf_snow3g(testsuite_params.dev_id, 0, &params_set[i]);
2909                         }
2910                 }
2911         }
2912
2913         return 0;
2914 }
2915
2916 static int
2917 test_perf_aes_cbc_vary_burst_size(void)
2918 {
2919         return test_perf_crypto_qp_vary_burst_size(testsuite_params.dev_id);
2920 }
2921
2922
2923 static struct rte_cryptodev_sym_session *
2924 test_perf_create_session(uint8_t dev_id, struct perf_test_params *pparams)
2925 {
2926         static struct rte_cryptodev_sym_session *sess;
2927         struct rte_crypto_sym_xform cipher_xform = { 0 };
2928         struct rte_crypto_sym_xform auth_xform = { 0 };
2929
2930         uint8_t cipher_key[pparams->session_attrs->key_cipher_len];
2931         uint8_t auth_key[pparams->session_attrs->key_auth_len];
2932
2933         memcpy(cipher_key, pparams->session_attrs->key_cipher_data,
2934                  pparams->session_attrs->key_cipher_len);
2935         memcpy(auth_key, pparams->session_attrs->key_auth_data,
2936                  pparams->session_attrs->key_auth_len);
2937
2938         cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
2939         cipher_xform.next = NULL;
2940
2941         cipher_xform.cipher.algo = pparams->session_attrs->cipher_algorithm;
2942         cipher_xform.cipher.op = pparams->session_attrs->cipher;
2943         cipher_xform.cipher.key.data = cipher_key;
2944         cipher_xform.cipher.key.length = pparams->session_attrs->key_cipher_len;
2945
2946         auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
2947         auth_xform.next = NULL;
2948
2949         auth_xform.auth.op = pparams->session_attrs->auth;
2950         auth_xform.auth.algo = pparams->session_attrs->auth_algorithm;
2951
2952         auth_xform.auth.digest_length = pparams->session_attrs->digest_len;
2953         auth_xform.auth.key.length = pparams->session_attrs->key_auth_len;
2954
2955
2956         cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
2957         if (cipher_xform.cipher.op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) {
2958                 cipher_xform.next = &auth_xform;
2959                 sess = rte_cryptodev_sym_session_create(dev_id,
2960                                 &cipher_xform);
2961         } else {
2962                 auth_xform.next = &cipher_xform;
2963                 sess = rte_cryptodev_sym_session_create(dev_id,
2964                                 &auth_xform);
2965         }
2966
2967         return sess;
2968 }
2969
2970 static inline struct rte_crypto_op *
2971 perf_gcm_set_crypto_op(struct rte_crypto_op *op, struct rte_mbuf *m,
2972                 struct rte_cryptodev_sym_session *sess,
2973                 struct crypto_params *m_hlp,
2974                 struct perf_test_params *params)
2975 {
2976         if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
2977                 rte_crypto_op_free(op);
2978                 return NULL;
2979         }
2980
2981         uint16_t iv_pad_len = ALIGN_POW2_ROUNDUP(params->symmetric_op->iv_len,
2982                                                  16);
2983
2984         op->sym->auth.digest.data = m_hlp->digest;
2985         op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
2986                                           m,
2987                                           params->symmetric_op->aad_len +
2988                                           iv_pad_len +
2989                                           params->symmetric_op->p_len);
2990
2991         op->sym->auth.digest.length = params->symmetric_op->t_len;
2992
2993         op->sym->auth.aad.data = m_hlp->aad;
2994         op->sym->auth.aad.length = params->symmetric_op->aad_len;
2995         op->sym->auth.aad.phys_addr = rte_pktmbuf_mtophys_offset(
2996                                           m,
2997                                           iv_pad_len);
2998
2999         rte_memcpy(op->sym->auth.aad.data, params->symmetric_op->aad_data,
3000                        params->symmetric_op->aad_len);
3001
3002         op->sym->cipher.iv.data = m_hlp->iv;
3003         rte_memcpy(op->sym->cipher.iv.data, params->symmetric_op->iv_data,
3004                        params->symmetric_op->iv_len);
3005         if (params->symmetric_op->iv_len == 12)
3006                 op->sym->cipher.iv.data[15] = 1;
3007
3008         op->sym->cipher.iv.length = params->symmetric_op->iv_len;
3009
3010         op->sym->auth.data.offset =
3011                         iv_pad_len + params->symmetric_op->aad_len;
3012         op->sym->auth.data.length = params->symmetric_op->p_len;
3013
3014         op->sym->cipher.data.offset =
3015                         iv_pad_len + params->symmetric_op->aad_len;
3016         op->sym->cipher.data.length = params->symmetric_op->p_len;
3017
3018         op->sym->m_src = m;
3019
3020         return op;
3021 }
3022
3023 static struct rte_mbuf *
3024 test_perf_create_pktmbuf_fill(struct rte_mempool *mpool,
3025                 struct perf_test_params *params,
3026                 unsigned buf_sz, struct crypto_params *m_hlp)
3027 {
3028         struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
3029         uint16_t iv_pad_len =
3030                         ALIGN_POW2_ROUNDUP(params->symmetric_op->iv_len, 16);
3031         uint16_t aad_len = params->symmetric_op->aad_len;
3032         uint16_t digest_size = params->symmetric_op->t_len;
3033         char *p;
3034
3035         p = rte_pktmbuf_append(m, aad_len);
3036         if (p == NULL) {
3037                 rte_pktmbuf_free(m);
3038                 return NULL;
3039         }
3040         m_hlp->aad = (uint8_t *)p;
3041
3042         p = rte_pktmbuf_append(m, iv_pad_len);
3043         if (p == NULL) {
3044                 rte_pktmbuf_free(m);
3045                 return NULL;
3046         }
3047         m_hlp->iv = (uint8_t *)p;
3048
3049         p = rte_pktmbuf_append(m, buf_sz);
3050         if (p == NULL) {
3051                 rte_pktmbuf_free(m);
3052                 return NULL;
3053         }
3054         rte_memcpy(p, params->symmetric_op->p_data, buf_sz);
3055
3056         p = rte_pktmbuf_append(m, digest_size);
3057         if (p == NULL) {
3058                 rte_pktmbuf_free(m);
3059                 return NULL;
3060         }
3061         m_hlp->digest = (uint8_t *)p;
3062
3063         return m;
3064 }
3065
3066 static int
3067 perf_AES_GCM(uint8_t dev_id, uint16_t queue_id,
3068              struct perf_test_params *pparams, uint32_t test_ops)
3069 {
3070         int j = 0;
3071         struct crypto_testsuite_params *ts_params = &testsuite_params;
3072         struct rte_cryptodev_sym_session *sess;
3073         struct rte_crypto_op *ops[pparams->burst_size];
3074         struct rte_crypto_op *proc_ops[pparams->burst_size];
3075         uint32_t total_operations = pparams->total_operations;
3076
3077         uint64_t burst_enqueued = 0, total_enqueued = 0, burst_dequeued = 0;
3078         uint64_t processed = 0, failed_polls = 0, retries = 0;
3079         uint64_t tsc_start = 0, tsc_end = 0;
3080
3081         uint16_t i = 0, l = 0, m = 0;
3082         uint16_t burst = pparams->burst_size * NUM_MBUF_SETS;
3083         uint16_t ops_unused = 0;
3084
3085         struct rte_mbuf *mbufs[burst];
3086         struct crypto_params m_hlp[burst];
3087
3088         if (rte_cryptodev_count() == 0) {
3089                 printf("\nNo crypto devices available. "
3090                                 "Is kernel driver loaded?\n");
3091                 return TEST_FAILED;
3092         }
3093
3094         sess = test_perf_create_session(dev_id, pparams);
3095         TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
3096
3097         for (i = 0; i < burst; i++) {
3098                 mbufs[i] = test_perf_create_pktmbuf_fill(
3099                                 ts_params->mbuf_mp,
3100                                 pparams, pparams->symmetric_op->p_len,
3101                                 &m_hlp[i]);
3102         }
3103
3104         if (test_ops)
3105                 total_operations = test_ops;
3106
3107         tsc_start = rte_rdtsc_precise();
3108         while (total_enqueued < total_operations) {
3109                 uint16_t burst_size =
3110                 total_enqueued+pparams->burst_size <= total_operations ?
3111                 pparams->burst_size : total_operations-total_enqueued;
3112                 uint16_t ops_needed = burst_size-ops_unused;
3113
3114                 if (ops_needed != rte_crypto_op_bulk_alloc(ts_params->op_mpool,
3115                                 RTE_CRYPTO_OP_TYPE_SYMMETRIC, ops, ops_needed)){
3116                         printf("\nFailed to alloc enough ops, "
3117                                         "finish dequeuing");
3118                 } else {
3119                         for (i = 0; i < ops_needed; i++)
3120                                 ops[i] = perf_gcm_set_crypto_op(ops[i],
3121                                         mbufs[i + (pparams->burst_size *
3122                                                 (j % NUM_MBUF_SETS))],
3123                                         sess, &m_hlp[i + (pparams->burst_size *
3124                                                 (j % NUM_MBUF_SETS))], pparams);
3125
3126                         /* enqueue burst */
3127                         burst_enqueued = rte_cryptodev_enqueue_burst(dev_id,
3128                                         queue_id, ops, burst_size);
3129
3130                         if (burst_enqueued < burst_size)
3131                                 retries++;
3132
3133                         ops_unused = burst_size-burst_enqueued;
3134                         total_enqueued += burst_enqueued;
3135                 }
3136
3137                 /* dequeue burst */
3138                 burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
3139                                 proc_ops, pparams->burst_size);
3140                 if (burst_dequeued == 0)
3141                         failed_polls++;
3142                 else {
3143                         processed += burst_dequeued;
3144
3145                         for (l = 0; l < burst_dequeued; l++)
3146                                 rte_crypto_op_free(proc_ops[l]);
3147                 }
3148
3149                 j++;
3150         }
3151
3152         /* Dequeue any operations still in the crypto device */
3153         while (processed < total_operations) {
3154                 /* Sending 0 length burst to flush sw crypto device */
3155                 rte_cryptodev_enqueue_burst(dev_id, queue_id, NULL, 0);
3156
3157                 /* dequeue burst */
3158                 burst_dequeued = rte_cryptodev_dequeue_burst(dev_id, queue_id,
3159                                 proc_ops, pparams->burst_size);
3160                 if (burst_dequeued == 0)
3161                         failed_polls++;
3162                 else {
3163                         processed += burst_dequeued;
3164
3165                 for (m = 0; m < burst_dequeued; m++) {
3166                         if (test_ops) {
3167                                 uint16_t iv_pad_len = ALIGN_POW2_ROUNDUP
3168                                         (pparams->symmetric_op->iv_len, 16);
3169                                 uint8_t *pkt = rte_pktmbuf_mtod(
3170                                         proc_ops[m]->sym->m_src,
3171                                         uint8_t *);
3172
3173                                 TEST_ASSERT_BUFFERS_ARE_EQUAL(
3174                                         pparams->symmetric_op->c_data,
3175                                         pkt + iv_pad_len +
3176                                         pparams->symmetric_op->aad_len,
3177                                         pparams->symmetric_op->c_len,
3178                                         "GCM Ciphertext data not as expected");
3179
3180                                 TEST_ASSERT_BUFFERS_ARE_EQUAL(
3181                                         pparams->symmetric_op->t_data,
3182                                         pkt + iv_pad_len +
3183                                         pparams->symmetric_op->aad_len +
3184                                         pparams->symmetric_op->c_len,
3185                                         pparams->symmetric_op->t_len,
3186                                         "GCM MAC data not as expected");
3187
3188                                 }
3189                                 rte_crypto_op_free(proc_ops[m]);
3190                         }
3191                 }
3192         }
3193
3194         tsc_end = rte_rdtsc_precise();
3195
3196         double ops_s = ((double)processed / (tsc_end - tsc_start))
3197                         * rte_get_tsc_hz();
3198         double throughput = (ops_s * pparams->symmetric_op->p_len * 8)
3199                         / 1000000000;
3200
3201         if (!test_ops) {
3202                 printf("\n%u\t\t%6.2f\t%16.2f\t%8"PRIu64"\t%10"PRIu64,
3203                 pparams->symmetric_op->p_len,
3204                 ops_s/1000000, throughput, retries, failed_polls);
3205         }
3206
3207         for (i = 0; i < burst; i++)
3208                 rte_pktmbuf_free(mbufs[i]);
3209
3210         return 0;
3211 }
3212
3213 static int
3214 test_perf_AES_GCM(void)
3215 {
3216         uint16_t i, j;
3217
3218         uint16_t buf_lengths[] = { 64, 128, 256, 512, 1024, 1536, 2048 };
3219
3220         static const struct cryptodev_perf_test_data *gcm_tests[] = {
3221                         &AES_GCM_128_12IV_0AAD
3222         };
3223
3224         int TEST_CASES_GCM = RTE_DIM(gcm_tests);
3225
3226         const unsigned burst_size = 32;
3227
3228         struct symmetric_op ops_set[TEST_CASES_GCM];
3229         struct perf_test_params params_set[TEST_CASES_GCM];
3230         struct symmetric_session_attrs session_attrs[TEST_CASES_GCM];
3231         static const struct cryptodev_perf_test_data *gcm_test;
3232
3233         for (i = 0; i < TEST_CASES_GCM; ++i) {
3234
3235                 gcm_test = gcm_tests[i];
3236
3237                 session_attrs[i].cipher =
3238                                 RTE_CRYPTO_CIPHER_OP_ENCRYPT;
3239                 session_attrs[i].cipher_algorithm =
3240                                 RTE_CRYPTO_CIPHER_AES_GCM;
3241                 session_attrs[i].key_cipher_data =
3242                                 gcm_test->key.data;
3243                 session_attrs[i].key_cipher_len =
3244                                 gcm_test->key.len;
3245                 session_attrs[i].auth_algorithm =
3246                                 RTE_CRYPTO_AUTH_AES_GCM;
3247                 session_attrs[i].auth =
3248                         RTE_CRYPTO_AUTH_OP_GENERATE;
3249                 session_attrs[i].key_auth_data = NULL;
3250                 session_attrs[i].key_auth_len = 0;
3251                 session_attrs[i].digest_len =
3252                                 gcm_test->auth_tag.len;
3253
3254                 ops_set[i].aad_data = gcm_test->aad.data;
3255                 ops_set[i].aad_len = gcm_test->aad.len;
3256                 ops_set[i].iv_data = gcm_test->iv.data;
3257                 ops_set[i].iv_len = gcm_test->iv.len;
3258                 ops_set[i].p_data = gcm_test->plaintext.data;
3259                 ops_set[i].p_len = buf_lengths[i];
3260                 ops_set[i].c_data = gcm_test->ciphertext.data;
3261                 ops_set[i].c_len = buf_lengths[i];
3262                 ops_set[i].t_data = gcm_test->auth_tags[i].data;
3263                 ops_set[i].t_len = gcm_test->auth_tags[i].len;
3264
3265                 params_set[i].chain = CIPHER_HASH;
3266                 params_set[i].session_attrs = &session_attrs[i];
3267                 params_set[i].symmetric_op = &ops_set[i];
3268                 params_set[i].total_operations = 1000000;
3269                 params_set[i].burst_size = burst_size;
3270
3271         }
3272
3273         for (i = 0; i < RTE_DIM(gcm_tests); i++) {
3274
3275                 printf("\nCipher algo: %s Cipher hash: %s cipher key size: %ub"
3276                                 " burst size: %u", "AES_GCM", "AES_GCM",
3277                                 gcm_test->key.len << 3, burst_size
3278                                 );
3279                 printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t"
3280                         " Retries\tEmptyPolls");
3281
3282                 for (j = 0; j < RTE_DIM(buf_lengths); ++j) {
3283
3284                         params_set[i].symmetric_op->c_len = buf_lengths[j];
3285                         params_set[i].symmetric_op->p_len = buf_lengths[j];
3286
3287                         ops_set[i].t_data = gcm_tests[i]->auth_tags[j].data;
3288                         ops_set[i].t_len = gcm_tests[i]->auth_tags[j].len;
3289
3290                         /* Run is twice, one for encryption/hash checks,
3291                          * one for perf
3292                          */
3293                         if (perf_AES_GCM(testsuite_params.dev_id, 0,
3294                                         &params_set[i], 1))
3295                                 return TEST_FAILED;
3296
3297                         if (perf_AES_GCM(testsuite_params.dev_id, 0,
3298                                         &params_set[i], 0))
3299                                 return TEST_FAILED;
3300                 }
3301
3302         }
3303         printf("\n");
3304         return 0;
3305 }
3306
3307 static struct unit_test_suite cryptodev_testsuite  = {
3308         .suite_name = "Crypto Device Unit Test Suite",
3309         .setup = testsuite_setup,
3310         .teardown = testsuite_teardown,
3311         .unit_test_cases = {
3312                 TEST_CASE_ST(ut_setup, ut_teardown,
3313                                 test_perf_aes_cbc_encrypt_digest_vary_pkt_size),
3314                 TEST_CASE_ST(ut_setup, ut_teardown,
3315                                 test_perf_AES_GCM),
3316                 TEST_CASE_ST(ut_setup, ut_teardown,
3317                                 test_perf_aes_cbc_vary_burst_size),
3318                 TEST_CASES_END() /**< NULL terminate unit test array */
3319         }
3320 };
3321
3322 static struct unit_test_suite cryptodev_gcm_testsuite  = {
3323         .suite_name = "Crypto Device AESNI GCM Unit Test Suite",
3324         .setup = testsuite_setup,
3325         .teardown = testsuite_teardown,
3326         .unit_test_cases = {
3327                 TEST_CASE_ST(ut_setup, ut_teardown,
3328                                 test_perf_AES_GCM),
3329                 TEST_CASES_END() /**< NULL terminate unit test array */
3330         }
3331 };
3332
3333 static struct unit_test_suite cryptodev_aes_testsuite  = {
3334         .suite_name = "Crypto Device AESNI MB Unit Test Suite",
3335         .setup = testsuite_setup,
3336         .teardown = testsuite_teardown,
3337         .unit_test_cases = {
3338                 TEST_CASE_ST(ut_setup, ut_teardown,
3339                                 test_perf_aes_cbc_encrypt_digest_vary_pkt_size),
3340                 TEST_CASES_END() /**< NULL terminate unit test array */
3341         }
3342 };
3343
3344 static struct unit_test_suite cryptodev_snow3g_testsuite  = {
3345         .suite_name = "Crypto Device SNOW3G Unit Test Suite",
3346         .setup = testsuite_setup,
3347         .teardown = testsuite_teardown,
3348         .unit_test_cases = {
3349                 TEST_CASE_ST(ut_setup, ut_teardown,
3350                                 test_perf_snow3G_vary_pkt_size),
3351                 TEST_CASE_ST(ut_setup, ut_teardown,
3352                                 test_perf_snow3G_vary_burst_size),
3353                 TEST_CASES_END() /**< NULL terminate unit test array */
3354         }
3355 };
3356
3357 static int
3358 perftest_aesni_gcm_cryptodev(void)
3359 {
3360         gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_AESNI_GCM_PMD;
3361
3362         return unit_test_suite_runner(&cryptodev_gcm_testsuite);
3363 }
3364
3365 static int
3366 perftest_aesni_mb_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
3367 {
3368         gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_AESNI_MB_PMD;
3369
3370         return unit_test_suite_runner(&cryptodev_aes_testsuite);
3371 }
3372
3373 static int
3374 perftest_qat_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
3375 {
3376         gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_QAT_SYM_PMD;
3377
3378         return unit_test_suite_runner(&cryptodev_testsuite);
3379 }
3380
3381 static int
3382 perftest_sw_snow3g_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
3383 {
3384         gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_SNOW3G_PMD;
3385
3386         return unit_test_suite_runner(&cryptodev_snow3g_testsuite);
3387 }
3388
3389 static int
3390 perftest_qat_snow3g_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
3391 {
3392         gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_QAT_SYM_PMD;
3393
3394         return unit_test_suite_runner(&cryptodev_snow3g_testsuite);
3395 }
3396
3397 REGISTER_TEST_COMMAND(cryptodev_aesni_mb_perftest, perftest_aesni_mb_cryptodev);
3398 REGISTER_TEST_COMMAND(cryptodev_qat_perftest, perftest_qat_cryptodev);
3399 REGISTER_TEST_COMMAND(cryptodev_sw_snow3g_perftest, perftest_sw_snow3g_cryptodev);
3400 REGISTER_TEST_COMMAND(cryptodev_qat_snow3g_perftest, perftest_qat_snow3g_cryptodev);
3401 REGISTER_TEST_COMMAND(cryptodev_aesni_gcm_perftest, perftest_aesni_gcm_cryptodev);