2d40516c7c454e127a78283eb9c702da70af6dbd
[openwrt/openwrt.git] /
1 From 92e1b96c26a84e503847bdd22ebadf697c4031ad Mon Sep 17 00:00:00 2001
2 From: Jouni Malinen <j@w1.fi>
3 Date: Sat, 13 Apr 2019 17:20:57 +0300
4 Subject: EAP-pwd: Disallow ECC groups with a prime under 256 bits
5
6 Based on the SAE implementation guidance update to not allow ECC groups
7 with a prime that is under 256 bits, reject groups 25, 26, and 27 in
8 EAP-pwd.
9
10 Signed-off-by: Jouni Malinen <j@w1.fi>
11 ---
12 src/eap_common/eap_pwd_common.c | 13 +++++++++++++
13 1 file changed, 13 insertions(+)
14
15 --- a/src/eap_common/eap_pwd_common.c
16 +++ b/src/eap_common/eap_pwd_common.c
17 @@ -85,10 +85,23 @@ static int eap_pwd_kdf(const u8 *key, si
18 }
19
20
21 +static int eap_pwd_suitable_group(u16 num)
22 +{
23 + /* Do not allow ECC groups with prime under 256 bits based on guidance
24 + * for the similar design in SAE. */
25 + return num == 19 || num == 20 || num == 21 ||
26 + num == 28 || num == 29 || num == 30;
27 +}
28 +
29 +
30 EAP_PWD_group * get_eap_pwd_group(u16 num)
31 {
32 EAP_PWD_group *grp;
33
34 + if (!eap_pwd_suitable_group(num)) {
35 + wpa_printf(MSG_INFO, "EAP-pwd: unsuitable group %u", num);
36 + return NULL;
37 + }
38 grp = os_zalloc(sizeof(EAP_PWD_group));
39 if (!grp)
40 return NULL;