VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2014-07-20 12:30:58 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2014-11-08 23:21:35 +0100
commita5c1978eefe2fd0dbf1ab6b7cdcb019a9b913a40 (patch)
treebb48f3b5544dc218228d368a7e893a83f0c0b059 /src/Common
parent75f780871949e5bacca4718507e66c8d28d72e69 (diff)
downloadVeraCrypt-a5c1978eefe2fd0dbf1ab6b7cdcb019a9b913a40.tar.gz
VeraCrypt-a5c1978eefe2fd0dbf1ab6b7cdcb019a9b913a40.zip
Remove remaining legacy cryptographic algorithms that are never used by VeraCrypt.
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Crypto.h3
-rw-r--r--src/Common/Dlgcode.c10
-rw-r--r--src/Common/Pkcs5.h3
-rw-r--r--src/Common/Tests.h1
4 files changed, 0 insertions, 17 deletions
diff --git a/src/Common/Crypto.h b/src/Common/Crypto.h
index f183a436..e66ac18c 100644
--- a/src/Common/Crypto.h
+++ b/src/Common/Crypto.h
@@ -45,43 +45,40 @@ extern "C" {
// The first PRF to try when mounting
#define FIRST_PRF_ID 1
// Hash algorithms (pseudorandom functions).
enum
{
RIPEMD160 = FIRST_PRF_ID,
#ifndef TC_WINDOWS_BOOT
SHA512,
WHIRLPOOL,
#endif
HASH_ENUM_END_ID
};
// The last PRF to try when mounting and also the number of implemented PRFs
#define LAST_PRF_ID (HASH_ENUM_END_ID - 1)
#define RIPEMD160_BLOCKSIZE 64
#define RIPEMD160_DIGESTSIZE 20
-#define SHA1_BLOCKSIZE 64
-#define SHA1_DIGESTSIZE 20
-
#define SHA512_BLOCKSIZE 128
#define SHA512_DIGESTSIZE 64
#define WHIRLPOOL_BLOCKSIZE 64
#define WHIRLPOOL_DIGESTSIZE 64
#define MAX_DIGESTSIZE WHIRLPOOL_DIGESTSIZE
#define DEFAULT_HASH_ALGORITHM FIRST_PRF_ID
#define DEFAULT_HASH_ALGORITHM_BOOT RIPEMD160
// The mode of operation used for newly created volumes and first to try when mounting
#define FIRST_MODE_OF_OPERATION_ID 1
// Modes of operation
enum
{
/* If you add/remove a mode, update the following: GetMaxPkcs5OutSize(), EAInitMode() */
XTS = FIRST_MODE_OF_OPERATION_ID,
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index b40a41cd..092c8c6f 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -4336,56 +4336,50 @@ static BOOL PerformBenchmark(HWND hwndDlg)
{
EncryptDataUnits (lpTestBuffer, &startDataUnitNo, (TC_LARGEST_COMPILER_UINT) benchmarkBufferSize / ENCRYPTION_DATA_UNIT_SIZE, ci);
DecryptDataUnits (lpTestBuffer, &startDataUnitNo, (TC_LARGEST_COMPILER_UINT) benchmarkBufferSize / ENCRYPTION_DATA_UNIT_SIZE, ci);
}
}
}
#endif
#if HASH_FNC_BENCHMARKS
/* Measures the speed at which each of the hash algorithms processes the message to produce
a single digest.
The hash algorithm benchmarks are included here for development purposes only. Do not enable
them when building a public release (the benchmark GUI strings wouldn't make sense). */
{
BYTE *digest [MAX_DIGESTSIZE];
WHIRLPOOL_CTX wctx;
RMD160_CTX rctx;
- sha1_ctx sctx;
sha512_ctx s2ctx;
int hid;
for (hid = FIRST_PRF_ID; hid <= LAST_PRF_ID; hid++)
{
if (QueryPerformanceCounter (&performanceCountStart) == 0)
goto counter_error;
switch (hid)
{
- case SHA1:
- sha1_begin (&sctx);
- sha1_hash (lpTestBuffer, benchmarkBufferSize, &sctx);
- sha1_end ((unsigned char *) digest, &sctx);
- break;
case SHA512:
sha512_begin (&s2ctx);
sha512_hash (lpTestBuffer, benchmarkBufferSize, &s2ctx);
sha512_end ((unsigned char *) digest, &s2ctx);
break;
case RIPEMD160:
RMD160Init(&rctx);
RMD160Update(&rctx, lpTestBuffer, benchmarkBufferSize);
RMD160Final((unsigned char *) digest, &rctx);
break;
case WHIRLPOOL:
WHIRLPOOL_init (&wctx);
WHIRLPOOL_add (lpTestBuffer, benchmarkBufferSize * 8, &wctx);
WHIRLPOOL_finalize (&wctx, (unsigned char *) digest);
break;
}
@@ -4407,44 +4401,40 @@ static BOOL PerformBenchmark(HWND hwndDlg)
/* Measures the time that it takes for the PKCS-5 routine to derive a header key using
each of the implemented PRF algorithms.
The PKCS-5 benchmarks are included here for development purposes only. Do not enable
them when building a public release (the benchmark GUI strings wouldn't make sense). */
{
int thid, i;
char dk[MASTER_KEYDATA_SIZE];
char *tmp_salt = {"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF\x01\x23\x45\x67\x89\xAB\xCD\xEF\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF\x01\x23\x45\x67\x89\xAB\xCD\xEF\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF"};
for (thid = FIRST_PRF_ID; thid <= LAST_PRF_ID; thid++)
{
if (QueryPerformanceCounter (&performanceCountStart) == 0)
goto counter_error;
for (i = 1; i <= 5; i++)
{
switch (thid)
{
- case SHA1:
- /* PKCS-5 test with HMAC-SHA-1 used as the PRF */
- derive_key_sha1 ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, FALSE), dk, MASTER_KEYDATA_SIZE);
- break;
case SHA512:
/* PKCS-5 test with HMAC-SHA-512 used as the PRF */
derive_key_sha512 ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, FALSE), dk, MASTER_KEYDATA_SIZE);
break;
case RIPEMD160:
/* PKCS-5 test with HMAC-RIPEMD-160 used as the PRF */
derive_key_ripemd160 (FALSE, "passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, FALSE), dk, MASTER_KEYDATA_SIZE);
break;
case WHIRLPOOL:
/* PKCS-5 test with HMAC-Whirlpool used as the PRF */
derive_key_whirlpool ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, FALSE), dk, MASTER_KEYDATA_SIZE);
break;
}
}
if (QueryPerformanceCounter (&performanceCountEnd) == 0)
goto counter_error;
diff --git a/src/Common/Pkcs5.h b/src/Common/Pkcs5.h
index 5a286fb5..148a3e2d 100644
--- a/src/Common/Pkcs5.h
+++ b/src/Common/Pkcs5.h
@@ -5,37 +5,34 @@
Agreement for Encryption for the Masses'. Modifications and additions to
the original source code (contained in this file) and all other portions
of this file are Copyright (c) 2003-2008 TrueCrypt Developers Association
and are governed by the TrueCrypt License 3.0 the full text of which is
contained in the file License.txt included in TrueCrypt binary and source
code distribution packages. */
#ifndef TC_HEADER_PKCS5
#define TC_HEADER_PKCS5
#include "Tcdefs.h"
#if defined(__cplusplus)
extern "C"
{
#endif
void hmac_sha512 (char *k, int lk, char *d, int ld, char *out, int t);
void derive_u_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b);
void derive_key_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen);
-void hmac_sha1 (char *k, int lk, char *d, int ld, char *out, int t);
-void derive_u_sha1 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b);
-void derive_key_sha1 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen);
void hmac_ripemd160 (char *key, int keylen, char *input, int len, char *digest);
void derive_u_ripemd160 (BOOL bNotTest, char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b);
void derive_key_ripemd160 (BOOL bNotTest, char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen);
void hmac_whirlpool (char *k, int lk, char *d, int ld, char *out, int t);
void derive_u_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b);
void derive_key_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen);
int get_pkcs5_iteration_count (int pkcs5_prf_id, BOOL bBoot);
char *get_pkcs5_prf_name (int pkcs5_prf_id);
#if defined(__cplusplus)
}
#endif
#endif // TC_HEADER_PKCS5
diff --git a/src/Common/Tests.h b/src/Common/Tests.h
index cd8aaf4c..e98ae884 100644
--- a/src/Common/Tests.h
+++ b/src/Common/Tests.h
@@ -1,30 +1,29 @@
/*
Legal Notice: Some portions of the source code contained in this file were
derived from the source code of Encryption for the Masses 2.02a, which is
Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License
Agreement for Encryption for the Masses'. Modifications and additions to
the original source code (contained in this file) and all other portions
of this file are Copyright (c) 2003-2008 TrueCrypt Developers Association
and are governed by the TrueCrypt License 3.0 the full text of which is
contained in the file License.txt included in TrueCrypt binary and source
code distribution packages. */
#ifdef __cplusplus
extern "C" {
#endif
extern unsigned char ks_tmp[MAX_EXPANDED_KEY];
void CipherInit2(int cipher, void* key, void* ks, int key_len);
BOOL test_hmac_sha512 (void);
-BOOL test_hmac_sha1 (void);
BOOL test_hmac_ripemd160 (void);
BOOL test_hmac_whirlpool (void);
BOOL test_pkcs5 (void);
BOOL TestSectorBufEncryption ();
BOOL TestLegacySectorBufEncryption ();
BOOL AutoTestAlgorithms (void);
#ifdef __cplusplus
}
#endif