From e0c3262743e76cfacac1f1f7fe2cd2e3baa2af1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Sun, 7 Oct 2001 20:51:26 +0200 Subject: [PATCH] Work in progress. Rev: src/nettle/yarrow.h:1.2 --- yarrow.h | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/yarrow.h b/yarrow.h index 0b691e8a..65486532 100644 --- a/yarrow.h +++ b/yarrow.h @@ -26,20 +26,46 @@ #ifndef NETTLE_YARROW_COMPAT_H_INCLUDED #define NETTLE_YARROW_COMPAT_H_INCLUDED +#include "sha1.h" +#include "des.h" + +enum yarrow_pool_id { YARROW_FAST = 0, YARROW_SLOW = 1 }; + +struct yarrow_source +{ + uint32_t estimate; + + /* The pool next sample should go to. */ + enum yarrow_pool_id next; +}; + struct yarrow160_ctx { + /* Indexed by yarrow_pool_id */ + struct sha1_ctx pools[2]; + + int seeded; + + struct des3_ctx key; + + unsigned nsources; + struct yarrow_source *sources; }; void -yarrow160_init(struct *yarrow160_ctx); +yarrow160_init(struct yarrow160_ctx *ctx, + int nsources, + struct yarrow_source *sources); void -yarrow160_update(struct *yarrow160_ctx, unsigned length, const uint8_t *data); +yarrow160_update(struct yarrow160_ctx *ctx, + unsigned source, unsigned length, const uint8_t *data); void -yarrow160_random(struct *yarrow160_ctx, unsigned length, uint8_t dst); +yarrow160_random(struct yarrow160_ctx *ctx, unsigned length, uint8_t dst); + +int +yarrow160_seeded(struct yarrow160_ctx *ctx); -unsigned -yarrow160_needed(struct *yarrow160_ctx); #endif /* NETTLE_YARROW_COMPAT_H_INCLUDED */ -- GitLab