aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ec/ec_cvt.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2001-03-07 01:17:05 +0000
committerBodo Möller <bodo@openssl.org>2001-03-07 01:17:05 +0000
commit0657bf9c14598f52fe3cacd0c32d99458d97659e (patch)
tree86a9d09470853a6f1a29910a74425f3a4c64cead /crypto/ec/ec_cvt.c
parent5b438e9b0f82f7238e20408c98be4dbe70c4ef43 (diff)
downloadopenssl-0657bf9c14598f52fe3cacd0c32d99458d97659e.tar.gz
Implement dispatcher for EC_GROUP and EC_POINT method functions.
Initial EC_GROUP_new_curve_GFp implementation.
Diffstat (limited to 'crypto/ec/ec_cvt.c')
-rw-r--r--crypto/ec/ec_cvt.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/crypto/ec/ec_cvt.c b/crypto/ec/ec_cvt.c
index be06d3d92f..361dcc3992 100644
--- a/crypto/ec/ec_cvt.c
+++ b/crypto/ec/ec_cvt.c
@@ -1,4 +1,3 @@
-/* TODO */
/* crypto/ec/ec_cvt.c */
/* ====================================================================
* Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
@@ -55,3 +54,27 @@
*/
#include "ec_lcl.h"
+
+
+EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
+ {
+ const EC_METHOD *meth;
+ EC_GROUP *ret;
+
+ /* Finally, this will use EC_GFp_nist_method if 'p' is a special
+ * prime with optimized modular arithmetics (for NIST curves)
+ * and EC_GFp_mont_method or EC_GFp_recp_method otherwise. */
+ meth = EC_GFp_simple_method();
+
+ ret = EC_GROUP_new(meth);
+ if (ret == NULL)
+ return NULL;
+
+ if (!EC_GROUP_set_curve_GFp(ret, p, a, b, ctx))
+ {
+ EC_GROUP_clear_free(ret);
+ return NULL;
+ }
+
+ return ret;
+ }