aboutsummaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-01-13 15:41:40 (GMT)
committerJouni Malinen <j@w1.fi>2013-01-13 15:41:40 (GMT)
commitcf830c1c54cb505045e9227bc6906effcde07e58 (patch)
treeb2e12e4557e17926649377e74d238efc921afbbc /src/common
parent0282a8c46a0f3792b622211a3ca710e32a86ac0d (diff)
downloadhostap-cf830c1c54cb505045e9227bc6906effcde07e58.zip
hostap-cf830c1c54cb505045e9227bc6906effcde07e58.tar.gz
hostap-cf830c1c54cb505045e9227bc6906effcde07e58.tar.bz2
Use a helper function for selection group cipher for AP mode
Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/common')
-rw-r--r--src/common/wpa_common.c18
-rw-r--r--src/common/wpa_common.h1
2 files changed, 19 insertions, 0 deletions
diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c
index fdf418f..c786b0a 100644
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
@@ -1343,3 +1343,21 @@ int wpa_write_ciphers(char *start, char *end, int ciphers, const char *delim)
return pos - start;
}
+
+
+int wpa_select_ap_group_cipher(int wpa, int wpa_pairwise, int rsn_pairwise)
+{
+ int pairwise = 0;
+
+ /* Select group cipher based on the enabled pairwise cipher suites */
+ if (wpa & 1)
+ pairwise |= wpa_pairwise;
+ if (wpa & 2)
+ pairwise |= rsn_pairwise;
+
+ if (pairwise & WPA_CIPHER_TKIP)
+ return WPA_CIPHER_TKIP;
+ if ((pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP)) == WPA_CIPHER_GCMP)
+ return WPA_CIPHER_GCMP;
+ return WPA_CIPHER_CCMP;
+}
diff --git a/src/common/wpa_common.h b/src/common/wpa_common.h
index a23038a..a326950 100644
--- a/src/common/wpa_common.h
+++ b/src/common/wpa_common.h
@@ -400,5 +400,6 @@ int wpa_pick_pairwise_cipher(int ciphers, int none_allowed);
int wpa_pick_group_cipher(int ciphers);
int wpa_parse_cipher(const char *value);
int wpa_write_ciphers(char *start, char *end, int ciphers, const char *delim);
+int wpa_select_ap_group_cipher(int wpa, int wpa_pairwise, int rsn_pairwise);
#endif /* WPA_COMMON_H */