e1e743f52d8f971fd88381655844ddbbea66adef
[openwrt/staging/chunkeey.git] /
1 From db54db11aec763b6fc74715c36e0f9de0d65e206 Mon Sep 17 00:00:00 2001
2 From: Jouni Malinen <jouni@codeaurora.org>
3 Date: Mon, 8 Apr 2019 18:01:07 +0300
4 Subject: SAE: Reject unsuitable groups based on REVmd changes
5
6 The rules defining which DH groups are suitable for SAE use were
7 accepted into IEEE 802.11 REVmd based on this document:
8 https://mentor.ieee.org/802.11/dcn/19/11-19-0387-02-000m-addressing-some-sae-comments.docx
9
10 Enforce those rules in production builds of wpa_supplicant and hostapd.
11 CONFIG_TESTING_OPTIONS=y builds can still be used to select any o the
12 implemented groups to maintain testing coverage.
13
14 Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
15 ---
16 src/common/sae.c | 23 +++++++++++++++++++++++
17 1 file changed, 23 insertions(+)
18
19 --- a/src/common/sae.c
20 +++ b/src/common/sae.c
21 @@ -18,10 +18,33 @@
22 #include "sae.h"
23
24
25 +static int sae_suitable_group(int group)
26 +{
27 +#ifdef CONFIG_TESTING_OPTIONS
28 + /* Allow all groups for testing purposes in non-production builds. */
29 + return 1;
30 +#else /* CONFIG_TESTING_OPTIONS */
31 + /* Enforce REVmd rules on which SAE groups are suitable for production
32 + * purposes: FFC groups whose prime is >= 3072 bits and ECC groups
33 + * defined over a prime field whose prime is >= 256 bits. Furthermore,
34 + * ECC groups defined over a characteristic 2 finite field and ECC
35 + * groups with a co-factor greater than 1 are not suitable. */
36 + return group == 19 || group == 20 || group == 21 ||
37 + group == 28 || group == 29 || group == 30 ||
38 + group == 15 || group == 16 || group == 17 || group == 18;
39 +#endif /* CONFIG_TESTING_OPTIONS */
40 +}
41 +
42 +
43 int sae_set_group(struct sae_data *sae, int group)
44 {
45 struct sae_temporary_data *tmp;
46
47 + if (!sae_suitable_group(group)) {
48 + wpa_printf(MSG_DEBUG, "SAE: Reject unsuitable group %d", group);
49 + return -1;
50 + }
51 +
52 sae_clear_data(sae);
53 tmp = sae->tmp = os_zalloc(sizeof(*tmp));
54 if (tmp == NULL)