]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP2: Parse AKM suite selector version of akm node
authorJouni Malinen <jouni@codeaurora.org>
Fri, 27 Sep 2019 00:09:09 +0000 (03:09 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 1 Oct 2019 11:21:51 +0000 (14:21 +0300)
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/common/dpp.c

index 4aa279aada811418f32c3d96179f5b95bc9a66f7..a1f94e5f11a334c94c92f510708255d5f74cf4b6 100644 (file)
@@ -6063,6 +6063,9 @@ const char * dpp_akm_selector_str(enum dpp_akm akm)
 
 static enum dpp_akm dpp_akm_from_str(const char *akm)
 {
+       const char *pos;
+       int dpp = 0, psk = 0, sae = 0;
+
        if (os_strcmp(akm, "psk") == 0)
                return DPP_AKM_PSK;
        if (os_strcmp(akm, "sae") == 0)
@@ -6075,6 +6078,38 @@ static enum dpp_akm dpp_akm_from_str(const char *akm)
                return DPP_AKM_SAE_DPP;
        if (os_strcmp(akm, "dpp+psk+sae") == 0)
                return DPP_AKM_PSK_SAE_DPP;
+
+       pos = akm;
+       while (*pos) {
+               if (os_strlen(pos) < 8)
+                       break;
+               if (os_strncasecmp(pos, "506F9A02", 8) == 0)
+                       dpp = 1;
+               else if (os_strncasecmp(pos, "000FAC02", 8) == 0)
+                       psk = 1;
+               else if (os_strncasecmp(pos, "000FAC06", 8) == 0)
+                       psk = 1;
+               else if (os_strncasecmp(pos, "000FAC08", 8) == 0)
+                       sae = 1;
+               pos += 8;
+               if (*pos != '+')
+                       break;
+               pos++;
+       }
+
+       if (dpp && psk && sae)
+               return DPP_AKM_PSK_SAE_DPP;
+       if (dpp && sae)
+               return DPP_AKM_SAE_DPP;
+       if (dpp)
+               return DPP_AKM_DPP;
+       if (psk && sae)
+               return DPP_AKM_PSK_SAE;
+       if (sae)
+               return DPP_AKM_SAE;
+       if (psk)
+               return DPP_AKM_PSK;
+
        return DPP_AKM_UNKNOWN;
 }