VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Random.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2014-10-14 17:14:54 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2014-11-08 23:23:53 +0100
commit68f16dae244752e8bdf112e8feeb6a0839088a3e (patch)
tree94b1f5ab11b4d08661d838704bf08c14eb2e46a4 /src/Common/Random.c
parentf38cf0b6943da24c802424f53588b54aada48fd8 (diff)
downloadVeraCrypt-68f16dae244752e8bdf112e8feeb6a0839088a3e.tar.gz
VeraCrypt-68f16dae244752e8bdf112e8feeb6a0839088a3e.zip
Implement support for creating and booting encrypted partition using SHA-256. Support SHA-256 for normal volumes as well.
Diffstat (limited to 'src/Common/Random.c')
-rw-r--r--src/Common/Random.c15
1 files changed, 15 insertions, 0 deletions
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;