block: sed-opal: keyring support for SED keys

Extend the SED block driver so it can alternatively
obtain a key from a sed-opal kernel keyring. The SED
ioctls will indicate the source of the key, either
directly in the ioctl data or from the keyring.

This allows the use of SED commands in scripts such as
udev scripts so that drives may be automatically unlocked
as they become available.

Signed-off-by: Greg Joyce <gjoyce@linux.vnet.ibm.com>
Reviewed-by: Jonathan Derrick <jonathan.derrick@linux.dev>
Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20230721211534.3437070-4-gjoyce@linux.vnet.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Greg Joyce
2023-07-21 16:15:34 -05:00
committed by Jens Axboe
parent 5c82efc1ae
commit 3bfeb61256
4 changed files with 184 additions and 3 deletions

View File

@@ -49,10 +49,16 @@ enum opal_lock_flags {
OPAL_SAVE_FOR_LOCK = 0x01,
};
enum opal_key_type {
OPAL_INCLUDED = 0, /* key[] is the key */
OPAL_KEYRING, /* key is in keyring */
};
struct opal_key {
__u8 lr;
__u8 key_len;
__u8 __align[6];
__u8 key_type;
__u8 __align[5];
__u8 key[OPAL_KEY_MAX];
};