Skip to contentSkip to conversation

sae: pass exact length to l_ecc_point_from_data

PATCH Applied James Prestwood 2 participants 2 messages Jan 21, 2022

lore
Share & tools
lore

James Prestwood

author
#0 lore raw

PATCH 1/1 sae: pass exact length to l_ecc_point_from_data

l_ecc_point_from_data now strictly enforces the buffer length.

---
 src/sae.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/sae.c +2 -1
index b0f80bb6..dc07db4b 100644
@@ -413,6 +413,7 @@ static struct l_ecc_point *sae_compute_pwe(const struct l_ecc_curve *curve,
 	struct l_ecc_scalar *qnr;
 	uint8_t qnr_bin[L_ECC_SCALAR_MAX_BYTES] = {0};
 	struct l_ecc_point *pwe;
+	unsigned int bytes = l_ecc_curve_get_scalar_bytes(curve);
 
 	/* create qr/qnr prior to beginning hunting-and-pecking loop */
 	qr = sae_new_residue(curve, true);
@@ -493,7 +494,7 @@ static struct l_ecc_point *sae_compute_pwe(const struct l_ecc_curve *curve,
 		return NULL;
 	}
 
-	pwe = l_ecc_point_from_data(curve, !is_odd + 2, x, sizeof(x));
+	pwe = l_ecc_point_from_data(curve, !is_odd + 2, x, bytes);
 	if (!pwe)
 		l_error("computing y failed, was x quadratic residue?");
 
Signature · 1 line
2.31.1
Applied
#1 lore raw

Hi James,

Quoted 5 lines · James Prestwood

l_ecc_point_from_data now strictly enforces the buffer length.

---
  src/sae.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

Applied, thanks.

Regards,
-Denis