mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-12 03:10:08 +01:00
Properly initialise crypto backend in header backup/restore commands. (fixes issue #49)
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@190 36d66b0a-2a48-0410-832c-cd162a569da5
This commit is contained in:
12
lib/setup.c
12
lib/setup.c
@@ -1213,6 +1213,12 @@ int crypt_header_backup(struct crypt_device *cd,
|
||||
if ((requested_type && !isLUKS(requested_type)) || !backup_file)
|
||||
return -EINVAL;
|
||||
|
||||
/* Some hash functions need initialized gcrypt library */
|
||||
if (init_crypto()) {
|
||||
log_err(cd, _("Cannot initialize crypto backend.\n"));
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
log_dbg("Requested header backup of device %s (%s) to "
|
||||
"file %s.", cd->device, requested_type, backup_file);
|
||||
|
||||
@@ -1226,6 +1232,12 @@ int crypt_header_restore(struct crypt_device *cd,
|
||||
if (requested_type && !isLUKS(requested_type))
|
||||
return -EINVAL;
|
||||
|
||||
/* Some hash functions need initialized gcrypt library */
|
||||
if (init_crypto()) {
|
||||
log_err(cd, _("Cannot initialize crypto backend.\n"));
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
log_dbg("Requested header restore to device %s (%s) from "
|
||||
"file %s.", cd->device, requested_type, backup_file);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user