VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Crypto.h
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-12-31 23:48:39 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-01-02 23:14:59 (GMT)
commit4181283f2968ccd3efe2fa3b9e49f5b70d174926 (patch)
treed63f974b8734e1a34610528d851b8d402ff5a887 /src/Common/Crypto.h
parentbb66dac8e677e44050367c97404d10f73e992a3c (diff)
downloadVeraCrypt-4181283f2968ccd3efe2fa3b9e49f5b70d174926.zip
VeraCrypt-4181283f2968ccd3efe2fa3b9e49f5b70d174926.tar.gz
Cryptography: Set 16-byte alignment for KEY_INFO structure that is used as input for Whirlpool hash. This helps improve performance.
Diffstat (limited to 'src/Common/Crypto.h')
-rw-r--r--src/Common/Crypto.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Common/Crypto.h b/src/Common/Crypto.h
index 5153976..a28084a 100644
--- a/src/Common/Crypto.h
+++ b/src/Common/Crypto.h
@@ -191,15 +191,22 @@ typedef struct
#include "GfMul.h"
#include "Password.h"
+#ifndef TC_WINDOWS_BOOT
+
+#include "config.h"
+
typedef struct keyInfo_t
{
int noIterations; /* Number of times to iterate (PKCS-5) */
int keyLength; /* Length of the key */
- __int8 userKey[MAX_PASSWORD]; /* Password (to which keyfiles may have been applied). WITHOUT +1 for the null terminator. */
+ uint64 dummy; /* Dummy field to ensure 16-byte alignment of this structure */
__int8 salt[PKCS5_SALT_SIZE]; /* PKCS-5 salt */
__int8 master_keydata[MASTER_KEYDATA_SIZE]; /* Concatenated master primary and secondary key(s) (XTS mode). For LRW (deprecated/legacy), it contains the tweak key before the master key(s). For CBC (deprecated/legacy), it contains the IV seed before the master key(s). */
+ CRYPTOPP_ALIGN_DATA(16) __int8 userKey[MAX_PASSWORD]; /* Password (to which keyfiles may have been applied). WITHOUT +1 for the null terminator. */
} KEY_INFO, *PKEY_INFO;
+#endif
+
typedef struct CRYPTO_INFO_t
{
int ea; /* Encryption algorithm ID */
@@ -273,7 +280,9 @@ typedef struct BOOT_CRYPTO_HEADER_t
#endif
PCRYPTO_INFO crypto_open (void);
+#ifndef TC_WINDOWS_BOOT
void crypto_loadkey (PKEY_INFO keyInfo, char *lpszUserKey, int nUserKeyLen);
+#endif
void crypto_close (PCRYPTO_INFO cryptoInfo);
int CipherGetBlockSize (int cipher);