diff options
Diffstat (limited to 'src/lib/libcrypto/ec/ec_convert.c')
-rw-r--r-- | src/lib/libcrypto/ec/ec_convert.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/libcrypto/ec/ec_convert.c b/src/lib/libcrypto/ec/ec_convert.c index a4237cda95..f2410c163c 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.11 2024/11/08 02:24:37 tb Exp $ */ | 1 | /* $OpenBSD: ec_convert.c,v 1.12 2024/12/12 10:00:15 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 | */ |
@@ -157,11 +157,11 @@ ec_encoded_length(const EC_GROUP *group, uint8_t form, size_t *out_len) | |||
157 | *out_len = 1; | 157 | *out_len = 1; |
158 | return 1; | 158 | return 1; |
159 | case EC_POINT_COMPRESSED: | 159 | case EC_POINT_COMPRESSED: |
160 | *out_len = 1 + BN_num_bytes(&group->field); | 160 | *out_len = 1 + BN_num_bytes(&group->p); |
161 | return 1; | 161 | return 1; |
162 | case EC_POINT_UNCOMPRESSED: | 162 | case EC_POINT_UNCOMPRESSED: |
163 | case EC_POINT_HYBRID: | 163 | case EC_POINT_HYBRID: |
164 | *out_len = 1 + 2 * BN_num_bytes(&group->field); | 164 | *out_len = 1 + 2 * BN_num_bytes(&group->p); |
165 | return 1; | 165 | return 1; |
166 | default: | 166 | default: |
167 | return 0; | 167 | return 0; |
@@ -171,15 +171,15 @@ ec_encoded_length(const EC_GROUP *group, uint8_t form, size_t *out_len) | |||
171 | static int | 171 | static int |
172 | ec_field_element_is_valid(const EC_GROUP *group, const BIGNUM *bn) | 172 | ec_field_element_is_valid(const EC_GROUP *group, const BIGNUM *bn) |
173 | { | 173 | { |
174 | /* Ensure bn is in the range [0, field). */ | 174 | /* Ensure bn is in the range [0, p). */ |
175 | return !BN_is_negative(bn) && BN_cmp(&group->field, bn) > 0; | 175 | return !BN_is_negative(bn) && BN_cmp(&group->p, bn) > 0; |
176 | } | 176 | } |
177 | 177 | ||
178 | static int | 178 | static int |
179 | ec_add_field_element_cbb(CBB *cbb, const EC_GROUP *group, const BIGNUM *bn) | 179 | ec_add_field_element_cbb(CBB *cbb, const EC_GROUP *group, const BIGNUM *bn) |
180 | { | 180 | { |
181 | uint8_t *buf = NULL; | 181 | uint8_t *buf = NULL; |
182 | int buf_len = BN_num_bytes(&group->field); | 182 | int buf_len = BN_num_bytes(&group->p); |
183 | 183 | ||
184 | if (!ec_field_element_is_valid(group, bn)) { | 184 | if (!ec_field_element_is_valid(group, bn)) { |
185 | ECerror(EC_R_BIGNUM_OUT_OF_RANGE); | 185 | ECerror(EC_R_BIGNUM_OUT_OF_RANGE); |
@@ -202,7 +202,7 @@ ec_get_field_element_cbs(CBS *cbs, const EC_GROUP *group, BIGNUM *bn) | |||
202 | { | 202 | { |
203 | CBS field_element; | 203 | CBS field_element; |
204 | 204 | ||
205 | if (!CBS_get_bytes(cbs, &field_element, BN_num_bytes(&group->field))) { | 205 | if (!CBS_get_bytes(cbs, &field_element, BN_num_bytes(&group->p))) { |
206 | ECerror(EC_R_INVALID_ENCODING); | 206 | ECerror(EC_R_INVALID_ENCODING); |
207 | return 0; | 207 | return 0; |
208 | } | 208 | } |