Thank you very much. I think I'm close here. I didn't try cryptsetup-openssl yet but I was able to get program on cryptsetup. After the system reboot I started to get success on my commands but still with some errors.
I made two volumes on my flash drive: sda1 and sda2. I installed Entware on sda1. And I'm trying to crypt sda2 now. So I do:
cryptsetup --verbose --debug -y --key-size 256 luksFormat /dev/sda2
And I get:
admin@RT-AC86U-C828:/tmp/home/root# cryptsetup --verbose --debug -y --key-size 2
56 luksFormat /dev/sda2
# cryptsetup 1.7.5 processing "cryptsetup --verbose --debug -y --key-size 256 luksFormat /dev/sda2"
# Running command luksFormat.
# Locking memory.
# Installing SIGINT/SIGTERM handler.
# Unblocking interruption on signal.
WARNING!
========
This will overwrite data on /dev/sda2 irrevocably.
Are you sure? (Type uppercase yes): YES
# Allocating crypt device /dev/sda2 context.
# Trying to open and read device /dev/sda2 with direct-io.
# Initialising device-mapper backend library.
# Timeout set to 0 miliseconds.
# Iteration time set to 2000 milliseconds.
# Interactive passphrase entry requested.
Enter passphrase:
Verify passphrase:
# Formatting device /dev/sda2 as type LUKS1.
# Crypto backend (gcrypt 1.6.6) initialized in cryptsetup library version 1.7.5.
# Detected kernel Linux 4.1.27 aarch64.
# Topology: IO (512/0), offset = 0; Required alignment is 1048576 bytes.
# Checking if cipher aes-xts-plain64 is usable.
# Userspace crypto wrapper cannot use aes-xts-plain64 (-95).
# Using dmcrypt to access keyslot area.
# Calculated device size is 1 sectors (RW), offset 0.
# dm version [ opencount flush ] [16384] (*1)
# dm versions [ opencount flush ] [16384] (*1)
# Detected dm-crypt version 1.14.1, dm-ioctl version 4.31.0.
# Device-mapper backend running with UDEV support disabled.
# DM-UUID is CRYPT-TEMP-temporary-cryptsetup-1814
# dm create temporary-cryptsetup-1814 CRYPT-TEMP-temporary-cryptsetup-1814 [ opencount flush ] [16384] (*1)
# dm reload temporary-cryptsetup-1814 [ opencount flush readonly securedata ] [16384] (*1)
# dm resume temporary-cryptsetup-1814 [ opencount flush readonly securedata ] [16384] (*1)
# temporary-cryptsetup-1814: Stacking NODE_ADD (253,0) 0:0 0600
# temporary-cryptsetup-1814: Stacking NODE_READ_AHEAD 2048 (flags=1)
# temporary-cryptsetup-1814: Processing NODE_ADD (253,0) 0:0 0600
# Created /dev/mapper/temporary-cryptsetup-1814
# temporary-cryptsetup-1814: Processing NODE_READ_AHEAD 2048 (flags=1)
# temporary-cryptsetup-1814 (253:0): read ahead is 256
# temporary-cryptsetup-1814 (253:0): Setting read ahead to 2048
# dm remove temporary-cryptsetup-1814 [ opencount flush retryremove ] [16384] (*1)
# temporary-cryptsetup-1814: Stacking NODE_DEL
# temporary-cryptsetup-1814: Processing NODE_DEL
# Removed /dev/mapper/temporary-cryptsetup-1814
# Generating LUKS header version 1 using hash sha256, aes, xts-plain64, MK 32 bytes
# KDF pbkdf2, hash sha256: 182044 iterations per second (256-bits key).
# Data offset 4096, UUID 6b470e76-6034-4c93-9df1-f4cd982deb70, digest iterations 44250
# Updating LUKS header of size 1024 on device /dev/sda2
# Key length 32, device size 3928568 sectors, header size 2050 sectors.
# Reading LUKS header of size 1024 from device /dev/sda2
# Key length 32, device size 3928568 sectors, header size 2050 sectors.
# Adding new keyslot -1 using volume key.
# Calculating data for key slot 0
# KDF pbkdf2, hash sha256: 182044 iterations per second (256-bits key).
# Key slot 0 use 355554 password iterations.
# Using hash sha256 for AF in key slot 0, 4000 stripes
# Updating key slot 0 [0x1000] area.
# Userspace crypto wrapper cannot use aes-xts-plain64 (-95).
# Using dmcrypt to access keyslot area.
# Calculated device size is 250 sectors (RW), offset 8.
# DM-UUID is CRYPT-TEMP-temporary-cryptsetup-1814
# dm create temporary-cryptsetup-1814 CRYPT-TEMP-temporary-cryptsetup-1814 [ opencount flush ] [16384] (*1)
# dm reload temporary-cryptsetup-1814 [ opencount flush securedata ] [16384] (*1)
# dm resume temporary-cryptsetup-1814 [ opencount flush securedata ] [16384] (*1)
# temporary-cryptsetup-1814: Stacking NODE_ADD (253,0) 0:0 0600
# temporary-cryptsetup-1814: Stacking NODE_READ_AHEAD 2048 (flags=1)
# temporary-cryptsetup-1814: Processing NODE_ADD (253,0) 0:0 0600
# Created /dev/mapper/temporary-cryptsetup-1814
# temporary-cryptsetup-1814: Processing NODE_READ_AHEAD 2048 (flags=1)
# temporary-cryptsetup-1814 (253:0): read ahead is 256
# temporary-cryptsetup-1814 (253:0): Setting read ahead to 2048
# dm remove temporary-cryptsetup-1814 [ opencount flush retryremove ] [16384] (*1)
# temporary-cryptsetup-1814: Stacking NODE_DEL
# temporary-cryptsetup-1814: Processing NODE_DEL
# Removed /dev/mapper/temporary-cryptsetup-1814
# Key slot 0 was enabled in LUKS header.
# Updating LUKS header of size 1024 on device /dev/sda2
# Key length 32, device size 3928568 sectors, header size 2050 sectors.
# Reading LUKS header of size 1024 from device /dev/sda2
# Key length 32, device size 3928568 sectors, header size 2050 sectors.
# Releasing crypt device /dev/sda2 context.
# Releasing device-mapper backend.
# Unlocking memory.
Command successful.
cryptsetup: posix-lock.c:137: get_lock_object: Assertion `!"sizeof lock obj"' failed.
Aborted
So it said "Successful" but then gave some error. However I see that LUKS volume is created:
admin@RT-AC86U-C828:/tmp/home/root# cryptsetup luksOpen /dev/sda2 crypted
Enter passphrase for /dev/sda2:
cryptsetup: posix-lock.c:137: get_lock_object: Assertion `!"sizeof lock obj"' failed.
Aborted
admin@RT-AC86U-C828:/tmp/home/root# ls /dev/mapper/c*
control crypted
While I get the same error the device-mapper is there.
admin@RT-AC86U-C828:/tmp/home/root# mkfs.ext3 -j /dev/mapper/crypted
mke2fs 1.42.13 (17-May-2015)
Creating filesystem with 490559 4k blocks and 122640 inodes
Filesystem UUID: 99a84dd4-cebd-42d4-9e96-9f294bf94dce
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
But here at the end I can't get it mounted:
admin@RT-AC86U-C828:/tmp/home/root# mkdir /mnt/crypted
admin@RT-AC86U-C828:/tmp/home/root# mount /dev/mapper/crypted /mnt/crypted/
mount: mounting /dev/mapper/crypted on /mnt/crypted/ failed: Invalid argument
Can that constant error
cryptsetup: posix-lock.c:137: get_lock_object: Assertion `!"sizeof lock obj"' failed be the cause of that?