Public bug reported:

Enabling fips-updates breaks cryptsetup luksAddKey and fails silently.

# General info

```
ubuntu@jammy:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.5 LTS
Release:        22.04
Codename:       jammy

ubuntu@jammy:~$ uname -a
Linux jammy 5.15.0-140-fips #150+fips1-Ubuntu SMP Fri Apr 25 13:41:07 UTC 2025 
x86_64 x86_64 x86_64 GNU/Linux

ubuntu@jammy:~$ apt-cache policy cryptsetup 
cryptsetup:
  Installed: 2:2.4.3-1ubuntu1.3
  Candidate: 2:2.4.3-1ubuntu1.3
  Version table:
 *** 2:2.4.3-1ubuntu1.3 500
        500 http://ca.archive.ubuntu.com/ubuntu jammy-updates/main amd64 
Packages
        100 /var/lib/dpkg/status
     2:2.4.3-1ubuntu1 500
        500 http://ca.archive.ubuntu.com/ubuntu jammy/main amd64 Packages

ubuntu@jammy:~$ apt-cache policy linux-fips
linux-fips:
  Installed: 5.15.0.140.80
  Candidate: 5.15.0.140.80
  Version table:

 *** 5.15.0.140.80 1001
       1001 https://esm.ubuntu.com/fips-updates/ubuntu jammy-updates/main amd64 
Packages
        100 /var/lib/dpkg/status

```

# Expected behavior

