From 2b7432bddbb826ba13ca71696965e5caf0f19b89 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Thu, 15 Jan 2015 17:30:51 -0600 Subject: [PATCH] ie: Add utility to parse pairwise cipher suites This utility works by validating values that make sense for pairwise ciphers. --- src/ie.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/ie.c b/src/ie.c index 6309ca4f..2bf3608e 100644 --- a/src/ie.c +++ b/src/ie.c @@ -293,3 +293,28 @@ static bool ie_parse_group_cipher(const uint8_t *data, *out = tmp; return true; } + +static bool ie_parse_pairwise_cipher(const uint8_t *data, + enum ie_rsn_cipher_suite *out) +{ + enum ie_rsn_cipher_suite tmp; + + bool r = ie_parse_cipher_suite(data, &tmp); + + if (!r) + return r; + + switch (tmp) { + case IE_RSN_CIPHER_SUITE_CCMP: + case IE_RSN_CIPHER_SUITE_TKIP: + case IE_RSN_CIPHER_SUITE_WEP104: + case IE_RSN_CIPHER_SUITE_WEP40: + case IE_RSN_CIPHER_SUITE_USE_GROUP_CIPHER: + break; + default: + return false; + } + + *out = tmp; + return true; +}