]> git.ipfire.org Git - thirdparty/hostap.git/commit
dragonfly: Fix legendre symbol calculation failure handling
authorChaitanya Tata <chaitanya.mgit@gmail.com>
Mon, 6 Nov 2023 17:19:15 +0000 (22:49 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 6 Nov 2023 18:07:05 +0000 (20:07 +0200)
commit3e1fb2dec781c816e07b1a91ab096e69a12647e4
tree0b9d4000862ee2f121a0f54eab0baf9302c935fa
parent76ae985b0ac04c2e87a24803688eb6a3d56782c5
dragonfly: Fix legendre symbol calculation failure handling

In case of low-memory conditions, the computation for legendre symbol
can fail and return -2 as per documentation, but the check for that
was missed here. And this can can cause an infinite loop searching for
qr and qnr if the error repeats for each attempt.

Break the loop if calculation fails, we can leave retry to the callers
or user. This is similar to the way allocation and generation of a new
random number was handled in this loop.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
src/common/dragonfly.c