Change PBKDF insterface to allow forced iterations (time cost) count.

Also move functions to separate utils_pbkdf.c file.

PBKDF can be now set for any context.

TODO: new setting is not covered by tests.
This commit is contained in:
Milan Broz
2017-09-24 11:04:12 +02:00
parent a73bb733ff
commit 66db5b39bb
9 changed files with 325 additions and 207 deletions

View File

@@ -778,7 +778,7 @@ int LUKS_generate_phdr(struct luks_phdr *header,
}
/* Compute master key digest */
pbkdf = CONST_CAST(struct crypt_pbkdf_type *)crypt_get_pbkdf_type(ctx);
pbkdf = crypt_get_pbkdf(ctx);
r = crypt_benchmark_pbkdf_internal(ctx, pbkdf, vk->keylength);
if (r < 0)
return r;
@@ -869,7 +869,7 @@ int LUKS_set_key(unsigned int keyIndex,
}
log_dbg("Calculating data for key slot %d", keyIndex);
pbkdf = CONST_CAST(struct crypt_pbkdf_type *)crypt_get_pbkdf_type(ctx);
pbkdf = crypt_get_pbkdf(ctx);
r = crypt_benchmark_pbkdf_internal(ctx, pbkdf, vk->keylength);
if (r < 0)
return r;