From: Niels Möller Date: Wed, 30 Oct 2024 09:24:19 +0000 (+0100) Subject: Update hmac-ripemd160. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91ec20feb849877dfdd899c5676cc5667d6cf981;p=thirdparty%2Fnettle.git Update hmac-ripemd160. --- diff --git a/hmac-ripemd160.c b/hmac-ripemd160.c index 4776ae86..ee5e802f 100644 --- a/hmac-ripemd160.c +++ b/hmac-ripemd160.c @@ -2,7 +2,7 @@ HMAC-RIPEMD160 message authentication code. - Copyright (C) 2011 Niels Möller + Copyright (C) 2011, 2024 Niels Möller This file is part of GNU Nettle. @@ -36,12 +36,14 @@ #endif #include "hmac.h" +#include "hmac-internal.h" void hmac_ripemd160_set_key(struct hmac_ripemd160_ctx *ctx, size_t key_length, const uint8_t *key) { - HMAC_SET_KEY(ctx, &nettle_ripemd160, key_length, key); + _nettle_hmac_set_key (sizeof(ctx->outer), ctx->outer, ctx->inner, &ctx->state, + ctx->state.block, &nettle_ripemd160, key_length, key); } void @@ -55,5 +57,7 @@ void hmac_ripemd160_digest(struct hmac_ripemd160_ctx *ctx, uint8_t *digest) { - HMAC_DIGEST(ctx, &nettle_ripemd160, digest); + ripemd160_digest (&ctx->state, ctx->state.block); + ctx->state.index = RIPEMD160_DIGEST_SIZE; + _NETTLE_HMAC_DIGEST (ctx->outer, ctx->inner, &ctx->state, ripemd160_digest, digest); } diff --git a/hmac.h b/hmac.h index c39c1a3d..568808dd 100644 --- a/hmac.h +++ b/hmac.h @@ -121,7 +121,7 @@ hmac_digest(const void *outer, const void *inner, void *state, /* HMAC using specific hash functions */ /* hmac-md5 */ -struct hmac_md5_ctx HMAC_CTX(struct md5_ctx, offsetof(struct md5_ctx, index)); +struct hmac_md5_ctx HMAC_CTX(struct md5_ctx, offsetof (struct md5_ctx, index)); void hmac_md5_set_key(struct hmac_md5_ctx *ctx, @@ -137,7 +137,7 @@ hmac_md5_digest(struct hmac_md5_ctx *ctx, /* hmac-ripemd160 */ -struct hmac_ripemd160_ctx OLD_HMAC_CTX(struct ripemd160_ctx); +struct hmac_ripemd160_ctx HMAC_CTX(struct ripemd160_ctx, offsetof (struct ripemd160_ctx, index)); void hmac_ripemd160_set_key(struct hmac_ripemd160_ctx *ctx,