This short memo gives instructions on how to build the Microsoft Research's Simple Encrypted Arithmetic Library (SEAL) using LLVM/Clang, and also with the Clang Static Analyzer for software quality/security assurance.
The SEAL Library can be downloaded at its website http://sealcrypto.org (it redirects to a Microsoft page). The version of SEAL we use for this demonstration is SEAL_v2.3.0-4_Linux.tar.gz (available at https://www.microsoft.com/en-us/download/details.aspx?id=56202).
For support of C++ 11, we need Clang 3.3 and above. As of April 2018, The current default version of Clang on Ubuntu 16.04 is clang-3.8. Install with aptitude:
sudo aptitude install clang
It installed clang to /usr/bin/clang
, which is a symbolic link to
/usr/lib/llvm-3.8/bin/clang
.
-
First decompress the tarball, and change to the source directory:
tar xvfz SEAL_v2.3.0-4_Linux.tar.gz cd SEAL/SEAL
-
Run the
./configure
command to generate the build scripts:./configure
-
Make a copy of the generated Makefile:
cp Makefile Makefile.clang
-
Open
Makefile.clang
for edit. Replace the lineCXX=g++
withCXX=clang++
. -
Open
seal/util/defines.h
for edit. Comment out (or delete) the following lines:// GNU GCC/G++ #if defined(__GNUC__) && (__GNUC__ < 5) #error "SEAL requires __GNUC__ >= 5" #endif
-
Build using clang with the static analyzer
scan-build make -f Makefile.clang
-
Inspect the Clang static analyzer generated report for potential bugs. One may use the
scan-view
tool or just open theindex.html
file with a browser.