staging: ks7010: use lower case names in michael_mic_t struct fields
Replace upper case fields and camel cases for fields included in michael_mic_t structure Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
291b93ca2c
commit
16b102e781
|
@ -349,9 +349,9 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv,
|
||||||
(uint8_t *)priv->rxp,
|
(uint8_t *)priv->rxp,
|
||||||
(int)priv->rx_size,
|
(int)priv->rx_size,
|
||||||
(uint8_t)0, /* priority */
|
(uint8_t)0, /* priority */
|
||||||
(uint8_t *)michael_mic.Result);
|
(uint8_t *)michael_mic.result);
|
||||||
}
|
}
|
||||||
if (memcmp(michael_mic.Result, recv_mic, 8) != 0) {
|
if (memcmp(michael_mic.result, recv_mic, 8) != 0) {
|
||||||
now = jiffies;
|
now = jiffies;
|
||||||
mic_failure = &priv->wpa.mic_failure;
|
mic_failure = &priv->wpa.mic_failure;
|
||||||
/* MIC FAILURE */
|
/* MIC FAILURE */
|
||||||
|
@ -1180,8 +1180,8 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb)
|
||||||
(uint8_t *)&pp->data[0],
|
(uint8_t *)&pp->data[0],
|
||||||
(int)skb_len,
|
(int)skb_len,
|
||||||
(uint8_t)0, /* priority */
|
(uint8_t)0, /* priority */
|
||||||
(uint8_t *)michael_mic.Result);
|
(uint8_t *)michael_mic.result);
|
||||||
memcpy(p, michael_mic.Result, 8);
|
memcpy(p, michael_mic.result, 8);
|
||||||
length += 8;
|
length += 8;
|
||||||
skb_len += 8;
|
skb_len += 8;
|
||||||
p += 8;
|
p += 8;
|
||||||
|
|
|
@ -30,17 +30,17 @@ do { \
|
||||||
// Reset the state to the empty message.
|
// Reset the state to the empty message.
|
||||||
#define MichaelClear(A) \
|
#define MichaelClear(A) \
|
||||||
do { \
|
do { \
|
||||||
A->L = A->K0; \
|
A->l = A->k0; \
|
||||||
A->R = A->K1; \
|
A->r = A->k1; \
|
||||||
A->nBytesInM = 0; \
|
A->m_bytes = 0; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static
|
static
|
||||||
void MichaelInitializeFunction(struct michael_mic_t *Mic, uint8_t *key)
|
void MichaelInitializeFunction(struct michael_mic_t *Mic, uint8_t *key)
|
||||||
{
|
{
|
||||||
// Set the key
|
// Set the key
|
||||||
Mic->K0 = getUInt32(key, 0);
|
Mic->k0 = getUInt32(key, 0);
|
||||||
Mic->K1 = getUInt32(key, 4);
|
Mic->k1 = getUInt32(key, 4);
|
||||||
|
|
||||||
//clear();
|
//clear();
|
||||||
MichaelClear(Mic);
|
MichaelClear(Mic);
|
||||||
|
@ -63,61 +63,61 @@ void MichaelAppend(struct michael_mic_t *Mic, uint8_t *src, int nBytes)
|
||||||
{
|
{
|
||||||
int addlen;
|
int addlen;
|
||||||
|
|
||||||
if (Mic->nBytesInM) {
|
if (Mic->m_bytes) {
|
||||||
addlen = 4 - Mic->nBytesInM;
|
addlen = 4 - Mic->m_bytes;
|
||||||
if (addlen > nBytes)
|
if (addlen > nBytes)
|
||||||
addlen = nBytes;
|
addlen = nBytes;
|
||||||
memcpy(&Mic->M[Mic->nBytesInM], src, addlen);
|
memcpy(&Mic->m[Mic->m_bytes], src, addlen);
|
||||||
Mic->nBytesInM += addlen;
|
Mic->m_bytes += addlen;
|
||||||
src += addlen;
|
src += addlen;
|
||||||
nBytes -= addlen;
|
nBytes -= addlen;
|
||||||
|
|
||||||
if (Mic->nBytesInM < 4)
|
if (Mic->m_bytes < 4)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Mic->L ^= getUInt32(Mic->M, 0);
|
Mic->l ^= getUInt32(Mic->m, 0);
|
||||||
MichaelBlockFunction(Mic->L, Mic->R);
|
MichaelBlockFunction(Mic->l, Mic->r);
|
||||||
Mic->nBytesInM = 0;
|
Mic->m_bytes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (nBytes >= 4) {
|
while (nBytes >= 4) {
|
||||||
Mic->L ^= getUInt32(src, 0);
|
Mic->l ^= getUInt32(src, 0);
|
||||||
MichaelBlockFunction(Mic->L, Mic->R);
|
MichaelBlockFunction(Mic->l, Mic->r);
|
||||||
src += 4;
|
src += 4;
|
||||||
nBytes -= 4;
|
nBytes -= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nBytes > 0) {
|
if (nBytes > 0) {
|
||||||
Mic->nBytesInM = nBytes;
|
Mic->m_bytes = nBytes;
|
||||||
memcpy(Mic->M, src, nBytes);
|
memcpy(Mic->m, src, nBytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
void MichaelGetMIC(struct michael_mic_t *Mic, uint8_t *dst)
|
void MichaelGetMIC(struct michael_mic_t *Mic, uint8_t *dst)
|
||||||
{
|
{
|
||||||
u8 *data = Mic->M;
|
u8 *data = Mic->m;
|
||||||
|
|
||||||
switch (Mic->nBytesInM) {
|
switch (Mic->m_bytes) {
|
||||||
case 0:
|
case 0:
|
||||||
Mic->L ^= 0x5a;
|
Mic->l ^= 0x5a;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
Mic->L ^= data[0] | 0x5a00;
|
Mic->l ^= data[0] | 0x5a00;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
Mic->L ^= data[0] | (data[1] << 8) | 0x5a0000;
|
Mic->l ^= data[0] | (data[1] << 8) | 0x5a0000;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
Mic->L ^= data[0] | (data[1] << 8) | (data[2] << 16) |
|
Mic->l ^= data[0] | (data[1] << 8) | (data[2] << 16) |
|
||||||
0x5a000000;
|
0x5a000000;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MichaelBlockFunction(Mic->L, Mic->R);
|
MichaelBlockFunction(Mic->l, Mic->r);
|
||||||
MichaelBlockFunction(Mic->L, Mic->R);
|
MichaelBlockFunction(Mic->l, Mic->r);
|
||||||
// The appendByte function has already computed the result.
|
// The appendByte function has already computed the result.
|
||||||
putUInt32(dst, 0, Mic->L);
|
putUInt32(dst, 0, Mic->l);
|
||||||
putUInt32(dst, 4, Mic->R);
|
putUInt32(dst, 4, Mic->r);
|
||||||
|
|
||||||
// Reset to the empty message.
|
// Reset to the empty message.
|
||||||
MichaelClear(Mic);
|
MichaelClear(Mic);
|
||||||
|
|
|
@ -11,13 +11,13 @@
|
||||||
|
|
||||||
/* MichaelMIC routine define */
|
/* MichaelMIC routine define */
|
||||||
struct michael_mic_t {
|
struct michael_mic_t {
|
||||||
u32 K0; // Key
|
u32 k0; // Key
|
||||||
u32 K1; // Key
|
u32 k1; // Key
|
||||||
u32 L; // Current state
|
u32 l; // Current state
|
||||||
u32 R; // Current state
|
u32 r; // Current state
|
||||||
u8 M[4]; // Message accumulator (single word)
|
u8 m[4]; // Message accumulator (single word)
|
||||||
int nBytesInM; // # bytes in M
|
int m_bytes; // # bytes in M
|
||||||
u8 Result[8];
|
u8 result[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
void MichaelMICFunction(struct michael_mic_t *Mic, u8 *Key,
|
void MichaelMICFunction(struct michael_mic_t *Mic, u8 *Key,
|
||||||
|
|
Loading…
Reference in New Issue