-/* $OpenBSD: ec_curve.c,v 1.33 2023/05/01 13:14:00 tb Exp $ */
+/* $OpenBSD: ec_curve.c,v 1.34 2023/05/01 13:49:26 tb Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
#include "ec_local.h"
typedef struct {
- int field_type;
int seed_len;
int param_len;
unsigned int cofactor; /* promoted to BN_ULONG */
}
_EC_NIST_PRIME_192 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 20,
.param_len = 24,
.cofactor = 1,
}
_EC_NIST_PRIME_224 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 20,
.param_len = 28,
.cofactor = 1,
}
_EC_NIST_PRIME_384 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 20,
.param_len = 48,
.cofactor = 1,
}
_EC_NIST_PRIME_521 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 20,
.param_len = 66,
.cofactor = 1,
}
_EC_X9_62_PRIME_192V2 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 20,
.param_len = 24,
.cofactor = 1,
}
_EC_X9_62_PRIME_192V3 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 20,
.param_len = 24,
.cofactor = 1,
}
_EC_X9_62_PRIME_239V1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 20,
.param_len = 30,
.cofactor = 1,
}
_EC_X9_62_PRIME_239V2 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 20,
.param_len = 30,
.cofactor = 1,
}
_EC_X9_62_PRIME_239V3 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 20,
.param_len = 30,
.cofactor = 1,
}
_EC_X9_62_PRIME_256V1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 20,
.param_len = 32,
.cofactor = 1,
}
_EC_SECG_PRIME_112R1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 20,
.param_len = 14,
.cofactor = 1,
}
_EC_SECG_PRIME_112R2 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 20,
.param_len = 14,
.cofactor = 4,
}
_EC_SECG_PRIME_128R1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 20,
.param_len = 16,
.cofactor = 1,
}
_EC_SECG_PRIME_128R2 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 20,
.param_len = 16,
.cofactor = 4,
}
_EC_SECG_PRIME_160K1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 21,
.cofactor = 1,
}
_EC_SECG_PRIME_160R1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 20,
.param_len = 21,
.cofactor = 1,
}
_EC_SECG_PRIME_160R2 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 20,
.param_len = 21,
.cofactor = 1,
}
_EC_SECG_PRIME_192K1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 24,
.cofactor = 1,
}
_EC_SECG_PRIME_224K1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 29,
.cofactor = 1,
}
_EC_SECG_PRIME_256K1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 32,
.cofactor = 1,
}
_EC_WTLS_8 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 15,
.cofactor = 1,
}
_EC_WTLS_9 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 21,
.cofactor = 1,
}
_EC_WTLS_12 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 28,
.cofactor = 1,
}
_EC_brainpoolP160r1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 20,
.cofactor = 1,
}
_EC_brainpoolP160t1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 20,
.cofactor = 1,
}
_EC_brainpoolP192r1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 24,
.cofactor = 1,
}
_EC_brainpoolP192t1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 24,
.cofactor = 1,
}
_EC_brainpoolP224r1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 28,
.cofactor = 1,
}
_EC_brainpoolP224t1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 28,
.cofactor = 1,
}
_EC_brainpoolP256r1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 32,
.cofactor = 1,
}
_EC_brainpoolP256t1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 32,
.cofactor = 1,
}
_EC_brainpoolP320r1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 40,
.cofactor = 1,
}
_EC_brainpoolP320t1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 40,
.cofactor = 1,
}
_EC_brainpoolP384r1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 48,
.cofactor = 1,
}
_EC_brainpoolP384t1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 48,
.cofactor = 1,
}
_EC_brainpoolP512r1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 64,
.cofactor = 1,
}
_EC_brainpoolP512t1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 64,
.cofactor = 1,
}
_EC_FRP256v1 = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 32,
.cofactor = 1,
}
_EC_GOST_2001_Test = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 32,
.cofactor = 1,
}
_EC_GOST_2001_CryptoPro_A = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 32,
.cofactor = 1,
}
_EC_GOST_2001_CryptoPro_B = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 32,
.cofactor = 1,
}
_EC_GOST_2001_CryptoPro_C = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 32,
.cofactor = 1,
}
_EC_GOST_2012_256_TC26_A = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 32,
.cofactor = 4,
}
_EC_GOST_2012_512_Test = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 64,
.cofactor = 1,
}
_EC_GOST_2012_512_TC26_A = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 64,
.cofactor = 1,
}
_EC_GOST_2012_512_TC26_B = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 64,
.cofactor = 1,
}
_EC_GOST_2012_512_TC26_C = {
{
- .field_type = NID_X9_62_prime_field,
.seed_len = 0,
.param_len = 64,
.cofactor = 4,
ECerror(ERR_R_BN_LIB);
goto err;
}
- if (data->field_type == NID_X9_62_prime_field) {
- if ((group = EC_GROUP_new_curve_GFp(p, a, b, ctx)) == NULL) {
- ECerror(ERR_R_EC_LIB);
- goto err;
- }
+ if ((group = EC_GROUP_new_curve_GFp(p, a, b, ctx)) == NULL) {
+ ECerror(ERR_R_EC_LIB);
+ goto err;
}
if ((P = EC_POINT_new(group)) == NULL) {