Skip to content

crypto: Add BitLocker Clear Key detection and passwordless open - #1212

Draft
Marcondiro wants to merge 1 commit into
storaged-project:masterfrom
Marcondiro:master
Draft

Marcondiro wants to merge 1 commit into
storaged-project:masterfrom
Marcondiro:master

Conversation

@Marcondiro

@Marcondiro Marcondiro commented Sep 27, 2026 •

Copy link
Copy Markdown

Hi,

This PR introduces support for Bitlocker Clear Keys: pre-provisioned and suspended BitLocker devices contain this on-disk key in clear, more info on Microsoft's FAQ.

In cryptsetup 2.8+, passing a NULL passphrase allows extracting the VMK using this Clear Key.

  • Extend BDCryptoBITLKInfo with has_clearkey field
  • In bd_crypto_bitlk_info(), probe for clear key presence
  • In bd_crypto_bitlk_open_flags(), allow NULL context to trigger clear key activation
  • Add test cases in tests/crypto_test.py
  • Added bitlk-aes-xts-128-clearkey-only.img from upstream cryptsetup to bitlk-images.tar.gz

Assisted-by: Gemini

Thanks!

@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Marcondiro
Marcondiro force-pushed the master branch 2 times, most recently from 3071eba to 07596c9 Compare September 28, 2026 08:18
Pre-provisioned and suspended BitLocker devices contain an on-disk
Clear Key protector. In cryptsetup 2.8+, passing a NULL passphrase
allows extracting the VMK using this Clear Key.

- Extend BDCryptoBITLKInfo with has_clearkey field
- In bd_crypto_bitlk_info(), probe for clear key presence
- In bd_crypto_bitlk_open_flags(), allow NULL context to trigger
  clear key activation
- Add test cases in tests/crypto_test.py

Assisted-by: Gemini
Signed-off-by: Marco Cavenati <cavenati.marco@gmail.com>
Comment thread src/plugins/crypto.c
info->backing_device = g_strdup (crypt_get_device_name (cd));
ret = crypt_get_sector_size (cd);
info->sector_size = ret > 0 ? ret : 0;
info->has_clearkey = (crypt_activate_by_passphrase (cd, NULL, CRYPT_ANY_SLOT, NULL, 0, 0) >= 0);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this is a good idea. crypt_activate_by_passphrase can be quite "heavy" function and in general the bd_crypto_*_info functions can be called as a reaction to udev event (device being added). I'll try talking to cryptsetup developer to check if we could get some "cheaper" API to get this information.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants