diff options
Diffstat (limited to 'lib/nettle/mac.c')
-rw-r--r-- | lib/nettle/mac.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/nettle/mac.c b/lib/nettle/mac.c index cfa37e3479..cf4fd70c2b 100644 --- a/lib/nettle/mac.c +++ b/lib/nettle/mac.c @@ -31,12 +31,13 @@ #include <nettle/sha.h> #include <nettle/hmac.h> #include <nettle/umac.h> +#include "gnettle.h" #include <fips.h> -typedef void (*update_func) (void *, unsigned, const uint8_t *); -typedef void (*digest_func) (void *, unsigned, uint8_t *); -typedef void (*set_key_func) (void *, unsigned, const uint8_t *); -typedef void (*set_nonce_func) (void *, unsigned, const uint8_t *); +typedef void (*update_func) (void *, _NETTLE_SIZE_T, const uint8_t *); +typedef void (*digest_func) (void *, _NETTLE_SIZE_T, uint8_t *); +typedef void (*set_key_func) (void *, _NETTLE_SIZE_T, const uint8_t *); +typedef void (*set_nonce_func) (void *, _NETTLE_SIZE_T, const uint8_t *); static int wrap_nettle_hash_init(gnutls_digest_algorithm_t algo, void **_ctx); @@ -80,7 +81,7 @@ struct nettle_mac_ctx { }; static void -_wrap_umac96_set_key(void *ctx, unsigned len, const uint8_t * key) +_wrap_umac96_set_key(void *ctx, _NETTLE_SIZE_T len, const uint8_t * key) { if (unlikely(len != 16)) abort(); @@ -88,7 +89,7 @@ _wrap_umac96_set_key(void *ctx, unsigned len, const uint8_t * key) } static void -_wrap_umac128_set_key(void *ctx, unsigned len, const uint8_t * key) +_wrap_umac128_set_key(void *ctx, _NETTLE_SIZE_T len, const uint8_t * key) { if (unlikely(len != 16)) abort(); @@ -188,7 +189,7 @@ static int wrap_nettle_mac_fast(gnutls_mac_algorithm_t algo, if (ctx.set_nonce) ctx.set_nonce(&ctx, nonce_size, nonce); ctx.set_key(&ctx, key_size, key); - ctx.update(&ctx, text_size, text); + _NETTLE_UPDATE(ctx.update, &ctx, text_size, text); ctx.digest(&ctx, ctx.length, digest); zeroize_temp_key(&ctx, sizeof(ctx)); @@ -269,7 +270,7 @@ wrap_nettle_mac_update(void *_ctx, const void *text, size_t textsize) { struct nettle_mac_ctx *ctx = _ctx; - ctx->update(ctx->ctx_ptr, textsize, text); + _NETTLE_UPDATE(ctx->update, ctx->ctx_ptr, textsize, text); return GNUTLS_E_SUCCESS; } @@ -305,7 +306,7 @@ wrap_nettle_hash_update(void *_ctx, const void *text, size_t textsize) { struct nettle_hash_ctx *ctx = _ctx; - ctx->update(ctx->ctx_ptr, textsize, text); + _NETTLE_UPDATE(ctx->update, ctx->ctx_ptr, textsize, text); return GNUTLS_E_SUCCESS; } @@ -411,7 +412,7 @@ static int wrap_nettle_hash_fast(gnutls_digest_algorithm_t algo, if (ret < 0) return gnutls_assert_val(ret); - ctx.update(&ctx, text_size, text); + _NETTLE_UPDATE(ctx.update, &ctx, text_size, text); ctx.digest(&ctx, ctx.length, digest); return 0; |