|
@@ -1197,66 +1197,57 @@ u32 wpa_cipher_to_suite(int proto, int cipher)
|
|
|
}
|
|
|
|
|
|
|
|
|
-int rsn_cipher_put_suites(u8 *pos, int ciphers)
|
|
|
+int rsn_cipher_put_suites(u8 *start, int ciphers)
|
|
|
{
|
|
|
- int num_suites = 0;
|
|
|
+ u8 *pos = start;
|
|
|
|
|
|
if (ciphers & WPA_CIPHER_CCMP_256) {
|
|
|
RSN_SELECTOR_PUT(pos, RSN_CIPHER_SUITE_CCMP_256);
|
|
|
pos += RSN_SELECTOR_LEN;
|
|
|
- num_suites++;
|
|
|
}
|
|
|
if (ciphers & WPA_CIPHER_GCMP_256) {
|
|
|
RSN_SELECTOR_PUT(pos, RSN_CIPHER_SUITE_GCMP_256);
|
|
|
pos += RSN_SELECTOR_LEN;
|
|
|
- num_suites++;
|
|
|
}
|
|
|
if (ciphers & WPA_CIPHER_CCMP) {
|
|
|
RSN_SELECTOR_PUT(pos, RSN_CIPHER_SUITE_CCMP);
|
|
|
pos += RSN_SELECTOR_LEN;
|
|
|
- num_suites++;
|
|
|
}
|
|
|
if (ciphers & WPA_CIPHER_GCMP) {
|
|
|
RSN_SELECTOR_PUT(pos, RSN_CIPHER_SUITE_GCMP);
|
|
|
pos += RSN_SELECTOR_LEN;
|
|
|
- num_suites++;
|
|
|
}
|
|
|
if (ciphers & WPA_CIPHER_TKIP) {
|
|
|
RSN_SELECTOR_PUT(pos, RSN_CIPHER_SUITE_TKIP);
|
|
|
pos += RSN_SELECTOR_LEN;
|
|
|
- num_suites++;
|
|
|
}
|
|
|
if (ciphers & WPA_CIPHER_NONE) {
|
|
|
RSN_SELECTOR_PUT(pos, RSN_CIPHER_SUITE_NONE);
|
|
|
pos += RSN_SELECTOR_LEN;
|
|
|
- num_suites++;
|
|
|
}
|
|
|
|
|
|
- return num_suites;
|
|
|
+ return (pos - start) / RSN_SELECTOR_LEN;
|
|
|
}
|
|
|
|
|
|
|
|
|
-int wpa_cipher_put_suites(u8 *pos, int ciphers)
|
|
|
+int wpa_cipher_put_suites(u8 *start, int ciphers)
|
|
|
{
|
|
|
- int num_suites = 0;
|
|
|
+ u8 *pos = start;
|
|
|
|
|
|
if (ciphers & WPA_CIPHER_CCMP) {
|
|
|
RSN_SELECTOR_PUT(pos, WPA_CIPHER_SUITE_CCMP);
|
|
|
pos += WPA_SELECTOR_LEN;
|
|
|
- num_suites++;
|
|
|
}
|
|
|
if (ciphers & WPA_CIPHER_TKIP) {
|
|
|
RSN_SELECTOR_PUT(pos, WPA_CIPHER_SUITE_TKIP);
|
|
|
pos += WPA_SELECTOR_LEN;
|
|
|
- num_suites++;
|
|
|
}
|
|
|
if (ciphers & WPA_CIPHER_NONE) {
|
|
|
RSN_SELECTOR_PUT(pos, WPA_CIPHER_SUITE_NONE);
|
|
|
pos += WPA_SELECTOR_LEN;
|
|
|
- num_suites++;
|
|
|
}
|
|
|
|
|
|
- return num_suites;
|
|
|
+ return (pos - start) / RSN_SELECTOR_LEN;
|
|
|
}
|
|
|
|
|
|
|