Use integrity key during integritysetup format.

Kernel could reject HMAC without a key during format, we must set a key here as well.

Because there is no data area (device size is 8 sectors), it is actually never used,
so we can use zeroed key here.

The real HMAC key is used later during device activation with the real size.
This commit is contained in:
Milan Broz
2018-02-13 14:41:36 +01:00
parent 828e6f2077
commit 954214e48c

View File

@@ -275,7 +275,13 @@ int INTEGRITY_format(struct crypt_device *cd,
if (r)
return r;
/* There is no data area, we can actually use fake zeroed key */
if (params->integrity_key_size)
dmdi.u.integrity.vk = crypt_alloc_volume_key(params->integrity_key_size, NULL);
r = dm_create_device(cd, tmp_name, "INTEGRITY", &dmdi, 0);
crypt_free_volume_key(dmdi.u.integrity.vk);
if (r)
return r;