libtomcrypt

repository·develop·Indexed 23 days ago

https://github.com/libtom/libtomcrypt

A cryptographic library providing a wide range of algorithms and features. It supports multiple Multi-Precision Integer (MPI) providers, including GMP, libtommath, and tomsfastmath. The library can be built using various Makefiles (GNU Make, MinGW, MSVC), CMake, or Visual Studio 2008 project files.

Tokens
927
Snippets
1
Records
6
Agent score
33%

What's inside libtomcrypt

  1. Build libtomcrypt using Makefiles

    develop

    libtomcrypt provides several makefiles depending on your target environment and requirements. Choose the appropriate makefile for your use case:

    • makefile: Builds a static library (requires GNU Make).
    • makefile.shared: Builds both shared and static libraries (requires GNU Make).
    • makefile.unix: For unusual UNIX platforms or environments without GNU Make.
    • makefile.mingw: For use with the MinGW compiler on MS Windows.
    • makefile.msvc: For use with the MSVC compiler on MS Windows.
    • libtomcrypt_VS2008.sln: A Visual Studio 2008 project for MS Windows.
  2. Build libtomcrypt using CMake

    develop

    The project supports the CMake build system. To build using CMake, follow these steps:

    1. Clone the repository.
    2. Create a build directory.
    3. Run cmake and make.
    git clone https://github.com/libtom/libtomcrypt.git
    mkdir -p libtomcrypt/build
    cd libtomcrypt/build
    cmake ..
    make -j$(nproc)
  3. Install libtomcrypt

    develop

    Use the install make-targets to install the library, headers, and binaries. The following targets are available:

    • install: Installs the library and header files.
    • install_bins: Installs the binaries created by the bins target.
    • install_docs: Installs the documentation.
    • install_test: Installs the test application.
    • install_all: Installs everything (library, bins, docs, and test).
    • uninstall: Uninstalls the library and header files.

    Customizing Installation Paths

    You can modify the installation path using these variables (supported in makefile, makefile.shared, and makefile.unix):

    • DESTDIR
    • PREFIX
    • LIBPATH
    • INCPATH
    • DATAPATH
    • BINPATH
  4. Configure libtomcrypt via CFLAGS

    develop

    You can customize the library's functionality and MPI (Multi-Precision Integer) provider during the build process using CFLAGS.

    Common Configuration Flags

    FlagBehavior
    LTC_NO_TESTRemove all algorithm self-tests
    LTC_NO_FILERemove API functions requiring a FILE data-type (useful for embedded targets)
    LTC_AES_NIEnable AES-NI support

    MPI Provider Configuration

    You can choose between gmp, libtommath, or tomsfastmath. To use a provider, you must define the corresponding _DESC flag (to enable the provider in the library) and the USE_ flag (to link it when building binaries).

    FlagBehavior
    GMP_DESCEnable gmp as MPI provider
    LTM_DESCEnable libtommath as MPI provider
    TFM_DESCEnable tomsfastmath as MPI provider
    USE_GMPUse gmp as MPI provider when building binaries
    USE_LTMUse libtommath as MPI provider when building binaries
    USE_TFMUse tomsfastmath as MPI provider when building binaries

    *Note: tomsfastmath has a fixed maximum size for MPIs. You can build against multiple providers in parallel and select the math library at runtime if _DESC flags are used.

  5. Use RSA test vectors for PKCS #1 v2.1 compliance testing

    develop

    The pkcs-1v2-1-vec.zip directory provides test vectors to verify implementations of RSAES-OAEP and RSASSA-PSS as defined in PKCS #1 v2.1. Use these files to validate encryption, decryption, signing, and intermediate value calculations.

    Available test files:

    • oaep-vect.txt: Test vectors for RSAES-OAEP encryption.
    • oaep-int.txt: Intermediate values for RSAES-OAEP encryption and RSA decryption with CRT. Includes DER-encoded RSAPrivateKey and RSAPublicKey types.
    • pss-vect.txt: Test vectors for RSASSA-PSS signing.
    • pss-int.txt: Intermediate values for RSASSA-PSS signing.