Skip to content

Commit 8fd5dad

Browse files
authored
Merge pull request libtom#593 from libtom/cleanup
Cleanup
2 parents 06a81ae + a921112 commit 8fd5dad

14 files changed

Lines changed: 90 additions & 84 deletions

File tree

.github/workflows/main.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,14 @@ jobs:
6565
cat test_std.txt
6666
cat test_err.txt
6767
cat tv.txt
68+
- name: pack build directory
69+
if: ${{ failure() }}
70+
run: |
71+
tar cJf build-${{ github.run_id }}.tar.xz --exclude ./build-${{ github.run_id }}.tar.xz .
72+
- name: upload Artifact
73+
if: ${{ failure() }}
74+
uses: actions/upload-artifact@v3
75+
with:
76+
name: build-${{ github.run_id }}.tar.xz
77+
path: build-${{ github.run_id }}.tar.xz
78+
retention-days: 1

appveyor.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ branches:
77
- /^appveyor/
88
- /^build-ci/
99
image:
10+
- Visual Studio 2022
11+
- Visual Studio 2019
1012
- Visual Studio 2017
1113
- Visual Studio 2015
1214
build_script:
1315
- cmd: >-
14-
if "Visual Studio 2017"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
16+
if "Visual Studio 2022"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
17+
if "Visual Studio 2019"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
18+
if "Visual Studio 2017"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
1519
if "Visual Studio 2015"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
1620
if "Visual Studio 2015"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
1721
cd..

doc/crypt.tex

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2763,40 +2763,40 @@ \subsection{Hash Registration}
27632763

