Skip to content

Commit f6f9bdd

Browse files
Add EC seed functions as deprecated no-ops (#1674)
Ruby exposes the `EC_GROUP` seed functions and allows you to set the seed with `EC_GROUP_set_seed`. It's one thing that are `EC_GROUP`s are static and immutable, but setting the seed is more prevalent to custom curves. We don't encourage using custom curves, so I've chose to mark it as a no-op and deprecated. We could arguably support `EC_GROUP_get0_seed` and `EC_GROUP_get_seed_len` for our named curves, but the seed value is only used during the initial curve parameter generation. We've chosen to mark this as a no-op for now, implementing them creates additional complexity that doesn't really provide additional value to the consumer. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.
1 parent 21c5e48 commit f6f9bdd

File tree

2 files changed

+29
-7
lines changed
  • crypto/fipsmodule/ec
  • include/openssl

2 files changed

+29
-7
lines changed

crypto/fipsmodule/ec/ec.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,3 +1093,12 @@ void EC_GROUP_set_point_conversion_form(EC_GROUP *group,
10931093
abort();
10941094
}
10951095
}
1096+
1097+
size_t EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *seed,
1098+
size_t len) {
1099+
return 0;
1100+
}
1101+
1102+
unsigned char *EC_GROUP_get0_seed(const EC_GROUP *group) { return NULL; }
1103+
1104+
size_t EC_GROUP_get_seed_len(const EC_GROUP *group) { return 0; }

include/openssl/ec.h

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ OPENSSL_EXPORT const char *EC_curve_nid2nist(int nid);
190190
// it returns |NID_X9_62_prime256v1| for "P-256".
191191
OPENSSL_EXPORT int EC_curve_nist2nid(const char *name);
192192

193-
194193
// Points on elliptic curves.
195194

196195
// EC_POINT_new returns a fresh |EC_POINT| object in the given group, or NULL
@@ -428,25 +427,39 @@ OPENSSL_EXPORT size_t EC_get_builtin_curves(EC_builtin_curve *out_curves,
428427
OPENSSL_EXPORT void EC_POINT_clear_free(EC_POINT *point);
429428

430429

431-
// General No-op Functions [Deprecated].
430+
// |EC_GROUP| No-op Functions [Deprecated].
432431

433-
// EC_GROUP_set_asn1_flag does nothing. AWS-LC only supports
434-
// |OPENSSL_EC_NAMED_CURVE|.
432+
// EC_GROUP_set_asn1_flag does nothing.
435433
OPENSSL_EXPORT OPENSSL_DEPRECATED void EC_GROUP_set_asn1_flag(EC_GROUP *group,
436434
int flag);
437435

438-
// EC_GROUP_get_asn1_flag returns |OPENSSL_EC_NAMED_CURVE|. This is the only
439-
// type AWS-LC supports.
436+
// EC_GROUP_get_asn1_flag returns |OPENSSL_EC_NAMED_CURVE|.
440437
OPENSSL_EXPORT OPENSSL_DEPRECATED int EC_GROUP_get_asn1_flag(
441438
const EC_GROUP *group);
442439

443440
// EC_GROUP_set_point_conversion_form aborts the process if |form| is not
444441
// |POINT_CONVERSION_UNCOMPRESSED| or |POINT_CONVERSION_COMPRESSED|, and
445442
// otherwise does nothing.
446-
// AWS-LC always uses |POINT_CONVERSION_UNCOMPRESSED|.
447443
OPENSSL_EXPORT OPENSSL_DEPRECATED void EC_GROUP_set_point_conversion_form(
448444
EC_GROUP *group, point_conversion_form_t form);
449445

446+
// EC_GROUP_set_seed does nothing and returns 0.
447+
//
448+
// Like OpenSSL's EC documentations indicates, the value of the seed is not used
449+
// in any cryptographic methods. It is only used to indicate the original seed
450+
// used to generate the curve's parameters and is preserved during ASN.1
451+
// communications. Please refrain from creating your own custom curves.
452+
OPENSSL_EXPORT OPENSSL_DEPRECATED size_t
453+
EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *p, size_t len);
454+
455+
// EC_GROUP_get0_seed returns NULL.
456+
OPENSSL_EXPORT OPENSSL_DEPRECATED unsigned char *EC_GROUP_get0_seed(
457+
const EC_GROUP *group);
458+
459+
// EC_GROUP_get_seed_len returns 0.
460+
OPENSSL_EXPORT OPENSSL_DEPRECATED size_t
461+
EC_GROUP_get_seed_len(const EC_GROUP *group);
462+
450463

451464
// EC_METHOD No-ops [Deprecated].
452465
//

0 commit comments

Comments
 (0)