diff options
| author | tb <> | 2024-10-31 15:37:53 +0000 |
|---|---|---|
| committer | tb <> | 2024-10-31 15:37:53 +0000 |
| commit | bebe8bdb2de5180072fb5cf327bce41d8398e8cc (patch) | |
| tree | 213f15ca307e60a6806d6afab897c0a81c295102 /src/lib/libcrypto/ec/ec_convert.c | |
| parent | 1bd9124c67ffd97dba5b773edc5d2e6968f685a3 (diff) | |
| download | openbsd-bebe8bdb2de5180072fb5cf327bce41d8398e8cc.tar.gz openbsd-bebe8bdb2de5180072fb5cf327bce41d8398e8cc.tar.bz2 openbsd-bebe8bdb2de5180072fb5cf327bce41d8398e8cc.zip | |
Retire the oct2point and point2oct EC_METHOD members
Both our remaining EC_METHODs use the methods that used to be called
ec_GFp_simple_{oct2point,point2oct}() so there's no need for the function
pointer indirection. Make the public API call them directly.
ok jsing
Diffstat (limited to 'src/lib/libcrypto/ec/ec_convert.c')
| -rw-r--r-- | src/lib/libcrypto/ec/ec_convert.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/lib/libcrypto/ec/ec_convert.c b/src/lib/libcrypto/ec/ec_convert.c index a151850f46..3fdbaf3ce7 100644 --- a/src/lib/libcrypto/ec/ec_convert.c +++ b/src/lib/libcrypto/ec/ec_convert.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_convert.c,v 1.6 2024/10/31 05:03:57 tb Exp $ */ | 1 | /* $OpenBSD: ec_convert.c,v 1.7 2024/10/31 15:37:53 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 | */ |
| @@ -218,8 +218,8 @@ ec_oct_get_field_element_cbs(CBS *cbs, const EC_GROUP *group, BIGNUM *bn) | |||
| 218 | return 1; | 218 | return 1; |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | size_t | 221 | static size_t |
| 222 | ec_GFp_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, | 222 | ec_oct_point2oct(const EC_GROUP *group, const EC_POINT *point, |
| 223 | point_conversion_form_t conversion_form, unsigned char *buf, size_t len, | 223 | point_conversion_form_t conversion_form, unsigned char *buf, size_t len, |
| 224 | BN_CTX *ctx) | 224 | BN_CTX *ctx) |
| 225 | { | 225 | { |
| @@ -308,8 +308,8 @@ ec_GFp_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, | |||
| 308 | return ret; | 308 | return ret; |
| 309 | } | 309 | } |
| 310 | 310 | ||
| 311 | int | 311 | static int |
| 312 | ec_GFp_simple_oct2point(const EC_GROUP *group, EC_POINT *point, | 312 | ec_oct_oct2point(const EC_GROUP *group, EC_POINT *point, |
| 313 | const unsigned char *buf, size_t len, BN_CTX *ctx) | 313 | const unsigned char *buf, size_t len, BN_CTX *ctx) |
| 314 | { | 314 | { |
| 315 | CBS cbs; | 315 | CBS cbs; |
| @@ -447,15 +447,11 @@ EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point, | |||
| 447 | if (ctx == NULL) | 447 | if (ctx == NULL) |
| 448 | goto err; | 448 | goto err; |
| 449 | 449 | ||
| 450 | if (group->meth->point2oct == NULL) { | ||
| 451 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | ||
| 452 | goto err; | ||
| 453 | } | ||
| 454 | if (group->meth != point->meth) { | 450 | if (group->meth != point->meth) { |
| 455 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | 451 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 456 | goto err; | 452 | goto err; |
| 457 | } | 453 | } |
| 458 | ret = group->meth->point2oct(group, point, form, buf, len, ctx); | 454 | ret = ec_oct_point2oct(group, point, form, buf, len, ctx); |
| 459 | 455 | ||
| 460 | err: | 456 | err: |
| 461 | if (ctx != ctx_in) | 457 | if (ctx != ctx_in) |
| @@ -477,15 +473,11 @@ EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point, | |||
| 477 | if (ctx == NULL) | 473 | if (ctx == NULL) |
| 478 | goto err; | 474 | goto err; |
| 479 | 475 | ||
| 480 | if (group->meth->oct2point == NULL) { | ||
| 481 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | ||
| 482 | goto err; | ||
| 483 | } | ||
| 484 | if (group->meth != point->meth) { | 476 | if (group->meth != point->meth) { |
| 485 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | 477 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 486 | goto err; | 478 | goto err; |
| 487 | } | 479 | } |
| 488 | ret = group->meth->oct2point(group, point, buf, len, ctx); | 480 | ret = ec_oct_oct2point(group, point, buf, len, ctx); |
| 489 | 481 | ||
| 490 | err: | 482 | err: |
| 491 | if (ctx != ctx_in) | 483 | if (ctx != ctx_in) |
