Support init_by_name for verity.

This commit is contained in:
Milan Broz
2012-06-08 16:38:26 +02:00
parent cdae1b4c60
commit ce2218ed65
9 changed files with 344 additions and 121 deletions

View File

@@ -190,7 +190,7 @@ int VERITY_activate(struct crypt_device *cd,
return 0;
dmd.target = DM_VERITY;
dmd.u.verity.data_device = crypt_get_device_name(cd);
dmd.data_device = crypt_get_device_name(cd);
dmd.u.verity.hash_device = hash_device;
dmd.u.verity.root_hash = root_hash;
dmd.u.verity.root_hash_size = root_hash_size;
@@ -198,13 +198,14 @@ int VERITY_activate(struct crypt_device *cd,
dmd.flags = CRYPT_ACTIVATE_READONLY;
dmd.size = verity_hdr->data_size * verity_hdr->data_block_size / 512;
dmd.uuid = NULL;
dmd.u.verity.vp = verity_hdr;
r = device_check_and_adjust(cd, dmd.u.verity.data_device, DEV_EXCL,
r = device_check_and_adjust(cd, dmd.data_device, DEV_EXCL,
&dmd.size, &offset, &dmd.flags);
if (r)
return r;
r = dm_create_device(name, CRYPT_VERITY, &dmd, verity_hdr, 0);
r = dm_create_device(name, CRYPT_VERITY, &dmd, 0);
if (!r && !(dm_flags() & DM_VERITY_SUPPORTED)) {
log_err(cd, _("Kernel doesn't support dm-verity mapping.\n"));
return -ENOTSUP;