From 2e0db07627d6ec226f3bdbeb3ac211dbd619f908 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bodo=20M=C3=B6ller?= Date: Wed, 7 Mar 2001 09:48:38 +0000 Subject: [PATCH] Optimized EC_METHODs need specific 'set_curve' and 'free' functions. --- crypto/ec/ec.h | 2 +- crypto/ec/ec_lcl.h | 9 +++++++++ crypto/ec/ec_lib.c | 2 +- crypto/ec/ecp_mont.c | 6 +++--- crypto/ec/ecp_nist.c | 6 +++--- crypto/ec/ecp_recp.c | 6 +++--- 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/crypto/ec/ec.h b/crypto/ec/ec.h index 092cd050eb..01234d714d 100644 --- a/crypto/ec/ec.h +++ b/crypto/ec/ec.h @@ -112,7 +112,7 @@ EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM int EC_GROUP_set_generator(EC_GROUP *, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor); -/* TODO: 'get' functions for EC_GROUPs */ +/* TODO: 'set' and 'get' functions for EC_GROUPs */ EC_POINT *EC_POINT_new(const EC_GROUP *); diff --git a/crypto/ec/ec_lcl.h b/crypto/ec/ec_lcl.h index cea552a736..6cc7a9ae1e 100644 --- a/crypto/ec/ec_lcl.h +++ b/crypto/ec/ec_lcl.h @@ -202,6 +202,9 @@ int ec_GFp_simple_field_sqr(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, BN_CTX /* method functions in ecp_mont.c */ +int ec_GFp_mont_group_set_curve_GFp(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *); +void ec_GFp_mont_group_finish(EC_GROUP *); +void ec_GFp_mont_group_clear_finish(EC_GROUP *); int ec_GFp_mont_field_mult(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *); int ec_GFp_mont_field_sqr(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, BN_CTX *); int ec_GFp_mont_field_encode(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, BN_CTX *); @@ -209,6 +212,9 @@ int ec_GFp_mont_field_decode(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, BN_CT /* method functions in ecp_recp.c */ +int ec_GFp_recp_group_set_curve_GFp(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *); +void ec_GFp_recp_group_finish(EC_GROUP *); +void ec_GFp_recp_group_clear_finish(EC_GROUP *); int ec_GFp_recp_field_mult(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *); int ec_GFp_recp_field_sqr(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, BN_CTX *); int ec_GFp_recp_field_encode(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, BN_CTX *); @@ -216,6 +222,9 @@ int ec_GFp_recp_field_decode(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, BN_CT /* method functions in ecp_nist.c */ +int ec_GFp_nist_group_set_curve_GFp(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *); +void ec_GFp_nist_group_finish(EC_GROUP *); +void ec_GFp_nist_group_clear_finish(EC_GROUP *); int ec_GFp_nist_field_mult(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *); int ec_GFp_nist_field_sqr(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, BN_CTX *); int ec_GFp_nist_field_encode(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, BN_CTX *); diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c index d8c78a41f9..2056d58cd3 100644 --- a/crypto/ec/ec_lib.c +++ b/crypto/ec/ec_lib.c @@ -181,7 +181,7 @@ int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, const BIG } -/* TODO: 'get' functions for EC_GROUPs */ +/* TODO: 'set' and 'get' functions for EC_GROUPs */ /* this has 'package' visibility */ diff --git a/crypto/ec/ecp_mont.c b/crypto/ec/ecp_mont.c index ca08ebb152..958adadc34 100644 --- a/crypto/ec/ecp_mont.c +++ b/crypto/ec/ecp_mont.c @@ -61,9 +61,9 @@ const EC_METHOD *EC_GFp_mont_method(void) { static const EC_METHOD ret = { ec_GFp_simple_group_init, - ec_GFp_simple_group_set_curve_GFp, - ec_GFp_simple_group_finish, - ec_GFp_simple_group_clear_finish, + ec_GFp_mont_group_set_curve_GFp, + ec_GFp_mont_group_finish, + ec_GFp_mont_group_clear_finish, ec_GFp_simple_group_copy, ec_GFp_simple_group_set_generator, /* TODO: 'set' and 'get' functions for EC_GROUPs */ diff --git a/crypto/ec/ecp_nist.c b/crypto/ec/ecp_nist.c index 9bb4ec74a8..94a232f747 100644 --- a/crypto/ec/ecp_nist.c +++ b/crypto/ec/ecp_nist.c @@ -61,9 +61,9 @@ const EC_METHOD *EC_GFp_nist_method(void) { static const EC_METHOD ret = { ec_GFp_simple_group_init, - ec_GFp_simple_group_set_curve_GFp, - ec_GFp_simple_group_finish, - ec_GFp_simple_group_clear_finish, + ec_GFp_nist_group_set_curve_GFp, + ec_GFp_nist_group_finish, + ec_GFp_nist_group_clear_finish, ec_GFp_simple_group_copy, ec_GFp_simple_group_set_generator, /* TODO: 'set' and 'get' functions for EC_GROUPs */ diff --git a/crypto/ec/ecp_recp.c b/crypto/ec/ecp_recp.c index 93d9bd6c94..d0fb8f7f1a 100644 --- a/crypto/ec/ecp_recp.c +++ b/crypto/ec/ecp_recp.c @@ -61,9 +61,9 @@ const EC_METHOD *EC_GFp_recp_method(void) { static const EC_METHOD ret = { ec_GFp_simple_group_init, - ec_GFp_simple_group_set_curve_GFp, - ec_GFp_simple_group_finish, - ec_GFp_simple_group_clear_finish, + ec_GFp_recp_group_set_curve_GFp, + ec_GFp_recp_group_finish, + ec_GFp_recp_group_clear_finish, ec_GFp_simple_group_copy, ec_GFp_simple_group_set_generator, /* TODO: 'set' and 'get' functions for EC_GROUPs */ -- 2.25.1