Skip to content

Commit c421e57

Browse files
authored
Merge pull request #704 from libtom/minor-improvements
Minor improvements
2 parents a3cc5bf + 91757cf commit c421e57

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+9662
-9560
lines changed

.ci/cmake.bat

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
if "Visual Studio 2017"=="%APPVEYOR_BUILD_WORKER_IMAGE%" goto :eof
3+
if "Visual Studio 2015"=="%APPVEYOR_BUILD_WORKER_IMAGE%" goto :eof
4+
5+
mkdir build
6+
cd build
7+
cmake -G "Ninja" ..
8+
ninja
9+
cd..

.ci/coverage_more.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,26 @@
22

33
set -e
44

5+
function pdiv() {
6+
printf "\n====== %s ======\n" "$*"
7+
}
8+
59
if [ "$#" = "1" -a "$(echo $1 | grep 'gmp')" != "" ]; then
10+
pdiv "Test GMP"
611
./test t gmp
712
fi
813

14+
pdiv "Sizes"
915
./sizes
16+
pdiv "Constants"
1017
./constants
1118

12-
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
19+
pdiv "Generate hashsum_tv.txt"
20+
for i in $(for j in $(echo $(./hashsum -h | awk '/Algorithms/,EOF' | tail -n +2)); do echo $j; done | sort); do
21+
echo -n "$i: " && ./hashsum -a $i tests/test.key
22+
done > hashsum_tv.txt
23+
24+
pdiv "Compare hashsum_tv.txt"
1325
difftroubles=$(diff -i -w -B hashsum_tv.txt notes/hashsum_tv.txt | grep '^<') || true
1426
if [ -n "$difftroubles" ]; then
1527
echo "FAILURE: hashsum_tv.tx"