```
ubuntu@jammy:~$ sudo blkid -t TYPE=crypto_LUKS -o device
[sudo] password for ubuntu: 
/dev/vda3


ubuntu@jammy:~$ sudo cryptsetup luksDump /dev/vda3
LUKS header information
Version:        2
Epoch:          3
Metadata area:  16384 [bytes]
Keyslots area:  16744448 [bytes]
UUID:           97e80f95-0f2c-41be-85ea-1078e25c1823
Label:          (no label)
Subsystem:      (no subsystem)
Flags:          (no flags)

Data segments:
  0: crypt
        offset: 16777216 [bytes]
        length: (whole device)
        cipher: aes-xts-plain64
        sector: 512 [bytes]

Keyslots:
  0: luks2
        Key:        512 bits
        Priority:   normal
        Cipher:     aes-xts-plain64
        Cipher key: 512 bits
        PBKDF:      argon2id
        Time cost:  4
        Memory:     1048576
        Threads:    2
        Salt:       c4 77 8a 0e 3b a2 0c 5e eb cc 1b b9 46 6d 70 bb 
                    3a a4 fc b6 3a ed 05 0c cb e8 15 df 15 3e c4 5c 
        AF stripes: 4000
        AF hash:    sha256
        Area offset:32768 [bytes]
        Area length:258048 [bytes]
        Digest ID:  0
Tokens:
Digests:
  0: pbkdf2
        Hash:       sha256
        Iterations: 265866
        Salt:       63 96 01 c2 b8 c0 a4 0a 4c 69 d4 25 ea 1e ef 35 
                    d8 54 38 e3 07 84 6b 4e ef 7d a3 2e db 95 63 1d 
        Digest:     67 fc c6 fe 0d 9b 3e 8e 50 ad 93 fa bd 32 87 e0 
                    2f 4c 8e c9 2c cb 9c 40 70 14 e1 fd 26 f6 92 5e 


ubuntu@jammy:~$ sudo cryptsetup luksAddKey /dev/vda3
Enter any existing passphrase: 
Enter new passphrase for key slot: 
Verify passphrase: 
ubuntu@jammy:~$ sudo cryptsetup --pbkdf=pbkdf2 luksAddKey /dev/vda3
Enter any existing passphrase: 
Enter new passphrase for key slot: 
Verify passphrase: 
ubuntu@jammy:~$ sudo cryptsetup --key-slot=5 luksAddKey /dev/vda3
Enter any existing passphrase: 
Enter new passphrase for key slot: 
Verify passphrase: 
ubuntu@jammy:~$ sudo cryptsetup --pbkdf=pbkdf2 --key-slot=6 luksAddKey /dev/vda3
Enter any existing passphrase: 
Enter new passphrase for key slot: 
Verify passphrase:


ubuntu@jammy:~$ sudo cryptsetup luksDump /dev/vda3
LUKS header information
Version:        2
Epoch:          7
Metadata area:  16384 [bytes]
Keyslots area:  16744448 [bytes]
UUID:           97e80f95-0f2c-41be-85ea-1078e25c1823
Label:          (no label)
Subsystem:      (no subsystem)
Flags:          (no flags)

Data segments:
  0: crypt
        offset: 16777216 [bytes]
        length: (whole device)
        cipher: aes-xts-plain64
        sector: 512 [bytes]

Keyslots:
  0: luks2
        Key:        512 bits
        Priority:   normal
        Cipher:     aes-xts-plain64
        Cipher key: 512 bits
        PBKDF:      argon2id
        Time cost:  4
        Memory:     1048576
        Threads:    2
        Salt:       c4 77 8a 0e 3b a2 0c 5e eb cc 1b b9 46 6d 70 bb 
                    3a a4 fc b6 3a ed 05 0c cb e8 15 df 15 3e c4 5c 
        AF stripes: 4000
        AF hash:    sha256
        Area offset:32768 [bytes]
        Area length:258048 [bytes]
        Digest ID:  0
  1: luks2
        Key:        512 bits
        Priority:   normal
        Cipher:     aes-xts-plain64
        Cipher key: 512 bits
        PBKDF:      argon2id
        Time cost:  5
        Memory:     1048576
        Threads:    2
        Salt:       92 ed ca 8e 0b 7c 3b 6f ae 1f 07 d3 77 b4 40 0e 
                    fe 65 9d 63 77 e9 65 23 5e 0f 6c c1 b5 00 13 e8 
        AF stripes: 4000
        AF hash:    sha256
        Area offset:290816 [bytes]
        Area length:258048 [bytes]
        Digest ID:  0
  2: luks2
        Key:        512 bits
        Priority:   normal
        Cipher:     aes-xts-plain64
        Cipher key: 512 bits
        PBKDF:      pbkdf2
        Hash:       sha256
        Iterations: 4378186
        Salt:       5b 28 eb 34 46 c5 f0 b2 02 88 76 7a ae 46 1b 9f 
                    08 8b 75 e8 ab f4 01 07 a8 ed 56 95 ef ca 2c 85 
        AF stripes: 4000
        AF hash:    sha256
        Area offset:548864 [bytes]
        Area length:258048 [bytes]
        Digest ID:  0
  5: luks2
        Key:        512 bits
        Priority:   normal
        Cipher:     aes-xts-plain64
        Cipher key: 512 bits
        PBKDF:      argon2id
        Time cost:  5
        Memory:     1048576
        Threads:    2
        Salt:       cd 6a a9 37 b8 ab 35 bc 74 b0 3f 35 bd 10 f3 d4 
                    63 c4 75 12 79 dc e2 33 c2 02 62 03 ba cd ac 3d 
        AF stripes: 4000
        AF hash:    sha256
        Area offset:806912 [bytes]
        Area length:258048 [bytes]
        Digest ID:  0
  6: luks2
        Key:        512 bits
        Priority:   normal
        Cipher:     aes-xts-plain64
        Cipher key: 512 bits
        PBKDF:      pbkdf2
        Hash:       sha256
        Iterations: 4462024
        Salt:       d1 ec 0e 08 01 3c e6 42 81 53 a0 ac 9a 4b ec c4 
                    3c 82 2b 9f cf a4 9d 7e c3 ec 27 fd f3 15 2a a7 
        AF stripes: 4000
        AF hash:    sha256
        Area offset:1064960 [bytes]
        Area length:258048 [bytes]
        Digest ID:  0
Tokens:
Digests:
  0: pbkdf2
        Hash:       sha256
        Iterations: 265866
        Salt:       63 96 01 c2 b8 c0 a4 0a 4c 69 d4 25 ea 1e ef 35 
                    d8 54 38 e3 07 84 6b 4e ef 7d a3 2e db 95 63 1d 
        Digest:     67 fc c6 fe 0d 9b 3e 8e 50 ad 93 fa bd 32 87 e0 
                    2f 4c 8e c9 2c cb 9c 40 70 14 e1 fd 26 f6 92 5e 


ubuntu@jammy:~$ sudo cryptsetup luksKillSlot /dev/vda3 1                
Enter any remaining passphrase: 
ubuntu@jammy:~$ sudo cryptsetup luksKillSlot /dev/vda3 5
Enter any remaining passphrase: 


ubuntu@jammy:~$ sudo cryptsetup luksDump /dev/vda3
LUKS header information
Version:        2
Epoch:          9
Metadata area:  16384 [bytes]
Keyslots area:  16744448 [bytes]
UUID:           97e80f95-0f2c-41be-85ea-1078e25c1823
Label:          (no label)
Subsystem:      (no subsystem)
Flags:          (no flags)

Data segments:
  0: crypt
        offset: 16777216 [bytes]
        length: (whole device)
        cipher: aes-xts-plain64
        sector: 512 [bytes]

Keyslots:
  0: luks2
        Key:        512 bits
        Priority:   normal
        Cipher:     aes-xts-plain64
        Cipher key: 512 bits
        PBKDF:      argon2id
        Time cost:  4
        Memory:     1048576
        Threads:    2
        Salt:       c4 77 8a 0e 3b a2 0c 5e eb cc 1b b9 46 6d 70 bb 
                    3a a4 fc b6 3a ed 05 0c cb e8 15 df 15 3e c4 5c 
        AF stripes: 4000
        AF hash:    sha256
        Area offset:32768 [bytes]
        Area length:258048 [bytes]
        Digest ID:  0
  2: luks2
        Key:        512 bits
        Priority:   normal
        Cipher:     aes-xts-plain64
        Cipher key: 512 bits
        PBKDF:      pbkdf2
        Hash:       sha256
        Iterations: 4378186
        Salt:       5b 28 eb 34 46 c5 f0 b2 02 88 76 7a ae 46 1b 9f 
                    08 8b 75 e8 ab f4 01 07 a8 ed 56 95 ef ca 2c 85 
        AF stripes: 4000
        AF hash:    sha256
        Area offset:548864 [bytes]
        Area length:258048 [bytes]
        Digest ID:  0
  6: luks2
        Key:        512 bits
        Priority:   normal
        Cipher:     aes-xts-plain64
        Cipher key: 512 bits
        PBKDF:      pbkdf2
        Hash:       sha256
        Iterations: 4462024
        Salt:       d1 ec 0e 08 01 3c e6 42 81 53 a0 ac 9a 4b ec c4 
                    3c 82 2b 9f cf a4 9d 7e c3 ec 27 fd f3 15 2a a7 
        AF stripes: 4000
        AF hash:    sha256
        Area offset:1064960 [bytes]
        Area length:258048 [bytes]
        Digest ID:  0
Tokens:
Digests:
  0: pbkdf2
        Hash:       sha256
        Iterations: 265866
        Salt:       63 96 01 c2 b8 c0 a4 0a 4c 69 d4 25 ea 1e ef 35 
                    d8 54 38 e3 07 84 6b 4e ef 7d a3 2e db 95 63 1d 
        Digest:     67 fc c6 fe 0d 9b 3e 8e 50 ad 93 fa bd 32 87 e0 
                    2f 4c 8e c9 2c cb 9c 40 70 14 e1 fd 26 f6 92 5e 


ubuntu@jammy:~$ sudo cryptsetup -v luksAddKey /dev/vda3
Enter any existing passphrase: 
Key slot 0 unlocked.
Enter new passphrase for key slot: 
Verify passphrase: 
Key slot 1 created.
Command successful.
ubuntu@jammy:~$ sudo cryptsetup -v luksAddKey --pbkdf=pbkdf2 /dev/vda3
Enter any existing passphrase: 
Key slot 0 unlocked.
Enter new passphrase for key slot: 
Verify passphrase: 
Key slot 3 created.
Command successful.


ubuntu@jammy:~$ sudo cryptsetup luksDump /dev/vda3
LUKS header information
Version:        2
Epoch:          11
Metadata area:  16384 [bytes]
Keyslots area:  16744448 [bytes]
UUID:           97e80f95-0f2c-41be-85ea-1078e25c1823
Label:          (no label)
Subsystem:      (no subsystem)
Flags:          (no flags)

Data segments:
  0: crypt
        offset: 16777216 [bytes]
        length: (whole device)
        cipher: aes-xts-plain64
        sector: 512 [bytes]

Keyslots:
  0: luks2
        Key:        512 bits
        Priority:   normal
        Cipher:     aes-xts-plain64
        Cipher key: 512 bits
        PBKDF:      argon2id
        Time cost:  4
        Memory:     1048576
        Threads:    2
        Salt:       c4 77 8a 0e 3b a2 0c 5e eb cc 1b b9 46 6d 70 bb 
                    3a a4 fc b6 3a ed 05 0c cb e8 15 df 15 3e c4 5c 
        AF stripes: 4000
        AF hash:    sha256
        Area offset:32768 [bytes]
        Area length:258048 [bytes]
        Digest ID:  0
  1: luks2
        Key:        512 bits
        Priority:   normal
        Cipher:     aes-xts-plain64
        Cipher key: 512 bits
        PBKDF:      argon2id
        Time cost:  5
        Memory:     1048576
        Threads:    2
        Salt:       d4 db 86 3f c3 55 48 59 29 8b 6e 3b db 63 29 5b 
                    8f 1c f6 6c 91 22 84 4a 03 6c f7 5a 3c a7 fe e9 
        AF stripes: 4000
        AF hash:    sha256
        Area offset:290816 [bytes]
        Area length:258048 [bytes]
        Digest ID:  0
  2: luks2
        Key:        512 bits
        Priority:   normal
        Cipher:     aes-xts-plain64
        Cipher key: 512 bits
        PBKDF:      pbkdf2
        Hash:       sha256
        Iterations: 4378186
        Salt:       5b 28 eb 34 46 c5 f0 b2 02 88 76 7a ae 46 1b 9f 
                    08 8b 75 e8 ab f4 01 07 a8 ed 56 95 ef ca 2c 85 
        AF stripes: 4000
        AF hash:    sha256
        Area offset:548864 [bytes]
        Area length:258048 [bytes]
        Digest ID:  0
  3: luks2
        Key:        512 bits
        Priority:   normal
        Cipher:     aes-xts-plain64
        Cipher key: 512 bits
        PBKDF:      pbkdf2
        Hash:       sha256
        Iterations: 4490688
        Salt:       60 5d 17 32 3a fa af 27 1b cd ab 2d aa f7 94 d7 
                    08 48 52 dd 82 95 12 23 bc 20 84 29 72 5f dd 66 
        AF stripes: 4000
        AF hash:    sha256
        Area offset:806912 [bytes]
        Area length:258048 [bytes]
        Digest ID:  0
  6: luks2
        Key:        512 bits
        Priority:   normal
        Cipher:     aes-xts-plain64
        Cipher key: 512 bits
        PBKDF:      pbkdf2
        Hash:       sha256
        Iterations: 4462024
        Salt:       d1 ec 0e 08 01 3c e6 42 81 53 a0 ac 9a 4b ec c4 
                    3c 82 2b 9f cf a4 9d 7e c3 ec 27 fd f3 15 2a a7 
        AF stripes: 4000
        AF hash:    sha256
        Area offset:1064960 [bytes]
        Area length:258048 [bytes]
        Digest ID:  0
Tokens:
Digests:
  0: pbkdf2
        Hash:       sha256
        Iterations: 265866
        Salt:       63 96 01 c2 b8 c0 a4 0a 4c 69 d4 25 ea 1e ef 35 
                    d8 54 38 e3 07 84 6b 4e ef 7d a3 2e db 95 63 1d 
        Digest:     67 fc c6 fe 0d 9b 3e 8e 50 ad 93 fa bd 32 87 e0 
                    2f 4c 8e c9 2c cb 9c 40 70 14 e1 fd 26 f6 92 5e 
```

