197f17497SC.J. Collier/*-
297f17497SC.J. Collier *   BSD LICENSE
397f17497SC.J. Collier *
497f17497SC.J. Collier *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.
597f17497SC.J. Collier *
697f17497SC.J. Collier *   Redistribution and use in source and binary forms, with or without
797f17497SC.J. Collier *   modification, are permitted provided that the following conditions
897f17497SC.J. Collier *   are met:
997f17497SC.J. Collier *
1097f17497SC.J. Collier *	 * Redistributions of source code must retain the above copyright
1197f17497SC.J. Collier *	   notice, this list of conditions and the following disclaimer.
1297f17497SC.J. Collier *	 * Redistributions in binary form must reproduce the above copyright
1397f17497SC.J. Collier *	   notice, this list of conditions and the following disclaimer in
1497f17497SC.J. Collier *	   the documentation and/or other materials provided with the
1597f17497SC.J. Collier *	   distribution.
1697f17497SC.J. Collier *	 * Neither the name of Intel Corporation nor the names of its
1797f17497SC.J. Collier *	   contributors may be used to endorse or promote products derived
1897f17497SC.J. Collier *	   from this software without specific prior written permission.
1997f17497SC.J. Collier *
3197f17497SC.J. Collier */
3297f17497SC.J. Collier
3339157ec0SLuca Boccassi#include <time.h>
3439157ec0SLuca Boccassi
3597f17497SC.J. Collier#include <rte_common.h>
3697f17497SC.J. Collier#include <rte_hexdump.h>
3797f17497SC.J. Collier#include <rte_mbuf.h>
3897f17497SC.J. Collier#include <rte_malloc.h>
3997f17497SC.J. Collier#include <rte_memcpy.h>
4097f17497SC.J. Collier
4197f17497SC.J. Collier#include <rte_crypto.h>
4297f17497SC.J. Collier#include <rte_cryptodev.h>
4397f17497SC.J. Collier#include <rte_cryptodev_pmd.h>
4497f17497SC.J. Collier
4597f17497SC.J. Collier#include "test.h"
4697f17497SC.J. Collier#include "test_cryptodev.h"
478b25d1adSChristian Ehrhardt
486b3e017eSChristian Ehrhardt#include "test_cryptodev_blockcipher.h"
496b3e017eSChristian Ehrhardt#include "test_cryptodev_aes_test_vectors.h"
506b3e017eSChristian Ehrhardt#include "test_cryptodev_des_test_vectors.h"
516b3e017eSChristian Ehrhardt#include "test_cryptodev_hash_test_vectors.h"
528b25d1adSChristian Ehrhardt#include "test_cryptodev_kasumi_test_vectors.h"
538b25d1adSChristian Ehrhardt#include "test_cryptodev_kasumi_hash_test_vectors.h"
5497f17497SC.J. Collier#include "test_cryptodev_snow3g_test_vectors.h"
5597f17497SC.J. Collier#include "test_cryptodev_snow3g_hash_test_vectors.h"
566b3e017eSChristian Ehrhardt#include "test_cryptodev_zuc_test_vectors.h"
576b3e017eSChristian Ehrhardt#include "test_cryptodev_zuc_hash_test_vectors.h"
5897f17497SC.J. Collier#include "test_cryptodev_gcm_test_vectors.h"
596b3e017eSChristian Ehrhardt#include "test_cryptodev_hmac_test_vectors.h"
6097f17497SC.J. Collier
6197f17497SC.J. Collierstatic enum rte_cryptodev_type gbl_cryptodev_type;
6297f17497SC.J. Collier
6397f17497SC.J. Collierstruct crypto_testsuite_params {
6497f17497SC.J. Collier	struct rte_mempool *mbuf_pool;
656b3e017eSChristian Ehrhardt	struct rte_mempool *large_mbuf_pool;
6697f17497SC.J. Collier	struct rte_mempool *op_mpool;
6797f17497SC.J. Collier	struct rte_cryptodev_config conf;
6897f17497SC.J. Collier	struct rte_cryptodev_qp_conf qp_conf;
6997f17497SC.J. Collier
7097f17497SC.J. Collier	uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
7197f17497SC.J. Collier	uint8_t valid_dev_count;
7297f17497SC.J. Collier};
7397f17497SC.J. Collier
7497f17497SC.J. Collierstruct crypto_unittest_params {
7597f17497SC.J. Collier	struct rte_crypto_sym_xform cipher_xform;
7697f17497SC.J. Collier	struct rte_crypto_sym_xform auth_xform;
7797f17497SC.J. Collier
7897f17497SC.J. Collier	struct rte_cryptodev_sym_session *sess;
7997f17497SC.J. Collier
8097f17497SC.J. Collier	struct rte_crypto_op *op;
8197f17497SC.J. Collier
8297f17497SC.J. Collier	struct rte_mbuf *obuf, *ibuf;
8397f17497SC.J. Collier
8497f17497SC.J. Collier	uint8_t *digest;
8597f17497SC.J. Collier};
8697f17497SC.J. Collier
8797f17497SC.J. Collier#define ALIGN_POW2_ROUNDUP(num, align) \
8897f17497SC.J. Collier	(((num) + (align) - 1) & ~((align) - 1))
8997f17497SC.J. Collier
9097f17497SC.J. Collier/*
9197f17497SC.J. Collier * Forward declarations.
9297f17497SC.J. Collier */
9397f17497SC.J. Collierstatic int
9497f17497SC.J. Colliertest_AES_CBC_HMAC_SHA512_decrypt_create_session_params(
956b3e017eSChristian Ehrhardt		struct crypto_unittest_params *ut_params, uint8_t *cipher_key,
966b3e017eSChristian Ehrhardt		uint8_t *hmac_key);
9797f17497SC.J. Collier
9897f17497SC.J. Collierstatic int
9997f17497SC.J. Colliertest_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session *sess,
10097f17497SC.J. Collier		struct crypto_unittest_params *ut_params,
1016b3e017eSChristian Ehrhardt		struct crypto_testsuite_params *ts_param,
1026b3e017eSChristian Ehrhardt		const uint8_t *cipher,
1036b3e017eSChristian Ehrhardt		const uint8_t *digest,
1046b3e017eSChristian Ehrhardt		const uint8_t *iv);
10597f17497SC.J. Collier
10697f17497SC.J. Collierstatic struct rte_mbuf *
10797f17497SC.J. Colliersetup_test_string(struct rte_mempool *mpool,
10897f17497SC.J. Collier		const char *string, size_t len, uint8_t blocksize)
10997f17497SC.J. Collier{
11097f17497SC.J. Collier	struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
11197f17497SC.J. Collier	size_t t_len = len - (blocksize ? (len % blocksize) : 0);
11297f17497SC.J. Collier
11397f17497SC.J. Collier	memset(m->buf_addr, 0, m->buf_len);
11497f17497SC.J. Collier	if (m) {
11597f17497SC.J. Collier		char *dst = rte_pktmbuf_append(m, t_len);
11697f17497SC.J. Collier
11797f17497SC.J. Collier		if (!dst) {
11897f17497SC.J. Collier			rte_pktmbuf_free(m);
11997f17497SC.J. Collier			return NULL;
12097f17497SC.J. Collier		}
12197f17497SC.J. Collier		if (string != NULL)
12297f17497SC.J. Collier			rte_memcpy(dst, string, t_len);
12397f17497SC.J. Collier		else
12497f17497SC.J. Collier			memset(dst, 0, t_len);
12597f17497SC.J. Collier	}
12697f17497SC.J. Collier
12797f17497SC.J. Collier	return m;
12897f17497SC.J. Collier}
12997f17497SC.J. Collier
1308b25d1adSChristian Ehrhardt/* Get number of bytes in X bits (rounding up) */
1318b25d1adSChristian Ehrhardtstatic uint32_t
1328b25d1adSChristian Ehrhardtceil_byte_length(uint32_t num_bits)
13397f17497SC.J. Collier{
1348b25d1adSChristian Ehrhardt	if (num_bits % 8)
1358b25d1adSChristian Ehrhardt		return ((num_bits >> 3) + 1);
1368b25d1adSChristian Ehrhardt	else
1378b25d1adSChristian Ehrhardt		return (num_bits >> 3);
13897f17497SC.J. Collier}
13997f17497SC.J. Collier
14097f17497SC.J. Collierstatic struct rte_crypto_op *
14197f17497SC.J. Collierprocess_crypto_request(uint8_t dev_id, struct rte_crypto_op *op)
14297f17497SC.J. Collier{
14397f17497SC.J. Collier	if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) {
14497f17497SC.J. Collier		printf("Error sending packet for encryption");
14597f17497SC.J. Collier		return NULL;
14697f17497SC.J. Collier	}
14797f17497SC.J. Collier
14897f17497SC.J. Collier	op = NULL;
14997f17497SC.J. Collier
15097f17497SC.J. Collier	while (rte_cryptodev_dequeue_burst(dev_id, 0, &op, 1) == 0)
15197f17497SC.J. Collier		rte_pause();
15297f17497SC.J. Collier
15397f17497SC.J. Collier	return op;
15497f17497SC.J. Collier}
15597f17497SC.J. Collier
15697f17497SC.J. Collierstatic struct crypto_testsuite_params testsuite_params = { NULL };
15797f17497SC.J. Collierstatic struct crypto_unittest_params unittest_params;
15897f17497SC.J. Collier
15997f17497SC.J. Collierstatic int
16097f17497SC.J. Colliertestsuite_setup(void)
16197f17497SC.J. Collier{
16297f17497SC.J. Collier	struct crypto_testsuite_params *ts_params = &testsuite_params;
16397f17497SC.J. Collier	struct rte_cryptodev_info info;
16497f17497SC.J. Collier	unsigned i, nb_devs, dev_id;
16597f17497SC.J. Collier	int ret;
16697f17497SC.J. Collier	uint16_t qp_id;
16797f17497SC.J. Collier
16897f17497SC.J. Collier	memset(ts_params, 0, sizeof(*ts_params));
16997f17497SC.J. Collier
17097f17497SC.J. Collier	ts_params->mbuf_pool = rte_mempool_lookup("CRYPTO_MBUFPOOL");
17197f17497SC.J. Collier	if (ts_params->mbuf_pool == NULL) {
17297f17497SC.J. Collier		/* Not already created so create */
17397f17497SC.J. Collier		ts_params->mbuf_pool = rte_pktmbuf_pool_create(
17497f17497SC.J. Collier				"CRYPTO_MBUFPOOL",
17597f17497SC.J. Collier				NUM_MBUFS, MBUF_CACHE_SIZE, 0, MBUF_SIZE,
17697f17497SC.J. Collier				rte_socket_id());
17797f17497SC.J. Collier		if (ts_params->mbuf_pool == NULL) {
17897f17497SC.J. Collier			RTE_LOG(ERR, USER1, "Can't create CRYPTO_MBUFPOOL\n");
17997f17497SC.J. Collier			return TEST_FAILED;
18097f17497SC.J. Collier		}
18197f17497SC.J. Collier	}
18297f17497SC.J. Collier
1836b3e017eSChristian Ehrhardt	ts_params->large_mbuf_pool = rte_mempool_lookup(
1846b3e017eSChristian Ehrhardt			"CRYPTO_LARGE_MBUFPOOL");
1856b3e017eSChristian Ehrhardt	if (ts_params->large_mbuf_pool == NULL) {
1866b3e017eSChristian Ehrhardt		/* Not already created so create */
1876b3e017eSChristian Ehrhardt		ts_params->large_mbuf_pool = rte_pktmbuf_pool_create(
1886b3e017eSChristian Ehrhardt				"CRYPTO_LARGE_MBUFPOOL",
1896b3e017eSChristian Ehrhardt				1, 0, 0, UINT16_MAX,
1906b3e017eSChristian Ehrhardt				rte_socket_id());
1916b3e017eSChristian Ehrhardt		if (ts_params->large_mbuf_pool == NULL) {
1926b3e017eSChristian Ehrhardt			RTE_LOG(ERR, USER1,
1936b3e017eSChristian Ehrhardt				"Can't create CRYPTO_LARGE_MBUFPOOL\n");
1946b3e017eSChristian Ehrhardt			return TEST_FAILED;
1956b3e017eSChristian Ehrhardt		}
1966b3e017eSChristian Ehrhardt	}
1976b3e017eSChristian Ehrhardt
19897f17497SC.J. Collier	ts_params->op_mpool = rte_crypto_op_pool_create(
19997f17497SC.J. Collier			"MBUF_CRYPTO_SYM_OP_POOL",
20097f17497SC.J. Collier			RTE_CRYPTO_OP_TYPE_SYMMETRIC,
20197f17497SC.J. Collier			NUM_MBUFS, MBUF_CACHE_SIZE,
20297f17497SC.J. Collier			DEFAULT_NUM_XFORMS *
20397f17497SC.J. Collier			sizeof(struct rte_crypto_sym_xform),
20497f17497SC.J. Collier			rte_socket_id());
20597f17497SC.J. Collier	if (ts_params->op_mpool == NULL) {
20697f17497SC.J. Collier		RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n");
20797f17497SC.J. Collier		return TEST_FAILED;
20897f17497SC.J. Collier	}
20997f17497SC.J. Collier
21097f17497SC.J. Collier	/* Create 2 AESNI MB devices if required */
21197f17497SC.J. Collier	if (gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_MB_PMD) {
2126b3e017eSChristian Ehrhardt#ifndef RTE_LIBRTE_PMD_AESNI_MB
2136b3e017eSChristian Ehrhardt		RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_MB must be"
2146b3e017eSChristian Ehrhardt			" enabled in config file to run this testsuite.\n");
2156b3e017eSChristian Ehrhardt		return TEST_FAILED;
2166b3e017eSChristian Ehrhardt#endif
21797f17497SC.J. Collier		nb_devs = rte_cryptodev_count_devtype(
21897f17497SC.J. Collier				RTE_CRYPTODEV_AESNI_MB_PMD);
21997f17497SC.J. Collier		if (nb_devs < 2) {
22097f17497SC.J. Collier			for (i = nb_devs; i < 2; i++) {
22197f17497SC.J. Collier				ret = rte_eal_vdev_init(
222a41e6ff1SRicardo Salveti					RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), NULL);
22397f17497SC.J. Collier
22497f17497SC.J. Collier				TEST_ASSERT(ret == 0,
22597f17497SC.J. Collier					"Failed to create instance %u of"
22697f17497SC.J. Collier					" pmd : %s",
227a41e6ff1SRicardo Salveti					i, RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
22897f17497SC.J. Collier			}
22997f17497SC.J. Collier		}
23097f17497SC.J. Collier	}
23197f17497SC.J. Collier
23297f17497SC.J. Collier	/* Create 2 AESNI GCM devices if required */
23397f17497SC.J. Collier	if (gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_GCM_PMD) {
2346b3e017eSChristian Ehrhardt#ifndef RTE_LIBRTE_PMD_AESNI_GCM
2356b3e017eSChristian Ehrhardt		RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_GCM must be"
2366b3e017eSChristian Ehrhardt			" enabled in config file to run this testsuite.\n");
2376b3e017eSChristian Ehrhardt		return TEST_FAILED;
2386b3e017eSChristian Ehrhardt#endif
23997f17497SC.J. Collier		nb_devs = rte_cryptodev_count_devtype(
24097f17497SC.J. Collier				RTE_CRYPTODEV_AESNI_GCM_PMD);
24197f17497SC.J. Collier		if (nb_devs < 2) {
24297f17497SC.J. Collier			for (i = nb_devs; i < 2; i++) {
24397f17497SC.J. Collier				TEST_ASSERT_SUCCESS(rte_eal_vdev_init(
244a41e6ff1SRicardo Salveti					RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), NULL),
24597f17497SC.J. Collier					"Failed to create instance %u of"
24697f17497SC.J. Collier					" pmd : %s",
247a41e6ff1SRicardo Salveti					i, RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD));
24897f17497SC.J. Collier			}
24997f17497SC.J. Collier		}
25097f17497SC.J. Collier	}
25197f17497SC.J. Collier
2526b3e017eSChristian Ehrhardt	/* Create 2 SNOW 3G devices if required */
25397f17497SC.J. Collier	if (gbl_cryptodev_type == RTE_CRYPTODEV_SNOW3G_PMD) {
2546b3e017eSChristian Ehrhardt#ifndef RTE_LIBRTE_PMD_SNOW3G
2556b3e017eSChristian Ehrhardt		RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_SNOW3G must be"
2566b3e017eSChristian Ehrhardt			" enabled in config file to run this testsuite.\n");
2576b3e017eSChristian Ehrhardt		return TEST_FAILED;
2586b3e017eSChristian Ehrhardt#endif
25997f17497SC.J. Collier		nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_SNOW3G_PMD);
26097f17497SC.J. Collier		if (nb_devs < 2) {
26197f17497SC.J. Collier			for (i = nb_devs; i < 2; i++) {
26297f17497SC.J. Collier				TEST_ASSERT_SUCCESS(rte_eal_vdev_init(
263a41e6ff1SRicardo Salveti					RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD), NULL),
26497f17497SC.J. Collier					"Failed to create instance %u of"
26597f17497SC.J. Collier					" pmd : %s",
266a41e6ff1SRicardo Salveti					i, RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
26797f17497SC.J. Collier			}
26897f17497SC.J. Collier		}
26997f17497SC.J. Collier	}
27097f17497SC.J. Collier
2718b25d1adSChristian Ehrhardt	/* Create 2 KASUMI devices if required */
2728b25d1adSChristian Ehrhardt	if (gbl_cryptodev_type == RTE_CRYPTODEV_KASUMI_PMD) {
2736b3e017eSChristian Ehrhardt#ifndef RTE_LIBRTE_PMD_KASUMI
2746b3e017eSChristian Ehrhardt		RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_KASUMI must be"
2756b3e017eSChristian Ehrhardt			" enabled in config file to run this testsuite.\n");
2766b3e017eSChristian Ehrhardt		return TEST_FAILED;
2776b3e017eSChristian Ehrhardt#endif
2788b25d1adSChristian Ehrhardt		nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_KASUMI_PMD);
2798b25d1adSChristian Ehrhardt		if (nb_devs < 2) {
2808b25d1adSChristian Ehrhardt			for (i = nb_devs; i < 2; i++) {
2818b25d1adSChristian Ehrhardt				TEST_ASSERT_SUCCESS(rte_eal_vdev_init(
282a41e6ff1SRicardo Salveti					RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), NULL),
2838b25d1adSChristian Ehrhardt					"Failed to create instance %u of"
2848b25d1adSChristian Ehrhardt					" pmd : %s",
285a41e6ff1SRicardo Salveti					i, RTE_STR(CRYPTODEV_NAME_KASUMI_PMD));
2868b25d1adSChristian Ehrhardt			}
2878b25d1adSChristian Ehrhardt		}
2888b25d1adSChristian Ehrhardt	}
2898b25d1adSChristian Ehrhardt
2906b3e017eSChristian Ehrhardt	/* Create 2 ZUC devices if required */
2916b3e017eSChristian Ehrhardt	if (gbl_cryptodev_type == RTE_CRYPTODEV_ZUC_PMD) {
2926b3e017eSChristian Ehrhardt#ifndef RTE_LIBRTE_PMD_ZUC
2936b3e017eSChristian Ehrhardt		RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_ZUC must be"
2946b3e017eSChristian Ehrhardt			" enabled in config file to run this testsuite.\n");
2956b3e017eSChristian Ehrhardt		return TEST_FAILED;
2966b3e017eSChristian Ehrhardt#endif
2976b3e017eSChristian Ehrhardt		nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_ZUC_PMD);
2986b3e017eSChristian Ehrhardt		if (nb_devs < 2) {
2996b3e017eSChristian Ehrhardt			for (i = nb_devs; i < 2; i++) {
3006b3e017eSChristian Ehrhardt				TEST_ASSERT_SUCCESS(rte_eal_vdev_init(
3016b3e017eSChristian Ehrhardt					RTE_STR(CRYPTODEV_NAME_ZUC_PMD), NULL),
3026b3e017eSChristian Ehrhardt					"Failed to create instance %u of"
3036b3e017eSChristian Ehrhardt					" pmd : %s",
3046b3e017eSChristian Ehrhardt					i, RTE_STR(CRYPTODEV_NAME_ZUC_PMD));
3056b3e017eSChristian Ehrhardt			}
3066b3e017eSChristian Ehrhardt		}
3076b3e017eSChristian Ehrhardt	}
3086b3e017eSChristian Ehrhardt
30997f17497SC.J. Collier	/* Create 2 NULL devices if required */
31097f17497SC.J. Collier	if (gbl_cryptodev_type == RTE_CRYPTODEV_NULL_PMD) {
3116b3e017eSChristian Ehrhardt#ifndef RTE_LIBRTE_PMD_NULL_CRYPTO
3126b3e017eSChristian Ehrhardt		RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO must be"
3136b3e017eSChristian Ehrhardt			" enabled in config file to run this testsuite.\n");
3146b3e017eSChristian Ehrhardt		return TEST_FAILED;
3156b3e017eSChristian Ehrhardt#endif
31697f17497SC.J. Collier		nb_devs = rte_cryptodev_count_devtype(
31797f17497SC.J. Collier				RTE_CRYPTODEV_NULL_PMD);
31897f17497SC.J. Collier		if (nb_devs < 2) {
31997f17497SC.J. Collier			for (i = nb_devs; i < 2; i++) {
32097f17497SC.J. Collier				int dev_id = rte_eal_vdev_init(
321a41e6ff1SRicardo Salveti					RTE_STR(CRYPTODEV_NAME_NULL_PMD), NULL);
32297f17497SC.J. Collier
32397f17497SC.J. Collier				TEST_ASSERT(dev_id >= 0,
32497f17497SC.J. Collier					"Failed to create instance %u of"
32597f17497SC.J. Collier					" pmd : %s",
326a41e6ff1SRicardo Salveti					i, RTE_STR(CRYPTODEV_NAME_NULL_PMD));
32797f17497SC.J. Collier			}
32897f17497SC.J. Collier		}
32997f17497SC.J. Collier	}
33097f17497SC.J. Collier
3316b3e017eSChristian Ehrhardt	/* Create 2 OPENSSL devices if required */
3326b3e017eSChristian Ehrhardt	if (gbl_cryptodev_type == RTE_CRYPTODEV_OPENSSL_PMD) {
3336b3e017eSChristian Ehrhardt#ifndef RTE_LIBRTE_PMD_OPENSSL
3346b3e017eSChristian Ehrhardt		RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_OPENSSL must be"
3356b3e017eSChristian Ehrhardt			" enabled in config file to run this testsuite.\n");
3366b3e017eSChristian Ehrhardt		return TEST_FAILED;
3376b3e017eSChristian Ehrhardt#endif
3386b3e017eSChristian Ehrhardt		nb_devs = rte_cryptodev_count_devtype(
3396b3e017eSChristian Ehrhardt				RTE_CRYPTODEV_OPENSSL_PMD);
3406b3e017eSChristian Ehrhardt		if (nb_devs < 2) {
3416b3e017eSChristian Ehrhardt			for (i = nb_devs; i < 2; i++) {
3426b3e017eSChristian Ehrhardt				ret = rte_eal_vdev_init(
3436b3e017eSChristian Ehrhardt					RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD),
3446b3e017eSChristian Ehrhardt					NULL);
3456b3e017eSChristian Ehrhardt
3466b3e017eSChristian Ehrhardt				TEST_ASSERT(ret == 0, "Failed to create "
3476b3e017eSChristian Ehrhardt					"instance %u of pmd : %s", i,
3486b3e017eSChristian Ehrhardt					RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
3496b3e017eSChristian Ehrhardt			}
3506b3e017eSChristian Ehrhardt		}
3516b3e017eSChristian Ehrhardt	}
3526b3e017eSChristian Ehrhardt
3536b3e017eSChristian Ehrhardt#ifndef RTE_LIBRTE_PMD_QAT
3546b3e017eSChristian Ehrhardt	if (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_SYM_PMD) {
3556b3e017eSChristian Ehrhardt		RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_QAT must be enabled "
3566b3e017eSChristian Ehrhardt				"in config file to run this testsuite.\n");
3576b3e017eSChristian Ehrhardt		return TEST_FAILED;
3586b3e017eSChristian Ehrhardt	}
3596b3e017eSChristian Ehrhardt#endif
3606b3e017eSChristian Ehrhardt
36197f17497SC.J. Collier	nb_devs = rte_cryptodev_count();
36297f17497SC.J. Collier	if (nb_devs < 1) {
3636b3e017eSChristian Ehrhardt		RTE_LOG(ERR, USER1, "No crypto devices found?\n");
36497f17497SC.J. Collier		return TEST_FAILED;
36597f17497SC.J. Collier	}
36697f17497SC.J. Collier
36797f17497SC.J. Collier	/* Create list of valid crypto devs */
36897f17497SC.J. Collier	for (i = 0; i < nb_devs; i++) {
36997f17497SC.J. Collier		rte_cryptodev_info_get(i, &info);
37097f17497SC.J. Collier		if (info.dev_type == gbl_cryptodev_type)
37197f17497SC.J. Collier			ts_params->valid_devs[ts_params->valid_dev_count++] = i;
37297f17497SC.J. Collier	}
37397f17497SC.J. Collier
37497f17497SC.J. Collier	if (ts_params->valid_dev_count < 1)
37597f17497SC.J. Collier		return TEST_FAILED;
37697f17497SC.J. Collier
37797f17497SC.J. Collier	/* Set up all the qps on the first of the valid devices found */
37897f17497SC.J. Collier
3796b3e017eSChristian Ehrhardt	dev_id = ts_params->valid_devs[0];
38097f17497SC.J. Collier
3816b3e017eSChristian Ehrhardt	rte_cryptodev_info_get(dev_id, &info);
38297f17497SC.J. Collier
3836b3e017eSChristian Ehrhardt	ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs;
3846b3e017eSChristian Ehrhardt	ts_params->conf.socket_id = SOCKET_ID_ANY;
3856b3e017eSChristian Ehrhardt	ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions;
38697f17497SC.J. Collier
3876b3e017eSChristian Ehrhardt	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id,
3886b3e017eSChristian Ehrhardt			&ts_params->conf),
3896b3e017eSChristian Ehrhardt			"Failed to configure cryptodev %u with %u qps",
3906b3e017eSChristian Ehrhardt			dev_id, ts_params->conf.nb_queue_pairs);
39197f17497SC.J. Collier
3926b3e017eSChristian Ehrhardt	ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
39397f17497SC.J. Collier
3946b3e017eSChristian Ehrhardt	for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) {
3956b3e017eSChristian Ehrhardt		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
3966b3e017eSChristian Ehrhardt			dev_id, qp_id, &ts_params->qp_conf,
3976b3e017eSChristian Ehrhardt			rte_cryptodev_socket_id(dev_id)),
3986b3e017eSChristian Ehrhardt			"Failed to setup queue pair %u on cryptodev %u",
3996b3e017eSChristian Ehrhardt			qp_id, dev_id);
40097f17497SC.J. Collier	}
40197f17497SC.J. Collier
40297f17497SC.J. Collier	return TEST_SUCCESS;
40397f17497SC.J. Collier}
40497f17497SC.J. Collier
40597f17497SC.J. Collierstatic void
40697f17497SC.J. Colliertestsuite_teardown(void)
40797f17497SC.J. Collier{
40897f17497SC.J. Collier	struct crypto_testsuite_params *ts_params = &testsuite_params;
40997f17497SC.J. Collier
41097f17497SC.J. Collier	if (ts_params->mbuf_pool != NULL) {
41197f17497SC.J. Collier		RTE_LOG(DEBUG, USER1, "CRYPTO_MBUFPOOL count %u\n",
4128b25d1adSChristian Ehrhardt		rte_mempool_avail_count(ts_params->mbuf_pool));
41397f17497SC.J. Collier	}
41497f17497SC.J. Collier
41597f17497SC.J. Collier	if (ts_params->op_mpool != NULL) {
41697f17497SC.J. Collier		RTE_LOG(DEBUG, USER1, "CRYPTO_OP_POOL count %u\n",
4178b25d1adSChristian Ehrhardt		rte_mempool_avail_count(ts_params->op_mpool));
41897f17497SC.J. Collier	}
41997f17497SC.J. Collier
42097f17497SC.J. Collier}
42197f17497SC.J. Collier
42297f17497SC.J. Collierstatic int
42397f17497SC.J. Collierut_setup(void)
42497f17497SC.J. Collier{
42597f17497SC.J. Collier	struct crypto_testsuite_params *ts_params = &testsuite_params;
42697f17497SC.J. Collier	struct crypto_unittest_params *ut_params = &unittest_params;
42797f17497SC.J. Collier
42897f17497SC.J. Collier	uint16_t qp_id;
42997f17497SC.J. Collier
43097f17497SC.J. Collier	/* Clear unit test parameters before running test */
43197f17497SC.J. Collier	memset(ut_params, 0, sizeof(*ut_params));
43297f17497SC.J. Collier
43397f17497SC.J. Collier	/* Reconfigure device to default parameters */
43497f17497SC.J. Collier	ts_params->conf.socket_id = SOCKET_ID_ANY;
4356b3e017eSChristian Ehrhardt	ts_params->conf.session_mp.nb_objs = DEFAULT_NUM_OPS_INFLIGHT;
43697f17497SC.J. Collier
43797f17497SC.J. Collier	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
43897f17497SC.J. Collier			&ts_params->conf),
43997f17497SC.J. Collier			"Failed to configure cryptodev %u",
44097f17497SC.J. Collier			ts_params->valid_devs[0]);
44197f17497SC.J. Collier
44297f17497SC.J. Collier	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) {
44397f17497SC.J. Collier		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
44497f17497SC.J. Collier			ts_params->valid_devs[0], qp_id,
44597f17497SC.J. Collier			&ts_params->qp_conf,
44697f17497SC.J. Collier			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
44797f17497SC.J. Collier			"Failed to setup queue pair %u on cryptodev %u",
44897f17497SC.J. Collier			qp_id, ts_params->valid_devs[0]);
44997f17497SC.J. Collier	}
45097f17497SC.J. Collier
45197f17497SC.J. Collier
45297f17497SC.J. Collier	rte_cryptodev_stats_reset(ts_params->valid_devs[0]);
45397f17497SC.J. Collier
45497f17497SC.J. Collier	/* Start the device */
45597f17497SC.J. Collier	TEST_ASSERT_SUCCESS(rte_cryptodev_start(ts_params->valid_devs[0]),
45697f17497SC.J. Collier			"Failed to start cryptodev %u",
45797f17497SC.J. Collier			ts_params->valid_devs[0]);
45897f17497SC.J. Collier
45997f17497SC.J. Collier	return TEST_SUCCESS;
46097f17497SC.J. Collier}
46197f17497SC.J. Collier
46297f17497SC.J. Collierstatic void
46397f17497SC.J. Collierut_teardown(void)
46497f17497SC.J. Collier{
46597f17497SC.J. Collier	struct crypto_testsuite_params *ts_params = &testsuite_params;
46697f17497SC.J. Collier	struct crypto_unittest_params *ut_params = &unittest_params;
46797f17497SC.J. Collier	struct rte_cryptodev_stats stats;
46897f17497SC.J. Collier
46997f17497SC.J. Collier	/* free crypto session structure */
47097f17497SC.J. Collier	if (ut_params->sess) {
47197f17497SC.J. Collier		rte_cryptodev_sym_session_free(ts_params->valid_devs[0],
47297f17497SC.J. Collier				ut_params->sess);
47397f17497SC.J. Collier		ut_params->sess = NULL;
47497f17497SC.J. Collier	}
47597f17497SC.J. Collier
47697f17497SC.J. Collier	/* free crypto operation structure */
47797f17497SC.J. Collier	if (ut_params->op)
47897f17497SC.J. Collier		rte_crypto_op_free(ut_params->op);
47997f17497SC.J. Collier
48097f17497SC.J. Collier	/*
48197f17497SC.J. Collier	 * free mbuf - both obuf and ibuf are usually the same,
4828b25d1adSChristian Ehrhardt	 * so check if they point at the same address is necessary,
4838b25d1adSChristian Ehrhardt	 * to avoid freeing the mbuf twice.
48497f17497SC.J. Collier	 */
48597f17497SC.J. Collier	if (ut_params->obuf) {
48697f17497SC.J. Collier		rte_pktmbuf_free(ut_params->obuf);
4878b25d1adSChristian Ehrhardt		if (ut_params->ibuf == ut_params->obuf)
4888b25d1adSChristian Ehrhardt			ut_params->ibuf = 0;
48997f17497SC.J. Collier		ut_params->obuf = 0;
49097f17497SC.J. Collier	}
49197f17497SC.J. Collier	if (ut_params->ibuf) {
49297f17497SC.J. Collier		rte_pktmbuf_free(ut_params->ibuf);
49397f17497SC.J. Collier		ut_params->ibuf = 0;
49497f17497SC.J. Collier	}
49597f17497SC.J. Collier
49697f17497SC.J. Collier	if (ts_params->mbuf_pool != NULL)
49797f17497SC.J. Collier		RTE_LOG(DEBUG, USER1, "CRYPTO_MBUFPOOL count %u\n",
4988b25d1adSChristian Ehrhardt			rte_mempool_avail_count(ts_params->mbuf_pool));
49997f17497SC.J. Collier
50097f17497SC.J. Collier	rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats);
50197f17497SC.J. Collier
50297f17497SC.J. Collier	/* Stop the device */
50397f17497SC.J. Collier	rte_cryptodev_stop(ts_params->valid_devs[0]);
50497f17497SC.J. Collier}
50597f17497SC.J. Collier
50697f17497SC.J. Collierstatic int
50797f17497SC.J. Colliertest_device_configure_invalid_dev_id(void)
50897f17497SC.J. Collier{
50997f17497SC.J. Collier	struct crypto_testsuite_params *ts_params = &testsuite_params;
51097f17497SC.J. Collier	uint16_t dev_id, num_devs = 0;
51197f17497SC.J. Collier
51297f17497SC.J. Collier	TEST_ASSERT((num_devs = rte_cryptodev_count()) >= 1,
51397f17497SC.J. Collier			"Need at least %d devices for test", 1);
51497f17497SC.J. Collier
51597f17497SC.J. Collier	/* valid dev_id values */
51697f17497SC.J. Collier	dev_id = ts_params->valid_devs[ts_params->valid_dev_count - 1];
51797f17497SC.J. Collier
51897f17497SC.J. Collier	/* Stop the device in case it's started so it can be configured */
5198e6d9d11SLuca Boccassi	rte_cryptodev_stop(dev_id);
52097f17497SC.J. Collier
52197f17497SC.J. Collier	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id, &ts_params->conf),
52297f17497SC.J. Collier			"Failed test for rte_cryptodev_configure: "
52397f17497SC.J. Collier			"invalid dev_num %u", dev_id);
52497f17497SC.J. Collier
52597f17497SC.J. Collier	/* invalid dev_id values */
52697f17497SC.J. Collier	dev_id = num_devs;
52797f17497SC.J. Collier
52897f17497SC.J. Collier	TEST_ASSERT_FAIL(rte_cryptodev_configure(dev_id, &ts_params->conf),
52997f17497SC.J. Collier			"Failed test for rte_cryptodev_configure: "
53097f17497SC.J. Collier			"invalid dev_num %u", dev_id);
53197f17497SC.J. Collier
53297f17497SC.J. Collier	dev_id = 0xff;
53397f17497SC.J. Collier
53497f17497SC.J. Collier	TEST_ASSERT_FAIL(rte_cryptodev_configure(dev_id, &ts_params->conf),
53597f17497SC.J. Collier			"Failed test for rte_cryptodev_configure:"
53697f17497SC.J. Collier			"invalid dev_num %u", dev_id);
53797f17497SC.J. Collier
53897f17497SC.J. Collier	return TEST_SUCCESS;
53997f17497SC.J. Collier}
54097f17497SC.J. Collier
54197f17497SC.J. Collierstatic int
54297f17497SC.J. Colliertest_device_configure_invalid_queue_pair_ids(void)
54397f17497SC.J. Collier{
54497f17497SC.J. Collier	struct crypto_testsuite_params *ts_params = &testsuite_params;
5456b3e017eSChristian Ehrhardt	uint16_t orig_nb_qps = ts_params->conf.nb_queue_pairs;
54697f17497SC.J. Collier
54797f17497SC.J. Collier	/* Stop the device in case it's started so it can be configured */
54897f17497SC.J. Collier	rte_cryptodev_stop(ts_params->valid_devs[0]);
54997f17497SC.J. Collier
55097f17497SC.J. Collier	/* valid - one queue pairs */
55197f17497SC.J. Collier	ts_params->conf.nb_queue_pairs = 1;
55297f17497SC.J. Collier
55397f17497SC.J. Collier	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
55497f17497SC.J. Collier			&ts_params->conf),
55597f17497SC.J. Collier			"Failed to configure cryptodev: dev_id %u, qp_id %u",
55697f17497SC.J. Collier			ts_params->valid_devs[0], ts_params->conf.nb_queue_pairs);
55797f17497SC.J. Collier
55897f17497SC.J. Collier
55997f17497SC.J. Collier	/* valid - max value queue pairs */
560f7a9461eSLuca Boccassi	ts_params->conf.nb_queue_pairs = orig_nb_qps;
56197f17497SC.J. Collier
56297f17497SC.J. Collier	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
56397f17497SC.J. Collier			&ts_params->conf),
56497f17497SC.J. Collier			"Failed to configure cryptodev: dev_id %u, qp_id %u",
56597f17497SC.J. Collier			ts_params->valid_devs[0], ts_params->conf.nb_queue_pairs);
56697f17497SC.J. Collier
56797f17497SC.J. Collier
56897f17497SC.J. Collier	/* invalid - zero queue pairs */
56997f17497SC.J. Collier	ts_params->conf.nb_queue_pairs = 0;
57097f17497SC.J. Collier
57197f17497SC.J. Collier	TEST_ASSERT_FAIL(rte_cryptodev_configure(ts_params->valid_devs[0],
57297f17497SC.J. Collier			&ts_params->conf),
57397f17497SC.J. Collier			"Failed test for rte_cryptodev_configure, dev_id %u,"
57497f17497SC.J. Collier			" invalid qps: %u",
57597f17497SC.J. Collier			ts_params->valid_devs[0],
57697f17497SC.J. Collier			ts_params->conf.nb_queue_pairs);
57797f17497SC.J. Collier
57897f17497SC.J. Collier
57997f17497SC.J. Collier	/* invalid - max value supported by field queue pairs */
58097f17497SC.J. Collier	ts_params->conf.nb_queue_pairs = UINT16_MAX;
58197f17497SC.J. Collier
58297f17497SC.J. Collier	TEST_ASSERT_FAIL(rte_cryptodev_configure(ts_params->valid_devs[0],
58397f17497SC.J. Collier			&ts_params->conf),
58497f17497SC.J. Collier			"Failed test for rte_cryptodev_configure, dev_id %u,"
58597f17497SC.J. Collier			" invalid qps: %u",
58697f17497SC.J. Collier			ts_params->valid_devs[0],
58797f17497SC.J. Collier			ts_params->conf.nb_queue_pairs);
58897f17497SC.J. Collier
58997f17497SC.J. Collier
59097f17497SC.J. Collier	/* invalid - max value + 1 queue pairs */
591f7a9461eSLuca Boccassi	ts_params->conf.nb_queue_pairs = orig_nb_qps + 1;
59297f17497SC.J. Collier
59397f17497SC.J. Collier	TEST_ASSERT_FAIL(rte_cryptodev_configure(ts_params->valid_devs[0],
59497f17497SC.J. Collier			&ts_params->conf),
59597f17497SC.J. Collier			"Failed test for rte_cryptodev_configure, dev_id %u,"
59697f17497SC.J. Collier			" invalid qps: %u",
59797f17497SC.J. Collier			ts_params->valid_devs[0],
59897f17497SC.J. Collier			ts_params->conf.nb_queue_pairs);
59997f17497SC.J. Collier
6006b3e017eSChristian Ehrhardt	/* revert to original testsuite value */
6016b3e017eSChristian Ehrhardt	ts_params->conf.nb_queue_pairs = orig_nb_qps;
6026b3e017eSChristian Ehrhardt
60397f17497SC.J. Collier	return TEST_SUCCESS;
60497f17497SC.J. Collier}
60597f17497SC.J. Collier
60697f17497SC.J. Collierstatic int
60797f17497SC.J. Colliertest_queue_pair_descriptor_setup(void)
60897f17497SC.J. Collier{
60997f17497SC.J. Collier	struct crypto_testsuite_params *ts_params = &testsuite_params;
61097f17497SC.J. Collier	struct rte_cryptodev_info dev_info;
61197f17497SC.J. Collier	struct rte_cryptodev_qp_conf qp_conf = {
61297f17497SC.J. Collier		.nb_descriptors = MAX_NUM_OPS_INFLIGHT
61397f17497SC.J. Collier	};
61497f17497SC.J. Collier
61597f17497SC.J. Collier	uint16_t qp_id;
61697f17497SC.J. Collier
61797f17497SC.J. Collier	/* Stop the device in case it's started so it can be configured */
61897f17497SC.J. Collier	rte_cryptodev_stop(ts_params->valid_devs[0]);
61997f17497SC.J. Collier
62097f17497SC.J. Collier
62197f17497SC.J. Collier	rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
62297f17497SC.J. Collier
62397f17497SC.J. Collier	ts_params->conf.session_mp.nb_objs = dev_info.sym.max_nb_sessions;
62497f17497SC.J. Collier
62597f17497SC.J. Collier	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
62697f17497SC.J. Collier			&ts_params->conf), "Failed to configure cryptodev %u",
62797f17497SC.J. Collier			ts_params->valid_devs[0]);
62897f17497SC.J. Collier
62997f17497SC.J. Collier
63097f17497SC.J. Collier	/*
63197f17497SC.J. Collier	 * Test various ring sizes on this device. memzones can't be
63297f17497SC.J. Collier	 * freed so are re-used if ring is released and re-created.
63397f17497SC.J. Collier	 */
63497f17497SC.J. Collier	qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/
63597f17497SC.J. Collier
63697f17497SC.J. Collier	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
63797f17497SC.J. Collier		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
63897f17497SC.J. Collier				ts_params->valid_devs[0], qp_id, &qp_conf,
63997f17497SC.J. Collier				rte_cryptodev_socket_id(
64097f17497SC.J. Collier						ts_params->valid_devs[0])),
64197f17497SC.J. Collier				"Failed test for "
64297f17497SC.J. Collier				"rte_cryptodev_queue_pair_setup: num_inflights "
64397f17497SC.J. Collier				"%u on qp %u on cryptodev %u",
64497f17497SC.J. Collier				qp_conf.nb_descriptors, qp_id,
64597f17497SC.J. Collier				ts_params->valid_devs[0]);
64697f17497SC.J. Collier	}
64797f17497SC.J. Collier
64897f17497SC.J. Collier	qp_conf.nb_descriptors = (uint32_t)(MAX_NUM_OPS_INFLIGHT / 2);
64997f17497SC.J. Collier
65097f17497SC.J. Collier	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
65197f17497SC.J. Collier		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
65297f17497SC.J. Collier				ts_params->valid_devs[0], qp_id, &qp_conf,
65397f17497SC.J. Collier				rte_cryptodev_socket_id(
65497f17497SC.J. Collier						ts_params->valid_devs[0])),
65597f17497SC.J. Collier				"Failed test for"
65697f17497SC.J. Collier				" rte_cryptodev_queue_pair_setup: num_inflights"
65797f17497SC.J. Collier				" %u on qp %u on cryptodev %u",
65897f17497SC.J. Collier				qp_conf.nb_descriptors, qp_id,
65997f17497SC.J. Collier				ts_params->valid_devs[0]);
66097f17497SC.J. Collier	}
66197f17497SC.J. Collier
66297f17497SC.J. Collier	qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT; /* valid */
66397f17497SC.J. Collier
66497f17497SC.J. Collier	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
66597f17497SC.J. Collier		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
66697f17497SC.J. Collier				ts_params->valid_devs[0], qp_id, &qp_conf,
66797f17497SC.J. Collier				rte_cryptodev_socket_id(
66897f17497SC.J. Collier						ts_params->valid_devs[0])),
66997f17497SC.J. Collier				"Failed test for "
67097f17497SC.J. Collier				"rte_cryptodev_queue_pair_setup: num_inflights"
67197f17497SC.J. Collier				" %u on qp %u on cryptodev %u",
67297f17497SC.J. Collier				qp_conf.nb_descriptors, qp_id,
67397f17497SC.J. Collier				ts_params->valid_devs[0]);
67497f17497SC.J. Collier	}
67597f17497SC.J. Collier
67697f17497SC.J. Collier	/* invalid number of descriptors - max supported + 2 */
67797f17497SC.J. Collier	qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT + 2;
67897f17497SC.J. Collier
67997f17497SC.J. Collier	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
68097f17497SC.J. Collier		TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
68197f17497SC.J. Collier				ts_params->valid_devs[0], qp_id, &qp_conf,
68297f17497SC.J. Collier				rte_cryptodev_socket_id(
68397f17497SC.J. Collier						ts_params->valid_devs[0])),
68497f17497SC.J. Collier				"Unexpectedly passed test for "
68597f17497SC.J. Collier				"rte_cryptodev_queue_pair_setup:"
68697f17497SC.J. Collier				"num_inflights %u on qp %u on cryptodev %u",
68797f17497SC.J. Collier				qp_conf.nb_descriptors, qp_id,
68897f17497SC.J. Collier				ts_params->valid_devs[0]);
68997f17497SC.J. Collier	}
69097f17497SC.J. Collier
69197f17497SC.J. Collier	/* invalid number of descriptors - max value of parameter */
69297f17497SC.J. Collier	qp_conf.nb_descriptors = UINT32_MAX-1;
69397f17497SC.J. Collier
69497f17497SC.J. Collier	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
69597f17497SC.J. Collier		TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
69697f17497SC.J. Collier				ts_params->valid_devs[0], qp_id, &qp_conf,
69797f17497SC.J. Collier				rte_cryptodev_socket_id(
69897f17497SC.J. Collier						ts_params->valid_devs[0])),
69997f17497SC.J. Collier				"Unexpectedly passed test for "
70097f17497SC.J. Collier				"rte_cryptodev_queue_pair_setup:"
70197f17497SC.J. Collier				"num_inflights %u on qp %u on cryptodev %u",
70297f17497SC.J. Collier				qp_conf.nb_descriptors, qp_id,
70397f17497SC.J. Collier				ts_params->valid_devs[0]);
70497f17497SC.J. Collier	}
70597f17497SC.J. Collier
70697f17497SC.J. Collier	qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
70797f17497SC.J. Collier
70897f17497SC.J. Collier	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
70997f17497SC.J. Collier		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
71097f17497SC.J. Collier				ts_params->valid_devs[0], qp_id, &qp_conf,
71197f17497SC.J. Collier				rte_cryptodev_socket_id(
71297f17497SC.J. Collier						ts_params->valid_devs[0])),
71397f17497SC.J. Collier				"Failed test for"
71497f17497SC.J. Collier				" rte_cryptodev_queue_pair_setup:"
71597f17497SC.J. Collier				"num_inflights %u on qp %u on cryptodev %u",
71697f17497SC.J. Collier				qp_conf.nb_descriptors, qp_id,
71797f17497SC.J. Collier				ts_params->valid_devs[0]);
71897f17497SC.J. Collier	}
71997f17497SC.J. Collier
72097f17497SC.J. Collier	/* invalid number of descriptors - max supported + 1 */
72197f17497SC.J. Collier	qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT + 1;
72297f17497SC.J. Collier
72397f17497SC.J. Collier	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
72497f17497SC.J. Collier		TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
72597f17497SC.J. Collier				ts_params->valid_devs[0], qp_id, &qp_conf,
72697f17497SC.J. Collier				rte_cryptodev_socket_id(
72797f17497SC.J. Collier						ts_params->valid_devs[0])),
72897f17497SC.J. Collier				"Unexpectedly passed test for "
72997f17497SC.J. Collier				"rte_cryptodev_queue_pair_setup:"
73097f17497SC.J. Collier				"num_inflights %u on qp %u on cryptodev %u",
73197f17497SC.J. Collier				qp_conf.nb_descriptors, qp_id,
73297f17497SC.J. Collier				ts_params->valid_devs[0]);
73397f17497SC.J. Collier	}
73497f17497SC.J. Collier
73597f17497SC.J. Collier	/* test invalid queue pair id */
73697f17497SC.J. Collier	qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;	/*valid */
73797f17497SC.J. Collier
738f7a9461eSLuca Boccassi	qp_id = ts_params->conf.nb_queue_pairs;		/*invalid */
73997f17497SC.J. Collier
74097f17497SC.J. Collier	TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
74197f17497SC.J. Collier			ts_params->valid_devs[0],
74297f17497SC.J. Collier			qp_id, &qp_conf,
74397f17497SC.J. Collier			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
74497f17497SC.J. Collier			"Failed test for rte_cryptodev_queue_pair_setup:"
74597f17497SC.J. Collier			"invalid qp %u on cryptodev %u",
74697f17497SC.J. Collier			qp_id, ts_params->valid_devs[0]);
74797f17497SC.J. Collier
74897f17497SC.J. Collier	qp_id = 0xffff; /*invalid*/
74997f17497SC.J. Collier
75097f17497SC.J. Collier	TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup(
75197f17497SC.J. Collier			ts_params->valid_devs[0],
75297f17497SC.J. Collier			qp_id, &qp_conf,
75397f17497SC.J. Collier			rte_cryptodev_socket_id(ts_params->valid_devs[0])),
75497f17497SC.J. Collier			"Failed test for rte_cryptodev_queue_pair_setup:"
75597f17497SC.J. Collier			"invalid qp %u on cryptodev %u",
75697f17497SC.J. Collier			qp_id, ts_params->valid_devs[0]);
75797f17497SC.J. Collier
75897f17497SC.J. Collier	return TEST_SUCCESS;
75997f17497SC.J. Collier}
76097f17497SC.J. Collier
76197f17497SC.J. Collier/* ***** Plaintext data for tests ***** */
76297f17497SC.J. Collier
76397f17497SC.J. Collierconst char catch_22_quote_1[] =
76497f17497SC.J. Collier		"There was only one catch and that was Catch-22, which "
76597f17497SC.J. Collier		"specified that a concern for one's safety in the face of "
76697f17497SC.J. Collier		"dangers that were real and immediate was the process of a "
76797f17497SC.J. Collier		"rational mind. Orr was crazy and could be grounded. All he "
76897f17497SC.J. Collier		"had to do was ask; and as soon as he did, he would no longer "
76997f17497SC.J. Collier		"be crazy and would have to fly more missions. Orr would be "
77097f17497SC.J. Collier		"crazy to fly more missions and sane if he didn't, but if he "
77197f17497SC.J. Collier		"was sane he had to fly them. If he flew them he was crazy "
77297f17497SC.J. Collier		"and didn't have to; but if he didn't want to he was sane and "
77397f17497SC.J. Collier		"had to. Yossarian was moved very deeply by the absolute "
77497f17497SC.J. Collier		"simplicity of this clause of Catch-22 and let out a "
77597f17497SC.J. Collier		"respectful whistle. \"That's some catch, that Catch-22\", he "
77697f17497SC.J. Collier		"observed. \"It's the best there is,\" Doc Daneeka agreed.";
77797f17497SC.J. Collier
77897f17497SC.J. Collierconst char catch_22_quote[] =
77997f17497SC.J. Collier		"What a lousy earth! He wondered how many people were "
78097f17497SC.J. Collier		"destitute that same night even in his own prosperous country, "
78197f17497SC.J. Collier		"how many homes were shanties, how many husbands were drunk "
78297f17497SC.J. Collier		"and wives socked, and how many children were bullied, abused, "
78397f17497SC.J. Collier		"or abandoned. How many families hungered for food they could "
78497f17497SC.J. Collier		"not afford to buy? How many hearts were broken? How many "
78597f17497SC.J. Collier		"suicides would take place that same night, how many people "
78697f17497SC.J. Collier		"would go insane? How many cockroaches and landlords would "
78797f17497SC.J. Collier		"triumph? How many winners were losers, successes failures, "
78897f17497SC.J. Collier		"and rich men poor men? How many wise guys were stupid? How "
78997f17497SC.J. Collier		"many happy endings were unhappy endings? How many honest men "
79097f17497SC.J. Collier		"were liars, brave men cowards, loyal men traitors, how many "
79197f17497SC.J. Collier		"sainted men were corrupt, how many people in positions of "
79297f17497SC.J. Collier		"trust had sold their souls to bodyguards, how many had never "
79397f17497SC.J. Collier		"had souls? How many straight-and-narrow paths were crooked "
79497f17497SC.J. Collier		"paths? How many best families were worst families and how "
79597f17497SC.J. Collier		"many good people were bad people? When you added them all up "
79697f17497SC.J. Collier		"and then subtracted, you might be left with only the children, "
79797f17497SC.J. Collier		"and perhaps with Albert Einstein and an old violinist or "
79897f17497SC.J. Collier		"sculptor somewhere.";
79997f17497SC.J. Collier
80097f17497SC.J. Collier#define QUOTE_480_BYTES		(480)
80197f17497SC.J. Collier#define QUOTE_512_BYTES		(512)
80297f17497SC.J. Collier#define QUOTE_768_BYTES		(768)
80397f17497SC.J. Collier#define QUOTE_1024_BYTES	(1024)
80497f17497SC.J. Collier
80597f17497SC.J. Collier
80697f17497SC.J. Collier
80797f17497SC.J. Collier/* ***** SHA1 Hash Tests ***** */
80897f17497SC.J. Collier
80997f17497SC.J. Collier#define HMAC_KEY_LENGTH_SHA1	(DIGEST_BYTE_LENGTH_SHA1)
81097f17497SC.J. Collier
81197f17497SC.J. Collierstatic uint8_t hmac_sha1_key[] = {
81297f17497SC.J. Collier	0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
81397f17497SC.J. Collier	0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
81497f17497SC.J. Collier	0xDE, 0xF4, 0xDE, 0xAD };
81597f17497SC.J. Collier
81697f17497SC.J. Collier/* ***** SHA224 Hash Tests ***** */
81797f17497SC.J. Collier
81897f17497SC.J. Collier#define HMAC_KEY_LENGTH_SHA224	(DIGEST_BYTE_LENGTH_SHA224)
81997f17497SC.J. Collier
82097f17497SC.J. Collier
82197f17497SC.J. Collier/* ***** AES-CBC Cipher Tests ***** */
82297f17497SC.J. Collier
82397f17497SC.J. Collier#define CIPHER_KEY_LENGTH_AES_CBC	(16)
82597f17497SC.J. Collier
82697f17497SC.J. Collierstatic uint8_t aes_cbc_key[] = {
82797f17497SC.J. Collier	0xE4, 0x23, 0x33, 0x8A, 0x35, 0x64, 0x61, 0xE2,
82897f17497SC.J. Collier	0x49, 0x03, 0xDD, 0xC6, 0xB8, 0xCA, 0x55, 0x7A };
82997f17497SC.J. Collier
83097f17497SC.J. Collierstatic uint8_t aes_cbc_iv[] = {
83197f17497SC.J. Collier	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
83297f17497SC.J. Collier	0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
83397f17497SC.J. Collier
83497f17497SC.J. Collier
83597f17497SC.J. Collier/* ***** AES-CBC / HMAC-SHA1 Hash Tests ***** */
83697f17497SC.J. Collier
83797f17497SC.J. Collierstatic const uint8_t catch_22_quote_2_512_bytes_AES_CBC_ciphertext[] = {
83897f17497SC.J. Collier	0x8B, 0x4D, 0xDA, 0x1B, 0xCF, 0x04, 0xA0, 0x31,
83997f17497SC.J. Collier	0xB4, 0xBF, 0xBD, 0x68, 0x43, 0x20, 0x7E, 0x76,
84097f17497SC.J. Collier	0xB1, 0x96, 0x8B, 0xA2, 0x7C, 0xA2, 0x83, 0x9E,
84197f17497SC.J. Collier	0x39, 0x5A, 0x2F, 0x7E, 0x92, 0xB4, 0x48, 0x1A,
84297f17497SC.J. Collier	0x3F, 0x6B, 0x5D, 0xDF, 0x52, 0x85, 0x5F, 0x8E,
84397f17497SC.J. Collier	0x42, 0x3C, 0xFB, 0xE9, 0x1A, 0x24, 0xD6, 0x08,
84497f17497SC.J. Collier	0xDD, 0xFD, 0x16, 0xFB, 0xE9, 0x55, 0xEF, 0xF0,
84597f17497SC.J. Collier	0xA0, 0x8D, 0x13, 0xAB, 0x81, 0xC6, 0x90, 0x01,
84697f17497SC.J. Collier	0xB5, 0x18, 0x84, 0xB3, 0xF6, 0xE6, 0x11, 0x57,
84797f17497SC.J. Collier	0xD6, 0x71, 0xC6, 0x3C, 0x3F, 0x2F, 0x33, 0xEE,
84897f17497SC.J. Collier	0x24, 0x42, 0x6E, 0xAC, 0x0B, 0xCA, 0xEC, 0xF9,
84997f17497SC.J. Collier	0x84, 0xF8, 0x22, 0xAA, 0x60, 0xF0, 0x32, 0xA9,
85097f17497SC.J. Collier	0x75, 0x75, 0x3B, 0xCB, 0x70, 0x21, 0x0A, 0x8D,
85197f17497SC.J. Collier	0x0F, 0xE0, 0xC4, 0x78, 0x2B, 0xF8, 0x97, 0xE3,
85297f17497SC.J. Collier	0xE4, 0x26, 0x4B, 0x29, 0xDA, 0x88, 0xCD, 0x46,
85397f17497SC.J. Collier	0xEC, 0xAA, 0xF9, 0x7F, 0xF1, 0x15, 0xEA, 0xC3,
85497f17497SC.J. Collier	0x87, 0xE6, 0x31, 0xF2, 0xCF, 0xDE, 0x4D, 0x80,
85597f17497SC.J. Collier	0x70, 0x91, 0x7E, 0x0C, 0xF7, 0x26, 0x3A, 0x92,
85697f17497SC.J. Collier	0x4F, 0x18, 0x83, 0xC0, 0x8F, 0x59, 0x01, 0xA5,
85797f17497SC.J. Collier	0x88, 0xD1, 0xDB, 0x26, 0x71, 0x27, 0x16, 0xF5,
85897f17497SC.J. Collier	0xEE, 0x10, 0x82, 0xAC, 0x68, 0x26, 0x9B, 0xE2,
85997f17497SC.J. Collier	0x6D, 0xD8, 0x9A, 0x80, 0xDF, 0x04, 0x31, 0xD5,
86097f17497SC.J. Collier	0xF1, 0x35, 0x5C, 0x3B, 0xDD, 0x9A, 0x65, 0xBA,
86197f17497SC.J. Collier	0x58, 0x34, 0x85, 0x61, 0x1C, 0x42, 0x10, 0x76,
86297f17497SC.J. Collier	0x73, 0x02, 0x42, 0xC9, 0x23, 0x18, 0x8E, 0xB4,
86397f17497SC.J. Collier	0x6F, 0xB4, 0xA3, 0x54, 0x6E, 0x88, 0x3B, 0x62,
86497f17497SC.J. Collier	0x7C, 0x02, 0x8D, 0x4C, 0x9F, 0xC8, 0x45, 0xF4,
86597f17497SC.J. Collier	0xC9, 0xDE, 0x4F, 0xEB, 0x22, 0x83, 0x1B, 0xE4,
86697f17497SC.J. Collier	0x49, 0x37, 0xE4, 0xAD, 0xE7, 0xCD, 0x21, 0x54,
86797f17497SC.J. Collier	0xBC, 0x1C, 0xC2, 0x04, 0x97, 0xB4, 0x10, 0x61,
86897f17497SC.J. Collier	0xF0, 0xE4, 0xEF, 0x27, 0x63, 0x3A, 0xDA, 0x91,
86997f17497SC.J. Collier	0x41, 0x25, 0x62, 0x1C, 0x5C, 0xB6, 0x38, 0x4A,
87097f17497SC.J. Collier	0x88, 0x71, 0x59, 0x5A, 0x8D, 0xA0, 0x09, 0xAF,
87197f17497SC.J. Collier	0x72, 0x94, 0xD7, 0x79, 0x5C, 0x60, 0x7C, 0x8F,
87297f17497SC.J. Collier	0x4C, 0xF5, 0xD9, 0xA1, 0x39, 0x6D, 0x81, 0x28,
87397f17497SC.J. Collier	0xEF, 0x13, 0x28, 0xDF, 0xF5, 0x3E, 0xF7, 0x8E,
87497f17497SC.J. Collier	0x09, 0x9C, 0x78, 0x18, 0x79, 0xB8, 0x68, 0xD7,
87597f17497SC.J. Collier	0xA8, 0x29, 0x62, 0xAD, 0xDE, 0xE1, 0x61, 0x76,
87697f17497SC.J. Collier	0x1B, 0x05, 0x16, 0xCD, 0xBF, 0x02, 0x8E, 0xA6,
87797f17497SC.J. Collier	0x43, 0x6E, 0x92, 0x55, 0x4F, 0x60, 0x9C, 0x03,
87897f17497SC.J. Collier	0xB8, 0x4F, 0xA3, 0x02, 0xAC, 0xA8, 0xA7, 0x0C,
87997f17497SC.J. Collier	0x1E, 0xB5, 0x6B, 0xF8, 0xC8, 0x4D, 0xDE, 0xD2,
88097f17497SC.J. Collier	0xB0, 0x29, 0x6E, 0x40, 0xE6, 0xD6, 0xC9, 0xE6,
88197f17497SC.J. Collier	0xB9, 0x0F, 0xB6, 0x63, 0xF5, 0xAA, 0x2B, 0x96,
88297f17497SC.J. Collier	0xA7, 0x16, 0xAC, 0x4E, 0x0A, 0x33, 0x1C, 0xA6,
88397f17497SC.J. Collier	0xE6, 0xBD, 0x8A, 0xCF, 0x40, 0xA9, 0xB2, 0xFA,
88497f17497SC.J. Collier	0x63, 0x27, 0xFD, 0x9B, 0xD9, 0xFC, 0xD5, 0x87,
88597f17497SC.J. Collier	0x8D, 0x4C, 0xB6, 0xA4, 0xCB, 0xE7, 0x74, 0x55,
88697f17497SC.J. Collier	0xF4, 0xFB, 0x41, 0x25, 0xB5, 0x4B, 0x0A, 0x1B,
88797f17497SC.J. Collier	0xB1, 0xD6, 0xB7, 0xD9, 0x47, 0x2A, 0xC3, 0x98,
88897f17497SC.J. Collier	0x6A, 0xC4, 0x03, 0x73, 0x1F, 0x93, 0x6E, 0x53,
88997f17497SC.J. Collier	0x19, 0x25, 0x64, 0x15, 0x83, 0xF9, 0x73, 0x2A,
89097f17497SC.J. Collier	0x74, 0xB4, 0x93, 0x69, 0xC4, 0x72, 0xFC, 0x26,
89197f17497SC.J. Collier	0xA2, 0x9F, 0x43, 0x45, 0xDD, 0xB9, 0xEF, 0x36,
89297f17497SC.J. Collier	0xC8, 0x3A, 0xCD, 0x99, 0x9B, 0x54, 0x1A, 0x36,
89397f17497SC.J. Collier	0xC1, 0x59, 0xF8, 0x98, 0xA8, 0xCC, 0x28, 0x0D,
89497f17497SC.J. Collier	0x73, 0x4C, 0xEE, 0x98, 0xCB, 0x7C, 0x58, 0x7E,
89597f17497SC.J. Collier	0x20, 0x75, 0x1E, 0xB7, 0xC9, 0xF8, 0xF2, 0x0E,
89697f17497SC.J. Collier	0x63, 0x9E, 0x05, 0x78, 0x1A, 0xB6, 0xA8, 0x7A,
89797f17497SC.J. Collier	0xF9, 0x98, 0x6A, 0xA6, 0x46, 0x84, 0x2E, 0xF6,
89897f17497SC.J. Collier	0x4B, 0xDC, 0x9B, 0x8F, 0x9B, 0x8F, 0xEE, 0xB4,
89997f17497SC.J. Collier	0xAA, 0x3F, 0xEE, 0xC0, 0x37, 0x27, 0x76, 0xC7,
90097f17497SC.J. Collier	0x95, 0xBB, 0x26, 0x74, 0x69, 0x12, 0x7F, 0xF1,
90197f17497SC.J. Collier	0xBB, 0xFF, 0xAE, 0xB5, 0x99, 0x6E, 0xCB, 0x0C
90297f17497SC.J. Collier};
90397f17497SC.J. Collier
90497f17497SC.J. Collierstatic const uint8_t catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest[] = {
90597f17497SC.J. Collier	0x9a, 0x4f, 0x88, 0x1b, 0xb6, 0x8f, 0xd8, 0x60,
90697f17497SC.J. Collier	0x42, 0x1a, 0x7d, 0x3d, 0xf5, 0x82, 0x80, 0xf1,
90797f17497SC.J. Collier	0x18, 0x8c, 0x1d, 0x32
90897f17497SC.J. Collier};
90997f17497SC.J. Collier
91097f17497SC.J. Collier
9116b3e017eSChristian Ehrhardt/* Multisession Vector context Test */
9126b3e017eSChristian Ehrhardt/*Begin Session 0 */
9136b3e017eSChristian Ehrhardtstatic uint8_t ms_aes_cbc_key0[] = {
9146b3e017eSChristian Ehrhardt	0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
9156b3e017eSChristian Ehrhardt	0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
9166b3e017eSChristian Ehrhardt};
9176b3e017eSChristian Ehrhardt
9186b3e017eSChristian Ehrhardtstatic uint8_t ms_aes_cbc_iv0[] = {
9196b3e017eSChristian Ehrhardt	0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
9206b3e017eSChristian Ehrhardt	0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
9216b3e017eSChristian Ehrhardt};
9226b3e017eSChristian Ehrhardt
9236b3e017eSChristian Ehrhardtstatic const uint8_t ms_aes_cbc_cipher0[] = {
9246b3e017eSChristian Ehrhardt		0x3C, 0xE4, 0xEE, 0x42, 0xB6, 0x9B, 0xC3, 0x38,
9256b3e017eSChristian Ehrhardt		0x5F, 0xAD, 0x54, 0xDC, 0xA8, 0x32, 0x81, 0xDC,
9266b3e017eSChristian Ehrhardt		0x7A, 0x6F, 0x85, 0x58, 0x07, 0x35, 0xED, 0xEB,
9276b3e017eSChristian Ehrhardt		0xAD, 0x79, 0x79, 0x96, 0xD3, 0x0E, 0xA6, 0xD9,
9286b3e017eSChristian Ehrhardt		0xAA, 0x86, 0xA4, 0x8F, 0xB5, 0xD6, 0x6E, 0x6D,
9296b3e017eSChristian Ehrhardt		0x0C, 0x91, 0x2F, 0xC4, 0x67, 0x98, 0x0E, 0xC4,
9306b3e017eSChristian Ehrhardt		0x8D, 0x83, 0x68, 0x69, 0xC4, 0xD3, 0x94, 0x34,
9316b3e017eSChristian Ehrhardt		0xC4, 0x5D, 0x60, 0x55, 0x22, 0x87, 0x8F, 0x6F,
9326b3e017eSChristian Ehrhardt		0x17, 0x8E, 0x75, 0xE4, 0x02, 0xF5, 0x1B, 0x99,
9336b3e017eSChristian Ehrhardt		0xC8, 0x39, 0xA9, 0xAB, 0x23, 0x91, 0x12, 0xED,
9346b3e017eSChristian Ehrhardt		0x08, 0xE7, 0xD9, 0x25, 0x89, 0x24, 0x4F, 0x8D,
9356b3e017eSChristian Ehrhardt		0x68, 0xF3, 0x10, 0x39, 0x0A, 0xEE, 0x45, 0x24,
9366b3e017eSChristian Ehrhardt		0xDF, 0x7A, 0x9D, 0x00, 0x25, 0xE5, 0x35, 0x71,
9376b3e017eSChristian Ehrhardt		0x4E, 0x40, 0x59, 0x6F, 0x0A, 0x13, 0xB3, 0x72,
9386b3e017eSChristian Ehrhardt		0x1D, 0x98, 0x63, 0x94, 0x89, 0xA5, 0x39, 0x8E,
9396b3e017eSChristian Ehrhardt		0xD3, 0x9C, 0x8A, 0x7F, 0x71, 0x2F, 0xC7, 0xCD,
9406b3e017eSChristian Ehrhardt		0x81, 0x05, 0xDC, 0xC0, 0x8D, 0xCE, 0x6D, 0x18,
9416b3e017eSChristian Ehrhardt		0x30, 0xC4, 0x72, 0x51, 0xF0, 0x27, 0xC8, 0xF6,
9426b3e017eSChristian Ehrhardt		0x60, 0x5B, 0x7C, 0xB2, 0xE3, 0x49, 0x0C, 0x29,
9436b3e017eSChristian Ehrhardt		0xC6, 0x9F, 0x39, 0x57, 0x80, 0x55, 0x24, 0x2C,
9446b3e017eSChristian Ehrhardt		0x9B, 0x0F, 0x5A, 0xB3, 0x89, 0x55, 0x31, 0x96,
9456b3e017eSChristian Ehrhardt		0x0D, 0xCD, 0xF6, 0x51, 0x03, 0x2D, 0x89, 0x26,
9466b3e017eSChristian Ehrhardt		0x74, 0x44, 0xD6, 0xE8, 0xDC, 0xEA, 0x44, 0x55,
9476b3e017eSChristian Ehrhardt		0x64, 0x71, 0x9C, 0x9F, 0x5D, 0xBA, 0x39, 0x46,
9486b3e017eSChristian Ehrhardt		0xA8, 0x17, 0xA1, 0x9C, 0x52, 0x9D, 0xBC, 0x6B,
9496b3e017eSChristian Ehrhardt		0x4A, 0x98, 0xE6, 0xEA, 0x33, 0xEC, 0x58, 0xB4,
9506b3e017eSChristian Ehrhardt		0x43, 0xF0, 0x32, 0x45, 0xA4, 0xC1, 0x55, 0xB7,
9516b3e017eSChristian Ehrhardt		0x5D, 0xB5, 0x59, 0xB2, 0xE3, 0x96, 0xFF, 0xA5,
9526b3e017eSChristian Ehrhardt		0xAF, 0xE1, 0x86, 0x1B, 0x42, 0xE6, 0x3B, 0xA0,
9536b3e017eSChristian Ehrhardt		0x90, 0x4A, 0xE8, 0x8C, 0x21, 0x7F, 0x36, 0x1E,
9546b3e017eSChristian Ehrhardt		0x5B, 0x65, 0x25, 0xD1, 0xC1, 0x5A, 0xCA, 0x3D,
9556b3e017eSChristian Ehrhardt		0x10, 0xED, 0x2D, 0x79, 0xD0, 0x0F, 0x58, 0x44,
9566b3e017eSChristian Ehrhardt		0x69, 0x81, 0xF5, 0xD4, 0xC9, 0x0F, 0x90, 0x76,
9576b3e017eSChristian Ehrhardt		0x1F, 0x54, 0xD2, 0xD5, 0x97, 0xCE, 0x2C, 0xE3,
9586b3e017eSChristian Ehrhardt		0xEF, 0xF4, 0xB7, 0xC6, 0x3A, 0x87, 0x7F, 0x83,
9596b3e017eSChristian Ehrhardt		0x2A, 0xAF, 0xCD, 0x90, 0x12, 0xA7, 0x7D, 0x85,
9606b3e017eSChristian Ehrhardt		0x1D, 0x62, 0xD3, 0x85, 0x25, 0x05, 0xDB, 0x45,
9616b3e017eSChristian Ehrhardt		0x92, 0xA3, 0xF6, 0xA2, 0xA8, 0x41, 0xE4, 0x25,
9626b3e017eSChristian Ehrhardt		0x86, 0x87, 0x67, 0x24, 0xEC, 0x89, 0x23, 0x2A,
9636b3e017eSChristian Ehrhardt		0x9B, 0x20, 0x4D, 0x93, 0xEE, 0xE2, 0x2E, 0xC1,
9646b3e017eSChristian Ehrhardt		0x0B, 0x15, 0x33, 0xCF, 0x00, 0xD1, 0x1A, 0xDA,
9656b3e017eSChristian Ehrhardt		0x93, 0xFD, 0x28, 0x21, 0x5B, 0xCF, 0xD1, 0xF3,
9666b3e017eSChristian Ehrhardt		0x5A, 0x81, 0xBA, 0x82, 0x5E, 0x2F, 0x61, 0xB4,
9676b3e017eSChristian Ehrhardt		0x05, 0x71, 0xB5, 0xF4, 0x39, 0x3C, 0x1F, 0x60,
9686b3e017eSChristian Ehrhardt		0x00, 0x7A, 0xC4, 0xF8, 0x35, 0x20, 0x6C, 0x3A,
9696b3e017eSChristian Ehrhardt		0xCC, 0x03, 0x8F, 0x7B, 0xA2, 0xB6, 0x65, 0x8A,
9706b3e017eSChristian Ehrhardt		0xB6, 0x5F, 0xFD, 0x25, 0xD3, 0x5F, 0x92, 0xF9,
9716b3e017eSChristian Ehrhardt		0xAE, 0x17, 0x9B, 0x5E, 0x6E, 0x9A, 0xE4, 0x55,
9726b3e017eSChristian Ehrhardt		0x10, 0x25, 0x07, 0xA4, 0xAF, 0x21, 0x69, 0x13,
9736b3e017eSChristian Ehrhardt		0xD8, 0xFA, 0x31, 0xED, 0xF7, 0xA7, 0xA7, 0x3B,
9746b3e017eSChristian Ehrhardt		0xB8, 0x96, 0x8E, 0x10, 0x86, 0x74, 0xD8, 0xB1,
9756b3e017eSChristian Ehrhardt		0x34, 0x9E, 0x9B, 0x6A, 0x26, 0xA8, 0xD4, 0xD0,
9766b3e017eSChristian Ehrhardt		0xB5, 0xF6, 0xDE, 0xE7, 0xCA, 0x06, 0xDC, 0xA3,
9776b3e017eSChristian Ehrhardt		0x6F, 0xEE, 0x6B, 0x1E, 0xB5, 0x30, 0x99, 0x23,
9786b3e017eSChristian Ehrhardt		0xF9, 0x76, 0xF0, 0xA0, 0xCF, 0x3B, 0x94, 0x7B,
9796b3e017eSChristian Ehrhardt		0x19, 0x8D, 0xA5, 0x0C, 0x18, 0xA6, 0x1D, 0x07,
9806b3e017eSChristian Ehrhardt		0x89, 0xBE, 0x5B, 0x61, 0xE5, 0xF1, 0x42, 0xDB,
9816b3e017eSChristian Ehrhardt		0xD4, 0x2E, 0x02, 0x1F, 0xCE, 0xEF, 0x92, 0xB1,
9826b3e017eSChristian Ehrhardt		0x1B, 0x56, 0x50, 0xF2, 0x16, 0xE5, 0xE7, 0x4F,
9836b3e017eSChristian Ehrhardt		0xFD, 0xBB, 0x3E, 0xD2, 0xFC, 0x3C, 0xC6, 0x0F,
9846b3e017eSChristian Ehrhardt		0xF9, 0x12, 0x4E, 0xCB, 0x1E, 0x0C, 0x15, 0x84,
9856b3e017eSChristian Ehrhardt		0x2A, 0x14, 0x8A, 0x02, 0xE4, 0x7E, 0x95, 0x5B,
9866b3e017eSChristian Ehrhardt		0x86, 0xDB, 0x9B, 0x62, 0x5B, 0x19, 0xD2, 0x17,
9876b3e017eSChristian Ehrhardt		0xFA, 0x13, 0xBB, 0x6B, 0x3F, 0x45, 0x9F, 0xBF
9886b3e017eSChristian Ehrhardt};
9896b3e017eSChristian Ehrhardt
9906b3e017eSChristian Ehrhardt
9916b3e017eSChristian Ehrhardtstatic  uint8_t ms_hmac_key0[] = {
9926b3e017eSChristian Ehrhardt		0xFF, 0x1A, 0x7D, 0x3D, 0xF5, 0x82, 0x80, 0xF1,
9936b3e017eSChristian Ehrhardt		0xF1, 0x35, 0x5C, 0x3B, 0xDD, 0x9A, 0x65, 0xBA,
9946b3e017eSChristian Ehrhardt		0x58, 0x34, 0x85, 0x65, 0x1C, 0x42, 0x50, 0x76,
9956b3e017eSChristian Ehrhardt		0x9A, 0xAF, 0x88, 0x1B, 0xB6, 0x8F, 0xF8, 0x60,
9966b3e017eSChristian Ehrhardt		0xA2, 0x5A, 0x7F, 0x3F, 0xF4, 0x72, 0x70, 0xF1,
9976b3e017eSChristian Ehrhardt		0xF5, 0x35, 0x4C, 0x3B, 0xDD, 0x90, 0x65, 0xB0,
9986b3e017eSChristian Ehrhardt		0x47, 0x3A, 0x75, 0x61, 0x5C, 0xA2, 0x10, 0x76,
9996b3e017eSChristian Ehrhardt		0x9A, 0xAF, 0x77, 0x5B, 0xB6, 0x7F, 0xF7, 0x60
10006b3e017eSChristian Ehrhardt};
10016b3e017eSChristian Ehrhardt
10026b3e017eSChristian Ehrhardtstatic const uint8_t ms_hmac_digest0[] = {
10036b3e017eSChristian Ehrhardt		0x43, 0x52, 0xED, 0x34, 0xAB, 0x36, 0xB2, 0x51,
10046b3e017eSChristian Ehrhardt		0xFB, 0xA3, 0xA6, 0x7C, 0x38, 0xFC, 0x42, 0x8F,
10056b3e017eSChristian Ehrhardt		0x57, 0x64, 0xAB, 0x81, 0xA7, 0x89, 0xB7, 0x6C,
10066b3e017eSChristian Ehrhardt		0xA0, 0xDC, 0xB9, 0x4D, 0xC4, 0x30, 0xF9, 0xD4,
10076b3e017eSChristian Ehrhardt		0x10, 0x82, 0x55, 0xD0, 0xAB, 0x32, 0xFB, 0x56,
10086b3e017eSChristian Ehrhardt		0x0D, 0xE4, 0x68, 0x3D, 0x76, 0xD0, 0x7B, 0xE4,
10096b3e017eSChristian Ehrhardt		0xA6, 0x2C, 0x34, 0x9E, 0x8C, 0x41, 0xF8, 0x23,
10106b3e017eSChristian Ehrhardt		0x28, 0x1B, 0x3A, 0x90, 0x26, 0x34, 0x47, 0x90
10116b3e017eSChristian Ehrhardt		};
10126b3e017eSChristian Ehrhardt
10136b3e017eSChristian Ehrhardt/* End Session 0 */
10146b3e017eSChristian Ehrhardt/* Begin session 1 */
10156b3e017eSChristian Ehrhardt
10166b3e017eSChristian Ehrhardtstatic  uint8_t ms_aes_cbc_key1[] = {
10176b3e017eSChristian Ehrhardt		0xf1, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
10186b3e017eSChristian Ehrhardt		0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff