Commit f7380a88 authored by Sergio Paracuellos's avatar Sergio Paracuellos Committed by Greg Kroah-Hartman

staging: ks7010: replace GetUInt32 macro with get_unaligned_le32

This commit replaces custom GetUInt32 macro with get_unaligned_le32
which is included in the linux kernel.
Signed-off-by: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8da5b3e7
...@@ -15,9 +15,6 @@ ...@@ -15,9 +15,6 @@
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include "michael_mic.h" #include "michael_mic.h"
// Convert from Byte[] to UInt32 in a portable way
#define getUInt32(A, B) ((uint32_t)(A[B + 0] << 0) \
+ (A[B + 1] << 8) + (A[B + 2] << 16) + (A[B + 3] << 24))
// Reset the state to the empty message. // Reset the state to the empty message.
static inline void michael_clear(struct michael_mic_t *mic) static inline void michael_clear(struct michael_mic_t *mic)
...@@ -30,8 +27,8 @@ static inline void michael_clear(struct michael_mic_t *mic) ...@@ -30,8 +27,8 @@ static inline void michael_clear(struct michael_mic_t *mic)
static void michael_init(struct michael_mic_t *mic, uint8_t *key) static void michael_init(struct michael_mic_t *mic, uint8_t *key)
{ {
// Set the key // Set the key
mic->k0 = getUInt32(key, 0); mic->k0 = get_unaligned_le32(key);
mic->k1 = getUInt32(key, 4); mic->k1 = get_unaligned_le32(key + 4);
//clear(); //clear();
michael_clear(mic); michael_clear(mic);
...@@ -65,13 +62,13 @@ static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes) ...@@ -65,13 +62,13 @@ static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes)
if (mic->m_bytes < 4) if (mic->m_bytes < 4)
return; return;
mic->l ^= getUInt32(mic->m, 0); mic->l ^= get_unaligned_le32(mic->m);
MichaelBlockFunction(mic->l, mic->r); MichaelBlockFunction(mic->l, mic->r);
mic->m_bytes = 0; mic->m_bytes = 0;
} }
while (bytes >= 4) { while (bytes >= 4) {
mic->l ^= getUInt32(src, 0); mic->l ^= get_unaligned_le32(src);
MichaelBlockFunction(mic->l, mic->r); MichaelBlockFunction(mic->l, mic->r);
src += 4; src += 4;
bytes -= 4; bytes -= 4;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment