answered
2018-03-10 20:01:46 +0200
Analysis from a user's perspective:
Yes, there is something severely broken in cryptsetup-1.7.5+git1-1.2.1 from Jolla's mer-tools repository for SFOS 2.1.4.14 and 2.2.0.29 (at least on Jolla 1 phones).
Any Cryptsetup action (e.g. luksFormat or --type plain open) always fails, regardless of the chosen cryptography and other options, with (using -v or --debug, but the latter does not reveal more):
Cannot initialize crypto backend.
Command failed with code 22: Invalid argument
IOW, solely cryptsetup --help works with cryptsetup-1.7.5+git1-1.2.1.
Furthermore the crypto configuration of the kernel and kernel module seems to be inconsistent between device models under SailfishOS versions up to (and including) 2.2.0
On a Jolla 1, the kernel module qcrypto.ko (in /lib/modules/version/kernel/drivers/crypto/msm/) has to be explicitly loaded to enable the cryptographic chaining mode XTS, while the built-in kernel module cbc.ko for the chaining mode CBC (see cat /lib/modules/version/modules.builtin | fgrep cbc) seems to be automatically loaded on demand and the modules providing most classic cryptography algorithms are loaded by default (or something else already triggered them to be loaded on demand).
On Xperia X though, all cryptography kernel modules seem to be loaded by default (I don't have one, hence this is just a guess from information NielDK provided).
Dear sailors, please scrutinise and resolve this also, by loading the various kernel modules providing the common cryptography algorithms AES (-128 & -256), SHA-256, SHA-1, CBC(AES), XTS(AES) and ESSIV (supposedly eseqiv and / or chainiv) either on demand or by default, on all devices.
Workaround:
Either before or after updating to SailfishOS 2.2.0 or 2.1.4, remove Cryptsetup completely with:
pkcon remove cryptsetup-luks cryptsetup cryptsetup-libs libcryptsetup4
After updating to SFOS 2.2.0 / 2.1.4, install Cryptsetup 1.6.4 (compiled and packaged by NielDK):
curl -O https://openrepos.net/sites/default/files/packages/500/cryptsetup-1.6.4-1.armv7hl.rpm
curl -O https://openrepos.net/sites/default/files/packages/500/libcryptsetup4-1.6.4-1.armv7hl.rpm
pkcon install-local libcryptsetup4-1.6.4-1.armv7hl.rpm cryptsetup-1.6.4-1.armv7hl.rpm
# Enter "y" to confirm installing
When Jolla provides a fixed Cryptsetup in their mer-tools repository (newer than cryptsetup-1.7.5+git1-1.2.1), you may install it with:
pkcon remove cryptsetup libcryptsetup4
# Remove NielDK's Cryptsetup, as the library package name does not match
pkcon install cryptsetup
# Must have Jolla's mer-tools repository enabled for this with: ssu ar mer-tools
A mere 1 MB (2048 * 512 Bytes) test file will not work with LUKS, as it is way too small (the LUKS header alone needs 2 MB by default).
You may try:
olf ( 2018-02-21 12:36:42 +0200 )editThanks for the feedback and fixed. This isn't the point though, I would be happy if cryptsetup complained that the file is too small as the crypto backed would have been initialised. Can you please convert this into a comment as it doesn't work very well as an answer?
gabriel ( 2018-02-21 13:07:12 +0200 )editJust tested with my build of cryptsetup. This is not reproducible with my build 2.0.1) Works as expected on SFOS X https://build.merproject.org/package/show/home:nielnielsen/cryptfs
Nieldk ( 2018-02-21 17:49:29 +0200 )editNieldk, this affects 2.1.4.x. It also works up to 2.1.3.x.
gabriel ( 2018-02-21 17:50:59 +0200 )editMy device is on SFOS X 2.1.4.13 Cryptsetup version (mine) is 2.0.1
Nieldk ( 2018-02-21 18:00:08 +0200 )edit