27642764
\begin{figure}[H]
27652765
\begin{center}
2766-
\begin{tabular}{|c|c|c|}
2767-
\hline \textbf{Name} & \textbf{Descriptor Name} & \textbf{Size of Message Digest (bytes)} \\
2768-
\hline WHIRLPOOL & whirlpool\_desc & 64 \\
2769-
\hline Keccak512 & keccak\_512\_desc & 64 \\
2770-
\hline SHA3-512 & sha3\_512\_desc & 64 \\
2771-
\hline SHA-512 & sha512\_desc & 64 \\
2772-
\hline BLAKE2B-512 & blake2b\_512\_desc & 64 \\
2773-
\hline Keccak384 & keccak\_384\_desc & 48 \\
2774-
\hline SHA3-384 & sha3\_384\_desc & 48 \\
2775-
\hline SHA-384 & sha384\_desc & 48 \\
2776-
\hline RIPEMD-320 & rmd160\_desc & 40 \\
2777-
\hline SHA-512/256 & sha512\_256\_desc & 32 \\
2778-
\hline Keccak256 & keccak\_256\_desc & 32 \\
2779-
\hline SHA3-256 & sha3\_256\_desc & 32 \\
2780-
\hline SHA-256 & sha256\_desc & 32 \\
2781-
\hline RIPEMD-256 & rmd160\_desc & 32 \\
2782-
\hline BLAKE2S-256 & blake2s\_256\_desc & 32 \\
2783-
\hline BLAKE2B-256 & blake2b\_256\_desc & 32 \\
2784-
\hline SHA-512/224 & sha512\_224\_desc & 28 \\
2785-
\hline Keccak224 & keccak\_224\_desc & 28 \\
2786-
\hline SHA3-224 & sha3\_224\_desc & 28 \\
2787-
\hline SHA-224 & sha224\_desc & 28 \\
2788-
\hline BLAKE2S-224 & blake2s\_224\_desc & 28 \\
2789-
\hline BLAKE2B-384 & blake2b\_384\_desc & 48 \\
2790-
\hline TIGER-192 & tiger\_desc & 24 \\
2791-
\hline SHA-1 & sha1\_desc & 20 \\
2792-
\hline RIPEMD-160 & rmd160\_desc & 20 \\
2793-
\hline BLAKE2S-160 & blake2s\_160\_desc & 20 \\
2794-
\hline BLAKE2B-160 & blake2b\_160\_desc & 20 \\
2795-
\hline RIPEMD-128 & rmd128\_desc & 16 \\
2796-
\hline MD5 & md5\_desc & 16 \\
2797-
\hline MD4 & md4\_desc & 16 \\
2798-
\hline MD2 & md2\_desc & 16 \\
2799-
\hline BLAKE2S-128 & blake2s\_128\_desc & 16 \\
2766+
\begin{tabular}{|c|c|c|c|}
2767+
\hline \textbf{Name} & \textbf{Descriptor Name} & \textbf{Size of Message Digest (bytes)} & \textbf{Id} \\
2768+
\hline WHIRLPOOL & whirlpool\_desc & 64 & 11 \\
2769+
\hline Keccak512 & keccak\_512\_desc & 64 & 32 \\
2770+
\hline SHA3-512 & sha3\_512\_desc & 64 & 20 \\
2771+
\hline SHA-512 & sha512\_desc & 64 & 5 \\
2772+
\hline BLAKE2B-512 & blake2b\_512\_desc & 64 & 28 \\
2773+
\hline Keccak384 & keccak\_384\_desc & 48 & 31 \\
2774+
\hline SHA3-384 & sha3\_384\_desc & 48 & 19 \\
2775+
\hline SHA-384 & sha384\_desc & 48 & 4 \\
2776+
\hline BLAKE2B-384 & blake2b\_384\_desc & 48 & 27 \\
2777+
\hline RIPEMD-320 & rmd160\_desc & 40 & 14 \\
2778+
\hline SHA-512/256 & sha512\_256\_desc & 32 & 16 \\
2779+
\hline Keccak256 & keccak\_256\_desc & 32 & 30 \\
2780+
\hline SHA3-256 & sha3\_256\_desc & 32 & 18 \\
2781+
\hline SHA-256 & sha256\_desc & 32 & 0 \\
2782+
\hline RIPEMD-256 & rmd160\_desc & 32 & 13 \\
2783+
\hline BLAKE2S-256 & blake2s\_256\_desc & 32 & 24 \\
2784+
\hline BLAKE2B-256 & blake2b\_256\_desc & 32 & 26 \\
2785+
\hline SHA-512/224 & sha512\_224\_desc & 28 & 15 \\
2786+
\hline Keccak224 & keccak\_224\_desc & 28 & 29 \\
2787+
\hline SHA3-224 & sha3\_224\_desc & 28 & 17 \\
2788+
\hline SHA-224 & sha224\_desc & 28 & 10 \\
2789+
\hline BLAKE2S-224 & blake2s\_224\_desc & 28 & 23 \\
2790+
\hline TIGER-192 & tiger\_desc & 24 & 1 \\
2791+
\hline SHA-1 & sha1\_desc & 20 & 2 \\
2792+
\hline RIPEMD-160 & rmd160\_desc & 20 & 9 \\
2793+
\hline BLAKE2S-160 & blake2s\_160\_desc & 20 & 22 \\
2794+
\hline BLAKE2B-160 & blake2b\_160\_desc & 20 & 25 \\
2795+
\hline RIPEMD-128 & rmd128\_desc & 16 & 8 \\
2796+
\hline MD5 & md5\_desc & 16 & 3 \\
2797+
\hline MD4 & md4\_desc & 16 & 6 \\
2798+
\hline MD2 & md2\_desc & 16 & 7 \\
2799+
\hline BLAKE2S-128 & blake2s\_128\_desc & 16 & 21 \\
28002800
\hline
28012801
\end{tabular}
28022802
\end{center}

src/headers/tomcrypt_cfg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
/* This is the build config file.
55
*
6-
* With this you can setup what to inlcude/exclude automatically during any build. Just comment
6+
* With this you can setup what to include/exclude automatically during any build. Just comment
77
* out the line that #define's the word for the thing you want to remove. phew!
88
*/
99

