diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2014-09-04 17:21:11 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2014-11-08 23:23:19 +0100 |
commit | f7d783dda8405cb2c930932749ee187d127eddf2 (patch) | |
tree | ac8eb34eae968da2597cc7099115a313879b5854 | |
parent | ccbc2cff0bf76f1f0d62e1778e83342e526e5eed (diff) | |
download | VeraCrypt-f7d783dda8405cb2c930932749ee187d127eddf2.tar.gz VeraCrypt-f7d783dda8405cb2c930932749ee187d127eddf2.zip |
Adapt certain functions in the case of Windows bootloader in order to make its size as small as possible.
-rw-r--r-- | src/Common/Crypto.c | 35 | ||||
-rw-r--r-- | src/Common/Crypto.h | 12 | ||||
-rw-r--r-- | src/Crypto/Rmd160.c | 2 |
3 files changed, 44 insertions, 5 deletions
diff --git a/src/Common/Crypto.c b/src/Common/Crypto.c index d8f8ae3a..f57bea44 100644 --- a/src/Common/Crypto.c +++ b/src/Common/Crypto.c @@ -275,28 +275,47 @@ Cipher *CipherGet (int id) 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);
return pCipher? pCipher -> Name : "";
+#endif
}
int CipherGetBlockSize (int cipherId)
{
+#ifdef TC_WINDOWS_BOOT
+ return CipherGet (cipherId) -> BlockSize;
+#else
Cipher* pCipher = CipherGet (cipherId);
return pCipher? pCipher -> BlockSize : 0;
+#endif
}
int CipherGetKeySize (int cipherId)
{
+#ifdef TC_WINDOWS_BOOT
+ return CipherGet (cipherId) -> KeySize;
+#else
Cipher* pCipher = CipherGet (cipherId);
return pCipher? pCipher -> KeySize : 0;
+#endif
}
int CipherGetKeyScheduleSize (int cipherId)
{
+#ifdef TC_WINDOWS_BOOT
+ return CipherGet (cipherId) -> KeyScheduleSize;
+#else
Cipher* pCipher = CipherGet (cipherId);
return pCipher? pCipher -> KeyScheduleSize : 0;
+#endif
}
#ifndef TC_WINDOWS_BOOT
@@ -619,18 +638,28 @@ int HashGetIdByName (char *name) return 0;
}
-
-const char *HashGetName (int hashId)
+#ifndef TC_WINDOWS_BOOT
+const
+#endif
+char *HashGetName (int hashId)
{
+#ifdef TC_WINDOWS_BOOT
+ return HashGet(hashId) -> Name;
+#else
Hash* pHash = HashGet(hashId);
return pHash? pHash -> Name : "";
+#endif
}
BOOL HashIsDeprecated (int hashId)
{
+#ifdef TC_WINDOWS_BOOT
+ return HashGet(hashId) -> Deprecated;
+#else
Hash* pHash = HashGet(hashId);
return pHash? pHash -> Deprecated : FALSE;
+#endif
}
diff --git a/src/Common/Crypto.h b/src/Common/Crypto.h index ac925094..651da737 100644 --- a/src/Common/Crypto.h +++ b/src/Common/Crypto.h @@ -250,7 +250,11 @@ int CipherGetBlockSize (int cipher); int CipherGetKeySize (int cipher);
int CipherGetKeyScheduleSize (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 EAInit (int ea, unsigned char *key, unsigned char *ks);
@@ -283,7 +287,11 @@ int EAGetPreviousCipher (int ea, int previousCipherId); int EAIsFormatEnabled (int ea);
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);
int GetMaxPkcs5OutSize (void);
diff --git a/src/Crypto/Rmd160.c b/src/Crypto/Rmd160.c index f90bf296..7441dd7d 100644 --- a/src/Crypto/Rmd160.c +++ b/src/Crypto/Rmd160.c @@ -140,7 +140,9 @@ void RMD160Final(unsigned char *digest, RMD160_CTX *ctx) if (digest) {
for (i = 0; i < 5; i++)
PUT_32BIT_LE(digest + i * 4, ctx->state[i]);
+#ifndef TC_WINDOWS_BOOT
burn (ctx, sizeof(*ctx));
+#endif
}
}
|