All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bae, Chang Seok" <chang.seok.bae@intel.com>
To: "Lutomirski, Andy" <luto@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@suse.de>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	Ingo Molnar <mingo@kernel.org>,
	"the arch/x86 maintainers" <x86@kernel.org>,
	"herbert@gondor.apana.org.au" <herbert@gondor.apana.org.au>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"ebiggers@kernel.org" <ebiggers@kernel.org>,
	"Williams, Dan J" <dan.j.williams@intel.com>,
	"Gairuboyina, Charishma1" <charishma1.gairuboyina@intel.com>,
	"Dwarakanath, Kumar N" <kumar.n.dwarakanath@intel.com>,
	"Krishnakumar,
	Lalithambika" <lalithambika.krishnakumar@intel.com>,
	"Shankar, Ravi V" <ravi.v.shankar@intel.com>
Subject: Re: [PATCH v4 11/13] crypto: x86/aes-kl - Support AES algorithm using Key Locker instructions
Date: Fri, 7 Jan 2022 18:06:26 +0000	[thread overview]
Message-ID: <5BAC2E0A-63C9-4671-AB69-693F9C874395@intel.com> (raw)
In-Reply-To: <75ec3ad1-6234-ae1f-1b83-482793e4fd23@kernel.org>

On Dec 24, 2021, at 09:42, Andy Lutomirski <luto@kernel.org> wrote:
> 
> I find it a bit bizarre that this tries to be a drop-in replacement for normal
> AES.  Is this actually what we want, or do we want users to opt in to the KL
> implementation?
> 
> It seems like it might make more sense for tools like cryptsetup (or dm-crypt
> -- the actual layer is subject to some degree of debate) to explicitly create
> a key handle and then ask the kernel to use that key handle, not for the
> kernel to do this by magic.

Yeah, it is ideal to encode a key early but it was considered less significant
in terms of key protection versus doing it via setkey().

This opt-in looks to be the --cipher option specific and cryptsetup even
allows users to directly choose kernel’s crypto API via “capi:”.

I suspect in case a user wants to pick a specific crypto implementation via
“capi:”, one should have studied it.

But indeed, such question deserves more discussion here.

> What happens when someone applies your patches and runs dmsetup table
> --showkeys?

"dmsetup table --showkeys" [1] shows UUID that could be found when dumping the
master key by giving the passphrase, like [2]. The volume key in LUKS header
is under the user key.

> Why should the use of keylocker be part of the luksFormat operation? Surely a
> non-KL machine should still be able to decrypt a nominally KL-using volume in
> a pinch, for recovery purposes if nothing else.

I was trying to directly update cipher information in LUKS. But it was not
that smooth. But if it is possible in an acceptable way, decoding KL-volume
with a generic AES (or vice versa) should work. 

They both are AES data transformations so compatible with each other. This was
also tested by setting the default AES cipher in the LUKS then switching each
other by tweaking the priority.

On the bottom, the "reencrypt" option [3] allows updating a cipher in the LUKS
format. But maybe a better option like the above is possible.

Thanks,
Chang

[1]
$ sudo dmsetup table --showkeys /dev/mapper/volume
0 491520 crypt capi:xts-aes-aeskl-plain64 :32:logon:cryptsetup:8c12bfda-3570-406a-b4fe-5ecf1e91eecd-d0 0 7:17 32768

[2] 
$ sudo cryptsetup luksDump  --dump-master-key ./test

WARNING!
========
Header dump with volume key is sensitive information
which allows access to encrypted partition without passphrase.
This dump should be always stored encrypted on safe place.

Are you sure? (Type uppercase yes): YES
Enter passphrase for ./test:
LUKS header information for ./test
Cipher name:    capi:xts
Cipher mode:    aes-aeskl-plain64
Payload offset: 32768
UUID:           8c12bfda-3570-406a-b4fe-5ecf1e91eecd
MK bits:        256
MK dump:        3a 51 37 60 37 d2 58 9f 48 a7 ce 44 f7 ff de 34
               4d b9 6f eb f2 e7 d6 bc e0 c9 76 b6 3d b1 e6 24

[3] https://man7.org/linux/man-pages/man8/cryptsetup-reencrypt.8.html

  reply	other threads:[~2022-01-07 18:06 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-14  0:51 [PATCH v4 00/13] x86: Support Key Locker Chang S. Bae
2021-12-14  0:52 ` [PATCH v4 01/13] Documentation/x86: Document " Chang S. Bae
2021-12-14  0:52 ` [PATCH v4 02/13] x86/cpufeature: Enumerate Key Locker feature Chang S. Bae
2021-12-14  0:52 ` [PATCH v4 03/13] x86/insn: Add Key Locker instructions to the opcode map Chang S. Bae
2021-12-14  0:52 ` [PATCH v4 04/13] x86/asm: Add a wrapper function for the LOADIWKEY instruction Chang S. Bae
2021-12-14  0:52 ` [PATCH v4 05/13] x86/msr-index: Add MSRs for Key Locker internal wrapping key Chang S. Bae
2021-12-14  0:52 ` [PATCH v4 06/13] x86/keylocker: Define Key Locker CPUID leaf Chang S. Bae
2021-12-14  0:52 ` [PATCH v4 07/13] x86/cpu/keylocker: Load an internal wrapping key at boot-time Chang S. Bae
2021-12-14  0:52 ` [PATCH v4 08/13] x86/power/keylocker: Restore internal wrapping key from the ACPI S3/4 sleep states Chang S. Bae
2021-12-17 15:42   ` Rafael J. Wysocki
2021-12-22  4:58     ` Bae, Chang Seok
2021-12-14  0:52 ` [PATCH v4 09/13] x86/cpu: Add a configuration and command line option for Key Locker Chang S. Bae
2021-12-14  0:52 ` [PATCH v4 10/13] crypto: x86/aes - Prepare for a new AES implementation Chang S. Bae
2021-12-14  0:52 ` [PATCH v4 11/13] crypto: x86/aes-kl - Support AES algorithm using Key Locker instructions Chang S. Bae
2021-12-24 17:42   ` Andy Lutomirski
2022-01-07 18:06     ` Bae, Chang Seok [this message]
2021-12-14  0:52 ` [PATCH v4 12/13] crypto: x86/aes-kl - Support CBC mode Chang S. Bae
2021-12-14  0:52 ` [PATCH v4 13/13] crypto: x86/aes-kl - Support XTS mode Chang S. Bae
2021-12-16  1:09 ` [PATCH v4 00/13] x86: Support Key Locker Eric Biggers
2022-01-05 21:55   ` Bae, Chang Seok
2022-01-05 21:55     ` [dm-devel] " Bae, Chang Seok
2022-01-06  5:07     ` Eric Biggers
2022-01-06  5:07       ` [dm-devel] " Eric Biggers
2022-01-06  6:13       ` Bae, Chang Seok
2022-01-06  6:13         ` [dm-devel] " Bae, Chang Seok
2022-01-06 16:25       ` Milan Broz
2022-01-06 16:25         ` Milan Broz

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=5BAC2E0A-63C9-4671-AB69-693F9C874395@intel.com \
    --to=chang.seok.bae@intel.com \
    --cc=bp@suse.de \
    --cc=charishma1.gairuboyina@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=kumar.n.dwarakanath@intel.com \
    --cc=lalithambika.krishnakumar@intel.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=ravi.v.shankar@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.