src/headers/tomcrypt_private.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ int func_name (hash_state * md, const unsigned char *in, unsigned long inlen)
9090
if (md-> state_var .curlen > sizeof(md-> state_var .buf)) { \
9191
return CRYPT_INVALID_ARG; \
9292
} \
93-
if ((md-> state_var .length + inlen * 8) < md-> state_var .length) { \
93+
if (((md-> state_var .length + inlen * 8) < md-> state_var .length) \
94+
|| ((inlen * 8) < inlen)) { \
9495
return CRYPT_HASH_OVERFLOW; \
9596
} \
9697
while (inlen > 0) { \

tests/base16_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ int base16_test(void)
2020

2121
for (idx = 0; idx < 2; idx++) {
2222
for (x = 0; x < 100; x++) {
23-
yarrow_read(in, x, &yarrow_prng);
23+
ENSURE(yarrow_read(in, x, &yarrow_prng) == x);
2424
l1 = sizeof(out);
2525
DO(base16_encode(in, x, out, &l1, idx));
2626
l2 = sizeof(tmp);

tests/base32_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ int base32_test(void)
2727

2828
for (idx = 0; idx < 4; idx++) {
2929
for (x = 0; x < 100; x++) {
30-
yarrow_read(in, x, &yarrow_prng);
30+
ENSURE(yarrow_read(in, x, &yarrow_prng) == x);
3131
l1 = sizeof(out);
3232
DO(base32_encode(in, x, out, &l1, testid[idx]));
3333
l2 = sizeof(tmp);

tests/base64_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ int base64_test(void)
130130
}
131131

132132
for (x = 0; x < 64; x++) {
133-
yarrow_read(in, x, &yarrow_prng);
133+
ENSURE(yarrow_read(in, x, &yarrow_prng) == x);
134134
l1 = sizeof(out);
135135
DO(base64_encode(in, x, out, &l1));
136136
l2 = sizeof(tmp);

tests/der_test.c

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,10 +1700,7 @@ int der_test(void)
17001700
#else
17011701
for (z = 0; z < 1024; z++) {
17021702
#endif
1703-
if (yarrow_read(buf[0], z, &yarrow_prng) != z) {
1704-
fprintf(stderr, "%d: Failed to read %lu bytes from yarrow\n", __LINE__, z);
1705-
return 1;
1706-
}
1703+
ENSURE(yarrow_read(buf[0], z, &yarrow_prng) == z);
17071704
DO(mp_read_unsigned_bin(a, buf[0], z));
17081705
/* if (mp_iszero(a) == LTC_MP_NO) { a.sign = buf[0][0] & 1 ? LTC_MP_ZPOS : LTC_MP_NEG; } */
17091706
x = sizeof(buf[0]);
@@ -1723,10 +1720,7 @@ int der_test(void)
17231720
/* test short integer */
17241721
for (zz = 0; zz < 256; zz++) {
17251722
for (z = 1; z < 4; z++) {
1726-
if (yarrow_read(buf[2], z, &yarrow_prng) != z) {
1727-
fprintf(stderr, "%d: Failed to read %lu bytes from yarrow\n", __LINE__, z);
1728-
return 1;
1729-
}
1723+
ENSURE(yarrow_read(buf[2], z, &yarrow_prng) == z);
17301724
/* encode with normal */
17311725
DO(mp_read_unsigned_bin(a, buf[2], z));
17321726

@@ -1763,10 +1757,7 @@ int der_test(void)
17631757

17641758
/* Test bit string */
17651759
for (zz = 1; zz < 1536; zz++) {
1766-
if (yarrow_read(buf[0], zz, &yarrow_prng) != zz) {
1767-
fprintf(stderr, "%d: Failed to read %lu bytes from yarrow\n", __LINE__, zz);
1768-
return 1;
1769-
}
1760+
ENSURE(yarrow_read(buf[0], zz, &yarrow_prng) == zz);
17701761
for (z = 0; z < zz; z++) {
17711762
buf[0][z] &= 0x01;
17721763
}
@@ -1788,10 +1779,7 @@ int der_test(void)
17881779

17891780
/* Test octet string */
17901781
for (zz = 1; zz < 1536; zz++) {
1791-
if (yarrow_read(buf[0], zz, &yarrow_prng) != zz) {
1792-
fprintf(stderr, "%d: Failed to read %lu bytes from yarrow\n", __LINE__, zz);
1793-
return 1;
1794-
}
1782+
ENSURE(yarrow_read(buf[0], zz, &yarrow_prng) == zz);
17951783
x = sizeof(buf[1]);
17961784
DO(der_encode_octet_string(buf[0], zz, buf[1], &x));
17971785
DO(der_length_octet_string(zz, &y));
@@ -1829,10 +1817,7 @@ int der_test(void)
18291817
/* do random strings */
18301818
for (zz = 0; zz < 5000; zz++) {
18311819
/* pick a random number of words */
1832-
if (yarrow_read(buf[0], 4, &yarrow_prng) != 4) {
1833-
fprintf(stderr, "%d: Failed to read %d bytes from yarrow\n", __LINE__, 4);
1834-
return 1;
1835-
}
1820+
ENSURE(yarrow_read(buf[0], 4, &yarrow_prng) == 4);
18361821
LOAD32L(z, buf[0]);
18371822
z = 2 + (z % ((sizeof(oid[0])/sizeof(oid[0][0])) - 2));
18381823

@@ -1841,10 +1826,7 @@ int der_test(void)
18411826
oid[0][1] = buf[0][1] % 40;
18421827

18431828
for (y = 2; y < z; y++) {
1844-
if (yarrow_read(buf[0], 4, &yarrow_prng) != 4) {
1845-
fprintf(stderr, "%d: Failed to read %d bytes from yarrow\n", __LINE__, 4);
1846-
return 1;
1847-
}
1829+
ENSURE(yarrow_read(buf[0], 4, &yarrow_prng) == 4);
18481830
LOAD32L(oid[0][y], buf[0]);
18491831
}
18501832

tests/ecc_test.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ static int s_ecc_test_shamir(void)
154154
/* do 100 random tests */
155155
for (y = 0; y < 100; y++) {
156156
/* pick a random r1, r2 */
157-
LTC_ARGCHK(yarrow_read(buf, sizes[x], &yarrow_prng) == sizes[x]);
157+
ENSURE(yarrow_read(buf, sizes[x], &yarrow_prng) == sizes[x]);
158158
DO(mp_read_unsigned_bin(rA, buf, sizes[x]));
159-
LTC_ARGCHK(yarrow_read(buf, sizes[x], &yarrow_prng) == sizes[x]);
159+
ENSURE(yarrow_read(buf, sizes[x], &yarrow_prng) == sizes[x]);
160160
DO(mp_read_unsigned_bin(rB, buf, sizes[x]));
161161

162162
/* compute rA * G = A */
@@ -166,9 +166,9 @@ static int s_ecc_test_shamir(void)
166166
DO(ltc_mp.ecc_ptmul(rB, G, B, a, modulus, 1));
167167

168168
/* pick a random kA, kB */
169-
LTC_ARGCHK(yarrow_read(buf, sizes[x], &yarrow_prng) == sizes[x]);
169+
ENSURE(yarrow_read(buf, sizes[x], &yarrow_prng) == sizes[x]);
170170
DO(mp_read_unsigned_bin(kA, buf, sizes[x]));
171-
LTC_ARGCHK(yarrow_read(buf, sizes[x], &yarrow_prng) == sizes[x]);
171+
ENSURE(yarrow_read(buf, sizes[x], &yarrow_prng) == sizes[x]);
172172
DO(mp_read_unsigned_bin(kB, buf, sizes[x]));
173173

174174
/* now, compute kA*A + kB*B = C1 using the older method */

0 commit comments

Comments
 (0)