Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c7f8dd8
Extract static function as `x509_get_pka()`
sjaeckel Jun 2, 2025
71b89e8
Export static function as `x509_import_spki()`
sjaeckel Jun 4, 2025
5c534cc
Re-factor `s_import_pkcs8()`
sjaeckel Jun 4, 2025
79b0a72
Extend `der_flexi_sequence_cmp()`
sjaeckel Jun 16, 2025
575f064
Use `rsa_init()` to initialize an `rsa_key`
sjaeckel Sep 2, 2025
10c1e13
Add `demos/der_print_flexi.c`
sjaeckel Aug 26, 2025
f759c76
Add support for separate MGF1 hashes
sjaeckel Aug 26, 2025
7dd6229
Add support for RSA-PSS keys
sjaeckel Aug 26, 2025
6c54b88
A BitString of length 0 can be only 3bytes long
sjaeckel Sep 1, 2025
aeec5ea
Add SubjectPublicKeyInfo support to `dsa_import()`
sjaeckel Sep 2, 2025
7a2891f
Refactor SubjectPublicKeyInfo import
sjaeckel Sep 2, 2025
1f62f4b
Put realloc logic into `pem_read()`
sjaeckel Sep 11, 2025
9a1c288
Re-order hash registrations
sjaeckel Oct 3, 2025
9b5e03b
Improve `register_{cipher,hash,prng}()`
sjaeckel Oct 3, 2025
95f74f3
Fix curve25519 in case sha512 is not available
sjaeckel Oct 3, 2025
5074e36
Re-order PEM headers to prepare for X.509 APIs
sjaeckel Oct 3, 2025
82c795e
Don't use written parameter of macro directly
sjaeckel Oct 3, 2025
c6d8b00
Correctly treat NULL in the parameters of a SubjectPublicKeyInfo
sjaeckel Oct 3, 2025
c6f8126
Improve readability of script and the logs it creates
sjaeckel Oct 3, 2025
e4a3292
Create table of supported ECC curves programmatically
sjaeckel Oct 6, 2025
4b37886
Bump required CMake version & DRY
sjaeckel Oct 6, 2025
16998cc
Revert "cmake: add ccache support"
sjaeckel Oct 6, 2025
4bb4d93
Clarify MPI providers a bit further
sjaeckel Oct 7, 2025
03677d7
Don't `abort()` in "release" builds
sjaeckel Oct 7, 2025
e8b66c0
Make build of docs reproducible
babelouest May 22, 2020
8cb9587
Move RFC6979 hash alg to a new ecc signature options struct
sjaeckel Oct 9, 2025
694f500
Allow deprecation warnings to be disabled
sjaeckel Oct 16, 2025
98524e3
Add tests for deprecated APIs
sjaeckel Oct 16, 2025
151a655
Update makefiles
sjaeckel Oct 16, 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
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: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
- { BUILDNAME: 'NO_FAST', BUILDOPTIONS: '-DLTC_NO_FAST', BUILDSCRIPT: '.ci/run.sh' }
- { BUILDNAME: 'NO_FAST+SMALL+NO_TABLES', BUILDOPTIONS: '-DLTC_NO_FAST -DLTC_SMALL_CODE -DLTC_NO_TABLES', BUILDSCRIPT: '.ci/run.sh' }
- { BUILDNAME: 'NO_ASM', BUILDOPTIONS: '-DLTC_NO_ASM', BUILDSCRIPT: '.ci/run.sh' }
- { BUILDNAME: 'NO_DEPRECATED_APIS', BUILDOPTIONS: '-DLTC_NO_DEPRECATED_APIS', BUILDSCRIPT: '.ci/run.sh' }
- { BUILDNAME: 'NO_TIMING_RESISTANCE', BUILDOPTIONS: '-DLTC_NO_ECC_TIMING_RESISTANT -DLTC_NO_RSA_BLINDING', BUILDSCRIPT: '.ci/run.sh' }
- { BUILDNAME: 'FORTUNA_CUSTOM_OPTIONS', BUILDOPTIONS: '-DLTC_FORTUNA_USE_ENCRYPT_ONLY -DLTC_FORTUNA_RESEED_RATELIMIT_STATIC', BUILDSCRIPT: '.ci/run.sh' }
- { BUILDNAME: 'PTHREAD', BUILDOPTIONS: '-DLTC_PTHREAD', 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
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
Loading