X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fec%2Fec_cvt.c;h=361dcc3992dd505f0c82e804230c40105899abe9;hp=be06d3d92f9405f02a6c36431d59e40b13f60507;hb=bb62a8b0c57c88ec189389f07250dee9c87d0681;hpb=38e3c5815c142e905f0a023d86c066283889cf4a 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; + }