diff options
author | Jan Luebbe <jlu@pengutronix.de> | 2024-04-23 12:21:02 +0200 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2024-04-23 15:18:30 -0700 |
commit | 6f4501734f28f3133ad9ac70b8d320cca8b40c4e (patch) | |
tree | 8895b7046bb8f566ae3f55f1bf175cad173ea29a /meta-perl/recipes-perl/libalgorithm | |
parent | 94a65e3ff65f69bad8f34690ce1b36cb97b039c0 (diff) | |
download | meta-openembedded-6f4501734f28f3133ad9ac70b8d320cca8b40c4e.tar.gz |
Add class for appending dm-verity hash data to block device images
Add support to generate a dm-verity image and the parameters required to
assemble the corresponding table for the device-mapper driver. The latter will
be stored in the file ${DEPLOY_DIR_IMAGE}/<IMAGE_LINK_NAME>.verity-params.
Note that in the resulting image the hash tree data is appended to the contents
of the original image without an explicit superblock to keep things simple and
compact.
The above mentioned parameter file can be sourced by a shell to finally create
the desired blockdevice via "dmsetup" (found in meta-oe's recipe
"libdevmapper"), e.g.
. <IMAGE_LINK_NAME>.verity-params
dmsetup create <dm_dev_name> --readonly --table "0 $VERITY_DATA_SECTORS verity \
1 <dev> <hash_dev> \
$VERITY_DATA_BLOCK_SIZE $VERITY_HASH_BLOCK_SIZE \
$VERITY_DATA_BLOCKS $VERITY_DATA_BLOCKS \
$VERITY_HASH_ALGORITHM $VERITY_ROOT_HASH $VERITY_SALT \
1 ignore_zero_blocks"
As the hash tree data is found at the end of the image, <dev> and <hash_dev>
should be the same blockdevice in the command shown above while <dm_dev_name> is
the name of the to be created dm-verity-device.
The root hash is calculated using a salt to make attacks more difficult. Thus,
please grant each image recipe its own salt which could be generated e.g. via
dd if=/dev/random bs=1k count=1 | sha256sum
and assign it to the parameter VERITY_SALT.
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-perl/recipes-perl/libalgorithm')
0 files changed, 0 insertions, 0 deletions