#include <libecc/lib_ecc_config.h>
#ifdef WITH_CURVE_BRAINPOOLP384T1

#ifndef __EC_PARAMS_BRAINPOOLP384T1_H__
#define __EC_PARAMS_BRAINPOOLP384T1_H__
#include <libecc/curves/known/ec_params_external.h>
static const u8 brainpoolp384t1_p[] = {
	0x8c, 0xb9, 0x1e, 0x82, 0xa3, 0x38, 0x6d, 0x28,
	0x0f, 0x5d, 0x6f, 0x7e, 0x50, 0xe6, 0x41, 0xdf,
	0x15, 0x2f, 0x71, 0x09, 0xed, 0x54, 0x56, 0xb4,
	0x12, 0xb1, 0xda, 0x19, 0x7f, 0xb7, 0x11, 0x23,
	0xac, 0xd3, 0xa7, 0x29, 0x90, 0x1d, 0x1a, 0x71,
	0x87, 0x47, 0x00, 0x13, 0x31, 0x07, 0xec, 0x53,
};

TO_EC_STR_PARAM(brainpoolp384t1_p);

#define CURVE_BRAINPOOLP384T1_P_BITLEN 384
static const u8 brainpoolp384t1_p_bitlen[] = {
	0x01, 0x80,
};

TO_EC_STR_PARAM(brainpoolp384t1_p_bitlen);

#if (WORD_BYTES == 8)     /* 64-bit words */
static const u8 brainpoolp384t1_r[] = {
	0x73, 0x46, 0xe1, 0x7d, 0x5c, 0xc7, 0x92, 0xd7,
	0xf0, 0xa2, 0x90, 0x81, 0xaf, 0x19, 0xbe, 0x20,
	0xea, 0xd0, 0x8e, 0xf6, 0x12, 0xab, 0xa9, 0x4b,
	0xed, 0x4e, 0x25, 0xe6, 0x80, 0x48, 0xee, 0xdc,
	0x53, 0x2c, 0x58, 0xd6, 0x6f, 0xe2, 0xe5, 0x8e,
	0x78, 0xb8, 0xff, 0xec, 0xce, 0xf8, 0x13, 0xad,
};

TO_EC_STR_PARAM(brainpoolp384t1_r);

static const u8 brainpoolp384t1_r_square[] = {
	0x36, 0xbf, 0x68, 0x83, 0x17, 0x8d, 0xf8, 0x42,
	0xd5, 0xc6, 0xef, 0x3b, 0xa5, 0x7e, 0x05, 0x2c,
	0x62, 0x14, 0x01, 0x91, 0x99, 0x18, 0xd5, 0xaf,
	0x8e, 0x28, 0xf9, 0x9c, 0xc9, 0x94, 0x08, 0x99,
	0x53, 0x52, 0x83, 0x34, 0x3d, 0x7f, 0xd9, 0x65,
	0x08, 0x7c, 0xef, 0xff, 0x40, 0xb6, 0x4b, 0xde,
};

TO_EC_STR_PARAM(brainpoolp384t1_r_square);

static const u8 brainpoolp384t1_mpinv[] = {
	0x9a, 0x6e, 0xa9, 0x6c, 0xea, 0x9e, 0xc8, 0x25,
};

TO_EC_STR_PARAM(brainpoolp384t1_mpinv);

static const u8 brainpoolp384t1_p_shift[] = {
	0x00,
};

TO_EC_STR_PARAM(brainpoolp384t1_p_shift);

static const u8 brainpoolp384t1_p_normalized[] = {
	0x8c, 0xb9, 0x1e, 0x82, 0xa3, 0x38, 0x6d, 0x28,
	0x0f, 0x5d, 0x6f, 0x7e, 0x50, 0xe6, 0x41, 0xdf,
	0x15, 0x2f, 0x71, 0x09, 0xed, 0x54, 0x56, 0xb4,
	0x12, 0xb1, 0xda, 0x19, 0x7f, 0xb7, 0x11, 0x23,
	0xac, 0xd3, 0xa7, 0x29, 0x90, 0x1d, 0x1a, 0x71,
	0x87, 0x47, 0x00, 0x13, 0x31, 0x07, 0xec, 0x53,
};

