#include <openssl/ec.h>
#include <assert.h>
#include <string.h>
#include <openssl/bn.h>
#include <openssl/err.h>
#include <openssl/mem.h>
#include <openssl/nid.h>
#include "internal.h"
#include "../../internal.h"
#include "../bn/internal.h"
#include "../delocate.h"
#include "builtin_curves.h"
static void ec_point_free(EC_POINT *point, int free_group);
static void ec_group_init_static_mont(BN_MONT_CTX *mont, size_t num_words,
const BN_ULONG *modulus,
const BN_ULONG *rr, uint64_t n0) { … }
static void ec_group_set_a_minus3(EC_GROUP *group) { … }
DEFINE_METHOD_FUNCTION(EC_GROUP, EC_group_p224) { … }
DEFINE_METHOD_FUNCTION(EC_GROUP, EC_group_p256) { … }
DEFINE_METHOD_FUNCTION(EC_GROUP, EC_group_p384) { … }
DEFINE_METHOD_FUNCTION(EC_GROUP, EC_group_p521) { … }
EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a,
const BIGNUM *b, BN_CTX *ctx) { … }
int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator,
const BIGNUM *order, const BIGNUM *cofactor) { … }
EC_GROUP *EC_GROUP_new_by_curve_name(int nid) { … }
void EC_GROUP_free(EC_GROUP *group) { … }
EC_GROUP *EC_GROUP_dup(const EC_GROUP *a) { … }
int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ignored) { … }
const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group) { … }
const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group) { … }
int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx) { … }
int EC_GROUP_order_bits(const EC_GROUP *group) { … }
int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor,
BN_CTX *ctx) { … }
int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *out_p, BIGNUM *out_a,
BIGNUM *out_b, BN_CTX *ctx) { … }
int EC_GROUP_get_curve_name(const EC_GROUP *group) { … }
unsigned EC_GROUP_get_degree(const EC_GROUP *group) { … }
const char *EC_curve_nid2nist(int nid) { … }
int EC_curve_nist2nid(const char *name) { … }
EC_POINT *EC_POINT_new(const EC_GROUP *group) { … }
static void ec_point_free(EC_POINT *point, int free_group) { … }
void EC_POINT_free(EC_POINT *point) { … }
void EC_POINT_clear_free(EC_POINT *point) { … }
int EC_POINT_copy(EC_POINT *dest, const EC_POINT *src) { … }
EC_POINT *EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group) { … }
int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point) { … }
int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) { … }
int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
BN_CTX *ctx) { … }
int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b,
BN_CTX *ctx) { … }
int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
const EC_POINT *point, BIGNUM *x,
BIGNUM *y, BN_CTX *ctx) { … }
int EC_POINT_get_affine_coordinates(const EC_GROUP *group,
const EC_POINT *point, BIGNUM *x, BIGNUM *y,
BN_CTX *ctx) { … }
void ec_affine_to_jacobian(const EC_GROUP *group, EC_JACOBIAN *out,
const EC_AFFINE *p) { … }
int ec_jacobian_to_affine(const EC_GROUP *group, EC_AFFINE *out,
const EC_JACOBIAN *p) { … }
int ec_jacobian_to_affine_batch(const EC_GROUP *group, EC_AFFINE *out,
const EC_JACOBIAN *in, size_t num) { … }
int ec_point_set_affine_coordinates(const EC_GROUP *group, EC_AFFINE *out,
const EC_FELEM *x, const EC_FELEM *y) { … }
int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *point,
const BIGNUM *x, const BIGNUM *y,
BN_CTX *ctx) { … }
int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point,
const BIGNUM *x, const BIGNUM *y,
BN_CTX *ctx) { … }
int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
const EC_POINT *b, BN_CTX *ctx) { … }
int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
BN_CTX *ctx) { … }
int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx) { … }
static int arbitrary_bignum_to_scalar(const EC_GROUP *group, EC_SCALAR *out,
const BIGNUM *in, BN_CTX *ctx) { … }
int ec_point_mul_no_self_test(const EC_GROUP *group, EC_POINT *r,
const BIGNUM *g_scalar, const EC_POINT *p,
const BIGNUM *p_scalar, BN_CTX *ctx) { … }
int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
const EC_POINT *p, const BIGNUM *p_scalar, BN_CTX *ctx) { … }
int ec_point_mul_scalar_public(const EC_GROUP *group, EC_JACOBIAN *r,
const EC_SCALAR *g_scalar, const EC_JACOBIAN *p,
const EC_SCALAR *p_scalar) { … }
int ec_point_mul_scalar_public_batch(const EC_GROUP *group, EC_JACOBIAN *r,
const EC_SCALAR *g_scalar,
const EC_JACOBIAN *points,
const EC_SCALAR *scalars, size_t num) { … }
int ec_point_mul_scalar(const EC_GROUP *group, EC_JACOBIAN *r,
const EC_JACOBIAN *p, const EC_SCALAR *scalar) { … }
int ec_point_mul_scalar_base(const EC_GROUP *group, EC_JACOBIAN *r,
const EC_SCALAR *scalar) { … }
int ec_point_mul_scalar_batch(const EC_GROUP *group, EC_JACOBIAN *r,
const EC_JACOBIAN *p0, const EC_SCALAR *scalar0,
const EC_JACOBIAN *p1, const EC_SCALAR *scalar1,
const EC_JACOBIAN *p2,
const EC_SCALAR *scalar2) { … }
int ec_init_precomp(const EC_GROUP *group, EC_PRECOMP *out,
const EC_JACOBIAN *p) { … }
int ec_point_mul_scalar_precomp(const EC_GROUP *group, EC_JACOBIAN *r,
const EC_PRECOMP *p0, const EC_SCALAR *scalar0,
const EC_PRECOMP *p1, const EC_SCALAR *scalar1,
const EC_PRECOMP *p2,
const EC_SCALAR *scalar2) { … }
void ec_point_select(const EC_GROUP *group, EC_JACOBIAN *out, BN_ULONG mask,
const EC_JACOBIAN *a, const EC_JACOBIAN *b) { … }
void ec_affine_select(const EC_GROUP *group, EC_AFFINE *out, BN_ULONG mask,
const EC_AFFINE *a, const EC_AFFINE *b) { … }
void ec_precomp_select(const EC_GROUP *group, EC_PRECOMP *out, BN_ULONG mask,
const EC_PRECOMP *a, const EC_PRECOMP *b) { … }
int ec_cmp_x_coordinate(const EC_GROUP *group, const EC_JACOBIAN *p,
const EC_SCALAR *r) { … }
int ec_get_x_coordinate_as_scalar(const EC_GROUP *group, EC_SCALAR *out,
const EC_JACOBIAN *p) { … }
int ec_get_x_coordinate_as_bytes(const EC_GROUP *group, uint8_t *out,
size_t *out_len, size_t max_out,
const EC_JACOBIAN *p) { … }
void ec_set_to_safe_point(const EC_GROUP *group, EC_JACOBIAN *out) { … }
void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag) { … }
int EC_GROUP_get_asn1_flag(const EC_GROUP *group) { … }
const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group) { … }
int EC_METHOD_get_field_type(const EC_METHOD *meth) { … }
void EC_GROUP_set_point_conversion_form(EC_GROUP *group,
point_conversion_form_t form) { … }