From 0a4d30f7edc0f2ea45a8c403587f0e7ad064547c Mon Sep 17 00:00:00 2001 From: tb <> Date: Sun, 12 Sep 2021 16:23:19 +0000 Subject: Default to using named curve parameter encoding The pre-OpenSSL 1.1.0 default was to use explicit curve parameter encoding. Most applications want to use named curve parameter encoding and have to opt into this explicitly. Stephen Henson changed this default in OpenSSL commit 86f300d3 6 years ago and provided a new OPENSSL_EC_EXPLICIT_CURVE define to opt back into the old default. According to Debian's codesearch, no application currently does this, which indicates that we currently have a bad default. In the future it is more likely that applications expect the new default, so we follow OpenSSL to avoid problems. Prompted by schwarze who noted that OPENSSL_EC_EXPLICIT_CURVE is missing. ok beck inoguchi jsing --- src/lib/libcrypto/ec/ec.h | 5 +++-- src/lib/libcrypto/ec/ec_lib.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/libcrypto/ec/ec.h b/src/lib/libcrypto/ec/ec.h index fc70a1eba9..d8ff42c0c9 100644 --- a/src/lib/libcrypto/ec/ec.h +++ b/src/lib/libcrypto/ec/ec.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ec.h,v 1.26 2021/09/10 14:35:36 tb Exp $ */ +/* $OpenBSD: ec.h,v 1.27 2021/09/12 16:23:19 tb Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -708,7 +708,8 @@ int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, unsigned int *k2, unsigned int *k3); #endif -#define OPENSSL_EC_NAMED_CURVE 0x001 +#define OPENSSL_EC_EXPLICIT_CURVE 0x000 +#define OPENSSL_EC_NAMED_CURVE 0x001 typedef struct ecpk_parameters_st ECPKPARAMETERS; diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index 994fd2d4c1..7cc69f8154 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_lib.c,v 1.40 2021/09/08 17:29:21 tb Exp $ */ +/* $OpenBSD: ec_lib.c,v 1.41 2021/09/12 16:23:19 tb Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -100,7 +100,7 @@ EC_GROUP_new(const EC_METHOD * meth) BN_init(&ret->cofactor); ret->curve_name = 0; - ret->asn1_flag = 0; + ret->asn1_flag = OPENSSL_EC_NAMED_CURVE; ret->asn1_form = POINT_CONVERSION_UNCOMPRESSED; ret->seed = NULL; -- cgit v1.2.3-55-g6feb