From 2dfc2d87da5e70c0378840b28d9cabe35ac1bf8c Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Fri, 23 Mar 2018 11:34:11 +0100 Subject: [PATCH] make fortuna_update_seed() public In order to be able to implement UpdateSeedFile from the original paper this is required to be available on the public API. --- src/headers/tomcrypt_prng.h | 7 ++++--- src/prngs/fortuna.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/headers/tomcrypt_prng.h b/src/headers/tomcrypt_prng.h index 0aaf5e55..5d66aaac 100644 --- a/src/headers/tomcrypt_prng.h +++ b/src/headers/tomcrypt_prng.h @@ -152,9 +152,10 @@ int fortuna_add_random_event(unsigned long source, unsigned long pool, const uns int fortuna_ready(prng_state *prng); unsigned long fortuna_read(unsigned char *out, unsigned long outlen, prng_state *prng); int fortuna_done(prng_state *prng); -int fortuna_export(unsigned char *out, unsigned long *outlen, prng_state *prng); -int fortuna_import(const unsigned char *in, unsigned long inlen, prng_state *prng); -int fortuna_test(void); +int fortuna_export(unsigned char *out, unsigned long *outlen, prng_state *prng); +int fortuna_import(const unsigned char *in, unsigned long inlen, prng_state *prng); +int fortuna_update_seed(const unsigned char *in, unsigned long inlen, prng_state *prng); +int fortuna_test(void); extern const struct ltc_prng_descriptor fortuna_desc; #endif diff --git a/src/prngs/fortuna.c b/src/prngs/fortuna.c index cb739a71..3066b3b4 100644 --- a/src/prngs/fortuna.c +++ b/src/prngs/fortuna.c @@ -167,7 +167,7 @@ static int _fortuna_reseed(prng_state *prng) @param prng The PRNG to import @return CRYPT_OK if successful */ -static int _fortuna_update_seed(const unsigned char *in, unsigned long inlen, prng_state *prng) +int fortuna_update_seed(const unsigned char *in, unsigned long inlen, prng_state *prng) { int err; unsigned char tmp[MAXBLOCKSIZE]; @@ -481,7 +481,7 @@ int fortuna_import(const unsigned char *in, unsigned long inlen, prng_state *prn return err; } - if ((err = _fortuna_update_seed(in, inlen, prng)) != CRYPT_OK) { + if ((err = fortuna_update_seed(in, inlen, prng)) != CRYPT_OK) { return err; }