]> git.ipfire.org Git - thirdparty/hostap.git/commit
wolfssl: Fix crypto_bignum_rand() implementation
authorJouni Malinen <j@w1.fi>
Sat, 16 May 2020 18:02:17 +0000 (21:02 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 16 May 2020 18:02:17 +0000 (21:02 +0300)
commiteb595b3e3ab531645a5bde71cf6385335b7a4b95
tree42f8993224311a8070ff1ab938d49743f910b0c2
parent6a28c4dbc102de3fed9db44637f47a10e7adfb78
wolfssl: Fix crypto_bignum_rand() implementation

The previous implementation used mp_rand_prime() to generate a random
value in range 0..m. That is insanely slow way of generating a random
value since mp_rand_prime() is for generating a random _prime_ which is
not what is needed here. Replace that implementation with generationg of
a random value in the requested range without doing any kind of prime
number checks or loops to reject values that are not primes.

This speeds up SAE and EAP-pwd routines by couple of orders of
magnitude..

Signed-off-by: Jouni Malinen <j@w1.fi>
src/crypto/crypto_wolfssl.c