VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Crypto
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2024-11-13 02:08:51 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2024-11-13 02:08:51 +0100
commitcb973512503bd7f0ea525db89cb20fa83b25f216 (patch)
treeee65a77befed695711b0f380258776d23da1c603 /src/Crypto
parentec4b44c238b47e11eee327a8dc4d74b90175eab2 (diff)
downloadVeraCrypt-cb973512503bd7f0ea525db89cb20fa83b25f216.tar.gz
VeraCrypt-cb973512503bd7f0ea525db89cb20fa83b25f216.zip
Windows: Remove support for 32-bit driver code. Set build target as Windows 10. Simplify code and fix all warnings in driver.
Diffstat (limited to 'src/Crypto')
-rw-r--r--src/Crypto/Whirlpool.c51
-rw-r--r--src/Crypto/chacha-xmm.c39
2 files changed, 29 insertions, 61 deletions
diff --git a/src/Crypto/Whirlpool.c b/src/Crypto/Whirlpool.c
index 6a1fe8b4..140c7c6f 100644
--- a/src/Crypto/Whirlpool.c
+++ b/src/Crypto/Whirlpool.c
@@ -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);
diff --git a/src/Crypto/chacha-xmm.c b/src/Crypto/chacha-xmm.c
index 54c3680c..980c2c81 100644
--- a/src/Crypto/chacha-xmm.c
+++ b/src/Crypto/chacha-xmm.c
@@ -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)
{