TO_EC_STR_PARAM(brainpoolp384t1_p_normalized);

static const u8 brainpoolp384t1_p_reciprocal[] = {
	0xd1, 0xb5, 0x75, 0xb1, 0x6d, 0x8e, 0xc6, 0xb8,
};

TO_EC_STR_PARAM(brainpoolp384t1_p_reciprocal);

#elif (WORD_BYTES == 4)   /* 32-bit words */
static const u8 brainpoolp384t1_r[] = {
	0x73, 0x46, 0xe1, 0x7d, 0x5c, 0xc7, 0x92, 0xd7,
	0xf0, 0xa2, 0x90, 0x81, 0xaf, 0x19, 0xbe, 0x20,
	0xea, 0xd0, 0x8e, 0xf6, 0x12, 0xab, 0xa9, 0x4b,
	0xed, 0x4e, 0x25, 0xe6, 0x80, 0x48, 0xee, 0xdc,
	0x53, 0x2c, 0x58, 0xd6, 0x6f, 0xe2, 0xe5, 0x8e,
	0x78, 0xb8, 0xff, 0xec, 0xce, 0xf8, 0x13, 0xad,
};

TO_EC_STR_PARAM(brainpoolp384t1_r);

static const u8 brainpoolp384t1_r_square[] = {
	0x36, 0xbf, 0x68, 0x83, 0x17, 0x8d, 0xf8, 0x42,
	0xd5, 0xc6, 0xef, 0x3b, 0xa5, 0x7e, 0x05, 0x2c,
	0x62, 0x14, 0x01, 0x91, 0x99, 0x18, 0xd5, 0xaf,
	0x8e, 0x28, 0xf9, 0x9c, 0xc9, 0x94, 0x08, 0x99,
	0x53, 0x52, 0x83, 0x34, 0x3d, 0x7f, 0xd9, 0x65,
	0x08, 0x7c, 0xef, 0xff, 0x40, 0xb6, 0x4b, 0xde,
};

TO_EC_STR_PARAM(brainpoolp384t1_r_square);

static const u8 brainpoolp384t1_mpinv[] = {
	0xea, 0x9e, 0xc8, 0x25,
};

TO_EC_STR_PARAM(brainpoolp384t1_mpinv);

static const u8 brainpoolp384t1_p_shift[] = {
	0x00,
};

TO_EC_STR_PARAM(brainpoolp384t1_p_shift);

static const u8 brainpoolp384t1_p_normalized[] = {
	0x8c, 0xb9, 0x1e, 0x82, 0xa3, 0x38, 0x6d, 0x28,
	0x0f, 0x5d, 0x6f, 0x7e, 0x50, 0xe6, 0x41, 0xdf,
	0x15, 0x2f, 0x71, 0x09, 0xed, 0x54, 0x56, 0xb4,
	0x12, 0xb1, 0xda, 0x19, 0x7f, 0xb7, 0x11, 0x23,
	0xac, 0xd3, 0xa7, 0x29, 0x90, 0x1d, 0x1a, 0x71,
	0x87, 0x47, 0x00, 0x13, 0x31, 0x07, 0xec, 0x53,
};

TO_EC_STR_PARAM(brainpoolp384t1_p_normalized);

static const u8 brainpoolp384t1_p_reciprocal[] = {
	0xd1, 0xb5, 0x75, 0xb1,
};

TO_EC_STR_PARAM(brainpoolp384t1_p_reciprocal);

#elif (WORD_BYTES == 2)   /* 16-bit words */
static const u8 brainpoolp384t1_r[] = {
	0x73, 0x46, 0xe1, 0x7d, 0x5c, 0xc7, 0x92, 0xd7,
	0xf0, 0xa2, 0x90, 0x81, 0xaf, 0x19, 0xbe, 0x20,
	0xea, 0xd0, 0x8e, 0xf6, 0x12, 0xab, 0xa9, 0x4b,
	0xed, 0x4e, 0x25, 0xe6, 0x80, 0x48, 0xee, 0xdc,
	0x53, 0x2c, 0x58, 0xd6, 0x6f, 0xe2, 0xe5, 0x8e,
	0x78, 0xb8, 0xff, 0xec, 0xce, 0xf8, 0x13, 0xad,
};

