VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-12-08 17:06:52 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-12-08 17:53:28 +0100
commit4262d4feb71aaade721ae5d06eec63ac07144a8f (patch)
tree2ea6df1dc4f31e7a6c11600b22f8e9a896b71b53 /src/Common
parente131d7a6070bbeb6b406fbaa54f8528e0dcace89 (diff)
downloadVeraCrypt-4262d4feb71aaade721ae5d06eec63ac07144a8f.tar.gz
VeraCrypt-4262d4feb71aaade721ae5d06eec63ac07144a8f.zip
Windows: Enhancement to favorites handling. Add PRF/TrueCryptMode fields in favorites management dialog, and use default mount parameters when mounting multiple favorites at once.
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Pkcs5.c25
-rw-r--r--src/Common/Pkcs5.h10
2 files changed, 35 insertions, 0 deletions
diff --git a/src/Common/Pkcs5.c b/src/Common/Pkcs5.c
index 753c49b4..1da5e237 100644
--- a/src/Common/Pkcs5.c
+++ b/src/Common/Pkcs5.c
@@ -1209,4 +1209,29 @@ int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL truecryptMode, BO
return 0;
}
+int is_pkcs5_prf_supported (int pkcs5_prf_id, BOOL truecryptMode, PRF_BOOT_TYPE bootType)
+{
+ if (pkcs5_prf_id == 0) // auto-detection always supported
+ return 1;
+
+ if (truecryptMode)
+ {
+ if ( (bootType == PRF_BOOT_GPT)
+ || (bootType == PRF_BOOT_MBR && pkcs5_prf_id != RIPEMD160)
+ || (bootType == PRF_BOOT_NO && pkcs5_prf_id != SHA512 && pkcs5_prf_id != WHIRLPOOL && pkcs5_prf_id != RIPEMD160)
+ )
+ return 0;
+ }
+ else
+ {
+ if ( (bootType == PRF_BOOT_MBR && pkcs5_prf_id != RIPEMD160 && pkcs5_prf_id != SHA256)
+ || (bootType != PRF_BOOT_MBR && (pkcs5_prf_id < FIRST_PRF_ID || pkcs5_prf_id > LAST_PRF_ID))
+ )
+ return 0;
+ }
+
+ return 1;
+
+}
+
#endif //!TC_WINDOWS_BOOT
diff --git a/src/Common/Pkcs5.h b/src/Common/Pkcs5.h
index 261df85d..2758bdf6 100644
--- a/src/Common/Pkcs5.h
+++ b/src/Common/Pkcs5.h
@@ -42,6 +42,16 @@ void derive_key_streebog (char *pwd, int pwd_len, char *salt, int salt_len, uint
int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL truecryptMode, BOOL bBoot);
wchar_t *get_pkcs5_prf_name (int pkcs5_prf_id);
+
+/* check if given PRF supported.*/
+typedef enum
+{
+ PRF_BOOT_NO = 0,
+ PRF_BOOT_MBR,
+ PRF_BOOT_GPT
+} PRF_BOOT_TYPE;
+
+int is_pkcs5_prf_supported (int pkcs5_prf_id, BOOL truecryptMode, PRF_BOOT_TYPE bootType);
#endif
#if defined(__cplusplus)