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
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);
}
/* 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,
/* 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,