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