Skip to contentSkip to conversation

crypto: xts: regression in 4.10

PATCH In review Nicolas Porcel 5 participants 8 messages Feb 21, 2017 – Mar 10, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello,

I am using aes-xts-plain64 with LUKS headers to crypt the root. In 4.10, the partition cannot be opened and I have the following errors when booting:

device-mapper: table: 253:0: crypt: Error allocating crypto tfm
device-mapper: ioctl: error adding target to table
device-mapper: reload ioctl on failed: No such file or directory Failed to setup dm-crypt key mapping for device /dev/mmcblk0p2
Check that the kernel supports aes-xts-plain64 cipher (check syslog for more info)

I found that this commit is responsible for the regression (reverting it solves the problem):

Quoted 5 lines

commit f1c131b45410a202eb45cc55980a7a9e4e4b4f40

Author: Herbert Xu <[email protected]>
Date:   Tue Nov 22 20:08:19 2016 +0800

crypto: xts - Convert to skcipher

Some precision: I am using the vanilla kernel source for 4.10. The aes, xts and dm-crypt modules are directly compiled in the kernel and not as modules. I also had the same problem with kernel 4.10-rc*.

Is it a known issue? I found 1 related email with no answer on the dm-crypt mailing. If this is a regression, I can start digging, although any guidance would be greatly appreciated.

Thank you in advance,

Best regards,

Signature · 1 line
Nicolas Porcel
#1 lore raw
Quoted 19 lines · Nicolas Porcel

Hello,

I am using aes-xts-plain64 with LUKS headers to crypt the root. In 4.10, the partition cannot be opened and I have the following errors when booting:

device-mapper: table: 253:0: crypt: Error allocating crypto tfm
device-mapper: ioctl: error adding target to table
device-mapper: reload ioctl on failed: No such file or directory Failed to setup dm-crypt key mapping for device /dev/mmcblk0p2
Check that the kernel supports aes-xts-plain64 cipher (check syslog for more info)

I found that this commit is responsible for the regression (reverting it solves the problem):

Quoted 4 lines

commit f1c131b45410a202eb45cc55980a7a9e4e4b4f40

Author: Herbert Xu <[email protected]>
Date:   Tue Nov 22 20:08:19 2016 +0800
Quoted 5 lines
Quoted 1 line

crypto: xts - Convert to skcipher

Some precision: I am using the vanilla kernel source for 4.10. The aes, xts and dm-crypt modules are directly compiled in the kernel and not as modules. I also had the same problem with kernel 4.10-rc*.

Kernel 4.10 works with LUKS and XTS in general (otherwise I would scream much earlier:-)

I guess either there is a bug in some specific dependency missing dependency in kernel config. Could you send your kernel .config that fails?

Do you have ECB mode compiled-in as well?

