X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=entropium%2Fentropium.c;h=182cd2f15a7fa3d9ba2cab5ccb967e108af5eec4;hb=3e91beb6a6b472a97cf214ac3eebf363e75279a1;hp=b86cd1bc581a318ab8f70c25991263ead15657ac;hpb=7b5401ab9ce23a5da1de8b6c7de3a1aa20ac4cf8;p=avr-crypto-lib.git diff --git a/entropium/entropium.c b/entropium/entropium.c index b86cd1b..182cd2f 100644 --- a/entropium/entropium.c +++ b/entropium/entropium.c @@ -48,7 +48,7 @@ #include #include -#include "sha256/sha256.h" +#include "sha256.h" #include "entropium.h" /** @@ -65,7 +65,7 @@ uint32_t rndCore[16]; * * we simply first "hash" rndCore, then entropy. */ -void entropium_addEntropy(unsigned length_b, const void* data){ +void entropium_addEntropy(unsigned length_b, const void *data){ sha256_ctx_t s; static uint8_t offset=0; /* selects if higher or lower half gets updated */ sha256_init(&s); @@ -87,7 +87,7 @@ void entropium_addEntropy(unsigned length_b, const void* data){ void entropium_getRandomBlock(void *b){ sha256_ctx_t s; - uint8_t offset=8; + static uint8_t offset=8; sha256_init(&s); sha256_lastBlock(&s, rndCore, 512); /* remeber the byte order! */ @@ -116,7 +116,7 @@ uint8_t entropium_getRandomByte(void){ return block[i++]; } -void entropium_fillBlockRandom(void* block, unsigned length_B){ +void entropium_fillBlockRandom(void *block, unsigned length_B){ while(length_B>ENTROPIUM_RANDOMBLOCK_SIZE){ entropium_getRandomBlock(block); block = (uint8_t*)block + ENTROPIUM_RANDOMBLOCK_SIZE;