From: Niels Möller Date: Sun, 7 Oct 2001 18:51:26 +0000 (+0200) Subject: Work in progress. X-Git-Tag: nettle_1.5_release_20020131~169 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0c3262743e76cfacac1f1f7fe2cd2e3baa2af1d;p=thirdparty%2Fnettle.git Work in progress. Rev: src/nettle/yarrow.h:1.2 --- 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 */