Message ID | 20211214005212.20588-1-chang.seok.bae@intel.com (mailing list archive) |
---|---|
Headers | show |
Series | x86: Support Key Locker | expand |
On Mon, Dec 13, 2021 at 04:51:59PM -0800, Chang S. Bae wrote: > == Disk Encryption Use Case == > > Disk encryption uses Key Locker to mitigate key exfiltration as follows: > > 1. Configuration for Key Locker: AES-KL shows up in /proc/crypto as a > distinct cipher option. From there, tools like cryptsetup [5] can select > AES-KL vs AES-NI. For example, > > $ cryptsetup luksFormat --cipher="capi:xts-aes-aeskl-plain" <device> plain64 is supposed to be used these days, not plain. > Note: AES-KL has a performance tradeoff. See details in 'Performance' > below. > > 2. Disk encryption flow with key protection: > > * The cryptsetup utility is responsible for loading the volume key into the > kernel's keyring and passing a reference of the key. Once dm-crypt [6] > has set up the volume, user space is responsible for invalidating the key > material so that only the key handle remains in memory. Cryptsetup does > this, e.g. via crypt_free_volume_key() and crypt_safe_free(). > > * The AES-KL code in the kernel's crypto library uses the key handle > instead of the actual clear text key. > > == Non Use Cases == > > Bare metal disk encryption is the only use case intended by these patches. Since dm-crypt is the use case for these patches, you probably should CC this patchset to dm-devel@redhat.com so that the dm-crypt developers are aware of it. > +-----------+---------------+---------------+ > | Cipher | Encryption | Decryption | > | (AES-KL) | (MiB/s) | (MiB/s) | > +-----------+---------------+---------------+ > | AES-CBC | 505.3 | 2097.8 | > | AES-XTS | 1130 | 696.4 | > +-----------+-------------------------------+ Why is AES-XTS decryption so much slower than AES-XTS encryption? They should be about the same. Also, is the AES-CBC support really useful, given that for disk encryption, AES-XTS is recommended over AES-CBC these days? - Eric
On Dec 15, 2021, at 17:09, Eric Biggers <ebiggers@kernel.org> wrote: > On Mon, Dec 13, 2021 at 04:51:59PM -0800, Chang S. Bae wrote: >> == Disk Encryption Use Case == <snip> >> $ cryptsetup luksFormat --cipher="capi:xts-aes-aeskl-plain" <device> > > plain64 is supposed to be used these days, not plain. I see. >> == Non Use Cases == >> >> Bare metal disk encryption is the only use case intended by these patches. > > Since dm-crypt is the use case for these patches, you probably should CC this > patchset to dm-devel@redhat.com so that the dm-crypt developers are aware of it. Oh, I should have included them. I was not aware of this mailing address. Hi DM-crypt folks, Here is the patch series: https://lore.kernel.org/lkml/20211214005212.20588-1-chang.seok.bae@intel.com/t/ I would appreciate if you give any feedback on this feature’s use case with yours. >> +-----------+---------------+---------------+ >> | Cipher | Encryption | Decryption | >> | (AES-KL) | (MiB/s) | (MiB/s) | >> +-----------+---------------+---------------+ >> | AES-CBC | 505.3 | 2097.8 | >> | AES-XTS | 1130 | 696.4 | >> +-----------+-------------------------------+ > > Why is AES-XTS decryption so much slower than AES-XTS encryption? They should > be about the same. Analyzing and understanding this with specific hardware implementation takes time for us. Will come back and update you when we have anything to share here. > Also, is the AES-CBC support really useful, given that for disk encryption, > AES-XTS is recommended over AES-CBC these days? Yes, we understand that AES-XTS is the primary option for disk encryption. But it seems that AES-CBC had been used for disk encryption, [1]: Comparing XTS to CBC for hard disk encryption If a storage device vendor is seeking FIPS 140-2 certification today, they will typically use CBC encryption, or even ECB. CBC is a good mode, ... As long as it is factual that the mode was once popular, it can help somebody who wants to use Key Locker for an old disk image I think. Thanks, Chang [1] https://csrc.nist.gov/CSRC/media/Projects/Block-Cipher-Techniques/documents/BCM/Comments/XTS/XTS_comments-Ball.pdf
On Wed, Jan 05, 2022 at 09:55:17PM +0000, Bae, Chang Seok wrote: > >> +-----------+---------------+---------------+ > >> | Cipher | Encryption | Decryption | > >> | (AES-KL) | (MiB/s) | (MiB/s) | > >> +-----------+---------------+---------------+ > >> | AES-CBC | 505.3 | 2097.8 | > >> | AES-XTS | 1130 | 696.4 | > >> +-----------+-------------------------------+ > > > > Why is AES-XTS decryption so much slower than AES-XTS encryption? They should > > be about the same. > > Analyzing and understanding this with specific hardware implementation takes > time for us. Will come back and update you when we have anything to share here. Note that for disk encryption, decryption performance is usually more important than encryption performance. So your performance results are strange. > > Also, is the AES-CBC support really useful, given that for disk encryption, > > AES-XTS is recommended over AES-CBC these days? > > Yes, we understand that AES-XTS is the primary option for disk encryption. > > But it seems that AES-CBC had been used for disk encryption, [1]: > > Comparing XTS to CBC for hard disk encryption > If a storage device vendor is seeking FIPS 140-2 certification today, > they will typically use CBC encryption, or even ECB. CBC is a good > mode, ... That document is very old. XTS has been NIST-approved for over a decade now. > > As long as it is factual that the mode was once popular, it can help somebody > who wants to use Key Locker for an old disk image I think. AES-CBC is/was usually used with ESSIV, in which case the key cannot be fully protected by Key Locker. I'm not sure you should bother to support legacy use cases, especially since it might mislead users into choosing a worse algorithm. - Eric
On Jan 5, 2022, at 21:07, Eric Biggers <ebiggers@kernel.org> wrote: > On Wed, Jan 05, 2022 at 09:55:17PM +0000, Bae, Chang Seok wrote: >> >> As long as it is factual that the mode was once popular, it can help somebody >> who wants to use Key Locker for an old disk image I think. > > AES-CBC is/was usually used with ESSIV, in which case the key cannot be fully > protected by Key Locker. > > I'm not sure you should bother to support legacy use cases, especially since it > might mislead users into choosing a worse algorithm. Alright, this is not that critical as it will be possible to add this mode later when needed. Thanks, Chang
On 06/01/2022 06:07, Eric Biggers wrote: > On Wed, Jan 05, 2022 at 09:55:17PM +0000, Bae, Chang Seok wrote: >>>> +-----------+---------------+---------------+ >>>> | Cipher | Encryption | Decryption | >>>> | (AES-KL) | (MiB/s) | (MiB/s) | >>>> +-----------+---------------+---------------+ >>>> | AES-CBC | 505.3 | 2097.8 | >>>> | AES-XTS | 1130 | 696.4 | >>>> +-----------+-------------------------------+ >>> >>> Why is AES-XTS decryption so much slower than AES-XTS encryption? They should >>> be about the same. >> >> Analyzing and understanding this with specific hardware implementation takes >> time for us. Will come back and update you when we have anything to share here. > > Note that for disk encryption, decryption performance is usually more important > than encryption performance. So your performance results are strange. If the test results are from "cryptsetup benchmark", it just run benchmark through userspace crypto API (AF_ALG) - no dm-crypt is involved at all. Proper test with dm-crypt should be run to get some numbers too. (But the test results are really strange... there is no reason decryption should be slower for XTS.) Also you mention that > Bare metal disk encryption is the only use case intended by these patches. > Userspace usage is not supported because there is no ABI provided to > communicate and coordinate wrapping-key restore failures to userspace. The cryptsetup benchmark is userspace use (just with kernel netlink access to kernel crypto). So I am not sure if these number are so important. Milan