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