3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00

ie: Skip unknown pairwise ciphers

This commit is contained in:
Denis Kenzior 2022-10-06 09:30:17 -05:00
parent ec3085e932
commit 59ace1b691

View File

@ -589,15 +589,14 @@ static bool ie_parse_group_cipher(const uint8_t *data,
return true; return true;
} }
static bool ie_parse_pairwise_cipher(const uint8_t *data, static int ie_parse_pairwise_cipher(const uint8_t *data,
enum ie_rsn_cipher_suite *out) enum ie_rsn_cipher_suite *out)
{ {
enum ie_rsn_cipher_suite tmp; enum ie_rsn_cipher_suite tmp;
bool r = ie_parse_cipher_suite(data, &tmp); bool r = ie_parse_cipher_suite(data, &tmp);
if (!r) if (!r)
return r; return -ENOENT;
switch (tmp) { switch (tmp) {
case IE_RSN_CIPHER_SUITE_CCMP: case IE_RSN_CIPHER_SUITE_CCMP:
@ -607,11 +606,11 @@ static bool ie_parse_pairwise_cipher(const uint8_t *data,
case IE_RSN_CIPHER_SUITE_USE_GROUP_CIPHER: case IE_RSN_CIPHER_SUITE_USE_GROUP_CIPHER:
break; break;
default: default:
return false; return -ERANGE;
} }
*out = tmp; *out = tmp;
return true; return 0;
} }
static bool ie_parse_group_management_cipher(const uint8_t *data, static bool ie_parse_group_management_cipher(const uint8_t *data,
@ -682,9 +681,12 @@ static int parse_ciphers(const uint8_t *data, size_t len,
/* Parse Pairwise Cipher Suite List field */ /* Parse Pairwise Cipher Suite List field */
for (i = 0, out_info->pairwise_ciphers = 0; i < count; i++) { for (i = 0, out_info->pairwise_ciphers = 0; i < count; i++) {
enum ie_rsn_cipher_suite suite; enum ie_rsn_cipher_suite suite;
int r = ie_parse_pairwise_cipher(data + i * 4, &suite);
if (!ie_parse_pairwise_cipher(data + i * 4, &suite)) if (r == -ENOENT) /* Skip unknown */
return -ERANGE; continue;
else if (r < 0)
return r;
out_info->pairwise_ciphers |= suite; out_info->pairwise_ciphers |= suite;
} }