# Steps to reproduce

```
ubuntu@jammy:~$ sudo cryptsetup luksDump /dev/vda3
[sudo] password for ubuntu: 
LUKS header information
Version:        2
Epoch:          3
Metadata area:  16384 [bytes]
Keyslots area:  16744448 [bytes]
UUID:           97e80f95-0f2c-41be-85ea-1078e25c1823
Label:          (no label)
Subsystem:      (no subsystem)
Flags:          (no flags)

Data segments:
  0: crypt
        offset: 16777216 [bytes]
        length: (whole device)
        cipher: aes-xts-plain64
        sector: 512 [bytes]

Keyslots:
  0: luks2
        Key:        512 bits
        Priority:   normal
        Cipher:     aes-xts-plain64
        Cipher key: 512 bits
        PBKDF:      argon2id
        Time cost:  4
        Memory:     1048576
        Threads:    2
        Salt:       c4 77 8a 0e 3b a2 0c 5e eb cc 1b b9 46 6d 70 bb 
                    3a a4 fc b6 3a ed 05 0c cb e8 15 df 15 3e c4 5c 
        AF stripes: 4000
        AF hash:    sha256
        Area offset:32768 [bytes]
        Area length:258048 [bytes]
        Digest ID:  0
Tokens:
Digests:
  0: pbkdf2
        Hash:       sha256
        Iterations: 265866
        Salt:       63 96 01 c2 b8 c0 a4 0a 4c 69 d4 25 ea 1e ef 35 
                    d8 54 38 e3 07 84 6b 4e ef 7d a3 2e db 95 63 1d 
        Digest:     67 fc c6 fe 0d 9b 3e 8e 50 ad 93 fa bd 32 87 e0 
                    2f 4c 8e c9 2c cb 9c 40 70 14 e1 fd 26 f6 92 5e 


ubuntu@jammy:~$ sudo pro attach <TOKEN_REDACTED>
Enabling Ubuntu Pro: ESM Apps
Ubuntu Pro: ESM Apps enabled
Enabling Ubuntu Pro: ESM Infra
Ubuntu Pro: ESM Infra enabled
Enabling Livepatch
Livepatch enabled
This machine is now attached to 'Ubuntu Pro - free personal subscription'

SERVICE          ENTITLED  STATUS       DESCRIPTION
anbox-cloud      yes       disabled     Scalable Android in the cloud
esm-apps         yes       enabled      Expanded Security Maintenance for 
Applications
esm-infra        yes       enabled      Expanded Security Maintenance for 
Infrastructure
fips-preview     yes       disabled     Preview of FIPS crypto packages 
undergoing certification with NIST
fips-updates     yes       disabled     FIPS compliant crypto packages with 
stable security updates
livepatch        yes       enabled      Canonical Livepatch service
realtime-kernel* yes       disabled     Ubuntu kernel with PREEMPT_RT patches 
integrated
usg              yes       disabled     Security compliance and audit tools

 * Service has variants

NOTICES
Operation in progress: pro attach

For a list of all Ubuntu Pro services and variants, run 'pro status --all'
Enable services with: pro enable <service>

     Account: <REDACTED>
Subscription: Ubuntu Pro - free personal subscription

ubuntu@jammy:~$ sudo pro enable fips-updates 
One moment, checking your subscription first
This will install the FIPS packages including security updates.
Warning: This action can take some time and cannot be undone.
Are you sure? (y/N) y
Configuring APT access to FIPS Updates
Updating FIPS Updates package lists
Updating standard Ubuntu package lists
Installing FIPS Updates packages
Installing openssh-client openssh-server openssh-sftp-server 
openssl-fips-module-3
FIPS Updates enabled
A reboot is required to complete install.

ubuntu@jammy:~$ sudo reboot

ubuntu@jammy:~$ pro status
SERVICE          ENTITLED  STATUS       DESCRIPTION
anbox-cloud      yes       disabled     Scalable Android in the cloud
esm-apps         yes       enabled      Expanded Security Maintenance for 
Applications
esm-infra        yes       enabled      Expanded Security Maintenance for 
Infrastructure
fips-updates     yes       enabled      FIPS compliant crypto packages with 
stable security updates
livepatch        yes       enabled      Canonical Livepatch service
realtime-kernel* yes       disabled     Ubuntu kernel with PREEMPT_RT patches 
integrated
usg              yes       disabled     Security compliance and audit tools

 * Service has variants

For a list of all Ubuntu Pro services and variants, run 'pro status --all'
Enable services with: pro enable <service>

     Account: <REDACTED>
Subscription: Ubuntu Pro - free personal subscription


ubuntu@jammy:~$ sudo cryptsetup luksAddKey /dev/vda3
Enter any existing passphrase: 
Enter new passphrase for key slot: 
Verify passphrase: 


ubuntu@jammy:~$ sudo cryptsetup -v luksAddKey /dev/vda3
Running in FIPS mode.
Enter any existing passphrase: 
Key slot 0 unlocked.
Enter new passphrase for key slot: 
Verify passphrase: 
Command failed with code -1 (wrong or missing parameters).
ubuntu@jammy:~$ sudo cryptsetup -v luksAddKey --pbkdf=pbkdf2 /dev/vda3
Running in FIPS mode.
Enter any existing passphrase: 
Key slot 0 unlocked.
Enter new passphrase for key slot: 
Verify passphrase: 
Command failed with code -1 (wrong or missing parameters).
ubuntu@jammy:~$ sudo cryptsetup -v luksAddKey --pbkdf=pbkdf2 --key-slot=3 
/dev/vda3
Running in FIPS mode.
Enter any existing passphrase: 
Key slot 0 unlocked.
Enter new passphrase for key slot: 
Verify passphrase: 
Command failed with code -1 (wrong or missing parameters).


ubuntu@jammy:~$ sudo cryptsetup luksDump /dev/vda3
LUKS header information
Version:        2
Epoch:          3
Metadata area:  16384 [bytes]
Keyslots area:  16744448 [bytes]
UUID:           97e80f95-0f2c-41be-85ea-1078e25c1823
Label:          (no label)
Subsystem:      (no subsystem)
Flags:          (no flags)

Data segments:
  0: crypt
        offset: 16777216 [bytes]
        length: (whole device)
        cipher: aes-xts-plain64
        sector: 512 [bytes]

Keyslots:
  0: luks2
        Key:        512 bits
        Priority:   normal
        Cipher:     aes-xts-plain64
        Cipher key: 512 bits
        PBKDF:      argon2id
        Time cost:  4
        Memory:     1048576
        Threads:    2
        Salt:       c4 77 8a 0e 3b a2 0c 5e eb cc 1b b9 46 6d 70 bb 
                    3a a4 fc b6 3a ed 05 0c cb e8 15 df 15 3e c4 5c 
        AF stripes: 4000
        AF hash:    sha256
        Area offset:32768 [bytes]
        Area length:258048 [bytes]
        Digest ID:  0
Tokens:
Digests:
  0: pbkdf2
        Hash:       sha256
        Iterations: 265866
        Salt:       63 96 01 c2 b8 c0 a4 0a 4c 69 d4 25 ea 1e ef 35 
                    d8 54 38 e3 07 84 6b 4e ef 7d a3 2e db 95 63 1d 
        Digest:     67 fc c6 fe 0d 9b 3e 8e 50 ad 93 fa bd 32 87 e0 
                    2f 4c 8e c9 2c cb 9c 40 70 14 e1 fd 26 f6 92 5e 

```

** Affects: cryptsetup (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: fips

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2112158

Title:
  Enabling FIPS breaks cryptsetup  luksAddKey

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cryptsetup/+bug/2112158/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to