3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 18:59:22 +01:00

sae: pass exact length to l_ecc_point_from_data

l_ecc_point_from_data now strictly enforces the buffer length.
This commit is contained in:
James Prestwood 2022-01-21 10:32:37 -08:00 committed by Denis Kenzior
parent d8116e8828
commit 26b7446178

View File

@ -413,6 +413,7 @@ static struct l_ecc_point *sae_compute_pwe(const struct l_ecc_curve *curve,
struct l_ecc_scalar *qnr; struct l_ecc_scalar *qnr;
uint8_t qnr_bin[L_ECC_SCALAR_MAX_BYTES] = {0}; uint8_t qnr_bin[L_ECC_SCALAR_MAX_BYTES] = {0};
struct l_ecc_point *pwe; 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 */ /* create qr/qnr prior to beginning hunting-and-pecking loop */
qr = sae_new_residue(curve, true); 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; 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) if (!pwe)
l_error("computing y failed, was x quadratic residue?"); l_error("computing y failed, was x quadratic residue?");