3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

sae: fix one-off error in sae_is_quadradic_residue

This fixes the valgrind warning:

==14804== Conditional jump or move depends on uninitialised value(s)
==14804==    at 0x402E56: sae_is_quadradic_residue (sae.c:218)
==14804==    by 0x402E56: sae_compute_pwe (sae.c:272)
==14804==    by 0x402E56: sae_build_commit (sae.c:333)
==14804==    by 0x402E56: sae_send_commit (sae.c:591)
==14804==    by 0x401CC3: test_confirm_after_accept (test-sae.c:454)
==14804==    by 0x408A28: l_test_run (test.c:83)
==14804==    by 0x401427: main (test-sae.c:566)
This commit is contained in:
James Prestwood 2019-01-11 09:16:05 -08:00 committed by Denis Kenzior
parent 0b4509d8d2
commit c2189bc67e

View File

@ -215,7 +215,7 @@ static bool sae_is_quadradic_residue(const struct l_ecc_curve *curve,
return false;
}
if (rbuf[bytes / 8] & 1) {
if (rbuf[bytes / 8 - 1] & 1) {
l_ecc_scalar_multiply(num, num, qr);
if (l_ecc_scalar_legendre(num) == -1) {