VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Crypto/Twofish.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-12-07 09:35:10 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-12-07 12:36:08 +0100
commita0eadbd660b48931f7ff88bb9c1f708474ef7e69 (patch)
tree006f5c72e40d9a8b8182417c709567477cef00e2 /src/Crypto/Twofish.c
parentfb38269c89e0fadf51e6912d5a9e017d02833b34 (diff)
downloadVeraCrypt-a0eadbd660b48931f7ff88bb9c1f708474ef7e69.tar.gz
VeraCrypt-a0eadbd660b48931f7ff88bb9c1f708474ef7e69.zip
Windows: Don't use Twofish x64 assembly implementation for UEFI bootloader (for now, yasm is not integrated in EDKII framework).
Diffstat (limited to 'src/Crypto/Twofish.c')
-rw-r--r--src/Crypto/Twofish.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Crypto/Twofish.c b/src/Crypto/Twofish.c
index 16788378..23a5dfda 100644
--- a/src/Crypto/Twofish.c
+++ b/src/Crypto/Twofish.c
@@ -50,11 +50,11 @@
Botan is released under the Simplified BSD License (see license.txt)
*/
-#if !defined (_MSC_VER) || defined(_WIN64)
+#if !defined (_MSC_VER) || defined(_M_X64)
#define UNROLL_TWOFISH
#endif
-#if CRYPTOPP_BOOL_X64
+#if CRYPTOPP_BOOL_X64 && !defined(_UEFI)
/* these are 64-bit assembly implementation taken from https://github.com/jkivilin/supercop-blockciphers
Copyright © 2011-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
@@ -630,7 +630,7 @@ void twofish_set_key(TwofishInstance *instance, const u4byte in_key[])
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]]
^ 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);
a += b;
-#if CRYPTOPP_BOOL_X64
+#if CRYPTOPP_BOOL_X64 && !defined(_UEFI)
if (i < 8)
{
instance->w[i] = a;
@@ -998,7 +998,7 @@ void twofish_set_key(TwofishInstance *instance, const u4byte in_key[])
#ifndef TC_MINIMIZE_CODE_SIZE
-#if CRYPTOPP_BOOL_X64 == 0
+#if (CRYPTOPP_BOOL_X64 == 0) || defined(_UEFI)
void twofish_encrypt(TwofishInstance *ks, const u4byte in_blk[4], u4byte out_blk[4])
{
uint32* rk = ks->l_key;
@@ -1071,7 +1071,7 @@ void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte o
#ifndef TC_MINIMIZE_CODE_SIZE
-#if CRYPTOPP_BOOL_X64 == 0
+#if (CRYPTOPP_BOOL_X64 == 0) || defined(_UEFI)
void twofish_decrypt(TwofishInstance *ks, const u4byte in_blk[4], u4byte out_blk[4])
{
uint32* rk = ks->l_key;