bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2016-2018 Dovecot authors, see the included COPYING file */
df74b8f6ff432d9a26727669dfed9a15d77efb55Aki Tuomi const unsigned char *password, size_t password_len,
df74b8f6ff432d9a26727669dfed9a15d77efb55Aki Tuomi const unsigned char *password, size_t password_len,
df74b8f6ff432d9a26727669dfed9a15d77efb55Aki Tuomi size_t l = (length + hash->digest_size - 1)/hash->digest_size; /* same as ceil(length/hash->digest_size) */
df74b8f6ff432d9a26727669dfed9a15d77efb55Aki Tuomi unsigned int c,i,t;
df74b8f6ff432d9a26727669dfed9a15d77efb55Aki Tuomi for(t = 0; t < l; t++) {
df74b8f6ff432d9a26727669dfed9a15d77efb55Aki Tuomi /* U_1 = PRF(Password, Salt|| INT_BE32(Block_Number)) */
df74b8f6ff432d9a26727669dfed9a15d77efb55Aki Tuomi /* block = U_1 ^ .. ^ U_iter */
df74b8f6ff432d9a26727669dfed9a15d77efb55Aki Tuomi /* U_c = PRF(Password, U_c-1) */
df74b8f6ff432d9a26727669dfed9a15d77efb55Aki Tuomiint pkcs5_pbkdf(enum pkcs5_pbkdf_mode mode, const struct hash_method *hash,
df74b8f6ff432d9a26727669dfed9a15d77efb55Aki Tuomi const unsigned char *password, size_t password_len,