VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Random.c
diff options
context:
space:
mode:
authorDavid Foerster <david.foerster@informatik.hu-berlin.de>2016-05-10 22:16:32 +0200
committerDavid Foerster <david.foerster@informatik.hu-berlin.de>2016-05-10 22:18:34 +0200
commit11716ed2dacbb104f8f59867fe66f2c0a6984291 (patch)
tree28aa448de2e790d0f40dc57799a55a9df12ee6fb /src/Common/Random.c
parent191075155835172e5596e191cf0679ff9022f0fd (diff)
downloadVeraCrypt-11716ed2dacbb104f8f59867fe66f2c0a6984291.tar.gz
VeraCrypt-11716ed2dacbb104f8f59867fe66f2c0a6984291.zip
Remove trailing whitespace
Diffstat (limited to 'src/Common/Random.c')
-rw-r--r--src/Common/Random.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/Common/Random.c b/src/Common/Random.c
index 56431262..32b38e44 100644
--- a/src/Common/Random.c
+++ b/src/Common/Random.c
@@ -1,11 +1,11 @@
/*
Legal Notice: Some portions of the source code contained in this file were
- derived from the source code of TrueCrypt 7.1a, which is
- Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
+ derived from the source code of TrueCrypt 7.1a, which is
+ Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
- and which is governed by the 'License Agreement for Encryption for the Masses'
- Modifications and additions to the original source code (contained in this file)
+ and which is governed by the 'License Agreement for Encryption for the Masses'
+ Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
@@ -46,16 +46,16 @@ static HANDLE PeriodicFastPollThreadHandle = NULL;
void RandAddInt (unsigned __int32 x)
{
- RandaddByte(x);
- RandaddByte((x >> 8));
+ RandaddByte(x);
+ RandaddByte((x >> 8));
RandaddByte((x >> 16));
RandaddByte((x >> 24));
}
void RandAddInt64 (unsigned __int64 x)
{
- RandaddByte(x);
- RandaddByte((x >> 8));
+ RandaddByte(x);
+ RandaddByte((x >> 8));
RandaddByte((x >> 16));
RandaddByte((x >> 24));
@@ -97,7 +97,7 @@ int Randinit ()
if (GetMaxPkcs5OutSize() > RNG_POOL_SIZE)
TC_THROW_FATAL_EXCEPTION;
- if(bRandDidInit)
+ if(bRandDidInit)
return 0;
InitializeCriticalSection (&critRandProt);
@@ -128,9 +128,9 @@ int Randinit ()
handleWin32Error (0, SRC_POS);
goto error;
}
-
+
if (!CryptAcquireContext (&hCryptProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
- {
+ {
CryptoAPIAvailable = FALSE;
CryptoAPILastError = GetLastError ();
goto error;
@@ -274,7 +274,7 @@ BOOL Randmix ()
if (RNG_POOL_SIZE % digestSize)
TC_THROW_FATAL_EXCEPTION;
- for (poolIndex = 0; poolIndex < RNG_POOL_SIZE; poolIndex += digestSize)
+ for (poolIndex = 0; poolIndex < RNG_POOL_SIZE; poolIndex += digestSize)
{
/* Compute the message digest of the entire pool using the selected hash function. */
switch (HashFunction)
@@ -303,7 +303,7 @@ BOOL Randmix ()
WHIRLPOOL_finalize (&wctx, hashOutputBuffer);
break;
- default:
+ default:
// Unknown/wrong ID
TC_THROW_FATAL_EXCEPTION;
}
@@ -316,26 +316,26 @@ BOOL Randmix ()
}
/* Prevent leaks */
- burn (hashOutputBuffer, MAX_DIGESTSIZE);
+ burn (hashOutputBuffer, MAX_DIGESTSIZE);
switch (HashFunction)
{
case RIPEMD160:
- burn (&rctx, sizeof(rctx));
+ burn (&rctx, sizeof(rctx));
break;
case SHA512:
- burn (&sctx, sizeof(sctx));
+ burn (&sctx, sizeof(sctx));
break;
case SHA256:
- burn (&s256ctx, sizeof(s256ctx));
+ burn (&s256ctx, sizeof(s256ctx));
break;
case WHIRLPOOL:
- burn (&wctx, sizeof(wctx));
+ burn (&wctx, sizeof(wctx));
break;
- default:
+ default:
// Unknown/wrong ID
TC_THROW_FATAL_EXCEPTION;
}
@@ -360,7 +360,7 @@ BOOL RandpeekBytes (void* hwndDlg, unsigned char *buf, int len, DWORD* mouseCoun
if (len > RNG_POOL_SIZE)
{
- Error ("ERR_NOT_ENOUGH_RANDOM_DATA", (HWND) hwndDlg);
+ Error ("ERR_NOT_ENOUGH_RANDOM_DATA", (HWND) hwndDlg);
len = RNG_POOL_SIZE;
}
@@ -413,7 +413,7 @@ BOOL RandgetBytesFull ( void* hwndDlg, unsigned char *buf , int len, BOOL forceS
/* There's never more than RNG_POOL_SIZE worth of randomess */
if ( (!allowAnyLength) && (len > RNG_POOL_SIZE))
{
- Error ("ERR_NOT_ENOUGH_RANDOM_DATA", (HWND) hwndDlg);
+ Error ("ERR_NOT_ENOUGH_RANDOM_DATA", (HWND) hwndDlg);
len = RNG_POOL_SIZE;
LeaveCriticalSection (&critRandProt);
return FALSE;
@@ -515,7 +515,7 @@ LRESULT CALLBACK MouseProc (int nCode, WPARAM wParam, LPARAM lParam)
EnterCriticalSection (&critRandProt);
/* only count real mouse messages in entropy estimation */
- if ( (nCode == HC_ACTION) && (wParam == WM_MOUSEMOVE)
+ if ( (nCode == HC_ACTION) && (wParam == WM_MOUSEMOVE)
&& ((pt.x != lastPoint.x) || (pt.y != lastPoint.y)))
{
ProcessedMouseEventsCounter++;
@@ -748,7 +748,7 @@ BOOL SlowPoll (void)
// we keep the check for clarity purpose
if ( !CryptoAPIAvailable )
return FALSE;
- if (CryptGenRandom (hCryptProv, sizeof (buffer), buffer))
+ if (CryptGenRandom (hCryptProv, sizeof (buffer), buffer))
{
RandaddBuf (buffer, sizeof (buffer));
@@ -759,7 +759,7 @@ BOOL SlowPoll (void)
else
{
/* return error in case CryptGenRandom fails */
- CryptoAPILastError = GetLastError ();
+ CryptoAPILastError = GetLastError ();
return FALSE;
}
}
@@ -870,7 +870,7 @@ BOOL FastPoll (void)
// we keep the check for clarity purpose
if ( !CryptoAPIAvailable )
return FALSE;
- if (CryptGenRandom (hCryptProv, sizeof (buffer), buffer))
+ if (CryptGenRandom (hCryptProv, sizeof (buffer), buffer))
{
RandaddBuf (buffer, sizeof (buffer));
burn (buffer, sizeof(buffer));