iPXE
ath_key.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 Atheros Communications Inc.
3 * Copyright (c) 2010 Bruno Randolf <br1@einfach.org>
4 *
5 * Modified for iPXE by Scott K Logan <logans@cottsay.net> July 2011
6 * Original from Linux kernel 3.0.1
7 *
8 * Permission to use, copy, modify, and/or distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 */
20
21FILE_SECBOOT ( FORBIDDEN );
22
23#include "ath.h"
24#include "reg.h"
25
26#define REG_READ (common->ops->read)
27#define REG_WRITE(_ah, _reg, _val) (common->ops->write)(_ah, _val, _reg)
28#define ENABLE_REGWRITE_BUFFER(_ah) \
29 if (common->ops->enable_write_buffer) \
30 common->ops->enable_write_buffer((_ah));
31
32#define REGWRITE_BUFFER_FLUSH(_ah) \
33 if (common->ops->write_flush) \
34 common->ops->write_flush((_ah));
35
36
37#define IEEE80211_WEP_NKID 4 /* number of key ids */
38
39/************************/
40/* Key Cache Management */
41/************************/
42
44{
45 u32 keyType;
46 void *ah = common->ah;
47
48 if (entry >= common->keymax) {
49 DBG("ath: keycache entry %d out of range\n", entry);
50 return 0;
51 }
52
53 keyType = REG_READ(ah, AR_KEYTABLE_TYPE(entry));
54
56
57 REG_WRITE(ah, AR_KEYTABLE_KEY0(entry), 0);
58 REG_WRITE(ah, AR_KEYTABLE_KEY1(entry), 0);
59 REG_WRITE(ah, AR_KEYTABLE_KEY2(entry), 0);
60 REG_WRITE(ah, AR_KEYTABLE_KEY3(entry), 0);
61 REG_WRITE(ah, AR_KEYTABLE_KEY4(entry), 0);
63 REG_WRITE(ah, AR_KEYTABLE_MAC0(entry), 0);
64 REG_WRITE(ah, AR_KEYTABLE_MAC1(entry), 0);
65
66 if (keyType == AR_KEYTABLE_TYPE_TKIP) {
67 u16 micentry = entry + 64;
68
69 REG_WRITE(ah, AR_KEYTABLE_KEY0(micentry), 0);
70 REG_WRITE(ah, AR_KEYTABLE_KEY1(micentry), 0);
71 REG_WRITE(ah, AR_KEYTABLE_KEY2(micentry), 0);
72 REG_WRITE(ah, AR_KEYTABLE_KEY3(micentry), 0);
73 if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) {
74 REG_WRITE(ah, AR_KEYTABLE_KEY4(micentry), 0);
75 REG_WRITE(ah, AR_KEYTABLE_TYPE(micentry),
77 }
78
79 }
80
82
83 return 1;
84}
#define AR_KEYTABLE_TYPE(_n)
Definition reg.h:1887
#define AR_KEYTABLE_MAC1(_n)
Definition reg.h:1889
#define AR_KEYTABLE_KEY1(_n)
Definition reg.h:1883
#define AR_KEYTABLE_KEY2(_n)
Definition reg.h:1884
#define AR_KEYTABLE_KEY0(_n)
Definition reg.h:1882
#define AR_KEYTABLE_MAC0(_n)
Definition reg.h:1888
#define AR_KEYTABLE_KEY3(_n)
Definition reg.h:1885
#define AR_KEYTABLE_TYPE_TKIP
Definition reg.h:1876
#define AR_KEYTABLE_KEY4(_n)
Definition reg.h:1886
#define AR_KEYTABLE_TYPE_CLR
Definition reg.h:1879
@ ATH_CRYPT_CAP_MIC_COMBINED
Definition ath.h:151
#define REGWRITE_BUFFER_FLUSH(_ah)
Definition ath_key.c:32
#define REG_WRITE(_ah, _reg, _val)
Definition ath_key.c:27
#define REG_READ
Definition ath_key.c:26
#define ENABLE_REGWRITE_BUFFER(_ah)
Definition ath_key.c:28
int ath_hw_keyreset(struct ath_common *common, u16 entry)
Definition ath_key.c:43
#define DBG(...)
Print a debugging message.
Definition compiler.h:498
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
struct ib_cm_common common
Definition ib_mad.h:0
uint8_t ah
Definition registers.h:1
#define u16
Definition vga.h:20
#define u32
Definition vga.h:21