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