summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ec2_smpl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ec/ec2_smpl.c')
-rw-r--r--src/lib/libcrypto/ec/ec2_smpl.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/lib/libcrypto/ec/ec2_smpl.c b/src/lib/libcrypto/ec/ec2_smpl.c
index 17664d0426..b3030edeee 100644
--- a/src/lib/libcrypto/ec/ec2_smpl.c
+++ b/src/lib/libcrypto/ec/ec2_smpl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec2_smpl.c,v 1.24 2022/11/19 07:00:57 tb Exp $ */ 1/* $OpenBSD: ec2_smpl.c,v 1.25 2022/11/19 07:29:29 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
4 * 4 *
@@ -127,7 +127,7 @@ EC_GF2m_simple_method(void)
127 * Note that all other members are handled by EC_GROUP_new. 127 * Note that all other members are handled by EC_GROUP_new.
128 */ 128 */
129int 129int
130ec_GF2m_simple_group_init(EC_GROUP * group) 130ec_GF2m_simple_group_init(EC_GROUP *group)
131{ 131{
132 BN_init(&group->field); 132 BN_init(&group->field);
133 BN_init(&group->a); 133 BN_init(&group->a);
@@ -140,7 +140,7 @@ ec_GF2m_simple_group_init(EC_GROUP * group)
140 * Note that all other members are handled by EC_GROUP_free. 140 * Note that all other members are handled by EC_GROUP_free.
141 */ 141 */
142void 142void
143ec_GF2m_simple_group_finish(EC_GROUP * group) 143ec_GF2m_simple_group_finish(EC_GROUP *group)
144{ 144{
145 BN_free(&group->field); 145 BN_free(&group->field);
146 BN_free(&group->a); 146 BN_free(&group->a);
@@ -152,7 +152,7 @@ ec_GF2m_simple_group_finish(EC_GROUP * group)
152 * Note that all other members are handled by EC_GROUP_clear_free. 152 * Note that all other members are handled by EC_GROUP_clear_free.
153 */ 153 */
154void 154void
155ec_GF2m_simple_group_clear_finish(EC_GROUP * group) 155ec_GF2m_simple_group_clear_finish(EC_GROUP *group)
156{ 156{
157 BN_clear_free(&group->field); 157 BN_clear_free(&group->field);
158 BN_clear_free(&group->a); 158 BN_clear_free(&group->a);
@@ -170,7 +170,7 @@ ec_GF2m_simple_group_clear_finish(EC_GROUP * group)
170 * Note that all other members are handled by EC_GROUP_copy. 170 * Note that all other members are handled by EC_GROUP_copy.
171 */ 171 */
172int 172int
173ec_GF2m_simple_group_copy(EC_GROUP * dest, const EC_GROUP * src) 173ec_GF2m_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src)
174{ 174{
175 int i; 175 int i;
176 176
@@ -200,8 +200,8 @@ ec_GF2m_simple_group_copy(EC_GROUP * dest, const EC_GROUP * src)
200 200
201/* Set the curve parameters of an EC_GROUP structure. */ 201/* Set the curve parameters of an EC_GROUP structure. */
202int 202int
203ec_GF2m_simple_group_set_curve(EC_GROUP * group, 203ec_GF2m_simple_group_set_curve(EC_GROUP *group,
204 const BIGNUM * p, const BIGNUM * a, const BIGNUM * b, BN_CTX * ctx) 204 const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
205{ 205{
206 int ret = 0, i; 206 int ret = 0, i;
207 207
@@ -265,7 +265,7 @@ ec_GF2m_simple_group_get_curve(const EC_GROUP *group,
265 265
266/* Gets the degree of the field. For a curve over GF(2^m) this is the value m. */ 266/* Gets the degree of the field. For a curve over GF(2^m) this is the value m. */
267int 267int
268ec_GF2m_simple_group_get_degree(const EC_GROUP * group) 268ec_GF2m_simple_group_get_degree(const EC_GROUP *group)
269{ 269{
270 return BN_num_bits(&group->field) - 1; 270 return BN_num_bits(&group->field) - 1;
271} 271}
@@ -275,7 +275,7 @@ ec_GF2m_simple_group_get_degree(const EC_GROUP * group)
275 * y^2 + x*y = x^3 + a*x^2 + b is an elliptic curve <=> b != 0 (mod p) 275 * y^2 + x*y = x^3 + a*x^2 + b is an elliptic curve <=> b != 0 (mod p)
276 */ 276 */
277int 277int
278ec_GF2m_simple_group_check_discriminant(const EC_GROUP * group, BN_CTX * ctx) 278ec_GF2m_simple_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx)
279{ 279{
280 int ret = 0; 280 int ret = 0;
281 BIGNUM *b; 281 BIGNUM *b;
@@ -314,7 +314,7 @@ ec_GF2m_simple_group_check_discriminant(const EC_GROUP * group, BN_CTX * ctx)
314 314
315/* Initializes an EC_POINT. */ 315/* Initializes an EC_POINT. */
316int 316int
317ec_GF2m_simple_point_init(EC_POINT * point) 317ec_GF2m_simple_point_init(EC_POINT *point)
318{ 318{
319 BN_init(&point->X); 319 BN_init(&point->X);
320 BN_init(&point->Y); 320 BN_init(&point->Y);
@@ -325,7 +325,7 @@ ec_GF2m_simple_point_init(EC_POINT * point)
325 325
326/* Frees an EC_POINT. */ 326/* Frees an EC_POINT. */
327void 327void
328ec_GF2m_simple_point_finish(EC_POINT * point) 328ec_GF2m_simple_point_finish(EC_POINT *point)
329{ 329{
330 BN_free(&point->X); 330 BN_free(&point->X);
331 BN_free(&point->Y); 331 BN_free(&point->Y);
@@ -335,7 +335,7 @@ ec_GF2m_simple_point_finish(EC_POINT * point)
335 335
336/* Clears and frees an EC_POINT. */ 336/* Clears and frees an EC_POINT. */
337void 337void
338ec_GF2m_simple_point_clear_finish(EC_POINT * point) 338ec_GF2m_simple_point_clear_finish(EC_POINT *point)
339{ 339{
340 BN_clear_free(&point->X); 340 BN_clear_free(&point->X);
341 BN_clear_free(&point->Y); 341 BN_clear_free(&point->Y);
@@ -346,7 +346,7 @@ ec_GF2m_simple_point_clear_finish(EC_POINT * point)
346 346
347/* Copy the contents of one EC_POINT into another. Assumes dest is initialized. */ 347/* Copy the contents of one EC_POINT into another. Assumes dest is initialized. */
348int 348int
349ec_GF2m_simple_point_copy(EC_POINT * dest, const EC_POINT * src) 349ec_GF2m_simple_point_copy(EC_POINT *dest, const EC_POINT *src)
350{ 350{
351 if (!BN_copy(&dest->X, &src->X)) 351 if (!BN_copy(&dest->X, &src->X))
352 return 0; 352 return 0;
@@ -364,7 +364,7 @@ ec_GF2m_simple_point_copy(EC_POINT * dest, const EC_POINT * src)
364 * A point at infinity is represented by having Z=0. 364 * A point at infinity is represented by having Z=0.
365 */ 365 */
366int 366int
367ec_GF2m_simple_point_set_to_infinity(const EC_GROUP * group, EC_POINT * point) 367ec_GF2m_simple_point_set_to_infinity(const EC_GROUP *group, EC_POINT *point)
368{ 368{
369 point->Z_is_one = 0; 369 point->Z_is_one = 0;
370 BN_zero(&point->Z); 370 BN_zero(&point->Z);
@@ -376,8 +376,8 @@ ec_GF2m_simple_point_set_to_infinity(const EC_GROUP * group, EC_POINT * point)
376 * Note that the simple implementation only uses affine coordinates. 376 * Note that the simple implementation only uses affine coordinates.
377 */ 377 */
378int 378int
379ec_GF2m_simple_point_set_affine_coordinates(const EC_GROUP * group, EC_POINT * point, 379ec_GF2m_simple_point_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point,
380 const BIGNUM * x, const BIGNUM * y, BN_CTX * ctx) 380 const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx)
381{ 381{
382 int ret = 0; 382 int ret = 0;
383 if (x == NULL || y == NULL) { 383 if (x == NULL || y == NULL) {
@@ -701,7 +701,7 @@ ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a,
701 701
702/* Forces the given EC_POINT to internally use affine coordinates. */ 702/* Forces the given EC_POINT to internally use affine coordinates. */
703int 703int
704ec_GF2m_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx) 704ec_GF2m_simple_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx)
705{ 705{
706 BN_CTX *new_ctx = NULL; 706 BN_CTX *new_ctx = NULL;
707 BIGNUM *x, *y; 707 BIGNUM *x, *y;