VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Crypto.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/Crypto.c')
-rw-r--r--src/Common/Crypto.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/Common/Crypto.c b/src/Common/Crypto.c
index 3b87572a..dd30e488 100644
--- a/src/Common/Crypto.c
+++ b/src/Common/Crypto.c
@@ -321,24 +321,28 @@ Cipher *CipherGet (int id)
321 return NULL; 321 return NULL;
322} 322}
323 323
324char *CipherGetName (int cipherId) 324const char *CipherGetName (int cipherId)
325{ 325{
326 return CipherGet (cipherId) -> Name; 326 Cipher* pCipher = CipherGet (cipherId);
327 return pCipher? pCipher -> Name : "";
327} 328}
328 329
329int CipherGetBlockSize (int cipherId) 330int CipherGetBlockSize (int cipherId)
330{ 331{
331 return CipherGet (cipherId) -> BlockSize; 332 Cipher* pCipher = CipherGet (cipherId);
333 return pCipher? pCipher -> BlockSize : 0;
332} 334}
333 335
334int CipherGetKeySize (int cipherId) 336int CipherGetKeySize (int cipherId)
335{ 337{
336 return CipherGet (cipherId) -> KeySize; 338 Cipher* pCipher = CipherGet (cipherId);
339 return pCipher? pCipher -> KeySize : 0;
337} 340}
338 341
339int CipherGetKeyScheduleSize (int cipherId) 342int CipherGetKeyScheduleSize (int cipherId)
340{ 343{
341 return CipherGet (cipherId) -> KeyScheduleSize; 344 Cipher* pCipher = CipherGet (cipherId);
345 return pCipher? pCipher -> KeyScheduleSize : 0;
342} 346}
343 347
344#ifndef TC_WINDOWS_BOOT 348#ifndef TC_WINDOWS_BOOT
@@ -715,15 +719,17 @@ int HashGetIdByName (char *name)
715} 719}
716 720
717 721
718char *HashGetName (int hashId) 722const char *HashGetName (int hashId)
719{ 723{
720 return HashGet (hashId) -> Name; 724 Hash* pHash = HashGet(hashId);
725 return pHash? pHash -> Name : "";
721} 726}
722 727
723 728
724BOOL HashIsDeprecated (int hashId) 729BOOL HashIsDeprecated (int hashId)
725{ 730{
726 return HashGet (hashId) -> Deprecated; 731 Hash* pHash = HashGet(hashId);
732 return pHash? pHash -> Deprecated : FALSE;
727} 733}
728 734
729 735