summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ec_convert.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ec/ec_convert.c')
-rw-r--r--src/lib/libcrypto/ec/ec_convert.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/libcrypto/ec/ec_convert.c b/src/lib/libcrypto/ec/ec_convert.c
index b48fc85315..a18bc49132 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.13 2024/12/16 06:11:26 tb Exp $ */ 1/* $OpenBSD: ec_convert.c,v 1.14 2025/01/05 16:07:08 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->p); 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->p); 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;
@@ -172,14 +172,14 @@ static int
172ec_field_element_is_valid(const EC_GROUP *group, const BIGNUM *bn) 172ec_field_element_is_valid(const EC_GROUP *group, const BIGNUM *bn)
173{ 173{
174 /* Ensure bn is in the range [0, p). */ 174 /* Ensure bn is in the range [0, p). */
175 return !BN_is_negative(bn) && BN_cmp(&group->p, bn) > 0; 175 return !BN_is_negative(bn) && BN_cmp(group->p, bn) > 0;
176} 176}
177 177
178static int 178static int
179ec_add_field_element_cbb(CBB *cbb, const EC_GROUP *group, const BIGNUM *bn) 179ec_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->p); 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->p))) { 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 }