3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-19 10:02:33 +01:00

ie: Add ie_rsn_cipher_suite_to_cipher

This commit is contained in:
Denis Kenzior 2015-05-21 20:58:42 -05:00
parent d22a1af576
commit d4cdd74ae0
2 changed files with 26 additions and 0 deletions

View File

@ -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)

View File

@ -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,