From: Niels Möller Date: Wed, 30 Oct 2024 09:40:26 +0000 (+0100) Subject: Update hmac-sha1. X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=363e26a221081b5429490518c3a991c0a718508d;p=thirdparty%2Fnettle.git Update hmac-sha1. --- diff --git a/hmac-sha1.c b/hmac-sha1.c index 108f9216..a04fc324 100644 --- a/hmac-sha1.c +++ b/hmac-sha1.c @@ -2,7 +2,7 @@ HMAC-SHA1 message authentication code. - Copyright (C) 2002 Niels Möller + Copyright (C) 2002, 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_sha1_set_key(struct hmac_sha1_ctx *ctx, size_t key_length, const uint8_t *key) { - HMAC_SET_KEY(ctx, &nettle_sha1, key_length, key); + _nettle_hmac_set_key (sizeof(ctx->outer), ctx->outer, ctx->inner, &ctx->state, + ctx->state.block, &nettle_sha1, key_length, key); } void @@ -55,5 +57,7 @@ void hmac_sha1_digest(struct hmac_sha1_ctx *ctx, uint8_t *digest) { - HMAC_DIGEST(ctx, &nettle_sha1, digest); + sha1_digest (&ctx->state, ctx->state.block); + ctx->state.index = SHA1_DIGEST_SIZE; + _NETTLE_HMAC_DIGEST (ctx->outer, ctx->inner, &ctx->state, sha1_digest, digest); } diff --git a/hmac.h b/hmac.h index 568808dd..e3d30578 100644 --- a/hmac.h +++ b/hmac.h @@ -153,7 +153,7 @@ hmac_ripemd160_digest(struct hmac_ripemd160_ctx *ctx, /* hmac-sha1 */ -struct hmac_sha1_ctx OLD_HMAC_CTX(struct sha1_ctx); +struct hmac_sha1_ctx HMAC_CTX (struct sha1_ctx, offsetof (struct sha1_ctx, index)); void hmac_sha1_set_key(struct hmac_sha1_ctx *ctx,