• Synology has officially announced the release of its latest DSM 7. Read more...

Compiling Veracrypt on your NAS

Currently reading
Compiling Veracrypt on your NAS

3
2
NAS
DS1618
Operating system
  1. Linux
  2. macOS
  3. Windows
Mobile operating system
  1. Android
After much searching and few options on how to do this, I thought I'd have a crack at compiling this myself. I hope someone finds this useful!

There is a container version available, but this lacks some Veracrypt functionality. (eg, mounting whole devices)

Making the mounted drive network-available is also tricky - Samba appears to not allow visibility of FUSE drives, even with 'allow_other' configured. However, although slower, SSHFS works just fine.

DISCLAIMER:
This is for the braver of you, and I offer no assurances this will work for you as it did for me.

REQUIREMENTS:
DSM 6.x
entware oPKG
entware dev headers
Various entware packages
yasm 1.3.0 (source)
VeraCrypt 1.24.update7 (source)
wxWidgets (source)
catch-wx (source)

1) install entware (this will provide you with most of the packages you'll need to compile with):
How To Install a Package Manager on a Synology NAS/Router (ipkg/oPKG)

2) log into the CLI and install these packages:
Bash:
sudo -i
opkg install make nano coreutils coreutils-od findutils-locate sed tar gcc ldd less bzip2 zlib gawk pkg-config

you may also have to upgrade tar further:
Bash:
opkg upgrade tar

3) download required headers:
dev packages (in this case libfuse-dev) are not provided by entware. however, most headers (including the fuse headers) can be manually downloaded. find your architecture in /opt/etc/entware_release. for my DS1618+ architecture of x86_64:
Bash:
sudo -i
cd ~
mkdir include
cd include
curl http://bin.entware.net/x64-k3.2/include/include.tar.gz > include.tar.gz
mv include.tar.gz include
tar xvzf include.tar.gz
mv * /opt/include
cd ~
rmdir include

4) download and install yasm:
Bash:
curl http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz > yasm-1.3.0.tar.gz
tar xvzf yasm-1.3.0.tar.gz
cd yasm-1.3.0
sed -i 's#) ytasm.*#)#' Makefile.in
./configure --prefix=/usr
make
make install
yasm -v

5) download wxWidgets:
Bash:
curl https://github.com/wxWidgets/wxWidgets/archive/master.zip > wxWidgets.zip
unzip wxWidgets.zip

6) download catch-wx:
Bash:
curl https://github.com/wxWidgets/Catch/archive/ee4acb6ae6e32a02bc012d197aa82b1ca7a493ab.zip > catch.zip
unzip catch.zip
mkdir wxWidgets-master/3rdparty/catch
mv Catch-Wx/* wxWidgets-master/3rdparty/catch
rmdir Catch-Wx

7) download VeraCrypt:
Bash:
curl https://github.com/veracrypt/VeraCrypt/archive/master.zip > veracrypt.zip
unzip veracrypt.zip

8) configure the wxWidgets static library for VeraCrypt and build it:
Bash:
cd ../VeraCrypt-master/src/
make WXSTATIC=1 WX_ROOT=/usr/src/wxWidgets ARCH=X86-64 CC=gcc wxbuild

9) create /opt/lib/pkgconfig/fuse.pc, with the following contents:
Code:
prefix=/opt
exec_prefix=${prefix}
libdir=/opt/lib
includedir=${prefix}/include

Name: fuse
Description: Filesystem in Userspace
Version: 2.9.9
Libs: -L${libdir} -lfuse -pthread
Libs.private: -ldl
Cflags: -I${includedir}/fuse -D_FILE_OFFSET_BITS=64

10) compile VeraCrypt:
Bash:
cd ../VeraCrypt-master/src/
make  NOGUI=1 WXSTATIC=1 ARCH=X86-64 CC=gcc AS=/bin/yasm NOASM=1
make install
veracrypt --version

11) Copy to opt/bin:
Bash:
cp ~/VeraCrypt-master-src/Main/veracrypt /opt/bin

12) mount some volumes!
As the Synology kernel may not natively support the encryption scheme you are using, when mounting, use this option: "-m=nokernelcrypto"

mounting a veracrypt volume:
Bash:
veracrypt -k "" --pim=0 --protect-hidden=no -m=nokernelcrypto container.hc /media/veracrypt1

mounting a device with Truecrypt compatibility:
Bash:
veracrypt -tc -k "" --pim=0 --protect-hidden=no -m=nokernelcrypto /dev/sdu /media/veracrypt1

USEFUL RESOURCES:
How To Install a Package Manager on a Synology NAS/Router (ipkg/oPKG)
Truecrypt 7 on Synology
veracrypt/VeraCrypt
yasm-1.3.0
Entware/Entware
 
3
2
NAS
DS1618
Operating system
  1. Linux
  2. macOS
  3. Windows
Mobile operating system
  1. Android
2
0
NAS
DS1515+
Operating system
  1. Windows
Mobile operating system
  1. Android
I have a problem with the above instruction.
in step 5, download and unpack wxWidgets in the ~ directory
then we do the same with catch-wx in step 6 and combine catch with wxWidgets. then in step 8 we set the variables to the WX_ROOT = / usr / src / wxWidgets folder which is not on NAS and the files we downloaded are in ~ / wxWidgets-master. is something missing here?
I have to move the content of ~ / wxWidgets-master to / usr / src / wxWidgets or compile something earlier?
 
2
0
NAS
DS1515+
Operating system
  1. Windows
Mobile operating system
  1. Android
When I copied wxWidgets to the /usr/src/wxWidgets folder and ran 'make WXSTATIC=1 WX=ROOT=/usr/src/wxWidgets ARCH=X86-64 CC=gcc wxbuild'
i got an error message:
make: *** No rule to make target 'wxbuild'. Stop.
 
3
2
NAS
DS1618
Operating system
  1. Linux
  2. macOS
  3. Windows
Mobile operating system
  1. Android
When I copied wxWidgets to the /usr/src/wxWidgets folder and ran 'make WXSTATIC=1 WX=ROOT=/usr/src/wxWidgets ARCH=X86-64 CC=gcc wxbuild'
i got an error message:
make: *** No rule to make target 'wxbuild'. Stop.
Heya,

sorry your having trouble - i can see I've got some of the pathing wrong :( ... my apologies, synology by default does not save bash history, so i had to reconstruct alot of the compilation commands from memory.

Unfotunately, it appears i also cant re-edit the original post, so i'm going to have to post corrections here.

The idea with WxWidgets, is that you Configure the wxWidgets static library for VeraCrypt and build it from within the veracrypt src root directory. as such, you need to reference the WxWidgets path you unzipped to. in my case, the correct command should be:

8) configure the wxWidgets static library for VeraCrypt and build it:
Bash:
cd VeraCrypt-master/src/
make WXSTATIC=1 WX_ROOT=../../wxWidgets-master ARCH=X86-64 CC=gcc wxbuild


(the above command assumes that wxWidgets-master and VeraCrypt-master are in the same directory.)

For reference, the README.md also shows the same instructions. (the first 2 steps of the "Instructions for Building VeraCrypt for Linux and Mac OS X" section)
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

Similar threads

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Trending threads

Top