mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-12 19:30:04 +01:00
Open device in locked mode if needed.
This commit is contained in:
committed by
Milan Broz
parent
a4d236eebe
commit
e229f79741
@@ -181,6 +181,9 @@ int LUKS_encrypt_to_storage(char *src, size_t srcLength,
|
|||||||
r = -EIO;
|
r = -EIO;
|
||||||
|
|
||||||
/* Write buffer to device */
|
/* Write buffer to device */
|
||||||
|
if (device_is_locked(device))
|
||||||
|
devfd = device_open_locked(ctx, device, O_RDWR);
|
||||||
|
else
|
||||||
devfd = device_open(ctx, device, O_RDWR);
|
devfd = device_open(ctx, device, O_RDWR);
|
||||||
if (devfd < 0)
|
if (devfd < 0)
|
||||||
goto out;
|
goto out;
|
||||||
@@ -238,6 +241,9 @@ int LUKS_decrypt_from_storage(char *dst, size_t dstLength,
|
|||||||
log_dbg(ctx, "Using userspace crypto wrapper to access keyslot area.");
|
log_dbg(ctx, "Using userspace crypto wrapper to access keyslot area.");
|
||||||
|
|
||||||
/* Read buffer from device */
|
/* Read buffer from device */
|
||||||
|
if (device_is_locked(device))
|
||||||
|
devfd = device_open_locked(ctx, device, O_RDONLY);
|
||||||
|
else
|
||||||
devfd = device_open(ctx, device, O_RDONLY);
|
devfd = device_open(ctx, device, O_RDONLY);
|
||||||
if (devfd < 0) {
|
if (devfd < 0) {
|
||||||
log_err(ctx, _("Cannot open device %s."), device_path(device));
|
log_err(ctx, _("Cannot open device %s."), device_path(device));
|
||||||
|
|||||||
Reference in New Issue
Block a user