VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Pkcs5.h
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-02-22 00:23:19 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-02-22 01:03:19 +0100
commitcb9859fa0e061fa3b068447c3860588cf3522f4e (patch)
tree3e4e6fa8c279827863255c8894cffe9cb54a2fec /src/Common/Pkcs5.h
parent717ffadf931407bb2e5684f3fcdef86b37e8213a (diff)
downloadVeraCrypt-cb9859fa0e061fa3b068447c3860588cf3522f4e.tar.gz
VeraCrypt-cb9859fa0e061fa3b068447c3860588cf3522f4e.zip
Speed and memory usage optimization for key derivation based on patches by Nils Maier. 20% improvement on 64-bit CPU for SHA512 and SHA256, 11% for Whirlpool and 13% for RIPEMD-160.
Diffstat (limited to 'src/Common/Pkcs5.h')
-rw-r--r--src/Common/Pkcs5.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/Common/Pkcs5.h b/src/Common/Pkcs5.h
index d7ab90db..ef931397 100644
--- a/src/Common/Pkcs5.h
+++ b/src/Common/Pkcs5.h
@@ -18,19 +18,22 @@
extern "C"
{
#endif
-void hmac_sha256 (char *k, int lk, char *d, int ld, char *out);
-void derive_u_sha256 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b);
+/* output written to d which must be at lease 32 bytes long */
+void hmac_sha256 (char *k, int lk, char *d, int ld);
void derive_key_sha256 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen);
-void hmac_sha512 (char *k, int lk, char *d, int ld, char *out, int t);
-void derive_u_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b);
+/* output written to d which must be at lease 64 bytes long */
+void hmac_sha512 (char *k, int lk, char *d, int ld);
void derive_key_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen);
-void hmac_ripemd160 (char *key, int keylen, char *input, int len, char *digest);
-void derive_u_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b);
+
+/* output written to input_digest which must be at lease 20 bytes long */
+void hmac_ripemd160 (char *key, int keylen, char *input_digest, int len);
void derive_key_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen);
-void hmac_whirlpool (char *k, int lk, char *d, int ld, char *out, int t);
-void derive_u_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b);
+
+/* output written to d which must be at lease 64 bytes long */
+void hmac_whirlpool (char *k, int lk, char *d, int ld);
void derive_key_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen);
+
int get_pkcs5_iteration_count (int pkcs5_prf_id, BOOL truecryptMode, BOOL bBoot);
char *get_pkcs5_prf_name (int pkcs5_prf_id);