Skip to content
Christoph Schmidt-Hieber edited this page Jan 29, 2016 · 19 revisions

Build Instructions

<wiki:toc max_depth="3" />

Native code

Toolchain setup

  1. Get the current android ndk (r10e at the time of writing).
  2. Set up a standalone toolchain:
      $ cd ${HOME}/android-ndk-r10e/build/tools
      $ rm -rf ${HOME}/android-toolchain
    
  3. On Linux:
      $ ./make-standalone-toolchain.sh --arch=arm --ndk-dir=${HOME}/android-ndk-r10e --install-dir=${HOME}/android-toolchain --platform=android-21 --system=linux-x86_64
    
  4. On Mac:
      $ ./make-standalone-toolchain.sh --arch=arm --ndk-dir=${HOME}/android-ndk-r10e --install-dir=${HOME}/android-toolchain --platform=android-21 --system=darwin-x86_64
    
  5. Get the agcc wrapper scripts, and make sure they're both in your path (e.g. in /usr/local/bin). You'll need to update them in case the NDK version has changed since your last build (e.g. from r8b to r8c).
      $ wget https://neurodroid.googlecode.com/git/nrn/agcc
      $ wget https://neurodroid.googlecode.com/git/nrn/agcc-vfp
      $ sudo mv agcc* /usr/local/bin
      $ sudo chmod +x /usr/local/bin/agcc*
    
  6. Then, get the latest Cryptonite code from the git repository. ${CRYPTONITE} will refer to the cryptonite source directory. It's strongly recommended to put it into ${HOME}/cryptonite at this time because some build scripts use hard-coded references to this directory (someone come up with a solution please!).

You'll need all dependencies listed below (Boost, OpenSSL, FUSE, rlog) to build EncFS and Cryptonite.

Boost

Boost is no longer required since we updated to encfs 1.8.0.

  1. Download and patch Boost:
      $ cd ${CRYPTONITE}/boost
      $ ./download.sh
    
  2. Build Boost:
      $ ./build.sh
    

OpenSSL

  1. Download OpenSSL:
      $ cd ${CRYPTONITE}/openssl
      $ ./download.sh
    
  2. Build OpenSSL:
      $ ./build.sh
    

FUSE

  1. Get FUSE:

      $ cd ${CRYPTONITE}
      $ git submodule init
      $ git submodule update --remote
    
  2. Build FUSE:

      $ cd ${CRYPTONITE}/fuse293
      $ ./build.sh
    

rlog

  1. Download rlog:
      $ cd ${CRYPTONITE}/rlog
      $ ./download.sh
    
  2. Build rlog:
      $ ./build.sh
    

EncFS

  1. Get GNU sed, automake and autoreconf (which is part of the autoconf package on most systems):

    On Ubuntu:

      $ sudo apt-get install autoconf automake
    

    On OS X:

      $ sudo port install gsed autoconf automake
    
  2. Download EncFS for Android:

      $ cd ${CRYPTONITE}
      $ git submodule init
      $ git submodule update --remote
    
  3. Build EncFS:

      $ cd ${CRYPTONITE}/encfs-1.8.1
      $ ./build.sh
    

You'll end up with a split version of the standalone encfs binary in ${CRYPTONITE}/cryptonite/assets/arm{-v7a}/

Cryptonite JNI

  1. Add the file ${CRYPTONITE}/cryptonite/jni/android_key.h if you have it (contains the dropbox keys for this app). Otherwise you can do:
      $ ln -s ${CRYPTONITE}/cryptonite/jni/android_fake.h ${CRYPTONITE}/cryptonite/jni/android_key.h
    
  2. Build libcryptonite.so for armeabi and armeabi-v7a:
      $ cd ${CRYPTONITE}/cryptonite
      $ ./jni-build.sh
    

Cryptonite app

Dependencies

  1. Install the Android SDK for your platform.
  2. Download and unzip ActionBarSherlock and rename the directory to ${HOME}/ActionBarSherlock. In Eclipse do "File -> New -> Android Project -> Create project from existing source" and select the actionbarsherlock dir. If you have lot of errors, check if the project Java compliance is set to 1.6 (Project -> Properties -> Java Compiler).
  3. Download the Dropbox Android SDK and put the unzipped jars (dropbox-android-sdk-x.y.z.jar, httpmime-x.y.z.jar, json_simple.jar) into the ${CRYPTONITE}/cryptonite/libs folder.

Cryptonite

Start a new Android project from existing code in Eclipse using ${CRYPTONITE}/cryptonite as the root directory. Then go to "Configure Build Path -> Add JARs" and add Dropbox SDK jars.

If you don't have the Dropbox keys, generate fake ones:

$ cd ${CRYPTONITE}/cryptonite
$ echo "db-xxxxxxxxxxxxxxx" > AndroidManifest.xml.key
$ echo "db-xxxxxxxxxxxxxxx" > AndroidManifest.xml.key2
$ cd ..

Then, insert the keys into AndroidManifest.xml:

$ cd ${CRYPTONITE}
$ ./insert_key.sh

Make sure that you set the compiler compliance level to 1.6 (Project settings -> Java compiler).

Alternatively, build from the command line. First, generate ${CRYPTONITE}/cryptonite/build.xml if you don't have it yet (android is located in the tools subdirectory of the Android SDK):

$ cd ${CRYPTONITE}/cryptonite
$ android update project --path .

The . at the end of the line is intentional. Then, generate an Android package:

$ cd ${CRYPTONITE}/cryptonite
$ ant debug

This will produce an apk in ${CRYPTONITE}/cryptonite/bin/cryptonite-debug.apk

TrueCrypt

TrueCrypt is shipped as a standalone binary with the Cryptonite apk. It's not required for the GUI and the EncFS part to work. Conversely, you can use the TrueCrypt binary independently of the Cryptonite app.

FUSE

Get the official ndk and build FUSE as described above. You won't need any of the other libraries for TrueCrypt.

wxWidgets

  1. Download and patch wxWidgets:
      $ cd ${CRYPTONITE}/wx
      $ ./download.sh
    
  2. Build wxWidgets:
      $ ./build.sh
    

TrueCrypt

  1. Get the TrueCrypt source distribution and save it under ${CRYPTONITE}/tc/
  2. Extract and patch the source and get some additional header files:
      $ cd ${CRYPTONITE}/tc
      $ ./patch.sh
    
  3. Build TrueCrypt:
      $ ./build.sh
    

The truecrypt binary will be located in ${CRYPTONITE}/tc/truecrypt-7.1a-source/Main/truecrypt. You can push it directly to the Cryptonite app directory if you have a rooted phone:

$ adb root
$ adb push ${CRYPTONITE}/tc/truecrypt-7.1a-source/Main/truecrypt /data/data/csh.cryptonite

And then test whether it's working:

adb shell
# cd /data/data/csh.cryptonite
# ./truecrypt

This should print some usage information if everything went well.