dmcrypt:当用户空间加密包装器不存在时会发生什么?

时间:2017-12-04 09:41:12

标签: linux encryption arm

我正在尝试设置加密卷以安全地存储文件。这是在NextThingCo袖珍芯片上完成的,但操作系统是基于debian的,所以我猜我先试试这里,因为我的问题与dmcrypt的关系比平台本身更多(或者我认为)。

我到目前为止构建的配方如下(可能不正确或过于复杂):

  1. 创建文件
  2. 将其设置为循环设备。
  3. 执行crypsetup格式化并打开。 " ABC"是通过stdin提供的密码(这个假设是正确的吗?)。
  4. 制作文件系统
  5. 所以它看起来像这样:

     sudo dd if=/dev/urandom of=./encrypted.volume bs=512K count=200
     sudo losetup /dev/loop0 ./encrypted.volume  
     echo "abc" | sudo cryptsetup luksFormat /dev/loop0
     echo "abc" | sudo cryptsetup open /dev/loop0 vault
     sudo mkfs /dev/mapper/vault
     sudo mount /dev/mapper/vault /mnt/vault
    

    现在,所有这些似乎工作正常,花花公子,直到我使用--debug参数(我想尝试其他参数,例如密钥大小)。我意识到以下消息:

    # cryptsetup 1.7.0 processing "cryptsetup -v --debug --cipher aes-xts-plain64 --key-size 
    512 --hash sha512 --iter-time 5000 --timeout 10 --use-random luksFormat /dev/loop0"
    # Running command luksFormat.
    ...
    # Userspace crypto wrapper cannot use aes-xts-plain64 (-95).
    ...
    device-mapper: remove ioctl on temporary-cryptsetup-6661 failed: Device or resource busy    <------ appears when I change the  --key-size to 512 i.s.o. default 256
    ...
    device-mapper: remove ioctl on temporary-cryptsetup-6698 failed: Device or resource busy
    

    我也尝试过运行基准测试:

    chip@chip:~/data/run$ sudo cryptsetup --debug benchmark
    [sudo] password for chip:
    # cryptsetup 1.7.0 processing "cryptsetup --debug benchmark"
    # Running command benchmark.
    # Installing SIGINT/SIGTERM handler.
    # Unblocking interruption on signal.
    # Tests are approximate using memory only (no storage IO).
    # Crypto backend (gcrypt 1.6.4) initialized in cryptsetup library version 1.7.0.
    # Detected kernel Linux 4.4.13-ntc-mlc armv7l.
    # KDF pbkdf2, hash sha1: 59041 iterations per second (256-bits key).
    PBKDF2-sha1        59041 iterations per second for 256-bit key
    # KDF pbkdf2, hash sha256: 79437 iterations per second (256-bits key).
    PBKDF2-sha256      79437 iterations per second for 256-bit key
    # KDF pbkdf2, hash sha512: 40705 iterations per second (256-bits key).
    PBKDF2-sha512      40705 iterations per second for 256-bit key
    # KDF pbkdf2, hash ripemd160: 50412 iterations per second (256-bits key).
    PBKDF2-ripemd160   50412 iterations per second for 256-bit key
    # KDF pbkdf2, hash whirlpool: 7481 iterations per second (256-bits key).
    PBKDF2-whirlpool    7481 iterations per second for 256-bit key
    # Cannot initialise cipher aes, mode cbc.
    Required kernel crypto interface not available.
    Command failed with code 95: Operation not supported
    

    以下是有关平台和操作系统的一些其他信息:

    chip@chip:~/data/run$ uname -r
    4.4.13-ntc-mlc
    chip@chip:~/data/run$ cat /boot/config-4.4.13-ntc-mlc | grep CRYPTO_USER_API_SKCIPHER
    # CONFIG_CRYPTO_USER_API_SKCIPHER is not set
    

    我知道在设置CONFIG_CRYPTO_USER_API_SKCIPHER后我需要重新编译内核,以便用户空间加密API可用。我不认为有办法解决这个问题,有吗?

    我Luks转储有关存储文件的信息:

    chip@chip:~/data/run$ sudo cryptsetup luksDump ./encrypted.volume
    
    LUKS header information for ./encrypted.volume
    
    Version:        1
    Cipher name:    aes          <------- ???
    Cipher mode:    xts-plain64  <------- ???
    Hash spec:      sha256       
    Payload offset: 4096
    MK bits:        256
    MK digest:      ee f8 8d ad 9b 67 d9 7d cb 20 fe a9 25 a3 8b a5 c2 65 56 dd
    MK salt:        38 74 e8 9d 77 6a 93 b5 03 41 cb 3e ce 79 b4 00
                    55 f3 98 8f c5 a7 14 05 25 9c 4e 91 68 1a 53 37
    MK iterations:  18500
    UUID:           36912ea4-9adb-4d1f-b9f2-f6a09a258833
    
    Key Slot 0: ENABLED
            Iterations:             150587
            Salt:                   e8 4f f3 c1 07 1a 2b 2d d2 d9 f4 55 0f b3 13 28
                                    2a 69 06 aa a0 94 4a 05 5d 5f e9 28 9b 91 39 94
            Key material offset:    8
            AF stripes:             4000
    Key Slot 1: DISABLED
    Key Slot 2: DISABLED
    Key Slot 3: DISABLED
    Key Slot 4: DISABLED
    Key Slot 5: DISABLED
    Key Slot 6: DISABLED
    Key Slot 7: DISABLED
    

    但是,我对目前的情况有几个问题:

    • 分区是否实际加密?如果是这样,采用哪种方案?
      • 如何在命令行上检查?尝试转储有关分区的信息告诉我&#34;有一个LUKS标头&#34;,但这并不告诉我数据是否加密。
    • 如何解决资源繁忙问题&#39;&#39;情况,这会让我使用512的密钥大小?

    感谢您一直在这里阅读。任何指针将不胜感激。

0 个答案:

没有答案