On Mon, 2021-02-01 at 11:36 +0000, David Howells wrote: > Jan Lübbe <jlu@xxxxxxxxxxxxxx> wrote: > > > ... But at this point, you can still do 'keyctl read' on that key, exposing > > the key material to user space. > > I wonder if it would help to provide a keyctl function to mark a key as being > permanently unreadable - so that it overrides the READ permission bit. > > Alternatively, you can disable READ and SETATTR permission - but that then > prevents you from removing other perms if you want to :-/ That would mean using user type keys, right? Then we'd still have the core problem how a master key can be protected against simply reading it from flash/disk, as it would be unencrypted in this scenario. Maybe a bit of background: We're looking at the trusted/encrypted keys because we want to store the key material in an encrypted format, only loadable into the same system where they were generated and only if that's in a trusted state (to solve the master key problem above). This binding can be done with trusted keys via a TPM (and soon with Sumit's OP- TEE backend, or later based on SoC-specific hardware like NXP's CAAM). In the OP-TEE/CAAM case, the bootloader would ensure that the backend can only be used when booting a correctly authenticated kernel. Of course, that's not as flexible as TPMs with a custom policy, but much simpler and a good fit for many embedded use-cases. Best regards, Jan Lübbe -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |