VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Common/Crypto.c6
-rw-r--r--src/Crypto/Twofish.c8
-rw-r--r--src/Crypto/Twofish.h4
3 files changed, 9 insertions, 9 deletions
diff --git a/src/Common/Crypto.c b/src/Common/Crypto.c
index e44ad1ba..808c8af7 100644
--- a/src/Common/Crypto.c
+++ b/src/Common/Crypto.c
@@ -247,7 +247,7 @@ void EncipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount)
247#endif 247#endif
248 } 248 }
249#endif 249#endif
250#if CRYPTOPP_BOOL_X64 && !defined(_UEFI) 250#if CRYPTOPP_BOOL_X64
251 else if (cipher == TWOFISH) { 251 else if (cipher == TWOFISH) {
252 twofish_encrypt_blocks(ks, data, data, (uint32) blockCount); 252 twofish_encrypt_blocks(ks, data, data, (uint32) blockCount);
253 } 253 }
@@ -347,7 +347,7 @@ void DecipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount)
347#endif 347#endif
348 } 348 }
349#endif 349#endif
350#if CRYPTOPP_BOOL_X64 && !defined(_UEFI) 350#if CRYPTOPP_BOOL_X64
351 else if (cipher == TWOFISH) { 351 else if (cipher == TWOFISH) {
352 twofish_decrypt_blocks(ks, data, data, (uint32) blockCount); 352 twofish_decrypt_blocks(ks, data, data, (uint32) blockCount);
353 } 353 }
@@ -428,7 +428,7 @@ BOOL CipherSupportsIntraDataUnitParallelization (int cipher)
428#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && !defined (_UEFI) 428#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && !defined (_UEFI)
429 || (cipher == SERPENT && HasSSE2()) 429 || (cipher == SERPENT && HasSSE2())
430#endif 430#endif
431#if CRYPTOPP_BOOL_X64 && !defined(_UEFI) 431#if CRYPTOPP_BOOL_X64
432 || (cipher == TWOFISH) 432 || (cipher == TWOFISH)
433#endif 433#endif
434 ; 434 ;
diff --git a/src/Crypto/Twofish.c b/src/Crypto/Twofish.c
index 23a5dfda..8ab59081 100644
--- a/src/Crypto/Twofish.c
+++ b/src/Crypto/Twofish.c
@@ -54,7 +54,7 @@
54#define UNROLL_TWOFISH 54#define UNROLL_TWOFISH
55#endif 55#endif
56 56
57#if CRYPTOPP_BOOL_X64 && !defined(_UEFI) 57#if CRYPTOPP_BOOL_X64
58 58
59/* these are 64-bit assembly implementation taken from https://github.com/jkivilin/supercop-blockciphers 59/* these are 64-bit assembly implementation taken from https://github.com/jkivilin/supercop-blockciphers
60 Copyright © 2011-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi> 60 Copyright © 2011-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
@@ -630,7 +630,7 @@ void twofish_set_key(TwofishInstance *instance, const u4byte in_key[])
630 uint32 b = rotl32(MDSQ[0][Q[0][Q[0][Q[1][Q[1][i + 1] ^ key[28]] ^ key[20]] ^ key[12]] ^ key[4]] ^ MDSQ[1][Q[0][Q[1][Q[1][Q[0][i + 1] ^ key[29]] ^ key[21]] ^ key[13]] ^ key[5]] 630 uint32 b = rotl32(MDSQ[0][Q[0][Q[0][Q[1][Q[1][i + 1] ^ key[28]] ^ key[20]] ^ key[12]] ^ key[4]] ^ MDSQ[1][Q[0][Q[1][Q[1][Q[0][i + 1] ^ key[29]] ^ key[21]] ^ key[13]] ^ key[5]]
631 ^ MDSQ[2][Q[1][Q[0][Q[0][Q[0][i + 1] ^ key[30]] ^ key[22]] ^ key[14]] ^ key[6]] ^ MDSQ[3][Q[1][Q[1][Q[0][Q[1][i + 1] ^ key[31]] ^ key[23]] ^ key[15]] ^ key[7]], 8); 631 ^ MDSQ[2][Q[1][Q[0][Q[0][Q[0][i + 1] ^ key[30]] ^ key[22]] ^ key[14]] ^ key[6]] ^ MDSQ[3][Q[1][Q[1][Q[0][Q[1][i + 1] ^ key[31]] ^ key[23]] ^ key[15]] ^ key[7]], 8);
632 a += b; 632 a += b;
633#if CRYPTOPP_BOOL_X64 && !defined(_UEFI) 633#if CRYPTOPP_BOOL_X64
634 if (i < 8) 634 if (i < 8)
635 { 635 {
636 instance->w[i] = a; 636 instance->w[i] = a;
@@ -998,7 +998,7 @@ void twofish_set_key(TwofishInstance *instance, const u4byte in_key[])
998 998
999#ifndef TC_MINIMIZE_CODE_SIZE 999#ifndef TC_MINIMIZE_CODE_SIZE
1000 1000
1001#if (CRYPTOPP_BOOL_X64 == 0) || defined(_UEFI) 1001#if (CRYPTOPP_BOOL_X64 == 0)
1002void twofish_encrypt(TwofishInstance *ks, const u4byte in_blk[4], u4byte out_blk[4]) 1002void twofish_encrypt(TwofishInstance *ks, const u4byte in_blk[4], u4byte out_blk[4])
1003{ 1003{
1004 uint32* rk = ks->l_key; 1004 uint32* rk = ks->l_key;
@@ -1071,7 +1071,7 @@ void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte o
1071 1071
1072#ifndef TC_MINIMIZE_CODE_SIZE 1072#ifndef TC_MINIMIZE_CODE_SIZE
1073 1073
1074#if (CRYPTOPP_BOOL_X64 == 0) || defined(_UEFI) 1074#if (CRYPTOPP_BOOL_X64 == 0)
1075void twofish_decrypt(TwofishInstance *ks, const u4byte in_blk[4], u4byte out_blk[4]) 1075void twofish_decrypt(TwofishInstance *ks, const u4byte in_blk[4], u4byte out_blk[4])
1076{ 1076{
1077 uint32* rk = ks->l_key; 1077 uint32* rk = ks->l_key;
diff --git a/src/Crypto/Twofish.h b/src/Crypto/Twofish.h
index 57723138..b2d44ddb 100644
--- a/src/Crypto/Twofish.h
+++ b/src/Crypto/Twofish.h
@@ -35,7 +35,7 @@ extern "C"
35#endif 35#endif
36typedef struct 36typedef struct
37{ 37{
38#if CRYPTOPP_BOOL_X64 && !defined(_UEFI) 38#if CRYPTOPP_BOOL_X64
39 u4byte mk_tab[4][256], w[8], k[32]; 39 u4byte mk_tab[4][256], w[8], k[32];
40#else 40#else
41 u4byte l_key[40]; 41 u4byte l_key[40];
@@ -52,7 +52,7 @@ typedef struct
52 52
53/* in_key must be 32-bytes long */ 53/* in_key must be 32-bytes long */
54void twofish_set_key(TwofishInstance *instance, const u4byte in_key[]); 54void twofish_set_key(TwofishInstance *instance, const u4byte in_key[]);
55#if CRYPTOPP_BOOL_X64 && !defined(_UEFI) 55#if CRYPTOPP_BOOL_X64
56void twofish_encrypt_blocks(TwofishInstance *instance, const byte* in_blk, byte* out_blk, uint32 blockCount); 56void twofish_encrypt_blocks(TwofishInstance *instance, const byte* in_blk, byte* out_blk, uint32 blockCount);
57void twofish_decrypt_blocks(TwofishInstance *instance, const byte* in_blk, byte* out_blk, uint32 blockCount); 57void twofish_decrypt_blocks(TwofishInstance *instance, const byte* in_blk, byte* out_blk, uint32 blockCount);
58#define twofish_encrypt(instance,in_blk,out_blk) twofish_encrypt_blocks(instance, (const byte*) in_blk, (byte*) out_blk, 1) 58#define twofish_encrypt(instance,in_blk,out_blk) twofish_encrypt_blocks(instance, (const byte*) in_blk, (byte*) out_blk, 1)