From 0073d22328d043ee79dbaa9705605bcc23456d4a Mon Sep 17 00:00:00 2001 From: tb <> Date: Thu, 12 Dec 2024 10:00:15 +0000 Subject: Rename group->field to group->p Now that we only do curves over GF(p) fields, there's no need to use a weird, confusing name for what we usually call p. Adjust some comments in the vicinity as well. --- src/lib/libcrypto/ec/ec_convert.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/lib/libcrypto/ec/ec_convert.c') 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 @@ -/* $OpenBSD: ec_convert.c,v 1.11 2024/11/08 02:24:37 tb Exp $ */ +/* $OpenBSD: ec_convert.c,v 1.12 2024/12/12 10:00:15 tb Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -157,11 +157,11 @@ ec_encoded_length(const EC_GROUP *group, uint8_t form, size_t *out_len) *out_len = 1; return 1; case EC_POINT_COMPRESSED: - *out_len = 1 + BN_num_bytes(&group->field); + *out_len = 1 + BN_num_bytes(&group->p); return 1; case EC_POINT_UNCOMPRESSED: case EC_POINT_HYBRID: - *out_len = 1 + 2 * BN_num_bytes(&group->field); + *out_len = 1 + 2 * BN_num_bytes(&group->p); return 1; default: return 0; @@ -171,15 +171,15 @@ ec_encoded_length(const EC_GROUP *group, uint8_t form, size_t *out_len) static int ec_field_element_is_valid(const EC_GROUP *group, const BIGNUM *bn) { - /* Ensure bn is in the range [0, field). */ - return !BN_is_negative(bn) && BN_cmp(&group->field, bn) > 0; + /* Ensure bn is in the range [0, p). */ + return !BN_is_negative(bn) && BN_cmp(&group->p, bn) > 0; } static int ec_add_field_element_cbb(CBB *cbb, const EC_GROUP *group, const BIGNUM *bn) { uint8_t *buf = NULL; - int buf_len = BN_num_bytes(&group->field); + int buf_len = BN_num_bytes(&group->p); if (!ec_field_element_is_valid(group, bn)) { ECerror(EC_R_BIGNUM_OUT_OF_RANGE); @@ -202,7 +202,7 @@ ec_get_field_element_cbs(CBS *cbs, const EC_GROUP *group, BIGNUM *bn) { CBS field_element; - if (!CBS_get_bytes(cbs, &field_element, BN_num_bytes(&group->field))) { + if (!CBS_get_bytes(cbs, &field_element, BN_num_bytes(&group->p))) { ECerror(EC_R_INVALID_ENCODING); return 0; } -- cgit v1.2.3-55-g6feb