VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Crypto.h
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-08-09 14:25:52 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-08-15 01:09:11 +0200
commite90e24b30b379752bf6531c663085de1d2a653d7 (patch)
tree6ff3a18a2e9dedb9e506d67f2c560e1c8f657e47 /src/Common/Crypto.h
parent0b2c8b09c6eb3ddce22fa88c34a640881f8f2177 (diff)
downloadVeraCrypt-e90e24b30b379752bf6531c663085de1d2a653d7.tar.gz
VeraCrypt-e90e24b30b379752bf6531c663085de1d2a653d7.zip
Windows: Add support for Streebog (hash) and kuznyechik (encryption)
Diffstat (limited to 'src/Common/Crypto.h')
-rw-r--r--src/Common/Crypto.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/Common/Crypto.h b/src/Common/Crypto.h
index 9b5fbace..abcdfa5b 100644
--- a/src/Common/Crypto.h
+++ b/src/Common/Crypto.h
@@ -54,6 +54,7 @@ enum
WHIRLPOOL,
SHA256,
RIPEMD160,
+ STREEBOG,
HASH_ENUM_END_ID
};
@@ -72,6 +73,9 @@ enum
#define WHIRLPOOL_BLOCKSIZE 64
#define WHIRLPOOL_DIGESTSIZE 64
+#define STREEBOG_BLOCKSIZE 64
+#define STREEBOG_DIGESTSIZE 64
+
#define MAX_DIGESTSIZE WHIRLPOOL_DIGESTSIZE
#define DEFAULT_HASH_ALGORITHM FIRST_PRF_ID
@@ -108,7 +112,8 @@ enum
SERPENT,
TWOFISH,
CAMELLIA,
- GOST89
+ GOST89,
+ KUZNYECHIK
};
typedef struct
@@ -162,9 +167,11 @@ typedef struct
# endif
#else
-
-#define MAX_EXPANDED_KEY (AES_KS + SERPENT_KS + TWOFISH_KS)
-
+#ifdef TC_WINDOWS_BOOT
+#define MAX_EXPANDED_KEY max((AES_KS + SERPENT_KS + TWOFISH_KS), CAMELLIA_KS)
+#else
+#define MAX_EXPANDED_KEY max(max(max((AES_KS + SERPENT_KS + TWOFISH_KS), GOST_KS), CAMELLIA_KS), KUZNYECHIK_KS)
+#endif
#endif
#ifdef DEBUG
@@ -190,7 +197,9 @@ typedef struct
#ifndef TC_WINDOWS_BOOT
# include "Sha2.h"
# include "Whirlpool.h"
+# include "Streebog.h"
# include "GostCipher.h"
+# include "kuznyechik.h"
# include "Camellia.h"
#else
# include "CamelliaSmall.h"
@@ -209,7 +218,7 @@ typedef struct keyInfo_t
int keyLength; /* Length of the key */
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 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;
@@ -231,8 +240,8 @@ typedef struct CRYPTO_INFO_t
GfCtx gf_ctx;
- unsigned __int8 master_keydata[MASTER_KEYDATA_SIZE]; /* This holds the volume header area containing concatenated master key(s) 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). */
- unsigned __int8 k2[MASTER_KEYDATA_SIZE]; /* For XTS, this contains the secondary key (if cascade, multiple concatenated). For LRW (deprecated/legacy), it contains the tweak key. For CBC (deprecated/legacy), it contains the IV seed. */
+ CRYPTOPP_ALIGN_DATA(16) unsigned __int8 master_keydata[MASTER_KEYDATA_SIZE]; /* This holds the volume header area containing concatenated master key(s) 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) unsigned __int8 k2[MASTER_KEYDATA_SIZE]; /* For XTS, this contains the secondary key (if cascade, multiple concatenated). For LRW (deprecated/legacy), it contains the tweak key. For CBC (deprecated/legacy), it contains the IV seed. */
unsigned __int8 salt[PKCS5_SALT_SIZE];
int noIterations;
BOOL bTrueCryptMode;