TO_EC_STR_PARAM(brainpoolp384t1_r);

static const u8 brainpoolp384t1_r_square[] = {
	0x36, 0xbf, 0x68, 0x83, 0x17, 0x8d, 0xf8, 0x42,
	0xd5, 0xc6, 0xef, 0x3b, 0xa5, 0x7e, 0x05, 0x2c,
	0x62, 0x14, 0x01, 0x91, 0x99, 0x18, 0xd5, 0xaf,
	0x8e, 0x28, 0xf9, 0x9c, 0xc9, 0x94, 0x08, 0x99,
	0x53, 0x52, 0x83, 0x34, 0x3d, 0x7f, 0xd9, 0x65,
	0x08, 0x7c, 0xef, 0xff, 0x40, 0xb6, 0x4b, 0xde,
};

TO_EC_STR_PARAM(brainpoolp384t1_r_square);

static const u8 brainpoolp384t1_mpinv[] = {
	0xc8, 0x25,
};

TO_EC_STR_PARAM(brainpoolp384t1_mpinv);

static const u8 brainpoolp384t1_p_shift[] = {
	0x00,
};

TO_EC_STR_PARAM(brainpoolp384t1_p_shift);

static const u8 brainpoolp384t1_p_normalized[] = {
	0x8c, 0xb9, 0x1e, 0x82, 0xa3, 0x38, 0x6d, 0x28,
	0x0f, 0x5d, 0x6f, 0x7e, 0x50, 0xe6, 0x41, 0xdf,
	0x15, 0x2f, 0x71, 0x09, 0xed, 0x54, 0x56, 0xb4,
	0x12, 0xb1, 0xda, 0x19, 0x7f, 0xb7, 0x11, 0x23,
	0xac, 0xd3, 0xa7, 0x29, 0x90, 0x1d, 0x1a, 0x71,
	0x87, 0x47, 0x00, 0x13, 0x31, 0x07, 0xec, 0x53,
};

TO_EC_STR_PARAM(brainpoolp384t1_p_normalized);

static const u8 brainpoolp384t1_p_reciprocal[] = {
	0xd1, 0xb5,
};

TO_EC_STR_PARAM(brainpoolp384t1_p_reciprocal);

#else                     /* unknown word size */
#error "Unsupported word size"
#endif

static const u8 brainpoolp384t1_a[] = {
	0x8c, 0xb9, 0x1e, 0x82, 0xa3, 0x38, 0x6d, 0x28,
	0x0f, 0x5d, 0x6f, 0x7e, 0x50, 0xe6, 0x41, 0xdf,
	0x15, 0x2f, 0x71, 0x09, 0xed, 0x54, 0x56, 0xb4,
	0x12, 0xb1, 0xda, 0x19, 0x7f, 0xb7, 0x11, 0x23,
	0xac, 0xd3, 0xa7, 0x29, 0x90, 0x1d, 0x1a, 0x71,
	0x87, 0x47, 0x00, 0x13, 0x31, 0x07, 0xec, 0x50,
};

TO_EC_STR_PARAM(brainpoolp384t1_a);

static const u8 brainpoolp384t1_b[] = {
	0x7f, 0x51, 0x9e, 0xad, 0xa7, 0xbd, 0xa8, 0x1b,
	0xd8, 0x26, 0xdb, 0xa6, 0x47, 0x91, 0x0f, 0x8c,
	0x4b, 0x93, 0x46, 0xed, 0x8c, 0xcd, 0xc6, 0x4e,
	0x4b, 0x1a, 0xbd, 0x11, 0x75, 0x6d, 0xce, 0x1d,
	0x20, 0x74, 0xaa, 0x26, 0x3b, 0x88, 0x80, 0x5c,
	0xed, 0x70, 0x35, 0x5a, 0x33, 0xb4, 0x71, 0xee,
};

TO_EC_STR_PARAM(brainpoolp384t1_b);

