Skip to content

setup and build

amir zamani edited this page Feb 2, 2018 · 2 revisions

after cloning this repository, first update the dependencies:

$workspace/> git clone https://github.com/azadkuh/mbedcrypto

$workspace/> cd mbedcrypto
$mbedcrypto/> ./update-dependencies.sh

this script automatically setups 3rdparty directory, then tries to pull or update dependencies from github.

Unices

under Linux, OS X or MSYS2:

$workspace/> mkdir mbedcrypto.build
$workspace/> cd mbedcrypto.build

$mbedcrypto.build/> cmake ../mbedcrypto
$mbedcrypto.build/> make

the mbedcrypto library and the companion unit test app would be built into mbedcrypto.xbin64 directory (or mbedcrypto.xbin32 in 32bit systems)

Windows

under Windows (MSVC) probably:

$workspace/> mkdir mbedcrypto.build
$workspace/> cd mbedcrypto.build

$mbedcrypto.build/> cmake ../mbedcrypto
$mbedcrypto.build/> cmake --build . --config Release

doxygen

under Unices if you have already installed doxygen:

# builds api documents into docs
$mbedcrypto.build/> make docs
# removes docs
$mbedcrypto.build/> make clean_docs

build options

these are the most important build options:

options default message
BUILD_MD2 OFF enable md2 hash (insecure and deprecated)
BUILD_MD4 OFF enable md4 hash
BUILD_RIPEMD160 OFF enable ripemd160 hash
BUILD_CFB OFF enable cfb (cipher feedback mode)
BUILD_CTR ON enable ctr (cipher counter mode)
BUILD_GCM ON enable gcm (Galois cipher mode, for aead cryptography)
BUILD_CCM ON enable ccm (counter cbc-mac cipher mode, for aead cryptography)
BUILD_DES ON enable des and triple-des cipher
BUILD_BLOWFISH OFF enable blowfish cipher
BUILD_CAMELLIA OFF enable camellia cipher
BUILD_ARC4 OFF enable arc4 cipher (insecure)
BUILD_PK_EXPORT ON enable export keys in pem or der format
BUILD_RSA_KEYGEN ON enable rsa key generator
BUILD_EC OFF enable eckey, eckey_dh and ecdsa algorithms
BUILD_QT5_BIND OFF also adds adaptors around Qt5's QByteArray

please see CMakeLists.txt for the full list.

to add or remove algorithms or features:

#cmake, ccmake or cmake - gui
$mbedcrypto.build/> cmake ../mbedcrypto -DBUILD_QT5_BIND=ON -DBUILD_PK_EXPORT=ON -DBUILD_RSA_KEYGEN=ON

# or optionally
$mbedcrypto.build/> ccmake .

#to disable making of the test app:
$mbedcrypto.build/> cmake ../mbedcrypto -DBUILD_TESTS=OFF

optionally if you use g++ or clang, you can also build mbedcrypto as a shared library as:

$build/> cmake ../mbedcrypto -DBUILD_SHARED_LIBS=ON
$build/> make