Skip to content

Latest commit

 

History

History
164 lines (127 loc) · 6.01 KB

BUILD.md

File metadata and controls

164 lines (127 loc) · 6.01 KB

AOCL Cryptography Library Build

AOCL-Cryptography uses CMAKE as a build system generator and supports make and Ninja build systems. This document explains the different build flags which can be used to disable/enable specific features for the project. For a quick start into AOCL-Cryptography, please refer to AOCL-Cryptography Linux Quick Starter.

Build

Run from build directory

$ cmake  -DOPENSSL_INSTALL_DIR=[path_to_openssl_install_dir]  -DAOCL_UTILS_INSTALL_DIR=[path_to_utils_install_dir] ../
$ make -j 

Using Ninja build System

$ cmake -G "Ninja" -DOPENSSL_INSTALL_DIR=[path_to_openssl_install_dir]  -DAOCL_UTILS_INSTALL_DIR=[path_to_utils_install_dir] ../
$ ninja 

Enabling Features of AOCL Cryptography

  1. Enable Examples - To compile example/demo code.
  2. Enable AOCL-UTILS - To dispatch correct kernel with CPU identification.
  3. Enable DEBUG Build - To compile code in Debug Mode.
  4. Enable Address Sanitizer Support
  5. Enable Valgrind Memcheck Support
  6. Enable Bench - To compile bench code.
  7. Enable Tests - To compile test code
  8. Build docs in pdf form
  9. Build Doxygen and Sphinx docs
  10. Build with dynamic compiler selection
  11. Build with assembly disabled
  12. Disabling/Enabling Optional Features

Enable Examples

To enable examples, append -DALCP_ENABLE_EXAMPLES=ON to the cmake configuration command.

$ cmake -DALCP_ENABLE_EXAMPLES=ON ../

ALCP_ENABLE_EXAMPLES is ON by default

Enable AOCL-UTILS

To enable aocl utils checks, append -DAOCL_UTILS_INSTALL_DIR=path/to/aocl/utils/source and -DENABLE_AOCL_UTILS=ON to the cmake configuration command.

$ cmake -DENABLE_AOCL_UTILS=ON -DAOCL_UTILS_INSTALL_DIR=path/to/aocl/utils/source ../

ENABLE_AOCL_UTILS is ON by default

Build Debug Configuration

To build in debug mode, append -DCMAKE_BUILD_TYPE=DEBUG to the cmake configuration command.

$ cmake -DCMAKE_BUILD_TYPE=DEBUG ../

CMAKE_BUILD_TYPE is set to RELEASE by default

For Compiling with Address Sanitizer Support

To enable sanitizers (asan, tsan etc), append -DALCP_SANITIZE=ON to the cmake configuration command.

$ cmake -DALCP_SANITIZE=ON ../

ENABLE_AOCL_UTILS is OFF by default

For Compiling with Valgrind Memcheck

In order to build ALCP to run binaries with valgrind to detect any memory leaks

$ cmake -DALCP_MEMCHECK_VALGRIND=ON ../

ALCP_MEMCHECK_VALGRIND is OFF by default

Note: Due to a known limitation in AOCL-Utils, any executables exercising RSA / EC routines might fail when ran with valgrind.

Build Benches

To build benchmarking support with alcp library, append -DALCP_ENABLE_BENCH=ON to the cmake configuration command.

$ cmake -DALCP_ENABLE_BENCH=ON ../

ALCP_ENABLE_BENCH is OFF by default

Benchmarks will be built into bench/{algorithm_type}/

Please look into README.md from bench.

Execute Benchmarks

$ ./bench/{algorithm_type}/bench_{algorithm_type}

Arguments can be provided in above bench as

$ ./bench/digest/bench_digest --benchmark_filter=SHA2_<SHA SCHEME>_<Block Size>
$ ./bench/digest/bench_digest --benchmark_filter=SHA2_512_16 (runs SHA256 schemes for 16 block size)
$ ./bench/digest/bench_digest --benchmark_filter=SHA2 (runs for all SHA2 schemes and block sizes)

Build Tests (using KAT vectors)

To enable tests, append -DALCP_ENABLE_TESTS=ON to the cmake configuration command.

$ cmake -DALCP_ENABLE_TESTS=ON ../

ALCP_ENABLE_TESTS is OFF by default

Test executables can be found inside tests/{algorithm_type} directory

For more details see README.md from tests.

Execute Tests

$ ./tests/{algorithm_type}/test_{algorithm_type}

Documentation

To enable all PDF documentation

These documentations include design documents, Provider documentation etc in PDF format which will be generated.

$ cmake -DALCP_ENABLE_DOCS=ON ../

ALCP_ENABLE_DOCS is OFF by default

Note: Needs the proprietary font “Klavika” to be installed in the system

To enable both Doxygen and Sphinx

To enable sphinx documentation before running the CMAKE command install the required python dependencies by

cd aocl-crypto
pip install -r sphinx/requirements.txt

To enable the HTML documentations - Sphinx and doxygen

$ cmake -DALCP_ENABLE_HTML=ON ../

ALCP_ENABLE_HTML is OFF by default

To generate only the Doxygen html documentation without Sphinx documentation

$ cmake -DALCP_ENABLE_HTML=ON  -DALCP_ENABLE_DOXYGEN=ON -DALCP_ENABLE_SPHINX=OFF ../ 

ALCP_ENABLE_DOXYGEN, ALCP_ENABLE_SPHINX both are OFF by default

To enable Dynamic compiler selection while building

If this option is enabled it will dynamically select between gcc/clang for compiling certain files to improve performance.

$ cmake -DALCP_ENABLE_DYNAMIC_COMPILER_PICK=ON  ../ 

ALCP_ENABLE_DYNAMIC_COMPILER_PICK is on by default

To disable assembly implementation and use intrinsics Kernels

$ cmake -DALCP_DISABLE_ASSEMBLY=ON  ../ 

ALCP_DISABLE_ASSEMBLY is OFF by default

Disabling/Enabling Optional Features

By default all of the below features are OFF and they can be enabled optionally by setting their corresponding flags to ON

  • To enable multi update feature for all supported ciphers append -DALCP_ENABLE_CIPHER_MULTI_UPDATE=ON to build flags.
  • To Enable CCM multi update feature append flag -DALCP_ENABLE_CCM_MULTI_UPDATE=ON to build flags.
  • To Enable OFB multi update feature append flag -DALCP_ENABLE_OFB_MULTI_UPDATE=ON to build flags.