The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Milan Broz <gmazyland@gmail.com>
To: Linlin Zhang <linlin.zhang@oss.qualcomm.com>,
	Mikulas Patocka <mpatocka@redhat.com>,
	Eric Biggers <ebiggers@kernel.org>
Cc: Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>,
	Benjamin Marzinski <bmarzins@redhat.com>,
	Neeraj Soni <neeraj.soni@oss.qualcomm.com>,
	dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/1] dm-inlinecrypt: add support for hardware-wrapped keys
Date: Sat, 16 May 2026 14:17:59 +0200	[thread overview]
Message-ID: <3b57685a-09b4-473a-8810-bbb46769ab42@gmail.com> (raw)
In-Reply-To: <20260516115045.3958326-2-linlin.zhang@oss.qualcomm.com>

On 5/16/26 1:50 PM, Linlin Zhang wrote:
> Add support for hardware-wrapped encryption keys to the
> dm-inlinecrypt target.
> 
> Introduce a new parameter <is_wrappedkey> to indicate whether
> the provided key is a raw key or a hardware-wrapped key. Based
> on this flag, the appropriate blk-crypto key type is selected
> when initializing the key.
> 
> This allows dm-inlinecrypt to work with hardware that requires
> keys to be wrapped and managed by the underlying inline
> encryption engine.
> 
> Update the target argument parsing accordingly and pass the
> key type to blk_crypto_init_key(). Documentation is also
> updated to reflect the new parameter and usage.
> 
> Signed-off-by: Linlin Zhang <linlin.zhang@oss.qualcomm.com>
> ---
>   .../device-mapper/dm-inlinecrypt.rst          | 10 ++-
>   drivers/md/dm-inlinecrypt.c                   | 71 +++++++++++--------
>   2 files changed, 50 insertions(+), 31 deletions(-)
> 
> diff --git a/Documentation/admin-guide/device-mapper/dm-inlinecrypt.rst b/Documentation/admin-guide/device-mapper/dm-inlinecrypt.rst
> index c71e600efb76..3a4ce2c5f228 100644
> --- a/Documentation/admin-guide/device-mapper/dm-inlinecrypt.rst
> +++ b/Documentation/admin-guide/device-mapper/dm-inlinecrypt.rst
> @@ -10,7 +10,7 @@ https://docs.kernel.org/block/inline-encryption.html
>   
>   Parameters::
>   
> -	      <cipher> <key> <iv_offset> <device path> \
> +	      <cipher> <key> <is_wrappedkey> <iv_offset> <device path> \
>   	      <offset> [<#opt_params> <opt_params>]

Please use optional parameter.
Adding mandatory field will introduce unnecessary incompatibility with dm-crypt mappings.
(The idea was that you can simply switch "crypt" to "inlinecrypt" for raw keys.)

I would probably just add "hw-wrapped" or "keytype=raw|hw-wrapped" optional argument
(with raw as default, so no need so specify it).

IOW the mapping will look like this (1 is number of optional parameters):

    <cipher> <key> <iv_offset> <device path> <offset> 1 hw-wrapped
or
    <cipher> <key> <iv_offset> <device path> <offset> 1 keytype=hw-wrapped

The second option will allow to add new key type much easier.

Please check how other targets implement it, some dm-crypt examples
https://gitlab.com/cryptsetup/cryptsetup/-/wikis/DMCrypt

Thanks,
Milan


  reply	other threads:[~2026-05-16 12:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-16 11:50 [PATCH v2 0/1] dm-inlinecrypt: add support for hardware-wrapped keys Linlin Zhang
2026-05-16 11:50 ` [PATCH v2 1/1] " Linlin Zhang
2026-05-16 12:17   ` Milan Broz [this message]
2026-05-18  8:11     ` Linlin Zhang
2026-05-18 12:37       ` Mikulas Patocka
2026-05-22  5:56         ` Linlin Zhang
2026-05-18 12:49       ` Milan Broz
2026-05-22  5:57         ` Linlin Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3b57685a-09b4-473a-8810-bbb46769ab42@gmail.com \
    --to=gmazyland@gmail.com \
    --cc=agk@redhat.com \
    --cc=bmarzins@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=ebiggers@kernel.org \
    --cc=linlin.zhang@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=neeraj.soni@oss.qualcomm.com \
    --cc=snitzer@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox