I can create a dm-crypt filesystem with:
root@smarcimx8mq4g:~# cat /data/caam/randomkey | keyctl padd logon logkey: @s
731358804
root@smarcimx8mq4g:~# dmsetup -v create encrypted --table "0 $(blockdev --getsz /dev/mmcblk1p3) crypt capi:tk(cbc(aes))-plain :36:logon:logkey: 0 /dev/mmcblk1p3 0 1 sector_size:512"
(I'm using the imx8's CAAM's implementation of tk(cbc(aes))
.)
Unfortunately this wipes (or loses the ability to decode) the data in /dev/mmcblk1p3. I can use /dev/mapper/encrypted, but only once I've run mkfs.ext4 and mounted it.
I've also tried:
root@smarcimx8mq4g:~# dmsetup -v load encrypted --table "0 $(blockdev --getsz /dev/mmcblk1p3) crypt capi:tk(cbc(aes))-plain :36:logon:logkey: 0 /dev/mmcblk1p3 0 1 sector_size:512"
device-mapper: reload ioctl on encrypted failed: No such device or address
Command failed.
(I expect that nothing other than "create" will create the /dev/mapper/encrypted node.)
How do I use dm-crypt to get access to the original data?