dm-crypt.saout.de archive mirror
 help / color / mirror / Atom feed
* [dm-crypt] Using dm-verity+dm-crypt on rootfs (Embedded Linux)
@ 2020-08-07  9:15 Andrii Voloshyn
  2020-08-08  9:10 ` Milan Broz
  0 siblings, 1 reply; 2+ messages in thread
From: Andrii Voloshyn @ 2020-08-07  9:15 UTC (permalink / raw)
  To: dm-crypt

[-- Attachment #1: Type: text/plain, Size: 1244 bytes --]

Hi there,



      Spent quite some time looking on the Internet for a reference, and couldn't find anything that would satisfy my requirements.

Let's imagine an Embedded Linux setup, where size of the NOR flash is limited to say 16MB, root filesystem is squashfs, and assume

that the bootloader (U-Boot) is trusted, and it validates kernel+dts. Alright, now I need to check validity of the rootfs, plus it needs to be

encrypted, and failsafe  (in case power is gone while writing to the flash). So I guess, I need to use a combination dm-verity+dm-crypt?

      

      From my experiments, I found out that I couldn't really use LUKS, as the header size would not fit into the flash. So I need to use plain mode, and that's Ok.

      Now, the question is, what information to pass to the kernel, and how (bootargs?, initrd?), so that it could verify and mount encrypted squashfs as rootfs?

      Have seen a lot of articles how to get it done on a partition, USB drive, etc. but not as the rootfs.

Any reference on any project already existing or documentation would be helpful. Or, any thoughts on how it could be done differently?



Thank you for your wisdom



Cheers,

Andrew

[-- Attachment #2: Type: text/html, Size: 1789 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dm-crypt] Using dm-verity+dm-crypt on rootfs (Embedded Linux)
  2020-08-07  9:15 [dm-crypt] Using dm-verity+dm-crypt on rootfs (Embedded Linux) Andrii Voloshyn
@ 2020-08-08  9:10 ` Milan Broz
  0 siblings, 0 replies; 2+ messages in thread
From: Milan Broz @ 2020-08-08  9:10 UTC (permalink / raw)
  To: Andrii Voloshyn, dm-crypt

On 07/08/2020 11:15, Andrii Voloshyn wrote:
> Hi there,
> 
>       Spent quite some time looking on the Internet for a reference, and couldn't find anything that would satisfy my requirements.
> Let's imagine an Embedded Linux setup, where size of the NOR flash is limited to say 16MB, root filesystem is squashfs, and assume
> that the bootloader (U-Boot) is trusted, and it validates kernel+dts. Alright, now I need to check validity of the rootfs, plus it needs to be
> encrypted, and failsafe  (in case power is gone while writing to the flash). So I guess, I need to use a combination dm-verity+dm-crypt?

You can use that, but dm-verity is read-only device (but that;s what you awant here, I guess). Then all you need is to properly store and sign dm-verity root hash.

DM-verity here provides data integrity, dm-crypt then confidentiality protection.

>      
>       From my experiments, I found out that I couldn't really use LUKS, as the header size would not fit into the flash. So I need to use plain mode, and that's Ok.

You can, LUKS2 header can be scaled down to be even smaller than LUKS1. Did you try that? Activation will be much simpler for you later.

Seems we do not have it in FAQ yet, but the idea is described here
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=932437#10

>       Now, the question is, what information to pass to the kernel, and how (bootargs?, initrd?), so that it could verify and mount encrypted squashfs as rootfs?
>       Have seen a lot of articles how to get it done on a partition, USB drive, etc. but not as the rootfs.
> Any reference on any project already existing or documentation would be helpful. Or, any thoughts on how it could be done differently?

I think you are reinventing what Android and ChromeOS is doing already ;-)

Milan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-08  9:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-07  9:15 [dm-crypt] Using dm-verity+dm-crypt on rootfs (Embedded Linux) Andrii Voloshyn
2020-08-08  9:10 ` Milan Broz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).