Pure C source Crypt Library
#library #c #libcrypt #hash #encrypt #decrypt #md5 #sha #ecc #dsa #dh #x509 #ssl #tls #ssh

Steffen Jaeckel b75b1305dd Merge branch 'release/1.18.1' hace 8 años
demos a674de7408 Merge branch 'diamondo25-patch-2' into develop hace 8 años
doc 10ad3b5b41 fixup type of `type` in `ltc_asn1_list` doc hace 8 años
hooks a00aba8370 add pre-commit hook hace 8 años
notes f122e9b887 Merge pull request #329 from libtom/pr/sha3-blocksize hace 8 años
src 144839a8db ltc: ctr: update pt and ct after acceleration hace 8 años
tests 5501572b35 Merge pull request #339 from libtom/minor_improvements hace 8 años
.clang-format 99214b53f6 add .clang-format hace 10 años
.gitattributes ab34b0bd93 or perhaps exclude .git* hace 8 años
.gitignore 08a461b39c also build openssl-enc hace 8 años
.travis.yml 9952fac68e tv.txt contains errors from tv_gen hace 8 años
LICENSE 412b2ee1fc after multiple objections of libtom users [1], we decided to change licensing hace 15 años
README.md 58b5e5c7ca improve README hace 8 años
build.sh 9952fac68e tv.txt contains errors from tv_gen hace 8 años
changes 08e0424d52 Update changes hace 8 años
check_source.sh fe19dad623 replace SVN tags hace 8 años
coverage.sh fe19dad623 replace SVN tags hace 8 años
coverage_more.sh 8f7986bbb2 fix coverage_more.sh after updating hashsum hace 8 años
coverity.sh 907d5301ee update coverity build script to use makefile.unix hace 8 años
helper.pl c7ff3bb86e Bump revision hace 8 años
libtomcrypt.pc.in bf45ea66e5 drop the need for testprof/makefile* hace 8 años
libtomcrypt_VS2008.sln 7bb7bdde1d improving MS Windows builds (msvc) hace 8 años
libtomcrypt_VS2008.vcproj 2041f9528e update makefiles hace 8 años
makefile cfce691a50 initialize ltc_mp to force allocation under all compilers, including clang on macOS hace 8 años
makefile.mingw c7bdb247bf Update makefiles hace 8 años
makefile.msvc c7bdb247bf Update makefiles hace 8 años
makefile.shared 4800543664 add -p switch to `install` commands in GNU makefiles hace 8 años
makefile.unix c7bdb247bf Update makefiles hace 8 años
makefile_include.mk 60df7d360a Fix 'fixme check' hace 8 años
printinfo.sh 81f0297285 small fix-ups hace 8 años
run.sh fe19dad623 replace SVN tags hace 8 años
scan_build.sh 84fcd4aec7 scan_build --status-bugs - related to #287 hace 8 años
testbuild.sh e97d921c8d travis: print version information in build scripts hace 12 años
testme.sh fe19dad623 replace SVN tags hace 8 años
updatemakes.sh b3c9f586dc also patch doc/Doxyfile automatically hace 8 años

README.md

libtomcrypt

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 .

Project Status

master: Build Status Coverage Status

develop: Build Status Coverage Status

Coverity Scan Build Status

API/ABI changes: check here

Submitting patches

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 updatemakes.sh script.

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).

Reviews

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.

Branches

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.

Configuration options

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.

Flag Behavior
LTC_NO_TEST Remove all algorithm self-tests from the library
LTC_NO_FILE Remove all API functions requiring a pre-defined FILE data-type (mostly useful for embedded targets)
GMP_DESC enable gmp as MPI provider *1
LTM_DESC enable libtommath as MPI provider *1
TFM_DESC enable tomsfastmath as MPI provider *1 *2
USE_GMP use gmp as MPI provider when building the binaries *3
USE_LTM use libtommath as MPI provider when building the binaries *3
USE_TFM use 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.

makefile use-case
makefile builds a static library (GNU Make required)
makefile.shared builds a shared (and static) library (GNU Make required)
makefile.unix for unusual UNIX platforms, or if you do not have GNU Make
makefile.mingw for usage with the mingw compiler on MS Windows
makefile.msvc for usage with the MSVC compiler on MS Windows
libtomcrypt_VS2008.sln A VisualStudio 2008 project for MS Windows

Make targets

The makefiles provide several targets to build (VS project excluded). The following list does not claim to be complete resp. to be available across all makefile variants.

target application
empty target/none given c.f. library
library builds only the library
hashsum builds the hashsum binary, similar to shasum, but with support for all hash-algorithms included in the library *4
ltcrypt builds the ltcrypt binary, implementing something similar to crypt *4
sizes builds the sizes binary, printing all internal data sizes on invocation *4
constants builds the constants binary, printing all internal constants on invocation *4
openssl-enc builds the openssl-enc binary, which is more or less compatible to openssl enc *4 *5
test builds the test binary, which runs all algorithm self-tests + some extended tests *4
timing builds the timing binary, which can be used to measure timings for algorithms and modes *4
bins builds hashsum *4
all_test builds test, hashsum, ltcrypt, small, tv_gen, sizes & constants *4
docs builds the developer documentation doc/crypt.pdf
install installs the library and header files *7 *8
install_bins installs the binaries created by the bins target *7 *8
install_docs installs the documentation created by the docs target *7 *8
install_test installs the test-app created by the test target *7 *8
install_all installs everything (i.e. library, bins, docs and test) *8
uninstall uninstalls the library and header files

*4 also builds library

*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

Examples

You want to build the library as static library

make

You want to build the library as shared library

make -f makefile.shared

You have 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

You have 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

You have gmp, libtommath and tomsfastmath installed on your system and want to build a static library and the timing binary to measure timings against gmp.

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

Installation

There exist several install make-targets which are described in the table above.

These targets support the standard ways (c.f. [GNU], [FreeBSD]) to modify the installation path via the following set of variables:

DESTDIR
PREFIX
LIBPATH
INCPATH
DATAPATH
BINPATH

The entire set of the variables is only supported in makefile, makefile.shared and makefile.unix.

In case you have to use one of the other makefiles, check in the file which variables are supported.

Examples

You want to install the static library to the default paths

make install

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

Have a look at the developer documentation, [GNU] or [FreeBSD] to get a detailed explanation of all the variables.