Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fc3af1e
A BitString of length 0 can be only 3bytes long
sjaeckel Sep 1, 2025
4c03415
Re-order hash registrations
sjaeckel Oct 3, 2025
8001748
Improve `register_{cipher,hash,prng}()`
sjaeckel Oct 3, 2025
2d64fc4
Fix curve25519 in case sha512 is not available
sjaeckel Oct 3, 2025
eb807b8
Don't use written parameter of macro directly
sjaeckel Oct 3, 2025
dd6ef9c
Correctly treat NULL in the parameters of a SubjectPublicKeyInfo
sjaeckel Oct 3, 2025
c895dd9
Improve readability of script and the logs it creates
sjaeckel Oct 3, 2025
52b93bf
Revert "cmake: add ccache support"
sjaeckel Oct 6, 2025
5e0d801
Clarify MPI providers a bit further
sjaeckel Oct 7, 2025
0c15edb
Don't `abort()` in "release" builds
sjaeckel Oct 7, 2025
95a492a
Make build of docs reproducible
babelouest May 22, 2020
c9259ff
Allow deprecation warnings to be disabled
sjaeckel Oct 16, 2025
ac291e8
Fix `hmac_memory_multi()` invocation
sjaeckel Oct 20, 2025
5dbdaff
Minor fixes
sjaeckel Oct 22, 2025
1924f43
Fix warning uncovered by scan-build.
sjaeckel Oct 22, 2025
3c906ab
Enable AES-NI per default on x86_64.
sjaeckel Oct 22, 2025
6f085d3
Allow disabling of CLZL and CTZL builtins.
sjaeckel Oct 22, 2025
78e2675
Make `store_test()` a bit more aggressive.
sjaeckel Oct 23, 2025
e0f49a9
Use `LTC_TMPVAR()` in more Macros.
sjaeckel Oct 23, 2025
934bd7e
Remove `init_{GMP,LTM,TFM}()`
sjaeckel Oct 23, 2025
e2d0935
Add SHA3-HMAC support to PKCS#8
sjaeckel Oct 28, 2025
47162b9
Add `demos/der_print_flexi.c`
sjaeckel Aug 26, 2025
d8a62f3
Create table of supported ECC curves programmatically
sjaeckel Oct 6, 2025
91757cf
Bump required CMake version & DRY
sjaeckel Oct 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .ci/cmake.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

if "Visual Studio 2017"=="%APPVEYOR_BUILD_WORKER_IMAGE%" goto :eof
if "Visual Studio 2015"=="%APPVEYOR_BUILD_WORKER_IMAGE%" goto :eof

mkdir build
cd build
cmake -G "Ninja" ..
ninja
cd..
14 changes: 13 additions & 1 deletion .ci/coverage_more.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,26 @@

set -e

function pdiv() {
printf "\n====== %s ======\n" "$*"
}

if [ "$#" = "1" -a "$(echo $1 | grep 'gmp')" != "" ]; then
pdiv "Test GMP"
./test t gmp
fi

pdiv "Sizes"
./sizes
pdiv "Constants"
./constants

for i in $(for j in $(echo $(./hashsum -h | awk '/Algorithms/,EOF' | tail -n +2)); do echo $j; done | sort); do echo -n "$i: " && ./hashsum -a $i tests/test.key ; done > hashsum_tv.txt
pdiv "Generate hashsum_tv.txt"
for i in $(for j in $(echo $(./hashsum -h | awk '/Algorithms/,EOF' | tail -n +2)); do echo $j; done | sort); do
echo -n "$i: " && ./hashsum -a $i tests/test.key
done > hashsum_tv.txt

