diff options
Diffstat (limited to 'src/lib/libcrypto/ec/ec_lib.c')
-rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index 7982d23f06..36f42ecc05 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.123 2025/03/24 13:07:04 jsing Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.126 2025/08/02 15:47:27 jsing 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 | */ |
@@ -68,12 +68,12 @@ | |||
68 | 68 | ||
69 | #include <openssl/bn.h> | 69 | #include <openssl/bn.h> |
70 | #include <openssl/ec.h> | 70 | #include <openssl/ec.h> |
71 | #include <openssl/err.h> | ||
72 | #include <openssl/objects.h> | 71 | #include <openssl/objects.h> |
73 | #include <openssl/opensslv.h> | 72 | #include <openssl/opensslv.h> |
74 | 73 | ||
75 | #include "bn_local.h" | 74 | #include "bn_local.h" |
76 | #include "ec_local.h" | 75 | #include "ec_local.h" |
76 | #include "err_local.h" | ||
77 | 77 | ||
78 | EC_GROUP * | 78 | EC_GROUP * |
79 | EC_GROUP_new(const EC_METHOD *meth) | 79 | EC_GROUP_new(const EC_METHOD *meth) |
@@ -165,6 +165,10 @@ EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src) | |||
165 | 165 | ||
166 | dst->a_is_minus3 = src->a_is_minus3; | 166 | dst->a_is_minus3 = src->a_is_minus3; |
167 | 167 | ||
168 | memcpy(&dst->fm, &src->fm, sizeof(src->fm)); | ||
169 | memcpy(&dst->fe_a, &src->fe_a, sizeof(src->fe_a)); | ||
170 | memcpy(&dst->fe_b, &src->fe_b, sizeof(src->fe_b)); | ||
171 | |||
168 | BN_MONT_CTX_free(dst->mont_ctx); | 172 | BN_MONT_CTX_free(dst->mont_ctx); |
169 | dst->mont_ctx = NULL; | 173 | dst->mont_ctx = NULL; |
170 | if (src->mont_ctx != NULL) { | 174 | if (src->mont_ctx != NULL) { |
@@ -860,6 +864,10 @@ EC_POINT_copy(EC_POINT *dst, const EC_POINT *src) | |||
860 | return 0; | 864 | return 0; |
861 | dst->Z_is_one = src->Z_is_one; | 865 | dst->Z_is_one = src->Z_is_one; |
862 | 866 | ||
867 | memcpy(&dst->fe_x, &src->fe_x, sizeof(dst->fe_x)); | ||
868 | memcpy(&dst->fe_y, &src->fe_y, sizeof(dst->fe_y)); | ||
869 | memcpy(&dst->fe_z, &src->fe_z, sizeof(dst->fe_z)); | ||
870 | |||
863 | return 1; | 871 | return 1; |
864 | } | 872 | } |
865 | LCRYPTO_ALIAS(EC_POINT_copy); | 873 | LCRYPTO_ALIAS(EC_POINT_copy); |
@@ -894,11 +902,7 @@ EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point) | |||
894 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | 902 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
895 | return 0; | 903 | return 0; |
896 | } | 904 | } |
897 | 905 | return point->meth->point_set_to_infinity(group, point); | |
898 | BN_zero(point->Z); | ||
899 | point->Z_is_one = 0; | ||
900 | |||
901 | return 1; | ||
902 | } | 906 | } |
903 | LCRYPTO_ALIAS(EC_POINT_set_to_infinity); | 907 | LCRYPTO_ALIAS(EC_POINT_set_to_infinity); |
904 | 908 | ||
@@ -1200,8 +1204,7 @@ EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point) | |||
1200 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | 1204 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); |
1201 | return 0; | 1205 | return 0; |
1202 | } | 1206 | } |
1203 | 1207 | return point->meth->point_is_at_infinity(group, point); | |
1204 | return BN_is_zero(point->Z); | ||
1205 | } | 1208 | } |
1206 | LCRYPTO_ALIAS(EC_POINT_is_at_infinity); | 1209 | LCRYPTO_ALIAS(EC_POINT_is_at_infinity); |
1207 | 1210 | ||