mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-18 10:19:24 +01:00
ie: Add ie_rsn_cipher_suite_to_cipher
This commit is contained in:
parent
d22a1af576
commit
d4cdd74ae0
25
src/ie.c
25
src/ie.c
@ -27,6 +27,7 @@
|
||||
#include <errno.h>
|
||||
#include <ell/ell.h>
|
||||
#include "util.h"
|
||||
#include "crypto.h"
|
||||
|
||||
#include "ie.h"
|
||||
|
||||
@ -178,6 +179,30 @@ void ie_tlv_builder_finalize(struct ie_tlv_builder *builder,
|
||||
*out_len = len;
|
||||
}
|
||||
|
||||
/*
|
||||
* Converts RSN cipher suite into an unsigned integer suitable to be used
|
||||
* by nl80211. The enumeration is the same as found in crypto.h
|
||||
*
|
||||
* If the suite value is invalid, this function returns 0.
|
||||
*/
|
||||
uint32_t ie_rsn_cipher_suite_to_cipher(enum ie_rsn_cipher_suite suite)
|
||||
{
|
||||
switch (suite) {
|
||||
case IE_RSN_CIPHER_SUITE_CCMP:
|
||||
return CRYPTO_CIPHER_CCMP;
|
||||
case IE_RSN_CIPHER_SUITE_TKIP:
|
||||
return CRYPTO_CIPHER_TKIP;
|
||||
case IE_RSN_CIPHER_SUITE_WEP40:
|
||||
return CRYPTO_CIPHER_WEP40;
|
||||
case IE_RSN_CIPHER_SUITE_WEP104:
|
||||
return CRYPTO_CIPHER_WEP104;
|
||||
case IE_RSN_CIPHER_SUITE_BIP:
|
||||
return CRYPTO_CIPHER_BIP;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* 802.11, Section 8.4.2.27.2 */
|
||||
static bool ie_parse_cipher_suite(const uint8_t *data,
|
||||
enum ie_rsn_cipher_suite *out)
|
||||
|
1
src/ie.h
1
src/ie.h
@ -249,6 +249,7 @@ static inline const unsigned char *ie_tlv_iter_get_data(
|
||||
return iter->data;
|
||||
}
|
||||
|
||||
uint32_t ie_rsn_cipher_suite_to_cipher(enum ie_rsn_cipher_suite suite);
|
||||
bool ie_tlv_iter_next(struct ie_tlv_iter *iter);
|
||||
bool ie_tlv_builder_init(struct ie_tlv_builder *builder);
|
||||
bool ie_tlv_builder_set_length(struct ie_tlv_builder *builder,
|
||||
|
Loading…
Reference in New Issue
Block a user