VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Random.c
diff options
context:
space:
mode:
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;