61 Commits

Author SHA1 Message Date
José Luis González García 1fb217476a Support for multi-byte characters in passwords
Using iconv() to convert the password from the local character set to UTF-16LE used by BitLocker.
2017-08-22 09:14:27 +02:00
Aorimn c539432bd6 Add getopt function
The getopt function can be used to get the value of a parsed option from
getopts (note the difference between singular and plural).
2016-04-20 23:09:20 +02:00
Aorimn 99e9e1f4b5 Use AES-XTS for decryption
While the previous commit includes an implementation of AES-XTS, it
didn't "link" it with dislocker. This commit is here to do just that.
2016-03-05 12:41:01 +01:00
Aorimn 5895934107 Add real AES-XTS implementation
The previous implementation was only an AES-XEX one, without support for
not-divisible-by-16 sectors. We now support this through a real - if not
entirely complete in the test vectors point of vue - implementation.
Note that we don't support sectors not aligned on the byte limit, as
should be the case in a real AES-XTS implementation. But so far, I
didn't see it implemented anywhere, so I think we're good.
2016-03-05 12:37:49 +01:00
Aorimn 0f14ed5baa Change crc32 to our own implementation
Although we use the table from the previous implementation, this enables
us to use our own license.
2016-01-31 16:42:11 +01:00
Aorimn 2eb0c610e3 Add fallback for AES-XEX calling functions
This commit binds our own AES-XEX implementation in the curent code if
the one from mbedTLS is missing (as is currently the case).
2016-01-31 16:04:52 +01:00
Aorimn 994e2bfbd6 Add AES-XEX implementation within dislocker
This is done in case the function isn't available in the mbedTLS
library.
2016-01-31 16:04:52 +01:00
Aorimn 72a9280550 Add AES-XTS enc/decryption implementation
This adds functions which call the mbedtls_aes_crypt_xex function. This
function isn't available yet in mbedTLS, so this is of no use for common
users.
The bright side is, when it's available, it will be supported in
dislocker. A future commit will test for the maybe-existing function and
use our own implementation if it's not existing.
2016-01-31 16:04:52 +01:00
Aorimn 0b0e49cd15 Adding support for AES-XTS algorithms
This extends supported algorithms to AES-XTS ones.
2016-01-31 16:04:52 +01:00
Aorimn 545fd05a2b Merge pull request #58 from robert-scheck/assert
Replace C++11 syntax by something that GCC 4.1 compatible

