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
 
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?
 
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.
 
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)
 
A very big thanks to cybacolt for this excellent post, detailing not only every individual step,
but also linking to all relevant resources!
I recently tried to replicate this procedure, but found that not everything works quite as intended for me.

When downloading from github, the links usually redirect, but curl (at least for me)
does not automatically follow these links. This can be achieved by using the "-L" switch.

I was not able to compile wxWidgets 3.1.4 with the given makefile from VeraCrypt,
because this version did not like the --disable-webkit parameter in the flags.
I edited the makefile and replaced --disable-webkit with --disable-gui. That did the trick for me.

Trying to subsequently compile VeraCrypt, there was a problem with CPU option processing in combination with setting the architecture explicitly.
It would always try to use AES-NI, which is not supported by my CPU. However, using the automatic architecture selection worked.
I also did not deactivate the ASM optimization and I explicitly required the SSSE3 option.

So in summary, I compiled wxWidgets with
Bash:
make WXSTATIC=1 SSSE3=1 WX_ROOT=/InsertYourPathTo/wxWidgets CC=gcc wxbuild
and VeraCrypt with
Bash:
make NOGUI=1 SSSE3=1 WXSTATIC=1 CC=gcc AS=/bin/yasm

Interstingly, make install does not work for me, because some variables are not set.
Then again, I just needed the binary, so I skipped this step.

Versions:
DS1511+
DSM 6.24
wxWidgets 3.1.4
VeraCrypt 1.25-RC1
 
As someone who has been breaking my head trying to compile veracrypt within the Entware/Openwrt Buildroot environment (and failing), I find this a very impressive achievement.
I am going to try this approach to compile and build VC on my QNAP NAS, which also supports Entware.

Many thanks!
 
A very big thanks to cybacolt for this excellent post, detailing not only every individual step,
but also linking to all relevant resources!
I recently tried to replicate this procedure, but found that not everything works quite as intended for me.

When downloading from github, the links usually redirect, but curl (at least for me)
does not automatically follow these links. This can be achieved by using the "-L" switch.

I was not able to compile wxWidgets 3.1.4 with the given makefile from VeraCrypt,
because this version did not like the --disable-webkit parameter in the flags.
I edited the makefile and replaced --disable-webkit with --disable-gui. That did the trick for me.

Trying to subsequently compile VeraCrypt, there was a problem with CPU option processing in combination with setting the architecture explicitly.
It would always try to use AES-NI, which is not supported by my CPU. However, using the automatic architecture selection worked.
I also did not deactivate the ASM optimization and I explicitly required the SSSE3 option.

So in summary, I compiled wxWidgets with
Bash:
make WXSTATIC=1 SSSE3=1 WX_ROOT=/InsertYourPathTo/wxWidgets CC=gcc wxbuild
and VeraCrypt with
Bash:
make NOGUI=1 SSSE3=1 WXSTATIC=1 CC=gcc AS=/bin/yasm

Interstingly, make install does not work for me, because some variables are not set.
Then again, I just needed the binary, so I skipped this step.

Versions:
DS1511+
DSM 6.24
wxWidgets 3.1.4
VeraCrypt 1.25-RC1
I am having a lot of trouble with building veracrypt because my compile keeps failing with AES-NI. What did you do to stop the compiler from trying to use AES-NI?
thank you!
 

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

I use Mozilla Firebird. Ever since. Nothing changed when I try it with Chrome
Replies
7
Views
3,277
  • Question
Alright, after a long time not looking at it, then coming back to it, I decided to not pursue any further...
Replies
1
Views
2,135
Found a good solution to this after both my Samsung TVs started suffering from the NAS disappearing from...
Replies
7
Views
33,003
No problem for me so far, with my packages,.... On my way there will not be writhing to any var so if it...
Replies
3
Views
4,688

Welcome to SynoForum.com!

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

Registration is free, easy and fast!

Back
Top