1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 02:58:02 -06:00

Windows: reduce size of MBR bootloader by removing unused functions in each build type.

This commit is contained in:
Mounir IDRASSI
2017-07-21 15:21:13 +02:00
parent 0fb2befe3a
commit ff871511af
8 changed files with 36 additions and 77 deletions

View File

@@ -393,17 +393,13 @@ const wchar_t *CipherGetName (int cipherId)
Cipher* pCipher = CipherGet (cipherId);
return pCipher? pCipher -> Name : L"";
}
#endif
int CipherGetBlockSize (int cipherId)
{
#ifdef TC_WINDOWS_BOOT
return CipherGet (cipherId) -> BlockSize;
#else
Cipher* pCipher = CipherGet (cipherId);
return pCipher? pCipher -> BlockSize : 0;
#endif
}
#endif
int CipherGetKeySize (int cipherId)
{
@@ -451,6 +447,7 @@ int EAGetFirst ()
return 1;
}
#ifndef TC_WINDOWS_BOOT
// Returns number of EAs
int EAGetCount (void)
{
@@ -462,6 +459,7 @@ int EAGetCount (void)
}
return count;
}
#endif
int EAGetNext (int previousEA)
{
@@ -593,6 +591,8 @@ int EAGetKeySize (int ea)
}
#ifndef TC_WINDOWS_BOOT
// Returns the first mode of operation of EA
int EAGetFirstMode (int ea)
{
@@ -612,9 +612,6 @@ int EAGetNextMode (int ea, int previousModeId)
return 0;
}
#ifndef TC_WINDOWS_BOOT
// Returns the name of the mode of operation of the whole EA
wchar_t *EAGetModeName (int ea, int mode, BOOL capitalLetters)
{
@@ -645,38 +642,7 @@ int EAGetKeyScheduleSize (int ea)
return size;
}
// Returns the largest key size needed by an EA for the specified mode of operation
int EAGetLargestKeyForMode (int mode)
{
int ea, key = 0;
for (ea = EAGetFirst (); ea != 0; ea = EAGetNext (ea))
{
if (!EAIsModeSupported (ea, mode))
continue;
if (EAGetKeySize (ea) >= key)
key = EAGetKeySize (ea);
}
return key;
}
// Returns the largest key needed by any EA for any mode
int EAGetLargestKey ()
{
int ea, key = 0;
for (ea = EAGetFirst (); ea != 0; ea = EAGetNext (ea))
{
if (EAGetKeySize (ea) >= key)
key = EAGetKeySize (ea);
}
return key;
}
#ifndef TC_WINDOWS_BOOT
// Returns number of ciphers in EA
int EAGetCipherCount (int ea)
@@ -687,6 +653,7 @@ int EAGetCipherCount (int ea)
return i - 1;
}
#endif
int EAGetFirstCipher (int ea)
{
@@ -732,18 +699,16 @@ int EAGetPreviousCipher (int ea, int previousCipherId)
return 0;
}
#ifndef TC_WINDOWS_BOOT
int EAIsFormatEnabled (int ea)
{
return EncryptionAlgorithms[ea].FormatEnabled;
}
#ifndef TC_WINDOWS_BOOT
int EAIsMbrSysEncEnabled (int ea)
{
return EncryptionAlgorithms[ea].MbrSysEncEnabled;
}
#endif
// Returns TRUE if the mode of operation is supported for the encryption algorithm
BOOL EAIsModeSupported (int ea, int testedMode)
@@ -758,7 +723,6 @@ BOOL EAIsModeSupported (int ea, int testedMode)
return FALSE;
}
#ifndef TC_WINDOWS_BOOT
Hash *HashGet (int id)
{
int i;
@@ -810,6 +774,22 @@ BOOL HashForSystemEncryption (int hashId)
}
// Returns the largest key size needed by an EA for the specified mode of operation
int EAGetLargestKeyForMode (int mode)
{
int ea, key = 0;
for (ea = EAGetFirst (); ea != 0; ea = EAGetNext (ea))
{
if (!EAIsModeSupported (ea, mode))
continue;
if (EAGetKeySize (ea) >= key)
key = EAGetKeySize (ea);
}
return key;
}
// Returns the maximum number of bytes necessary to be generated by the PBKDF2 (PKCS #5)
int GetMaxPkcs5OutSize (void)
{