#define CURVE_BRAINPOOLP384T1_CURVE_ORDER_BITLEN 384
static const u8 brainpoolp384t1_curve_order[] = {
	0x8c, 0xb9, 0x1e, 0x82, 0xa3, 0x38, 0x6d, 0x28,
	0x0f, 0x5d, 0x6f, 0x7e, 0x50, 0xe6, 0x41, 0xdf,
	0x15, 0x2f, 0x71, 0x09, 0xed, 0x54, 0x56, 0xb3,
	0x1f, 0x16, 0x6e, 0x6c, 0xac, 0x04, 0x25, 0xa7,
	0xcf, 0x3a, 0xb6, 0xaf, 0x6b, 0x7f, 0xc3, 0x10,
	0x3b, 0x88, 0x32, 0x02, 0xe9, 0x04, 0x65, 0x65,
};

TO_EC_STR_PARAM(brainpoolp384t1_curve_order);

static const u8 brainpoolp384t1_gx[] = {
	0x18, 0xde, 0x98, 0xb0, 0x2d, 0xb9, 0xa3, 0x06,
	0xf2, 0xaf, 0xcd, 0x72, 0x35, 0xf7, 0x2a, 0x81,
	0x9b, 0x80, 0xab, 0x12, 0xeb, 0xd6, 0x53, 0x17,
	0x24, 0x76, 0xfe, 0xcd, 0x46, 0x2a, 0xab, 0xff,
	0xc4, 0xff, 0x19, 0x1b, 0x94, 0x6a, 0x5f, 0x54,
	0xd8, 0xd0, 0xaa, 0x2f, 0x41, 0x88, 0x08, 0xcc,
};

TO_EC_STR_PARAM(brainpoolp384t1_gx);

static const u8 brainpoolp384t1_gy[] = {
	0x25, 0xab, 0x05, 0x69, 0x62, 0xd3, 0x06, 0x51,
	0xa1, 0x14, 0xaf, 0xd2, 0x75, 0x5a, 0xd3, 0x36,
	0x74, 0x7f, 0x93, 0x47, 0x5b, 0x7a, 0x1f, 0xca,
	0x3b, 0x88, 0xf2, 0xb6, 0xa2, 0x08, 0xcc, 0xfe,
	0x46, 0x94, 0x08, 0x58, 0x4d, 0xc2, 0xb2, 0x91,
	0x26, 0x75, 0xbf, 0x5b, 0x9e, 0x58, 0x29, 0x28,
};

TO_EC_STR_PARAM(brainpoolp384t1_gy);

static const u8 brainpoolp384t1_gz[] = {
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
};

TO_EC_STR_PARAM(brainpoolp384t1_gz);

static const u8 brainpoolp384t1_gen_order[] = {
	0x8c, 0xb9, 0x1e, 0x82, 0xa3, 0x38, 0x6d, 0x28,
	0x0f, 0x5d, 0x6f, 0x7e, 0x50, 0xe6, 0x41, 0xdf,
	0x15, 0x2f, 0x71, 0x09, 0xed, 0x54, 0x56, 0xb3,
	0x1f, 0x16, 0x6e, 0x6c, 0xac, 0x04, 0x25, 0xa7,
	0xcf, 0x3a, 0xb6, 0xaf, 0x6b, 0x7f, 0xc3, 0x10,
	0x3b, 0x88, 0x32, 0x02, 0xe9, 0x04, 0x65, 0x65,
};

TO_EC_STR_PARAM(brainpoolp384t1_gen_order);

#define CURVE_BRAINPOOLP384T1_Q_BITLEN 384
static const u8 brainpoolp384t1_gen_order_bitlen[] = {
	0x01, 0x80,
};

TO_EC_STR_PARAM(brainpoolp384t1_gen_order_bitlen);

static const u8 brainpoolp384t1_cofactor[] = {
	0x01,
};

TO_EC_STR_PARAM(brainpoolp384t1_cofactor);

static const u8 brainpoolp384t1_alpha_montgomery[] = {
	0x00,
};
TO_EC_STR_PARAM_FIXED_SIZE(brainpoolp384t1_alpha_montgomery, 0);

static const u8 brainpoolp384t1_gamma_montgomery[] = {
	0x00,
};
TO_EC_STR_PARAM_FIXED_SIZE(brainpoolp384t1_gamma_montgomery, 0);

static const u8 brainpoolp384t1_alpha_edwards[] = {
	0x00,
};
TO_EC_STR_PARAM_FIXED_SIZE(brainpoolp384t1_alpha_edwards, 0);

