Partial support for reading DiskCryptor volumes
RFC 1/1 Partial support for reading DiskCryptor volumes
Hello,
Back in June, I wrote to the mailing list seeking some help with reverse-engineering the DiskCryptor volume format [1].
Since then, I have implemented decryption of the volume header (for all cipher combinations, with autodetection) and would like to know whether you would be interested in merging support for opening DiskCryptor volumes once it is ready.
The DiskCryptor development has largely stalled, with the last beta release in April 2020. Releases by DavidXanatos have the following problem [3]:
Quoted 5 lines
The Disk Cryptor driver needed to be updated, and since the ReactOS foundation no longer offer a driver signing service, I head to use a leaked code signing certificate I found laying around the Internets. This means some anti malware applications may wrongfully flag it as potentially dangerous.
I'm attaching my current code, which can also be browsed on:
https://github.com/matjon/cryptsetup/tree/dcryptor_support/lib/dcryptor
The code is somewhat similar to ./lib/tcrypt/tcrypt.c as DiskCryptor was inspired by TrueCrypt. It uses, however, a different volume layout (the first 2048 bytes of the underlying filesystem are relocated to a different place on the partition [2]).
Greetings,
Mateusz
[1] see thread from "Thu, 3 Jun 2021 12:05:28 +0200"
https://lore.kernel.org/dm-crypt/[email protected]/T/
[2] https://diskcryptor.org/volume/
[3] https://github.com/DavidXanatos/DiskCryptor/releases
--- lib/Makemodule.am | 2 + lib/dcryptor/dcryptor.c | 424 ++++++++++++++++++ lib/dcryptor/dcryptor.h | 66 +++ lib/libcryptsetup.h | 21 +- lib/setup.c | 79 +++- src/cryptsetup.c | 71 +++ tests/diskcryptor/password.txt | 1 + tests/diskcryptor/volume_aes.bin | Bin 0 -> 8388608 bytes tests/diskcryptor/volume_aes_twofish.bin | Bin 0 -> 8388608 bytes .../volume_aes_twofish_serpent.bin | Bin 0 -> 8388608 bytes tests/diskcryptor/volume_serpent.bin | Bin 0 -> 8388608 bytes tests/diskcryptor/volume_serpent_aes.bin | Bin 0 -> 8388608 bytes tests/diskcryptor/volume_twofish.bin | Bin 0 -> 8388608 bytes tests/diskcryptor/volume_twofish_serpent.bin | Bin 0 -> 8388608 bytes 14 files changed, 662 insertions(+), 2 deletions(-) create mode 100644 lib/dcryptor/dcryptor.c create mode 100644 lib/dcryptor/dcryptor.h create mode 100644 tests/diskcryptor/password.txt create mode 100755 tests/diskcryptor/volume_aes.bin create mode 100755 tests/diskcryptor/volume_aes_twofish.bin create mode 100755 tests/diskcryptor/volume_aes_twofish_serpent.bin create mode 100755 tests/diskcryptor/volume_serpent.bin create mode 100755 tests/diskcryptor/volume_serpent_aes.bin create mode 100755 tests/diskcryptor/volume_twofish.bin create mode 100755 tests/diskcryptor/volume_twofish_serpent.bin
lib/Makemodule.am +2 -0
@@ -76,6 +76,8 @@ libcryptsetup_la_SOURCES = \ lib/loopaes/loopaes.c \ lib/tcrypt/tcrypt.h \ lib/tcrypt/tcrypt.c \ + lib/dcryptor/dcryptor.h \ + lib/dcryptor/dcryptor.c \ lib/luks1/af.h \ lib/luks1/af.c \ lib/luks1/keyencryption.c \
lib/dcryptor/dcryptor.c new file +424 -0
424 lines not on this page · raw message
lib/dcryptor/dcryptor.h new file +66 -0
66 lines not on this page · raw message
lib/libcryptsetup.h +20 -1
@@ -421,6 +421,8 @@ int crypt_get_metadata_size(struct crypt_device *cd,#define CRYPT_VERITY "VERITY"/** TCRYPT (TrueCrypt-compatible and VeraCrypt-compatible) mode */ #define CRYPT_TCRYPT "TCRYPT" +/** DiskCryptor */ +#define CRYPT_DCRYPTOR "DCRYPTOR"/** INTEGRITY dm-integrity device */ #define CRYPT_INTEGRITY "INTEGRITY"/** BITLK (BitLocker-compatible mode) */
@@ -553,6 +555,23 @@ struct crypt_params_tcrypt {*/ #define CRYPT_TCRYPT_VERA_MODES (1 << 4) +/** +* +* Structure used as parameter for DiskCryptor device type. +* +* @see crypt_load +* +*/ +struct crypt_params_dcryptor { +const char *passphrase;/**< passphrase to unlock header (input only) */ +size_t passphrase_size;/**< passphrase size (input only) */ +const char **keyfiles;/**< NOT IMPLEMENTED YET */ +unsigned int keyfiles_count;/**< NOT IMPLEMENTED YET */ +const char *cipher;/**< cipher chain c1[-c2[-c3]] */ +size_t key_size;/**< key size in bytes (the whole chain) */ +uint32_t flags;/**< CRYPT_DISKCRYPTOR* flags */ +}; +/** * * Structure used as parameter for dm-integrity device type.
@@ -2256,7 +2275,7 @@ int crypt_token_register(const crypt_token_handler *handler);/** * Report external token handlers (plugins) support -+ * @return @e 0 when enabled or negative errno value otherwise. */ int crypt_token_external_support (void );
lib/setup.c +78 -1
187 lines not on this page · raw message
src/cryptsetup.c +71 -0
83 lines not on this page · raw message
tests/diskcryptor/password.txt new file +1 -0
@@ -0,0 +1 @@ +abcde
tests/diskcryptor/volume_aes.bin new file binary +0 -0
tests/diskcryptor/volume_aes_twofish.bin new file binary +0 -0
tests/diskcryptor/volume_aes_twofish_serpent.bin new file binary +0 -0
tests/diskcryptor/volume_serpent.bin new file binary +0 -0
tests/diskcryptor/volume_serpent_aes.bin new file binary +0 -0
tests/diskcryptor/volume_twofish.bin new file binary +0 -0
tests/diskcryptor/volume_twofish_serpent.bin new file binary +0 -0
Signature · 5 lines
2.25.1 _______________________________________________ dm-crypt mailing list -- [email protected] To unsubscribe send an email to [email protected]
Hi,
Quoted 5 lines · Mateusz Jończyk
Hello,
Back in June, I wrote to the mailing list seeking some help with reverse-engineering the DiskCryptor volume format [1].
Quoted 14 lines
Since then, I have implemented decryption of the volume header (for all cipher combinations, with autodetection) and would like to know whether you would be interested in merging support for opening DiskCryptor volumes once it is ready.
The DiskCryptor development has largely stalled, with the last beta release in April 2020. Releases by DavidXanatos have the following problem [3]:
Quoted 5 lines
The Disk Cryptor driver needed to be updated, and since the ReactOS foundation no longer offer a driver signing service, I head to use a leaked code signing certificate I found laying around the Internets. This means some anti malware applications may wrongfully flag it as potentially dangerous.
How much is DiskCryptor used in reality? The note above would qualify it as a regular malware for me :-)
I would like to have support for various formats, but the line where it becomes bloatware is very thin...
Anyway, if
- code is licensed under LGPL (no new GPL-only code in libcryptsetup)
- it only allows to open existing formats (no code to modify metadata; our primary format is LUKS and it will stay this way)
- it does not add complicated dependences
(I think we should care about memory footprint more now)
then the best is perhaps open merge request (or issue) on the project page and discuss it there.
(For now, the code looks simple enough.)
What is missing to more "stable" code? Only the parts marked TODO, or something crucial for format parsing?
Thanks,
Milan
_______________________________________________
dm-crypt mailing list -- [email protected]
To unsubscribe send an email to [email protected]