From: tb Date: Sat, 19 Nov 2022 07:00:57 +0000 (+0000) Subject: whitespace X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9d9f513e235c786065104046d1d13ad80429c5c3;p=openbsd whitespace --- diff --git a/lib/libcrypto/ec/ec2_oct.c b/lib/libcrypto/ec/ec2_oct.c index 832083c628b..b25084ef584 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.16 2021/05/03 14:42:45 tb Exp $ */ +/* $OpenBSD: ec2_oct.c,v 1.17 2022/11/19 07:00:57 tb Exp $ */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * @@ -90,7 +90,7 @@ * the same method, but claim no priority date earlier than July 29, 1994 * (and additionally fail to cite the EUROCRYPT '92 publication as prior art). */ -int +int ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point, const BIGNUM *x_, int y_bit, BN_CTX *ctx) { @@ -172,7 +172,7 @@ ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point * If buf is NULL, the encoded length will be returned. * If the length len of buf is smaller than required an error will be returned. */ -size_t +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) diff --git a/lib/libcrypto/ec/ec2_smpl.c b/lib/libcrypto/ec/ec2_smpl.c index 9f3b380bfeb..17664d04262 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.23 2021/09/08 17:29:21 tb Exp $ */ +/* $OpenBSD: ec2_smpl.c,v 1.24 2022/11/19 07:00:57 tb Exp $ */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * @@ -126,7 +126,7 @@ EC_GF2m_simple_method(void) /* Initialize a GF(2^m)-based EC_GROUP structure. * Note that all other members are handled by EC_GROUP_new. */ -int +int ec_GF2m_simple_group_init(EC_GROUP * group) { BN_init(&group->field); @@ -139,7 +139,7 @@ ec_GF2m_simple_group_init(EC_GROUP * group) /* Free a GF(2^m)-based EC_GROUP structure. * Note that all other members are handled by EC_GROUP_free. */ -void +void ec_GF2m_simple_group_finish(EC_GROUP * group) { BN_free(&group->field); @@ -151,7 +151,7 @@ ec_GF2m_simple_group_finish(EC_GROUP * group) /* Clear and free a GF(2^m)-based EC_GROUP structure. * Note that all other members are handled by EC_GROUP_clear_free. */ -void +void ec_GF2m_simple_group_clear_finish(EC_GROUP * group) { BN_clear_free(&group->field); @@ -169,7 +169,7 @@ ec_GF2m_simple_group_clear_finish(EC_GROUP * group) /* Copy a GF(2^m)-based EC_GROUP structure. * Note that all other members are handled by EC_GROUP_copy. */ -int +int ec_GF2m_simple_group_copy(EC_GROUP * dest, const EC_GROUP * src) { int i; @@ -199,7 +199,7 @@ ec_GF2m_simple_group_copy(EC_GROUP * dest, const EC_GROUP * src) /* Set the curve parameters of an EC_GROUP structure. */ -int +int ec_GF2m_simple_group_set_curve(EC_GROUP * group, const BIGNUM * p, const BIGNUM * a, const BIGNUM * b, BN_CTX * ctx) { @@ -238,7 +238,7 @@ ec_GF2m_simple_group_set_curve(EC_GROUP * group, /* Get the curve parameters of an EC_GROUP structure. * If p, a, or b are NULL then there values will not be set but the method will return with success. */ -int +int ec_GF2m_simple_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx) { @@ -264,7 +264,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 +int ec_GF2m_simple_group_get_degree(const EC_GROUP * group) { return BN_num_bits(&group->field) - 1; @@ -274,7 +274,7 @@ ec_GF2m_simple_group_get_degree(const EC_GROUP * group) /* Checks the discriminant of the curve. * y^2 + x*y = x^3 + a*x^2 + b is an elliptic curve <=> b != 0 (mod p) */ -int +int ec_GF2m_simple_group_check_discriminant(const EC_GROUP * group, BN_CTX * ctx) { int ret = 0; @@ -313,7 +313,7 @@ ec_GF2m_simple_group_check_discriminant(const EC_GROUP * group, BN_CTX * ctx) /* Initializes an EC_POINT. */ -int +int ec_GF2m_simple_point_init(EC_POINT * point) { BN_init(&point->X); @@ -324,7 +324,7 @@ ec_GF2m_simple_point_init(EC_POINT * point) /* Frees an EC_POINT. */ -void +void ec_GF2m_simple_point_finish(EC_POINT * point) { BN_free(&point->X); @@ -334,7 +334,7 @@ ec_GF2m_simple_point_finish(EC_POINT * point) /* Clears and frees an EC_POINT. */ -void +void ec_GF2m_simple_point_clear_finish(EC_POINT * point) { BN_clear_free(&point->X); @@ -345,7 +345,7 @@ ec_GF2m_simple_point_clear_finish(EC_POINT * point) /* Copy the contents of one EC_POINT into another. Assumes dest is initialized. */ -int +int ec_GF2m_simple_point_copy(EC_POINT * dest, const EC_POINT * src) { if (!BN_copy(&dest->X, &src->X)) @@ -363,7 +363,7 @@ ec_GF2m_simple_point_copy(EC_POINT * dest, const EC_POINT * src) /* Set an EC_POINT to the point at infinity. * A point at infinity is represented by having Z=0. */ -int +int ec_GF2m_simple_point_set_to_infinity(const EC_GROUP * group, EC_POINT * point) { point->Z_is_one = 0; @@ -375,7 +375,7 @@ ec_GF2m_simple_point_set_to_infinity(const EC_GROUP * group, EC_POINT * point) /* Set the coordinates of an EC_POINT using affine coordinates. * Note that the simple implementation only uses affine coordinates. */ -int +int ec_GF2m_simple_point_set_affine_coordinates(const EC_GROUP * group, EC_POINT * point, const BIGNUM * x, const BIGNUM * y, BN_CTX * ctx) { @@ -404,7 +404,7 @@ ec_GF2m_simple_point_set_affine_coordinates(const EC_GROUP * group, EC_POINT * p /* Gets the affine coordinates of an EC_POINT. * Note that the simple implementation only uses affine coordinates. */ -int +int ec_GF2m_simple_point_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx) { @@ -437,7 +437,7 @@ ec_GF2m_simple_point_get_affine_coordinates(const EC_GROUP *group, /* Computes a + b and stores the result in r. r could be a or b, a could be b. * Uses algorithm A.10.2 of IEEE P1363. */ -int +int ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx) { @@ -557,14 +557,14 @@ ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, /* Computes 2 * a and stores the result in r. r could be a. * Uses algorithm A.10.2 of IEEE P1363. */ -int +int ec_GF2m_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx) { return ec_GF2m_simple_add(group, r, a, a, ctx); } -int +int ec_GF2m_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)) @@ -578,7 +578,7 @@ ec_GF2m_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) /* Indicates whether the given point is the point at infinity. */ -int +int ec_GF2m_simple_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) { return BN_is_zero(&point->Z); @@ -589,7 +589,7 @@ ec_GF2m_simple_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) * in the EC_GROUP. A point is valid if it satisfies the Weierstrass equation: * y^2 + x*y = x^3 + a*x^2 + b. */ -int +int ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx) { int ret = -1; @@ -653,7 +653,7 @@ ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX * 0 equal (in affine coordinates) * 1 not equal */ -int +int ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx) { @@ -700,7 +700,7 @@ ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a, /* Forces the given EC_POINT to internally use affine coordinates. */ -int +int ec_GF2m_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx) { BN_CTX *new_ctx = NULL; @@ -741,7 +741,7 @@ ec_GF2m_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ct /* Forces each of the EC_POINTs in the given array to use affine coordinates. */ -int +int ec_GF2m_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx) { @@ -757,7 +757,7 @@ ec_GF2m_simple_points_make_affine(const EC_GROUP *group, size_t num, /* Wrapper to simple binary polynomial field multiplication implementation. */ -int +int ec_GF2m_simple_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) { @@ -766,7 +766,7 @@ ec_GF2m_simple_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, /* Wrapper to simple binary polynomial field squaring implementation. */ -int +int ec_GF2m_simple_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) { @@ -775,7 +775,7 @@ ec_GF2m_simple_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, /* Wrapper to simple binary polynomial field division implementation. */ -int +int ec_GF2m_simple_field_div(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) { diff --git a/lib/libcrypto/ec/ec_ameth.c b/lib/libcrypto/ec/ec_ameth.c index 5c9a76c8bee..ee931a93c6e 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.33 2022/06/27 12:36:05 tb Exp $ */ +/* $OpenBSD: ec_ameth.c,v 1.34 2022/11/19 07:00:57 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -75,7 +75,7 @@ static int ecdh_cms_decrypt(CMS_RecipientInfo *ri); static int ecdh_cms_encrypt(CMS_RecipientInfo *ri); #endif -static int +static int eckey_param2type(int *pptype, void **ppval, EC_KEY * ec_key) { const EC_GROUP *group; @@ -107,7 +107,7 @@ eckey_param2type(int *pptype, void **ppval, EC_KEY * ec_key) return 1; } -static int +static int eckey_pub_encode(X509_PUBKEY * pk, const EVP_PKEY * pkey) { EC_KEY *ec_key = pkey->pkey.ec; @@ -190,7 +190,7 @@ eckey_type2param(int ptype, const void *pval) return NULL; } -static int +static int eckey_pub_decode(EVP_PKEY * pkey, X509_PUBKEY * pubkey) { const unsigned char *p = NULL; @@ -223,7 +223,7 @@ eckey_pub_decode(EVP_PKEY * pkey, X509_PUBKEY * pubkey) return 0; } -static int +static int eckey_pub_cmp(const EVP_PKEY * a, const EVP_PKEY * b) { int r; @@ -238,7 +238,7 @@ eckey_pub_cmp(const EVP_PKEY * a, const EVP_PKEY * b) return -2; } -static int +static int eckey_priv_decode(EVP_PKEY * pkey, const PKCS8_PRIV_KEY_INFO * p8) { const unsigned char *p = NULL; @@ -305,7 +305,7 @@ eckey_priv_decode(EVP_PKEY * pkey, const PKCS8_PRIV_KEY_INFO * p8) return 0; } -static int +static int eckey_priv_encode(PKCS8_PRIV_KEY_INFO * p8, const EVP_PKEY * pkey) { EC_KEY *ec_key; @@ -358,13 +358,13 @@ eckey_priv_encode(PKCS8_PRIV_KEY_INFO * p8, const EVP_PKEY * pkey) return 1; } -static int +static int int_ec_size(const EVP_PKEY * pkey) { return ECDSA_size(pkey->pkey.ec); } -static int +static int ec_bits(const EVP_PKEY * pkey) { BIGNUM *order = BN_new(); @@ -405,7 +405,7 @@ ec_security_bits(const EVP_PKEY *pkey) return ecbits / 2; } -static int +static int ec_missing_parameters(const EVP_PKEY * pkey) { if (EC_KEY_get0_group(pkey->pkey.ec) == NULL) @@ -413,13 +413,13 @@ ec_missing_parameters(const EVP_PKEY * pkey) return 0; } -static int +static int 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 +static int 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); @@ -429,13 +429,13 @@ ec_cmp_parameters(const EVP_PKEY * a, const EVP_PKEY * b) return 1; } -static void +static void int_ec_free(EVP_PKEY * pkey) { EC_KEY_free(pkey->pkey.ec); } -static int +static int do_EC_KEY_print(BIO * bp, const EC_KEY * x, int off, int ktype) { unsigned char *buffer = NULL; @@ -519,7 +519,7 @@ do_EC_KEY_print(BIO * bp, const EC_KEY * x, int off, int ktype) return (ret); } -static int +static int eckey_param_decode(EVP_PKEY * pkey, const unsigned char **pder, int derlen) { @@ -532,20 +532,20 @@ eckey_param_decode(EVP_PKEY * pkey, return 1; } -static int +static int eckey_param_encode(const EVP_PKEY * pkey, unsigned char **pder) { return i2d_ECParameters(pkey->pkey.ec, pder); } -static int +static int 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 +static int eckey_pub_print(BIO * bp, const EVP_PKEY * pkey, int indent, ASN1_PCTX * ctx) { @@ -553,14 +553,14 @@ eckey_pub_print(BIO * bp, const EVP_PKEY * pkey, int indent, } -static int +static int 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 +static int old_ec_priv_decode(EVP_PKEY * pkey, const unsigned char **pder, int derlen) { @@ -573,13 +573,13 @@ old_ec_priv_decode(EVP_PKEY * pkey, return 1; } -static int +static int old_ec_priv_encode(const EVP_PKEY * pkey, unsigned char **pder) { return i2d_ECPrivateKey(pkey->pkey.ec, pder); } -static int +static int ec_pkey_ctrl(EVP_PKEY * pkey, int op, long arg1, void *arg2) { switch (op) { diff --git a/lib/libcrypto/ec/ec_asn1.c b/lib/libcrypto/ec/ec_asn1.c index 6bf7e47d7db..baa58b5183c 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.37 2022/05/24 20:06:32 tb Exp $ */ +/* $OpenBSD: ec_asn1.c,v 1.38 2022/11/19 07:00:57 tb Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -67,7 +67,7 @@ #include "asn1_locl.h" #include "ec_lcl.h" -int +int EC_GROUP_get_basis_type(const EC_GROUP * group) { int i = 0; @@ -90,7 +90,7 @@ EC_GROUP_get_basis_type(const EC_GROUP * group) } #ifndef OPENSSL_NO_EC2M -int +int EC_GROUP_get_trinomial_basis(const EC_GROUP * group, unsigned int *k) { if (group == NULL) @@ -108,7 +108,7 @@ EC_GROUP_get_trinomial_basis(const EC_GROUP * group, unsigned int *k) return 1; } -int +int EC_GROUP_get_pentanomial_basis(const EC_GROUP * group, unsigned int *k1, unsigned int *k2, unsigned int *k3) { @@ -268,7 +268,7 @@ static const ASN1_ADB_TABLE X9_62_CHARACTERISTIC_TWO_adbtbl[] = { .field_name = "p.onBasis", .item = &ASN1_NULL_it, }, - + }, { .value = NID_X9_62_tpBasis, @@ -279,7 +279,7 @@ static const ASN1_ADB_TABLE X9_62_CHARACTERISTIC_TWO_adbtbl[] = { .field_name = "p.tpBasis", .item = &ASN1_INTEGER_it, }, - + }, { .value = NID_X9_62_ppBasis, @@ -290,7 +290,7 @@ static const ASN1_ADB_TABLE X9_62_CHARACTERISTIC_TWO_adbtbl[] = { .field_name = "p.ppBasis", .item = &X9_62_PENTANOMIAL_it, }, - + }, }; @@ -370,7 +370,7 @@ static const ASN1_ADB_TABLE X9_62_FIELDID_adbtbl[] = { .field_name = "p.prime", .item = &ASN1_INTEGER_it, }, - + }, { .value = NID_X9_62_characteristic_two_field, @@ -381,7 +381,7 @@ static const ASN1_ADB_TABLE X9_62_FIELDID_adbtbl[] = { .field_name = "p.char_two", .item = &X9_62_CHARACTERISTIC_TWO_it, }, - + }, }; @@ -798,7 +798,7 @@ ec_asn1_group2fieldid(const EC_GROUP * group, X9_62_FIELDID * field) return (ok); } -static int +static int ec_asn1_group2curve(const EC_GROUP * group, X9_62_CURVE * curve) { BIGNUM *tmp_1 = NULL, *tmp_2 = NULL; @@ -1308,7 +1308,7 @@ d2i_ECPKParameters(EC_GROUP ** a, const unsigned char **in, long len) return (group); } -int +int i2d_ECPKParameters(const EC_GROUP * a, unsigned char **out) { int ret = 0; @@ -1420,7 +1420,7 @@ d2i_ECPrivateKey(EC_KEY ** a, const unsigned char **in, long len) return (NULL); } -int +int i2d_ECPrivateKey(EC_KEY * a, unsigned char **out) { int ret = 0, ok = 0; @@ -1504,7 +1504,7 @@ i2d_ECPrivateKey(EC_KEY * a, unsigned char **out) return (ok ? ret : 0); } -int +int i2d_ECParameters(EC_KEY * a, unsigned char **out) { if (a == NULL) { @@ -1569,7 +1569,7 @@ o2i_ECPublicKey(EC_KEY ** a, const unsigned char **in, long len) return ret; } -int +int i2o_ECPublicKey(const EC_KEY * a, unsigned char **out) { size_t buf_len = 0; diff --git a/lib/libcrypto/ec/ec_check.c b/lib/libcrypto/ec/ec_check.c index dcca6616743..3f6a802374c 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.9 2018/07/15 16:27:39 tb Exp $ */ +/* $OpenBSD: ec_check.c,v 1.10 2022/11/19 07:00:57 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * @@ -56,7 +56,7 @@ #include "ec_lcl.h" #include -int +int EC_GROUP_check(const EC_GROUP * group, BN_CTX * ctx) { int ret = 0; diff --git a/lib/libcrypto/ec/ec_curve.c b/lib/libcrypto/ec/ec_curve.c index 09f8cfe9d84..1f69d4f1dc3 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.22 2022/06/30 11:14:47 tb Exp $ */ +/* $OpenBSD: ec_curve.c,v 1.23 2022/11/19 07:00:57 tb Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -3433,7 +3433,7 @@ EC_GROUP_new_by_curve_name(int nid) return ret; } -size_t +size_t EC_get_builtin_curves(EC_builtin_curve * r, size_t nitems) { size_t i, min; diff --git a/lib/libcrypto/ec/ec_err.c b/lib/libcrypto/ec/ec_err.c index 2ff8e9974ee..be6a2845994 100644 --- a/lib/libcrypto/ec/ec_err.c +++ b/lib/libcrypto/ec/ec_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_err.c,v 1.14 2022/11/10 16:37:52 jsing Exp $ */ +/* $OpenBSD: ec_err.c,v 1.15 2022/11/19 07:00:57 tb Exp $ */ /* ==================================================================== * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * @@ -131,7 +131,7 @@ static ERR_STRING_DATA EC_str_reasons[] = #endif -void +void ERR_load_EC_strings(void) { #ifndef OPENSSL_NO_ERR diff --git a/lib/libcrypto/ec/ec_key.c b/lib/libcrypto/ec/ec_key.c index 27b8f266087..3aa6a96eb87 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.26 2021/04/20 17:23:37 tb Exp $ */ +/* $OpenBSD: ec_key.c,v 1.27 2022/11/19 07:00:57 tb Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -98,7 +98,7 @@ EC_KEY_new_by_curve_name(int nid) return ret; } -void +void EC_KEY_free(EC_KEY * r) { int i; @@ -228,7 +228,7 @@ EC_KEY_dup(const EC_KEY * ec_key) return ret; } -int +int EC_KEY_up_ref(EC_KEY * r) { int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_EC); @@ -308,7 +308,7 @@ ossl_ec_key_gen(EC_KEY *eckey) return (ok); } -int +int EC_KEY_check_key(const EC_KEY * eckey) { int ok = 0; @@ -375,7 +375,7 @@ EC_KEY_check_key(const EC_KEY * eckey) return (ok); } -int +int EC_KEY_set_public_key_affine_coordinates(EC_KEY * key, BIGNUM * x, BIGNUM * y) { BN_CTX *ctx = NULL; @@ -434,7 +434,7 @@ EC_KEY_get0_group(const EC_KEY * key) return key->group; } -int +int EC_KEY_set_group(EC_KEY * key, const EC_GROUP * group) { if (key->meth->set_group != NULL && @@ -451,7 +451,7 @@ EC_KEY_get0_private_key(const EC_KEY * key) return key->priv_key; } -int +int EC_KEY_set_private_key(EC_KEY * key, const BIGNUM * priv_key) { if (key->meth->set_private != NULL && @@ -468,7 +468,7 @@ EC_KEY_get0_public_key(const EC_KEY * key) return key->pub_key; } -int +int EC_KEY_set_public_key(EC_KEY * key, const EC_POINT * pub_key) { if (key->meth->set_public != NULL && @@ -479,25 +479,25 @@ EC_KEY_set_public_key(EC_KEY * key, const EC_POINT * pub_key) return (key->pub_key == NULL) ? 0 : 1; } -unsigned int +unsigned int EC_KEY_get_enc_flags(const EC_KEY * key) { return key->enc_flag; } -void +void EC_KEY_set_enc_flags(EC_KEY * key, unsigned int flags) { key->enc_flag = flags; } -point_conversion_form_t +point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY * key) { return key->conv_form; } -void +void EC_KEY_set_conv_form(EC_KEY * key, point_conversion_form_t cform) { key->conv_form = cform; @@ -537,14 +537,14 @@ EC_KEY_insert_key_method_data(EC_KEY * key, void *data, return ex_data; } -void +void EC_KEY_set_asn1_flag(EC_KEY * key, int flag) { if (key->group != NULL) EC_GROUP_set_asn1_flag(key->group, flag); } -int +int EC_KEY_precompute_mult(EC_KEY * key, BN_CTX * ctx) { if (key->group == NULL) @@ -552,19 +552,19 @@ EC_KEY_precompute_mult(EC_KEY * key, BN_CTX * ctx) return EC_GROUP_precompute_mult(key->group, ctx); } -int +int EC_KEY_get_flags(const EC_KEY * key) { return key->flags; } -void +void EC_KEY_set_flags(EC_KEY * key, int flags) { key->flags |= flags; } -void +void EC_KEY_clear_flags(EC_KEY * key, int flags) { key->flags &= ~flags; diff --git a/lib/libcrypto/ec/ec_mult.c b/lib/libcrypto/ec/ec_mult.c index 05f89a57872..1198a6f6b18 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.24 2018/07/15 16:27:39 tb Exp $ */ +/* $OpenBSD: ec_mult.c,v 1.25 2022/11/19 07:00:57 tb Exp $ */ /* * Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project. */ @@ -132,7 +132,7 @@ ec_pre_comp_dup(void *src_) return src_; } -static void +static void ec_pre_comp_free(void *pre_) { int i; @@ -155,7 +155,7 @@ ec_pre_comp_free(void *pre_) free(pre); } -static void +static void ec_pre_comp_clear_free(void *pre_) { int i; @@ -331,7 +331,7 @@ compute_wNAF(const BIGNUM * scalar, int w, size_t * ret_len) * scalar*generator * in the addition if scalar != NULL */ -int +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) { @@ -721,7 +721,7 @@ ec_wNAF_mul(const EC_GROUP * group, EC_POINT * r, const BIGNUM * scalar, * points[2^(w-1)*numblocks-1] = (2^(w-1)) * 2^(blocksize*(numblocks-1)) * generator * points[2^(w-1)*numblocks] = NULL */ -int +int ec_wNAF_precompute_mult(EC_GROUP * group, BN_CTX * ctx) { const EC_POINT *generator; @@ -764,7 +764,7 @@ ec_wNAF_precompute_mult(EC_GROUP * group, BN_CTX * ctx) /* * The following parameters mean we precompute (approximately) one * point per bit. - * + * * TBD: The combination 8, 4 is perfect for 160 bits; for other bit * lengths, other parameter combinations might provide better * efficiency. @@ -875,7 +875,7 @@ ec_wNAF_precompute_mult(EC_GROUP * group, BN_CTX * ctx) } -int +int 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) diff --git a/lib/libcrypto/ec/ec_pmeth.c b/lib/libcrypto/ec/ec_pmeth.c index 63e63592519..3637d6bba67 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.13 2021/12/04 16:08:32 tb Exp $ */ +/* $OpenBSD: ec_pmeth.c,v 1.14 2022/11/19 07:00:57 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -93,7 +93,7 @@ typedef struct { size_t kdf_outlen; } EC_PKEY_CTX; -static int +static int pkey_ec_init(EVP_PKEY_CTX * ctx) { EC_PKEY_CTX *dctx; @@ -111,7 +111,7 @@ pkey_ec_init(EVP_PKEY_CTX * ctx) return 1; } -static int +static int pkey_ec_copy(EVP_PKEY_CTX * dst, EVP_PKEY_CTX * src) { EC_PKEY_CTX *dctx, *sctx; @@ -146,7 +146,7 @@ pkey_ec_copy(EVP_PKEY_CTX * dst, EVP_PKEY_CTX * src) return 1; } -static void +static void pkey_ec_cleanup(EVP_PKEY_CTX * ctx) { EC_PKEY_CTX *dctx = ctx->data; @@ -160,7 +160,7 @@ pkey_ec_cleanup(EVP_PKEY_CTX * ctx) } } -static int +static int pkey_ec_sign(EVP_PKEY_CTX * ctx, unsigned char *sig, size_t * siglen, const unsigned char *tbs, size_t tbslen) { @@ -188,7 +188,7 @@ pkey_ec_sign(EVP_PKEY_CTX * ctx, unsigned char *sig, size_t * siglen, return 1; } -static int +static int pkey_ec_verify(EVP_PKEY_CTX * ctx, const unsigned char *sig, size_t siglen, const unsigned char *tbs, size_t tbslen) @@ -207,7 +207,7 @@ pkey_ec_verify(EVP_PKEY_CTX * ctx, return ret; } -static int +static int pkey_ec_derive(EVP_PKEY_CTX * ctx, unsigned char *key, size_t * keylen) { int ret; @@ -283,7 +283,7 @@ pkey_ec_kdf_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen) return rv; } -static int +static int pkey_ec_ctrl(EVP_PKEY_CTX * ctx, int type, int p1, void *p2) { EC_PKEY_CTX *dctx = ctx->data; @@ -410,7 +410,7 @@ pkey_ec_ctrl(EVP_PKEY_CTX * ctx, int type, int p1, void *p2) } } -static int +static int pkey_ec_ctrl_str(EVP_PKEY_CTX * ctx, const char *type, const char *value) { if (!strcmp(type, "ec_paramgen_curve")) { @@ -449,7 +449,7 @@ pkey_ec_ctrl_str(EVP_PKEY_CTX * ctx, const char *type, const char *value) return -2; } -static int +static int pkey_ec_paramgen(EVP_PKEY_CTX * ctx, EVP_PKEY * pkey) { EC_KEY *ec = NULL; @@ -470,7 +470,7 @@ pkey_ec_paramgen(EVP_PKEY_CTX * ctx, EVP_PKEY * pkey) return ret; } -static int +static int pkey_ec_keygen(EVP_PKEY_CTX * ctx, EVP_PKEY * pkey) { EC_KEY *ec = NULL; diff --git a/lib/libcrypto/ec/eck_prn.c b/lib/libcrypto/ec/eck_prn.c index 058ae57de5b..14185c76054 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.18 2022/11/10 12:37:00 tobhe Exp $ */ +/* $OpenBSD: eck_prn.c,v 1.19 2022/11/19 07:00:57 tb Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -69,7 +69,7 @@ #include #include -int +int ECPKParameters_print_fp(FILE * fp, const EC_GROUP * x, int off) { BIO *b; @@ -85,7 +85,7 @@ ECPKParameters_print_fp(FILE * fp, const EC_GROUP * x, int off) return (ret); } -int +int EC_KEY_print_fp(FILE * fp, const EC_KEY * x, int off) { BIO *b; @@ -101,7 +101,7 @@ EC_KEY_print_fp(FILE * fp, const EC_KEY * x, int off) return (ret); } -int +int ECParameters_print_fp(FILE * fp, const EC_KEY * x) { BIO *b; @@ -117,7 +117,7 @@ ECParameters_print_fp(FILE * fp, const EC_KEY * x) return (ret); } -int +int EC_KEY_print(BIO * bp, const EC_KEY * x, int off) { EVP_PKEY *pk; @@ -135,7 +135,7 @@ EC_KEY_print(BIO * bp, const EC_KEY * x, int off) return ret; } -int +int ECParameters_print(BIO * bp, const EC_KEY * x) { EVP_PKEY *pk; @@ -153,11 +153,11 @@ ECParameters_print(BIO * bp, const EC_KEY * x) return ret; } -static int +static int print_bin(BIO * fp, const char *str, const unsigned char *num, size_t len, int off); -int +int ECPKParameters_print(BIO * bp, const EC_GROUP * x, int off) { unsigned char *buffer = NULL; @@ -333,7 +333,7 @@ ECPKParameters_print(BIO * bp, const EC_GROUP * x, int off) return (ret); } -static int +static int print_bin(BIO * fp, const char *name, const unsigned char *buf, size_t len, int off) { diff --git a/lib/libcrypto/ec/ecp_nistputil.c b/lib/libcrypto/ec/ecp_nistputil.c index ca55b49ba29..fc4f9f5c265 100644 --- a/lib/libcrypto/ec/ecp_nistputil.c +++ b/lib/libcrypto/ec/ecp_nistputil.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecp_nistputil.c,v 1.6 2014/07/10 22:45:57 jsing Exp $ */ +/* $OpenBSD: ecp_nistputil.c,v 1.7 2022/11/19 07:00:57 tb Exp $ */ /* * Written by Bodo Moeller for the OpenSSL project. */ @@ -43,7 +43,7 @@ * tmp_felems needs to point to a temporary array of 'num'+1 field elements * for storage of intermediate values. */ -void +void ec_GFp_nistp_points_make_affine_internal(size_t num, void *point_array, size_t felem_size, void *tmp_felems, void (*felem_one) (void *out), @@ -192,7 +192,7 @@ ec_GFp_nistp_points_make_affine_internal(size_t num, void *point_array, * has to be b_4 b_3 b_2 b_1 b_0 0. * */ -void +void ec_GFp_nistp_recode_scalar_bits(unsigned char *sign, unsigned char *digit, unsigned char in) { unsigned char s, d; diff --git a/lib/libcrypto/ec/ecp_nistz256.c b/lib/libcrypto/ec/ecp_nistz256.c index dec7d312562..e4929b92bbb 100644 --- a/lib/libcrypto/ec/ecp_nistz256.c +++ b/lib/libcrypto/ec/ecp_nistz256.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecp_nistz256.c,v 1.11 2022/08/29 06:08:03 jsg Exp $ */ +/* $OpenBSD: ecp_nistz256.c,v 1.12 2022/11/19 07:00:57 tb Exp $ */ /* Copyright (c) 2014, Intel Corporation. * * Permission to use, copy, modify, and/or distribute this software for any @@ -897,7 +897,7 @@ ecp_nistz256_points_mul(const EC_GROUP *group, EC_POINT *r, */ BN_ULONG infty; infty = (p.p.X[0] | p.p.X[1] | p.p.X[2] | p.p.X[3] | - p.p.Y[0] | p.p.Y[1] | p.p.Y[2] | p.p.Y[3]); + p.p.Y[0] | p.p.Y[1] | p.p.Y[2] | p.p.Y[3]); if (P256_LIMBS == 8) infty |= (p.p.X[4] | p.p.X[5] | p.p.X[6] | p.p.X[7] | diff --git a/lib/libcrypto/ec/ecp_oct.c b/lib/libcrypto/ec/ecp_oct.c index 177bbe152e6..1536b3ee904 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.14 2021/04/20 17:32:57 tb Exp $ */ +/* $OpenBSD: ecp_oct.c,v 1.15 2022/11/19 07:00:57 tb Exp $ */ /* Includes code written by Lenka Fibikova * for the OpenSSL project. * Includes code written by Bodo Moeller for the OpenSSL project. @@ -66,7 +66,7 @@ #include "ec_lcl.h" -int +int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP * group, EC_POINT * point, const BIGNUM * x_, int y_bit, BN_CTX * ctx) { @@ -197,7 +197,7 @@ ec_GFp_simple_set_compressed_coordinates(const EC_GROUP * group, } -size_t +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) { @@ -302,7 +302,7 @@ ec_GFp_simple_point2oct(const EC_GROUP * group, const EC_POINT * point, point_co } -int +int ec_GFp_simple_oct2point(const EC_GROUP * group, EC_POINT * point, const unsigned char *buf, size_t len, BN_CTX * ctx) { diff --git a/lib/libcrypto/ec/ecp_smpl.c b/lib/libcrypto/ec/ecp_smpl.c index 6f5280bbc97..c9d73bd6295 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.34 2022/01/20 11:02:44 inoguchi Exp $ */ +/* $OpenBSD: ecp_smpl.c,v 1.35 2022/11/19 07:00:57 tb Exp $ */ /* Includes code written by Lenka Fibikova * for the OpenSSL project. * Includes code written by Bodo Moeller for the OpenSSL project. @@ -1416,7 +1416,7 @@ ec_GFp_simple_field_sqr(const EC_GROUP * group, BIGNUM * r, const BIGNUM * a, BN /* * Apply randomization of EC point projective coordinates: * - * (X, Y, Z) = (lambda^2 * X, lambda^3 * Y, lambda * Z) + * (X, Y, Z) = (lambda^2 * X, lambda^3 * Y, lambda * Z) * * where lambda is in the interval [1, group->field). */ @@ -1473,14 +1473,14 @@ ec_GFp_simple_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx) #define EC_POINT_BN_set_flags(P, flags) do { \ - BN_set_flags(&(P)->X, (flags)); \ - BN_set_flags(&(P)->Y, (flags)); \ - BN_set_flags(&(P)->Z, (flags)); \ + BN_set_flags(&(P)->X, (flags)); \ + BN_set_flags(&(P)->Y, (flags)); \ + BN_set_flags(&(P)->Z, (flags)); \ } while(0) -#define EC_POINT_CSWAP(c, a, b, w, t) do { \ +#define EC_POINT_CSWAP(c, a, b, w, t) do { \ if (!BN_swap_ct(c, &(a)->X, &(b)->X, w) || \ - !BN_swap_ct(c, &(a)->Y, &(b)->Y, w) || \ + !BN_swap_ct(c, &(a)->Y, &(b)->Y, w) || \ !BN_swap_ct(c, &(a)->Z, &(b)->Z, w)) \ goto err; \ t = ((a)->Z_is_one ^ (b)->Z_is_one) & (c); \ diff --git a/lib/libcrypto/ec/ecx_methods.c b/lib/libcrypto/ec/ecx_methods.c index 741cb2de6b0..8829d8fdbc9 100644 --- a/lib/libcrypto/ec/ecx_methods.c +++ b/lib/libcrypto/ec/ecx_methods.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecx_methods.c,v 1.1 2022/11/10 16:37:52 jsing Exp $ */ +/* $OpenBSD: ecx_methods.c,v 1.2 2022/11/19 07:00:57 tb Exp $ */ /* * Copyright (c) 2022 Joel Sing * @@ -676,7 +676,7 @@ ecx_item_verify(EVP_MD_CTX *md_ctx, const ASN1_ITEM *it, void *asn, { const ASN1_OBJECT *aobj; int nid, param_type; - + X509_ALGOR_get0(&aobj, ¶m_type, NULL, algor); nid = OBJ_obj2nid(aobj);