pdiv "Compare hashsum_tv.txt"
difftroubles=$(diff -i -w -B hashsum_tv.txt notes/hashsum_tv.txt | grep '^<') || true
if [ -n "$difftroubles" ]; then
echo "FAILURE: hashsum_tv.tx"
Expand Down
4 changes: 2 additions & 2 deletions .ci/meta_builds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ fi
function run_gcc() {
bash .ci/check_source.sh "CHECK_SOURCES" "$2" "$3" "$4" "$5"

make -j$(nproc) pem-info V=0
make -j$(nproc) latex-tables V=0

echo "verify docs..."
while read -r line; do
grep -q -e "$line" doc/crypt.tex || { echo "Failed to find \"$line\" in doc/crypt.tex"; exit 1; }
done < <(./pem-info | grep '^\\' | sed 's@\\@\\\\@g')
done < <(./latex-tables | grep '^\\' | sed 's@\\@\\\\@g')
echo "docs OK"

make clean &>/dev/null
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
- { BUILDNAME: 'VALGRIND', BUILDOPTIONS: '', BUILDSCRIPT: '.ci/valgrind.sh' }
- { BUILDNAME: 'STOCK', BUILDOPTIONS: '', BUILDSCRIPT: '.ci/run.sh' }
- { BUILDNAME: 'STOCK-MPI', BUILDOPTIONS: '-ULTM_DESC -UTFM_DESC -UUSE_LTM -UUSE_TFM', BUILDSCRIPT: '.ci/run.sh' }
- { BUILDNAME: 'STOCK+AESNI', BUILDOPTIONS: '-DLTC_AES_NI', BUILDSCRIPT: '.ci/run.sh' }
- { BUILDNAME: 'EASY', BUILDOPTIONS: '-DLTC_EASY', BUILDSCRIPT: '.ci/run.sh' }
- { BUILDNAME: 'SMALL', BUILDOPTIONS: '-DLTC_SMALL_CODE', BUILDSCRIPT: '.ci/run.sh' }
- { BUILDNAME: 'NO_TABLES', BUILDOPTIONS: '-DLTC_NO_TABLES', BUILDSCRIPT: '.ci/run.sh' }
Expand Down
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ constants
constants.exe
crypt
crypt.exe
der_print_flexi
der_print_flexi.exe
hashsum
hashsum.exe
multi
Expand All @@ -40,8 +42,8 @@ openssl-enc
openssl-enc.exe
openssh-privkey
openssh-privkey.exe
pem-info
pem-info.exe
latex-tables
latex-tables.exe
sizes
sizes.exe
small
Expand Down Expand Up @@ -107,7 +109,7 @@ doxygen/
*.lof
*.bak

coverage/
coverage*/
coverage*.info

# coverity intermediate directory etc.
Expand Down
31 changes: 14 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# LibTomCrypt, modular cryptographic library -- Tom St Denis
#

cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.22)

project(
libtomcrypt
Expand Down Expand Up @@ -50,23 +50,11 @@ option(BUILD_SHARED_LIBS
)
option(WITH_PTHREAD "Build with pthread support" FALSE)

# -----------------------------------------------------------------------------
# Add support for ccache if desired
# -----------------------------------------------------------------------------
find_program(CCACHE ccache)

if(CCACHE)
option(ENABLE_CCACHE "Enable ccache." ON)
endif()

# use ccache if installed
if(CCACHE AND ENABLE_CCACHE)
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
endif()

# -----------------------------------------------------------------------------
# Compose CFLAGS
# -----------------------------------------------------------------------------
set(LTC_CFLAGS "" CACHE STRING "Optional user-specific CFLAGS")
set(LTC_LDFLAGS "" CACHE STRING "Optional user-specific LDFLAGS")

# Some information ported from makefile_include.mk

Expand Down Expand Up @@ -94,8 +82,17 @@ else()
-Wsystem-headers
)
set(CMAKE_C_FLAGS_DEBUG "-g3")
set(CMAKE_C_FLAGS_RELEASE "-O3 -funroll-loops -fomit-frame-pointer")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g3 -O2")
if(LTC_CFLAGS MATCHES "-DARGTYPE")
set(ARGTYPE "")
else()
set(ARGTYPE "-DARGTYPE=4")
endif()
set(CMAKE_C_FLAGS_RELEASE "-O3 -funroll-loops -fomit-frame-pointer ${ARGTYPE}")
if(BUILD_SHARED_LIBS)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g3 -O2 ${ARGTYPE}")
else()
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g3 -O2")
endif()
set(CMAKE_C_FLAGS_MINSIZEREL "-Os")
endif()

Expand Down
15 changes: 4 additions & 11 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,18 @@ build_script:
if "Visual Studio 2015"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
cd..
git clone https://github.com/libtom/libtommath.git --branch=master
cp libtomcrypt\.ci\cmake.bat libtommath\cmake.bat
cd libtommath
mkdir build
cd build
cmake -G "Ninja" ..
ninja
cd..
cmake.bat
nmake -f makefile.msvc
cd..
cd libtomcrypt
mkdir build
cd build
cmake -G "Ninja" ..
ninja
cd..
.ci\cmake.bat
nmake -f makefile.msvc all
cp test.exe test-stock.exe
cp timing.exe timing-stock.exe
nmake -f makefile.msvc clean
nmake -f makefile.msvc all CFLAGS="/Ox /DUSE_LTM /DLTM_DESC /DLTC_AES_NI /I../libtommath"
nmake -f makefile.msvc all CFLAGS="/Ox /DUSE_LTM /DLTM_DESC /DLTC_NO_AES_NI /I../libtommath"
test_script:
- cmd: >-
test-stock.exe
Expand Down
36 changes: 12 additions & 24 deletions demos/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
# -----------------------------------------------------------------------------
# Options
# -----------------------------------------------------------------------------
option(BUILD_USEFUL_DEMOS "Build useful demos (hashsum)" FALSE)
option(
BUILD_USABLE_DEMOS
"Build usable demos (aesgcm constants crypt openssh-privkey openssl-enc pem-info sizes timing)"
FALSE
)
option(BUILD_TEST_DEMOS "Build test demos (small tv_gen)" FALSE)

option(INSTALL_DEMOS "Install enabled demos (USEFUL and/or USABLE) and ltc wrapper script" FALSE)

Expand All @@ -16,46 +9,41 @@ option(INSTALL_DEMOS "Install enabled demos (USEFUL and/or USABLE) and ltc wrapp
#
# Demos that are even somehow useful and could be installed as a system-tool
#
# * USEFUL_DEMOS = hashsum
# -----------------------------------------------------------------------------
set(USEFUL_DEMOS hashsum)
list(JOIN USEFUL_DEMOS " " USEFUL_DEMOS_STR)
option(BUILD_USEFUL_DEMOS "Build useful demos (${USEFUL_DEMOS_STR})" FALSE)

if(BUILD_USEFUL_DEMOS)
list(APPEND USABLE_DEMOS_TARGETS hashsum)
list(APPEND USABLE_DEMOS_TARGETS ${USEFUL_DEMOS})
endif()

# -----------------------------------------------------------------------------
# Usable demos
#
# Demos that are usable but only rarely make sense to be installed
#
# USEABLE_DEMOS = aesgcm constants crypt openssh-privkey openssl-enc pem-info sizes timing
# -----------------------------------------------------------------------------
set(USABLE_DEMOS aesgcm constants crypt der_print_flexi latex-tables openssh-privkey openssl-enc sizes timing)
list(JOIN USABLE_DEMOS " " USABLE_DEMOS_STR)
option(BUILD_USABLE_DEMOS "Build usable demos (${USABLE_DEMOS_STR})" FALSE)

if(BUILD_USABLE_DEMOS)
list(
APPEND
USABLE_DEMOS_TARGETS
aesgcm
constants
crypt
openssh-privkey
openssl-enc
pem-info
sizes
timing
)
list(APPEND USABLE_DEMOS_TARGETS ${USABLE_DEMOS})
endif()

# -----------------------------------------------------------------------------
# Test demos
#
# Demos that are used for testing or measuring
#
# * TEST_DEMOS = small tv_gen
# -----------------------------------------------------------------------------
set(TEST_DEMOS small tv_gen)
list(JOIN TEST_DEMOS " " TEST_DEMOS_STR)
option(BUILD_TEST_DEMOS "Build test demos (${TEST_DEMOS_STR})" FALSE)

if(BUILD_TEST_DEMOS)
list(APPEND ALL_DEMOS_TARGETS small tv_gen)
list(APPEND ALL_DEMOS_TARGETS ${TEST_DEMOS})
endif()

# -----------------------------------------------------------------------------
Expand Down
Loading