d637a52826a9c70ebb519bcef9a44874a9b48c1a
[oweals/openwrt.git] /
1 From e43f08991f00820c1f711ca254021d5f83b5cd7d Mon Sep 17 00:00:00 2001
2 From: Jouni Malinen <jouni@codeaurora.org>
3 Date: Thu, 25 Apr 2019 18:52:34 +0300
4 Subject: [PATCH 1/6] SAE: Use const_time_memcmp() for pwd_value >= prime
5  comparison
6
7 This reduces timing and memory access pattern differences for an
8 operation that could depend on the used password.
9
10 Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
11 (cherry picked from commit 8e14b030e558d23f65d761895c07089404e61cf1)
12 ---
13  src/common/sae.c | 2 +-
14  1 file changed, 1 insertion(+), 1 deletion(-)
15
16 --- a/src/common/sae.c
17 +++ b/src/common/sae.c
18 @@ -317,7 +317,7 @@ static int sae_test_pwd_seed_ecc(struct
19         wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-value",
20                         pwd_value, sae->tmp->prime_len);
21  
22 -       if (os_memcmp(pwd_value, prime, sae->tmp->prime_len) >= 0)
23 +       if (const_time_memcmp(pwd_value, prime, sae->tmp->prime_len) >= 0)
24                 return 0;
25  
26         x_cand = crypto_bignum_init_set(pwd_value, sae->tmp->prime_len);