More method functions for elliptic curves,
and an ectest.c that actually tests something.
This commit is contained in:
@@ -56,9 +56,12 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
#include "ec_lcl.h"
|
||||
|
||||
static const char EC_version[] = "EC" OPENSSL_VERSION_PTEXT;
|
||||
|
||||
|
||||
/* functions for EC_GROUP objects */
|
||||
|
||||
@@ -101,17 +104,6 @@ EC_GROUP *EC_GROUP_new(const EC_METHOD *meth)
|
||||
}
|
||||
|
||||
|
||||
int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
|
||||
{
|
||||
if (group->meth->group_set_curve_GFp == 0)
|
||||
{
|
||||
ECerr(EC_F_EC_GROUP_SET_CURVE_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
||||
return 0;
|
||||
}
|
||||
return group->meth->group_set_curve_GFp(group, p, a, b, ctx);
|
||||
}
|
||||
|
||||
|
||||
void EC_GROUP_free(EC_GROUP *group)
|
||||
{
|
||||
if (group->meth->group_finish != 0)
|
||||
@@ -171,6 +163,28 @@ int EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src)
|
||||
}
|
||||
|
||||
|
||||
int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
|
||||
{
|
||||
if (group->meth->group_set_curve_GFp == 0)
|
||||
{
|
||||
ECerr(EC_F_EC_GROUP_SET_CURVE_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
||||
return 0;
|
||||
}
|
||||
return group->meth->group_set_curve_GFp(group, p, a, b, ctx);
|
||||
}
|
||||
|
||||
|
||||
int EC_GROUP_get_curve_GFp(EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx)
|
||||
{
|
||||
if (group->meth->group_get_curve_GFp == 0)
|
||||
{
|
||||
ECerr(EC_F_EC_GROUP_GET_CURVE_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
|
||||
return 0;
|
||||
}
|
||||
return group->meth->group_get_curve_GFp(group, p, a, b, ctx);
|
||||
}
|
||||
|
||||
|
||||
int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor)
|
||||
{
|
||||
if (group->meth->group_set_generator == 0)
|
||||
@@ -182,9 +196,6 @@ int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, const BIG
|
||||
}
|
||||
|
||||
|
||||
/* TODO: 'set' and 'get' functions for EC_GROUPs */
|
||||
|
||||
|
||||
/* this has 'package' visibility */
|
||||
int EC_GROUP_set_extra_data(EC_GROUP *group, void *extra_data, void *(*extra_data_dup_func)(void *),
|
||||
void (*extra_data_free_func)(void *), void (*extra_data_clear_free_func)(void *))
|
||||
|
Reference in New Issue
Block a user