From a97b56cc32dd3e8b4105961eb6424c16775ecd3b Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Sun, 10 Jan 2010 20:40:41 +0000 Subject: [PATCH] Properly initialise gcrypt in format call. git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@171 36d66b0a-2a48-0410-832c-cd162a569da5 --- lib/setup.c | 6 ++++++ luks/keymanage.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/setup.c b/lib/setup.c index e66fcaf9..0aef8585 100644 --- a/lib/setup.c +++ b/lib/setup.c @@ -1134,6 +1134,12 @@ int crypt_format(struct crypt_device *cd, if (!type) return -EINVAL; + /* Some hash functions need initialized gcrypt library */ + if (init_crypto()) { + log_err(cd, _("Cannot initialize crypto backend.\n")); + return -ENOSYS; + } + if (volume_key) cd->volume_key = LUKS_alloc_masterkey(volume_key_size, volume_key); diff --git a/luks/keymanage.c b/luks/keymanage.c index 2533e4a7..729944df 100644 --- a/luks/keymanage.c +++ b/luks/keymanage.c @@ -391,7 +391,7 @@ static int LUKS_PBKDF2_performance_check(const char *hashSpec, { if (!*PBKDF2_per_sec) { if (PBKDF2_performance_check(hashSpec, PBKDF2_per_sec) < 0) { - log_err(ctx, _("Not compatible PBKDF2 options (using hash algorithm %s)."), hashSpec); + log_err(ctx, _("Not compatible PBKDF2 options (using hash algorithm %s).\n"), hashSpec); return -EINVAL; } log_dbg("PBKDF2: %" PRIu64 " iterations per second using hash %s.", *PBKDF2_per_sec, hashSpec);