.ci/meta_builds.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ fi
2222
function run_gcc() {
2323
bash .ci/check_source.sh "CHECK_SOURCES" "$2" "$3" "$4" "$5"
2424

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

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

3333
make clean &>/dev/null

.github/workflows/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ jobs:
4646
- { BUILDNAME: 'VALGRIND', BUILDOPTIONS: '', BUILDSCRIPT: '.ci/valgrind.sh' }
4747
- { BUILDNAME: 'STOCK', BUILDOPTIONS: '', BUILDSCRIPT: '.ci/run.sh' }
4848
- { BUILDNAME: 'STOCK-MPI', BUILDOPTIONS: '-ULTM_DESC -UTFM_DESC -UUSE_LTM -UUSE_TFM', BUILDSCRIPT: '.ci/run.sh' }
49-
- { BUILDNAME: 'STOCK+AESNI', BUILDOPTIONS: '-DLTC_AES_NI', BUILDSCRIPT: '.ci/run.sh' }
5049
- { BUILDNAME: 'EASY', BUILDOPTIONS: '-DLTC_EASY', BUILDSCRIPT: '.ci/run.sh' }
5150
- { BUILDNAME: 'SMALL', BUILDOPTIONS: '-DLTC_SMALL_CODE', BUILDSCRIPT: '.ci/run.sh' }
5251
- { BUILDNAME: 'NO_TABLES', BUILDOPTIONS: '-DLTC_NO_TABLES', BUILDSCRIPT: '.ci/run.sh' }

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ constants
3232
constants.exe
3333
crypt
3434
crypt.exe
35+
der_print_flexi
36+
der_print_flexi.exe
3537
hashsum
3638
hashsum.exe
3739
multi
@@ -40,8 +42,8 @@ openssl-enc
4042
openssl-enc.exe
4143
openssh-privkey
4244
openssh-privkey.exe
43-
pem-info
44-
pem-info.exe
45+
latex-tables
46+
latex-tables.exe
4547
sizes
4648
sizes.exe
4749
small
@@ -107,7 +109,7 @@ doxygen/
107109
*.lof
108110
*.bak
109111

110-
coverage/
112+
coverage*/
111113
coverage*.info
112114

113115
# coverity intermediate directory etc.

CMakeLists.txt

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# LibTomCrypt, modular cryptographic library -- Tom St Denis
44
#
55

6-
cmake_minimum_required(VERSION 3.10)
6+
cmake_minimum_required(VERSION 3.22)
77

88
project(
99
libtomcrypt
@@ -50,23 +50,11 @@ option(BUILD_SHARED_LIBS
5050
)
5151
option(WITH_PTHREAD "Build with pthread support" FALSE)
5252

53-
# -----------------------------------------------------------------------------
54-
# Add support for ccache if desired
55-
# -----------------------------------------------------------------------------
56-
find_program(CCACHE ccache)
57-
58-
if(CCACHE)
59-
option(ENABLE_CCACHE "Enable ccache." ON)
60-
endif()
61-
62-
# use ccache if installed
63-
if(CCACHE AND ENABLE_CCACHE)
64-
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
65-
endif()
66-
6753
# -----------------------------------------------------------------------------
6854
# Compose CFLAGS
6955
# -----------------------------------------------------------------------------
56+
set(LTC_CFLAGS "" CACHE STRING "Optional user-specific CFLAGS")
57+
set(LTC_LDFLAGS "" CACHE STRING "Optional user-specific LDFLAGS")
7058

7159
# Some information ported from makefile_include.mk
7260

@@ -94,8 +82,17 @@ else()
9482
-Wsystem-headers
9583
)
9684
set(CMAKE_C_FLAGS_DEBUG "-g3")
97-
set(CMAKE_C_FLAGS_RELEASE "-O3 -funroll-loops -fomit-frame-pointer")
98-
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g3 -O2")
85+
if(LTC_CFLAGS MATCHES "-DARGTYPE")
86+
set(ARGTYPE "")
87+
else()
88+
set(ARGTYPE "-DARGTYPE=4")
89+
endif()
90+
set(CMAKE_C_FLAGS_RELEASE "-O3 -funroll-loops -fomit-frame-pointer ${ARGTYPE}")
91+
if(BUILD_SHARED_LIBS)
92+
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g3 -O2 ${ARGTYPE}")
93+
else()
94+
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g3 -O2")
95+
endif()
9996
set(CMAKE_C_FLAGS_MINSIZEREL "-Os")
10097
endif()
10198

appveyor.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,18 @@ build_script:
2020
if "Visual Studio 2015"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
2121
cd..
2222
git clone https://github.com/libtom/libtommath.git --branch=master
23+
cp libtomcrypt\.ci\cmake.bat libtommath\cmake.bat
2324
cd libtommath
24-
mkdir build
25-
cd build
26-
cmake -G "Ninja" ..
27-
ninja
28-
cd..
25+
cmake.bat
2926
nmake -f makefile.msvc
3027
cd..
3128
cd libtomcrypt
32-
mkdir build
33-
cd build
34-
cmake -G "Ninja" ..
35-
ninja
36-
cd..
29+
.ci\cmake.bat
3730
nmake -f makefile.msvc all
3831
cp test.exe test-stock.exe
3932
cp timing.exe timing-stock.exe
4033
nmake -f makefile.msvc clean
41-
nmake -f makefile.msvc all CFLAGS="/Ox /DUSE_LTM /DLTM_DESC /DLTC_AES_NI /I../libtommath"
34+
nmake -f makefile.msvc all CFLAGS="/Ox /DUSE_LTM /DLTM_DESC /DLTC_NO_AES_NI /I../libtommath"
4235
test_script:
4336
- cmd: >-
4437
test-stock.exe

demos/CMakeLists.txt

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
# -----------------------------------------------------------------------------
22
# Options
33
# -----------------------------------------------------------------------------
4-
option(BUILD_USEFUL_DEMOS "Build useful demos (hashsum)" FALSE)
5-
option(
6-
BUILD_USABLE_DEMOS
7-
"Build usable demos (aesgcm constants crypt openssh-privkey openssl-enc pem-info sizes timing)"
8-
FALSE
9-
)
10-
option(BUILD_TEST_DEMOS "Build test demos (small tv_gen)" FALSE)
114

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

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

2217
if(BUILD_USEFUL_DEMOS)
23-
list(APPEND USABLE_DEMOS_TARGETS hashsum)
18+
list(APPEND USABLE_DEMOS_TARGETS ${USEFUL_DEMOS})
2419
endif()
2520

2621
# -----------------------------------------------------------------------------
2722
# Usable demos
2823
#
2924
# Demos that are usable but only rarely make sense to be installed
3025
#
31-
# USEABLE_DEMOS = aesgcm constants crypt openssh-privkey openssl-enc pem-info sizes timing
3226
# -----------------------------------------------------------------------------
27+
set(USABLE_DEMOS aesgcm constants crypt der_print_flexi latex-tables openssh-privkey openssl-enc sizes timing)
28+
list(JOIN USABLE_DEMOS " " USABLE_DEMOS_STR)
29+
option(BUILD_USABLE_DEMOS "Build usable demos (${USABLE_DEMOS_STR})" FALSE)
3330

3431
if(BUILD_USABLE_DEMOS)
35-
list(
36-
APPEND
37-
USABLE_DEMOS_TARGETS
38-
aesgcm
39-
constants
40-
crypt
41-
openssh-privkey
42-
openssl-enc
43-
pem-info
44-
sizes
45-
timing
46-
)
32+
list(APPEND USABLE_DEMOS_TARGETS ${USABLE_DEMOS})
4733
endif()
4834

4935
# -----------------------------------------------------------------------------
5036
# Test demos
5137
#
5238
# Demos that are used for testing or measuring
5339
#
54-
# * TEST_DEMOS = small tv_gen
5540
# -----------------------------------------------------------------------------
41+
set(TEST_DEMOS small tv_gen)
42+
list(JOIN TEST_DEMOS " " TEST_DEMOS_STR)
43+
option(BUILD_TEST_DEMOS "Build test demos (${TEST_DEMOS_STR})" FALSE)
5644

5745
if(BUILD_TEST_DEMOS)
58-
list(APPEND ALL_DEMOS_TARGETS small tv_gen)
46+
list(APPEND ALL_DEMOS_TARGETS ${TEST_DEMOS})
5947
endif()
6048

6149
# -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)