diff options
Diffstat (limited to 'src/Common/Pkcs5.c')
-rw-r--r-- | src/Common/Pkcs5.c | 25 |
1 files changed, 25 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 | |||
1209 | return 0; | 1209 | return 0; |
1210 | } | 1210 | } |
1211 | 1211 | ||
1212 | int is_pkcs5_prf_supported (int pkcs5_prf_id, BOOL truecryptMode, PRF_BOOT_TYPE bootType) | ||
1213 | { | ||
1214 | if (pkcs5_prf_id == 0) // auto-detection always supported | ||
1215 | return 1; | ||
1216 | |||
1217 | if (truecryptMode) | ||
1218 | { | ||
1219 | if ( (bootType == PRF_BOOT_GPT) | ||
1220 | || (bootType == PRF_BOOT_MBR && pkcs5_prf_id != RIPEMD160) | ||
1221 | || (bootType == PRF_BOOT_NO && pkcs5_prf_id != SHA512 && pkcs5_prf_id != WHIRLPOOL && pkcs5_prf_id != RIPEMD160) | ||
1222 | ) | ||
1223 | return 0; | ||
1224 | } | ||
1225 | else | ||
1226 | { | ||
1227 | if ( (bootType == PRF_BOOT_MBR && pkcs5_prf_id != RIPEMD160 && pkcs5_prf_id != SHA256) | ||
1228 | || (bootType != PRF_BOOT_MBR && (pkcs5_prf_id < FIRST_PRF_ID || pkcs5_prf_id > LAST_PRF_ID)) | ||
1229 | ) | ||
1230 | return 0; | ||
1231 | } | ||
1232 | |||
1233 | return 1; | ||
1234 | |||
1235 | } | ||
1236 | |||
1212 | #endif //!TC_WINDOWS_BOOT | 1237 | #endif //!TC_WINDOWS_BOOT |