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

Adapt certain functions in the case of Windows bootloader in order to make its size as small as possible.

This commit is contained in:
Mounir IDRASSI
2014-09-04 17:21:11 +02:00
parent ccbc2cff0b
commit f7d783dda8
3 changed files with 44 additions and 5 deletions

View File

@@ -275,28 +275,47 @@ Cipher *CipherGet (int id)
return NULL; return NULL;
} }
const char *CipherGetName (int cipherId) #ifndef TC_WINDOWS_BOOT
const
#endif
char *CipherGetName (int cipherId)
{ {
#ifdef TC_WINDOWS_BOOT
return CipherGet (cipherId) -> Name;
#else
Cipher* pCipher = CipherGet (cipherId); Cipher* pCipher = CipherGet (cipherId);
return pCipher? pCipher -> Name : ""; return pCipher? pCipher -> Name : "";
#endif
} }
int CipherGetBlockSize (int cipherId) int CipherGetBlockSize (int cipherId)
{ {
#ifdef TC_WINDOWS_BOOT
return CipherGet (cipherId) -> BlockSize;
#else
Cipher* pCipher = CipherGet (cipherId); Cipher* pCipher = CipherGet (cipherId);
return pCipher? pCipher -> BlockSize : 0; return pCipher? pCipher -> BlockSize : 0;
#endif
} }
int CipherGetKeySize (int cipherId) int CipherGetKeySize (int cipherId)
{ {
#ifdef TC_WINDOWS_BOOT
return CipherGet (cipherId) -> KeySize;
#else
Cipher* pCipher = CipherGet (cipherId); Cipher* pCipher = CipherGet (cipherId);
return pCipher? pCipher -> KeySize : 0; return pCipher? pCipher -> KeySize : 0;
#endif
} }
int CipherGetKeyScheduleSize (int cipherId) int CipherGetKeyScheduleSize (int cipherId)
{ {
#ifdef TC_WINDOWS_BOOT
return CipherGet (cipherId) -> KeyScheduleSize;
#else
Cipher* pCipher = CipherGet (cipherId); Cipher* pCipher = CipherGet (cipherId);
return pCipher? pCipher -> KeyScheduleSize : 0; return pCipher? pCipher -> KeyScheduleSize : 0;
#endif
} }
#ifndef TC_WINDOWS_BOOT #ifndef TC_WINDOWS_BOOT
@@ -619,18 +638,28 @@ int HashGetIdByName (char *name)
return 0; return 0;
} }
#ifndef TC_WINDOWS_BOOT
const char *HashGetName (int hashId) const
#endif
char *HashGetName (int hashId)
{ {
#ifdef TC_WINDOWS_BOOT
return HashGet(hashId) -> Name;
#else
Hash* pHash = HashGet(hashId); Hash* pHash = HashGet(hashId);
return pHash? pHash -> Name : ""; return pHash? pHash -> Name : "";
#endif
} }
BOOL HashIsDeprecated (int hashId) BOOL HashIsDeprecated (int hashId)
{ {
#ifdef TC_WINDOWS_BOOT
return HashGet(hashId) -> Deprecated;
#else
Hash* pHash = HashGet(hashId); Hash* pHash = HashGet(hashId);
return pHash? pHash -> Deprecated : FALSE; return pHash? pHash -> Deprecated : FALSE;
#endif
} }

View File

@@ -250,7 +250,11 @@ int CipherGetBlockSize (int cipher);
int CipherGetKeySize (int cipher); int CipherGetKeySize (int cipher);
int CipherGetKeyScheduleSize (int cipher); int CipherGetKeyScheduleSize (int cipher);
BOOL CipherSupportsIntraDataUnitParallelization (int cipher); BOOL CipherSupportsIntraDataUnitParallelization (int cipher);
const char * CipherGetName (int cipher);
#ifndef TC_WINDOWS_BOOT
const
#endif
char * CipherGetName (int cipher);
int CipherInit (int cipher, unsigned char *key, unsigned char *ks); int CipherInit (int cipher, unsigned char *key, unsigned char *ks);
int EAInit (int ea, unsigned char *key, unsigned char *ks); int EAInit (int ea, unsigned char *key, unsigned char *ks);
@@ -283,7 +287,11 @@ int EAGetPreviousCipher (int ea, int previousCipherId);
int EAIsFormatEnabled (int ea); int EAIsFormatEnabled (int ea);
BOOL EAIsModeSupported (int ea, int testedMode); BOOL EAIsModeSupported (int ea, int testedMode);
const char *HashGetName (int hash_algo_id);
#ifndef TC_WINDOWS_BOOT
const
#endif
char *HashGetName (int hash_algo_id);
BOOL HashIsDeprecated (int hashId); BOOL HashIsDeprecated (int hashId);
int GetMaxPkcs5OutSize (void); int GetMaxPkcs5OutSize (void);

View File

@@ -140,7 +140,9 @@ void RMD160Final(unsigned char *digest, RMD160_CTX *ctx)
if (digest) { if (digest) {
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
PUT_32BIT_LE(digest + i * 4, ctx->state[i]); PUT_32BIT_LE(digest + i * 4, ctx->state[i]);
#ifndef TC_WINDOWS_BOOT
burn (ctx, sizeof(*ctx)); burn (ctx, sizeof(*ctx));
#endif
} }
} }