aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/dragonfly.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@codeaurora.org>2019-04-25 16:45:27 (GMT)
committerJouni Malinen <j@w1.fi>2019-04-25 20:49:49 (GMT)
commit2b84ca4dd96459b661b0ebaf40ec43074fc9f42c (patch)
tree35a6a9dc161f8780f6523e1ff1b39d94caca89cd /src/common/dragonfly.c
parentff229da3095917fe1d152ca256c83366b0f3ee1d (diff)
downloadhostap-2b84ca4dd96459b661b0ebaf40ec43074fc9f42c.zip
hostap-2b84ca4dd96459b661b0ebaf40ec43074fc9f42c.tar.gz
hostap-2b84ca4dd96459b661b0ebaf40ec43074fc9f42c.tar.bz2
Share common SAE and EAP-pwd functionality: suitable groups
Start sharing common SAE and EAP-pwd functionality by adding a new source code file that can be included into both. This first step is bringing in a shared function to check whether a group is suitable. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
Diffstat (limited to 'src/common/dragonfly.c')
-rw-r--r--src/common/dragonfly.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/common/dragonfly.c b/src/common/dragonfly.c
new file mode 100644
index 0000000..1e80404
--- /dev/null
+++ b/src/common/dragonfly.c
@@ -0,0 +1,27 @@
+/*
+ * Shared Dragonfly functionality
+ * Copyright (c) 2012-2016, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2019, The Linux Foundation
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#include "utils/includes.h"
+
+#include "utils/common.h"
+#include "dragonfly.h"
+
+
+int dragonfly_suitable_group(int group, int ecc_only)
+{
+ /* Enforce REVmd rules on which SAE groups are suitable for production
+ * purposes: FFC groups whose prime is >= 3072 bits and ECC groups
+ * defined over a prime field whose prime is >= 256 bits. Furthermore,
+ * ECC groups defined over a characteristic 2 finite field and ECC
+ * groups with a co-factor greater than 1 are not suitable. */
+ return group == 19 || group == 20 || group == 21 ||
+ group == 28 || group == 29 || group == 30 ||
+ (!ecc_only &&
+ (group == 15 || group == 16 || group == 17 || group == 18));
+}