(See commit description, shouldn't XTS now select ECB as well? This seems to me like a bug...)

Quoted 3 lines

Is it a known issue? I found 1 related email with no answer on the dm-crypt mailing. If this is a regression, I can start digging, although any guidance would be greatly appreciated.

What mail on dmcrypt list? I do not see any recent mail.

Milan

#2 lore raw
Quoted 1 line · Milan Broz

Kernel 4.10 works with LUKS and XTS in general (otherwise I would scream much earlier:-)

I was surprised that it was still broken in the mainline release. All the other regressions I had have been fixed. Also, I guess LUKS with aes-xts is quite standard.

Quoted 4 lines

I guess either there is a bug in some specific dependency missing dependency in kernel config. Could you send your kernel .config that fails?

Do you have ECB mode compiled-in as well?

Nice guess. I had ECB enabled as a module, and I don't think it was present in the initramfs. Compiling it in the kernel solves the problem. Thanks for the clue!

I now have the xts(ecb(aes-generic)) driver appearing in /proc/crypto. I had no xts driver before.

I don't think it's necessary now to copy my kernel config. Also, it's quite minimalist: make defconfig with a few drivers I need, mostly compiled in the kernel.

Quoted 2 lines

(See commit description, shouldn't XTS now select ECB as well? This seems to me like a bug...)

I was actually confused by the message, I thought it would fallback to the old implementation. I guess the XTS module should select ECB if that's not the case. Should I submit a patch for that? Or maybe it would be easier if a maintainer directly makes the change?

Quoted 1 line

What mail on dmcrypt list? I do not see any recent mail.

It was a mail from 2012, I should be more careful with search engines...

Signature · 1 line
Nicolas Porcel
#3 lore raw
In reply to Nicolas Porcel

What XTS implementations do you have available on /proc/crypto after the error?

Some drivers that allocate fallback implementations using the older API started to fail after the generic templates were converted to skcipher.

Quoted 35 lines · Nicolas Porcel

Hello,

I am using aes-xts-plain64 with LUKS headers to crypt the root. In 4.10, the partition cannot be opened and I have the following errors when booting:

device-mapper: table: 253:0: crypt: Error allocating crypto tfm
device-mapper: ioctl: error adding target to table
device-mapper: reload ioctl on failed: No such file or directory Failed to setup dm-crypt key mapping for device /dev/mmcblk0p2
Check that the kernel supports aes-xts-plain64 cipher (check syslog for more info)

I found that this commit is responsible for the regression (reverting it solves the problem):

Quoted 5 lines

commit f1c131b45410a202eb45cc55980a7a9e4e4b4f40

Author: Herbert Xu <[email protected]>
Date:   Tue Nov 22 20:08:19 2016 +0800

crypto: xts - Convert to skcipher

Some precision: I am using the vanilla kernel source for 4.10. The aes, xts and dm-crypt modules are directly compiled in the kernel and not as modules. I also had the same problem with kernel 4.10-rc*.

Is it a known issue? I found 1 related email with no answer on the dm-crypt mailing. If this is a regression, I can start digging, although any guidance would be greatly appreciated.

Thank you in advance,

Best regards,

Signature · 1 line
Nicolas Porcel
Signature · 2 lines
Regards,
Marcelo
#4 lore raw

PATCH 1/1 crypto: Add ECB dependency for XTS mode

In reply to Nicolas Porcel

Since the
commit f1c131b45410a202eb45cc55980a7a9e4e4b4f40
crypto: xts - Convert to skcipher
the XTS mode is based on ECB, so the mode must select ECB otherwise it can fail to initialize.

---
 crypto/Kconfig | 1 +
 1 file changed, 1 insertion(+)
crypto/Kconfig +1 -0
index 160f08e721cc..9c245eb0dd83 100644
@@ -374,6 +374,7 @@ config CRYPTO_XTS
 	select CRYPTO_BLKCIPHER
 	select CRYPTO_MANAGER
 	select CRYPTO_GF128MUL
+	select CRYPTO_ECB
 	help
 	  XTS: IEEE1619/D16 narrow block cipher use with aes-xts-plain,
 	  key size 256, 384 or 512 bits. This implementation currently
Signature · 1 line
2.11.0
maintainer
#5 lore raw

Re: [PATCH] crypto: Add ECB dependency for XTS mode

Quoted 7 lines · Milan Broz

Since the
commit f1c131b45410a202eb45cc55980a7a9e4e4b4f40
crypto: xts - Convert to skcipher
the XTS mode is based on ECB, so the mode must select ECB otherwise it can fail to initialize.

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#6 lore raw

Re: [PATCH] crypto: Add ECB dependency for XTS mode

In reply to Milan Broz

Patch below should be backported to 4.10 stable (only 4.10, older kernels are ok).
We have reports some systems fail to boot from LUKS now (missing ecb module in initramdisk) ...

Upstream commit is 12cb3a1c4184f891d965d1f39f8cfcc9ef617647

Thanks,
Milan

Quoted 24 lines · Milan Broz

Since the
commit f1c131b45410a202eb45cc55980a7a9e4e4b4f40
crypto: xts - Convert to skcipher
the XTS mode is based on ECB, so the mode must select ECB otherwise it can fail to initialize.

---
 crypto/Kconfig | 1 +
 1 file changed, 1 insertion(+)
crypto/Kconfig +1 -0
index 160f08e721cc..9c245eb0dd83 100644
@@ -374,6 +374,7 @@ config CRYPTO_XTS
 	select CRYPTO_BLKCIPHER
 	select CRYPTO_MANAGER
 	select CRYPTO_GF128MUL
+	select CRYPTO_ECB
 	help
 	  XTS: IEEE1619/D16 narrow block cipher use with aes-xts-plain,
 	  key size 256, 384 or 512 bits. This implementation currently
#7 lore raw

Re: [PATCH] crypto: Add ECB dependency for XTS mode

Quoted 6 lines · Milan Broz

Patch below should be backported to 4.10 stable (only 4.10, older kernels are ok).
We have reports some systems fail to boot from LUKS now (missing ecb module in initramdisk) ...

Upstream commit is 12cb3a1c4184f891d965d1f39f8cfcc9ef617647

Now queued up, thanks.

greg k-h