summaryrefslogtreecommitdiff
path: root/cmac.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2018-02-19 22:25:18 +0100
committerNiels Möller <nisse@lysator.liu.se>2018-02-19 22:25:18 +0100
commit69208ec19a2edab0a636ff6b6decd188c6be5383 (patch)
treed33105abcc45d1fae6fb379b54352b1a99d0b4ee /cmac.c
parent0c4cccd0a0d469b15f577b8cdf0dbdac6fb03a42 (diff)
downloadnettle-69208ec19a2edab0a636ff6b6decd188c6be5383.tar.gz
Mostly aesthetic changes to CMAC.
Diffstat (limited to 'cmac.c')
-rw-r--r--cmac.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/cmac.c b/cmac.c
index eb7b2cf5..d08bd832 100644
--- a/cmac.c
+++ b/cmac.c
@@ -46,13 +46,8 @@
#include "nettle-internal.h"
#include "macros.h"
-static const uint8_t const_zero[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
/* shift one and XOR with 0x87. */
-static inline void
+static void
block_mulx(union nettle_block16 *dst,
const union nettle_block16 *src)
{
@@ -70,9 +65,13 @@ block_mulx(union nettle_block16 *dst,
}
void
-cmac128_set_key(struct cmac128 *ctx, void *cipher,
+cmac128_set_key(struct cmac128_ctx *ctx, const void *cipher,
nettle_cipher_func *encrypt)
{
+ static const uint8_t const_zero[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
union nettle_block16 *L = &ctx->block;
memset(ctx, 0, sizeof(*ctx));
@@ -86,7 +85,7 @@ cmac128_set_key(struct cmac128 *ctx, void *cipher,
#define MIN(x,y) ((x)<(y)?(x):(y))
void
-cmac128_update(struct cmac128 *ctx, void *cipher,
+cmac128_update(struct cmac128_ctx *ctx, const void *cipher,
nettle_cipher_func *encrypt,
size_t msg_len, const uint8_t *msg)
{
@@ -131,7 +130,7 @@ cmac128_update(struct cmac128 *ctx, void *cipher,
}
void
-cmac128_digest(struct cmac128 *ctx, void *cipher,
+cmac128_digest(struct cmac128_ctx *ctx, const void *cipher,
nettle_cipher_func *encrypt,
unsigned length,
uint8_t *dst)