diff options
author | tb <> | 2021-04-20 17:04:13 +0000 |
---|---|---|
committer | tb <> | 2021-04-20 17:04:13 +0000 |
commit | 05c3c8fff8c081d09d5d0feb2306a16cd2b9f6f7 (patch) | |
tree | 173c34f3f2e636d34625fd1b38effccf5db6b71f /src/lib/libcrypto/ec/ec.h | |
parent | c1737c38418f1a215997d19f2ff6dd2977f52430 (diff) | |
download | openbsd-05c3c8fff8c081d09d5d0feb2306a16cd2b9f6f7.tar.gz openbsd-05c3c8fff8c081d09d5d0feb2306a16cd2b9f6f7.tar.bz2 openbsd-05c3c8fff8c081d09d5d0feb2306a16cd2b9f6f7.zip |
Prepare to provide EC_GROUP_{get,set}_curve(3)
There are numerous functions in ec/ that exist with _GF2m and _GFp
variants for no good reason. The code of both variants is the same.
The EC_METHODs contain a pointer to the appropriate version. This
commit hides the _GF2m and _GFp variants from internal use and
provides versions that work for both curve types. These will be made
public in an upcoming library bump.
Similar to part of OpenSSL commit 8e3cced75fb5fee5da59ebef9605d403a999391b
ok jsing
Diffstat (limited to 'src/lib/libcrypto/ec/ec.h')
-rw-r--r-- | src/lib/libcrypto/ec/ec.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/libcrypto/ec/ec.h b/src/lib/libcrypto/ec/ec.h index a95d99f6a9..a6ae3e3ac3 100644 --- a/src/lib/libcrypto/ec/ec.h +++ b/src/lib/libcrypto/ec/ec.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec.h,v 1.18 2019/09/29 10:09:09 tb Exp $ */ | 1 | /* $OpenBSD: ec.h,v 1.19 2021/04/20 17:04:13 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -280,6 +280,12 @@ unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x); | |||
280 | size_t EC_GROUP_get_seed_len(const EC_GROUP *); | 280 | size_t EC_GROUP_get_seed_len(const EC_GROUP *); |
281 | size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); | 281 | size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); |
282 | 282 | ||
283 | #if defined(LIBRESSL_INTERNAL) | ||
284 | int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, | ||
285 | const BIGNUM *b, BN_CTX *ctx); | ||
286 | int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, | ||
287 | BN_CTX *ctx); | ||
288 | #else | ||
283 | /** Sets the parameter of a ec over GFp defined by y^2 = x^3 + a*x + b | 289 | /** Sets the parameter of a ec over GFp defined by y^2 = x^3 + a*x + b |
284 | * \param group EC_GROUP object | 290 | * \param group EC_GROUP object |
285 | * \param p BIGNUM with the prime number | 291 | * \param p BIGNUM with the prime number |
@@ -321,6 +327,8 @@ int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, c | |||
321 | */ | 327 | */ |
322 | int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); | 328 | int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); |
323 | #endif | 329 | #endif |
330 | #endif | ||
331 | |||
324 | /** Returns the number of bits needed to represent a field element | 332 | /** Returns the number of bits needed to represent a field element |
325 | * \param group EC_GROUP object | 333 | * \param group EC_GROUP object |
326 | * \return number of bits needed to represent a field element | 334 | * \return number of bits needed to represent a field element |