-/* $OpenBSD: ec2_mult.c,v 1.13 2018/07/23 18:24:22 tb Exp $ */
+/* $OpenBSD: ec2_mult.c,v 1.14 2022/11/19 07:29:29 tb Exp $ */
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
* because ec_GF2m_simple_mul() uses ec_wNAF_mul() if appropriate */
int
-ec_GF2m_precompute_mult(EC_GROUP * group, BN_CTX * ctx)
+ec_GF2m_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
{
return ec_wNAF_precompute_mult(group, ctx);
}
int
-ec_GF2m_have_precompute_mult(const EC_GROUP * group)
+ec_GF2m_have_precompute_mult(const EC_GROUP *group)
{
return ec_wNAF_have_precompute_mult(group);
}
-/* $OpenBSD: ec2_oct.c,v 1.17 2022/11/19 07:00:57 tb Exp $ */
+/* $OpenBSD: ec2_oct.c,v 1.18 2022/11/19 07:29:29 tb Exp $ */
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
size_t
ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point,
point_conversion_form_t form,
- unsigned char *buf, size_t len, BN_CTX * ctx)
+ unsigned char *buf, size_t len, BN_CTX *ctx)
{
size_t ret;
BN_CTX *new_ctx = NULL;
-/* $OpenBSD: ec2_smpl.c,v 1.24 2022/11/19 07:00:57 tb Exp $ */
+/* $OpenBSD: ec2_smpl.c,v 1.25 2022/11/19 07:29:29 tb Exp $ */
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
* Note that all other members are handled by EC_GROUP_new.
*/
int
-ec_GF2m_simple_group_init(EC_GROUP * group)
+ec_GF2m_simple_group_init(EC_GROUP *group)
{
BN_init(&group->field);
BN_init(&group->a);
* Note that all other members are handled by EC_GROUP_free.
*/
void
-ec_GF2m_simple_group_finish(EC_GROUP * group)
+ec_GF2m_simple_group_finish(EC_GROUP *group)
{
BN_free(&group->field);
BN_free(&group->a);
* Note that all other members are handled by EC_GROUP_clear_free.
*/
void
-ec_GF2m_simple_group_clear_finish(EC_GROUP * group)
+ec_GF2m_simple_group_clear_finish(EC_GROUP *group)
{
BN_clear_free(&group->field);
BN_clear_free(&group->a);
* Note that all other members are handled by EC_GROUP_copy.
*/
int
-ec_GF2m_simple_group_copy(EC_GROUP * dest, const EC_GROUP * src)
+ec_GF2m_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src)
{
int i;
/* Set the curve parameters of an EC_GROUP structure. */
int
-ec_GF2m_simple_group_set_curve(EC_GROUP * group,
- const BIGNUM * p, const BIGNUM * a, const BIGNUM * b, BN_CTX * ctx)
+ec_GF2m_simple_group_set_curve(EC_GROUP *group,
+ const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
{
int ret = 0, i;
/* Gets the degree of the field. For a curve over GF(2^m) this is the value m. */
int
-ec_GF2m_simple_group_get_degree(const EC_GROUP * group)
+ec_GF2m_simple_group_get_degree(const EC_GROUP *group)
{
return BN_num_bits(&group->field) - 1;
}
* y^2 + x*y = x^3 + a*x^2 + b is an elliptic curve <=> b != 0 (mod p)
*/
int
-ec_GF2m_simple_group_check_discriminant(const EC_GROUP * group, BN_CTX * ctx)
+ec_GF2m_simple_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx)
{
int ret = 0;
BIGNUM *b;
/* Initializes an EC_POINT. */
int
-ec_GF2m_simple_point_init(EC_POINT * point)
+ec_GF2m_simple_point_init(EC_POINT *point)
{
BN_init(&point->X);
BN_init(&point->Y);
/* Frees an EC_POINT. */
void
-ec_GF2m_simple_point_finish(EC_POINT * point)
+ec_GF2m_simple_point_finish(EC_POINT *point)
{
BN_free(&point->X);
BN_free(&point->Y);
/* Clears and frees an EC_POINT. */
void
-ec_GF2m_simple_point_clear_finish(EC_POINT * point)
+ec_GF2m_simple_point_clear_finish(EC_POINT *point)
{
BN_clear_free(&point->X);
BN_clear_free(&point->Y);
/* Copy the contents of one EC_POINT into another. Assumes dest is initialized. */
int
-ec_GF2m_simple_point_copy(EC_POINT * dest, const EC_POINT * src)
+ec_GF2m_simple_point_copy(EC_POINT *dest, const EC_POINT *src)
{
if (!BN_copy(&dest->X, &src->X))
return 0;
* A point at infinity is represented by having Z=0.
*/
int
-ec_GF2m_simple_point_set_to_infinity(const EC_GROUP * group, EC_POINT * point)
+ec_GF2m_simple_point_set_to_infinity(const EC_GROUP *group, EC_POINT *point)
{
point->Z_is_one = 0;
BN_zero(&point->Z);
* Note that the simple implementation only uses affine coordinates.
*/
int
-ec_GF2m_simple_point_set_affine_coordinates(const EC_GROUP * group, EC_POINT * point,
- const BIGNUM * x, const BIGNUM * y, BN_CTX * ctx)
+ec_GF2m_simple_point_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point,
+ const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx)
{
int ret = 0;
if (x == NULL || y == NULL) {
/* Forces the given EC_POINT to internally use affine coordinates. */
int
-ec_GF2m_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx)
+ec_GF2m_simple_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx)
{
BN_CTX *new_ctx = NULL;
BIGNUM *x, *y;
-/* $OpenBSD: ec_ameth.c,v 1.34 2022/11/19 07:00:57 tb Exp $ */
+/* $OpenBSD: ec_ameth.c,v 1.35 2022/11/19 07:29:29 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
#endif
static int
-eckey_param2type(int *pptype, void **ppval, EC_KEY * ec_key)
+eckey_param2type(int *pptype, void **ppval, EC_KEY *ec_key)
{
const EC_GROUP *group;
int nid;
}
static int
-eckey_pub_encode(X509_PUBKEY * pk, const EVP_PKEY * pkey)
+eckey_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
{
EC_KEY *ec_key = pkey->pkey.ec;
void *pval = NULL;
}
static int
-eckey_pub_decode(EVP_PKEY * pkey, X509_PUBKEY * pubkey)
+eckey_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
{
const unsigned char *p = NULL;
const void *pval;
}
static int
-eckey_pub_cmp(const EVP_PKEY * a, const EVP_PKEY * b)
+eckey_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
{
int r;
const EC_GROUP *group = EC_KEY_get0_group(b->pkey.ec);
}
static int
-eckey_priv_decode(EVP_PKEY * pkey, const PKCS8_PRIV_KEY_INFO * p8)
+eckey_priv_decode(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8)
{
const unsigned char *p = NULL;
const void *pval;
}
static int
-eckey_priv_encode(PKCS8_PRIV_KEY_INFO * p8, const EVP_PKEY * pkey)
+eckey_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
{
EC_KEY *ec_key;
unsigned char *ep, *p;
}
static int
-int_ec_size(const EVP_PKEY * pkey)
+int_ec_size(const EVP_PKEY *pkey)
{
return ECDSA_size(pkey->pkey.ec);
}
static int
-ec_bits(const EVP_PKEY * pkey)
+ec_bits(const EVP_PKEY *pkey)
{
BIGNUM *order = BN_new();
const EC_GROUP *group;
}
static int
-ec_missing_parameters(const EVP_PKEY * pkey)
+ec_missing_parameters(const EVP_PKEY *pkey)
{
if (EC_KEY_get0_group(pkey->pkey.ec) == NULL)
return 1;
}
static int
-ec_copy_parameters(EVP_PKEY * to, const EVP_PKEY * from)
+ec_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
{
return EC_KEY_set_group(to->pkey.ec, EC_KEY_get0_group(from->pkey.ec));
}
static int
-ec_cmp_parameters(const EVP_PKEY * a, const EVP_PKEY * b)
+ec_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)
{
const EC_GROUP *group_a = EC_KEY_get0_group(a->pkey.ec), *group_b = EC_KEY_get0_group(b->pkey.ec);
if (EC_GROUP_cmp(group_a, group_b, NULL))
}
static void
-int_ec_free(EVP_PKEY * pkey)
+int_ec_free(EVP_PKEY *pkey)
{
EC_KEY_free(pkey->pkey.ec);
}
static int
-do_EC_KEY_print(BIO * bp, const EC_KEY * x, int off, int ktype)
+do_EC_KEY_print(BIO *bp, const EC_KEY *x, int off, int ktype)
{
unsigned char *buffer = NULL;
const char *ecstr;
}
static int
-eckey_param_decode(EVP_PKEY * pkey,
+eckey_param_decode(EVP_PKEY *pkey,
const unsigned char **pder, int derlen)
{
EC_KEY *eckey;
}
static int
-eckey_param_encode(const EVP_PKEY * pkey, unsigned char **pder)
+eckey_param_encode(const EVP_PKEY *pkey, unsigned char **pder)
{
return i2d_ECParameters(pkey->pkey.ec, pder);
}
static int
-eckey_param_print(BIO * bp, const EVP_PKEY * pkey, int indent,
- ASN1_PCTX * ctx)
+eckey_param_print(BIO *bp, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *ctx)
{
return do_EC_KEY_print(bp, pkey->pkey.ec, indent, 0);
}
static int
-eckey_pub_print(BIO * bp, const EVP_PKEY * pkey, int indent,
- ASN1_PCTX * ctx)
+eckey_pub_print(BIO *bp, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *ctx)
{
return do_EC_KEY_print(bp, pkey->pkey.ec, indent, 1);
}
static int
-eckey_priv_print(BIO * bp, const EVP_PKEY * pkey, int indent,
- ASN1_PCTX * ctx)
+eckey_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *ctx)
{
return do_EC_KEY_print(bp, pkey->pkey.ec, indent, 2);
}
static int
-old_ec_priv_decode(EVP_PKEY * pkey,
+old_ec_priv_decode(EVP_PKEY *pkey,
const unsigned char **pder, int derlen)
{
EC_KEY *ec;
}
static int
-old_ec_priv_encode(const EVP_PKEY * pkey, unsigned char **pder)
+old_ec_priv_encode(const EVP_PKEY *pkey, unsigned char **pder)
{
return i2d_ECPrivateKey(pkey->pkey.ec, pder);
}
static int
-ec_pkey_ctrl(EVP_PKEY * pkey, int op, long arg1, void *arg2)
+ec_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
{
switch (op) {
case ASN1_PKEY_CTRL_PKCS7_SIGN:
-/* $OpenBSD: ec_asn1.c,v 1.38 2022/11/19 07:00:57 tb Exp $ */
+/* $OpenBSD: ec_asn1.c,v 1.39 2022/11/19 07:29:29 tb Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
#include "ec_lcl.h"
int
-EC_GROUP_get_basis_type(const EC_GROUP * group)
+EC_GROUP_get_basis_type(const EC_GROUP *group)
{
int i = 0;
#ifndef OPENSSL_NO_EC2M
int
-EC_GROUP_get_trinomial_basis(const EC_GROUP * group, unsigned int *k)
+EC_GROUP_get_trinomial_basis(const EC_GROUP *group, unsigned int *k)
{
if (group == NULL)
return 0;
}
int
-EC_GROUP_get_pentanomial_basis(const EC_GROUP * group, unsigned int *k1,
+EC_GROUP_get_pentanomial_basis(const EC_GROUP *group, unsigned int *k1,
unsigned int *k2, unsigned int *k3)
{
if (group == NULL)
/* the function definitions */
static int
-ec_asn1_group2fieldid(const EC_GROUP * group, X9_62_FIELDID * field)
+ec_asn1_group2fieldid(const EC_GROUP *group, X9_62_FIELDID *field)
{
int ok = 0, nid;
BIGNUM *tmp = NULL;
}
static int
-ec_asn1_group2curve(const EC_GROUP * group, X9_62_CURVE * curve)
+ec_asn1_group2curve(const EC_GROUP *group, X9_62_CURVE *curve)
{
BIGNUM *tmp_1 = NULL, *tmp_2 = NULL;
unsigned char *buffer_1 = NULL, *buffer_2 = NULL, *a_buf = NULL,
}
static ECPARAMETERS *
-ec_asn1_group2parameters(const EC_GROUP * group, ECPARAMETERS * param)
+ec_asn1_group2parameters(const EC_GROUP *group, ECPARAMETERS *param)
{
int ok = 0;
size_t len = 0;
}
ECPKPARAMETERS *
-ec_asn1_group2pkparameters(const EC_GROUP * group, ECPKPARAMETERS * params)
+ec_asn1_group2pkparameters(const EC_GROUP *group, ECPKPARAMETERS *params)
{
int ok = 1, tmp;
ECPKPARAMETERS *ret = params;
}
static EC_GROUP *
-ec_asn1_parameters2group(const ECPARAMETERS * params)
+ec_asn1_parameters2group(const ECPARAMETERS *params)
{
int ok = 0, tmp;
EC_GROUP *ret = NULL;
}
EC_GROUP *
-ec_asn1_pkparameters2group(const ECPKPARAMETERS * params)
+ec_asn1_pkparameters2group(const ECPKPARAMETERS *params)
{
EC_GROUP *ret = NULL;
int tmp = 0;
}
int
-i2d_ECPKParameters(const EC_GROUP * a, unsigned char **out)
+i2d_ECPKParameters(const EC_GROUP *a, unsigned char **out)
{
int ret = 0;
ECPKPARAMETERS *tmp = ec_asn1_group2pkparameters(a, NULL);
}
int
-i2d_ECPrivateKey(EC_KEY * a, unsigned char **out)
+i2d_ECPrivateKey(EC_KEY *a, unsigned char **out)
{
int ret = 0, ok = 0;
unsigned char *buffer = NULL;
}
int
-i2d_ECParameters(EC_KEY * a, unsigned char **out)
+i2d_ECParameters(EC_KEY *a, unsigned char **out)
{
if (a == NULL) {
ECerror(ERR_R_PASSED_NULL_PARAMETER);
}
int
-i2o_ECPublicKey(const EC_KEY * a, unsigned char **out)
+i2o_ECPublicKey(const EC_KEY *a, unsigned char **out)
{
size_t buf_len = 0;
int new_buffer = 0;
-/* $OpenBSD: ec_check.c,v 1.10 2022/11/19 07:00:57 tb Exp $ */
+/* $OpenBSD: ec_check.c,v 1.11 2022/11/19 07:29:29 tb Exp $ */
/* ====================================================================
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
*
#include <openssl/err.h>
int
-EC_GROUP_check(const EC_GROUP * group, BN_CTX * ctx)
+EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx)
{
int ret = 0;
BIGNUM *order;
-/* $OpenBSD: ec_curve.c,v 1.23 2022/11/19 07:00:57 tb Exp $ */
+/* $OpenBSD: ec_curve.c,v 1.24 2022/11/19 07:29:29 tb Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
}
size_t
-EC_get_builtin_curves(EC_builtin_curve * r, size_t nitems)
+EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems)
{
size_t i, min;
-/* $OpenBSD: ec_key.c,v 1.27 2022/11/19 07:00:57 tb Exp $ */
+/* $OpenBSD: ec_key.c,v 1.28 2022/11/19 07:29:29 tb Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
}
void
-EC_KEY_free(EC_KEY * r)
+EC_KEY_free(EC_KEY *r)
{
int i;
}
EC_KEY *
-EC_KEY_copy(EC_KEY * dest, const EC_KEY * src)
+EC_KEY_copy(EC_KEY *dest, const EC_KEY *src)
{
EC_EXTRA_DATA *d;
}
EC_KEY *
-EC_KEY_dup(const EC_KEY * ec_key)
+EC_KEY_dup(const EC_KEY *ec_key)
{
EC_KEY *ret;
}
int
-EC_KEY_up_ref(EC_KEY * r)
+EC_KEY_up_ref(EC_KEY *r)
{
int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_EC);
return ((i > 1) ? 1 : 0);
}
int
-EC_KEY_check_key(const EC_KEY * eckey)
+EC_KEY_check_key(const EC_KEY *eckey)
{
int ok = 0;
BN_CTX *ctx = NULL;
}
int
-EC_KEY_set_public_key_affine_coordinates(EC_KEY * key, BIGNUM * x, BIGNUM * y)
+EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNUM *y)
{
BN_CTX *ctx = NULL;
BIGNUM *tx, *ty;
}
const EC_GROUP *
-EC_KEY_get0_group(const EC_KEY * key)
+EC_KEY_get0_group(const EC_KEY *key)
{
return key->group;
}
int
-EC_KEY_set_group(EC_KEY * key, const EC_GROUP * group)
+EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group)
{
if (key->meth->set_group != NULL &&
key->meth->set_group(key, group) == 0)
}
const BIGNUM *
-EC_KEY_get0_private_key(const EC_KEY * key)
+EC_KEY_get0_private_key(const EC_KEY *key)
{
return key->priv_key;
}
int
-EC_KEY_set_private_key(EC_KEY * key, const BIGNUM * priv_key)
+EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *priv_key)
{
if (key->meth->set_private != NULL &&
key->meth->set_private(key, priv_key) == 0)
}
const EC_POINT *
-EC_KEY_get0_public_key(const EC_KEY * key)
+EC_KEY_get0_public_key(const EC_KEY *key)
{
return key->pub_key;
}
int
-EC_KEY_set_public_key(EC_KEY * key, const EC_POINT * pub_key)
+EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub_key)
{
if (key->meth->set_public != NULL &&
key->meth->set_public(key, pub_key) == 0)
}
unsigned int
-EC_KEY_get_enc_flags(const EC_KEY * key)
+EC_KEY_get_enc_flags(const EC_KEY *key)
{
return key->enc_flag;
}
void
-EC_KEY_set_enc_flags(EC_KEY * key, unsigned int flags)
+EC_KEY_set_enc_flags(EC_KEY *key, unsigned int flags)
{
key->enc_flag = flags;
}
point_conversion_form_t
-EC_KEY_get_conv_form(const EC_KEY * key)
+EC_KEY_get_conv_form(const EC_KEY *key)
{
return key->conv_form;
}
void
-EC_KEY_set_conv_form(EC_KEY * key, point_conversion_form_t cform)
+EC_KEY_set_conv_form(EC_KEY *key, point_conversion_form_t cform)
{
key->conv_form = cform;
if (key->group != NULL)
}
void *
-EC_KEY_insert_key_method_data(EC_KEY * key, void *data,
+EC_KEY_insert_key_method_data(EC_KEY *key, void *data,
void *(*dup_func) (void *),
void (*free_func) (void *),
void (*clear_free_func) (void *))
}
void
-EC_KEY_set_asn1_flag(EC_KEY * key, int flag)
+EC_KEY_set_asn1_flag(EC_KEY *key, int flag)
{
if (key->group != NULL)
EC_GROUP_set_asn1_flag(key->group, flag);
}
int
-EC_KEY_precompute_mult(EC_KEY * key, BN_CTX * ctx)
+EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx)
{
if (key->group == NULL)
return 0;
}
int
-EC_KEY_get_flags(const EC_KEY * key)
+EC_KEY_get_flags(const EC_KEY *key)
{
return key->flags;
}
void
-EC_KEY_set_flags(EC_KEY * key, int flags)
+EC_KEY_set_flags(EC_KEY *key, int flags)
{
key->flags |= flags;
}
void
-EC_KEY_clear_flags(EC_KEY * key, int flags)
+EC_KEY_clear_flags(EC_KEY *key, int flags)
{
key->flags &= ~flags;
}
-/* $OpenBSD: ec_lib.c,v 1.45 2022/04/07 17:37:25 tb Exp $ */
+/* $OpenBSD: ec_lib.c,v 1.46 2022/11/19 07:29:29 tb Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
/* functions for EC_GROUP objects */
EC_GROUP *
-EC_GROUP_new(const EC_METHOD * meth)
+EC_GROUP_new(const EC_METHOD *meth)
{
EC_GROUP *ret;
void
-EC_GROUP_free(EC_GROUP * group)
+EC_GROUP_free(EC_GROUP *group)
{
if (!group)
return;
void
-EC_GROUP_clear_free(EC_GROUP * group)
+EC_GROUP_clear_free(EC_GROUP *group)
{
if (!group)
return;
int
-EC_GROUP_copy(EC_GROUP * dest, const EC_GROUP * src)
+EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src)
{
EC_EXTRA_DATA *d;
EC_GROUP *
-EC_GROUP_dup(const EC_GROUP * a)
+EC_GROUP_dup(const EC_GROUP *a)
{
EC_GROUP *t = NULL;
void
-EC_GROUP_set_curve_name(EC_GROUP * group, int nid)
+EC_GROUP_set_curve_name(EC_GROUP *group, int nid)
{
group->curve_name = nid;
}
int
-EC_GROUP_get_curve_name(const EC_GROUP * group)
+EC_GROUP_get_curve_name(const EC_GROUP *group)
{
return group->curve_name;
}
void
-EC_GROUP_set_asn1_flag(EC_GROUP * group, int flag)
+EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag)
{
group->asn1_flag = flag;
}
int
-EC_GROUP_get_asn1_flag(const EC_GROUP * group)
+EC_GROUP_get_asn1_flag(const EC_GROUP *group)
{
return group->asn1_flag;
}
void
-EC_GROUP_set_point_conversion_form(EC_GROUP * group,
+EC_GROUP_set_point_conversion_form(EC_GROUP *group,
point_conversion_form_t form)
{
group->asn1_form = form;
point_conversion_form_t
-EC_GROUP_get_point_conversion_form(const EC_GROUP * group)
+EC_GROUP_get_point_conversion_form(const EC_GROUP *group)
{
return group->asn1_form;
}
size_t
-EC_GROUP_set_seed(EC_GROUP * group, const unsigned char *p, size_t len)
+EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *p, size_t len)
{
if (group->seed) {
free(group->seed);
unsigned char *
-EC_GROUP_get0_seed(const EC_GROUP * group)
+EC_GROUP_get0_seed(const EC_GROUP *group)
{
return group->seed;
}
size_t
-EC_GROUP_get_seed_len(const EC_GROUP * group)
+EC_GROUP_get_seed_len(const EC_GROUP *group)
{
return group->seed_len;
}
#endif
int
-EC_GROUP_get_degree(const EC_GROUP * group)
+EC_GROUP_get_degree(const EC_GROUP *group)
{
if (group->meth->group_get_degree == 0) {
ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
int
-EC_GROUP_check_discriminant(const EC_GROUP * group, BN_CTX * ctx)
+EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx)
{
if (group->meth->group_check_discriminant == 0) {
ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
int
-EC_GROUP_cmp(const EC_GROUP * a, const EC_GROUP * b, BN_CTX * ctx)
+EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx)
{
int r = 0;
BIGNUM *a1, *a2, *a3, *b1, *b2, *b3;
/* this has 'package' visibility */
void *
-EC_EX_DATA_get_data(const EC_EXTRA_DATA * ex_data,
+EC_EX_DATA_get_data(const EC_EXTRA_DATA *ex_data,
void *(*dup_func) (void *),
void (*free_func) (void *),
void (*clear_free_func) (void *))
/* functions for EC_POINT objects */
EC_POINT *
-EC_POINT_new(const EC_GROUP * group)
+EC_POINT_new(const EC_GROUP *group)
{
EC_POINT *ret;
void
-EC_POINT_free(EC_POINT * point)
+EC_POINT_free(EC_POINT *point)
{
if (!point)
return;
void
-EC_POINT_clear_free(EC_POINT * point)
+EC_POINT_clear_free(EC_POINT *point)
{
if (!point)
return;
int
-EC_POINT_copy(EC_POINT * dest, const EC_POINT * src)
+EC_POINT_copy(EC_POINT *dest, const EC_POINT *src)
{
if (dest->meth->point_copy == 0) {
ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
EC_POINT *
-EC_POINT_dup(const EC_POINT * a, const EC_GROUP * group)
+EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group)
{
EC_POINT *t;
int r;
const EC_METHOD *
-EC_POINT_method_of(const EC_POINT * point)
+EC_POINT_method_of(const EC_POINT *point)
{
return point->meth;
}
int
-EC_POINT_set_to_infinity(const EC_GROUP * group, EC_POINT * point)
+EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point)
{
if (group->meth->point_set_to_infinity == 0) {
ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
int
-EC_POINT_is_on_curve(const EC_GROUP * group, const EC_POINT * point, BN_CTX * ctx)
+EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx)
{
if (group->meth->is_on_curve == 0) {
ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
int
EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b,
- BN_CTX * ctx)
+ BN_CTX *ctx)
{
if (group->meth->point_cmp == 0) {
ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
}
int
-EC_GROUP_precompute_mult(EC_GROUP * group, BN_CTX * ctx)
+EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
{
if (group->meth->precompute_mult != 0)
return group->meth->precompute_mult(group, ctx);
}
int
-EC_GROUP_have_precompute_mult(const EC_GROUP * group)
+EC_GROUP_have_precompute_mult(const EC_GROUP *group)
{
if (group->meth->have_precompute_mult != 0)
return group->meth->have_precompute_mult(group);
-/* $OpenBSD: ec_mult.c,v 1.25 2022/11/19 07:00:57 tb Exp $ */
+/* $OpenBSD: ec_mult.c,v 1.26 2022/11/19 07:29:29 tb Exp $ */
/*
* Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project.
*/
static void ec_pre_comp_clear_free(void *);
static EC_PRE_COMP *
-ec_pre_comp_new(const EC_GROUP * group)
+ec_pre_comp_new(const EC_GROUP *group)
{
EC_PRE_COMP *ret = NULL;
* w-1 zeros away from that next non-zero digit.
*/
static signed char *
-compute_wNAF(const BIGNUM * scalar, int w, size_t * ret_len)
+compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len)
{
int window_val;
int ok = 0;
* in the addition if scalar != NULL
*/
int
-ec_wNAF_mul(const EC_GROUP * group, EC_POINT * r, const BIGNUM * scalar,
- size_t num, const EC_POINT * points[], const BIGNUM * scalars[], BN_CTX * ctx)
+ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
+ size_t num, const EC_POINT *points[], const BIGNUM *scalars[], BN_CTX *ctx)
{
BN_CTX *new_ctx = NULL;
const EC_POINT *generator = NULL;
* points[2^(w-1)*numblocks] = NULL
*/
int
-ec_wNAF_precompute_mult(EC_GROUP * group, BN_CTX * ctx)
+ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
{
const EC_POINT *generator;
EC_POINT *tmp_point = NULL, *base = NULL, **var;
int
-ec_wNAF_have_precompute_mult(const EC_GROUP * group)
+ec_wNAF_have_precompute_mult(const EC_GROUP *group)
{
if (EC_EX_DATA_get_data(group->extra_data, ec_pre_comp_dup, ec_pre_comp_free, ec_pre_comp_clear_free) != NULL)
return 1;
-/* $OpenBSD: ec_pmeth.c,v 1.14 2022/11/19 07:00:57 tb Exp $ */
+/* $OpenBSD: ec_pmeth.c,v 1.15 2022/11/19 07:29:29 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
} EC_PKEY_CTX;
static int
-pkey_ec_init(EVP_PKEY_CTX * ctx)
+pkey_ec_init(EVP_PKEY_CTX *ctx)
{
EC_PKEY_CTX *dctx;
}
static int
-pkey_ec_copy(EVP_PKEY_CTX * dst, EVP_PKEY_CTX * src)
+pkey_ec_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
{
EC_PKEY_CTX *dctx, *sctx;
if (!pkey_ec_init(dst))
}
static void
-pkey_ec_cleanup(EVP_PKEY_CTX * ctx)
+pkey_ec_cleanup(EVP_PKEY_CTX *ctx)
{
EC_PKEY_CTX *dctx = ctx->data;
}
static int
-pkey_ec_sign(EVP_PKEY_CTX * ctx, unsigned char *sig, size_t * siglen,
+pkey_ec_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
const unsigned char *tbs, size_t tbslen)
{
int ret, type;
}
static int
-pkey_ec_verify(EVP_PKEY_CTX * ctx,
+pkey_ec_verify(EVP_PKEY_CTX *ctx,
const unsigned char *sig, size_t siglen,
const unsigned char *tbs, size_t tbslen)
{
}
static int
-pkey_ec_derive(EVP_PKEY_CTX * ctx, unsigned char *key, size_t * keylen)
+pkey_ec_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen)
{
int ret;
size_t outlen;
}
static int
-pkey_ec_ctrl(EVP_PKEY_CTX * ctx, int type, int p1, void *p2)
+pkey_ec_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
{
EC_PKEY_CTX *dctx = ctx->data;
EC_GROUP *group;
}
static int
-pkey_ec_ctrl_str(EVP_PKEY_CTX * ctx, const char *type, const char *value)
+pkey_ec_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value)
{
if (!strcmp(type, "ec_paramgen_curve")) {
int nid;
}
static int
-pkey_ec_paramgen(EVP_PKEY_CTX * ctx, EVP_PKEY * pkey)
+pkey_ec_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
{
EC_KEY *ec = NULL;
EC_PKEY_CTX *dctx = ctx->data;
}
static int
-pkey_ec_keygen(EVP_PKEY_CTX * ctx, EVP_PKEY * pkey)
+pkey_ec_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
{
EC_KEY *ec = NULL;
EC_PKEY_CTX *dctx = ctx->data;
-/* $OpenBSD: ec_print.c,v 1.7 2014/12/03 19:53:20 deraadt Exp $ */
+/* $OpenBSD: ec_print.c,v 1.8 2022/11/19 07:29:29 tb Exp $ */
/* ====================================================================
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
*
#include "ec_lcl.h"
BIGNUM *
-EC_POINT_point2bn(const EC_GROUP * group, const EC_POINT * point,
- point_conversion_form_t form, BIGNUM * ret, BN_CTX * ctx)
+EC_POINT_point2bn(const EC_GROUP *group, const EC_POINT *point,
+ point_conversion_form_t form, BIGNUM *ret, BN_CTX *ctx)
{
size_t buf_len = 0;
unsigned char *buf;
}
EC_POINT *
-EC_POINT_bn2point(const EC_GROUP * group,
- const BIGNUM * bn, EC_POINT * point, BN_CTX * ctx)
+EC_POINT_bn2point(const EC_GROUP *group,
+ const BIGNUM *bn, EC_POINT *point, BN_CTX *ctx)
{
size_t buf_len = 0;
unsigned char *buf;
/* the return value must be freed (using free()) */
char *
-EC_POINT_point2hex(const EC_GROUP * group, const EC_POINT * point,
- point_conversion_form_t form, BN_CTX * ctx)
+EC_POINT_point2hex(const EC_GROUP *group, const EC_POINT *point,
+ point_conversion_form_t form, BN_CTX *ctx)
{
char *ret, *p;
size_t buf_len = 0, i;
}
EC_POINT *
-EC_POINT_hex2point(const EC_GROUP * group, const char *buf,
- EC_POINT * point, BN_CTX * ctx)
+EC_POINT_hex2point(const EC_GROUP *group, const char *buf,
+ EC_POINT *point, BN_CTX *ctx)
{
EC_POINT *ret = NULL;
BIGNUM *tmp_bn = NULL;
-/* $OpenBSD: eck_prn.c,v 1.19 2022/11/19 07:00:57 tb Exp $ */
+/* $OpenBSD: eck_prn.c,v 1.20 2022/11/19 07:29:29 tb Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
#include <openssl/evp.h>
int
-ECPKParameters_print_fp(FILE * fp, const EC_GROUP * x, int off)
+ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off)
{
BIO *b;
int ret;
}
int
-EC_KEY_print_fp(FILE * fp, const EC_KEY * x, int off)
+EC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off)
{
BIO *b;
int ret;
}
int
-ECParameters_print_fp(FILE * fp, const EC_KEY * x)
+ECParameters_print_fp(FILE *fp, const EC_KEY *x)
{
BIO *b;
int ret;
}
int
-EC_KEY_print(BIO * bp, const EC_KEY * x, int off)
+EC_KEY_print(BIO *bp, const EC_KEY *x, int off)
{
EVP_PKEY *pk;
int ret = 0;
}
int
-ECParameters_print(BIO * bp, const EC_KEY * x)
+ECParameters_print(BIO *bp, const EC_KEY *x)
{
EVP_PKEY *pk;
int ret = 0;
}
static int
-print_bin(BIO * fp, const char *str, const unsigned char *num,
+print_bin(BIO *fp, const char *str, const unsigned char *num,
size_t len, int off);
int
-ECPKParameters_print(BIO * bp, const EC_GROUP * x, int off)
+ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)
{
unsigned char *buffer = NULL;
size_t buf_len = 0, i;
}
static int
-print_bin(BIO * fp, const char *name, const unsigned char *buf,
+print_bin(BIO *fp, const char *name, const unsigned char *buf,
size_t len, int off)
{
size_t i;
-/* $OpenBSD: ecp_mont.c,v 1.20 2021/09/08 17:29:21 tb Exp $ */
+/* $OpenBSD: ecp_mont.c,v 1.21 2022/11/19 07:29:29 tb Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
int
-ec_GFp_mont_group_init(EC_GROUP * group)
+ec_GFp_mont_group_init(EC_GROUP *group)
{
int ok;
void
-ec_GFp_mont_group_finish(EC_GROUP * group)
+ec_GFp_mont_group_finish(EC_GROUP *group)
{
BN_MONT_CTX_free(group->field_data1);
group->field_data1 = NULL;
void
-ec_GFp_mont_group_clear_finish(EC_GROUP * group)
+ec_GFp_mont_group_clear_finish(EC_GROUP *group)
{
BN_MONT_CTX_free(group->field_data1);
group->field_data1 = NULL;
int
-ec_GFp_mont_group_copy(EC_GROUP * dest, const EC_GROUP * src)
+ec_GFp_mont_group_copy(EC_GROUP *dest, const EC_GROUP *src)
{
BN_MONT_CTX_free(dest->field_data1);
dest->field_data1 = NULL;
-/* $OpenBSD: ecp_nist.c,v 1.19 2022/06/30 11:14:47 tb Exp $ */
+/* $OpenBSD: ecp_nist.c,v 1.20 2022/11/19 07:29:29 tb Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
}
int
-ec_GFp_nist_group_copy(EC_GROUP * dest, const EC_GROUP * src)
+ec_GFp_nist_group_copy(EC_GROUP *dest, const EC_GROUP *src)
{
dest->field_mod_func = src->field_mod_func;
int
-ec_GFp_nist_field_sqr(const EC_GROUP * group, BIGNUM * r, const BIGNUM * a,
- BN_CTX * ctx)
+ec_GFp_nist_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a,
+ BN_CTX *ctx)
{
int ret = 0;
BN_CTX *ctx_new = NULL;
-/* $OpenBSD: ecp_nistp224.c,v 1.27 2021/09/08 17:29:21 tb Exp $ */
+/* $OpenBSD: ecp_nistp224.c,v 1.28 2022/11/19 07:29:29 tb Exp $ */
/*
* Written by Emilia Kasper (Google) for the OpenSSL project.
*/
/* To preserve endianness when using BN_bn2bin and BN_bin2bn */
static void
-flip_endian(u8 * out, const u8 * in, unsigned len)
+flip_endian(u8 *out, const u8 *in, unsigned len)
{
unsigned i;
for (i = 0; i < len; ++i)
/* From OpenSSL BIGNUM to internal representation */
static int
-BN_to_felem(felem out, const BIGNUM * bn)
+BN_to_felem(felem out, const BIGNUM *bn)
{
felem_bytearray b_in;
felem_bytearray b_out;
/* From internal representation to OpenSSL BIGNUM */
static BIGNUM *
-felem_to_BN(BIGNUM * out, const felem in)
+felem_to_BN(BIGNUM *out, const felem in)
{
felem_bytearray b_in, b_out;
felem_to_bin28(b_in, in);
*/
int
-ec_GFp_nistp224_group_init(EC_GROUP * group)
+ec_GFp_nistp224_group_init(EC_GROUP *group)
{
int ret;
ret = ec_GFp_simple_group_init(group);
}
int
-ec_GFp_nistp224_group_set_curve(EC_GROUP * group, const BIGNUM * p,
- const BIGNUM * a, const BIGNUM * b, BN_CTX * ctx)
+ec_GFp_nistp224_group_set_curve(EC_GROUP *group, const BIGNUM *p,
+ const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
{
int ret = 0;
BN_CTX *new_ctx = NULL;
/* Takes the Jacobian coordinates (X, Y, Z) of a point and returns
* (X', Y') = (X/Z^2, Y/Z^3) */
int
-ec_GFp_nistp224_point_get_affine_coordinates(const EC_GROUP * group,
- const EC_POINT * point, BIGNUM * x, BIGNUM * y, BN_CTX * ctx)
+ec_GFp_nistp224_point_get_affine_coordinates(const EC_GROUP *group,
+ const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
{
felem z1, z2, x_in, y_in, x_out, y_out;
widefelem tmp;
/* Computes scalar*generator + \sum scalars[i]*points[i], ignoring NULL values
* Result is stored in r (r can equal one of the inputs). */
int
-ec_GFp_nistp224_points_mul(const EC_GROUP * group, EC_POINT * r,
- const BIGNUM * scalar, size_t num, const EC_POINT * points[],
- const BIGNUM * scalars[], BN_CTX * ctx)
+ec_GFp_nistp224_points_mul(const EC_GROUP *group, EC_POINT *r,
+ const BIGNUM *scalar, size_t num, const EC_POINT *points[],
+ const BIGNUM *scalars[], BN_CTX *ctx)
{
int ret = 0;
int j;
}
int
-ec_GFp_nistp224_precompute_mult(EC_GROUP * group, BN_CTX * ctx)
+ec_GFp_nistp224_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
{
int ret = 0;
NISTP224_PRE_COMP *pre = NULL;
}
int
-ec_GFp_nistp224_have_precompute_mult(const EC_GROUP * group)
+ec_GFp_nistp224_have_precompute_mult(const EC_GROUP *group)
{
if (EC_EX_DATA_get_data(group->extra_data, nistp224_pre_comp_dup,
nistp224_pre_comp_free, nistp224_pre_comp_clear_free)
-/* $OpenBSD: ecp_nistp256.c,v 1.26 2021/09/08 17:29:21 tb Exp $ */
+/* $OpenBSD: ecp_nistp256.c,v 1.27 2022/11/19 07:29:29 tb Exp $ */
/*
* Written by Adam Langley (Google) for the OpenSSL project
*/
/* To preserve endianness when using BN_bn2bin and BN_bin2bn */
static void
-flip_endian(u8 * out, const u8 * in, unsigned len)
+flip_endian(u8 *out, const u8 *in, unsigned len)
{
unsigned i;
for (i = 0; i < len; ++i)
/* BN_to_felem converts an OpenSSL BIGNUM into an felem */
static int
-BN_to_felem(felem out, const BIGNUM * bn)
+BN_to_felem(felem out, const BIGNUM *bn)
{
felem_bytearray b_in;
felem_bytearray b_out;
/* felem_to_BN converts an felem into an OpenSSL BIGNUM */
static BIGNUM *
-smallfelem_to_BN(BIGNUM * out, const smallfelem in)
+smallfelem_to_BN(BIGNUM *out, const smallfelem in)
{
felem_bytearray b_in, b_out;
smallfelem_to_bin32(b_in, in);
/* subtract_u64 sets *result = *result - v and *carry to one if the subtraction
* underflowed. */
static void
-subtract_u64(u64 * result, u64 * carry, u64 v)
+subtract_u64(u64 *result, u64 *carry, u64 v)
{
uint128_t r = *result;
r -= v;
* Output point (X, Y, Z) is stored in x_out, y_out, z_out */
static void
batch_mul(felem x_out, felem y_out, felem z_out,
- const felem_bytearray scalars[], const unsigned num_points, const u8 * g_scalar,
+ const felem_bytearray scalars[], const unsigned num_points, const u8 *g_scalar,
const int mixed, const smallfelem pre_comp[][17][3], const smallfelem g_pre_comp[2][16][3])
{
int i, skip;
*/
int
-ec_GFp_nistp256_group_init(EC_GROUP * group)
+ec_GFp_nistp256_group_init(EC_GROUP *group)
{
int ret;
ret = ec_GFp_simple_group_init(group);
}
int
-ec_GFp_nistp256_group_set_curve(EC_GROUP * group, const BIGNUM * p,
- const BIGNUM * a, const BIGNUM * b, BN_CTX * ctx)
+ec_GFp_nistp256_group_set_curve(EC_GROUP *group, const BIGNUM *p,
+ const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
{
int ret = 0;
BN_CTX *new_ctx = NULL;
/* Takes the Jacobian coordinates (X, Y, Z) of a point and returns
* (X', Y') = (X/Z^2, Y/Z^3) */
int
-ec_GFp_nistp256_point_get_affine_coordinates(const EC_GROUP * group,
- const EC_POINT * point, BIGNUM * x, BIGNUM * y, BN_CTX * ctx)
+ec_GFp_nistp256_point_get_affine_coordinates(const EC_GROUP *group,
+ const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
{
felem z1, z2, x_in, y_in;
smallfelem x_out, y_out;
/* Computes scalar*generator + \sum scalars[i]*points[i], ignoring NULL values
* Result is stored in r (r can equal one of the inputs). */
int
-ec_GFp_nistp256_points_mul(const EC_GROUP * group, EC_POINT * r,
- const BIGNUM * scalar, size_t num, const EC_POINT * points[],
- const BIGNUM * scalars[], BN_CTX * ctx)
+ec_GFp_nistp256_points_mul(const EC_GROUP *group, EC_POINT *r,
+ const BIGNUM *scalar, size_t num, const EC_POINT *points[],
+ const BIGNUM *scalars[], BN_CTX *ctx)
{
int ret = 0;
int j;
}
int
-ec_GFp_nistp256_precompute_mult(EC_GROUP * group, BN_CTX * ctx)
+ec_GFp_nistp256_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
{
int ret = 0;
NISTP256_PRE_COMP *pre = NULL;
}
int
-ec_GFp_nistp256_have_precompute_mult(const EC_GROUP * group)
+ec_GFp_nistp256_have_precompute_mult(const EC_GROUP *group)
{
if (EC_EX_DATA_get_data(group->extra_data, nistp256_pre_comp_dup,
nistp256_pre_comp_free, nistp256_pre_comp_clear_free)
-/* $OpenBSD: ecp_nistp521.c,v 1.27 2021/09/08 17:29:21 tb Exp $ */
+/* $OpenBSD: ecp_nistp521.c,v 1.28 2022/11/19 07:29:29 tb Exp $ */
/*
* Written by Adam Langley (Google) for the OpenSSL project
*/
/* To preserve endianness when using BN_bn2bin and BN_bin2bn */
static void
-flip_endian(u8 * out, const u8 * in, unsigned len)
+flip_endian(u8 *out, const u8 *in, unsigned len)
{
unsigned i;
for (i = 0; i < len; ++i)
/* BN_to_felem converts an OpenSSL BIGNUM into an felem */
static int
-BN_to_felem(felem out, const BIGNUM * bn)
+BN_to_felem(felem out, const BIGNUM *bn)
{
felem_bytearray b_in;
felem_bytearray b_out;
/* felem_to_BN converts an felem into an OpenSSL BIGNUM */
static BIGNUM *
-felem_to_BN(BIGNUM * out, const felem in)
+felem_to_BN(BIGNUM *out, const felem in)
{
felem_bytearray b_in, b_out;
felem_to_bin66(b_in, in);
* Output point (X, Y, Z) is stored in x_out, y_out, z_out */
static void
batch_mul(felem x_out, felem y_out, felem z_out,
- const felem_bytearray scalars[], const unsigned num_points, const u8 * g_scalar,
+ const felem_bytearray scalars[], const unsigned num_points, const u8 *g_scalar,
const int mixed, const felem pre_comp[][17][3], const felem g_pre_comp[16][3])
{
int i, skip;
*/
int
-ec_GFp_nistp521_group_init(EC_GROUP * group)
+ec_GFp_nistp521_group_init(EC_GROUP *group)
{
int ret;
ret = ec_GFp_simple_group_init(group);
}
int
-ec_GFp_nistp521_group_set_curve(EC_GROUP * group, const BIGNUM * p,
- const BIGNUM * a, const BIGNUM * b, BN_CTX * ctx)
+ec_GFp_nistp521_group_set_curve(EC_GROUP *group, const BIGNUM *p,
+ const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
{
int ret = 0;
BN_CTX *new_ctx = NULL;
/* Takes the Jacobian coordinates (X, Y, Z) of a point and returns
* (X', Y') = (X/Z^2, Y/Z^3) */
int
-ec_GFp_nistp521_point_get_affine_coordinates(const EC_GROUP * group,
- const EC_POINT * point, BIGNUM * x, BIGNUM * y, BN_CTX * ctx)
+ec_GFp_nistp521_point_get_affine_coordinates(const EC_GROUP *group,
+ const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
{
felem z1, z2, x_in, y_in, x_out, y_out;
largefelem tmp;
/* Computes scalar*generator + \sum scalars[i]*points[i], ignoring NULL values
* Result is stored in r (r can equal one of the inputs). */
int
-ec_GFp_nistp521_points_mul(const EC_GROUP * group, EC_POINT * r,
- const BIGNUM * scalar, size_t num, const EC_POINT * points[],
- const BIGNUM * scalars[], BN_CTX * ctx)
+ec_GFp_nistp521_points_mul(const EC_GROUP *group, EC_POINT *r,
+ const BIGNUM *scalar, size_t num, const EC_POINT *points[],
+ const BIGNUM *scalars[], BN_CTX *ctx)
{
int ret = 0;
int j;
}
int
-ec_GFp_nistp521_precompute_mult(EC_GROUP * group, BN_CTX * ctx)
+ec_GFp_nistp521_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
{
int ret = 0;
NISTP521_PRE_COMP *pre = NULL;
}
int
-ec_GFp_nistp521_have_precompute_mult(const EC_GROUP * group)
+ec_GFp_nistp521_have_precompute_mult(const EC_GROUP *group)
{
if (EC_EX_DATA_get_data(group->extra_data, nistp521_pre_comp_dup,
nistp521_pre_comp_free, nistp521_pre_comp_clear_free)
-/* $OpenBSD: ecp_oct.c,v 1.15 2022/11/19 07:00:57 tb Exp $ */
+/* $OpenBSD: ecp_oct.c,v 1.16 2022/11/19 07:29:29 tb Exp $ */
/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
* for the OpenSSL project.
* Includes code written by Bodo Moeller for the OpenSSL project.
#include "ec_lcl.h"
int
-ec_GFp_simple_set_compressed_coordinates(const EC_GROUP * group,
- EC_POINT * point, const BIGNUM * x_, int y_bit, BN_CTX * ctx)
+ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group,
+ EC_POINT *point, const BIGNUM *x_, int y_bit, BN_CTX *ctx)
{
BN_CTX *new_ctx = NULL;
BIGNUM *tmp1, *tmp2, *x, *y;
size_t
-ec_GFp_simple_point2oct(const EC_GROUP * group, const EC_POINT * point, point_conversion_form_t form,
- unsigned char *buf, size_t len, BN_CTX * ctx)
+ec_GFp_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, point_conversion_form_t form,
+ unsigned char *buf, size_t len, BN_CTX *ctx)
{
size_t ret;
BN_CTX *new_ctx = NULL;
int
-ec_GFp_simple_oct2point(const EC_GROUP * group, EC_POINT * point,
- const unsigned char *buf, size_t len, BN_CTX * ctx)
+ec_GFp_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
+ const unsigned char *buf, size_t len, BN_CTX *ctx)
{
point_conversion_form_t form;
int y_bit;
-/* $OpenBSD: ecp_smpl.c,v 1.35 2022/11/19 07:00:57 tb Exp $ */
+/* $OpenBSD: ecp_smpl.c,v 1.36 2022/11/19 07:29:29 tb Exp $ */
/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
* for the OpenSSL project.
* Includes code written by Bodo Moeller for the OpenSSL project.
int
-ec_GFp_simple_group_init(EC_GROUP * group)
+ec_GFp_simple_group_init(EC_GROUP *group)
{
BN_init(&group->field);
BN_init(&group->a);
void
-ec_GFp_simple_group_finish(EC_GROUP * group)
+ec_GFp_simple_group_finish(EC_GROUP *group)
{
BN_free(&group->field);
BN_free(&group->a);
void
-ec_GFp_simple_group_clear_finish(EC_GROUP * group)
+ec_GFp_simple_group_clear_finish(EC_GROUP *group)
{
BN_clear_free(&group->field);
BN_clear_free(&group->a);
int
-ec_GFp_simple_group_copy(EC_GROUP * dest, const EC_GROUP * src)
+ec_GFp_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src)
{
if (!BN_copy(&dest->field, &src->field))
return 0;
int
-ec_GFp_simple_group_set_curve(EC_GROUP * group,
- const BIGNUM * p, const BIGNUM * a, const BIGNUM * b, BN_CTX * ctx)
+ec_GFp_simple_group_set_curve(EC_GROUP *group,
+ const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
{
int ret = 0;
BN_CTX *new_ctx = NULL;
int
-ec_GFp_simple_group_get_curve(const EC_GROUP * group, BIGNUM * p, BIGNUM * a, BIGNUM * b, BN_CTX * ctx)
+ec_GFp_simple_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx)
{
int ret = 0;
BN_CTX *new_ctx = NULL;
int
-ec_GFp_simple_group_get_degree(const EC_GROUP * group)
+ec_GFp_simple_group_get_degree(const EC_GROUP *group)
{
return BN_num_bits(&group->field);
}
int
-ec_GFp_simple_group_check_discriminant(const EC_GROUP * group, BN_CTX * ctx)
+ec_GFp_simple_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx)
{
int ret = 0;
BIGNUM *a, *b, *order, *tmp_1, *tmp_2;
void
-ec_GFp_simple_point_finish(EC_POINT * point)
+ec_GFp_simple_point_finish(EC_POINT *point)
{
BN_free(&point->X);
BN_free(&point->Y);
void
-ec_GFp_simple_point_clear_finish(EC_POINT * point)
+ec_GFp_simple_point_clear_finish(EC_POINT *point)
{
BN_clear_free(&point->X);
BN_clear_free(&point->Y);
int
-ec_GFp_simple_point_copy(EC_POINT * dest, const EC_POINT * src)
+ec_GFp_simple_point_copy(EC_POINT *dest, const EC_POINT *src)
{
if (!BN_copy(&dest->X, &src->X))
return 0;
int
-ec_GFp_simple_point_set_to_infinity(const EC_GROUP * group, EC_POINT * point)
+ec_GFp_simple_point_set_to_infinity(const EC_GROUP *group, EC_POINT *point)
{
point->Z_is_one = 0;
BN_zero(&point->Z);
}
int
-ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP * group, EC_POINT * point,
- const BIGNUM * x, const BIGNUM * y, BN_CTX * ctx)
+ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point,
+ const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx)
{
if (x == NULL || y == NULL) {
/* unlike for projective coordinates, we do not tolerate this */
}
int
-ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP * group, const EC_POINT * point,
- BIGNUM * x, BIGNUM * y, BN_CTX * ctx)
+ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point,
+ BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
{
BN_CTX *new_ctx = NULL;
BIGNUM *Z, *Z_1, *Z_2, *Z_3;
}
int
-ec_GFp_simple_add(const EC_GROUP * group, EC_POINT * r, const EC_POINT * a, const EC_POINT * b, BN_CTX * ctx)
+ec_GFp_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx)
{
int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *);
int
-ec_GFp_simple_dbl(const EC_GROUP * group, EC_POINT * r, const EC_POINT * a, BN_CTX * ctx)
+ec_GFp_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx)
{
int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *);
int
-ec_GFp_simple_invert(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx)
+ec_GFp_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx)
{
if (EC_POINT_is_at_infinity(group, point) > 0 || BN_is_zero(&point->Y))
/* point is its own inverse */
int
-ec_GFp_simple_is_at_infinity(const EC_GROUP * group, const EC_POINT * point)
+ec_GFp_simple_is_at_infinity(const EC_GROUP *group, const EC_POINT *point)
{
return BN_is_zero(&point->Z);
}
int
-ec_GFp_simple_is_on_curve(const EC_GROUP * group, const EC_POINT * point, BN_CTX * ctx)
+ec_GFp_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx)
{
int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *);
int
-ec_GFp_simple_cmp(const EC_GROUP * group, const EC_POINT * a, const EC_POINT * b, BN_CTX * ctx)
+ec_GFp_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx)
{
/*
* return values: -1 error 0 equal (in affine coordinates) 1
int
-ec_GFp_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx)
+ec_GFp_simple_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx)
{
BN_CTX *new_ctx = NULL;
BIGNUM *x, *y;
int
-ec_GFp_simple_points_make_affine(const EC_GROUP * group, size_t num, EC_POINT * points[], BN_CTX * ctx)
+ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx)
{
BN_CTX *new_ctx = NULL;
BIGNUM *tmp0, *tmp1;
int
-ec_GFp_simple_field_mul(const EC_GROUP * group, BIGNUM * r, const BIGNUM * a, const BIGNUM * b, BN_CTX * ctx)
+ec_GFp_simple_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
{
return BN_mod_mul(r, a, b, &group->field, ctx);
}
int
-ec_GFp_simple_field_sqr(const EC_GROUP * group, BIGNUM * r, const BIGNUM * a, BN_CTX * ctx)
+ec_GFp_simple_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
{
return BN_mod_sqr(r, a, &group->field, ctx);
}