summaryrefslogtreecommitdiff
path: root/drivers/staging/ks7010
diff options
context:
space:
mode:
authorSergio Paracuellos <sergio.paracuellos@gmail.com>2018-03-28 17:24:24 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-29 11:49:12 +0200
commitc61cc2cc3be358da10121d119356dfe67fe240f2 (patch)
tree2c3d607416112ab4f4b5d3e981ced0f65d22b5c6 /drivers/staging/ks7010
parentf7380a88dacc9a52e4329a79cacf4665e9b2047b (diff)
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: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ks7010')
-rw-r--r--drivers/staging/ks7010/michael_mic.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index 490438dc3f48..5eac35602167 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -34,17 +34,18 @@ static void michael_init(struct michael_mic_t *mic, uint8_t *key)
michael_clear(mic);
}
-#define MichaelBlockFunction(L, R) \
-do { \
- R ^= rol32(L, 17); \
- L += R; \
- R ^= ((L & 0xff00ff00) >> 8) | ((L & 0x00ff00ff) << 8); \
- L += R; \
- R ^= rol32(L, 3); \
- L += R; \
- R ^= ror32(L, 2); \
- L += R; \
-} while (0)
+static inline void michael_block(struct michael_mic_t *mic)
+{
+ mic->r ^= rol32(mic->l, 17);
+ mic->l += mic->r;
+ mic->r ^= ((mic->l & 0xff00ff00) >> 8) |
+ ((mic->l & 0x00ff00ff) << 8);
+ mic->l += mic->r;
+ mic->r ^= rol32(mic->l, 3); \
+ mic->l += mic->r;
+ mic->r ^= ror32(mic->l, 2); \
+ mic->l += mic->r;
+}
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;
mic->l ^= get_unaligned_le32(mic->m);
- MichaelBlockFunction(mic->l, mic->r);
+ michael_block(mic);
mic->m_bytes = 0;
}
while (bytes >= 4) {
mic->l ^= get_unaligned_le32(src);
- MichaelBlockFunction(mic->l, mic->r);
+ michael_block(mic);
src += 4;
bytes -= 4;
}
@@ -99,8 +100,8 @@ static void michael_get_mic(struct michael_mic_t *mic, uint8_t *dst)
0x5a000000;
break;
}
- MichaelBlockFunction(mic->l, mic->r);
- MichaelBlockFunction(mic->l, mic->r);
+ michael_block(mic);
+ michael_block(mic);
// The appendByte function has already computed the result.
put_unaligned_le32(mic->l, dst);
put_unaligned_le32(mic->r, dst + 4);