Previously the git repository contained
doc/crypt.pdf for detailed documentation.
This was changed and the file is now only available from the tarball of the appropriate version
or from the page https://github.com/libtom/libtomcrypt/releases .
API/ABI changes: check here
Please branch off from develop if you want to submit a patch.
Patch integration will be faster if tests and documentation are included.
Please update the makefiles in a separate commit. To update them simply run the
If you have something bigger to submit, feel free to contact us beforehand. Then we can give you write access to this repo, so you can open your PR based on this repo and we can easier follow the rebase-before-merge approach we're using (or even do the rebase ourself).
We're using Pull Request reviews to make sure that the code is in line with the existing code base.
Please have a look here to get an idea of the approach.
Please be aware, that all branches besides master and develop can and will be force-pushed, rebased and/or removed!
If you want to rely on such an unstable branch, create your own fork of this repository to make sure nothing breaks for you.
By default the library builds its entire feature set (besides
katja) in a (depending on your needs more or less) optimal way.
There are numerous configuration options available if you want to trim down the functionality of the library.
Please have a look at
src/headers/tomcrypt_custom.h for all available configuration options.
The following list is a small part of the available, but the most often required, configuration switches.
|Remove all algorithm self-tests from the library
|Remove all API functions requiring a pre-defined
FILE data-type (mostly useful for embedded targets)
|enable gmp as MPI provider *1
|enable libtommath as MPI provider *1
|enable tomsfastmath as MPI provider *1 *2
gmp as MPI provider when building the binaries *3
libtommath as MPI provider when building the binaries *3
tomsfastmath as MPI provider when building the binaries *3
*1 It is possible to build the library against all MPI providers in parallel and choose at startup-time which math library should be used.
*2 Please be aware that
tomsfastmath has the limitation of a fixed max size of MPI's.
*3 Only one is supported at the time & this is only required when building the binaries, not when building the library itself.
Building the library
There are several
makefiles provided. Please choose the one that fits best for you.
|builds a static library (GNU Make required)
|builds a shared (and static) library (GNU Make required)
|for unusual UNIX platforms, or if you do not have GNU Make
|for usage with the mingw compiler on MS Windows
|for usage with the MSVC compiler on MS Windows
|A VisualStudio 2008 project for MS Windows
makefiles provide several targets to build (VS project excluded).
The following list does not claim to be complete resp. to be available across all
|empty target/none given
|builds only the library
hashsum binary, similar to
shasum, but with support for all hash-algorithms included in the library *4
ltcrypt binary, implementing something similar to
sizes binary, printing all internal data sizes on invocation *4
constants binary, printing all internal constants on invocation *4
openssl-enc binary, which is more or less compatible to
openssl enc *4 *5
test binary, which runs all algorithm self-tests + some extended tests *4
timing binary, which can be used to measure timings for algorithms and modes *4
|builds the developer documentation
library and header files *7 *8
|installs the binaries created by the
bins target *7 *8
|installs the documentation created by the
docs target *7 *8
|installs the test-app created by the
test target *7 *8
|installs everything (i.e.
library and header files
*4 also builds
*5 broken build in some configurations, therefore not built by default
*7 also builds the necessary artifact(s) before installing it
*8 also have a look at the 'Installation' section of this file
You want to build the library as static library
You want to build the library as shared library
make -f makefile.shared
libtommath installed on your system and want to build a static library and the
test binary to run the self-tests.
make CFLAGS="-DUSE_LTM -DLTM_DESC" EXTRALIBS="-ltommath" test
tomsfastmath installed on your system and want to build a shared library and all binaries
make -f makefile.shared CFLAGS="-DUSE_TFM -DTFM_DESC" EXTRALIBS="-ltfm" all demos
tomsfastmath installed on your system and want to build a static library and the
timing binary to measure timings against
make CFLAGS="-DUSE_GMP -DGMP_DESC -DLTM_DESC -DTFM_DESC" EXTRALIBS="-lgmp" timing
If you have
libtommath in a non-standard location:
make CFLAGS="-DUSE_LTM -DLTM_DESC -I/opt/devel/ltm" EXTRALIBS="/opt/devel/ltm/libtommath.a" all
There exist several install make-targets which are described in the table above.
The entire set of the variables is only supported in
In case you have to use one of the other makefiles, check in the file which variables are supported.
You want to install the static library to the default paths
You want to install the shared library to a special path and use it from this path
make -f makefile.shared PREFIX=/opt/special/path
The project provides support for the CMake build system.
git clone https://github.com/libtom/libtomcrypt.git
mkdir -p libtomcrypt/build
More details around building with CMake can be found in the developer documentation.