Import Upstream version 0.7.1

parent 137c8135
......@@ -8,11 +8,15 @@ os:
- linux
- osx
env:
global:
- PATH="/usr/bin:/usr/local/bin:$PATH"
before_install:
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update -qq; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get install -qq libfuse-dev libpolarssl-dev ruby-dev; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install -v osxfuse; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install -v Caskroom/cask/osxfuse; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then ./src/mbed_install.sh; fi
install:
......
# v0.7.1
This version is only used to update dislocker's brew file and the BitBake recipe
for OSX's and BitBake's users to be able to download v0.7. If you're not an OSX
nor a BitBake user, you can use either v0.7 or v0.7.1, this won't make any
difference.
# v0.7
- Feature improvement:
- dislocker can now be run from /etc/fstab. This also means that the `-o`
option for the offset had to be changed. It is now `-O`;
- dislocker on FreeBSD can now read devices, not just partition dumps.
- Compatiblity improvement:
- OSX support and dependencies have been updated;
- Thanks to Eric Johnson, from Leidos, a BitBake recipe is now available.
# v0.6.1
This version is only used to update dislocker's brew file for OSX users
to be able to download v0.6. If you're not an OSX user, you can use either v0.6
......@@ -5,7 +21,7 @@ or v0.6.1, this won't make any difference.
# v0.6
- Features improvement:
- Read/write on Windows 10 (v1511) encrypted volumes.
- Read/write on Windows 10 (v1511) encrypted volumes - AES-XTS 128/256.
# v0.5.2
Minor fixes for downstream packaging and larger distribution coverage.
......
......@@ -27,10 +27,12 @@ find_program (GIT_EXE NAMES git PATHS /usr/bin /usr/local/bin)
if(GIT_EXE)
execute_process (
COMMAND ${GIT_EXE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_RELEASE_BRANCH
)
execute_process (
COMMAND ${GIT_EXE} log -n 1 --pretty=format:%t
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_RELEASE_COMMIT
)
string (STRIP "${GIT_RELEASE_BRANCH}" GIT_RELEASE_BRANCH)
......@@ -40,7 +42,7 @@ endif()
set (VERSION_MAJOR 0)
set (VERSION_MINOR 6)
set (VERSION_MINOR 7)
set (VERSION_RELEASE 1)
set (VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}")
......
......@@ -10,34 +10,38 @@ You need:
- cmake (at least version 2.6);
- make (or gmake, for FreeBSD);
- Headers for FUSE;
- Headers for PolarSSL/mbedTLS;
- Headers for mbedTLS (previously known as PolarSSL);
- A partition encrypted with BitLocker, from Windows Vista, 7 or 8.
If you have Ruby headers, the library will compile with some Ruby bindings and
another program - see the NOTE section below - will be available.
For Debian-like:
For Debian-like distos based on Debian Jessie or Ubuntu 14.04 or older:
- aptitude install gcc cmake make libfuse-dev libpolarssl-dev ruby-dev
- `aptitude install gcc cmake make libfuse-dev libpolarssl-dev ruby-dev`
For Debian-like distos based on Debian Stretch or Ubuntu 16.04 or later:
- `aptitude install gcc cmake make libfuse-dev libmbedtls-dev ruby-dev`
For Fedora-like:
- dnf install gcc cmake make fuse-devel mbedtls-devel ruby-devel rubypick
- `dnf install gcc cmake make fuse-devel mbedtls-devel ruby-devel rubypick`
Alternatively, running "dnf install dislocker fuse-dislocker" to use the
Alternatively, running `dnf install dislocker fuse-dislocker` to use the
already existing RPM packages in Fedora could be a clever idea.
For RHEL-like (including CentOS Scientific Linux):
- yum install gcc cmake make fuse-devel mbedtls-devel ruby-devel /usr/bin/ruby
- `yum install gcc cmake make fuse-devel mbedtls-devel ruby-devel /usr/bin/ruby`
Alternatively, running "yum install dislocker fuse-dislocker" to use the
Alternatively, running `yum install dislocker fuse-dislocker` to use the
already existing RPM packages in EPEL could be a clever idea.
For FreeBSD:
- pkg install cmake gmake fusefs-libs polarssl
- `pkg install cmake gmake fusefs-libs mbedtls`
For OSX: Follow the instructions in the next section.
......@@ -49,21 +53,14 @@ Each OS type has its own section below, beware to follow yours:
## If you are on MacOSX...
Just install Homebrew (http://brew.sh/) and run the following command:
Just install Homebrew (http://brew.sh/) and run the following commands:
```
brew update
brew install Caskroom/cask/osxfuse
brew install src/dislocker.rb
```
This will install dislocker.
You may have to follow the 'mbedTLS 2.0.0' section below. If so, you will have
to install OSXfuse and cmake through Homebrew first:
```
brew install osxfuse cmake
```
And once you have followed the 'mbedTLS 2.0.0' section's instructions, you can
follow the steps below, in the 'If you are NOT on MacOSX...' point (even if you
are on MacOSX).
## If you're on FreeBSD...
......@@ -128,7 +125,7 @@ You can then resume the installation where you have left it.
# PORTABILITY
Globally, this was successfuly tested on Linux x86/x86_64, MacOSX and FreeBSD.
Globally, this was successfully tested on Linux x86/x86_64, MacOSX and FreeBSD.
It won't work on Windows and may not work on other BSDs (not tested).
For MacOSX, it has been tested against OSXFUSE 2.3.8 and 2.3.9.
......@@ -146,7 +143,8 @@ Whether it works or not, feel free to send comments and feedbacks to
Five binaries are built when compiling dislocker as described in the `INSTALL.md`
file:
1. `dislocker-bek`: for disecting a .bek file and printing information about it
1. `dislocker-bek`: for dissecting a .bek file and printing information about it
2. `dislocker-metadata`: for printing information about a BitLocker-encrypted volume
......
......@@ -4,11 +4,11 @@
This software has been designed to read BitLocker encrypted partitions under a
Linux system. The driver used to only read volumes encrypted under a Windows 7
system but see now its capabilities extended to:
- Windows Vista, 7, 8, 8.1 and 10 encrypted partitions;
- BitLocker-To-Go encrypted partitions - that's USB/FAT32 partitions;
- be able to write on the above partitions.
Linux system. The driver has the capability to read/write on:
- Windows Vista, 7, 8, 8.1 and 10 encrypted partitions - that's AES-CBC,
AES-XTS, 128 or 256 bits, with or without the Elephant diffuser, encrypted
partitions;
- BitLocker-To-Go encrypted partitions - that's USB/FAT32 partitions.
The core driver is composed of a library, with multiple binaries (see the NOTES
section below) using this library. Two binaries are of interest when wanting to
......@@ -30,7 +30,7 @@ create that file, depending on the size of the encrypted partition. But
afterward, once the partition is decrypted, the access to the NTFS partition
will be faster. Another thing to think about is the size on your disk this
binary needs: the same size as the volume you're trying to decrypt.
Nethertheless, once the partition is decrypted, you can mount your file as any
Nevertheless, once the partition is decrypted, you can mount your file as any
NTFS partition.
......@@ -50,7 +50,8 @@ Once installed, see `dislocker(1)` for details on how to use it.
There may be bugs, and I'll be happy to hear about it!
Feel free to send comments and feedbacks to [dislocker __AT__ hsc __DOT__ fr]().
Feel free to send comments and feedbacks to [dislocker __AT__ hsc __DOT__ fr](),
or to open an [issue](https://github.com/Aorimn/dislocker/issues).
......@@ -74,11 +75,23 @@ whether the volume is a standard BitLocker partition or a BitLocker-To-Go one.
## A note on fstab
BitLocker partitions can be mount-ed using the /etc/fstab file and dislocker's
long options.
The line below is an example line, which has to be adapted to each case:
```
/dev/sda2 /mnt/dislocker fuse.dislocker user-password=blah,nofail 0 0
```
## Note
Five binaries are built when compiling dislocker as described in the `INSTALL.md`
file:
1. `dislocker-bek`: for disecting a .bek file and printing information about it
1. `dislocker-bek`: for dissecting a .bek file and printing information about it
2. `dislocker-metadata`: for printing information about a BitLocker-encrypted volume
......
# Find the FUSE includes and library
#
# FUSE_INCLUDE_DIRSS - where to find fuse.h, etc.
# FUSE_LIBRARIES - List of libraries when using FUSE.
# FUSE_FOUND - True if FUSE lib is found.
# check if already in cache, be silent
IF (FUSE_INCLUDE_DIRS)
SET (FUSE_FIND_QUIETLY TRUE)
ENDIF (FUSE_INCLUDE_DIRS)
# find includes
FIND_PATH (FUSE_INCLUDE_DIRS fuse.h
/usr/local/include/osxfuse
/usr/local/include
/usr/include
)
# find lib
if (APPLE)
SET(FUSE_NAMES libosxfuse.dylib fuse)
else (APPLE)
SET(FUSE_NAMES fuse)
endif (APPLE)
FIND_LIBRARY(FUSE_LIBRARIES
NAMES ${FUSE_NAMES}
PATHS /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib
)
include ("FindPackageHandleStandardArgs")
find_package_handle_standard_args ("FUSE" DEFAULT_MSG
FUSE_INCLUDE_DIRS FUSE_LIBRARIES)
mark_as_advanced (FUSE_INCLUDE_DIRS FUSE_LIBRARIES)
......@@ -49,20 +49,32 @@ if( ${POLARSSL_LIBRARIES-NOTFOUND} )
return()
endif()
execute_process(
COMMAND echo "#include <${POLARSSL_INC_FOLDER}/version.h>\n#include <stdio.h>\nint main(){printf(${POLARSSL_REAL_NAME}_VERSION_STRING);return 0;}"
OUTPUT_FILE a.c
)
execute_process(
COMMAND ${CMAKE_C_COMPILER} a.c -I${POLARSSL_INCLUDE_DIRS} ${POLARSSL_LIBRARIES}
)
execute_process(
COMMAND ./a.out
OUTPUT_VARIABLE POLARSSL_VERSION_STRING
)
execute_process(
COMMAND ${CMAKE_COMMAND} -E remove a.c a.out
)
if( NOT CMAKE_CROSSCOMPILING )
execute_process(
COMMAND echo "#include <${POLARSSL_INC_FOLDER}/version.h>\n#include <stdio.h>\nint main(){printf(${POLARSSL_REAL_NAME}_VERSION_STRING);return 0;}"
OUTPUT_FILE a.c
)
execute_process(
COMMAND ${CMAKE_C_COMPILER} a.c -I${POLARSSL_INCLUDE_DIRS} ${POLARSSL_LIBRARIES}
)
execute_process(
COMMAND ./a.out
OUTPUT_VARIABLE POLARSSL_VERSION_STRING
)
execute_process(
COMMAND ${CMAKE_COMMAND} -E remove a.c a.out
)
else()
execute_process(
COMMAND grep -w "MBEDTLS_VERSION_STRING" ${POLARSSL_INCLUDE_DIRS}/${POLARSSL_INC_FOLDER}/version.h
COMMAND sed -e "s@\s\+@ @g"
COMMAND cut -d\ -f3
COMMAND sed -e "s@\"@@g"
OUTPUT_VARIABLE POLARSSL_VERSION_STRING
)
endif()
message("PolarSSL/mbedTLS version: " ${POLARSSL_VERSION_STRING})
if( "${POLARSSL_VERSION_STRING}" STREQUAL "2.0.0" AND NOT "${POLARSSL_USED_LIBRARY}" STREQUAL "mbedcrypto" )
message("*** WARNING *** Your mbedTLS version is 2.0.0, it's possible the `make' command doesn't work.\nPlease refer to the INSTALL.md's \"mbedTLS 2.0.0\" section if you have any problem.\n")
......
......@@ -77,6 +77,8 @@ typedef enum {
*/
void dis_usage();
int dis_getopts(dis_context_t dis_ctx, int argc, char** argv);
int dis_getopt(dis_context_t dis_ctx, dis_opt_e opt_name, void** opt_value);
int dis_setopt(dis_context_t dis_ctx, dis_opt_e opt_name, const void* opt_value);
void dis_free_args(dis_context_t dis_ctx);
void dis_print_args(dis_context_t dis_ctx);
......
......@@ -4,7 +4,7 @@
.SH NAME
Dislocker file - Read BitLocker encrypted volumes under Linux, OSX and FreeBSD.
.SH SYNOPSIS
dislocker-file [-hqrsv] [-l \fILOG_FILE\fR] [-o \fIOFFSET\fR] [-V \fIVOLUME\fR \fIDECRYPTMETHOD\fR -F[\fIN\fR]] [--] \fINTFS_FILE\fR
dislocker-file [-hqrsv] [-l \fILOG_FILE\fR] [-O \fIOFFSET\fR] [-V \fIVOLUME\fR \fIDECRYPTMETHOD\fR -F[\fIN\fR]] [--] \fINTFS_FILE\fR
Where DECRYPTMETHOD = {-p[\fIRECOVERY_PASSWORD\fR] | -f \fIBEK_FILE\fR | -u[\fIUSER_PASSWORD\fR] | -k \fIFVEK_FILE\fR | -c}
.SH DESCRIPTION
......@@ -20,7 +20,7 @@ For program's options description, see dislocker-fuse(1). The only change in the
.B NTFS_FILE
the newly created file where NTFS data will be put to, once decrypted from the BitLocker encrypted volume.
.SH EXAMPLES
These are exemples you can run directly.
These are examples you can run directly.
Dislock the BitLocker encrypted volume:
.IP
......@@ -43,6 +43,6 @@ You may have to completely unmount the NTFS partition before halting the system.
Note that these are \fBexamples\fR and, as such, you may need to modify the given command lines. For example, you may want to change the decryption method used in them.
.SH AUTHOR
This tool is developped by Romain Coltel on behalf of HSC (\fBhttp://www.hsc.fr/\fR)
This tool is developed by Romain Coltel on behalf of HSC (\fBhttp://www.hsc.fr/\fR)
.PP
Feel free to send bugs report to <dislocker __AT__ hsc __DOT__ fr>
\ No newline at end of file
Feel free to send bugs report to <dislocker __AT__ hsc __DOT__ fr>
......@@ -4,7 +4,7 @@
.SH NAME
Dislocker fuse - Read/write BitLocker encrypted volumes under Linux, OSX and FreeBSD.
.SH SYNOPSIS
dislocker-fuse [-hqrsv] [-l \fILOG_FILE\fR] [-o \fIOFFSET\fR] [-V \fIVOLUME\fR \fIDECRYPTMETHOD\fR -F[\fIN\fR]] [-- \fIARGS\fR...]
dislocker-fuse [-hqrsv] [-l \fILOG_FILE\fR] [-O \fIOFFSET\fR] [-V \fIVOLUME\fR \fIDECRYPTMETHOD\fR -F[\fIN\fR]] [-- \fIARGS\fR...]
Where DECRYPTMETHOD = {-p[\fIRECOVERY_PASSWORD\fR] | -f \fIBEK_FILE\fR | -u[\fIUSER_PASSWORD\fR] | -k \fIFVEK_FILE\fR | -c}
.SH DESCRIPTION
......@@ -36,9 +36,9 @@ See the FVEK FILE section below to understand what is to be put into this \fIFVE
.B -l, --logfile \fILOG_FILE\fR
put messages into this file (stdout by default)
.TP
.B -o, --offset \fIOFFSET\fR
BitLocker partition offset in base 10 (default is 0).
Protip: in your shell, you probably can pass \fB-o $((\fI0xdeadbeef\fB))\fR if you have a 16-based number and are too lazy to convert it in another way.
.B -O, --offset \fIOFFSET\fR
BitLocker partition offset, in bytes, in base 10 (default is 0).
Protip: in your shell, you probably can pass \fB-O $((\fI0xdeadbeef\fB))\fR if you have a 16-based number and are too lazy to convert it in another way.
.TP
.B -p, --recovery-password=[\fIRECOVERY_PASSWORD\fB]\fR
decrypt volume using the recovery password method.
......@@ -81,13 +81,13 @@ The FVEK file option expects a specific format from the file. The file is split
The file is therefore 66 bytes long, not more nor less.
Note that you may have to deal with endianness.
.SH EXAMPLES
These are exemples you can run directly.
These are examples you can run directly.
First, you may want to copy the BitLocker volume:
.IP
.B % dd if=/dev/sda2 of=encrypted.bitlocker
.IP
This will copy the entire volume located into \fB/dev/sda2\fR to \fBencrypted.bitlocker\fR.
You're not forced to do this step, but this will ensure no write whatesoever is performed on the BitLocker volume.
You're not forced to do this step, but this will ensure no write whatsoever is performed on the BitLocker volume.
.P
Then dislock it:
.IP
......@@ -110,6 +110,6 @@ It seems that you have to unmount the NTFS partition and the dislocker one befor
.P
Note that these are \fBexamples\fR and, as such, may need to be modified. For instance, you may want to change the decryption method used in them.
.SH AUTHOR
This tool is developped by Romain Coltel on behalf of HSC (\fBhttp://www.hsc.fr/\fR)
This tool is developed by Romain Coltel on behalf of HSC (\fBhttp://www.hsc.fr/\fR)
.PP
Feel free to send bugs report to <dislocker __AT__ hsc __DOT__ fr>
\ No newline at end of file
Feel free to send bugs report to <dislocker __AT__ hsc __DOT__ fr>
......@@ -4,7 +4,7 @@
.SH NAME
Dislocker file - Read BitLocker encrypted volumes under Linux, OSX and FreeBSD.
.SH SYNOPSIS
dislocker-file [-hqrsv] [-l \fILOG_FILE\fR] [-o \fIOFFSET\fR] [-V \fIVOLUME\fR \fIDECRYPTMETHOD\fR -F[\fIN\fR]] [--] \fINTFS_FILE\fR
dislocker-file [-hqrsv] [-l \fILOG_FILE\fR] [-O \fIOFFSET\fR] [-V \fIVOLUME\fR \fIDECRYPTMETHOD\fR -F[\fIN\fR]] [--] \fINTFS_FILE\fR
Where DECRYPTMETHOD = {-p[\fIRECOVERY_PASSWORD\fR] | -f \fIBEK_FILE\fR | -u[\fIUSER_PASSWORD\fR] | -k \fIFVEK_FILE\fR | -c}
.SH DESCRIPTION
......@@ -20,7 +20,7 @@ For program's options description, see dislocker-fuse(1). The only change in the
.B NTFS_FILE
the newly created file where NTFS data will be put to, once decrypted from the BitLocker encrypted volume.
.SH EXAMPLES
These are exemples you can run directly.
These are examples you can run directly.
Dislock the BitLocker encrypted volume:
.IP
......@@ -40,6 +40,6 @@ You may have to unmount the NTFS partition before halting the system. In order t
Note that these are \fBexamples\fR and, as such, you may need to modify the given command lines. For example, you may want to change the decryption method used in them.
.SH AUTHOR
This tool is developped by Romain Coltel on behalf of HSC (\fBhttp://www.hsc.fr/\fR)
This tool is developed by Romain Coltel on behalf of HSC (\fBhttp://www.hsc.fr/\fR)
.PP
Feel free to send bugs report to <dislocker __AT__ hsc __DOT__ fr>
\ No newline at end of file
Feel free to send bugs report to <dislocker __AT__ hsc __DOT__ fr>
......@@ -20,7 +20,7 @@ print the help and exit
.B files
check for BitLocker-encrypted partitions among these files instead of trying to find them alone
.SH RETURN VALUES
-1 means an error occured, other numbers are the number of BitLocker-encrypted volumes found. For example, 0 means no volume has been found, 42 means 42 volumes have been found.
-1 means an error occurred, other numbers are the number of BitLocker-encrypted volumes found. For example, 0 means no volume has been found, 42 means 42 volumes have been found.
.SH EXAMPLES
No volume is found automatically, the program returns 0 volume found (the last line comes from the echo):
.IP
......@@ -39,6 +39,6 @@ Two volumes are found, the program returns this number (the last line comes from
2
.fi
.SH AUTHOR
This tool is developped by Romain Coltel on behalf of HSC (\fBhttp://www.hsc.fr/\fR)
This tool is developed by Romain Coltel on behalf of HSC (\fBhttp://www.hsc.fr/\fR)
.PP
Feel free to send bugs report to <dislocker __AT__ hsc __DOT__ fr>
\ No newline at end of file
Feel free to send bugs report to <dislocker __AT__ hsc __DOT__ fr>
......@@ -4,7 +4,7 @@
.SH NAME
Dislocker fuse - Read/write BitLocker encrypted volumes under Linux, OSX and FreeBSD.
.SH SYNOPSIS
dislocker-fuse [-hqrsv] [-l \fILOG_FILE\fR] [-o \fIOFFSET\fR] [-V \fIVOLUME\fR \fIDECRYPTMETHOD\fR -F[\fIN\fR]] [-- \fIARGS\fR...]
dislocker-fuse [-hqrsv] [-l \fILOG_FILE\fR] [-O \fIOFFSET\fR] [-V \fIVOLUME\fR \fIDECRYPTMETHOD\fR -F[\fIN\fR]] [-- \fIARGS\fR...]
Where DECRYPTMETHOD = {-p[\fIRECOVERY_PASSWORD\fR] | -f \fIBEK_FILE\fR | -u[\fIUSER_PASSWORD\fR] | -k \fIFVEK_FILE\fR | -c}
.SH DESCRIPTION
......@@ -36,9 +36,9 @@ See the FVEK FILE section below to understand what is to be put into this \fIFVE
.B -l, --logfile \fILOG_FILE\fR
put messages into this file (stdout by default)
.TP
.B -o, --offset \fIOFFSET\fR
BitLocker partition offset in base 10 (default is 0).
Protip: in your shell, you probably can pass \fB-o $((\fI0xdeadbeef\fB))\fR if you have a 16-based number and are too lazy to convert it in another way.
.B -O, --offset \fIOFFSET\fR
BitLocker partition offset, in bytes, in base 10 (default is 0).
Protip: in your shell, you probably can pass \fB-O $((\fI0xdeadbeef\fB))\fR if you have a 16-based number and are too lazy to convert it in another way.
.TP
.B -p, --recovery-password=[\fIRECOVERY_PASSWORD\fB]\fR
decrypt volume using the recovery password method.
......@@ -81,13 +81,13 @@ The FVEK file option expects a specific format from the file. The file is split
The file is therefore 66 bytes long, not more nor less.
Note that you may have to deal with endianness.
.SH EXAMPLES
These are exemples you can run directly.
These are examples you can run directly.
First, you may want to copy the BitLocker volume:
.IP
.B % dd if=/dev/sda2 of=encrypted.bitlocker
.IP
This will copy the entire volume located into \fB/dev/sda2\fR to \fBencrypted.bitlocker\fR.
You're not forced to do this step, but this will ensure no write whatesoever is performed on the BitLocker volume.
You're not forced to do this step, but this will ensure no write whatsoever is performed on the BitLocker volume.
.P
Then dislock it:
.IP
......@@ -107,6 +107,6 @@ It seems that you have to unmount the NTFS partition and the dislocker one befor
.P
Note that these are \fBexamples\fR and, as such, may need to be modified. For instance, you may want to change the decryption method used in them.
.SH AUTHOR
This tool is developped by Romain Coltel on behalf of HSC (\fBhttp://www.hsc.fr/\fR)
This tool is developed by Romain Coltel on behalf of HSC (\fBhttp://www.hsc.fr/\fR)
.PP
Feel free to send bugs report to <dislocker __AT__ hsc __DOT__ fr>
\ No newline at end of file
Feel free to send bugs report to <dislocker __AT__ hsc __DOT__ fr>
......@@ -17,6 +17,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
if("${CMAKE_SOURCE_DIR}" MATCHES "src/?$")
message(FATAL_ERROR "\nPlease execute cmake from the directory above, not the src/ directory.")
return()
endif()
add_definitions (-DPROGNAME="${PROJECT_NAME}")
add_definitions (-DAUTHOR="${AUTHOR}")
......@@ -34,7 +38,9 @@ else()
add_definitions (-D__ARCH_X86)
endif()
include_directories (SYSTEM /usr/local/include)
if( NOT CMAKE_CROSSCOMPILING )
include_directories (SYSTEM /usr/local/include)
endif()
include_directories (${PROJECT_SOURCE_DIR}/include)
set (LIB pthread)
......@@ -54,7 +60,7 @@ set (SOURCES
)
if(NOT DEFINED WARN_FLAGS)
set (WARN_FLAGS "-Wall -Werror -Wextra" CACHE STRING "" FORCE)
set (WARN_FLAGS "-Wall -Wextra" CACHE STRING "" FORCE)
endif()
if(NOT DEFINED HARDEN_FLAGS)
set (HARDEN_FLAGS "-fstack-protector -fstrict-aliasing -D_FORTIFY_SOURCE=2 -O1" CACHE STRING "" FORCE)
......@@ -123,6 +129,12 @@ if(RUBY_FOUND AND RUBY_INCLUDE_DIRS AND RUBY_LIBRARIES)
set (SOURCES ${SOURCES} ruby.c)
endif()
find_package (FUSE)
if(FUSE_FOUND AND FUSE_INCLUDE_DIRS AND FUSE_LIBRARIES)
include_directories (${FUSE_INCLUDE_DIRS})
set (LIB "${LIB} ${FUSE_LIBRARIES}")
endif()
# Places
if(NOT DEFINED sharedir)
set(sharedir ${CMAKE_INSTALL_PREFIX}/share)
......@@ -149,7 +161,7 @@ if(NOT DEFINED bindir)
endif()
string (TOLOWER "${CMAKE_SYSTEM_NAME}" SYSNAME)
set (DIS_MAN ../man/${SYSNAME})
set (DIS_MAN ${PROJECT_SOURCE_DIR}/man/${SYSNAME})
# RPATH handling
if(POLICY CMP0042)
......@@ -185,22 +197,24 @@ target_link_libraries (${BIN_FUSE} ${FUSE_LIB} ${PROJECT_NAME})
set_target_properties (${BIN_FUSE} PROPERTIES COMPILE_DEFINITIONS FUSE_USE_VERSION=26)
set_target_properties (${BIN_FUSE} PROPERTIES LINK_FLAGS "-pie -fPIE")
add_custom_command (TARGET ${BIN_FUSE} POST_BUILD
COMMAND gzip -c ${DIS_MAN}/${BIN_FUSE}.1 > ${DIS_MAN}/${BIN_FUSE}.1.gz
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/man/
COMMAND gzip -c ${DIS_MAN}/${BIN_FUSE}.1 > ${CMAKE_BINARY_DIR}/man/${BIN_FUSE}.1.gz
)
set (CLEAN_FILES ${CLEAN_FILES} ${DIS_MAN}/${BIN_FUSE}.1.gz)
set (CLEAN_FILES ${CLEAN_FILES} ${CMAKE_BINARY_DIR}/man/${BIN_FUSE}.1.gz)
install (TARGETS ${BIN_FUSE} RUNTIME DESTINATION "${bindir}")
install (FILES ${DIS_MAN}/${BIN_FUSE}.1.gz DESTINATION "${mandir}/man1")
install (FILES ${CMAKE_BINARY_DIR}/man/${BIN_FUSE}.1.gz DESTINATION "${mandir}/man1")
set (BIN_FILE ${PROJECT_NAME}-file)
add_executable (${BIN_FILE} ${BIN_FILE}.c)
target_link_libraries (${BIN_FILE} ${PROJECT_NAME})
set_target_properties (${BIN_FILE} PROPERTIES LINK_FLAGS "-pie -fPIE")
add_custom_command (TARGET ${BIN_FILE} POST_BUILD
COMMAND gzip -c ${DIS_MAN}/${BIN_FILE}.1 > ${DIS_MAN}/${BIN_FILE}.1.gz
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/man/
COMMAND gzip -c ${DIS_MAN}/${BIN_FILE}.1 > ${CMAKE_BINARY_DIR}/man/${BIN_FILE}.1.gz
)
set (CLEAN_FILES ${CLEAN_FILES} ${DIS_MAN}/${BIN_FILE}.1.gz)
set (CLEAN_FILES ${CLEAN_FILES} ${CMAKE_BINARY_DIR}/man/${BIN_FILE}.1.gz)
install (TARGETS ${BIN_FILE} RUNTIME DESTINATION "${bindir}")
install (FILES ${DIS_MAN}/${BIN_FILE}.1.gz DESTINATION "${mandir}/man1")
install (FILES ${CMAKE_BINARY_DIR}/man/${BIN_FILE}.1.gz DESTINATION "${mandir}/man1")
set (BIN_METADATA ${PROJECT_NAME}-metadata)
add_executable (${BIN_METADATA} ${BIN_METADATA}.c)
......@@ -224,11 +238,12 @@ if(RUBY_FOUND)
)
set (CLEAN_FILES ${CLEAN_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${BIN_FIND})
add_custom_command (TARGET ${BIN_FIND} POST_BUILD
COMMAND gzip -c ${DIS_MAN}/${BIN_FIND}.1 > ${DIS_MAN}/${BIN_FIND}.1.gz
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/man/
COMMAND gzip -c ${DIS_MAN}/${BIN_FIND}.1 > ${CMAKE_BINARY_DIR}/man/${BIN_FIND}.1.gz
)
set (CLEAN_FILES ${CLEAN_FILES} ${DIS_MAN}/${BIN_FIND}.1.gz)
set (CLEAN_FILES ${CLEAN_FILES} ${CMAKE_BINARY_DIR}/man/${BIN_FIND}.1.gz)
install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${BIN_FIND} DESTINATION "${bindir}")
install (FILES ${DIS_MAN}/${BIN_FIND}.1.gz DESTINATION "${mandir}/man1")
install (FILES ${CMAKE_BINARY_DIR}/man/${BIN_FIND}.1.gz DESTINATION "${mandir}/man1")
else()
set (BIN_FIND true)
endif()
......
......@@ -125,12 +125,79 @@ ssize_t dis_read(int fd, void* buf, size_t count)
dis_printf(L_DEBUG, "Reading %# " F_SIZE_T " bytes from #%d into %p\n", count, fd, buf);
#ifdef __FREEBSD
/*
* FreeBSD's devices are character devices which are to be accessed one
* block at a time. Exactly what one block is remains a mystery atm, so we
* assume it's a sector, and that a sector is 512-bytes long.
* So we count the number of sectors the requested read is on, read them all
* and copy to the user only the requested data.
*/
uint16_t sector_size = 512;
off_t offset = lseek(fd, 0, SEEK_CUR);
unsigned int sector_to_add = 0;
off_t new_offset = -1;
size_t old_count = count;
void* old_buf = buf;
if((offset % sector_size) != 0)
sector_to_add += 1;
if(((offset + (off_t)count) % sector_size) != 0)
sector_to_add += 1;
new_offset = (offset / sector_size) * sector_size;
count = ((count / sector_size) + sector_to_add) * sector_size;
if(lseek(fd, new_offset, SEEK_SET) != new_offset)
{
dis_printf(
L_ERROR,
"Cannot lseek(2) to boundary %#" F_OFF_T "\n",
new_offset
);
errno = EIO;
return -1;
}
buf = dis_malloc(count * sizeof(char));
if(buf == NULL)
{
dis_printf(
L_ERROR,
"Cannot malloc %" F_SIZE_T " bytes\n",
count * sizeof(char)
);
errno = EIO;
return -1;
}
#endif
if((res = read(fd, buf, count)) < 0)
{
dis_errno = errno;
dis_printf(L_ERROR, DIS_XREAD_FAIL_STR " #%d: %s\n", fd, strerror(errno));
}
#ifdef __FREEBSD
/* What is remaining is just to copy actual data */
memcpy(old_buf, (char*) buf + (offset - new_offset), old_count);
dis_free(buf);
if(lseek(fd, offset + (off_t)old_count, SEEK_SET) == -1)
{
dis_printf(
L_ERROR,
"Cannot lseek(2) for restore to %#" F_OFF_T "\n",
offset + (off_t)old_count
);
errno = EIO;
return -1;
}
/* Fake the return value */
res = (ssize_t) old_count;
#endif
return res;
}
......@@ -175,7 +242,7 @@ off_t dis_lseek(int fd, off_t offset, int whence)
{
off_t res = -1;
dis_printf(L_DEBUG, "Positionnong #%d at offset %lld from %d\n", fd, offset, whence);
dis_printf(L_DEBUG, "Positioning #%d at offset %lld from %d\n", fd, offset, whence);
if((res = lseek(fd, offset, whence)) < 0)
{
......
This diff is collapsed.
......@@ -191,6 +191,8 @@ struct fuse_operations fs_oper = {
*/
int main(int argc, char** argv)
{
char* volume_path = NULL;
// Check parameters number
if(argc < 2)
{
......@@ -201,11 +203,28 @@ int main(int argc, char** argv)
int param_idx = 0;
int ret = EXIT_SUCCESS;
/* Get command line options */
dis_ctx = dis_new();
param_idx = dis_getopts(dis_ctx, argc, argv);
/*
* Check we have a volume path given and if not, take the first non-argument
* as the volume path
*/
dis_getopt(dis_ctx, DIS_OPT_VOLUME_PATH, (void**) &volume_path);
if(volume_path == NULL)
{
if(param_idx >= argc || param_idx <= 0)
{
dis_printf(L_CRITICAL, "Error, no volume path given. Abort.\n");
return EXIT_FAILURE;
}
dis_printf(L_DEBUG, "Setting the volume path to %s.\n", argv[param_idx]);
dis_setopt(dis_ctx, DIS_OPT_VOLUME_PATH, argv[param_idx]);
param_idx++;
}
/* Initialize dislocker */
if(dis_initialize(dis_ctx) != DIS_RET_SUCCESS)
{
......
FILESEXTRAPATHS_prepend := "${THISDIR}/dislocker:"
SUMMARY = "Read BitLocker encrypted partitions under a Linux system"
DESCRIPTION = " \
This software has been designed to read BitLocker encrypted partitions under a \
Linux system. The driver has the capability to read/write on: \
- Windows Vista, 7, 8, 8.1 and 10 encrypted partitions - that's AES-CBC, \
AES-XTS, 128 or 256 bits, with or without the Elephant diffuser, encrypted \
partitions; \
- BitLocker-To-Go encrypted partitions - that's USB/FAT32 partitions. \
"
HOMEPAGE = "https://github.com/Aorimn/dislocker"
BUGTRACKER = "https://github.com/Aorimn/dislocker/issues"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=6aa0d8e41ad2e57bef0712adf0cf5cb5"
SECTION = "e/utils"
SRC_URI = "https://github.com/Aorimn/dislocker/archive/v${PV}.tar.gz"
SRC_URI[md5sum] = "0683bd18472d5f9e13f718e4d80ed7c7"
SRC_URI[sha256sum] = "9e36afb0b29714e325d1721332e913bbd357f089a53962fcb7ae62f2e3862d84"
DEPENDS = "mbedtls fuse"
RDEPENDS_${PN} += "mbedtls fuse"
PROVIDES += "dislocker"
RPROVIDES_${PN} = "dislocker"
EXTRA_OECMAKE = " -DLIB_INSTALL_DIR=${baselib}"
inherit cmake
......@@ -493,16 +493,16 @@ int enlock(dis_context_t dis_ctx, uint8_t* buffer, off_t offset, size_t size)
return -EFAULT;
}
if((size_t)offset + size >= (size_t)dis_ctx->io_data.volume_size)
if(offset + (off_t)size >= (off_t)dis_ctx->io_data.volume_size)
{
size_t nsize = (size_t)dis_ctx->io_data.volume_size
- (size_t)offset;
dis_printf(
L_WARNING,
"Size modified as exceeding volume's end (offset=%#"
F_SIZE_T " + size=%#" F_SIZE_T " >= volume_size=%#"
F_SIZE_T ") ; new size: %#" F_SIZE_T "\n",
(size_t)offset, size, (size_t)dis_ctx->io_data.volume_size, nsize
F_OFF_T " + size=%#" F_OFF_T " >= volume_size=%#"
F_OFF_T ") ; new size: %#" F_SIZE_T "\n",
offset, (off_t)size, dis_ctx->io_data.volume_size, nsize
);
size = nsize;
}
......
......@@ -6,13 +6,14 @@ require 'formula'
class Dislocker < Formula
homepage 'https://github.com/Aorimn/dislocker'
url 'https://github.com/Aorimn/dislocker/archive/v0.6.zip'
sha256 '9738fdaa224de5669fe98dbd2a2edfbb1f2d0021e63045140d693c401e673ce4'
version '0.6.0'
url 'https://github.com/Aorimn/dislocker/archive/v0.7.zip'