Thank you @robert-scheck
2016-01-07 21:07:16 +01:00
Robert Scheck 2eeea8f677 Replace C++11 syntax by something that GCC 4.1 on RHEL 5 is able to understand 2016-01-06 03:46:36 +01:00
Robert Scheck eddf520ddb Avoid "error: expected declaration specifiers or '...' before 'off_t'" build failure on RHEL 5 2016-01-06 03:27:24 +01:00
Aorimn 909f4b7592 Give the real size to decrypt the keys
When decrypting keys (VMK or FVEK mainly), we gave 256 as of the key
size. This worked until now but I suspect that was mainly by the chance
that the current keys always are 256 bits long.
With the XTS mode, it seems the keys sizes have to be doubled, so that
would also prepare for the AES-XTS-256 mode, where keys could be 512
(I'm not sure yet).
2015-11-25 23:20:06 +01:00
Aorimn 36277c0a3b Add cipher numbers for AES-XTS
Looking at Windows 10 (v1511) encrypted partitions with AES-XTS, both
128 and 256, shows that the new cipher numbers are 0x8004 and 0x8005
respectively.
2015-11-25 19:55:47 +01:00
Aorimn 455653e55f Begin to prepare for AES-XTS encryption
AES-XTS is the new encryption scheme available on Windows 10 (from the
1511 version).
Moreover, this commit remove a branching case which often happens, which
should give beter performances (not tested though).
2015-11-19 00:07:38 +01:00
Aorimn 4d9a91617e Adding inttypes.h header for old systems
Ubuntu 12.04 for example doesn't seem to have inttypes.h included, but
my fedora has.
2015-10-08 15:28:25 +02:00
Aorimn 87c80cfbd3 Add Ruby functions when they're not defined
Ruby 1.8 doesn't seem to have rb_str_catf, so we provide an
implementation of this function when it's not defined.
2015-10-08 15:27:58 +02:00
Aorimn dfbcdc5e19 Use PRI* macros
Use PRI macros, instead of custom defined ones, to print specific
formats.
2015-10-08 14:49:28 +02:00
Aorimn ce2eef7000 Implement datums to_s functions
This implementation return Ruby strings suitable for printing datums.
2015-10-08 13:52:16 +02:00
Aorimn 1231375b50 Change a bunch of field names
In a datum, the entry and datum_type fields are now respectively called
entry_type and value_type. So every field using the former names have
been changed and consistency has (tried to) be preserved.
2015-10-04 19:06:52 +02:00
Aorimn 45dce08b0e Improve compiler compatibility again
Make clang statements only for clang.
2015-10-04 16:16:22 +02:00
Aorimn 8448a5ed5a Improve compilation compatibility
The `-Wno-unknown-attributes' clang warning option wasn't supported for
all platforms so we now get through the #pragma directive of the
preprocessor to tell clang not to consider `-Wunknown-attributes' for
the Ruby headers.
As this doesn't seem to be known for all versions of clang (at least for
version 3.0-6ubuntu3 from Ubuntu 12.04), we also add a pragma for clang
not to consider `-Wunknown-pragmas'.
2015-10-04 13:50:29 +02:00
Aorimn cfe4ed1c63 Improve Ruby bindings
One can now use libdislocker to read metadata and get access to keys.
One cannot yet fully decrypt the drive.
Next commit will present some samples of the use of the API.
2015-09-25 10:29:28 +02:00
Aorimn 3d26b2f47c Add new functions to accesses api
These functions permit to be used directly, without having to create a
dis_config_t structure.
2015-09-22 00:10:38 +02:00
Aorimn daaa1c1df1 Finish removing the dis_ctx dependency in metadata
This introduces a sort of configuration for the metadata unit, but get
rid of the dis_ctx dependency.
2015-09-20 15:12:53 +02:00
Aorimn f9c8b7f243 Change information metadata field name
The previously unknown_size field in the information structure seemed to
indicate the size of a "convertlog", during conversion of the volume. We
thus renamed this field for "convert_size".
2015-08-13 19:30:50 +02:00
Aorimn 4997b2d416 Merge branch 'cmake' into develop 2015-08-08 19:22:11 +02:00
Aorimn 4701b28497 Changes according to mbedtls modifications
The mbedtls headers seem to change every name by prepending mbedtls_ to
functions names, MBEDTLS_ to #define-d, and so on. We thus put #define
to change the names.
2015-08-06 13:22:11 +02:00
Aorimn 0d10e00c1e Export the PolarSSL real installed name
Every #define-d variable in PolarSSL has been renamed with
s/POLARSSL/MBEDTLS/, so we now export POLARSSL_REAL_NAME out of the
FindPolarSSL.cmake file so that dislocker may use the correct name when
looking at the POLARSSL/MBEDTLS_VERSION_STRING or others.
2015-08-06 11:53:41 +02:00
Aorimn 2b708a0e59 Try to fix compilation on OSX Yosemite
Homebrew seems to have changed the polarssl/ folder into mbedtls/, so we
adapt the cmake/FindPolarSSL.cmake file to reflect this change. This
file now exports POLARSSL_INC_FOLDER, which take "polarssl" or "mbedtls"
for value according to the folder name in use on the system.
This is then used to include the correct files in dislocker.
2015-08-06 00:56:00 +02:00
Aorimn fb473e1e09 Remove dis_perror from the library
This function used to exit(3), which is NOT good for libraries. So we
remove it and let the binaries which link with our library decide how to
deal with errors.
2015-07-12 00:09:58 +02:00
Aorimn 918123d5d0 Add new volume encryption state
It seems like the state 0 is when BitLocker is getting killed, so we
call it a null state - not sure if that applies well. The state 3 is
related to the EOW mode and seems to be used when BitLocker is activated
in this mode.
2015-06-07 20:11:37 +02:00
Aorimn 73d6750b68 Add an include to fix issue #35 2015-06-06 12:12:02 +02:00
Aorimn 1633b3d444 Trailing whitespaces cleaning, again
It seems like header files missed the whitespace cleaning, so fix it.
2015-04-25 18:26:14 +02:00
Aorimn fe95220f2f Fix not entering passwords on command line
A bug was laying when one wouldn't want to put a password on the command
line, leading to the option being totally ignored.
2015-04-25 18:22:38 +02:00
Aorimn fc4011a9c5 Change xwrappers into dis_wrappers
xmalloc, for instance, seems to be used by the ruby library as a wrapper
around malloc, which doesn't fit well with dislocker.
2015-04-25 15:53:02 +02:00
Aorimn afae39afbd Add firsts ruby bindings
This commit enables firsts ruby bindings of the library. As
dislocker-find is a ruby script, it has been used as a test subject for
these firsts bindings by relying on the library for getting guids to
look for in partition's header.
2015-04-24 19:26:58 +02:00
Aorimn cccad9dab4 Remove get_state from the exported functions
This also allows to remove the dis_metadata_state_t typedef from the
public interface.
2015-04-23 22:13:45 +02:00
Aorimn 13365d1b55 Remove mutexes
As FUSE is using threads, we protected lseek/read and lseek/write
sequances by mutexes. However, we can simplify it by using the pread and
pwrite functions, thus getting rid of the mutexes.
2015-04-20 23:49:37 +02:00
Aorimn cb934fbfa7 Create new "objects" units
The inouts has been modified to be an object, as for the metadata.
2015-04-20 22:32:05 +02:00
Aorimn 5ffa3978d4 Modify dis_crypt_new's prototype
A check had more sense to be in the encryption unit than in the
dislocker one.
2015-04-20 22:17:16 +02:00
Aorimn 1675ee3490 Add a new return value
DIS_RET_ERROR_METADATA_FILE_OVERWRITE can be returned when given
(offset, size) pair is overwriting the NTFS-file where BitLocker
metadata are written.
2015-04-20 20:07:55 +02:00
Aorimn b256aa920f Add fve_fd field to the dis_contexts structure
This is a dislocker-wide variable, which may be used by any module in
dislocker, so we put it in the aforementioned structure.
2015-04-20 20:05:25 +02:00
Aorimn a3f8c0a53c Modify the checkupdate_dis_state macro
The programm isn't really exiting, it's just really returning, ending
the dis_initialize call early. So we modify the log message to reflect
this.
Moreover, we change the return value in order to distinguish an error
status, a normal-success status and an early-success status.
2015-03-16 23:05:17 +01:00
Aorimn c913466554 Forgot some files in the 53ca6e4 commit
It's well to put structures in private files, but it's better to add the
files to the repo.
2015-03-15 00:23:43 +01:00
Aorimn a704a7c2c6 Move outputs/ to inouts/
Not sure the name won't change in the future, but it surely is more
appropriate.
2015-03-14 23:52:40 +01:00
Aorimn 53ca6e4264 Hide the dislocker's context structure
This structure shouldn't be messed with, so we put it in a private
header - dislocker.priv.h. This is the occasion to put the config
structure in a private header too. Although there's no incomplete type
for the config structure in the public header so developers would use
the dislocker context structure only.
2015-03-14 23:41:38 +01:00
Aorimn 7b6860cdb4 Move the sectors.c file into the outputs directory
This is the beginning of the outputs/ object. The io_data structure will
be changed to reflect this object.
2015-03-14 22:17:13 +01:00
Aorimn b3754e80aa Move the crypt structure to a private header
The crypt structure, representing an encryption object is now private.
We use the .priv.h convention for a private header. This private header
is thus named encommon.priv.h and can be used only by the encryption/
directory units.
2015-03-14 17:05:07 +01:00
Aorimn 32e10d63c0 Change return values of dis_initialize
initialization now reports its failure status in a better way, leading
to applications being able to do something appropriate -which none does
for the moment.
2015-03-10 22:24:07 +01:00