diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/ec/ec_local.h | 41 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_methods.c | 62 |
2 files changed, 32 insertions, 71 deletions
diff --git a/src/lib/libcrypto/ec/ec_local.h b/src/lib/libcrypto/ec/ec_local.h index 56402a2b04..e5189361e0 100644 --- a/src/lib/libcrypto/ec/ec_local.h +++ b/src/lib/libcrypto/ec/ec_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_local.h,v 1.36 2024/11/01 05:10:40 tb Exp $ */ | 1 | /* $OpenBSD: ec_local.h,v 1.37 2024/11/12 10:53:22 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -252,45 +252,6 @@ struct ec_point_st { | |||
| 252 | int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | 252 | int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, |
| 253 | size_t num, const EC_POINT *points[], const BIGNUM *scalars[], BN_CTX *); | 253 | size_t num, const EC_POINT *points[], const BIGNUM *scalars[], BN_CTX *); |
| 254 | 254 | ||
| 255 | /* method functions in ecp_smpl.c */ | ||
| 256 | int ec_GFp_simple_group_init(EC_GROUP *); | ||
| 257 | void ec_GFp_simple_group_finish(EC_GROUP *); | ||
| 258 | int ec_GFp_simple_group_copy(EC_GROUP *, const EC_GROUP *); | ||
| 259 | int ec_GFp_simple_group_set_curve(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *); | ||
| 260 | int ec_GFp_simple_group_get_curve(const EC_GROUP *, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *); | ||
| 261 | int ec_GFp_simple_group_get_degree(const EC_GROUP *); | ||
| 262 | int ec_GFp_simple_group_check_discriminant(const EC_GROUP *, BN_CTX *); | ||
| 263 | int ec_GFp_simple_point_init(EC_POINT *); | ||
| 264 | void ec_GFp_simple_point_finish(EC_POINT *); | ||
| 265 | int ec_GFp_simple_point_copy(EC_POINT *, const EC_POINT *); | ||
| 266 | int ec_GFp_simple_point_set_to_infinity(const EC_GROUP *, EC_POINT *); | ||
| 267 | int ec_GFp_simple_set_Jprojective_coordinates(const EC_GROUP *, EC_POINT *, | ||
| 268 | const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *); | ||
| 269 | int ec_GFp_simple_get_Jprojective_coordinates(const EC_GROUP *, | ||
| 270 | const EC_POINT *, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *); | ||
| 271 | int ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP *, EC_POINT *, | ||
| 272 | const BIGNUM *x, const BIGNUM *y, BN_CTX *); | ||
| 273 | int ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *, const EC_POINT *, | ||
| 274 | BIGNUM *x, BIGNUM *y, BN_CTX *); | ||
| 275 | int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *, EC_POINT *, | ||
| 276 | const BIGNUM *x, int y_bit, BN_CTX *); | ||
| 277 | int ec_GFp_simple_add(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *); | ||
| 278 | int ec_GFp_simple_dbl(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, BN_CTX *); | ||
| 279 | int ec_GFp_simple_invert(const EC_GROUP *, EC_POINT *, BN_CTX *); | ||
| 280 | int ec_GFp_simple_is_at_infinity(const EC_GROUP *, const EC_POINT *); | ||
| 281 | int ec_GFp_simple_is_on_curve(const EC_GROUP *, const EC_POINT *, BN_CTX *); | ||
| 282 | int ec_GFp_simple_cmp(const EC_GROUP *, const EC_POINT *a, const EC_POINT *b, BN_CTX *); | ||
| 283 | int ec_GFp_simple_make_affine(const EC_GROUP *, EC_POINT *, BN_CTX *); | ||
| 284 | int ec_GFp_simple_points_make_affine(const EC_GROUP *, size_t num, EC_POINT *[], BN_CTX *); | ||
| 285 | int ec_GFp_simple_field_mul(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *); | ||
| 286 | int ec_GFp_simple_field_sqr(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, BN_CTX *); | ||
| 287 | int ec_GFp_simple_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx); | ||
| 288 | int ec_GFp_simple_mul_generator_ct(const EC_GROUP *, EC_POINT *r, const BIGNUM *scalar, BN_CTX *); | ||
| 289 | int ec_GFp_simple_mul_single_ct(const EC_GROUP *, EC_POINT *r, const BIGNUM *scalar, | ||
| 290 | const EC_POINT *point, BN_CTX *); | ||
| 291 | int ec_GFp_simple_mul_double_nonct(const EC_GROUP *, EC_POINT *r, const BIGNUM *g_scalar, | ||
| 292 | const BIGNUM *p_scalar, const EC_POINT *point, BN_CTX *); | ||
| 293 | |||
| 294 | int ec_group_simple_order_bits(const EC_GROUP *group); | 255 | int ec_group_simple_order_bits(const EC_GROUP *group); |
| 295 | int ec_point_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx); | 256 | int ec_point_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx); |
| 296 | 257 | ||
diff --git a/src/lib/libcrypto/ec/ecp_methods.c b/src/lib/libcrypto/ec/ecp_methods.c index f3c9f05850..6770ef839b 100644 --- a/src/lib/libcrypto/ec/ecp_methods.c +++ b/src/lib/libcrypto/ec/ecp_methods.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecp_methods.c,v 1.3 2024/11/12 10:44:25 tb Exp $ */ | 1 | /* $OpenBSD: ecp_methods.c,v 1.4 2024/11/12 10:53:22 tb Exp $ */ |
| 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
| 3 | * for the OpenSSL project. | 3 | * for the OpenSSL project. |
| 4 | * Includes code written by Bodo Moeller for the OpenSSL project. | 4 | * Includes code written by Bodo Moeller for the OpenSSL project. |
| @@ -86,7 +86,7 @@ | |||
| 86 | * representation (i.e. 'encoding' means multiplying by some factor R). | 86 | * representation (i.e. 'encoding' means multiplying by some factor R). |
| 87 | */ | 87 | */ |
| 88 | 88 | ||
| 89 | int | 89 | static int |
| 90 | ec_GFp_simple_group_init(EC_GROUP *group) | 90 | ec_GFp_simple_group_init(EC_GROUP *group) |
| 91 | { | 91 | { |
| 92 | BN_init(&group->field); | 92 | BN_init(&group->field); |
| @@ -96,7 +96,7 @@ ec_GFp_simple_group_init(EC_GROUP *group) | |||
| 96 | return 1; | 96 | return 1; |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | void | 99 | static void |
| 100 | ec_GFp_simple_group_finish(EC_GROUP *group) | 100 | ec_GFp_simple_group_finish(EC_GROUP *group) |
| 101 | { | 101 | { |
| 102 | BN_free(&group->field); | 102 | BN_free(&group->field); |
| @@ -104,7 +104,7 @@ ec_GFp_simple_group_finish(EC_GROUP *group) | |||
| 104 | BN_free(&group->b); | 104 | BN_free(&group->b); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | int | 107 | static int |
| 108 | ec_GFp_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src) | 108 | ec_GFp_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src) |
| 109 | { | 109 | { |
| 110 | if (!bn_copy(&dest->field, &src->field)) | 110 | if (!bn_copy(&dest->field, &src->field)) |
| @@ -160,7 +160,7 @@ ec_encode_z_coordinate(const EC_GROUP *group, BIGNUM *bn, int *is_one, | |||
| 160 | return 1; | 160 | return 1; |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | int | 163 | static int |
| 164 | ec_GFp_simple_group_set_curve(EC_GROUP *group, | 164 | ec_GFp_simple_group_set_curve(EC_GROUP *group, |
| 165 | const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) | 165 | const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) |
| 166 | { | 166 | { |
| @@ -202,7 +202,7 @@ ec_GFp_simple_group_set_curve(EC_GROUP *group, | |||
| 202 | return ret; | 202 | return ret; |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | int | 205 | static int |
| 206 | ec_GFp_simple_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, | 206 | ec_GFp_simple_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, |
| 207 | BIGNUM *b, BN_CTX *ctx) | 207 | BIGNUM *b, BN_CTX *ctx) |
| 208 | { | 208 | { |
| @@ -218,13 +218,13 @@ ec_GFp_simple_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, | |||
| 218 | return 1; | 218 | return 1; |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | int | 221 | static int |
| 222 | ec_GFp_simple_group_get_degree(const EC_GROUP *group) | 222 | ec_GFp_simple_group_get_degree(const EC_GROUP *group) |
| 223 | { | 223 | { |
| 224 | return BN_num_bits(&group->field); | 224 | return BN_num_bits(&group->field); |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | int | 227 | static int |
| 228 | ec_GFp_simple_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx) | 228 | ec_GFp_simple_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx) |
| 229 | { | 229 | { |
| 230 | BIGNUM *p, *a, *b, *discriminant; | 230 | BIGNUM *p, *a, *b, *discriminant; |
| @@ -281,7 +281,7 @@ ec_GFp_simple_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx) | |||
| 281 | return ret; | 281 | return ret; |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | int | 284 | static int |
| 285 | ec_GFp_simple_point_init(EC_POINT * point) | 285 | ec_GFp_simple_point_init(EC_POINT * point) |
| 286 | { | 286 | { |
| 287 | BN_init(&point->X); | 287 | BN_init(&point->X); |
| @@ -292,7 +292,7 @@ ec_GFp_simple_point_init(EC_POINT * point) | |||
| 292 | return 1; | 292 | return 1; |
| 293 | } | 293 | } |
| 294 | 294 | ||
| 295 | void | 295 | static void |
| 296 | ec_GFp_simple_point_finish(EC_POINT *point) | 296 | ec_GFp_simple_point_finish(EC_POINT *point) |
| 297 | { | 297 | { |
| 298 | BN_free(&point->X); | 298 | BN_free(&point->X); |
| @@ -301,7 +301,7 @@ ec_GFp_simple_point_finish(EC_POINT *point) | |||
| 301 | point->Z_is_one = 0; | 301 | point->Z_is_one = 0; |
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | int | 304 | static int |
| 305 | ec_GFp_simple_point_copy(EC_POINT *dest, const EC_POINT *src) | 305 | ec_GFp_simple_point_copy(EC_POINT *dest, const EC_POINT *src) |
| 306 | { | 306 | { |
| 307 | if (!bn_copy(&dest->X, &src->X)) | 307 | if (!bn_copy(&dest->X, &src->X)) |
| @@ -315,7 +315,7 @@ ec_GFp_simple_point_copy(EC_POINT *dest, const EC_POINT *src) | |||
| 315 | return 1; | 315 | return 1; |
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | int | 318 | static int |
| 319 | ec_GFp_simple_point_set_to_infinity(const EC_GROUP *group, EC_POINT *point) | 319 | ec_GFp_simple_point_set_to_infinity(const EC_GROUP *group, EC_POINT *point) |
| 320 | { | 320 | { |
| 321 | point->Z_is_one = 0; | 321 | point->Z_is_one = 0; |
| @@ -323,7 +323,7 @@ ec_GFp_simple_point_set_to_infinity(const EC_GROUP *group, EC_POINT *point) | |||
| 323 | return 1; | 323 | return 1; |
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | int | 326 | static int |
| 327 | ec_GFp_simple_set_Jprojective_coordinates(const EC_GROUP *group, | 327 | ec_GFp_simple_set_Jprojective_coordinates(const EC_GROUP *group, |
| 328 | EC_POINT *point, const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, | 328 | EC_POINT *point, const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, |
| 329 | BN_CTX *ctx) | 329 | BN_CTX *ctx) |
| @@ -355,7 +355,7 @@ ec_GFp_simple_set_Jprojective_coordinates(const EC_GROUP *group, | |||
| 355 | return ret; | 355 | return ret; |
| 356 | } | 356 | } |
| 357 | 357 | ||
| 358 | int | 358 | static int |
| 359 | ec_GFp_simple_get_Jprojective_coordinates(const EC_GROUP *group, | 359 | ec_GFp_simple_get_Jprojective_coordinates(const EC_GROUP *group, |
| 360 | const EC_POINT *point, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx) | 360 | const EC_POINT *point, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx) |
| 361 | { | 361 | { |
| @@ -374,7 +374,7 @@ ec_GFp_simple_get_Jprojective_coordinates(const EC_GROUP *group, | |||
| 374 | return ret; | 374 | return ret; |
| 375 | } | 375 | } |
| 376 | 376 | ||
| 377 | int | 377 | static int |
| 378 | ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point, | 378 | ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point, |
| 379 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx) | 379 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx) |
| 380 | { | 380 | { |
| @@ -387,7 +387,7 @@ ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP *group, EC_POINT *poin | |||
| 387 | BN_value_one(), ctx); | 387 | BN_value_one(), ctx); |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | int | 390 | static int |
| 391 | ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group, | 391 | ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group, |
| 392 | const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx) | 392 | const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx) |
| 393 | { | 393 | { |
| @@ -468,7 +468,7 @@ ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group, | |||
| 468 | return ret; | 468 | return ret; |
| 469 | } | 469 | } |
| 470 | 470 | ||
| 471 | int | 471 | static int |
| 472 | ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group, | 472 | ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group, |
| 473 | EC_POINT *point, const BIGNUM *in_x, int y_bit, BN_CTX *ctx) | 473 | EC_POINT *point, const BIGNUM *in_x, int y_bit, BN_CTX *ctx) |
| 474 | { | 474 | { |
| @@ -566,7 +566,7 @@ ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group, | |||
| 566 | return ret; | 566 | return ret; |
| 567 | } | 567 | } |
| 568 | 568 | ||
| 569 | int | 569 | static int |
| 570 | ec_GFp_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx) | 570 | ec_GFp_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx) |
| 571 | { | 571 | { |
| 572 | int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); | 572 | int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); |
| @@ -748,7 +748,7 @@ ec_GFp_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const E | |||
| 748 | return ret; | 748 | return ret; |
| 749 | } | 749 | } |
| 750 | 750 | ||
| 751 | int | 751 | static int |
| 752 | ec_GFp_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx) | 752 | ec_GFp_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx) |
| 753 | { | 753 | { |
| 754 | int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); | 754 | int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); |
| @@ -882,7 +882,7 @@ ec_GFp_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX | |||
| 882 | return ret; | 882 | return ret; |
| 883 | } | 883 | } |
| 884 | 884 | ||
| 885 | int | 885 | static int |
| 886 | ec_GFp_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) | 886 | ec_GFp_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) |
| 887 | { | 887 | { |
| 888 | if (EC_POINT_is_at_infinity(group, point) || BN_is_zero(&point->Y)) | 888 | if (EC_POINT_is_at_infinity(group, point) || BN_is_zero(&point->Y)) |
| @@ -892,13 +892,13 @@ ec_GFp_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) | |||
| 892 | return BN_usub(&point->Y, &group->field, &point->Y); | 892 | return BN_usub(&point->Y, &group->field, &point->Y); |
| 893 | } | 893 | } |
| 894 | 894 | ||
| 895 | int | 895 | static int |
| 896 | ec_GFp_simple_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) | 896 | ec_GFp_simple_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) |
| 897 | { | 897 | { |
| 898 | return BN_is_zero(&point->Z); | 898 | return BN_is_zero(&point->Z); |
| 899 | } | 899 | } |
| 900 | 900 | ||
| 901 | int | 901 | static int |
| 902 | ec_GFp_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx) | 902 | ec_GFp_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx) |
| 903 | { | 903 | { |
| 904 | int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); | 904 | int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); |
| @@ -995,7 +995,7 @@ ec_GFp_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX * | |||
| 995 | return ret; | 995 | return ret; |
| 996 | } | 996 | } |
| 997 | 997 | ||
| 998 | int | 998 | static int |
| 999 | ec_GFp_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx) | 999 | ec_GFp_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx) |
| 1000 | { | 1000 | { |
| 1001 | /* | 1001 | /* |
| @@ -1091,7 +1091,7 @@ ec_GFp_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, B | |||
| 1091 | return ret; | 1091 | return ret; |
| 1092 | } | 1092 | } |
| 1093 | 1093 | ||
| 1094 | int | 1094 | static int |
| 1095 | ec_GFp_simple_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) | 1095 | ec_GFp_simple_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) |
| 1096 | { | 1096 | { |
| 1097 | BIGNUM *x, *y; | 1097 | BIGNUM *x, *y; |
| @@ -1123,7 +1123,7 @@ ec_GFp_simple_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) | |||
| 1123 | return ret; | 1123 | return ret; |
| 1124 | } | 1124 | } |
| 1125 | 1125 | ||
| 1126 | int | 1126 | static int |
| 1127 | ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx) | 1127 | ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx) |
| 1128 | { | 1128 | { |
| 1129 | BIGNUM *tmp0, *tmp1; | 1129 | BIGNUM *tmp0, *tmp1; |
| @@ -1292,13 +1292,13 @@ ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *po | |||
| 1292 | return ret; | 1292 | return ret; |
| 1293 | } | 1293 | } |
| 1294 | 1294 | ||
| 1295 | int | 1295 | static int |
| 1296 | ec_GFp_simple_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) | 1296 | ec_GFp_simple_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) |
| 1297 | { | 1297 | { |
| 1298 | return BN_mod_mul(r, a, b, &group->field, ctx); | 1298 | return BN_mod_mul(r, a, b, &group->field, ctx); |
| 1299 | } | 1299 | } |
| 1300 | 1300 | ||
| 1301 | int | 1301 | static int |
| 1302 | ec_GFp_simple_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) | 1302 | ec_GFp_simple_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) |
| 1303 | { | 1303 | { |
| 1304 | return BN_mod_sqr(r, a, &group->field, ctx); | 1304 | return BN_mod_sqr(r, a, &group->field, ctx); |
| @@ -1311,7 +1311,7 @@ ec_GFp_simple_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, BN_CT | |||
| 1311 | * | 1311 | * |
| 1312 | * where lambda is in the interval [1, group->field). | 1312 | * where lambda is in the interval [1, group->field). |
| 1313 | */ | 1313 | */ |
| 1314 | int | 1314 | static int |
| 1315 | ec_GFp_simple_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx) | 1315 | ec_GFp_simple_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx) |
| 1316 | { | 1316 | { |
| 1317 | BIGNUM *lambda = NULL; | 1317 | BIGNUM *lambda = NULL; |
| @@ -1586,21 +1586,21 @@ ec_GFp_simple_mul_ct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
| 1586 | #undef EC_POINT_BN_set_flags | 1586 | #undef EC_POINT_BN_set_flags |
| 1587 | #undef EC_POINT_CSWAP | 1587 | #undef EC_POINT_CSWAP |
| 1588 | 1588 | ||
| 1589 | int | 1589 | static int |
| 1590 | ec_GFp_simple_mul_generator_ct(const EC_GROUP *group, EC_POINT *r, | 1590 | ec_GFp_simple_mul_generator_ct(const EC_GROUP *group, EC_POINT *r, |
| 1591 | const BIGNUM *scalar, BN_CTX *ctx) | 1591 | const BIGNUM *scalar, BN_CTX *ctx) |
| 1592 | { | 1592 | { |
| 1593 | return ec_GFp_simple_mul_ct(group, r, scalar, NULL, ctx); | 1593 | return ec_GFp_simple_mul_ct(group, r, scalar, NULL, ctx); |
| 1594 | } | 1594 | } |
| 1595 | 1595 | ||
| 1596 | int | 1596 | static int |
| 1597 | ec_GFp_simple_mul_single_ct(const EC_GROUP *group, EC_POINT *r, | 1597 | ec_GFp_simple_mul_single_ct(const EC_GROUP *group, EC_POINT *r, |
| 1598 | const BIGNUM *scalar, const EC_POINT *point, BN_CTX *ctx) | 1598 | const BIGNUM *scalar, const EC_POINT *point, BN_CTX *ctx) |
| 1599 | { | 1599 | { |
| 1600 | return ec_GFp_simple_mul_ct(group, r, scalar, point, ctx); | 1600 | return ec_GFp_simple_mul_ct(group, r, scalar, point, ctx); |
| 1601 | } | 1601 | } |
| 1602 | 1602 | ||
| 1603 | int | 1603 | static int |
| 1604 | ec_GFp_simple_mul_double_nonct(const EC_GROUP *group, EC_POINT *r, | 1604 | ec_GFp_simple_mul_double_nonct(const EC_GROUP *group, EC_POINT *r, |
| 1605 | const BIGNUM *g_scalar, const BIGNUM *p_scalar, const EC_POINT *point, | 1605 | const BIGNUM *g_scalar, const BIGNUM *p_scalar, const EC_POINT *point, |
| 1606 | BN_CTX *ctx) | 1606 | BN_CTX *ctx) |
