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