VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Crypto.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/Crypto.c')
-rw-r--r--src/Common/Crypto.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/Common/Crypto.c b/src/Common/Crypto.c
index 49948107..9c4ee5a3 100644
--- a/src/Common/Crypto.c
+++ b/src/Common/Crypto.c
@@ -219,7 +219,7 @@ void EncipherBlock(int cipher, void *data, void *ks)
void EncipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount)
{
- byte *data = dataPtr;
+ uint8 *data = dataPtr;
#if defined (TC_WINDOWS_DRIVER) && !defined (_WIN64)
KFLOATING_SAVE floatingPointState;
#endif
@@ -317,7 +317,7 @@ void DecipherBlock(int cipher, void *data, void *ks)
case AES:
#if defined (_WIN64) || !defined (TC_WINDOWS_DRIVER)
if (IsAesHwCpuSupported())
- aes_hw_cpu_decrypt ((byte *) ks + sizeof (aes_encrypt_ctx), data);
+ aes_hw_cpu_decrypt ((uint8 *) ks + sizeof (aes_encrypt_ctx), data);
else
#endif
aes_decrypt (data, data, (void *) ((char *) ks + sizeof(aes_encrypt_ctx)));
@@ -334,7 +334,7 @@ void DecipherBlock(int cipher, void *data, void *ks)
void DecipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount)
{
- byte *data = dataPtr;
+ uint8 *data = dataPtr;
#if defined (TC_WINDOWS_DRIVER) && !defined (_WIN64)
KFLOATING_SAVE floatingPointState;
#endif
@@ -349,7 +349,7 @@ void DecipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount)
{
while (blockCount > 0)
{
- aes_hw_cpu_decrypt_32_blocks ((byte *) ks + sizeof (aes_encrypt_ctx), data);
+ aes_hw_cpu_decrypt_32_blocks ((uint8 *) ks + sizeof (aes_encrypt_ctx), data);
data += 32 * 16;
blockCount -= 32;
@@ -855,7 +855,7 @@ int GetMaxPkcs5OutSize (void)
#ifdef TC_WINDOWS_BOOT
-static byte CryptoInfoBufferInUse = 0;
+static uint8 CryptoInfoBufferInUse = 0;
CRYPTO_INFO CryptoInfoBuffer;
#endif
@@ -1118,7 +1118,7 @@ void EncipherBlock(int cipher, void *data, void *ks)
{
#ifdef TC_WINDOWS_BOOT_AES
if (IsAesHwCpuSupported())
- aes_hw_cpu_encrypt ((byte *) ks, data);
+ aes_hw_cpu_encrypt ((uint8 *) ks, data);
else
aes_encrypt (data, data, ks);
#elif defined (TC_WINDOWS_BOOT_SERPENT) && !defined (WOLFCRYPT_BACKEND)
@@ -1134,9 +1134,9 @@ void DecipherBlock(int cipher, void *data, void *ks)
{
#ifdef TC_WINDOWS_BOOT_AES
if (IsAesHwCpuSupported())
- aes_hw_cpu_decrypt ((byte *) ks + sizeof (aes_encrypt_ctx) + 14 * 16, data);
+ aes_hw_cpu_decrypt ((uint8 *) ks + sizeof (aes_encrypt_ctx) + 14 * 16, data);
else
- aes_decrypt (data, data, (aes_decrypt_ctx *) ((byte *) ks + sizeof(aes_encrypt_ctx)));
+ aes_decrypt (data, data, (aes_decrypt_ctx *) ((uint8 *) ks + sizeof(aes_encrypt_ctx)));
#elif defined (TC_WINDOWS_BOOT_SERPENT) && !defined (WOLFCRYPT_BACKEND)
serpent_decrypt (data, data, ks);
#elif defined (TC_WINDOWS_BOOT_TWOFISH) && !defined (WOLFCRYPT_BACKEND)
@@ -1278,7 +1278,7 @@ BOOL IsRamEncryptionEnabled ()
}
/* masking for random index to remove bias */
-byte GetRngMask (byte count)
+uint8 GetRngMask (uint8 count)
{
if (count >= 128)
return 0xFF;
@@ -1297,10 +1297,10 @@ byte GetRngMask (byte count)
return 1;
}
-byte GetRandomIndex (ChaCha20RngCtx* pCtx, byte elementsCount)
+uint8 GetRandomIndex (ChaCha20RngCtx* pCtx, uint8 elementsCount)
{
- byte index = 0;
- byte mask = GetRngMask (elementsCount);
+ uint8 index = 0;
+ uint8 mask = GetRngMask (elementsCount);
while (TRUE)
{
@@ -1315,7 +1315,7 @@ byte GetRandomIndex (ChaCha20RngCtx* pCtx, byte elementsCount)
#if defined(_WIN64) && !defined (_UEFI)
/* declaration of variables and functions used for RAM encryption on 64-bit build */
-static byte* pbKeyDerivationArea = NULL;
+static uint8* pbKeyDerivationArea = NULL;
static ULONG cbKeyDerivationArea = 0;
static uint64 HashSeedMask = 0;
@@ -1331,9 +1331,9 @@ ULONG AllocTag = 'MMCV';
BOOL InitializeSecurityParameters(GetRandSeedFn rngCallback)
{
ChaCha20RngCtx ctx;
- byte pbSeed[CHACHA20RNG_KEYSZ + CHACHA20RNG_IVSZ];
+ uint8 pbSeed[CHACHA20RNG_KEYSZ + CHACHA20RNG_IVSZ];
#ifdef TC_WINDOWS_DRIVER
- byte i;
+ uint8 i;
char randomStr[4];
Dump ("InitializeSecurityParameters BEGIN\n");
#endif
@@ -1390,7 +1390,7 @@ BOOL InitializeSecurityParameters(GetRandSeedFn rngCallback)
cbKeyDerivationArea = 1024 * 1024;
do
{
- pbKeyDerivationArea = (byte*) TCalloc(cbKeyDerivationArea);
+ pbKeyDerivationArea = (uint8*) TCalloc(cbKeyDerivationArea);
if (!pbKeyDerivationArea)
cbKeyDerivationArea >>= 1;
} while (!pbKeyDerivationArea && (cbKeyDerivationArea >= (2*PAGE_SIZE)));
@@ -1531,25 +1531,25 @@ void VcUnprotectKeys (PCRYPTO_INFO pCryptoInfo, uint64 encID)
#if defined(_M_ARM64) || defined(__arm__) || defined (__arm64__) || defined (__aarch64__)
/* dummy implementation that should never be called */
-void aes_hw_cpu_decrypt(const byte* ks, byte* data)
+void aes_hw_cpu_decrypt(const uint8* ks, uint8* data)
{
ks = ks;
data = data;
}
-void aes_hw_cpu_decrypt_32_blocks(const byte* ks, byte* data)
+void aes_hw_cpu_decrypt_32_blocks(const uint8* ks, uint8* data)
{
ks = ks;
data = data;
}
-void aes_hw_cpu_encrypt(const byte* ks, byte* data)
+void aes_hw_cpu_encrypt(const uint8* ks, uint8* data)
{
ks = ks;
data = data;
}
-void aes_hw_cpu_encrypt_32_blocks(const byte* ks, byte* data)
+void aes_hw_cpu_encrypt_32_blocks(const uint8* ks, uint8* data)
{
ks = ks;
data = data;