diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-11-15 11:15:41 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-11-15 11:15:41 +0100 |
commit | 21e61c8dedd7161e6e4a7e150623e767aa091359 (patch) | |
tree | c59710475b111e890a9637fdaecd4a24012802ff /src/Common/Pkcs5.c | |
parent | fc4a54418044263c3173ff9bb793fad698b89cda (diff) | |
download | VeraCrypt-21e61c8dedd7161e6e4a7e150623e767aa091359.tar.gz VeraCrypt-21e61c8dedd7161e6e4a7e150623e767aa091359.zip |
Windows: Fix warning in driver build by make get_pkcs5_iteration_count have a single return statement at the end
Diffstat (limited to 'src/Common/Pkcs5.c')
-rw-r--r-- | src/Common/Pkcs5.c | 76 |
1 files changed, 36 insertions, 40 deletions
diff --git a/src/Common/Pkcs5.c b/src/Common/Pkcs5.c index 3e98ed40..ef4d0c68 100644 --- a/src/Common/Pkcs5.c +++ b/src/Common/Pkcs5.c @@ -1179,53 +1179,49 @@ wchar_t *get_pkcs5_prf_name (int pkcs5_prf_id) -int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL bBoot) +int get_pkcs5_iteration_count(int pkcs5_prf_id, int pim, BOOL bBoot) { - if ( (pim < 0) - ) - { - return 0; - } + int iteration_count = 0; - switch (pkcs5_prf_id) + if (pim >= 0) { - - case BLAKE2S: - if (pim == 0) - return bBoot? 200000 : 500000; - else + switch (pkcs5_prf_id) { - return bBoot? pim * 2048 : 15000 + pim * 1000; + case BLAKE2S: + if (pim == 0) + iteration_count = bBoot ? 200000 : 500000; + else + iteration_count = bBoot ? pim * 2048 : 15000 + pim * 1000; + break; + + case SHA512: + iteration_count = (pim == 0) ? 500000 : 15000 + pim * 1000; + break; + + case WHIRLPOOL: + iteration_count = (pim == 0) ? 500000 : 15000 + pim * 1000; + break; + + case SHA256: + if (pim == 0) + iteration_count = bBoot ? 200000 : 500000; + else + iteration_count = bBoot ? pim * 2048 : 15000 + pim * 1000; + break; + + case STREEBOG: + if (pim == 0) + iteration_count = bBoot ? 200000 : 500000; + else + iteration_count = bBoot ? pim * 2048 : 15000 + pim * 1000; + break; + + default: + TC_THROW_FATAL_EXCEPTION; // Unknown/wrong ID } - - case SHA512: - return ((pim == 0)? 500000 : 15000 + pim * 1000); - - case WHIRLPOOL: - return ((pim == 0)? 500000 : 15000 + pim * 1000); - - case SHA256: - if (pim == 0) - return bBoot? 200000 : 500000; - else - { - return bBoot? pim * 2048 : 15000 + pim * 1000; - } - - case STREEBOG: - if (pim == 0) - return bBoot? 200000 : 500000; - else - { - return bBoot? pim * 2048 : 15000 + pim * 1000; - } - - default: - TC_THROW_FATAL_EXCEPTION; // Unknown/wrong ID } - return 0; - + return iteration_count; } int is_pkcs5_prf_supported (int pkcs5_prf_id, PRF_BOOT_TYPE bootType) |