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

staging: ks7010: replace MichaelBlockFunction macro with inline function

This commit replaces MichaelBlockFunction macro with similar
inline function renaming it to michael_block.
Signed-off-by: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f7380a88
...@@ -34,17 +34,18 @@ static void michael_init(struct michael_mic_t *mic, uint8_t *key) ...@@ -34,17 +34,18 @@ static void michael_init(struct michael_mic_t *mic, uint8_t *key)
michael_clear(mic); michael_clear(mic);
} }
#define MichaelBlockFunction(L, R) \ static inline void michael_block(struct michael_mic_t *mic)
do { \ {
R ^= rol32(L, 17); \ mic->r ^= rol32(mic->l, 17);
L += R; \ mic->l += mic->r;
R ^= ((L & 0xff00ff00) >> 8) | ((L & 0x00ff00ff) << 8); \ mic->r ^= ((mic->l & 0xff00ff00) >> 8) |
L += R; \ ((mic->l & 0x00ff00ff) << 8);
R ^= rol32(L, 3); \ mic->l += mic->r;
L += R; \ mic->r ^= rol32(mic->l, 3); \
R ^= ror32(L, 2); \ mic->l += mic->r;
L += R; \ mic->r ^= ror32(mic->l, 2); \
} while (0) mic->l += mic->r;
}
static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes) static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes)
{ {
...@@ -63,13 +64,13 @@ static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes) ...@@ -63,13 +64,13 @@ static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes)
return; return;
mic->l ^= get_unaligned_le32(mic->m); mic->l ^= get_unaligned_le32(mic->m);
MichaelBlockFunction(mic->l, mic->r); michael_block(mic);
mic->m_bytes = 0; mic->m_bytes = 0;
} }
while (bytes >= 4) { while (bytes >= 4) {
mic->l ^= get_unaligned_le32(src); mic->l ^= get_unaligned_le32(src);
MichaelBlockFunction(mic->l, mic->r); michael_block(mic);
src += 4; src += 4;
bytes -= 4; bytes -= 4;
} }
...@@ -99,8 +100,8 @@ static void michael_get_mic(struct michael_mic_t *mic, uint8_t *dst) ...@@ -99,8 +100,8 @@ static void michael_get_mic(struct michael_mic_t *mic, uint8_t *dst)
0x5a000000; 0x5a000000;
break; break;
} }
MichaelBlockFunction(mic->l, mic->r); michael_block(mic);
MichaelBlockFunction(mic->l, mic->r); michael_block(mic);
// The appendByte function has already computed the result. // The appendByte function has already computed the result.
put_unaligned_le32(mic->l, dst); put_unaligned_le32(mic->l, dst);
put_unaligned_le32(mic->r, dst + 4); put_unaligned_le32(mic->r, dst + 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