]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Update hmac-ripemd160.
authorNiels Möller <nisse@lysator.liu.se>
Wed, 30 Oct 2024 09:24:19 +0000 (10:24 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Sun, 22 Jun 2025 19:11:04 +0000 (21:11 +0200)
hmac-ripemd160.c
hmac.h

index 4776ae86dc62bdf69cca6ee27d6ace5f27620b49..ee5e802f10bbb3bbf9ab6d9263486cb9d1a5ec50 100644 (file)
@@ -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.
 
 #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 c39c1a3dc3f14a20bc9212ca3c061819c4df646b..568808dd4a07c27428be20c6c00bf44653cb57f8 100644 (file)
--- 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,