diff options
author | Richard Levitte <levitte@openssl.org> | 2021-01-27 14:55:28 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2021-02-03 17:20:56 +0100 |
commit | 9db6af922c48c5cab5398ef9f37e425e382f9440 (patch) | |
tree | 79dca1b5db60bb0f61dfc9c9f86f1161b7a2b15d | |
parent | 977e95b912138d02bae86d829a990d81c2bbcca0 (diff) |
EC: Reverse the default asn1_flag in a new EC_GROUP
The default was OPENSSL_EC_NAMED_CURVE, but that's not true until a
curve name has been set, so we change the initial value to
OPENSSL_EC_EXPLICIT_CURVE and let EC_GROUP_set_curve_name() change it
to OPENSSL_EC_NAMED_CURVE.
Submitted by Matt Caswell
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13973)
-rw-r--r-- | crypto/ec/ec_lib.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c index 325e11f9f1..71cb45ca19 100644 --- a/crypto/ec/ec_lib.c +++ b/crypto/ec/ec_lib.c @@ -63,7 +63,7 @@ EC_GROUP *ec_group_new_ex(OSSL_LIB_CTX *libctx, const char *propq, if (ret->cofactor == NULL) goto err; } - ret->asn1_flag = OPENSSL_EC_NAMED_CURVE; + ret->asn1_flag = OPENSSL_EC_EXPLICIT_CURVE; ret->asn1_form = POINT_CONVERSION_UNCOMPRESSED; if (!meth->group_init(ret)) goto err; @@ -481,6 +481,10 @@ const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group) void EC_GROUP_set_curve_name(EC_GROUP *group, int nid) { group->curve_name = nid; + group->asn1_flag = + (nid != NID_undef) + ? OPENSSL_EC_NAMED_CURVE + : OPENSSL_EC_EXPLICIT_CURVE; } int EC_GROUP_get_curve_name(const EC_GROUP *group) |