Updated post: SCALE-MAMBA 1.3 also requires cryptopp library.

So you have finally decided to give multiparty computation a try but you find the installation of most software so complicated? No need to worry: in this post we will show you how to install our software SCALE-MAMBA in three easy steps.

Although part of the installation is covered in the original documentation we have noticed that a number of users get stuck in the process of installing the dependencies. Hence we focus here on successfully compiling SCALE and in the end we run a sample program as the one present in its documentation.

We begin by fetching the code from github. For simplicity let’s assume that you ran the following command inside your home directory:

cd $HOME; git clone https://github.com/KULeuven-COSIC/SCALE-MAMBA

Also, please check that you have the latest g++. Don’t forget the yasm package and python which can be easily installed by doing:

sudo apt-get install yasm python. Alternatively you can install yasm from its source.

Step 1.

Install mpir, openssl, crypto++, inside ~/local. This ~/local directory can be changed to whatever you wish.

$ mylocal="$HOME/local"
$ mkdir -p ${mylocal}
$ cd ${mylocal}
$ 
$ # install MPIR
$ curl -O 'http://mpir.org/mpir-3.0.0.tar.bz2'
$ tar xf mpir-3.0.0.tar.bz2
$ cd mpir-3.0.0
$ ./configure --enable-cxx --prefix="${mylocal}/mpir"
$ make && make check && make install
$ 
$ # install OpenSSL 1.1.0
$ cd $mylocal
$ curl -O https://www.openssl.org/source/openssl-1.1.0j.tar.gz
$ tar -xf openssl-1.1.0j.tar.gz
$ cd openssl-1.1.0j
$ ./config --prefix="${mylocal}/openssl"
$ make && make install
$ 
$ # install crypto++
$ curl -O https://www.cryptopp.com/cryptopp800.zip
$ unzip cryptopp800.zip -d cryptopp800
$ cd cryptopp800
$ make && make install PREFIX=${mylocal}/cryptopp

Step 2.

Export mpir, openssl and crypto++ paths by copying the following lines at the end of your ~/.bashrc configuration file.

# this goes at the end of your ~/.bashrc file
export mylocal="$HOME/local"

# export OpenSSL paths
export PATH="${mylocal}/openssl/bin/:${PATH}"
export C_INCLUDE_PATH="${mylocal}/openssl/include/:${C_INCLUDE_PATH}"
export CPLUS_INCLUDE_PATH="${mylocal}/openssl/include/:${CPLUS_INCLUDE_PATH}"
export LIBRARY_PATH="${mylocal}/openssl/lib/:${LIBRARY_PATH}"
export LD_LIBRARY_PATH="${mylocal}/openssl/lib/:${LD_LIBRARY_PATH}"

# export MPIR paths
export C_INCLUDE_PATH="${mylocal}/mpir/include/:${C_INCLUDE_PATH}"
export CPLUS_INCLUDE_PATH="${mylocal}/mpir/include/:${CPLUS_INCLUDE_PATH}"
export LIBRARY_PATH="${mylocal}/mpir/lib/:${LIBRARY_PATH}"
export LD_LIBRARY_PATH="${mylocal}/mpir/lib/:${LD_LIBRARY_PATH}"

# export Crypto++ paths
export CPLUS_INCLUDE_PATH="${mylocal}/cryptopp/include/:${CPLUS_INCLUDE_PATH}"
export LIBRARY_PATH="${mylocal}/cryptopp/lib/:${LIBRARY_PATH}"
export LD_LIBRARY_PATH="${mylocal}/cryptopp/lib/:${LD_LIBRARY_PATH}"

Time to load the newly added paths into your terminal via source ~/.bashrc.

Step 3.

Modify CONFIG.mine accordingly and compile the project:

$ cd ~/SCALE-MAMBA
$ cp CONFIG CONFIG.mine
$ echo "ROOT = $HOME/SCALE-MAMBA" >> CONFIG.mine
$ echo "OSSL = ${mylocal}/openssl" >> CONFIG.mine
$ make progs

That’s it! After make finishes then you should see a Player.x executable inside the SCALE-MAMBA directory.

Run a simple example

Since SCALE supports many adversary structures such as dishonest majority, Q2 access structure or even different sharing schemes such as additive, replicated or Shamir sharing (see readme for details) it might be overwhelming to a novice to figure out what and how to use it.

So let’s simply follow the Idiot’s installation from guide (can you guess who wrote it?) where we run a simple program using 3-parties Shamir resistant against 1 corruption on a localhost.

# setup 1 out of 3 Shamir on a localhost
$ cp Auto-Test-Data/Cert-Store/* Cert-Store/
$ cp Auto-Test-Data/1/* Data/

We then compile a simple program written in a python like language (hence the MAMBA naming):

./compile.py Programs/tutorial

Finally, get some new terminal windows to run a 3-party protocol described by Programs/tutorial/tutorial.mpc with an 1 out of 3 Shamir sharing scheme.

./Player.x 0 Programs/tutorial
./Player.x 1 Programs/tutorial
./Player.x 2 Programs/tutorial

If you have reached this far then it means you’ve successfully installed SCALE-MAMBA and ran a simple program, good job! In the next blogposts we will describe how to run more interesting programs, stay tuned.