iwinfo: add support for GCMP cipher
Extend support for WPA ciphers by GCMP which is required for 802.11ad. Breaks ABI as ciphers now needs to be a field of 16 bits instead of 8. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
74d13fb987
commit
8bfd8d8800
6 changed files with 20 additions and 9 deletions
|
@ -38,7 +38,8 @@
|
||||||
#define IWINFO_CIPHER_WEP104 (1 << 5)
|
#define IWINFO_CIPHER_WEP104 (1 << 5)
|
||||||
#define IWINFO_CIPHER_AESOCB (1 << 6)
|
#define IWINFO_CIPHER_AESOCB (1 << 6)
|
||||||
#define IWINFO_CIPHER_CKIP (1 << 7)
|
#define IWINFO_CIPHER_CKIP (1 << 7)
|
||||||
#define IWINFO_CIPHER_COUNT 8
|
#define IWINFO_CIPHER_GCMP (1 << 8)
|
||||||
|
#define IWINFO_CIPHER_COUNT 9
|
||||||
|
|
||||||
#define IWINFO_KMGMT_NONE (1 << 0)
|
#define IWINFO_KMGMT_NONE (1 << 0)
|
||||||
#define IWINFO_KMGMT_8021x (1 << 1)
|
#define IWINFO_KMGMT_8021x (1 << 1)
|
||||||
|
@ -164,8 +165,8 @@ struct iwinfo_freqlist_entry {
|
||||||
struct iwinfo_crypto_entry {
|
struct iwinfo_crypto_entry {
|
||||||
uint8_t enabled;
|
uint8_t enabled;
|
||||||
uint8_t wpa_version;
|
uint8_t wpa_version;
|
||||||
uint8_t group_ciphers;
|
uint16_t group_ciphers;
|
||||||
uint8_t pair_ciphers;
|
uint16_t pair_ciphers;
|
||||||
uint8_t auth_suites;
|
uint8_t auth_suites;
|
||||||
uint8_t auth_algs;
|
uint8_t auth_algs;
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct iwinfo_hardware_entry * iwinfo_hardware(struct iwinfo_hardware_id *id);
|
||||||
int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id);
|
int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id);
|
||||||
|
|
||||||
void iwinfo_parse_rsn(struct iwinfo_crypto_entry *c, uint8_t *data, uint8_t len,
|
void iwinfo_parse_rsn(struct iwinfo_crypto_entry *c, uint8_t *data, uint8_t len,
|
||||||
uint8_t defcipher, uint8_t defauth);
|
uint16_t defcipher, uint8_t defauth);
|
||||||
|
|
||||||
struct uci_section *iwinfo_uci_get_radio(const char *name, const char *type);
|
struct uci_section *iwinfo_uci_get_radio(const char *name, const char *type);
|
||||||
void iwinfo_uci_free(void);
|
void iwinfo_uci_free(void);
|
||||||
|
|
|
@ -158,6 +158,9 @@ static char * format_enc_ciphers(int ciphers)
|
||||||
if (ciphers & IWINFO_CIPHER_CCMP)
|
if (ciphers & IWINFO_CIPHER_CCMP)
|
||||||
pos += sprintf(pos, "CCMP, ");
|
pos += sprintf(pos, "CCMP, ");
|
||||||
|
|
||||||
|
if (ciphers & IWINFO_CIPHER_GCMP)
|
||||||
|
pos += sprintf(pos, "GCMP, ");
|
||||||
|
|
||||||
if (ciphers & IWINFO_CIPHER_WRAP)
|
if (ciphers & IWINFO_CIPHER_WRAP)
|
||||||
pos += sprintf(pos, "WRAP, ");
|
pos += sprintf(pos, "WRAP, ");
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,9 @@ static char * iwinfo_crypto_print_ciphers(int ciphers)
|
||||||
if (ciphers & IWINFO_CIPHER_CCMP)
|
if (ciphers & IWINFO_CIPHER_CCMP)
|
||||||
pos += sprintf(pos, "CCMP, ");
|
pos += sprintf(pos, "CCMP, ");
|
||||||
|
|
||||||
|
if (ciphers & IWINFO_CIPHER_GCMP)
|
||||||
|
pos += sprintf(pos, "GCMP, ");
|
||||||
|
|
||||||
if (ciphers & IWINFO_CIPHER_WRAP)
|
if (ciphers & IWINFO_CIPHER_WRAP)
|
||||||
pos += sprintf(pos, "WRAP, ");
|
pos += sprintf(pos, "WRAP, ");
|
||||||
|
|
||||||
|
|
|
@ -1654,10 +1654,11 @@ static struct {
|
||||||
{ "WEP-40", IWINFO_CIPHER_WEP40 },
|
{ "WEP-40", IWINFO_CIPHER_WEP40 },
|
||||||
{ "NONE", IWINFO_CIPHER_NONE },
|
{ "NONE", IWINFO_CIPHER_NONE },
|
||||||
{ "TKIP", IWINFO_CIPHER_TKIP },
|
{ "TKIP", IWINFO_CIPHER_TKIP },
|
||||||
{ "CCMP", IWINFO_CIPHER_CCMP }
|
{ "CCMP", IWINFO_CIPHER_CCMP },
|
||||||
|
{ "GCMP", IWINFO_CIPHER_GCMP }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void parse_wpa_ciphers(const char *str, uint8_t *ciphers)
|
static void parse_wpa_ciphers(const char *str, uint16_t *ciphers)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
size_t l;
|
size_t l;
|
||||||
|
|
|
@ -285,7 +285,7 @@ int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id)
|
||||||
return (id->vendor_id && id->device_id) ? 0 : -1;
|
return (id->vendor_id && id->device_id) ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void iwinfo_parse_rsn_cipher(uint8_t idx, uint8_t *ciphers)
|
static void iwinfo_parse_rsn_cipher(uint8_t idx, uint16_t *ciphers)
|
||||||
{
|
{
|
||||||
switch (idx)
|
switch (idx)
|
||||||
{
|
{
|
||||||
|
@ -312,9 +312,12 @@ static void iwinfo_parse_rsn_cipher(uint8_t idx, uint8_t *ciphers)
|
||||||
*ciphers |= IWINFO_CIPHER_WEP104;
|
*ciphers |= IWINFO_CIPHER_WEP104;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
*ciphers |= IWINFO_CIPHER_GCMP;
|
||||||
|
break;
|
||||||
|
|
||||||
case 6: /* AES-128-CMAC */
|
case 6: /* AES-128-CMAC */
|
||||||
case 7: /* No group addressed */
|
case 7: /* No group addressed */
|
||||||
case 8: /* GCMP */
|
|
||||||
case 9: /* GCMP-256 */
|
case 9: /* GCMP-256 */
|
||||||
case 10: /* CCMP-256 */
|
case 10: /* CCMP-256 */
|
||||||
case 11: /* BIP-GMAC-128 */
|
case 11: /* BIP-GMAC-128 */
|
||||||
|
@ -325,7 +328,7 @@ static void iwinfo_parse_rsn_cipher(uint8_t idx, uint8_t *ciphers)
|
||||||
}
|
}
|
||||||
|
|
||||||
void iwinfo_parse_rsn(struct iwinfo_crypto_entry *c, uint8_t *data, uint8_t len,
|
void iwinfo_parse_rsn(struct iwinfo_crypto_entry *c, uint8_t *data, uint8_t len,
|
||||||
uint8_t defcipher, uint8_t defauth)
|
uint16_t defcipher, uint8_t defauth)
|
||||||
{
|
{
|
||||||
uint16_t i, count;
|
uint16_t i, count;
|
||||||
uint8_t wpa_version = 0;
|
uint8_t wpa_version = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue