1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-12 03:18:26 -06:00

Windows: Remove support for 32-bit driver code. Set build target as Windows 10. Simplify code and fix all warnings in driver.

This commit is contained in:
Mounir IDRASSI
2024-11-13 02:08:51 +01:00
parent ec4b44c238
commit cb97351250
31 changed files with 513 additions and 778 deletions

View File

@@ -957,28 +957,35 @@ void WHIRLPOOL_add(const unsigned char * input,
}
// now process the input data in blocks of 64 bytes and save the leftovers to ctx->data
if (len >= 64)
{
if (input == data)
{
HashMultipleBlocks(ctx, dataBuf, 64);
return;
}
else if (IsAligned16(input))
{
uint64 leftOver = HashMultipleBlocks(ctx, (uint64 *)input, len);
input += (len - leftOver);
len = leftOver;
}
else
do
{ // copy input first if it's not aligned correctly
memcpy(data, input, 64);
HashMultipleBlocks(ctx, dataBuf, 64);
input+=64;
len-=64;
} while (len >= 64);
}
if (len >= 64)
{
if (input == data)
{
HashMultipleBlocks(ctx, dataBuf, 64);
return;
}
else
{
#ifndef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS
if (IsAligned16(input))
#endif
{
uint64 leftOver = HashMultipleBlocks(ctx, (uint64*)input, len);
input += (len - leftOver);
len = leftOver;
}
#ifndef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS
else
do
{ // copy input first if it's not aligned correctly
memcpy(data, input, 64);
HashMultipleBlocks(ctx, dataBuf, 64);
input += 64;
len -= 64;
} while (len >= 64);
#endif
}
}
if (len && data != input)
memcpy(data, input, (size_t) len);

View File

@@ -81,45 +81,6 @@ static void salsa20_wordtobyte(uint8 output[64],const uint32 input[16], unsigned
for (i = 0;i < 16;++i) U32TO8_LITTLE(output + 4 * i,x[i]);
}
void chacha_ECRYPT_init(void)
{
return;
}
static const char sigma[17] = "expand 32-byte k";
static const char tau[17] = "expand 16-byte k";
void chacha_ECRYPT_keysetup(uint32* input,const uint8 *k,uint32 kbits,uint32 ivbits)
{
const char *constants;
input[4] = U8TO32_LITTLE(k + 0);
input[5] = U8TO32_LITTLE(k + 4);
input[6] = U8TO32_LITTLE(k + 8);
input[7] = U8TO32_LITTLE(k + 12);
if (kbits == 256) { /* recommended */
k += 16;
constants = sigma;
} else { /* kbits == 128 */
constants = tau;
}
input[8] = U8TO32_LITTLE(k + 0);
input[9] = U8TO32_LITTLE(k + 4);
input[10] = U8TO32_LITTLE(k + 8);
input[11] = U8TO32_LITTLE(k + 12);
input[0] = U8TO32_LITTLE(constants + 0);
input[1] = U8TO32_LITTLE(constants + 4);
input[2] = U8TO32_LITTLE(constants + 8);
input[3] = U8TO32_LITTLE(constants + 12);
}
void chacha_ECRYPT_ivsetup(uint32* input,const uint8 *iv)
{
input[12] = 0;
input[13] = 0;
input[14] = U8TO32_LITTLE(iv + 0);
input[15] = U8TO32_LITTLE(iv + 4);
}
void chacha_ECRYPT_encrypt_bytes(size_t bytes, uint32* x, const uint8* m, uint8* out, uint8* output, unsigned int r)
{