* Convert a WPA cipher selector OUI to an internal * cipher algorithm. Where appropriate we also * record any key length. */
| 1169 | * record any key length. |
| 1170 | */ |
| 1171 | static int |
| 1172 | wpa_cipher(const uint8_t *sel, uint8_t *keylen, uint8_t *cipher) |
| 1173 | { |
| 1174 | #define WPA_SEL(x) (((x)<<24)|WPA_OUI) |
| 1175 | uint32_t w = le32dec(sel); |
| 1176 | |
| 1177 | switch (w) { |
| 1178 | case WPA_SEL(WPA_CSE_NULL): |
| 1179 | *cipher = IEEE80211_CIPHER_NONE; |
| 1180 | break; |
| 1181 | case WPA_SEL(WPA_CSE_WEP40): |
| 1182 | if (keylen) |
| 1183 | *keylen = 40 / NBBY; |
| 1184 | *cipher = IEEE80211_CIPHER_WEP; |
| 1185 | break; |
| 1186 | case WPA_SEL(WPA_CSE_WEP104): |
| 1187 | if (keylen) |
| 1188 | *keylen = 104 / NBBY; |
| 1189 | *cipher = IEEE80211_CIPHER_WEP; |
| 1190 | break; |
| 1191 | case WPA_SEL(WPA_CSE_TKIP): |
| 1192 | *cipher = IEEE80211_CIPHER_TKIP; |
| 1193 | break; |
| 1194 | case WPA_SEL(WPA_CSE_CCMP): |
| 1195 | *cipher = IEEE80211_CIPHER_AES_CCM; |
| 1196 | break; |
| 1197 | default: |
| 1198 | return (EINVAL); |
| 1199 | } |
| 1200 | |
| 1201 | return (0); |
| 1202 | #undef WPA_SEL |
| 1203 | } |
| 1204 | |
| 1205 | /* |
| 1206 | * Convert a WPA key management/authentication algorithm |
no test coverage detected