buffer_size = hdr_file.payloadOffset << SECTOR_SHIFT;
if (r || buffer_size < LUKS_ALIGN_KEYSLOTS) {
- log_err(ctx, _("Backup file do not contain valid LUKS header.\n"));
+ log_err(ctx, _("Backup file doesn't contain valid LUKS header.\n"));
r = -EINVAL;
goto out;
}
close(devfd);
/* Be sure to reload new data */
- r = LUKS_read_phdr(device, hdr, 0, ctx);
+ r = LUKS_read_phdr(device, hdr, 1, ctx);
out:
if (devfd != -1)
close(devfd);
log_dbg("LUKS header not detected.");
if (require_luks_device)
log_err(ctx, _("Device %s is not a valid LUKS device.\n"), device);
- else
- set_error(_("Device %s is not a valid LUKS device."), device);
r = -EINVAL;
} else if((hdr->version = ntohs(hdr->version)) != 1) { /* Convert every uint16/32_t item from network byte order */
log_err(ctx, _("Unsupported LUKS version %d.\n"), hdr->version);
hdr->keyblock[keyIndex].keyMaterialOffset,
ctx);
if (r < 0) {
- if(!get_error())
- log_err(ctx, _("Failed to write to key storage.\n"));
+ log_err(ctx, _("Failed to write to key storage.\n"));
goto out;
}