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