From 68f16dae244752e8bdf112e8feeb6a0839088a3e Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Tue, 14 Oct 2014 17:14:54 +0200 Subject: Implement support for creating and booting encrypted partition using SHA-256. Support SHA-256 for normal volumes as well. --- src/Common/Random.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/Common/Random.c') diff --git a/src/Common/Random.c b/src/Common/Random.c index 445e8f24..54192cb2 100644 --- a/src/Common/Random.c +++ b/src/Common/Random.c @@ -210,6 +210,7 @@ BOOL Randmix () WHIRLPOOL_CTX wctx; RMD160_CTX rctx; sha512_ctx sctx; + sha256_ctx s256ctx; int poolIndex, digestIndex, digestSize; switch (HashFunction) @@ -222,6 +223,10 @@ BOOL Randmix () digestSize = SHA512_DIGESTSIZE; break; + case SHA256: + digestSize = SHA256_DIGESTSIZE; + break; + case WHIRLPOOL: digestSize = WHIRLPOOL_DIGESTSIZE; break; @@ -250,6 +255,12 @@ BOOL Randmix () sha512_end (hashOutputBuffer, &sctx); break; + case SHA256: + sha256_begin (&s256ctx); + sha256_hash (pRandPool, RNG_POOL_SIZE, &s256ctx); + sha256_end (hashOutputBuffer, &s256ctx); + break; + case WHIRLPOOL: WHIRLPOOL_init (&wctx); WHIRLPOOL_add (pRandPool, RNG_POOL_SIZE * 8, &wctx); @@ -280,6 +291,10 @@ BOOL Randmix () burn (&sctx, sizeof(sctx)); break; + case SHA256: + burn (&s256ctx, sizeof(s256ctx)); + break; + case WHIRLPOOL: burn (&wctx, sizeof(wctx)); break; -- cgit v1.2.3