diff options
| author | beck <> | 2017-01-29 17:49:23 +0000 |
|---|---|---|
| committer | beck <> | 2017-01-29 17:49:23 +0000 |
| commit | d1f47bd292f36094480caa49ada36b99a69c59b0 (patch) | |
| tree | 1a54abba678898ee5270ae4f3404a50ee9a92eea /src/lib/libcrypto/ec/ec_lib.c | |
| parent | f8c627888330b75c2eea8a3c27d0efe947a4f9da (diff) | |
| download | openbsd-d1f47bd292f36094480caa49ada36b99a69c59b0.tar.gz openbsd-d1f47bd292f36094480caa49ada36b99a69c59b0.tar.bz2 openbsd-d1f47bd292f36094480caa49ada36b99a69c59b0.zip | |
Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@
Diffstat (limited to 'src/lib/libcrypto/ec/ec_lib.c')
| -rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index 976091f4c9..baddbf6dc8 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_lib.c,v 1.22 2016/09/03 12:10:40 beck Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.23 2017/01/29 17:49:23 beck 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 | */ |
| @@ -78,16 +78,16 @@ EC_GROUP_new(const EC_METHOD * meth) | |||
| 78 | EC_GROUP *ret; | 78 | EC_GROUP *ret; |
| 79 | 79 | ||
| 80 | if (meth == NULL) { | 80 | if (meth == NULL) { |
| 81 | ECerr(EC_F_EC_GROUP_NEW, EC_R_SLOT_FULL); | 81 | ECerror(EC_R_SLOT_FULL); |
| 82 | return NULL; | 82 | return NULL; |
| 83 | } | 83 | } |
| 84 | if (meth->group_init == 0) { | 84 | if (meth->group_init == 0) { |
| 85 | ECerr(EC_F_EC_GROUP_NEW, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 85 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 86 | return NULL; | 86 | return NULL; |
| 87 | } | 87 | } |
| 88 | ret = malloc(sizeof *ret); | 88 | ret = malloc(sizeof *ret); |
| 89 | if (ret == NULL) { | 89 | if (ret == NULL) { |
| 90 | ECerr(EC_F_EC_GROUP_NEW, ERR_R_MALLOC_FAILURE); | 90 | ECerror(ERR_R_MALLOC_FAILURE); |
| 91 | return NULL; | 91 | return NULL; |
| 92 | } | 92 | } |
| 93 | ret->meth = meth; | 93 | ret->meth = meth; |
| @@ -166,11 +166,11 @@ EC_GROUP_copy(EC_GROUP * dest, const EC_GROUP * src) | |||
| 166 | EC_EXTRA_DATA *d; | 166 | EC_EXTRA_DATA *d; |
| 167 | 167 | ||
| 168 | if (dest->meth->group_copy == 0) { | 168 | if (dest->meth->group_copy == 0) { |
| 169 | ECerr(EC_F_EC_GROUP_COPY, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 169 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 170 | return 0; | 170 | return 0; |
| 171 | } | 171 | } |
| 172 | if (dest->meth != src->meth) { | 172 | if (dest->meth != src->meth) { |
| 173 | ECerr(EC_F_EC_GROUP_COPY, EC_R_INCOMPATIBLE_OBJECTS); | 173 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 174 | return 0; | 174 | return 0; |
| 175 | } | 175 | } |
| 176 | if (dest == src) | 176 | if (dest == src) |
| @@ -262,7 +262,7 @@ EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, | |||
| 262 | const BIGNUM *order, const BIGNUM *cofactor) | 262 | const BIGNUM *order, const BIGNUM *cofactor) |
| 263 | { | 263 | { |
| 264 | if (generator == NULL) { | 264 | if (generator == NULL) { |
| 265 | ECerr(EC_F_EC_GROUP_SET_GENERATOR, ERR_R_PASSED_NULL_PARAMETER); | 265 | ECerror(ERR_R_PASSED_NULL_PARAMETER); |
| 266 | return 0; | 266 | return 0; |
| 267 | } | 267 | } |
| 268 | if (group->generator == NULL) { | 268 | if (group->generator == NULL) { |
| @@ -398,7 +398,7 @@ EC_GROUP_set_curve_GFp(EC_GROUP * group, const BIGNUM * p, const BIGNUM * a, | |||
| 398 | const BIGNUM * b, BN_CTX * ctx) | 398 | const BIGNUM * b, BN_CTX * ctx) |
| 399 | { | 399 | { |
| 400 | if (group->meth->group_set_curve == 0) { | 400 | if (group->meth->group_set_curve == 0) { |
| 401 | ECerr(EC_F_EC_GROUP_SET_CURVE_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 401 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 402 | return 0; | 402 | return 0; |
| 403 | } | 403 | } |
| 404 | return group->meth->group_set_curve(group, p, a, b, ctx); | 404 | return group->meth->group_set_curve(group, p, a, b, ctx); |
| @@ -410,7 +410,7 @@ EC_GROUP_get_curve_GFp(const EC_GROUP * group, BIGNUM * p, BIGNUM * a, | |||
| 410 | BIGNUM * b, BN_CTX * ctx) | 410 | BIGNUM * b, BN_CTX * ctx) |
| 411 | { | 411 | { |
| 412 | if (group->meth->group_get_curve == 0) { | 412 | if (group->meth->group_get_curve == 0) { |
| 413 | ECerr(EC_F_EC_GROUP_GET_CURVE_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 413 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 414 | return 0; | 414 | return 0; |
| 415 | } | 415 | } |
| 416 | return group->meth->group_get_curve(group, p, a, b, ctx); | 416 | return group->meth->group_get_curve(group, p, a, b, ctx); |
| @@ -422,7 +422,7 @@ EC_GROUP_set_curve_GF2m(EC_GROUP * group, const BIGNUM * p, const BIGNUM * a, | |||
| 422 | const BIGNUM * b, BN_CTX * ctx) | 422 | const BIGNUM * b, BN_CTX * ctx) |
| 423 | { | 423 | { |
| 424 | if (group->meth->group_set_curve == 0) { | 424 | if (group->meth->group_set_curve == 0) { |
| 425 | ECerr(EC_F_EC_GROUP_SET_CURVE_GF2M, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 425 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 426 | return 0; | 426 | return 0; |
| 427 | } | 427 | } |
| 428 | return group->meth->group_set_curve(group, p, a, b, ctx); | 428 | return group->meth->group_set_curve(group, p, a, b, ctx); |
| @@ -434,7 +434,7 @@ EC_GROUP_get_curve_GF2m(const EC_GROUP * group, BIGNUM * p, BIGNUM * a, | |||
| 434 | BIGNUM * b, BN_CTX * ctx) | 434 | BIGNUM * b, BN_CTX * ctx) |
| 435 | { | 435 | { |
| 436 | if (group->meth->group_get_curve == 0) { | 436 | if (group->meth->group_get_curve == 0) { |
| 437 | ECerr(EC_F_EC_GROUP_GET_CURVE_GF2M, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 437 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 438 | return 0; | 438 | return 0; |
| 439 | } | 439 | } |
| 440 | return group->meth->group_get_curve(group, p, a, b, ctx); | 440 | return group->meth->group_get_curve(group, p, a, b, ctx); |
| @@ -445,7 +445,7 @@ int | |||
| 445 | EC_GROUP_get_degree(const EC_GROUP * group) | 445 | EC_GROUP_get_degree(const EC_GROUP * group) |
| 446 | { | 446 | { |
| 447 | if (group->meth->group_get_degree == 0) { | 447 | if (group->meth->group_get_degree == 0) { |
| 448 | ECerr(EC_F_EC_GROUP_GET_DEGREE, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 448 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 449 | return 0; | 449 | return 0; |
| 450 | } | 450 | } |
| 451 | return group->meth->group_get_degree(group); | 451 | return group->meth->group_get_degree(group); |
| @@ -456,7 +456,7 @@ int | |||
| 456 | EC_GROUP_check_discriminant(const EC_GROUP * group, BN_CTX * ctx) | 456 | EC_GROUP_check_discriminant(const EC_GROUP * group, BN_CTX * ctx) |
| 457 | { | 457 | { |
| 458 | if (group->meth->group_check_discriminant == 0) { | 458 | if (group->meth->group_check_discriminant == 0) { |
| 459 | ECerr(EC_F_EC_GROUP_CHECK_DISCRIMINANT, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 459 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 460 | return 0; | 460 | return 0; |
| 461 | } | 461 | } |
| 462 | return group->meth->group_check_discriminant(group, ctx); | 462 | return group->meth->group_check_discriminant(group, ctx); |
| @@ -553,7 +553,7 @@ EC_EX_DATA_set_data(EC_EXTRA_DATA ** ex_data, void *data, | |||
| 553 | for (d = *ex_data; d != NULL; d = d->next) { | 553 | for (d = *ex_data; d != NULL; d = d->next) { |
| 554 | if (d->dup_func == dup_func && d->free_func == free_func && | 554 | if (d->dup_func == dup_func && d->free_func == free_func && |
| 555 | d->clear_free_func == clear_free_func) { | 555 | d->clear_free_func == clear_free_func) { |
| 556 | ECerr(EC_F_EC_EX_DATA_SET_DATA, EC_R_SLOT_FULL); | 556 | ECerror(EC_R_SLOT_FULL); |
| 557 | return 0; | 557 | return 0; |
| 558 | } | 558 | } |
| 559 | } | 559 | } |
| @@ -699,16 +699,16 @@ EC_POINT_new(const EC_GROUP * group) | |||
| 699 | EC_POINT *ret; | 699 | EC_POINT *ret; |
| 700 | 700 | ||
| 701 | if (group == NULL) { | 701 | if (group == NULL) { |
| 702 | ECerr(EC_F_EC_POINT_NEW, ERR_R_PASSED_NULL_PARAMETER); | 702 | ECerror(ERR_R_PASSED_NULL_PARAMETER); |
| 703 | return NULL; | 703 | return NULL; |
| 704 | } | 704 | } |
| 705 | if (group->meth->point_init == 0) { | 705 | if (group->meth->point_init == 0) { |
| 706 | ECerr(EC_F_EC_POINT_NEW, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 706 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 707 | return NULL; | 707 | return NULL; |
| 708 | } | 708 | } |
| 709 | ret = malloc(sizeof *ret); | 709 | ret = malloc(sizeof *ret); |
| 710 | if (ret == NULL) { | 710 | if (ret == NULL) { |
| 711 | ECerr(EC_F_EC_POINT_NEW, ERR_R_MALLOC_FAILURE); | 711 | ECerror(ERR_R_MALLOC_FAILURE); |
| 712 | return NULL; | 712 | return NULL; |
| 713 | } | 713 | } |
| 714 | ret->meth = group->meth; | 714 | ret->meth = group->meth; |
| @@ -752,11 +752,11 @@ int | |||
| 752 | EC_POINT_copy(EC_POINT * dest, const EC_POINT * src) | 752 | EC_POINT_copy(EC_POINT * dest, const EC_POINT * src) |
| 753 | { | 753 | { |
| 754 | if (dest->meth->point_copy == 0) { | 754 | if (dest->meth->point_copy == 0) { |
| 755 | ECerr(EC_F_EC_POINT_COPY, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 755 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 756 | return 0; | 756 | return 0; |
| 757 | } | 757 | } |
| 758 | if (dest->meth != src->meth) { | 758 | if (dest->meth != src->meth) { |
| 759 | ECerr(EC_F_EC_POINT_COPY, EC_R_INCOMPATIBLE_OBJECTS); | 759 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 760 | return 0; | 760 | return 0; |
| 761 | } | 761 | } |
| 762 | if (dest == src) | 762 | if (dest == src) |
| @@ -797,11 +797,11 @@ int | |||
| 797 | EC_POINT_set_to_infinity(const EC_GROUP * group, EC_POINT * point) | 797 | EC_POINT_set_to_infinity(const EC_GROUP * group, EC_POINT * point) |
| 798 | { | 798 | { |
| 799 | if (group->meth->point_set_to_infinity == 0) { | 799 | if (group->meth->point_set_to_infinity == 0) { |
| 800 | ECerr(EC_F_EC_POINT_SET_TO_INFINITY, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 800 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 801 | return 0; | 801 | return 0; |
| 802 | } | 802 | } |
| 803 | if (group->meth != point->meth) { | 803 | if (group->meth != point->meth) { |
| 804 | ECerr(EC_F_EC_POINT_SET_TO_INFINITY, EC_R_INCOMPATIBLE_OBJECTS); | 804 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 805 | return 0; | 805 | return 0; |
| 806 | } | 806 | } |
| 807 | return group->meth->point_set_to_infinity(group, point); | 807 | return group->meth->point_set_to_infinity(group, point); |
| @@ -813,11 +813,11 @@ EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *point, | |||
| 813 | const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx) | 813 | const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx) |
| 814 | { | 814 | { |
| 815 | if (group->meth->point_set_Jprojective_coordinates_GFp == 0) { | 815 | if (group->meth->point_set_Jprojective_coordinates_GFp == 0) { |
| 816 | ECerr(EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 816 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 817 | return 0; | 817 | return 0; |
| 818 | } | 818 | } |
| 819 | if (group->meth != point->meth) { | 819 | if (group->meth != point->meth) { |
| 820 | ECerr(EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP, EC_R_INCOMPATIBLE_OBJECTS); | 820 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 821 | return 0; | 821 | return 0; |
| 822 | } | 822 | } |
| 823 | return group->meth->point_set_Jprojective_coordinates_GFp(group, point, x, y, z, ctx); | 823 | return group->meth->point_set_Jprojective_coordinates_GFp(group, point, x, y, z, ctx); |
| @@ -829,11 +829,11 @@ EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, | |||
| 829 | const EC_POINT *point, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx) | 829 | const EC_POINT *point, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx) |
| 830 | { | 830 | { |
| 831 | if (group->meth->point_get_Jprojective_coordinates_GFp == 0) { | 831 | if (group->meth->point_get_Jprojective_coordinates_GFp == 0) { |
| 832 | ECerr(EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 832 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 833 | return 0; | 833 | return 0; |
| 834 | } | 834 | } |
| 835 | if (group->meth != point->meth) { | 835 | if (group->meth != point->meth) { |
| 836 | ECerr(EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP, EC_R_INCOMPATIBLE_OBJECTS); | 836 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 837 | return 0; | 837 | return 0; |
| 838 | } | 838 | } |
| 839 | return group->meth->point_get_Jprojective_coordinates_GFp(group, point, x, y, z, ctx); | 839 | return group->meth->point_get_Jprojective_coordinates_GFp(group, point, x, y, z, ctx); |
| @@ -845,11 +845,11 @@ EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *point, | |||
| 845 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx) | 845 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx) |
| 846 | { | 846 | { |
| 847 | if (group->meth->point_set_affine_coordinates == 0) { | 847 | if (group->meth->point_set_affine_coordinates == 0) { |
| 848 | ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 848 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 849 | return 0; | 849 | return 0; |
| 850 | } | 850 | } |
| 851 | if (group->meth != point->meth) { | 851 | if (group->meth != point->meth) { |
| 852 | ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP, EC_R_INCOMPATIBLE_OBJECTS); | 852 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 853 | return 0; | 853 | return 0; |
| 854 | } | 854 | } |
| 855 | return group->meth->point_set_affine_coordinates(group, point, x, y, ctx); | 855 | return group->meth->point_set_affine_coordinates(group, point, x, y, ctx); |
| @@ -861,11 +861,11 @@ EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *point, | |||
| 861 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx) | 861 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx) |
| 862 | { | 862 | { |
| 863 | if (group->meth->point_set_affine_coordinates == 0) { | 863 | if (group->meth->point_set_affine_coordinates == 0) { |
| 864 | ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 864 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 865 | return 0; | 865 | return 0; |
| 866 | } | 866 | } |
| 867 | if (group->meth != point->meth) { | 867 | if (group->meth != point->meth) { |
| 868 | ECerr(EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M, EC_R_INCOMPATIBLE_OBJECTS); | 868 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 869 | return 0; | 869 | return 0; |
| 870 | } | 870 | } |
| 871 | return group->meth->point_set_affine_coordinates(group, point, x, y, ctx); | 871 | return group->meth->point_set_affine_coordinates(group, point, x, y, ctx); |
| @@ -877,11 +877,11 @@ EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, const EC_POINT *point | |||
| 877 | BIGNUM *x, BIGNUM *y, BN_CTX *ctx) | 877 | BIGNUM *x, BIGNUM *y, BN_CTX *ctx) |
| 878 | { | 878 | { |
| 879 | if (group->meth->point_get_affine_coordinates == 0) { | 879 | if (group->meth->point_get_affine_coordinates == 0) { |
| 880 | ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 880 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 881 | return 0; | 881 | return 0; |
| 882 | } | 882 | } |
| 883 | if (group->meth != point->meth) { | 883 | if (group->meth != point->meth) { |
| 884 | ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP, EC_R_INCOMPATIBLE_OBJECTS); | 884 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 885 | return 0; | 885 | return 0; |
| 886 | } | 886 | } |
| 887 | return group->meth->point_get_affine_coordinates(group, point, x, y, ctx); | 887 | return group->meth->point_get_affine_coordinates(group, point, x, y, ctx); |
| @@ -893,11 +893,11 @@ EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, const EC_POINT *poin | |||
| 893 | BIGNUM *x, BIGNUM *y, BN_CTX *ctx) | 893 | BIGNUM *x, BIGNUM *y, BN_CTX *ctx) |
| 894 | { | 894 | { |
| 895 | if (group->meth->point_get_affine_coordinates == 0) { | 895 | if (group->meth->point_get_affine_coordinates == 0) { |
| 896 | ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 896 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 897 | return 0; | 897 | return 0; |
| 898 | } | 898 | } |
| 899 | if (group->meth != point->meth) { | 899 | if (group->meth != point->meth) { |
| 900 | ECerr(EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M, EC_R_INCOMPATIBLE_OBJECTS); | 900 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 901 | return 0; | 901 | return 0; |
| 902 | } | 902 | } |
| 903 | return group->meth->point_get_affine_coordinates(group, point, x, y, ctx); | 903 | return group->meth->point_get_affine_coordinates(group, point, x, y, ctx); |
| @@ -909,11 +909,11 @@ EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | |||
| 909 | const EC_POINT *b, BN_CTX *ctx) | 909 | const EC_POINT *b, BN_CTX *ctx) |
| 910 | { | 910 | { |
| 911 | if (group->meth->add == 0) { | 911 | if (group->meth->add == 0) { |
| 912 | ECerr(EC_F_EC_POINT_ADD, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 912 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 913 | return 0; | 913 | return 0; |
| 914 | } | 914 | } |
| 915 | if ((group->meth != r->meth) || (r->meth != a->meth) || (a->meth != b->meth)) { | 915 | if ((group->meth != r->meth) || (r->meth != a->meth) || (a->meth != b->meth)) { |
| 916 | ECerr(EC_F_EC_POINT_ADD, EC_R_INCOMPATIBLE_OBJECTS); | 916 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 917 | return 0; | 917 | return 0; |
| 918 | } | 918 | } |
| 919 | return group->meth->add(group, r, a, b, ctx); | 919 | return group->meth->add(group, r, a, b, ctx); |
| @@ -924,11 +924,11 @@ int | |||
| 924 | EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx) | 924 | EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx) |
| 925 | { | 925 | { |
| 926 | if (group->meth->dbl == 0) { | 926 | if (group->meth->dbl == 0) { |
| 927 | ECerr(EC_F_EC_POINT_DBL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 927 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 928 | return 0; | 928 | return 0; |
| 929 | } | 929 | } |
| 930 | if ((group->meth != r->meth) || (r->meth != a->meth)) { | 930 | if ((group->meth != r->meth) || (r->meth != a->meth)) { |
| 931 | ECerr(EC_F_EC_POINT_DBL, EC_R_INCOMPATIBLE_OBJECTS); | 931 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 932 | return 0; | 932 | return 0; |
| 933 | } | 933 | } |
| 934 | return group->meth->dbl(group, r, a, ctx); | 934 | return group->meth->dbl(group, r, a, ctx); |
| @@ -939,11 +939,11 @@ int | |||
| 939 | EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx) | 939 | EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx) |
| 940 | { | 940 | { |
| 941 | if (group->meth->invert == 0) { | 941 | if (group->meth->invert == 0) { |
| 942 | ECerr(EC_F_EC_POINT_INVERT, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 942 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 943 | return 0; | 943 | return 0; |
| 944 | } | 944 | } |
| 945 | if (group->meth != a->meth) { | 945 | if (group->meth != a->meth) { |
| 946 | ECerr(EC_F_EC_POINT_INVERT, EC_R_INCOMPATIBLE_OBJECTS); | 946 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 947 | return 0; | 947 | return 0; |
| 948 | } | 948 | } |
| 949 | return group->meth->invert(group, a, ctx); | 949 | return group->meth->invert(group, a, ctx); |
| @@ -954,11 +954,11 @@ int | |||
| 954 | EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) | 954 | EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) |
| 955 | { | 955 | { |
| 956 | if (group->meth->is_at_infinity == 0) { | 956 | if (group->meth->is_at_infinity == 0) { |
| 957 | ECerr(EC_F_EC_POINT_IS_AT_INFINITY, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 957 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 958 | return 0; | 958 | return 0; |
| 959 | } | 959 | } |
| 960 | if (group->meth != point->meth) { | 960 | if (group->meth != point->meth) { |
| 961 | ECerr(EC_F_EC_POINT_IS_AT_INFINITY, EC_R_INCOMPATIBLE_OBJECTS); | 961 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 962 | return 0; | 962 | return 0; |
| 963 | } | 963 | } |
| 964 | return group->meth->is_at_infinity(group, point); | 964 | return group->meth->is_at_infinity(group, point); |
| @@ -969,11 +969,11 @@ int | |||
| 969 | EC_POINT_is_on_curve(const EC_GROUP * group, const EC_POINT * point, BN_CTX * ctx) | 969 | EC_POINT_is_on_curve(const EC_GROUP * group, const EC_POINT * point, BN_CTX * ctx) |
| 970 | { | 970 | { |
| 971 | if (group->meth->is_on_curve == 0) { | 971 | if (group->meth->is_on_curve == 0) { |
| 972 | ECerr(EC_F_EC_POINT_IS_ON_CURVE, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 972 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 973 | return 0; | 973 | return 0; |
| 974 | } | 974 | } |
| 975 | if (group->meth != point->meth) { | 975 | if (group->meth != point->meth) { |
| 976 | ECerr(EC_F_EC_POINT_IS_ON_CURVE, EC_R_INCOMPATIBLE_OBJECTS); | 976 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 977 | return 0; | 977 | return 0; |
| 978 | } | 978 | } |
| 979 | return group->meth->is_on_curve(group, point, ctx); | 979 | return group->meth->is_on_curve(group, point, ctx); |
| @@ -985,11 +985,11 @@ EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, | |||
| 985 | BN_CTX * ctx) | 985 | BN_CTX * ctx) |
| 986 | { | 986 | { |
| 987 | if (group->meth->point_cmp == 0) { | 987 | if (group->meth->point_cmp == 0) { |
| 988 | ECerr(EC_F_EC_POINT_CMP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 988 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 989 | return -1; | 989 | return -1; |
| 990 | } | 990 | } |
| 991 | if ((group->meth != a->meth) || (a->meth != b->meth)) { | 991 | if ((group->meth != a->meth) || (a->meth != b->meth)) { |
| 992 | ECerr(EC_F_EC_POINT_CMP, EC_R_INCOMPATIBLE_OBJECTS); | 992 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 993 | return -1; | 993 | return -1; |
| 994 | } | 994 | } |
| 995 | return group->meth->point_cmp(group, a, b, ctx); | 995 | return group->meth->point_cmp(group, a, b, ctx); |
| @@ -1000,11 +1000,11 @@ int | |||
| 1000 | EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) | 1000 | EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) |
| 1001 | { | 1001 | { |
| 1002 | if (group->meth->make_affine == 0) { | 1002 | if (group->meth->make_affine == 0) { |
| 1003 | ECerr(EC_F_EC_POINT_MAKE_AFFINE, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 1003 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 1004 | return 0; | 1004 | return 0; |
| 1005 | } | 1005 | } |
| 1006 | if (group->meth != point->meth) { | 1006 | if (group->meth != point->meth) { |
| 1007 | ECerr(EC_F_EC_POINT_MAKE_AFFINE, EC_R_INCOMPATIBLE_OBJECTS); | 1007 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 1008 | return 0; | 1008 | return 0; |
| 1009 | } | 1009 | } |
| 1010 | return group->meth->make_affine(group, point, ctx); | 1010 | return group->meth->make_affine(group, point, ctx); |
| @@ -1018,12 +1018,12 @@ EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], | |||
| 1018 | size_t i; | 1018 | size_t i; |
| 1019 | 1019 | ||
| 1020 | if (group->meth->points_make_affine == 0) { | 1020 | if (group->meth->points_make_affine == 0) { |
| 1021 | ECerr(EC_F_EC_POINTS_MAKE_AFFINE, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 1021 | ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
| 1022 | return 0; | 1022 | return 0; |
| 1023 | } | 1023 | } |
| 1024 | for (i = 0; i < num; i++) { | 1024 | for (i = 0; i < num; i++) { |
| 1025 | if (group->meth != points[i]->meth) { | 1025 | if (group->meth != points[i]->meth) { |
| 1026 | ECerr(EC_F_EC_POINTS_MAKE_AFFINE, EC_R_INCOMPATIBLE_OBJECTS); | 1026 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
| 1027 | return 0; | 1027 | return 0; |
| 1028 | } | 1028 | } |
| 1029 | } | 1029 | } |