static const u8 brainpoolp384t1_name[] = "BRAINPOOLP384T1";
TO_EC_STR_PARAM(brainpoolp384t1_name);

static const u8 brainpoolp384t1_oid[] = "1.3.36.3.3.2.8.1.1.12";
TO_EC_STR_PARAM(brainpoolp384t1_oid);

static const ec_str_params brainpoolp384t1_str_params = {
	.p = &brainpoolp384t1_p_str_param,
	.p_bitlen = &brainpoolp384t1_p_bitlen_str_param,
	.r = &brainpoolp384t1_r_str_param,
	.r_square = &brainpoolp384t1_r_square_str_param,
	.mpinv = &brainpoolp384t1_mpinv_str_param,
	.p_shift = &brainpoolp384t1_p_shift_str_param,
	.p_normalized = &brainpoolp384t1_p_normalized_str_param,
	.p_reciprocal = &brainpoolp384t1_p_reciprocal_str_param,
	.a = &brainpoolp384t1_a_str_param,
	.b = &brainpoolp384t1_b_str_param,
	.curve_order = &brainpoolp384t1_curve_order_str_param,
	.gx = &brainpoolp384t1_gx_str_param,
	.gy = &brainpoolp384t1_gy_str_param,
	.gz = &brainpoolp384t1_gz_str_param,
	.gen_order = &brainpoolp384t1_gen_order_str_param,
	.gen_order_bitlen = &brainpoolp384t1_gen_order_bitlen_str_param,
	.cofactor = &brainpoolp384t1_cofactor_str_param,
	.alpha_montgomery = &brainpoolp384t1_alpha_montgomery_str_param,
	.gamma_montgomery = &brainpoolp384t1_gamma_montgomery_str_param,
	.alpha_edwards = &brainpoolp384t1_alpha_edwards_str_param,
	.oid = &brainpoolp384t1_oid_str_param,
	.name = &brainpoolp384t1_name_str_param,
};

/*
 * Compute max bit length of all curves for p and q
 */
#ifndef CURVES_MAX_P_BIT_LEN
#define CURVES_MAX_P_BIT_LEN    0
#endif
#if (CURVES_MAX_P_BIT_LEN < CURVE_BRAINPOOLP384T1_P_BITLEN)
#undef CURVES_MAX_P_BIT_LEN
#define CURVES_MAX_P_BIT_LEN CURVE_BRAINPOOLP384T1_P_BITLEN
#endif
#ifndef CURVES_MAX_Q_BIT_LEN
#define CURVES_MAX_Q_BIT_LEN    0
#endif
#if (CURVES_MAX_Q_BIT_LEN < CURVE_BRAINPOOLP384T1_Q_BITLEN)
#undef CURVES_MAX_Q_BIT_LEN
#define CURVES_MAX_Q_BIT_LEN CURVE_BRAINPOOLP384T1_Q_BITLEN
#endif
#ifndef CURVES_MAX_CURVE_ORDER_BIT_LEN
#define CURVES_MAX_CURVE_ORDER_BIT_LEN    0
#endif
#if (CURVES_MAX_CURVE_ORDER_BIT_LEN < CURVE_BRAINPOOLP384T1_CURVE_ORDER_BITLEN)
#undef CURVES_MAX_CURVE_ORDER_BIT_LEN
#define CURVES_MAX_CURVE_ORDER_BIT_LEN CURVE_BRAINPOOLP384T1_CURVE_ORDER_BITLEN
#endif

/*
 * Compute and adapt max name and oid length
 */
#ifndef MAX_CURVE_OID_LEN
#define MAX_CURVE_OID_LEN 0
#endif
#ifndef MAX_CURVE_NAME_LEN
#define MAX_CURVE_NAME_LEN 0
#endif
#if (MAX_CURVE_OID_LEN < 1)
#undef MAX_CURVE_OID_LEN
#define MAX_CURVE_OID_LEN 1
#endif
#if (MAX_CURVE_NAME_LEN < 29)
#undef MAX_CURVE_NAME_LEN
#define MAX_CURVE_NAME_LEN 29
#endif

#endif /* __EC_PARAMS_BRAINPOOLP384T1_H__ */

#endif /* WITH_CURVE_BRAINPOOLP384T1 */
