From 8071d4dbe5da21882b50d14fd5f7e4585b3ee697 Mon Sep 17 00:00:00 2001 From: tb Date: Sat, 19 Nov 2022 07:29:29 +0000 Subject: [PATCH] Fix an annoying quirk in the EC code Dealing with elliptic curves makes some people think that it would be kind of neat to multiply types with variable names. Sometimes. Only in function definitions. --- lib/libcrypto/ec/ec2_mult.c | 6 ++-- lib/libcrypto/ec/ec2_oct.c | 4 +-- lib/libcrypto/ec/ec2_smpl.c | 34 +++++++++---------- lib/libcrypto/ec/ec_ameth.c | 50 +++++++++++++-------------- lib/libcrypto/ec/ec_asn1.c | 28 +++++++-------- lib/libcrypto/ec/ec_check.c | 4 +-- lib/libcrypto/ec/ec_curve.c | 4 +-- lib/libcrypto/ec/ec_key.c | 46 ++++++++++++------------- lib/libcrypto/ec/ec_lib.c | 60 ++++++++++++++++----------------- lib/libcrypto/ec/ec_mult.c | 14 ++++---- lib/libcrypto/ec/ec_pmeth.c | 22 ++++++------ lib/libcrypto/ec/ec_print.c | 18 +++++----- lib/libcrypto/ec/eck_prn.c | 18 +++++----- lib/libcrypto/ec/ecp_mont.c | 10 +++--- lib/libcrypto/ec/ecp_nist.c | 8 ++--- lib/libcrypto/ec/ecp_nistp224.c | 28 +++++++-------- lib/libcrypto/ec/ecp_nistp256.c | 32 +++++++++--------- lib/libcrypto/ec/ecp_nistp521.c | 30 ++++++++--------- lib/libcrypto/ec/ecp_oct.c | 14 ++++---- lib/libcrypto/ec/ecp_smpl.c | 56 +++++++++++++++--------------- 20 files changed, 243 insertions(+), 243 deletions(-) diff --git a/lib/libcrypto/ec/ec2_mult.c b/lib/libcrypto/ec/ec2_mult.c index 3e5d1dca853..c44ac5c3dbb 100644 --- a/lib/libcrypto/ec/ec2_mult.c +++ b/lib/libcrypto/ec/ec2_mult.c @@ -1,4 +1,4 @@ -/* $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. * @@ -441,13 +441,13 @@ ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, * 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); } diff --git a/lib/libcrypto/ec/ec2_oct.c b/lib/libcrypto/ec/ec2_oct.c index b25084ef584..be292032921 100644 --- a/lib/libcrypto/ec/ec2_oct.c +++ b/lib/libcrypto/ec/ec2_oct.c @@ -1,4 +1,4 @@ -/* $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. * @@ -175,7 +175,7 @@ ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point 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; diff --git a/lib/libcrypto/ec/ec2_smpl.c b/lib/libcrypto/ec/ec2_smpl.c index 17664d04262..b3030edeeec 100644 --- a/lib/libcrypto/ec/ec2_smpl.c +++ b/lib/libcrypto/ec/ec2_smpl.c @@ -1,4 +1,4 @@ -/* $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. * @@ -127,7 +127,7 @@ EC_GF2m_simple_method(void) * 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); @@ -140,7 +140,7 @@ ec_GF2m_simple_group_init(EC_GROUP * group) * 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); @@ -152,7 +152,7 @@ ec_GF2m_simple_group_finish(EC_GROUP * group) * 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); @@ -170,7 +170,7 @@ ec_GF2m_simple_group_clear_finish(EC_GROUP * group) * 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; @@ -200,8 +200,8 @@ ec_GF2m_simple_group_copy(EC_GROUP * dest, const EC_GROUP * src) /* 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; @@ -265,7 +265,7 @@ ec_GF2m_simple_group_get_curve(const EC_GROUP *group, /* 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; } @@ -275,7 +275,7 @@ ec_GF2m_simple_group_get_degree(const EC_GROUP * group) * 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; @@ -314,7 +314,7 @@ ec_GF2m_simple_group_check_discriminant(const EC_GROUP * group, BN_CTX * ctx) /* 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); @@ -325,7 +325,7 @@ ec_GF2m_simple_point_init(EC_POINT * point) /* 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); @@ -335,7 +335,7 @@ ec_GF2m_simple_point_finish(EC_POINT * point) /* 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); @@ -346,7 +346,7 @@ ec_GF2m_simple_point_clear_finish(EC_POINT * point) /* 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; @@ -364,7 +364,7 @@ ec_GF2m_simple_point_copy(EC_POINT * dest, const EC_POINT * src) * 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); @@ -376,8 +376,8 @@ ec_GF2m_simple_point_set_to_infinity(const EC_GROUP * group, EC_POINT * point) * 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) { @@ -701,7 +701,7 @@ ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a, /* 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; diff --git a/lib/libcrypto/ec/ec_ameth.c b/lib/libcrypto/ec/ec_ameth.c index ee931a93c6e..b6f21ade634 100644 --- a/lib/libcrypto/ec/ec_ameth.c +++ b/lib/libcrypto/ec/ec_ameth.c @@ -1,4 +1,4 @@ -/* $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. */ @@ -76,7 +76,7 @@ static int ecdh_cms_encrypt(CMS_RecipientInfo *ri); #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; @@ -108,7 +108,7 @@ eckey_param2type(int *pptype, void **ppval, EC_KEY * ec_key) } 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; @@ -191,7 +191,7 @@ eckey_type2param(int ptype, const void *pval) } 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; @@ -224,7 +224,7 @@ eckey_pub_decode(EVP_PKEY * pkey, X509_PUBKEY * pubkey) } 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); @@ -239,7 +239,7 @@ eckey_pub_cmp(const EVP_PKEY * a, const EVP_PKEY * b) } 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; @@ -306,7 +306,7 @@ eckey_priv_decode(EVP_PKEY * pkey, const PKCS8_PRIV_KEY_INFO * p8) } 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; @@ -359,13 +359,13 @@ eckey_priv_encode(PKCS8_PRIV_KEY_INFO * p8, const EVP_PKEY * pkey) } 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; @@ -406,7 +406,7 @@ ec_security_bits(const EVP_PKEY *pkey) } 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; @@ -414,13 +414,13 @@ ec_missing_parameters(const EVP_PKEY * pkey) } 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)) @@ -430,13 +430,13 @@ ec_cmp_parameters(const EVP_PKEY * a, const EVP_PKEY * b) } 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; @@ -520,7 +520,7 @@ do_EC_KEY_print(BIO * bp, const EC_KEY * x, int off, int ktype) } static int -eckey_param_decode(EVP_PKEY * pkey, +eckey_param_decode(EVP_PKEY *pkey, const unsigned char **pder, int derlen) { EC_KEY *eckey; @@ -533,35 +533,35 @@ eckey_param_decode(EVP_PKEY * pkey, } 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; @@ -574,13 +574,13 @@ old_ec_priv_decode(EVP_PKEY * pkey, } 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: diff --git a/lib/libcrypto/ec/ec_asn1.c b/lib/libcrypto/ec/ec_asn1.c index baa58b5183c..974afffe78d 100644 --- a/lib/libcrypto/ec/ec_asn1.c +++ b/lib/libcrypto/ec/ec_asn1.c @@ -1,4 +1,4 @@ -/* $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. */ @@ -68,7 +68,7 @@ #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; @@ -91,7 +91,7 @@ EC_GROUP_get_basis_type(const EC_GROUP * group) #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; @@ -109,7 +109,7 @@ EC_GROUP_get_trinomial_basis(const EC_GROUP * group, unsigned int *k) } 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) @@ -683,7 +683,7 @@ static ECPKPARAMETERS *ec_asn1_group2pkparameters(const EC_GROUP *, /* 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; @@ -799,7 +799,7 @@ ec_asn1_group2fieldid(const EC_GROUP * group, X9_62_FIELDID * field) } 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, @@ -894,7 +894,7 @@ ec_asn1_group2curve(const EC_GROUP * group, X9_62_CURVE * curve) } 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; @@ -989,7 +989,7 @@ ec_asn1_group2parameters(const EC_GROUP * group, ECPARAMETERS * param) } 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; @@ -1035,7 +1035,7 @@ ec_asn1_group2pkparameters(const EC_GROUP * group, ECPKPARAMETERS * params) } static EC_GROUP * -ec_asn1_parameters2group(const ECPARAMETERS * params) +ec_asn1_parameters2group(const ECPARAMETERS *params) { int ok = 0, tmp; EC_GROUP *ret = NULL; @@ -1247,7 +1247,7 @@ ec_asn1_parameters2group(const ECPARAMETERS * params) } EC_GROUP * -ec_asn1_pkparameters2group(const ECPKPARAMETERS * params) +ec_asn1_pkparameters2group(const ECPKPARAMETERS *params) { EC_GROUP *ret = NULL; int tmp = 0; @@ -1309,7 +1309,7 @@ d2i_ECPKParameters(EC_GROUP ** a, const unsigned char **in, long len) } 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); @@ -1421,7 +1421,7 @@ d2i_ECPrivateKey(EC_KEY ** a, const unsigned char **in, long len) } 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; @@ -1505,7 +1505,7 @@ i2d_ECPrivateKey(EC_KEY * a, unsigned char **out) } 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); @@ -1570,7 +1570,7 @@ o2i_ECPublicKey(EC_KEY ** a, const unsigned char **in, long len) } 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; diff --git a/lib/libcrypto/ec/ec_check.c b/lib/libcrypto/ec/ec_check.c index 3f6a802374c..cc54ded3e74 100644 --- a/lib/libcrypto/ec/ec_check.c +++ b/lib/libcrypto/ec/ec_check.c @@ -1,4 +1,4 @@ -/* $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. * @@ -57,7 +57,7 @@ #include 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; diff --git a/lib/libcrypto/ec/ec_curve.c b/lib/libcrypto/ec/ec_curve.c index 1f69d4f1dc3..592a367a82a 100644 --- a/lib/libcrypto/ec/ec_curve.c +++ b/lib/libcrypto/ec/ec_curve.c @@ -1,4 +1,4 @@ -/* $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. */ @@ -3434,7 +3434,7 @@ EC_GROUP_new_by_curve_name(int nid) } 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; diff --git a/lib/libcrypto/ec/ec_key.c b/lib/libcrypto/ec/ec_key.c index 3aa6a96eb87..fa8d4632205 100644 --- a/lib/libcrypto/ec/ec_key.c +++ b/lib/libcrypto/ec/ec_key.c @@ -1,4 +1,4 @@ -/* $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. */ @@ -99,7 +99,7 @@ EC_KEY_new_by_curve_name(int nid) } void -EC_KEY_free(EC_KEY * r) +EC_KEY_free(EC_KEY *r) { int i; @@ -128,7 +128,7 @@ EC_KEY_free(EC_KEY * r) } 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; @@ -215,7 +215,7 @@ EC_KEY_copy(EC_KEY * dest, const EC_KEY * src) } EC_KEY * -EC_KEY_dup(const EC_KEY * ec_key) +EC_KEY_dup(const EC_KEY *ec_key) { EC_KEY *ret; @@ -229,7 +229,7 @@ EC_KEY_dup(const EC_KEY * ec_key) } 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); @@ -309,7 +309,7 @@ ossl_ec_key_gen(EC_KEY *eckey) } int -EC_KEY_check_key(const EC_KEY * eckey) +EC_KEY_check_key(const EC_KEY *eckey) { int ok = 0; BN_CTX *ctx = NULL; @@ -376,7 +376,7 @@ EC_KEY_check_key(const EC_KEY * eckey) } 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; @@ -429,13 +429,13 @@ EC_KEY_set_public_key_affine_coordinates(EC_KEY * key, BIGNUM * x, BIGNUM * y) } 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) @@ -446,13 +446,13 @@ EC_KEY_set_group(EC_KEY * key, const EC_GROUP * group) } 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) @@ -463,13 +463,13 @@ EC_KEY_set_private_key(EC_KEY * key, const BIGNUM * priv_key) } 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) @@ -480,25 +480,25 @@ EC_KEY_set_public_key(EC_KEY * key, const EC_POINT * pub_key) } 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) @@ -521,7 +521,7 @@ EC_KEY_get_key_method_data(EC_KEY *key, } 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 *)) @@ -538,14 +538,14 @@ EC_KEY_insert_key_method_data(EC_KEY * key, void *data, } 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; @@ -553,19 +553,19 @@ EC_KEY_precompute_mult(EC_KEY * key, BN_CTX * ctx) } 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; } diff --git a/lib/libcrypto/ec/ec_lib.c b/lib/libcrypto/ec/ec_lib.c index 4ec17d5d5d1..151e91b36c8 100644 --- a/lib/libcrypto/ec/ec_lib.c +++ b/lib/libcrypto/ec/ec_lib.c @@ -1,4 +1,4 @@ -/* $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. */ @@ -74,7 +74,7 @@ /* functions for EC_GROUP objects */ EC_GROUP * -EC_GROUP_new(const EC_METHOD * meth) +EC_GROUP_new(const EC_METHOD *meth) { EC_GROUP *ret; @@ -115,7 +115,7 @@ EC_GROUP_new(const EC_METHOD * meth) void -EC_GROUP_free(EC_GROUP * group) +EC_GROUP_free(EC_GROUP *group) { if (!group) return; @@ -136,7 +136,7 @@ EC_GROUP_free(EC_GROUP * group) void -EC_GROUP_clear_free(EC_GROUP * group) +EC_GROUP_clear_free(EC_GROUP *group) { if (!group) return; @@ -158,7 +158,7 @@ EC_GROUP_clear_free(EC_GROUP * group) 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; @@ -227,7 +227,7 @@ EC_GROUP_copy(EC_GROUP * dest, const EC_GROUP * src) EC_GROUP * -EC_GROUP_dup(const EC_GROUP * a) +EC_GROUP_dup(const EC_GROUP *a) { EC_GROUP *t = NULL; @@ -428,35 +428,35 @@ EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx) 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; @@ -464,14 +464,14 @@ EC_GROUP_set_point_conversion_form(EC_GROUP * group, 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); @@ -491,14 +491,14 @@ EC_GROUP_set_seed(EC_GROUP * group, const unsigned char *p, size_t len) 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; } @@ -556,7 +556,7 @@ EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, #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); @@ -567,7 +567,7 @@ EC_GROUP_get_degree(const EC_GROUP * group) 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); @@ -578,7 +578,7 @@ EC_GROUP_check_discriminant(const EC_GROUP * group, BN_CTX * ctx) 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; @@ -710,7 +710,7 @@ EC_EX_DATA_set_data(EC_EXTRA_DATA ** ex_data, void *data, /* 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 *)) @@ -825,7 +825,7 @@ EC_EX_DATA_clear_free_all_data(EC_EXTRA_DATA ** ex_data) /* functions for EC_POINT objects */ EC_POINT * -EC_POINT_new(const EC_GROUP * group) +EC_POINT_new(const EC_GROUP *group) { EC_POINT *ret; @@ -853,7 +853,7 @@ EC_POINT_new(const EC_GROUP * group) void -EC_POINT_free(EC_POINT * point) +EC_POINT_free(EC_POINT *point) { if (!point) return; @@ -865,7 +865,7 @@ EC_POINT_free(EC_POINT * point) void -EC_POINT_clear_free(EC_POINT * point) +EC_POINT_clear_free(EC_POINT *point) { if (!point) return; @@ -879,7 +879,7 @@ EC_POINT_clear_free(EC_POINT * point) 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); @@ -896,7 +896,7 @@ EC_POINT_copy(EC_POINT * dest, const EC_POINT * src) 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; @@ -917,14 +917,14 @@ EC_POINT_dup(const EC_POINT * a, const EC_GROUP * group) 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); @@ -1113,7 +1113,7 @@ 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) +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); @@ -1129,7 +1129,7 @@ EC_POINT_is_on_curve(const EC_GROUP * group, const EC_POINT * point, BN_CTX * ct 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); @@ -1258,7 +1258,7 @@ EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, } 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); @@ -1267,7 +1267,7 @@ EC_GROUP_precompute_mult(EC_GROUP * group, BN_CTX * 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); diff --git a/lib/libcrypto/ec/ec_mult.c b/lib/libcrypto/ec/ec_mult.c index 1198a6f6b18..a3da62323ac 100644 --- a/lib/libcrypto/ec/ec_mult.c +++ b/lib/libcrypto/ec/ec_mult.c @@ -1,4 +1,4 @@ -/* $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. */ @@ -98,7 +98,7 @@ static void ec_pre_comp_free(void *); 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; @@ -192,7 +192,7 @@ ec_pre_comp_clear_free(void *pre_) * 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; @@ -332,8 +332,8 @@ compute_wNAF(const BIGNUM * scalar, int w, size_t * ret_len) * 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; @@ -722,7 +722,7 @@ ec_wNAF_mul(const EC_GROUP * group, EC_POINT * r, const BIGNUM * scalar, * 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; @@ -876,7 +876,7 @@ ec_wNAF_precompute_mult(EC_GROUP * group, BN_CTX * ctx) 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; diff --git a/lib/libcrypto/ec/ec_pmeth.c b/lib/libcrypto/ec/ec_pmeth.c index 3637d6bba67..80c09b1e21c 100644 --- a/lib/libcrypto/ec/ec_pmeth.c +++ b/lib/libcrypto/ec/ec_pmeth.c @@ -1,4 +1,4 @@ -/* $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. */ @@ -94,7 +94,7 @@ typedef struct { } EC_PKEY_CTX; static int -pkey_ec_init(EVP_PKEY_CTX * ctx) +pkey_ec_init(EVP_PKEY_CTX *ctx) { EC_PKEY_CTX *dctx; @@ -112,7 +112,7 @@ pkey_ec_init(EVP_PKEY_CTX * ctx) } 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)) @@ -147,7 +147,7 @@ pkey_ec_copy(EVP_PKEY_CTX * dst, EVP_PKEY_CTX * src) } static void -pkey_ec_cleanup(EVP_PKEY_CTX * ctx) +pkey_ec_cleanup(EVP_PKEY_CTX *ctx) { EC_PKEY_CTX *dctx = ctx->data; @@ -161,7 +161,7 @@ pkey_ec_cleanup(EVP_PKEY_CTX * ctx) } 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; @@ -189,7 +189,7 @@ pkey_ec_sign(EVP_PKEY_CTX * ctx, unsigned char *sig, size_t * siglen, } 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) { @@ -208,7 +208,7 @@ pkey_ec_verify(EVP_PKEY_CTX * ctx, } 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; @@ -284,7 +284,7 @@ pkey_ec_kdf_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen) } 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; @@ -411,7 +411,7 @@ pkey_ec_ctrl(EVP_PKEY_CTX * ctx, int type, int p1, void *p2) } 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; @@ -450,7 +450,7 @@ pkey_ec_ctrl_str(EVP_PKEY_CTX * ctx, const char *type, const char *value) } 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; @@ -471,7 +471,7 @@ pkey_ec_paramgen(EVP_PKEY_CTX * ctx, EVP_PKEY * pkey) } 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; diff --git a/lib/libcrypto/ec/ec_print.c b/lib/libcrypto/ec/ec_print.c index af4d1996c0f..18d7a7a01fd 100644 --- a/lib/libcrypto/ec/ec_print.c +++ b/lib/libcrypto/ec/ec_print.c @@ -1,4 +1,4 @@ -/* $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. * @@ -57,8 +57,8 @@ #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; @@ -83,8 +83,8 @@ EC_POINT_point2bn(const EC_GROUP * group, const EC_POINT * point, } 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; @@ -122,8 +122,8 @@ static const char *HEX_DIGITS = "0123456789ABCDEF"; /* 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; @@ -161,8 +161,8 @@ EC_POINT_point2hex(const EC_GROUP * group, const EC_POINT * point, } 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; diff --git a/lib/libcrypto/ec/eck_prn.c b/lib/libcrypto/ec/eck_prn.c index 14185c76054..f7ce8debb0a 100644 --- a/lib/libcrypto/ec/eck_prn.c +++ b/lib/libcrypto/ec/eck_prn.c @@ -1,4 +1,4 @@ -/* $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. */ @@ -70,7 +70,7 @@ #include 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; @@ -86,7 +86,7 @@ ECPKParameters_print_fp(FILE * fp, const EC_GROUP * x, int off) } 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; @@ -102,7 +102,7 @@ EC_KEY_print_fp(FILE * fp, const EC_KEY * x, int off) } int -ECParameters_print_fp(FILE * fp, const EC_KEY * x) +ECParameters_print_fp(FILE *fp, const EC_KEY *x) { BIO *b; int ret; @@ -118,7 +118,7 @@ ECParameters_print_fp(FILE * fp, const EC_KEY * x) } 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; @@ -136,7 +136,7 @@ EC_KEY_print(BIO * bp, const EC_KEY * x, int off) } int -ECParameters_print(BIO * bp, const EC_KEY * x) +ECParameters_print(BIO *bp, const EC_KEY *x) { EVP_PKEY *pk; int ret = 0; @@ -154,11 +154,11 @@ ECParameters_print(BIO * bp, const EC_KEY * x) } 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; @@ -334,7 +334,7 @@ ECPKParameters_print(BIO * bp, const EC_GROUP * x, int off) } 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; diff --git a/lib/libcrypto/ec/ecp_mont.c b/lib/libcrypto/ec/ecp_mont.c index 0da3083d8e4..da6d2f1cf00 100644 --- a/lib/libcrypto/ec/ecp_mont.c +++ b/lib/libcrypto/ec/ecp_mont.c @@ -1,4 +1,4 @@ -/* $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. */ @@ -119,7 +119,7 @@ EC_GFp_mont_method(void) int -ec_GFp_mont_group_init(EC_GROUP * group) +ec_GFp_mont_group_init(EC_GROUP *group) { int ok; @@ -131,7 +131,7 @@ ec_GFp_mont_group_init(EC_GROUP * group) 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; @@ -142,7 +142,7 @@ ec_GFp_mont_group_finish(EC_GROUP * group) 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; @@ -153,7 +153,7 @@ ec_GFp_mont_group_clear_finish(EC_GROUP * group) 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; diff --git a/lib/libcrypto/ec/ecp_nist.c b/lib/libcrypto/ec/ecp_nist.c index b3cea0c4c0a..d3cb4f37b77 100644 --- a/lib/libcrypto/ec/ecp_nist.c +++ b/lib/libcrypto/ec/ecp_nist.c @@ -1,4 +1,4 @@ -/* $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. */ @@ -117,7 +117,7 @@ EC_GFp_nist_method(void) } 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; @@ -192,8 +192,8 @@ ec_GFp_nist_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, 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; diff --git a/lib/libcrypto/ec/ecp_nistp224.c b/lib/libcrypto/ec/ecp_nistp224.c index 9ef9dc3585c..70944c463d8 100644 --- a/lib/libcrypto/ec/ecp_nistp224.c +++ b/lib/libcrypto/ec/ecp_nistp224.c @@ -1,4 +1,4 @@ -/* $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. */ @@ -302,7 +302,7 @@ felem_to_bin28(u8 out[28], const felem in) /* 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) @@ -311,7 +311,7 @@ flip_endian(u8 * out, const u8 * in, unsigned len) /* 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; @@ -336,7 +336,7 @@ BN_to_felem(felem out, const BIGNUM * bn) /* 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); @@ -1249,7 +1249,7 @@ nistp224_pre_comp_clear_free(void *pre_) */ 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); @@ -1258,8 +1258,8 @@ ec_GFp_nistp224_group_init(EC_GROUP * 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; @@ -1292,8 +1292,8 @@ ec_GFp_nistp224_group_set_curve(EC_GROUP * group, const BIGNUM * p, /* 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; @@ -1355,9 +1355,9 @@ make_points_affine(size_t num, felem points[ /* num */ ][3], felem tmp_felems[ / /* 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; @@ -1550,7 +1550,7 @@ ec_GFp_nistp224_points_mul(const EC_GROUP * group, EC_POINT * r, } 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; @@ -1677,7 +1677,7 @@ ec_GFp_nistp224_precompute_mult(EC_GROUP * group, BN_CTX * ctx) } 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) diff --git a/lib/libcrypto/ec/ecp_nistp256.c b/lib/libcrypto/ec/ecp_nistp256.c index e13621c7b60..8371ee4827f 100644 --- a/lib/libcrypto/ec/ecp_nistp256.c +++ b/lib/libcrypto/ec/ecp_nistp256.c @@ -1,4 +1,4 @@ -/* $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 */ @@ -137,7 +137,7 @@ smallfelem_to_bin32(u8 out[32], const smallfelem in) /* 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) @@ -146,7 +146,7 @@ flip_endian(u8 * out, const u8 * in, unsigned len) /* 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; @@ -171,7 +171,7 @@ BN_to_felem(felem out, const BIGNUM * bn) /* 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); @@ -833,7 +833,7 @@ felem_reduce_zero105(felem out, const longfelem 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; @@ -1581,7 +1581,7 @@ get_bit(const felem_bytearray in, int i) * 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; @@ -1798,7 +1798,7 @@ nistp256_pre_comp_clear_free(void *pre_) */ 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); @@ -1807,8 +1807,8 @@ ec_GFp_nistp256_group_init(EC_GROUP * 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; @@ -1841,8 +1841,8 @@ ec_GFp_nistp256_group_set_curve(EC_GROUP * group, const BIGNUM * p, /* 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; @@ -1905,9 +1905,9 @@ make_points_affine(size_t num, smallfelem points[ /* num */ ][3], smallfelem 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_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; @@ -2103,7 +2103,7 @@ ec_GFp_nistp256_points_mul(const EC_GROUP * group, EC_POINT * r, } 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; @@ -2224,7 +2224,7 @@ ec_GFp_nistp256_precompute_mult(EC_GROUP * group, BN_CTX * ctx) } 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) diff --git a/lib/libcrypto/ec/ecp_nistp521.c b/lib/libcrypto/ec/ecp_nistp521.c index 994c1039d64..064bf855349 100644 --- a/lib/libcrypto/ec/ecp_nistp521.c +++ b/lib/libcrypto/ec/ecp_nistp521.c @@ -1,4 +1,4 @@ -/* $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 */ @@ -163,7 +163,7 @@ felem_to_bin66(u8 out[66], const felem in) /* 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) @@ -172,7 +172,7 @@ flip_endian(u8 * out, const u8 * in, unsigned len) /* 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; @@ -197,7 +197,7 @@ BN_to_felem(felem out, const BIGNUM * bn) /* 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); @@ -1487,7 +1487,7 @@ get_bit(const felem_bytearray in, int i) * 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; @@ -1689,7 +1689,7 @@ nistp521_pre_comp_clear_free(void *pre_) */ 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); @@ -1698,8 +1698,8 @@ ec_GFp_nistp521_group_init(EC_GROUP * 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; @@ -1732,8 +1732,8 @@ ec_GFp_nistp521_group_set_curve(EC_GROUP * group, const BIGNUM * p, /* 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; @@ -1795,9 +1795,9 @@ make_points_affine(size_t num, felem points[ /* num */ ][3], felem tmp_felems[ / /* 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; @@ -1992,7 +1992,7 @@ ec_GFp_nistp521_points_mul(const EC_GROUP * group, EC_POINT * r, } 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; @@ -2099,7 +2099,7 @@ ec_GFp_nistp521_precompute_mult(EC_GROUP * group, BN_CTX * ctx) } 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) diff --git a/lib/libcrypto/ec/ecp_oct.c b/lib/libcrypto/ec/ecp_oct.c index 1536b3ee904..7c29e7e6128 100644 --- a/lib/libcrypto/ec/ecp_oct.c +++ b/lib/libcrypto/ec/ecp_oct.c @@ -1,4 +1,4 @@ -/* $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 * for the OpenSSL project. * Includes code written by Bodo Moeller for the OpenSSL project. @@ -67,8 +67,8 @@ #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; @@ -198,8 +198,8 @@ ec_GFp_simple_set_compressed_coordinates(const EC_GROUP * group, 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; @@ -303,8 +303,8 @@ ec_GFp_simple_point2oct(const EC_GROUP * group, const EC_POINT * point, point_co 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; diff --git a/lib/libcrypto/ec/ecp_smpl.c b/lib/libcrypto/ec/ecp_smpl.c index c9d73bd6295..55fb46869db 100644 --- a/lib/libcrypto/ec/ecp_smpl.c +++ b/lib/libcrypto/ec/ecp_smpl.c @@ -1,4 +1,4 @@ -/* $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 * for the OpenSSL project. * Includes code written by Bodo Moeller for the OpenSSL project. @@ -131,7 +131,7 @@ EC_GFp_simple_method(void) 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); @@ -142,7 +142,7 @@ ec_GFp_simple_group_init(EC_GROUP * group) 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); @@ -151,7 +151,7 @@ ec_GFp_simple_group_finish(EC_GROUP * group) 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); @@ -160,7 +160,7 @@ ec_GFp_simple_group_clear_finish(EC_GROUP * group) 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; @@ -176,8 +176,8 @@ ec_GFp_simple_group_copy(EC_GROUP * dest, const EC_GROUP * src) 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; @@ -233,7 +233,7 @@ ec_GFp_simple_group_set_curve(EC_GROUP * group, 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; @@ -277,14 +277,14 @@ ec_GFp_simple_group_get_curve(const EC_GROUP * group, BIGNUM * p, BIGNUM * a, BI 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; @@ -372,7 +372,7 @@ ec_GFp_simple_point_init(EC_POINT * point) 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); @@ -381,7 +381,7 @@ ec_GFp_simple_point_finish(EC_POINT * point) 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); @@ -391,7 +391,7 @@ ec_GFp_simple_point_clear_finish(EC_POINT * point) 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; @@ -406,7 +406,7 @@ ec_GFp_simple_point_copy(EC_POINT * dest, const EC_POINT * src) 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); @@ -515,8 +515,8 @@ ec_GFp_simple_get_Jprojective_coordinates(const EC_GROUP *group, } 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 */ @@ -528,8 +528,8 @@ ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP * group, EC_POINT * po } 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; @@ -635,7 +635,7 @@ ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP * group, const EC_POIN } 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 *); @@ -824,7 +824,7 @@ ec_GFp_simple_add(const EC_GROUP * group, EC_POINT * r, const EC_POINT * a, cons 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 *); @@ -966,7 +966,7 @@ ec_GFp_simple_dbl(const EC_GROUP * group, EC_POINT * r, const EC_POINT * a, BN_C 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 */ @@ -977,14 +977,14 @@ ec_GFp_simple_invert(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx) 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 *); @@ -1087,7 +1087,7 @@ ec_GFp_simple_is_on_curve(const EC_GROUP * group, const EC_POINT * point, 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 @@ -1189,7 +1189,7 @@ ec_GFp_simple_cmp(const EC_GROUP * group, const EC_POINT * a, const EC_POINT * b 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; @@ -1227,7 +1227,7 @@ ec_GFp_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx 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; @@ -1402,13 +1402,13 @@ ec_GFp_simple_points_make_affine(const EC_GROUP * group, size_t num, EC_POINT * 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); } -- 2.20.1