$ show Aorimn/dislocker
Dislocker is a C-based system utility that decrypts and mounts BitLocker-encrypted partitions on Linux, macOS, and FreeBSD. It provides read/write access to BitLocker volumes (Vista/7/8/8.1/10) via FUSE (virtual NTFS mount) or flat-file decryption. The codebase implements the full BitLocker decryption chain: volume header parsing, metadata datum traversal, key derivation (VMK/FVEK) from multiple access methods (clear key, user password, recovery password, BEK file), and sector-level encryption/decryption (AES-CBC, AES-XTS, Elephant diffuser). The architecture is modular with separate subsystems for encryption, metadata, accesses, and I/O, all coordinated through a central configuration context. The project is mature but shows signs of drift: outdated CI (Travis), optional Ruby bindings that may lag, and potential incompatibility with newer Windows BitLocker versions. Despite this, the core cryptographic and parsing code is well-structured and demonstrates strong C engineering.
The LLM identified 3 files worth highlighting for reuse:
Implements a generic datum system for parsing BitLocker metadata. Datums are type-length-value structures with nested iteration. The code provides safe bounds-checked accessors (get_header_safe, get_payload_safe, get_next_datum) and supports multiple datum types (keys, strings, stretch keys, etc.). This pattern is reusable for any binary format with hierarchical metadata blocks, and the safety checks make it robust against malformed data.
Provides a clean abstraction over OpenSSL (or mbedTLS) for AES encryption operations. Defines function pointers for AES-ECB, CBC, XEX, XTS, and key expansion. The header is designed to be swapped at compile time via CMake, allowing the same crypto logic to use different SSL libraries. This pattern is reusable for any project needing pluggable cryptographic backends.
Implements a configuration context using an enum of option IDs (dis_opt_e) with setter/getter functions (dis_setopt, dis_getopt). Supports long options, environment variables, and hidden options for passwords. The design is extensible and decouples option handling from the rest of the code. This pattern can be reused in any C application needing structured configuration.