Compare commits

...

2659 commits

Author SHA1 Message Date
Steffen Jaeckel
a10cad624d Update makefiles
Some checks failed
CI / CMake (-DCMAKE_BUILD_TYPE=Release, clang, , map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=Off], ubuntu-24.04) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, clang, , map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=Off], ubuntu-24.04-arm) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, clang, , map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=On], ubuntu-22.04) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, clang, , map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=On], ubuntu-22.04-arm) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, clang, , map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=On], ubuntu-24.04) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, clang, , map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=On], ubuntu-24.04-arm) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, clang, -DLTC_CFLAGS="-DLTC_NO_ASM", map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=Off], ubuntu-22.04) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, clang, -DLTC_CFLAGS="-DLTC_NO_ASM", map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=Off], ubuntu-22.04-arm) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, clang, -DLTC_CFLAGS="-DLTC_NO_ASM", map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=Off], ubuntu-24.04) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, clang, -DLTC_CFLAGS="-DLTC_NO_ASM", map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=Off], ubuntu-24.04-arm) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, clang, -DLTC_CFLAGS="-DLTC_NO_ASM", map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=On], ubuntu-22.04) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, clang, -DLTC_CFLAGS="-DLTC_NO_ASM", map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=On], ubuntu-22.04-arm) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, clang, -DLTC_CFLAGS="-DLTC_NO_ASM", map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=On], ubuntu-24.04) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, clang, -DLTC_CFLAGS="-DLTC_NO_ASM", map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=On], ubuntu-24.04-arm) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, gcc, , map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=Off], ubuntu-22.04) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, gcc, , map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=Off], ubuntu-22.04-arm) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, gcc, , map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=Off], ubuntu-24.04) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, gcc, , map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=Off], ubuntu-24.04-arm) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, gcc, , map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=On], ubuntu-22.04) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, gcc, , map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=On], ubuntu-22.04-arm) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, gcc, , map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=On], ubuntu-24.04) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, gcc, , map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=On], ubuntu-24.04-arm) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, gcc, -DLTC_CFLAGS="-DLTC_NO_ASM", map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=Off], ubuntu-22.04) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, gcc, -DLTC_CFLAGS="-DLTC_NO_ASM", map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=Off], ubuntu-22.04-arm) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, gcc, -DLTC_CFLAGS="-DLTC_NO_ASM", map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=Off], ubuntu-24.04) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, gcc, -DLTC_CFLAGS="-DLTC_NO_ASM", map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=Off], ubuntu-24.04-arm) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, gcc, -DLTC_CFLAGS="-DLTC_NO_ASM", map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=On], ubuntu-22.04) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, gcc, -DLTC_CFLAGS="-DLTC_NO_ASM", map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=On], ubuntu-22.04-arm) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, gcc, -DLTC_CFLAGS="-DLTC_NO_ASM", map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=On], ubuntu-24.04) (push) Has been cancelled
CI / CMake (-DCMAKE_BUILD_TYPE=Release, gcc, -DLTC_CFLAGS="-DLTC_NO_ASM", map[CMAKEOPTIONS:-DBUILD_SHARED_LIBS=On], ubuntu-24.04-arm) (push) Has been cancelled
2026-08-07 08:33:48 +02:00
Karel Miko
0a0969b3d2 private - ltc_algname_match (relaxed alg name matching) 2026-08-04 12:40:06 +02:00
Karel Miko
a3ecbbc800 DER - fail cleanly when no math provider is registered 2026-08-04 12:40:06 +02:00
Steffen Jaeckel
223ecd23b8
Merge pull request #730 from libtom/pr/blake3
BLAKE3
2026-08-04 11:29:14 +02:00
Karel Miko
075342e984 Update makefiles 2026-08-04 11:26:06 +02:00
Karel Miko
5b05baaf36 BLAKE3 2026-08-04 11:26:06 +02:00
Karel Miko
4d5140219b typo LTC_BLAKE2S / LTC_BLAKE2B 2026-08-03 11:39:44 +02:00
Steffen Jaeckel
dc77d926dc
Merge pull request #790 from libtom/fix-latex-tables
Fix latex tables
2026-08-03 11:38:00 +02:00
Steffen Jaeckel
82b193d7c6 Add ARIA to latex-tabels tool & PEM docs.
Fixes: 05ad38ab66 ("With ARIA added, we can now decrypt ARIA encrypted PEM files.")
Fixes: libtom/libtomcrypt#760
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-08-03 11:33:39 +02:00
Steffen Jaeckel
885578932a Ensure that latex-tables tool succeeds
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-08-03 11:12:19 +02:00
Steffen Jaeckel
014cc99c75
Merge pull request #789 from libtom/pr/zero-stat
verify functions always set stat=0 before any other return
2026-08-03 10:53:27 +02:00
Karel Miko
47479c474f verify functions always set stat=0 before any other return 2026-08-03 00:16:20 +02:00
karel-m
02788482af
Merge pull request #788 from libtom/pr/pbes-fix-stack-over-read
PBES - fix stack over-read with malformed PBES2 parameters
2026-08-01 18:37:52 +02:00
karel-m
59767256e6
Merge pull request #787 from libtom/pr/sha512-x86-alt
SHA-512 accelerated by x86 (alternative)
2026-08-01 18:37:40 +02:00
Karel Miko
b50ffea546 PBES - fix stack over-read with malformed PBES2 parameters 2026-08-01 15:44:26 +02:00
Karel Miko
22bc6b68e0 MSVC & SHA512 extension support 2026-08-01 14:13:43 +02:00
Karel Miko
51511d1cd0 Update makefiles 2026-08-01 11:17:41 +02:00
Karel Miko
9e2984aa7e SHA-512 accelerated by x86 (alternative) 2026-08-01 11:17:36 +02:00
karel-m
4d9e2a1a57
Merge pull request #758 from libtom/more-fixes-and-improvements
More fixes and improvements
2026-08-01 10:20:27 +02:00
Karel Miko
bfc516d246 fix typo sha256_x86_compress/sha256_compress (LTC_CLEAN_STACK only) 2026-08-01 09:26:29 +02:00
Steffen Jaeckel
97f5d72457 Ensure the table sizes are OK.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-07-31 23:57:51 +02:00
Steffen Jaeckel
5a2bc6b131 Fix importing certificate with Ed448 key.
While running the tests in verbose mode I saw that
`tests/pem/openssl_ed448_x509.pem` is skipped instead of processed.

Fixes: 076a11037a ("Ed448 + X448")
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-07-31 23:57:51 +02:00
Steffen Jaeckel
2320e44205 Allow processing of empty files.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-07-31 23:57:51 +02:00
Steffen Jaeckel
b0894f683f Add pem tests with empty files.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-07-31 23:57:51 +02:00
Steffen Jaeckel
7978822b69 Add help to test binary.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-07-31 23:57:51 +02:00
Steffen Jaeckel
429d07e388 Some minor SHA1/256 improvements&fixes.
* Use a shared init function.
* Fix some functions used in descriptors and implementation.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-07-31 23:57:51 +02:00
Steffen Jaeckel
fb857d83ed Auto-generate table of hashes.
Fixes: 6c885c7732 ("SM3 hash function")
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-07-31 23:57:51 +02:00
Steffen Jaeckel
54f5803ad8 Rename keccac hash descriptors.
They're the only ones which don't follow the same pattern.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-07-31 23:57:51 +02:00
Steffen Jaeckel
459bd79006
Merge pull request #786 from libtom/pr/appveyor-clang-cl
appveyor + clang-cl
2026-07-31 23:50:20 +02:00
Karel Miko
a58d4b5278 clang-cl fix related to intrin.h 2026-07-31 23:48:18 +02:00
Karel Miko
3acb5aed64 appveyor + clang-cl 2026-07-31 23:48:18 +02:00
Steffen Jaeckel
2d16cc7f76
Merge pull request #756 from libtom/fast-type
Fix LTC_FAST_TYPE
2026-07-31 23:48:02 +02:00
Steffen Jaeckel
4a964ea017 Align macro based and inline LTC_FAST functions. 2026-07-31 20:27:50 +02:00
Karel Miko
6bc4dd9b7b fix UBSanitizer issue: load of misaligned address for type LTC_FAST_TYPE (replacing LTC_FAST_TYPE_PTR_CAST approach) 2026-07-31 20:16:48 +02:00
Steffen Jaeckel
88f95afc5c Rename according to PR #756
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-07-31 20:16:48 +02:00
karel-m
a467ea586b
Merge pull request #785 from libtom/pr/hash-memcpyable
Another attempt to make sha1/sha256 states memcpyable
2026-07-31 11:10:10 +02:00
Steffen Jaeckel
927191b193
Merge pull request #763 from MarekKnapek/ubsan
ubsan
2026-07-31 10:54:12 +02:00
Marek Knápek
c727c4032a Get rid of LTC_FAST_TYPE_PTR_CAST entirely.
As it might be dangerous to use it.

This introduces `LTC_FAST_TYPE_{ASSIGN,MASK,XOR{2,3}}()` in order to
replace the potential unaligned loads.

This fixes the following UBSAN errors:

src/modes/ctr/ctr_encrypt.c:56:66: runtime error: load of misaligned address 0x7ffea07ee82f for type 'LTC_FAST_TYPE', which requires 8 byte alignment
src/modes/ctr/ctr_encrypt.c:56:64: runtime error: store to misaligned address 0x7ffea07ee82f for type 'LTC_FAST_TYPE', which requires 8 byte alignment
tests/store_test.c:66:91: runtime error: load of misaligned address 0x7ffdd32f0d9f for type 'LTC_FAST_TYPE', which requires 8 byte alignment
tests/store_test.c:66:52: runtime error: load of misaligned address 0x7ffdd32f0d71 for type 'LTC_FAST_TYPE', which requires 8 byte alignment
tests/store_test.c:66:50: runtime error: store to misaligned address 0x7ffdd32f0dc1 for type 'LTC_FAST_TYPE', which requires 8 byte alignment
src/mac/pmac/pmac_process.c:40:50: runtime error: load of misaligned address 0x57c89c4329ec for type 'LTC_FAST_TYPE', which requires 8 byte alignment
src/mac/xcbc/xcbc_process.c:35:60: runtime error: load of misaligned address 0x57c89c432ccc for type 'LTC_FAST_TYPE', which requires 8 byte alignment
src/mac/f9/f9_process.c:39:58: runtime error: load of misaligned address 0x5c2b1a1d2c14 for type 'LTC_FAST_TYPE', which requires 8 byte alignment
src/encauth/gcm/gcm_process.c:82:58: runtime error: load of misaligned address 0x596b3e6aa354 for type 'LTC_FAST_TYPE', which requires 8 byte alignment
2026-07-31 10:45:09 +02:00
Marek Knápek
471f143078 Fix UBSAN errors
src/encauth/siv/siv.c:164:19: runtime error: null pointer passed as argument 2, which is declared to never be null
/usr/include/string.h:44:28: note: nonnull attribute specified here
src/misc/compare_testvector.c:63:25: runtime error: null pointer passed as argument 2, which is declared to never be null
/usr/include/string.h:65:33: note: nonnull attribute specified here
2026-07-31 10:44:16 +02:00
Karel Miko
a1a631efe4 make sha1/sha states clonable via memcpy 2026-07-30 20:17:44 +02:00
karel-m
c5607aff6b
Merge pull request #784 from libtom/pr/msvc-fallthrough
Fix LTC_FALLTHROUGH related error reported by MSVC compiler
2026-07-30 16:48:17 +02:00
Karel Miko
23fca6ed39 Fix LTC_FALLTHROUGH related error reported by MSVC compiler 2026-07-30 16:01:06 +02:00
Steffen Jaeckel
79f2b5762d
Merge pull request #777 from libtom/pr/siv-zero-ad
SIV properly handle zero AD components
2026-07-30 15:42:03 +02:00
Karel Miko
511252c49e update SIV doc - fix adnum; explain no associated data vs. empty associated data 2026-07-30 15:39:27 +02:00
Karel Miko
cff7442824 SIV properly handle zero AD components 2026-07-30 15:39:27 +02:00
Steffen Jaeckel
f5fe918ab8
Merge pull request #755 from libtom/fix-warnings
Fix warnings
2026-07-30 15:37:58 +02:00
Karel Miko
074a354151 fix build failures with -std=c99 2026-07-30 15:22:33 +02:00
Karel Miko
0b6f0e1232 fix clang warnings -Wimplicit-fallthrough (while keeping /* FALLTHROUGH */ for some code review tools) 2026-07-30 15:22:33 +02:00
Karel Miko
26605163a4 fix clang warnings -Wmissing-variable-declarations 2026-07-30 15:22:33 +02:00
Karel Miko
317994fb1b fix clang warnings -Wstrict-prototypes -Wmissing-prototypes in tests+demos 2026-07-30 15:22:33 +02:00
Karel Miko
661fcd6486 fix UBSanitizer issue: applying non-zero offset to null pointer 2026-07-30 15:22:33 +02:00
Karel Miko
5c8ac18bd1 fix UBSanitizer issue: memcpy/memcmp require non-null pointers even when the length is zero 2026-07-30 15:22:33 +02:00
Karel Miko
76a9ece653 fix UBSanitizer issue: left-shifting negative integer is undefined behavior 2026-07-30 15:22:33 +02:00
Karel Miko
509da35eee fix clang warning: 'err' may be used uninitialized 2026-07-30 15:22:33 +02:00
karel-m
612f211bbc
Merge pull request #783 from libtom/pr/der-misc-issues
various DER related fixes/improvements
2026-07-29 23:50:05 +02:00
Karel Miko
209df8ae1a hardening pkcs8_get_children against uninitialized output pointers 2026-07-28 16:33:09 +02:00
Karel Miko
5c7757d0a5 various DER related fixes/improvements 2026-07-28 00:10:29 +02:00
Steffen Jaeckel
a8ed78c2ca
Merge pull request #780 from libtom/pr/argon2-parallelism-overflow
Argon2 enforce parallelism max 2^24-1
2026-07-21 11:07:46 +02:00
Karel Miko
fcadf67bbb Argon2 enforce parallelism max 2^24-1 2026-07-21 11:02:31 +02:00
Steffen Jaeckel
b7b04ffd37
Merge pull request #778 from libtom/pr/eax-taglen
EAX properly handle taglen boundaries
2026-07-21 10:59:19 +02:00
Karel Miko
39f5e1fae8 EAX properly handle taglen boundaries 2026-07-21 10:56:44 +02:00
Steffen Jaeckel
84aec00adc
Merge pull request #776 from libtom/pr/ccm-nonce
Fix issue #775 - CCM nonce is 7..13 bytes
2026-07-21 10:56:27 +02:00
Karel Miko
e00b22d939 CCM nonce is 7..13 bytes 2026-07-21 10:53:25 +02:00
Steffen Jaeckel
1027dcfaf6
Merge pull request #765 from libtom/pr/fix-issue764
Fix issue #764 - small-subgroup attack
2026-07-21 10:53:14 +02:00
Karel Miko
bc95a1fd2d hardening ecc_shared_secret against small-subgroup attacks 2026-05-25 16:18:14 +02:00
Karel Miko
ec7c05f94e fix issue #764 as suggested by @yaotushaozhu 2026-05-25 14:11:27 +02:00
Karel Miko
afb09869f7 failing test for issue #764 - small-subgroup attack regression test 2026-05-25 13:56:48 +02:00
Steffen Jaeckel
a68fa19bc2
Merge pull request #732 from libtom/pr/sm3-hash
SM3 hash function
2026-05-19 13:31:48 +02:00
Steffen Jaeckel
c17e5ed051 Update makefiles 2026-05-19 13:29:49 +02:00
Karel Miko
6c885c7732 SM3 hash function 2026-05-19 13:29:36 +02:00
Steffen Jaeckel
291d847c10
Merge pull request #752 from libtom/pr/AES-GCM-SIV
RFC 8452 - AES-GCM-SIV
2026-05-19 13:14:53 +02:00
Karel Miko
96d2d09d7a Update makefiles 2026-05-19 13:12:32 +02:00
Karel Miko
37a2e345a4 AES-GCM-SIV 2026-05-19 13:12:32 +02:00
Steffen Jaeckel
8512e3e891
Merge pull request #759 from libtom/pr/KMAC128-256
KMAC as defined in NIST SP 800-185
2026-05-19 13:05:06 +02:00
Karel Miko
7bcdb63950 Update makefiles 2026-05-19 13:03:25 +02:00
Karel Miko
9b268d6258 KMAC - NIST SP 800-185 2026-05-19 13:03:25 +02:00
Steffen Jaeckel
6e4dcfcc11
Merge pull request #760 from libtom/pr/ARIA
ARIA block cipher (RFC 5794)
2026-05-19 10:22:37 +02:00
Steffen Jaeckel
05ad38ab66 With ARIA added, we can now decrypt ARIA encrypted PEM files.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-17 13:49:10 +02:00
Karel Miko
2f6b257def Update makefiles 2026-05-16 11:38:42 +02:00
Karel Miko
4d513a02fc ARIA block cipher (RFC 5794) 2026-05-16 11:38:38 +02:00
Steffen Jaeckel
8b5af49b94
Merge pull request #754 from libtom/pr/shake128-256
RFC 8702: RSA-PSS-SHAKE128/256 and ECDSA-SHAKE128/256
2026-05-06 09:48:25 +02:00
Karel Miko
1e4d471a9f RFC 8702: RSA-PSS-SHAKE128/256 and ECDSA-SHAKE128/256 2026-05-06 09:23:52 +02:00
Steffen Jaeckel
efd7f24f1a
Merge pull request #753 from libtom/pr/wycheproof-pk-stricter-checks
Stricter checks (RSA OAEP, X25519, X448) - based on wycheproof results
2026-05-05 07:42:48 +02:00
Karel Miko
2c375b3a3c RSA OAEP - reject ciphertext values 0 and 1 2026-05-05 07:42:20 +02:00
Karel Miko
71f45fedbc x25519/x448 - reject all-zero shared secrets 2026-05-05 07:40:06 +02:00
Steffen Jaeckel
efad039f19
Merge pull request #751 from libtom/more-fixes-and-improvements
More fixes and improvements
2026-05-04 15:32:59 +02:00
Steffen Jaeckel
a724483a0b Add gcm_hw_pmul_is_supported()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-04 10:47:11 +02:00
Steffen Jaeckel
c05b3088b4 Use __has_attribute() for target attribute.
... and bring aarch64/PMULL in similar shape as x86/PCLMUL.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-04 10:47:05 +02:00
Karel Miko
42489a16cb fix basename(..) in demos 2026-05-04 10:44:57 +02:00
Steffen Jaeckel
9e446e665f Better position to print this info.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-04 10:08:07 +02:00
Steffen Jaeckel
fdf0b60170 Replace some CI builds with a single build_options.sh run.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-04 10:08:07 +02:00
Steffen Jaeckel
078fd15f69 Apply V option to make clean
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-04 10:08:07 +02:00
Steffen Jaeckel
f940880a67 Create ENCRYPT_ONLY descriptors in amalgamated build.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-04 10:08:07 +02:00
Steffen Jaeckel
3520a0fcf5 Fix maybe-unitialized warnings.
Fixes: e20fff1f3d ("Add more TurboSHAKE unit tests.")
Fixes: 6832f3c106 ("Add KangarooTwelve XOF functions.")
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-04 10:08:07 +02:00
Steffen Jaeckel
011d427196 Remove dirty hacks in SHA3.
Fixes: 6832f3c106 ("Add KangarooTwelve XOF functions.")
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-04 10:08:07 +02:00
Steffen Jaeckel
001fa107d1 Some minor fixes detected in AMALGAMATED builds.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-04 10:08:07 +02:00
Marek Knápek
580be51806 Use LTC_UNUSED_PARAM().
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-04 10:08:07 +02:00
Steffen Jaeckel
07cab77569 Test aesgcm demo.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-04 10:08:07 +02:00
Steffen Jaeckel
7fb003f1a2 Slightly improve timing demo.
* Use faster sober128 if available.
* Use stable PRNG state for ECC operations, so we get comparable results.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-04 10:08:07 +02:00
Steffen Jaeckel
ccbbb797f0 Fix indentation.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-03 11:11:39 +02:00
Steffen Jaeckel
229f540c48 Don't print warning in case LTC_NO_TEST is defined.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-03 11:11:39 +02:00
Steffen Jaeckel
0834f876cd Split up ec25519/448 tests.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-03 11:11:39 +02:00
Steffen Jaeckel
811b1a6c14 Introduce LTC_NOP_TEST()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-03 11:11:39 +02:00
Steffen Jaeckel
45f95768da
Merge pull request #747 from libtom/pr/wycheproof-padding_depad
padding_depad - reject zero-length input (except for LTC_PAD_ZERO)
2026-04-30 11:42:08 +02:00
Steffen Jaeckel
180ffcdd65
Merge pull request #748 from libtom/pr/wycheproof-ecdh
ECC failing wycheproof tests
2026-04-30 11:41:18 +02:00
Karel Miko
e312fffaf2 fix ECC failing wycheproof tests 2026-04-30 11:41:04 +02:00
Karel Miko
7c0e52114e ecc - failing wycheproof tests 2026-04-30 11:41:04 +02:00
Steffen Jaeckel
2317c13d62
Merge pull request #749 from libtom/pr/wycheproof-ed448
Ed448/X448 failing wycheproof tests
2026-04-30 08:46:24 +02:00
Karel Miko
176c4827fc fix Ed448/X448 failing wycheproof tests 2026-04-30 08:46:13 +02:00
Karel Miko
8dd6ecfd20 ed448/x448 - failing wycheproof tests 2026-04-30 08:46:13 +02:00
Steffen Jaeckel
284129706a
Merge pull request #746 from libtom/pr/wycheproof-frp256v1
add FRP256v1 - French governmental ECC curve
2026-04-30 08:45:07 +02:00
Karel Miko
8a1b70a040 add FRP256v1 (French governmental ECC curve referenced in wycheproof test suite) 2026-04-30 08:44:46 +02:00
Steffen Jaeckel
888307876a
Merge pull request #750 from libtom/pr/wycheproof-decode_bit_string
wycheproof - fix failing ASN.1 BIT STRING related test
2026-04-30 08:43:45 +02:00
Karel Miko
577f2bc155 fix failing wycheproof test (ecdh_brainpoolP224r1_test.json tcId=787) ASN.1 BIT STRING related 2026-04-29 20:07:43 +02:00
Karel Miko
8ea53b4eaf padding_depad - reject zero-length input (except for LTC_PAD_ZERO) 2026-04-29 14:33:20 +02:00
Steffen Jaeckel
6e699f964d
Merge pull request #410 from libtom/pr/fix-LTC_MECC_FP
fix LTC_MECC_FP
2026-04-29 10:56:18 +02:00
Steffen Jaeckel
9e1c6174fc Add CI jobs with ECC FP enabled.
We replace the PTHREAD job with `ECC_FP+PTHREAD` since PTHREAD is only
relevant for ECC_FP and the PRNG's.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-29 10:53:40 +02:00
Steffen Jaeckel
576258b5fc Fix ECC FP API.
We have to return an error code when working with the mutex API.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-29 10:53:40 +02:00
Steffen Jaeckel
1f28017b10 Fix typo
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-29 10:53:40 +02:00
Steffen Jaeckel
22586373c3 Fix potential unsigned underflow.
Running the `timing` demo with `LTC_MECC_FP` enabled gave a segfault,
which Valgrind narrowed down to

```
==135594== Invalid read of size 1
==135594==    at 0x49298C: ss_accel_fp_mul2add (ltc_ecc_fp_mulmod.c:1007)
==135594==    by 0x4931C1: ltc_ecc_fp_mul2add (ltc_ecc_fp_mulmod.c:1192)
==135594==    by 0x41C1B2: ecc_verify_hash_internal (ecc_verify_hash_internal.c:114)
==135594==    by 0x41C830: ecc_verify_hash_rfc7518_internal (ecc_verify_hash_rfc7518.c:35)
==135594==    by 0x40340F: time_ecc (timing.c:1031)
==135594==    by 0x402894: main (timing.c:1621)
==135594==  Address 0x20feffeb2f is not stack'd, malloc'd or (recently) free'd
```

The origin being `ltc_mp_unsigned_bin_size(tkb)` returning 0, so y is -1,
but as an unsigned type that's no fun.

Fixed by making y a signed type.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-29 10:53:40 +02:00
Karel Miko
6affa8b99f fix LTC_MECC_FP 2026-04-29 10:53:40 +02:00
Steffen Jaeckel
0a46eb2e5c
Merge pull request #740 from MarekKnapek/738
Fix for issue #738.
2026-04-27 23:26:19 +02:00
Marek Knápek
44d111e755 Fix for issue #738.
Closes: libtom/libtomcrypt#738
2026-04-27 23:25:14 +02:00
Steffen Jaeckel
d062d0e31f
Merge pull request #446 from libtom/pr/wycheproof-fail-changed-seq-tag
Wycheproof failing ECC tests
2026-04-27 14:23:07 +02:00
Karel Miko
66a2e73eb8 fix for issue #116 2026-04-27 14:19:59 +02:00
Karel Miko
8e9b1983af fix ecc_projective_add_point + ecc_projective_dbl_point 2026-04-27 14:19:59 +02:00
Steffen Jaeckel
689b57755b Fix cases where the points are equal.
In the case where `(P.x,P.y) == (Q.x,Q.y)` in affine coordinates, which
shows itself as either of the two being 0 after the add, we have
to double instead of add.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-27 14:19:59 +02:00
Steffen Jaeckel
b67f4397f4 Ensure that stat is initialized.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-27 14:19:59 +02:00
Steffen Jaeckel
9fa2f16ddc Fix length-related wycheproof testcases
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-27 14:19:59 +02:00
Karel Miko
1d55aca785 failing wycheproof tests 2026-04-27 14:19:59 +02:00
Steffen Jaeckel
7d0d0799ce
Merge pull request #744 from libtom/fix-743
Fix 743
2026-04-27 14:16:54 +02:00
tynus3
1bb1e6172c Fix off-by-one heap BOF.
Fixes: 1b3a757345 ("add ASN.1-identifier functions")
Closes: libtom/libtomcrypt#743
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-27 12:56:58 +02:00
Steffen Jaeckel
876460e7b6 Add testcases.
Link: libtom/libtomcrypt#743
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-27 12:56:58 +02:00
Steffen Jaeckel
143679efce
Merge pull request #741 from libtom/pr/rsa-import-failure
fix RSA import
2026-04-24 18:34:59 +02:00
Steffen Jaeckel
55bf39c50e Also add the failing key to the test corpus.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-24 18:32:50 +02:00
Karel Miko
9f56c5803e fix RSA import 2026-04-24 16:49:08 +02:00
Steffen Jaeckel
0971e458ba
Merge pull request #722 from libtom/pr/ed448-x448-attempt3
Ed448 + X448
2026-04-24 13:14:56 +02:00
Karel Miko
e0599e2b3a Update makefiles 2026-04-24 11:50:39 +02:00
Karel Miko
076a11037a Ed448 + X448 2026-04-24 11:49:23 +02:00
Steffen Jaeckel
c80285ba04
Merge pull request #725 from libtom/remove-ocb-v1
Remove OCB v1
2026-04-24 10:49:18 +02:00
Steffen Jaeckel
b6d4e6384e Update makefiles 2026-04-24 10:45:27 +02:00
Steffen Jaeckel
800e5ce319 Remove OCB v1.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-24 10:45:24 +02:00
Steffen Jaeckel
f5438b298d Deprecate OCB v1.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-24 09:45:26 +02:00
Steffen Jaeckel
8c82c8786b Update OCB docs regarding patents.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-24 09:45:26 +02:00
Steffen Jaeckel
2be5cceb84
Merge pull request #729 from libtom/pr/xchacha20-xchacha20poly130
XChaCha20 / XChaCha20-Poly1305
2026-04-24 09:44:28 +02:00
Karel Miko
b0a1804d50 Update makefiles 2026-04-24 09:41:08 +02:00
Karel Miko
0e4c5aff7e XChaCha20 / XChaCha20-Poly1305 2026-04-24 09:41:08 +02:00
Steffen Jaeckel
c53dfcc6df
Merge pull request #739 from libtom/pr/wycheproof-ed25519
Wycheproof Ed25519 test vectors + fix
2026-04-24 09:36:21 +02:00
Karel Miko
0f37c60fd7 Wycheproof Ed25519 test vectors + fix 2026-04-24 09:36:09 +02:00
Steffen Jaeckel
14d9bd0f82
Merge pull request #736 from libtom/pr/gcm-freebsd
GCM + FreeBSD + HWCAP_PMULL
2026-04-24 09:35:00 +02:00
Karel Miko
e63dca1277 GCM + FreeBSD + HWCAP_PMULL 2026-04-24 09:34:50 +02:00
Steffen Jaeckel
cfb3ba8339
Merge pull request #726 from libtom/cleanup-and-fixes
Cleanup and fixes
2026-04-23 12:27:16 +02:00
Steffen Jaeckel
760d09031e Add Project Wycheproof testvectors for SIV.
Gemini proposed this to convert
```
import json
import requests

def to_c_hex(hex_str):
    if not hex_str: return "NULL"
    bytes_list = [f"0x{hex_str[i:i+2]}" for i in range(0, len(hex_str), 2)]
    return "{" + ",".join(bytes_list) + "}"

url = "https://raw.githubusercontent.com/C2SP/wycheproof/main/testvectors_v1/aes_siv_cmac_test.json"
data = requests.get(url).json()

print("#include <stdint.h>\n#include <stddef.h>\n")
print("typedef struct { int tcId; const char* comment; uint8_t key[64]; size_t keyLen; const uint8_t* aad; size_t aadLen; const uint8_t* msg; size_t msgLen; const uint8_t* ct; size_t ctLen; const char* result; } aes_siv_test_case;\n")

for group in data['testGroups']:
    for test in group['tests']:
        tid = test['tcId']
        if test['aad']: print(f"static const uint8_t aad_{tid}[] = {to_c_hex(test['aad'])};")
        if test['msg']: print(f"static const uint8_t msg_{tid}[] = {to_c_hex(test['msg'])};")
        if test['ct']:  print(f"static const uint8_t ct_{tid}[]  = {to_c_hex(test['ct'])};")

print("\nstatic const aes_siv_test_case aes_siv_tests[] = {")
for group in data['testGroups']:
    for test in group['tests']:
        tid = test['tcId']
        key_hex = to_c_hex(test['key'])
        aad_ptr = f"aad_{tid}" if test['aad'] else "NULL"
        msg_ptr = f"msg_{tid}" if test['msg'] else "NULL"
        ct_ptr  = f"ct_{tid}"  if test['ct']  else "NULL"

        print(f"    {{ {tid}, \"{test['comment']}\", {key_hex}, {len(test['key'])//2}, {aad_ptr}, {len(test['aad'])//2}, {msg_ptr}, {len(test['msg'])//2}, {ct_ptr}, {len(test['ct'])//2}, \"{test['result']}\" }},")
print("};")
```

I manually modified the result type to be an enum.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 10:30:32 +02:00
Steffen Jaeckel
098e0e3030 Explicitly use padding type.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 10:30:32 +02:00
Steffen Jaeckel
72642a7e8c Make depadding better against timing attacks.
Fixes: 82482119df ("add padding module")
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 10:30:27 +02:00
Steffen Jaeckel
f700888231 Accept zero-length data in CTR mode.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 10:30:27 +02:00
Steffen Jaeckel
b8c5ea8f18 Accept zero-length data in OMAC.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 10:30:27 +02:00
Steffen Jaeckel
5f4287aced Fix SIV.
This also changes the API, since we need to know how many ADs are passed
and can't rely on a NULL element, as an empty element also changes the
tag.

Fixes: faa8cd71e5 ("add SIV")
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 10:29:48 +02:00
Steffen Jaeckel
5c7e0e9fb1 Allow pt as NULL if there's nothing to encrypt.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 09:13:02 +02:00
Steffen Jaeckel
57b92e7351 Add a sentence about the origins of the CHC hash.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 09:13:02 +02:00
Steffen Jaeckel
d7c650d398 Update PR template.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 09:13:02 +02:00
Steffen Jaeckel
18cfd0f87a Suppress warnings emitted by Clang.
Fixes: 874e095a19 ("SHA-256 & SHA-224 x86")
Fixes: 7ac05df902 ("Add x86-optimized SHA1.")
Fixes: 46e0137e55 ("Optimize gcm_gf_mult using PCLMULQDQ and PMULL")
Fixes: 31c7f891aa ("add support for AES-NI instructions")
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 09:13:02 +02:00
Steffen Jaeckel
fe7bfb053a Branch once, not on each iteration.
Even though the branch predictor should get this, it's unnecessary.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 09:13:02 +02:00
Steffen Jaeckel
6be6de1ffa Replace int* recid hack in ECC.
Link: libtom/libtomcrypt#724
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 09:13:02 +02:00
Steffen Jaeckel
233f226108 Fix some ifdefs, include guards and a function call.
Fixes: 7ac05df902 ("Add x86-optimized SHA1.")
Fixes: 874e095a19 ("SHA-256 & SHA-224 x86")
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 09:13:02 +02:00
Steffen Jaeckel
e5df4f7ce8 Fix build with -DLTC_MINIMAL.
Fixes: 661109f660 ("re-factor modes to use internal ECB implementation")
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 09:13:02 +02:00
Steffen Jaeckel
e2544d4071 Further improve timing demo.
Filtering is now possible for all classes besides public key crypto.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 09:13:02 +02:00
Steffen Jaeckel
661dad10c7 Make HW-accel checkers always available.
Since the SHA-NI checker does the same for all three versions, we only have
to make one version public. This also now enables explicit testing of the
SHA-NI blocks.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 09:13:02 +02:00
Steffen Jaeckel
ec3804c452 Use s_x86_cpuid() in s_{aesni,pclmul}_is_supported().
Hopefully at one point we can get rid of its duplication. Why again don't
we use inline functions as they should be used?

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 09:13:02 +02:00
Steffen Jaeckel
e3bf539e5d Clean-up some defines.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 09:13:02 +02:00
Steffen Jaeckel
4bdd0480f7 Introduce LTC_NO_ACCEL.
Related-to: libtom/libtomcrypt#727
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 09:13:02 +02:00
Steffen Jaeckel
a8236250a9
Merge pull request #737 from libtom/pr/sha3-missing-ltc_test
couple of missing: if defined(LTC_TEST)
2026-04-23 08:55:41 +02:00
Karel Miko
854749e2f4 couple of missing: if defined(LTC_TEST) 2026-04-23 08:16:12 +02:00
Steffen Jaeckel
ff52a70038
Merge pull request #734 from libtom/pr/fix-unused-parameter
fix unused-parameter warning
2026-04-22 14:41:44 +02:00
Karel Miko
a29e328b07 fix unused-parameter warning 2026-04-22 14:41:34 +02:00
Steffen Jaeckel
463431edc2
Merge pull request #735 from libtom/pr/hmac-zero-key
patch HMAC to accept zero-length keys and remove the scrypt workaround
2026-04-22 14:40:45 +02:00
Karel Miko
557e9e2678 patch HMAC to accept zero-length keys and remove the scrypt workaround 2026-04-21 23:35:10 +02:00
Steffen Jaeckel
2e441a17df
Merge pull request #717 from MarekKnapek/SHA-1x86
SHA-1, SHA-224 & SHA-256 with x86 instructions
2026-04-15 17:27:26 +02:00
Steffen Jaeckel
070d613d26 Update makefiles 2026-04-15 15:22:32 +02:00
Marek Knápek
874e095a19 SHA-256 & SHA-224 x86 2026-04-15 15:22:25 +02:00
Marek Knápek
7ac05df902 Add x86-optimized SHA1. 2026-04-15 15:20:28 +02:00
Steffen Jaeckel
68aae28a9d
Merge pull request #706 from libtom/new-rsa-api
New RSA API
2026-04-15 12:27:08 +02:00
Karel Miko
fa26d13016 RSA: update documentation (crypt.tex) to reflect the latest changes 2026-04-15 11:12:30 +02:00
Karel Miko
7ab625c090 RSA: fix demos/timing.c 2026-04-15 11:12:30 +02:00
Karel Miko
21d100d862 RSA: make rsa_decode_parameters work with rsa_key instead of ltc_rsa_parameters 2026-04-15 11:12:30 +02:00
Karel Miko
80de9b088b RSA: cosmetics - consistency tomcrypt_pk.h vs implementation files 2026-04-15 11:12:30 +02:00
Karel Miko
32ab39fb42 RSA: comment typo 2026-04-15 11:12:30 +02:00
Karel Miko
e4d3bd2fa5 RSA: replace hash_alg + mgf1_hash_alg with hash_idx + mgf1_hash_idx 2026-04-15 11:12:30 +02:00
Karel Miko
7fa7c2ad51 RSA: remove unnecessary #define LTC_DEPRECATED(x) 2026-04-15 11:12:30 +02:00
Karel Miko
557cb62b06 RSA: use consistently ltc_rsa_op_checked (+ cosmetic renaming op_check >> op_checked) 2026-04-15 11:12:30 +02:00
Karel Miko
c1b3281433 RSA: no more dual semantics of pss_oaep (removed from ltc_rsa_parameters; now lives on rsa_key where it belongs) 2026-04-15 11:12:30 +02:00
Karel Miko
d2829aa10f RSA: PSS + all encryption needs a PRNG 2026-04-15 11:12:30 +02:00
Steffen Jaeckel
66e677aedd Introduce new RSA API.
This also:
a) deprecates the old RSA and PKCS#1 API.
b) reverts the changes done to them in order to make the now deprecated API
   compatible again with the last release.

The fixes commit mentioned below is the testcase for the Bleichenbacher
attack, which works now again as expected.

Fixes: 9d03c38e ("add flags to `der_decode_sequence()`")
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-15 11:12:30 +02:00
Steffen Jaeckel
208ee2be4e Refactor SubjectPublicKeyInfo import
Slightly minimize both space and time when importing a
SubjectPublicKeyInfo. Time for ECC keys stays the same.

Those tests were done with X.509 support already available, but later these
commits were split up to be independent of the X.509 feature.

Running the entire set of pem files through `x509_verify` via [0]
resp. the timing app via [1] resulted in the following data:

Before this patch:

[0]
```
==1031519== HEAP SUMMARY:
==1031519==     in use at exit: 0 bytes in 0 blocks
==1031519==   total heap usage: 424,057 allocs, 424,057 frees, 73,527,730 bytes allocated
```

[1]
```
x509 cert-rsa-pss.pem    :     50021 cycles
x509 LTC_CA.pem          :     10335 cycles
x509 LTC_S0.pem          :     47284 cycles
x509 LTC_SS0.pem         :     36687 cycles
x509 secp384r1.pem       :   1985416 cycles
x509 secp521r1.pem       :   3287773 cycles
x509 LTC_SSS0.pem        :     25086 cycles
x509 secp224r1.pem       :    775807 cycles
```

After this patch:

[0]
```
==1043548== HEAP SUMMARY:
==1043548==     in use at exit: 0 bytes in 0 blocks
==1043548==   total heap usage: 337,244 allocs, 337,244 frees, 65,047,463 bytes allocated
```

[1]
```
x509 cert-rsa-pss.pem    :     32568 cycles
x509 LTC_CA.pem          :      5478 cycles
x509 LTC_S0.pem          :     36093 cycles
x509 LTC_SS0.pem         :     23351 cycles
x509 secp384r1.pem       :   1984030 cycles
x509 secp521r1.pem       :   3303396 cycles
x509 LTC_SSS0.pem        :     13220 cycles
x509 secp224r1.pem       :    781534 cycles
```

[0] find tests/x509 -name '*.pem' -exec valgrind --leak-check=full --show-leak-kinds=all './x509_verify' {} \+
[1] ./timing x509

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-15 11:12:30 +02:00
Steffen Jaeckel
d1ab64ec25 Add support for RSA-PSS keys
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-15 11:12:30 +02:00
Steffen Jaeckel
56f0e118dd Add support for separate MGF1 hashes
Update PKCS#1-PSS and RSA APIs that allow passing a separate hash index for
the MGF1 hash.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-15 11:12:30 +02:00
Steffen Jaeckel
33d8f8464d
Merge pull request #723 from cyanogilvie/fix/ocb-decrypt-aliasing
Fix s_ocb_done aliasing bug in decrypt path
2026-04-15 11:10:32 +02:00
Cyan Ogilvie
8c68d99221 Fix s_ocb_done aliasing bug in decrypt path
In decrypt mode (mode==1), s_ocb_done was XORing `ct[x]` into the
checksum before writing the output.  The function's parameter names are
misleading (the header comment notes pt/ct really mean in/out), so in
decrypt mode `ct` is the not-yet-written *output* buffer and `pt` is
the *input* ciphertext.  Reading from `ct` only worked when callers
aliased the input and output buffers (in-place decryption), as the
self-test does.  Callers passing distinct buffers got CRYPT_OK with
stat=0 -- correct plaintext but failed tag verification.

Fix by reading from `pt[x]` (the input).  Add a separate-buffer
regression case to ocb_test that runs against every existing test
vector and was confirmed to fail without the fix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 19:32:17 -03:00
Steffen Jaeckel
e5bfb94f63
Merge pull request #719 from libtom/pr/scrypt-rfc7914
The scrypt Password-Based Key Derivation Function (RFC 7914)
2026-04-14 16:17:28 +02:00
Karel Miko
3aed12c410 The scrypt Password-Based Key Derivation Function (RFC 7914) 2026-04-14 13:59:38 +02:00
Steffen Jaeckel
94287f0480
Merge pull request #721 from cyanogilvie/fix/pclmul-cache-init-msvc
Fix s_pclmul_is_supported() cache flag on MSVC
2026-04-14 13:36:27 +02:00
Cyan Ogilvie
baac704391 Fix s_pclmul_is_supported() cache flag on MSVC
Move initialized=1 out of the #else branch so that on MSVC it doesn't
call __cpuid every time.
2026-04-14 07:45:41 -03:00
Steffen Jaeckel
cf29490bfc Introduce LTC_ALIGNED_BUF_SIZE(). [skip ci]
Since there's absolutely no way to ensure that a struct is somehow
aligned -- all those compile-time mechanism are best-effort and no
guarantee -- we align the necessary buffers at run-time.

AES-NI already introduced that, let's improve a bit upon its usage.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-14 09:55:43 +02:00
Steffen Jaeckel
14352f5036 Improve timing demo a bit. [skip ci]
Allow more classes to be filtered.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-14 09:17:11 +02:00
Karel Miko
66925c259c Fix helper.pl. [skip ci]
Fix matching of other uses of a descriptor type, besides their declaration.
2026-04-13 19:48:05 +02:00
Steffen Jaeckel
25e93e39cf Add uninstall_hooks make command. [skip ci]
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-13 14:45:12 +02:00
Steffen Jaeckel
5abd33ea32
Merge pull request #718 from libtom/pr/argon2-rfc9106
Argon2 password hashing function (RFC 9106)
2026-04-13 10:47:50 +02:00
Steffen Jaeckel
c68b9c0b3f Minor changes of argon2 implementation.
* We continue using `LTC_ARGCHK()` until we've decided on something else.
* Call the enum/struct the same as the typedef.
* Some other small adjustments/fixes.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-12 16:06:53 +02:00
Karel Miko
458b392d01 Argon2 password hashing function (RFC 9106) 2026-04-12 14:48:32 +02:00
Steffen Jaeckel
3223b87588
Merge pull request #709 from MarekKnapek/sha-stack
Smaller stack usage for SHA-1, SHA-256 and SHA-512.
2026-04-09 17:04:26 +02:00
Steffen Jaeckel
cc53195945 Update docs.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-09 15:40:07 +02:00
Steffen Jaeckel
11929885a4 Basic algo self-tests should be run before the ones using them.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-09 15:40:07 +02:00
Steffen Jaeckel
77afa82d14 Add option LTC_SMALL_STACK.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-09 15:40:07 +02:00
Steffen Jaeckel
a9cd3cd0ff Slightly improve timing demo.
* Add the option to only run for a subset of algos.
* Improve `hash` to show something meaningful.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-09 08:29:50 +02:00
Marek Knápek
17cbd2be0a Smaller stack usage for SHA-1, SHA-256 and SHA-512. 2026-04-09 08:29:50 +02:00
Steffen Jaeckel
d0e09092f9 Re-format gitignore. [skip ci]
I wasn't aware that the gitignore file had DOS line endings. Changed that
to UNIX line endings.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-09 08:29:38 +02:00
Steffen Jaeckel
ecc36868a9
Merge pull request #714 from sjlombardo/develop
Optimize gcm_gf_mult using PCLMULQDQ and PMULL
2026-04-07 18:31:43 +02:00
Steffen Jaeckel
93eed8d3fa Add CMake CI testrun w/o ASM
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-07 16:51:37 +02:00
Stephen Lombardo
46e0137e55 Optimize gcm_gf_mult using PCLMULQDQ and PMULL
GCM table setup disproportionately hurts LTC performance
with small messages. Disabling LTC_GCM_TABLES helps for
small payloads but hurts large ones.

This implements hardware carry-less multiplication for GCM that
performs well for both cases using PCLMULQDQ on x86/x86_64 and
PMULL on AArch64.

There are no public API changes.

These features can be disabled with LTC_NO_GCM_PCLMUL,
LTC_NO_GCM_PMULL, or LTC_NO_ASM. LTC_GCM_TABLES is disabled
automatically when no opt-out macro is set.
2026-04-07 16:51:37 +02:00
Steffen Jaeckel
6ad2ce97a4
Merge pull request #715 from libtom/add-cmake-tests
Add CMake & arm64 tests to CI
2026-04-07 15:45:09 +02:00
Steffen Jaeckel
0572f9564f Update nick-fields/retry GH action
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-07 12:40:22 +02:00
Steffen Jaeckel
97be312324 Add CMake tests to CI
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-07 12:19:33 +02:00
Steffen Jaeckel
63af5f6dc1 Update docs of ecc_free().
This fixes #710

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-02-04 11:30:24 +01:00
Steffen Jaeckel
9a13375d47
Merge pull request #708 from MarekKnapek/KangarooTwelve
KangarooTwelve
2025-11-28 22:27:59 +01:00
Marek Knápek
6832f3c106 Add KangarooTwelve XOF functions.
KangarooTwelve 128bits and KangarooTwelve 256 bits.

https://keccak.team/files/TurboSHAKE.pdf
https://www.rfc-editor.org/rfc/rfc9861.txt
https://datatracker.ietf.org/doc/html/rfc9861
2025-11-28 19:05:31 +01:00
Marek Knápek
189f9ccdf0 LTC_TURBO_SHAKE requires LTC_SHA3 2025-11-28 19:05:31 +01:00
Marek Knápek
e20fff1f3d Add more TurboSHAKE unit tests. 2025-11-28 19:05:31 +01:00
Marek Knápek
d31ca86251 Introduce the concept of "domain" for SHAKE XOF. 2025-11-27 14:28:00 +01:00
Steffen Jaeckel
4db24a7d08
Merge pull request #692 from MarekKnapek/turboshake
Add TurboSHAKE XOF functions.
2025-11-26 11:08:29 +01:00
Steffen Jaeckel
2c487a2e4b Update docs.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-25 10:09:14 +01:00
Steffen Jaeckel
e33128e18c Fix LTC_COMPARE_TESTVECTOR()
Fixes: 6daff83d ("Deprecate `compare_testvector()`.")
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-25 09:28:20 +01:00
Marek Knápek
709572e22e Add TurboSHAKE XOF functions.
TurboSHAKE128 and TurboSHAKE256.
https://datatracker.ietf.org/doc/html/rfc9861
https://www.rfc-editor.org/rfc/rfc9861.txt
https://keccak.team/files/TurboSHAKE.pdf
https://github.com/libtom/libtomcrypt/issues/691
2025-11-25 09:22:35 +01:00
Steffen Jaeckel
34b6ad9a2e
Merge pull request #707 from libtom/improve-tests
Improve tests
2025-11-24 16:15:18 +01:00
Steffen Jaeckel
dda1c7eedf Re-factor modes_test().
... also funny that no static analyzer complained about `ret` being
assigned, but never read ...

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-24 14:58:13 +01:00
Steffen Jaeckel
6daff83d82 Deprecate compare_testvector().
This should never have been public API.
Also introduce a `LTC_COMPARE_TESTVECTOR()` macro to be used within the
library, which doesn't exit, but only returns an error.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-24 14:58:13 +01:00
Steffen Jaeckel
03881e4abc
Merge pull request #699 from libtom/some-improvements
Some improvements
2025-11-19 00:22:08 +01:00
Steffen Jaeckel
369650ccd3 Update makefiles 2025-11-18 23:20:01 +01:00
Steffen Jaeckel
e2918971fa Re-order PEM headers to prepare for X.509 APIs
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-18 23:20:01 +01:00
Steffen Jaeckel
ea672df7a3 Put realloc logic into pem_read()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-18 23:20:01 +01:00
Steffen Jaeckel
9abf12305a Add SubjectPublicKeyInfo support to dsa_import()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-18 23:20:01 +01:00
Steffen Jaeckel
d77afd6a68 Use rsa_init() to initialize an rsa_key
(and you should do that too)

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-18 23:03:42 +01:00
Steffen Jaeckel
c9b609a0b7 Extend der_flexi_sequence_cmp()
To be able to do a bit more, add an optional handler callback function.
Additional to that, also make it possible to mark elements as optional.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-18 23:03:42 +01:00
Steffen Jaeckel
7e78899af6 Re-factor s_import_pkcs8()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-18 23:03:42 +01:00
Steffen Jaeckel
002a6c8330 Export static function as x509_import_spki()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-18 23:03:42 +01:00
Steffen Jaeckel
06b7a7e416 Extract static function as x509_get_pka()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-18 23:03:41 +01:00
Steffen Jaeckel
eda303df0f
Merge pull request #705 from libtom/new-ecc-api
New ECC API
2025-11-18 21:41:41 +01:00
Steffen Jaeckel
7f73f83853 Update docs
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-18 18:53:26 +01:00
Steffen Jaeckel
a642e69afb Update makefiles 2025-11-18 18:53:26 +01:00
Steffen Jaeckel
b46c695505 Add tests for deprecated APIs
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-18 18:53:26 +01:00
Steffen Jaeckel
35a4a5fc1b Move RFC6979 hash alg to a new ecc signature options struct
Fixes #700

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-18 18:53:26 +01:00
Steffen Jaeckel
c421e570c6
Merge pull request #704 from libtom/minor-improvements
Minor improvements
2025-11-11 09:04:01 +01:00
Steffen Jaeckel
91757cf54d Bump required CMake version & DRY
* The oldest supported Ubuntu Version is 22.04 which comes with CMake 3.22.
* Refactor demos/CMakeLists.txt to set the list of binaries only once.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:57:15 +01:00
Steffen Jaeckel
d8a62f3367 Create table of supported ECC curves programmatically
Related to #349

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:56:58 +01:00
Steffen Jaeckel
47162b9609 Add demos/der_print_flexi.c
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:56:42 +01:00
Steffen Jaeckel
e2d0935792 Add SHA3-HMAC support to PKCS#8
This also enables testing of PKCS#8 keys using modern hash algos with
LTC_EASY.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:52:38 +01:00
Steffen Jaeckel
934bd7e0fe Remove init_{GMP,LTM,TFM}()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:52:34 +01:00
Steffen Jaeckel
e0f49a924f Use LTC_TMPVAR() in more Macros.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:52:32 +01:00
Steffen Jaeckel
78e2675bfe Make store_test() a bit more aggressive.
With `LTC_FAST` enabled test to read from different offsets.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:52:29 +01:00
Steffen Jaeckel
6f085d349e Allow disabling of CLZL and CTZL builtins.
Fixes: fe8e4bf5 ("Use more builtin functions if available")
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:52:26 +01:00
Steffen Jaeckel
3c906ab3da Enable AES-NI per default on x86_64.
This can be disabled by defining `LTC_NO_AES_NI`.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:52:24 +01:00
Steffen Jaeckel
1924f43503 Fix warning uncovered by scan-build.
```
src/ciphers/aes/aesni.c:150:7: warning: Value stored to 'temp' is never read [deadcode.DeadStores]
  150 |       temp = temp_invert(rk);
      |       ^      ~~~~~~~~~~~~~~~
1 warning generated.
```

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:52:20 +01:00
Steffen Jaeckel
5dbdaff16b Minor fixes
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:52:16 +01:00
Steffen Jaeckel
ac291e8bdd Fix hmac_memory_multi() invocation
It expects a pair of type `(unsigned char*,unsigned long)` and not
`(unsigned char*,unsigned int)`.

Fixes: 46fa363f ("Finish up RFC6979 ECDSA keygen")
Reported-via: https://github.com/libtom/libtomcrypt/pull/699#issuecomment-3414862539 ff.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:52:06 +01:00
Steffen Jaeckel
c9259ffa31 Allow deprecation warnings to be disabled
One can now define them on a per-case basis to disable them.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:51:58 +01:00
Nicolas Mora
95a492a184 Make build of docs reproducible 2025-11-03 13:51:48 +01:00
Steffen Jaeckel
0c15edb22c Don't abort() in "release" builds
Change the default behavior of `LTC_ARGCHK()` for Release, resp.
Release+Shared Library builds to be non-fatal.

This closes #458

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:51:45 +01:00
Steffen Jaeckel
5e0d801c1d Clarify MPI providers a bit further
This closes #354

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:51:37 +01:00
Steffen Jaeckel
52b93bf3d1 Revert "cmake: add ccache support"
This reverts commit 93f5348c47.

You should use the CMake flag `-DCMAKE_CXX_COMPILER_LAUNCHER=ccache`
instead.

Sibling-to: https://github.com/libtom/libtommath/pull/577
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:51:29 +01:00
Steffen Jaeckel
c895dd990c Improve readability of script and the logs it creates
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:50:16 +01:00
Steffen Jaeckel
dd6ef9cdc7 Correctly treat NULL in the parameters of a SubjectPublicKeyInfo
The NULL is optional.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:50:11 +01:00
Steffen Jaeckel
eb807b84d0 Don't use written parameter of macro directly
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:50:06 +01:00
Steffen Jaeckel
2d64fc45e0 Fix curve25519 in case sha512 is not available
Before this patch it silently didn't work, now it errors out.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:49:58 +01:00
Steffen Jaeckel
8001748cd1 Improve register_{cipher,hash,prng}()
Only go once through `X_descriptor[]` when calling `register_X()`

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:49:53 +01:00
Steffen Jaeckel
4c03415dea Re-order hash registrations
... in order of likelihood of usage and/or strength.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:49:47 +01:00
Steffen Jaeckel
fc3af1e0ec A BitString of length 0 can be only 3bytes long
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-11-03 13:49:30 +01:00
Steffen Jaeckel
a3cc5bf623 Update issue template according to the new way how GH wants it.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-10-31 09:49:37 +01:00
Steffen Jaeckel
b1fa61d594
Merge pull request #698 from enginelesscc/develop
Fix build of aesni on msvc
2025-10-06 10:23:13 +02:00
Steffen Jaeckel
4d84f53ee7 Let's see if AESNI makes a difference
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-10-04 16:19:15 +02:00
Steffen Jaeckel
0aef68af83 Lets try to build with AESNI support on MSVC
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-10-04 12:12:49 +02:00
Vivyy
89b37c3606
Fix build of aesni on msvc 2025-09-20 23:43:10 +02:00
Steffen Jaeckel
5edb54e522
Merge pull request #696 from libtom/some-improvements
Some improvements
2025-09-15 15:35:47 +02:00
Steffen Jaeckel
ae50082c0f Only compute length of OID data once.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-13 12:04:42 +02:00
Steffen Jaeckel
ef1453d5ba It should be static inline
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-13 12:04:38 +02:00
Steffen Jaeckel
a58de2e03d Fix some scan-build warnings
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-13 12:04:38 +02:00
Steffen Jaeckel
f8c319ee6e Update crypt_build_settings
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-13 12:04:38 +02:00
Steffen Jaeckel
fe8e4bf547 Use more builtin functions if available
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-13 12:04:38 +02:00
Steffen Jaeckel
1978245572 Update makefiles 2025-09-13 12:04:38 +02:00
Steffen Jaeckel
bb389e2c99 Make some DER helpers private
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-13 12:04:38 +02:00
Steffen Jaeckel
18b4e3f2ef Handle long OID nodes.
This will behave differently on 32bit architectures, but since 32bit
is mostly dead and I don't see a way how to handle this w/o breaking
ABI&API, I guess we have to live with it.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-13 12:04:38 +02:00
Steffen Jaeckel
c00b006174 Make pem_read() ignore all junk before a real PEM header is found
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-12 18:25:09 +02:00
Steffen Jaeckel
78bb06c8d6 Minor cleanup
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-12 18:25:09 +02:00
Steffen Jaeckel
07d544c5d9 Add tests for & fix pk_oid API
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-12 18:25:09 +02:00
Steffen Jaeckel
fe32e7ea9d Add LTC_ARRAY_SIZE() macro
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-06 15:00:00 +02:00
Steffen Jaeckel
8d44e48d46 Be less strict in register_all_hashes()
Allow using all hashes in case we didn't register our ciphers.
Nobody should really use CHC, so we shouldn't make it mandatory.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-06 15:00:00 +02:00
Steffen Jaeckel
19a5520936 Allow base16_encode() to re-use the input buffer as output
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-06 15:00:00 +02:00
Steffen Jaeckel
72b353f3dd Workflow trigger filtering changed
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-06 15:00:00 +02:00
Steffen Jaeckel
6155a33e5f Use COMPARE_TESTVECTOR() consistently
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-06 15:00:00 +02:00
Steffen Jaeckel
cb12f2e7d0 Clarify some test descriptions
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-06 15:00:00 +02:00
Steffen Jaeckel
6fe391956d Fix/improve some install/uninstall make targets
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-06 15:00:00 +02:00
Steffen Jaeckel
87d51de391 Improve variable naming
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-06 14:59:59 +02:00
Steffen Jaeckel
563f0fb4f2
Merge pull request #524 from libtom/modes-use-ecb
Make all modes use the ECB mode API
2025-09-06 14:58:49 +02:00
Steffen Jaeckel
cd18fed7ba fix scan-build warnings 2025-09-05 18:23:26 +02:00
Steffen Jaeckel
3c42b6a668 fix timing demo 2025-09-05 17:38:30 +02:00
Steffen Jaeckel
06adf5269f refactor AEAD's and MAC's to use ECB API 2025-09-05 17:37:02 +02:00
Steffen Jaeckel
661109f660 re-factor modes to use internal ECB implementation 2025-09-05 17:37:02 +02:00
Steffen Jaeckel
23803626b6
Merge pull request #594 from orbea/shared
makefile.shared: Don't use libtool
2025-09-05 10:56:13 +02:00
orbea
d2f50cc16d makefile.shared: Don't use libtool
Gentoo Bug: https://bugs.gentoo.org/777084
2025-09-04 20:59:48 +02:00
Steffen Jaeckel
60566ebe0e
Merge pull request #477 from rmw42/feature/rfc6979
Deterministic EcDSA according to RFC6979
2025-09-04 20:59:17 +02:00
Steffen Jaeckel
46fa363f2c Finish up RFC6979 ECDSA keygen
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-04 17:36:30 +02:00
Steffen Jaeckel
d05119491b Update makefiles 2025-09-04 17:36:30 +02:00
Russ Williams
d376af52ca RFC6979: implementation, tests, docs 2025-09-04 17:36:30 +02:00
Steffen Jaeckel
f5a626f15f Let's wait a bit longer before bailing out
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-04 17:36:11 +02:00
Steffen Jaeckel
d448df1938
Merge pull request #689 from momo5502/develop
Fix CMake configure on Windows
2025-05-06 08:19:25 +02:00
Steffen Jaeckel
aeccd41afc Also run CMake build in Appveyor
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-05-05 21:17:57 +02:00
Maurice Heumann
5b93429053
Fix CMake configure on Windows 2025-05-03 10:10:40 +02:00
Steffen Jaeckel
3905c28913
Merge pull request #687 from UnknownDK/fix-flag-scopes
Fix PBES and OMAC flag scopes
2025-04-23 18:10:45 +02:00
Bjørn Højmose Grevenkop-Castenskiold
0672c6182f Fix PBES and OMAC flag scopes
pbes_properties and omac_state are gatekept by LTC_PBES and LTC_OMAC
respectively. Therefore they should only be used within those scopes.
2025-04-11 20:01:28 +02:00
Steffen Jaeckel
a6b9aff7aa
Merge pull request #450 from libtom/pr/ecdsa-der-attempt1
Fix #449 (ECDSA forcing DER/ASN.1)
2025-03-02 12:31:08 +01:00
Steffen Jaeckel
46f33c6b5d Update ecc_recover_key() docs.
This also adds a note about the potential limitation of the signature
formats, depending on the tailoring.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-03-02 12:09:24 +01:00
Steffen Jaeckel
3b7ad1b5d1 Improve ecc_recover_key()
It is already nearly independent of `LTC_DER`, so simply `#ifdef` that
code path instead of multiplying the APIs by the number of signature
formats.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-03-02 12:09:24 +01:00
Steffen Jaeckel
ecb5fdd997 Add testcase for Ethereum signatures.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-03-02 12:09:24 +01:00
Steffen Jaeckel
bdffc3d53e Update docs.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-03-02 12:09:24 +01:00
Steffen Jaeckel
47c721c164 Update doc formatting
* make PDF content copy&paste-able
* add new `\code{}` command

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-03-02 12:09:24 +01:00
Steffen Jaeckel
2e09d68712 Update makefiles 2025-03-02 12:09:24 +01:00
Steffen Jaeckel
161b3be130 There is also no private PEM API if it's disabled
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-03-02 12:09:24 +01:00
Steffen Jaeckel
77bc1a7737 allow compilation of ECC w/o DER
via e.g.

```
make -j9 EXTRALIBS="../libtommath/libtommath.a " \
	CFLAGS="-DLTC_NOTHING -DLTC_MINIMAL -DLTC_MECC -DUSE_LTM \
	-DLTM_DESC -I../libtommath"
```
2025-03-02 12:09:24 +01:00
Karel Miko
6561b37bac refactor ecc_verify_hash_ex 2025-03-02 12:09:24 +01:00
Karel Miko
0ee3bb5786 refactor ecc_sign_hash_ex 2025-03-02 12:09:24 +01:00
Steffen Jaeckel
c996610ca6
Merge pull request #685 from paperchalice/quote
Quote header list when finding bcrypt
2025-03-02 11:42:59 +01:00
paperchalice
b508028b14 Quote header list when finding bcrypt
Found try compile source is incorrect, add quote to generate correct  source file.
2025-03-01 19:49:54 +01:00
Steffen Jaeckel
5c73ba894e
Merge pull request #686 from libtom/retry-dependencies-install
Try to work around build failures
2025-03-01 19:49:39 +01:00
Steffen Jaeckel
e609a505ca Try to work around build failures
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-03-01 11:52:51 +01:00
Steffen Jaeckel
d032686639
Merge pull request #596 from libtom/amalgamation
Amalgamation
2025-02-21 12:08:14 +01:00
Steffen Jaeckel
92aef0ade1 Include the tables into the amalgamation
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-02-20 14:43:07 +01:00
Steffen Jaeckel
22e71d755b Fix return value.
Instead of wrongfully always returning OK, return the real error code.

This was uncovered by the amalgamation via the warning:

```
pre_gen/tomcrypt_amalgam.c: In function ‘der_decode_custom_type_ex’:
pre_gen/tomcrypt_amalgam.c:49820:10: warning: ‘*(unsigned int *)((char *)&ident + offsetof(ltc_asn1_list, type))’ may be used uninitialized [-Wmaybe-uninitialized]
49820 |       if ((ident.type != root->type) ||
      |          ^
pre_gen/tomcrypt_amalgam.c:49780:18: note: ‘*(unsigned int *)((char *)&ident + offsetof(ltc_asn1_list, type))’ was declared here
49780 |    ltc_asn1_list ident;
      |                  ^~~~~
```

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-02-20 14:43:07 +01:00
Steffen Jaeckel
00f662da80 Fix compiler warning
```
pre_gen/tomcrypt_amalgam.c: In function ‘pkcs_1_oaep_encode’:
pre_gen/tomcrypt_amalgam.c:64485:18: warning: ‘DB’ may be used uninitialized [-Wmaybe-uninitialized]
64485 |       if ((err = hash_memory(lparam_hash_used, DB, 0, DB, &x)) != CRYPT_OK) {
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pre_gen/tomcrypt_amalgam.c:22613:5: note: by argument 2 of type ‘const unsigned char *’ to ‘hash_memory’ declared here
22613 | int hash_memory(int hash, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen)
      |     ^~~~~~~~~~~
```

Use `out` instead of `DB`, since `out` is `LTC_ARGCHK`'ed.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-02-20 14:43:07 +01:00
Steffen Jaeckel
647b340ec3 Use LTC_NULL with ssh_decode_sequence_multi()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-02-20 14:43:07 +01:00
Steffen Jaeckel
08b69be797 minor changes for amalgamation
* de-duplicate `struct oid_to_pbes`
* add makefile target
* add amalgamation to release
* fix `small` demo
* add header guards for `tomcrypt_private.h`
* update docs
* add CI job with amalgamated library

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-02-20 14:43:06 +01:00
Steffen Jaeckel
236477823a prefix the MPI related macros with ltc_
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-02-20 14:41:50 +01:00
Steffen Jaeckel
3cc754610d undef Macros after usage & rename duplicate symbols
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-02-20 14:41:50 +01:00
Steffen Jaeckel
ac2c11aa17
Merge pull request #683 from libtom/some-improvements
Some improvements
2025-02-20 14:41:11 +01:00
Richard Levitte
894f33b81c Add contrib/libtomcrypt.cmake, and write about it in doc/crypt.tex
contrib/libtomcrypt.cmake is a snippet that can be used by any CMake
based project that wants to link with libtomcrypt, no matter if it
was installed with libtomcrypt-config.cmake or libtomcrypt.pc.

Fixes #681
2025-02-18 21:27:38 +01:00
Steffen Jaeckel
cda7d42647 Improve ILP32 detection
This should fix https://github.com/DCIT/perl-CryptX/issues/117

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-02-17 15:12:53 +01:00
Steffen Jaeckel
b4d41d53bb Ubuntu-20.04 is no longer
https://github.com/actions/runner-images/issues/11101

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-02-17 15:08:44 +01:00
Steffen Jaeckel
c93cc120f0 LTC_SOURCE ceased to exist
f55039bfeb removed all usage of
`LTC_SOURCE`, but I missed to remove it from the makefiles etc.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-02-17 15:05:01 +01:00
Steffen Jaeckel
54f0456559
Merge pull request #682 from paperchalice/cmake
Check BCryptGenRandom correctly
2025-01-29 17:13:55 +01:00
paperchalice
ae7f26ed44 Check BCryptGenRandom correctly 2025-01-29 19:05:43 +08:00
Steffen Jaeckel
427e0551c0
Merge pull request #680 from levitte/tomcrypt_private-stdarg 2025-01-21 09:35:06 +01:00
Richard Levitte
2fd160eae9 Have src/headers/tomcrypt_private.h include stdarg.h
This ensures that va_list, which is used in that file, gets properly
declared.

As a consequence, the following pattern in other files can be reduced:

    #include "tomcrypt_private.h"
    #include <stdarg.h>

Fixes #679
2025-01-21 07:18:45 +01:00
Steffen Jaeckel
2e9f2b5e44
Merge pull request #319 from libtom/add/SIV
Add SIV
2025-01-09 13:36:02 +01:00
Steffen Jaeckel
ad2696f24f Update SIV a bit
* Rename `siv_{en,de}crypt()` to `siv_{en,de}crypt_memory()`.
* The number of AAD components per SIV operation must not exceed 126.
* Init OMAC only once per SIV operation.
  All OMAC operations start off with the same key. Instead of
  re-initializing the OMAC context for each operation, init once and
  store the context.
* Add SIV to timing demo.
* Add 1000-times-encrypt-then-decrypt test for SIV.
* Update docs.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-01-01 17:05:36 +01:00
Steffen Jaeckel
8bdc093fae Add omac_vprocess()
As a new private API.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-12-28 19:11:32 +01:00
Steffen Jaeckel
197be81918 Re-factor SIV and add siv_memory()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-12-19 16:17:34 +01:00
Steffen Jaeckel
f4df47b59b Update makefiles
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-12-17 18:24:26 +01:00
Steffen Jaeckel
faa8cd71e5 add SIV
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-12-17 18:24:26 +01:00
Steffen Jaeckel
c900951dab Fix c&p error [skip-ci]
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-12-17 18:24:16 +01:00
Steffen Jaeckel
a81dab9970
Merge pull request #678 from libtom/some-improvements 2024-12-11 18:24:46 +01:00
Steffen Jaeckel
f6e71dfced Remove even more footers
Fixes 2400883060

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-12-11 12:10:02 +01:00
Steffen Jaeckel
87ff205c8b Handle potential pkg-config failures
There are cases where we want to use an MPI provider, but the package is
not installed in the system, so `pkg-config` can't find it.
To solve this simply ignore the errors created and only print something
if the user asks us to by passing `V=1`.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-12-11 11:57:08 +01:00
Steffen Jaeckel
54a16fb672 There are no broken demos anymore
... at least at compile time.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-12-11 11:09:58 +01:00
Steffen Jaeckel
795e8e8cfe Re-work some of the demos
* Add at least a `-h` option, sometimes more.
* Fix the exit codes of some of them.
* Make them all compile with `LTC_EASY`.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-12-11 11:09:58 +01:00
Steffen Jaeckel
d96605b4b9 Fix build on x32
* `CONSTPTR()` must be 32bit.
* `CRYPT_HASH_OVERFLOW` test operates on `unsigned long`, which is only
  32bit wide on x32.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-12-11 11:09:58 +01:00
Steffen Jaeckel
e487f8400e Introduce CRYPT_ERR_NUM and build-time check err_2_str[] size
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-12-11 11:09:58 +01:00
Steffen Jaeckel
507c66827f
Merge pull request #677 from libtom/some-improvements
Some improvements
2024-12-05 18:34:05 +01:00
Steffen Jaeckel
88dcebdbf5 Rework demos building and installation
* add `ltc` wrapper script for installed demos
* rework demos/CMakeLists.txt and add some more bells and whistles
* prefix installed demos with `ltc-`

Currently this makes the standard makefiles and CMake results diverge, but
we can fix that later if required.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-12-05 17:23:12 +01:00
Steffen Jaeckel
a9bb1c1525 Use cmake-format to format CMake files
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-12-03 19:51:26 +01:00
Steffen Jaeckel
98415b8a38 Change ltcrypt back to crypt
This reverts 85dc39483f

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-12-03 19:51:22 +01:00
Steffen Jaeckel
9eef89c5a4 Cancel running GH action on update of PR branch
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-12-03 19:48:18 +01:00
Steffen Jaeckel
dc945f9697 Add LTC_PTHREAD to pkg-config file if enabled at build time
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-11-20 13:11:59 +01:00
Steffen Jaeckel
2400883060 Remove remaining footers
Fixes 24765c30c5

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-11-20 12:59:49 +01:00
Richard Levitte
6659f36ad6 Align demo/CMakeLists.txt a bit more with with makefile_include.mk
Now, they build the same executables.
2024-11-20 12:59:45 +01:00
Steffen Jaeckel
17642547e4
Merge pull request #676 from hughsie/hughsie/sbom
Add a SBOM file in CycloneDX format
2024-11-19 14:39:57 +01:00
Richard Hughes
55441f12d2
Add a SBOM file in CycloneDX format
Improve supply chain security by including a SBOM file with substituted values.

This will be used to construct a composite platform SBOM.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2024-11-19 12:28:13 +00:00
Steffen Jaeckel
5d2b15472f
Merge pull request #667 from levitte/constify-math
Constify math descriptors
2024-11-09 09:56:08 +01:00
Steffen Jaeckel
1d07689581 Remove unnecessary casts in the tests
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-11-08 17:15:39 +01:00
Richard Levitte
1e31c38e61 Remove unnecessary casts in the demos 2024-11-08 17:15:39 +01:00
Richard Levitte
4b3c98a4e6 Remove unnecessary casts in the misc implementations 2024-11-08 17:15:39 +01:00
Richard Levitte
b98ef26112 Remove unnecessary casts in the Sober128 implementation 2024-11-08 17:15:39 +01:00
Richard Levitte
fc32d77845 Remove unnecessary casts in the ECC implementation 2024-11-08 17:15:39 +01:00
Richard Levitte
477d09fd01 Remove unnecessary casts in the DSA implementation 2024-11-08 17:15:39 +01:00
Richard Levitte
7d3e6b7066 Remove unnecessary casts in the RSA implementation 2024-11-08 17:15:39 +01:00
Richard Levitte
e95069924a src/math/tfm_desc.c: Compensate for TFM before 0.14.0 (yet to be released)
TFM is notorious for not having a properly constified API.  This is to appear
in its next release, which is tentatively set to 0.14.0.
2024-11-08 17:15:39 +01:00
Richard Levitte
88315ff8df Constify all the functions in ltc_math_descriptor appropriately
This includes amending the documentation in doc/crypt.tex
This also includes removing unnecessary casts in src/math/*.c
2024-11-08 17:15:39 +01:00
Steffen Jaeckel
2dd6690edf
Merge pull request #674 from cmorty/pem_decode_filehandle
Add missing ifndef LTC_NO_FILE
2024-11-07 10:46:30 +01:00
Moritz Strübe
89d73ac405 Add missing ifndef LTC_NO_FILE
pem_decode_filehandle is deactiveted in the header, but not the module.
2024-11-06 15:35:29 +00:00
Steffen Jaeckel
d34f2130a6
Merge pull request #673 from cmorty/ltc_lrw_mode-macro
Add missing LTC_ prefix to LTC_LRW_MODE macro
2024-11-06 00:07:28 +01:00
Moritz Strübe
8daa79f85b Add missing LTC_ prefix to LTC_LRW_MODE macro
This also fixes the implicit declaration of function ‘gcm_gf_mult’
warning in lrw_start.c.
2024-11-04 14:36:19 +00:00
Steffen Jaeckel
cbb01b3708
Merge pull request #672 from libtom/some-fixes
Some fixes
2024-10-14 19:30:11 +02:00
Steffen Jaeckel
5a1545a8ae Ensure test buffers are always '\0' terminated
This caused spurious test failures.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-10-12 14:04:49 +02:00
Steffen Jaeckel
ebfcff3027 Fix handling of trailing spaces when decoding PEM files
Reported via [0].

[0] https://github.com/DCIT/perl-CryptX/issues/110#issuecomment-2407279713

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-10-12 14:04:49 +02:00
Steffen Jaeckel
31a48d06bf Const arrays should be const
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-10-12 14:04:49 +02:00
Steffen Jaeckel
c1437deec2 Fix hang when decoding PEM
Reported via [0]

[0] https://github.com/DCIT/perl-CryptX/issues/110#issue-2533207989

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-10-12 14:04:33 +02:00
Steffen Jaeckel
29af8922b6
Merge pull request #670 from libtom/fix-669
Fix type in PEM+SSH decoder
2024-10-07 12:42:12 +02:00
Steffen Jaeckel
3df7a96258 Fix type in PEM+SSH decoder
9b6bf32f88 changed the type of the length
argument of a `LTC_SSHDATA_STRING` from `ulong32` to `unsigned long` and
usage of this wrong type survived multiple re-factors and code moves.

This fixes #669

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-10-07 12:10:40 +02:00
Steffen Jaeckel
24fc92b857
Merge pull request #668 from levitte/pem-doc-fixes
Fix PEM documentation
2024-10-06 14:41:34 +02:00
Richard Levitte
2026e2865d Fix demos/pem-info.c to properly display different CFB modes
Also, make CMake build it.
2024-09-20 13:38:26 +02:00
Richard Levitte
dd3b9e59e1 Fix PEM documentation 2024-09-20 11:24:19 +02:00
Steffen Jaeckel
e0d90c58da
Merge pull request #646 from Xartrick/patch-1
Allow 72 bytes (576 bits) keys for Blowfish
2024-09-14 11:28:07 +02:00
Steffen Jaeckel
5f4ddc8d13 Update notes/cipher_tv.txt
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-09-14 10:33:04 +02:00
Xartrick
556c3222f2 Allow 72 bytes (576 bits) keys for Blowfish 2024-09-14 10:20:54 +02:00
Steffen Jaeckel
6865b9fc81
Merge pull request #666 from libtom/fix-aesni-in-ci
Fix AESNI build job
2024-09-03 13:03:29 +02:00
Steffen Jaeckel
dd98fcc461 Fix AESNI build job
Fixes: 33d1c814 ("Improve SSE4.1/AES-NI support")

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-09-03 12:35:12 +02:00
Steffen Jaeckel
ce904c86ef
Merge pull request #644 from tbvdm/aesni
Improve SSE4.1/AES-NI support
2024-09-02 14:26:39 +02:00
Tim van der Molen
33d1c81485 Improve SSE4.1/AES-NI support 2024-09-02 13:54:35 +02:00
Steffen Jaeckel
e8eb4a0312
Merge pull request #664 from libtom/pr/fix-sm4-on-cygwin
Cygwin fix for SM4 (issue #663)
2024-09-02 08:54:16 +02:00
Karel Miko
24e31ef373 Cygwin fix for SM4 (issue #663) 2024-09-01 18:59:41 +02:00
Steffen Jaeckel
fc6b42025b
Merge pull request #665 from libtom/pr/fix-anon-union
avoid using anonymous union (issue #662)
2024-09-01 17:28:56 +02:00
Karel Miko
d85a4e05e7 avoid using anonymous union (issue #662) 2024-09-01 12:59:32 +02:00
Steffen Jaeckel
ab16280bf1
Merge pull request #657 from levitte/ChaoWeiAtGit/develop
Add SM4 block cipher [reboot]
2024-08-31 15:13:06 +02:00
Chao Wei
6f15a45adc Add SM4 block cipher
SM4 (formerly SMS4)[1] is a block cipher used in the Chinese
National Standard for Wireless LAN WAPI (Wired Authentication
and Privacy Infrastructure).
--from wikipedia
2024-08-30 05:30:48 +02:00
Steffen Jaeckel
12bf723b74
Merge pull request #661 from libtom/fix-ccm
Fix compiler warning
2024-08-29 22:37:17 +02:00
Steffen Jaeckel
349d56e38c Fix compiler warning
Repeated from 97edea362a

```
src/encauth/ccm/ccm_add_nonce.c: In function ‘ccm_add_nonce’:
src/encauth/ccm/ccm_add_nonce.c:61:21: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
   61 |       ccm->PAD[x++] = (unsigned char)((len >> 24) & 255);
      |       ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/headers/tomcrypt.h:82,
                 from ./src/headers/tomcrypt_private.h:4,
                 from src/encauth/ccm/ccm_add_nonce.c:3:
./src/headers/tomcrypt_mac.h:410:24: note: at offset 16 into destination object ‘PAD’ of size 16
  410 |    unsigned char       PAD[16],              /* flags | Nonce N | l(m) */
```

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-28 08:47:34 +02:00
Steffen Jaeckel
c4b423f809
Merge pull request #660 from levitte/no-BCryptGenRandom
Make the definition of LTC_WIN32_BCRYPT private
2024-08-26 14:49:35 +02:00
Richard Levitte
00708c8837 Make the definition of LTC_WIN32_BCRYPT private
1. It's internal anyway, so doesn't quite need to be reflected in a
   public header file.
2. This makes it easy for someone build this library to choose not
   to use BCryptGenRandom() by simply definining LTC_NO_WIN32_BCRYPT,
   which was hard to reflect in an unmodified public header file.

Alternative to #653
2024-08-22 09:36:38 +02:00
Steffen Jaeckel
427ce3315e
Merge pull request #659 from levitte/cmake-build-tv_gen
With CMake, build demos/tv_gen as well
2024-08-20 14:36:09 +02:00
Richard Levitte
ba132eb4a7 With CMake, build demos/tv_gen as well 2024-08-20 14:35:58 +02:00
Steffen Jaeckel
e75c563d1d
Merge pull request #658 from levitte/fix-cipher_hash_test.c
fix: tests/cipher_hash_test.c failed to use aes_enc_test
2024-08-20 14:35:34 +02:00
Richard Levitte
6170ba5205 fix: tests/cipher_hash_test.c failed to use aes_enc_test
Depending on build circumstances, the AES test function is either
aes_test() or aes_enc_test().
2024-08-20 14:35:16 +02:00
Steffen Jaeckel
668bd74b93
Merge pull request #587 from libtom/add-pem-support
Add PEM support
2024-08-20 14:34:57 +02:00
Steffen Jaeckel
2594f3a7d2 Update docs
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
2613264cef We can now also decrypt PEM files encrypted in CFB1 and CFB8 mode
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
cf79facfb9 Add support for CFB1 and CFB8
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
5dec1ee02d Fix make tvs, add make pr-check
Fixup of 5ad1681ccb

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
ec8ffbb5bd Update makefiles 2024-08-20 13:29:27 +02:00
Steffen Jaeckel
478f43fc56 Add support for reading authorized_keys files
This also changes the requirements when calling `ecc_find_curve()` that
the `cu` argument can be NULL.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
c0be0aa0bf Add support for more types of encrypted PEM files
1. ChaCha20, two-key 3DES and DES-X encrypted OpenSSL PEM files

2. AES-GCM and Chacha20+Poly1305 encrypted SSH keys

* OpenSSH uses a slightly different algorithm for its
  `chacha20-poly1305@openssh.com` than defined in the RFC.
  Therefore add an `openssh_compat` flag to
  `chacha20poly1305_state`.
* Add the option to give a 16byte IV and no counter, when calling
  `chacha20poly1305_memory()`
* Add support for DES-X

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
65e05bfa56 Update docs
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
95790221fb Add free() function to password_ctx
The user can now pass a `free()` function pointer that will be used to
free the memory that has been allocated by the `callback()`.
If `free()` is NULL, the library will still call `XFREE()`.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
02cb0c4957 Revert "Move password buffer into the library"
This reverts commit d840323bc1d3bc35bc72271e55ffa644f02b4582
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
9db30dfdc5 Make everything compile on MSVC
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
03515d5611 Move password buffer into the library
The design before was not completely fine. The user had to allocate the
buffer and passed ownership to the library.
As of [0] this seems to be a problem in some environments.

[0] https://github.com/libtom/libtomcrypt/pull/587#issuecomment-1765324724

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
fe3b3e627b Add generic PEM decode APIs
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
8d19047336 Add support for more PEM file types + some fixes
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
7b5d85d735 Calm old Valgrind ...
Valgrind 3.15.0 on Ubuntu 20.04 reports a false positive [0]

```
==7922== Conditional jump or move depends on uninitialised value(s)
==7922==    at 0x461F0C: s_decode_header (pem_ssh.c:316)
[...]
```

Simply suppress this false positive.

[0] https://github.com/libtom/libtomcrypt/actions/runs/6507805191/job/17676616149?pr=587

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
ca7b4ee354 Add more SSH key tests
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
928c476734 Per default support PEM line lengths up to 80 chars
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
23eb8f97bc Add support for importing PEM public keys
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Karel Miko
cda6211712 pem: support for RC5-CBC, RC5-CFB, RC5-OFB 2024-08-20 13:29:27 +02:00
Steffen Jaeckel
f6497d22ce Add support for more algos of encrypted PEM files
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
5d8658946b Refactor some of the ECC import internals
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
934abdd82f Add "Enter passphrase" support to openssh-privkey
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
9333d5c8a1 Use the public key contained within the ssh key
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
6c24c5c06d Add support for aes256-ctr encrypted SSH keys
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
661f5845fe distinguish between Ed25519 and X25519
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
39d4b089ac Update docs
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
651582254b introduce pka_key_free()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
4e46f823df clean-up a bit
* more `const` correctness
* take `LTC_NO_FILE` into account
* only declare `extern` variables where they're required
* ensure keys don't contain stale data
* ensure input arguments are valid
* add `CRYPT_PW_CTX_MISSING` error code
* fix documentation

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
5523eadc13 disable PEM support on MSVC
If someone wants to fix builds on MSVC, please step forward. Until then
the library can still be used on Windows via `mingw-gcc`.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
26fbebb9d0 add support for DH keys
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>

# Conflicts:
#	src/pk/dh/dh_import.c
#	src/pk/dh/dh_set.c
#	src/pk/dh/dh_set_pg_dhparam.c
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
87a1758f2f split-up into multiple C files
... and slightly optimize multiple things, e.g. `DEK-Info` decoding

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
3e981af4c4 also test FILE-based PEM API's
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
a76447f7aa add file-iterator to test_process_dir()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
d1e48df763 Verify that the imported keys match
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
22a952b813 add DSA support to PEM decoder
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
464c9b1986 add dsa_import_pkcs8()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
370457f405 add PEM tests
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
f036a471bd add support for regular PEM files
This adds support to decode plain and encrypted PEM files.

Either in OpenSSL specific format or PKCS#8

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
3f6f885852 re-factor PKCS#8 API a bit
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
e9f1db1742 add pkcs8_get_children()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
b8cb13f998 add LTC_OID_MAX_STRLEN
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
18baa1476c add der_flexi_sequence_cmp()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
35c306feae add pk_get_oid_from_asn1()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
69c93a82a5 rename file
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
cf71fffbd9 re-factor openssh-privkey demo into library functions
This adds two new API functions
* `pem_decode_openssh()`
* `pem_decode_openssh_filehandle()`

It also introduces the following two new types:
* a new union type `ltc_pka_key` which can hold any PKA key type.
* a `password_ctx` type with a callback to retrieve a password
  if necessary.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
a301ea1419 use updated API
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
350fbc6546 refactor & clean-up
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
e0046fbd7e add ssh private testkeys
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
2ff20d7966 add ecdsa key support
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
fec3d45adc add rsa-support
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
bee3ad2a2a add OpenSSH Private Key decryption demo
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-20 13:29:27 +02:00
Steffen Jaeckel
f27a312a6c
Merge pull request #655 from levitte/upgrade-workflows
In workflows, modernise the actions that are used
2024-08-20 08:50:38 +02:00
Richard Levitte
3cea832f5e In workflows, modernise the actions that are used
actions/checkout@v2 → actions/checkout@v4
actions/upload-artifact@v3 → actions/upload-artifact@v4

This will reduce the amount of warnings in the workflow summary.
2024-08-20 06:53:53 +02:00
Steffen Jaeckel
cacfc2dc04
Merge pull request #651 from libtom/pr/fix-warning-unusedvar-tiger
fix unused variable warning in hashes/tiger
2024-08-18 16:14:45 +02:00
Steffen Jaeckel
1405c732ee
Merge pull request #652 from libtom/pr/fix-asm-volatile
Use standard __asm__ blocks instead of asm (from CryptX PR)
2024-08-18 13:22:44 +02:00
Karel Miko
e78a7b65eb Use standard __asm__ blocks instead of asm (from CryptX PR) 2024-08-18 13:21:37 +02:00
Steffen Jaeckel
90529a2d0c Fix missing static
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-08-18 12:57:04 +02:00
Karel Miko
9bdf5794d3 fix unused variable warning in hashes/tiger 2024-08-18 12:57:04 +02:00
Steffen Jaeckel
7d4a646f50 Merge branch 'fix-b64-zero-length-array' into develop
Closes #538
2024-08-18 12:56:05 +02:00
Steffen Jaeckel
9183396b85 Avoid zero length array with LTC_BASE64_URL unset 2024-08-18 12:53:47 +02:00
Steffen Jaeckel
2302a3a897
Merge pull request #647 from etienne-lms/xcalloc
fix XCALLOC() against GCC 14 -Wcalloc-transposed-args
2024-06-26 19:59:31 +02:00
Etienne Carriere
9c1e83b51b fix XCALLOC() against GCC 14 -Wcalloc-transposed-args
Fix use of XCALLOC() macro against GCC 14 directive
-Wcalloc-transposed-args that makes GCC to complain with an warning/error
trace message like the below when 1st argument is given by sizeof().

warning: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args]

No functional changes.

Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
2024-06-25 17:28:16 +02:00
Steffen Jaeckel
f7e6519fae
Merge pull request #636 from libtom/update-fortuna
Update fortuna
2024-02-26 17:02:46 +01:00
Steffen Jaeckel
0e12dbd964 Update AES integration of fortuna
* Use `aes_` based API instead of `rijndael_`, so we can profit from
  a potential hardware accelerated version of AES.
* Add option to use 'encrypt_only' variant of AES inside fortuna

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-02-26 16:25:17 +01:00
Steffen Jaeckel
090f52755c Add aes_enc_test()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-02-26 16:25:17 +01:00
Steffen Jaeckel
86fe3b91f1
Merge pull request #640 from libtom/extend-tiger
Extend tiger
2024-02-26 16:22:59 +01:00
Steffen Jaeckel
5ad1681ccb Add new make target tvs
To simplify generating the necessary testvectors when adding a new
algorithm.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-02-26 15:53:17 +01:00
Steffen Jaeckel
8be96ac2f6 Update docs
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-02-26 15:51:54 +01:00
Steffen Jaeckel
d11758e700 Add support for Tiger2
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-02-26 15:51:54 +01:00
Steffen Jaeckel
c272d2264c Add support for Tiger with more than 3 passes
This fixes #632

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-02-26 10:16:49 +01:00
Steffen Jaeckel
1777e6d5c3 Fix potential memory leak
Fixup of 97edea362a

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-02-25 23:55:53 +01:00
Steffen Jaeckel
7e863d2142
Merge pull request #612 from libtom/rsaaes_oaep_hashes
add possibility to use different hash algorithms in RSAES-OAEP
2023-10-09 14:38:14 +02:00
Steffen Jaeckel
63091c9e5c Add possibility to use different hash algorithms in RSAES-OAEP
The hash algorithms used in the MGF and to create the hash of the Label
must not forcibly be the same. This change allows to use different
algorithms.

Unfortunately this breaks the API if you use one of:
* `rsa_decrypt_key_ex()`
* `rsa_encrypt_key_ex()`
* `pkcs_1_oaep_decode()`
* `pkcs_1_oaep_encode()`

The `rsa_decrypt_key()` and `rsa_encrypt_key()` macros are still the same.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-10-09 12:26:21 +02:00
Steffen Jaeckel
91b7bbe4c1
Merge pull request #633 from libtom/some-fixes
Fix AES-NI and other minor stuff
2023-10-08 23:04:26 +02:00
Steffen Jaeckel
e4adaafd90 Fix make incompatibility
Since make version 4.3 [0] the `#` sign inside a string is handled
differently. Fix that.

[0] https://lists.gnu.org/archive/html/info-gnu/2020-01/msg00004.html

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-10-05 12:34:33 +02:00
Steffen Jaeckel
124e020437 Add missing package name suffix to CMake/CPack
Fixes e98e0a64e6

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-10-05 11:14:46 +02:00
Steffen Jaeckel
d9b25936fb Fix CMake with MSVC
Reported by @pineappleiceberg in [0]

[0] https://github.com/libtom/libtomcrypt/issues/577#issuecomment-1722545061

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-10-05 11:14:46 +02:00
Steffen Jaeckel
97edea362a Fix compiler warning
```
src/encauth/ccm/ccm_memory.c: In function ‘ccm_memory’:
src/encauth/ccm/ccm_memory.c:164:17: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  164 |        PAD[x++] = (unsigned char)((len >> 24) & 255);
      |        ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/encauth/ccm/ccm_memory.c:43:19: note: at offset 16 into destination object ‘PAD’ of size 16
   43 |    unsigned char  PAD[16], ctr[16], CTRPAD[16], ptTag[16], b, *pt_real;
      |                   ^~~
```

Multiple reviews and tests determined that this can't happen, but most
likely computers are better in finding out such stuff (or it was a false
positive).

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-10-05 11:14:46 +02:00
Steffen Jaeckel
7aaa8ebe19 Re-order struct members
In order to memory-align the used buffers for keys, IVs etc. we re-order
the struct members of ciphers, modes and encauth.

There's no guarantee that this works, but it improves the chances.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-10-05 11:14:46 +02:00
Steffen Jaeckel
c48673234c Always determine manually whether CC is clang
This is required
1. when cross-compiling
2. to enable/disable the specific compiler warnings

Tested on `bash`, `dash`, `zsh` and FreeBSD `sh`.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-10-05 11:14:46 +02:00
Steffen Jaeckel
d3a297c341 Add option to disable AES-NI at compile time
One can now define `LTC_NO_AES_NI` to disable AES-NI.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-10-05 11:14:46 +02:00
Steffen Jaeckel
1c36997bd0 Ensure that AES key is always correctly aligned
Aligning a `struct` member via `attribute(align(<n>))` is not guaranteed
to work.
Change the approach to use an opaque buffer and always manually align
the start pointers of the keys.

c.f. https://github.com/DCIT/perl-CryptX/issues/95

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-10-05 11:14:46 +02:00
Steffen Jaeckel
024d8a1340 Add LTC_ALIGN_BUF()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-10-05 11:14:46 +02:00
Steffen Jaeckel
b96e96cf8b
Merge pull request #626 from libtom/some-fixes
Some fixes
2023-08-23 14:37:18 +02:00
Steffen Jaeckel
c4fd304ff4 Fix #627
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-08-07 13:06:53 +02:00
Steffen Jaeckel
dc883ea0ea Add Testcase for #627
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-08-07 13:06:53 +02:00
Steffen Jaeckel
c4d22b9046 Fix build for Windows ARM (UWP)
This fixes #576

Patch inspired by the same, but modified.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-08-07 13:06:53 +02:00
Steffen Jaeckel
bc59fb82b8 Add support for reading random data from "bcrypt" on Windows
This fixes #577

Patch inspired by the same, but simplified after reading the docs.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-08-07 13:06:53 +02:00
Steffen Jaeckel
e591a35c6a Port WinCSP usage from libtommath
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-08-07 11:37:19 +02:00
Steffen Jaeckel
5fa7837f3a Add empty stub for s_der_tests_print_flexi()
So we don't have to `#ifdef` whether it's available or not.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-08-07 11:37:19 +02:00
Steffen Jaeckel
18863a8ade Fix DER decoding of UTF-8 Strings
Don't read more than the length indicated by the length field.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-08-07 11:37:19 +02:00
Steffen Jaeckel
c939720699 Add Testcase that UTF-8 decoding respects the ASN.1 length
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-08-07 11:37:19 +02:00
Steffen Jaeckel
7a38fca62a Fix some pkg-config related things
* use a separate `libtomcrypt` folder to install the headers to
* use `INCPATH` and `LIBPATH` when installing `libtomcrypt.pc`
* fix `libtomcrypt.pc` generation for `makefile.unix`

This fixes #625

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-08-07 11:37:19 +02:00
Steffen Jaeckel
e98e0a64e6 Port CMake changes from libtommath for Debian packaging
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-08-07 11:37:19 +02:00
ycaibb
ee24a31ae1 fix missing mutex unlock
Fixes a missing mutex unlock on an out of memory error
in ltc_ecc_fp_save_state().

Originates from: 4af447d408

Fixes #571

Comment by sj:
This patch version slightly deviates from the original patch to OP-TEE
since we don't call `XFREE(NULL)` as there exist implementations of
`free()` that don't support it.

Signed-off-by: Ryan Cai <ycaibb@gmail.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Modified-by: Steffen Jaeckel <s@jaeckel.eu>
2023-08-07 11:37:19 +02:00
Steffen Jaeckel
2cb51b656c
Merge pull request #631 from ulikos/fix-630
Fixed size check in ecc_get_key, Fixes #630
2023-08-07 11:36:53 +02:00
Ulrich Koschella
48462aab40 Fixed size check in ecc_get_key, Fixes #630 2023-08-07 11:05:09 +02:00
Steffen Jaeckel
6120c82618 Add Testcase for #630
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-08-07 11:05:09 +02:00
Steffen Jaeckel
06b0f7711b
Merge pull request #629 from ulikos/fix-628
Fixed wrong sign in docu of ECC Extended Key Generation, Fixes #628
2023-08-07 07:49:23 +02:00
Ulrich Koschella
7ddd4f7de2 Fixed wrong sign in docu of ECC Extended Key Generation, Fixes #628 2023-08-03 13:03:25 +02:00
Steffen Jaeckel
1e629e6f64
Merge pull request #557 from libtom/add-aesni
Add AES-NI
2023-06-22 19:15:27 +02:00
Steffen Jaeckel
d026c63075 Update makefiles
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-06-22 18:37:25 +02:00
Steffen Jaeckel
9e0a131b2c introduce separate aes_desc
`aes_desc` and `aes_enc_desc` now do auto-detection of the best suitable
AES implementation for the platform.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-06-22 18:37:25 +02:00
Steffen Jaeckel
2314444cb0 Disable warnings from clang
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-06-22 18:37:25 +02:00
Steffen Jaeckel
37a8d7ec77 add CI testrun with AESNI
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-06-22 18:37:25 +02:00
Steffen Jaeckel
31c7f891aa add support for AES-NI instructions
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-06-22 18:37:25 +02:00
Steffen Jaeckel
0173cac3be Add LTC_TMPVAR() macro
Use unique names for variables declared in macros.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-06-21 13:23:52 +02:00
Steffen Jaeckel
93f5348c47 cmake: add ccache support
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-06-19 21:14:38 +02:00
Steffen Jaeckel
a2245e8696
Merge pull request #611 from libtom/fix-mpi-pkgconfig
update `Libs` part of pkg-config file with configured MPI providers
2023-06-19 20:56:48 +02:00
Steffen Jaeckel
4767558fd0 Add correct MPI provider defines to pkg-config cflags
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-06-19 20:24:03 +02:00
Steffen Jaeckel
3f33ccf181 cmake: Add TomsFastMath support
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-06-19 20:23:23 +02:00
Steffen Jaeckel
5330cd1d9b also update pkg-config file generated by cmake
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-06-19 19:18:28 +02:00
Steffen Jaeckel
2c3a5fd0ac update Libs part of pkg-config file with configured MPI providers
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-06-19 19:18:28 +02:00
Steffen Jaeckel
93dc29ab9a
Merge pull request #623 from libtom/update-ci
Update base OS version of CI
2023-06-19 19:17:15 +02:00
Steffen Jaeckel
90359498e1 Remove pre-installed libtommath
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-06-19 17:16:23 +02:00
Steffen Jaeckel
acec8a5c3e More error logs on CI failure
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-06-19 17:15:59 +02:00
Steffen Jaeckel
8076d86366 Fix missing include paths of ltm and tfm
Default include paths of ltm and tfm have changed.
Try to get include paths from pkg-config.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-06-19 16:44:40 +02:00
Steffen Jaeckel
e1a52a5b94 Fix Valgrind CI run when building with Clang
Clang creates now DWARFv5 debug infos which isn't supported in old Valgrind
versions. Instruct Clang to create DWARFv4 debug infos, so we can run our
tests in Valgrind.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-06-19 16:34:07 +02:00
Steffen Jaeckel
87665fb276 Calm scan-build static analyser
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-06-19 16:34:07 +02:00
Steffen Jaeckel
f0328b02c2 Update base OS version of CI
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-06-19 16:34:07 +02:00
Steffen Jaeckel
fae62af0ab
Merge pull request #613 from SOuajih/pkcs_fix
fix pkcs_1_v1_5_decode() when empty message
2023-03-31 20:55:08 +02:00
Steffen Jaeckel
6164cc1cb6 ensure that input-data pointer is non-NULL
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-03-31 14:42:50 +02:00
Steffen Jaeckel
f9c0c63433 allow input-data pointer to be NULL
If we allow the length to be 0, we should also prepare for the case where
the user doesn't want to provide a valid input-data pointer.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-03-31 14:42:50 +02:00
Safae Ouajih
caf3500288 fix pkcs_1_v1_5_decode() when empty message
In case of EME-PKCS1-v1_5 decoding, the encoded message
format is as follow : EM = 0x00 || 0x02 || PS || 0x00 || M.
When using an empty message, the 0x00 octet that separates
the padding string and message is located at the end. Thus,
update the condition to pass the check in case of empty message.

This fixes the following AOSP cts test:
Module: CtsKeystoreTestCases
Test: testEmptyPlaintextEncryptsAndDecrypts
Link: https://android.googlesource.com/platform/cts/+/refs/tags/android-cts-12.0_r6/tests/tests/keystore/src/android/keystore/cts/CipherTest.java

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
2023-03-31 14:21:01 +02:00
Steffen Jaeckel
05f94077cc fix help message of aesgcm demo
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-03-31 14:17:51 +02:00
Steffen Jaeckel
2a1b284677
Merge pull request #609 from atomicmooseca/fix-cmake
Update CMakeLists.txt
2023-01-18 19:33:50 +01:00
Steve Manley
2e24591795 Fix CMakeLists.txt which still used variables from the ltm port
It still used `LTM_{C,LD}_FLAGS` instead of `LTC_{C,LD}_FLAGS`.
2023-01-18 19:02:36 +01:00
Steffen Jaeckel
29986d04f2
Merge pull request #607 from Jinbosh8/reset-gcm-memory 2022-11-15 16:23:23 +01:00
Jin
b207b63bb3 Added gcm_reset() to gcm_memory() to avoid key leakage 2022-11-14 23:45:09 -08:00
Steffen Jaeckel
3474ca3712
Merge pull request #606 from libtom/docs-in-ci
Docs in ci
2022-10-14 12:47:50 +02:00
Steffen Jaeckel
06f22b61b5 create developer manual in CI
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-10-14 11:06:10 +02:00
Steffen Jaeckel
b073ee0c62 use correct Build Status badge in README
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-10-14 10:37:19 +02:00
Steffen Jaeckel
e8e678e101 improve MPI providers section in documentation
.. also add a checkbox regarding MPI providers to the issue template

This closes #605

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-10-12 12:06:59 +02:00
Steffen Jaeckel
e10c62ec18
Merge pull request #586 from libtom/feature/cmake-support
Feature/cmake support
2022-10-05 15:23:59 +02:00
Steffen Jaeckel
cdc1dbe6f5 port cmake integration changes from libtommath
... also enable building of tests.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-10-05 14:49:54 +02:00
Adrian Antonana
a9a010d5fc introduce initial cmake support 2022-09-13 12:29:55 +02:00
Steffen Jaeckel
e6be20bfc7
Merge pull request #601 from libtom/fix-600
remove camellia tests if `LTC_TEST` is not defined
2022-09-13 12:29:16 +02:00
Steffen Jaeckel
2fe75d31cb remove camellia tests if LTC_TEST is not defined
Fixes #600

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-09-13 11:55:20 +02:00
Steffen Jaeckel
fde3e8c10a
Merge pull request #599 from libtom/rereview-curve25519-ctx-and-ph
Re-review curve25519 ctx and ph
2022-09-13 11:50:57 +02:00
Steffen Jaeckel
1873838e96 fix incompatibility issues with LLP64 data models
This is also a fixup of a921112fe3

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-09-12 11:34:27 +02:00
Steffen Jaeckel
ca92434d9d don't overwrite arguments
There's no need to store those values first somewhere else.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-09-12 11:34:27 +02:00
Steffen Jaeckel
24275fee7e optimize stack arrays
* minimize stack usage
* no need to zero-initialize the arrays

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-09-12 11:34:27 +02:00
Steffen Jaeckel
97f78901e9 ensure that ctx is non-NULL
The code-path via the `ed25519ph_*()` APIs would have allowed to get here
and de-reference `ctx` even if it is `NULL`.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-09-12 11:34:27 +02:00
Steffen Jaeckel
e836af56c2 re-factor tweetnacl_crypto_hash[_ctx]()
@etienne-lms remarked in [0] that the stack usage could be minimized
by using `hash_memory_multi()` instead of copying the data, so let's do
that.

[0] https://github.com/OP-TEE/optee_os/pull/5486#discussion_r955095821

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-09-12 11:34:27 +02:00
Steffen Jaeckel
288088ce3f
Merge pull request #598 from libtom/improve-vararg-apis
Improve vararg apis
2022-09-12 11:34:01 +02:00
Steffen Jaeckel
1ee85a8f25 Update makefiles 2022-09-02 11:30:45 +02:00
Steffen Jaeckel
13dc1f4fa2 add test-case that uses LTC_NO_NULL_TERMINATION_CHECK
It's a compile-only test, but we run it anyways so we can finally get
`crypt_fsa()` included in the coverage report. It's not really useful but
also doesn't hurt.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-09-02 11:30:45 +02:00
Steffen Jaeckel
6ab01a8e8f fix possible UB
A user isn't guaranteed to use the `der_..._multi()` in a correct fashion.
Therefor change the pattern in the library and terminate further vararg
processing immediately after the `EOL` marker is hit.

The previous changes introducing the function-`attribute(sentinel)` would
allow detecting this, but not all compilers have support for the attribute.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-08-31 13:05:00 +02:00
Steffen Jaeckel
1c805e1c66 use LTC_NULL in the library code
`NULL` as defined by the standard is not guaranteed to be of a pointer
type. In order to make sure that in vararg API's a pointer type is used,
define our own version and use that one internally.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-08-31 13:05:00 +02:00
Steffen Jaeckel
0ad23e1b4c introduce LTC_NULL_TERMINATED function attribute
In order to be able to check at compile time whether a vararg function
is correctly NULL-terminated.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-08-31 13:05:00 +02:00
Steffen Jaeckel
ddfe2e8aa7
Merge pull request #597 from sa-kib/ed25519ctx
contextualized extension of the Ed25519 scheme
2022-08-21 11:34:22 +02:00
Steffen Jaeckel
23d7091b9f Update makefiles 2022-08-20 14:38:43 +02:00
Steffen Jaeckel
9dec999564 re-factor some parts of the Ed25519ctx and Ed25519ph implementation
* The RFC doesn't limit the context to be a string.
  It talks about `octets` which means it could be any binary data.
* Move the context-preprocessing function out of tweetnacl.c
* Fix potential segfaults when Ed25519 signature verification fails and
  `LTC_CLEAN_STACK` is enabled.
* Fix all the warnings.
* Update documentation.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-08-20 14:38:43 +02:00
Valerii Chubar
b761cc0f67 Add ed25519ctx and ed25519ph support
Signed-off-by: Valerii Chubar <valerii_chubar@epam.com>
Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
2022-08-20 14:38:43 +02:00
Valerii Chubar
a6c6492139 ed25519: Add testcase for segfault on verify
In case when the signature is not verified the "mlen" variable
is equal to ULONG_MAX. When LTC_CLEAN_STACK has been defined
this results in a segmentation fault.

Signed-off-by: Valerii Chubar <valerii_chubar@epam.com>
Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
2022-08-20 14:38:43 +02:00
Steffen Jaeckel
8fd5dad96b
Merge pull request #593 from libtom/cleanup
Cleanup
2022-07-18 10:55:46 +02:00
Steffen Jaeckel
a921112fe3 Ensure that hash overflow is detected
Previously it was not detected if `inlen` itself was too big and would
overflow the multiplication by 8.

Related to #592

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-07-16 15:09:48 +02:00
Steffen Jaeckel
bb09c272bb also build with MSVC 2019 & 2022
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-07-16 15:07:09 +02:00
Oliver Schneider
0219ace105 Spelling fix in tomcrypt_cfg.h 2022-03-18 10:43:09 +01:00
Steffen Jaeckel
038db7e03e fix sporadically failing tests when built with pthreads support
... I hope ... :)

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-03-17 15:08:39 +01:00
Steffen Jaeckel
2c51ae81ac make sure to check yarrow_read() return values
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-03-17 15:08:37 +01:00
Steffen Jaeckel
69843a4807 pack up failed build to be able to investigate
Sometimes it's hard to reproduce an issue as they happen on CI, so let's
pack-up what we can on failure and upload it as artifact.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-03-17 15:08:32 +01:00
Steffen Jaeckel
6552fbcfe2 add hash Id to docs 2022-03-17 14:26:44 +01:00
Steffen Jaeckel
06a81aeb22
Merge pull request #584 from libtom/cleanup
Clean-up & minor improvements
2022-03-16 20:52:33 +01:00
Steffen Jaeckel
c8e49539e6 add cipher Id to docs
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-02-11 16:12:27 +01:00
Steffen Jaeckel
31ab638fb6 silence valgrind
When compiling with clang (9-12) and then running the tests in
valgrind (I tested 3.13.0 and 3.15.0) the following error was created:

```
Conditional jump or move depends on uninitialised value(s)
   at 0x47761F: ecc_ssh_ecdsa_encode_name (ecc_ssh_ecdsa_encode_name.c:38)
   ...
Uninitialised value was created by a stack allocation
   at 0x477570: ecc_ssh_ecdsa_encode_name (ecc_ssh_ecdsa_encode_name.c:21)
```

This silences this error by initialising the stack-array on creation.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-02-11 16:12:27 +01:00
Steffen Jaeckel
7a8496df5c better debug output
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-02-11 16:12:27 +01:00
Steffen Jaeckel
cf58641c99 migrate from travis CI to GitHub actions
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-02-11 16:12:27 +01:00
Steffen Jaeckel
5c30a53074 improve pk_oid_num_to_str()
* allow `OID` to be `NULL` until you want to write it ...
* make sure we don't overflow the `int i`

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-02-11 16:12:27 +01:00
Steffen Jaeckel
1052703116 fix/improve DER tests
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-02-11 16:12:27 +01:00
Steffen Jaeckel
c2f6c403fe prevent UB
This prevents incrementing `adata`, which can be a NULL pointer at this
point.

Fixes #583

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-02-11 16:12:27 +01:00
Steffen Jaeckel
4a1477e289 add (private) rsa_import_pkcs1()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-02-11 16:12:27 +01:00
Steffen Jaeckel
3bf3dffabc signal a potential overflow when decoding a LTC_ASN1_SHORT_INTEGER
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-02-11 16:12:27 +01:00
Steffen Jaeckel
8899c81601 continue looping on NOP
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-02-11 16:12:27 +01:00
Steffen Jaeckel
ec27d57548 slightly improve base64 encoding
* ensure base64 encode in&out buffers aren't the same
* allow calling any of the encode functions with `out` being a
  NULL-pointer, to be able to determine the size for storing
  the output.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-02-11 16:12:27 +01:00
Steffen Jaeckel
a24af5f7e1 correctly prefix enum ltc_oid_id members
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-02-11 16:12:27 +01:00
Steffen Jaeckel
0bfa7d0e1e add base64_encode_pem()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-02-10 16:15:14 +01:00
Steffen Jaeckel
1aac5b322a fix typo
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-02-10 16:15:14 +01:00
Steffen Jaeckel
b39c46f817 re-order code a bit
... so only relevant parts are executed

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-02-10 16:15:14 +01:00
Steffen Jaeckel
11590de241 add SSH-style padding
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-02-10 16:15:14 +01:00
Steffen Jaeckel
cee9569fdd annotate some and fix un-aligned #endif
This fixes #572

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2022-02-10 16:15:14 +01:00
Steffen Jaeckel
673f5ce290
Merge pull request #569 from cneveux/rsa_public_exponent
rsa: add rsa key generate with bignumber public exponent
2021-06-04 18:51:41 +02:00
Cedric Neveux
75cfdaa490 documentation: add new rsa generate key API
Add rsa_make_key_ubin_e api documentation.

Signed-off-by: Cedric Neveux <cedric.neveux@nxp.com>
2021-06-04 08:05:58 +02:00
Cedric Neveux
d6bc30e8b8 test: add test rsa key generate with public exponent upto 256 bits
Add a RSA test generating a RSA key with a 256 bits public exponent.

Signed-off-by: Cedric Neveux <cedric.neveux@nxp.com>
2021-06-04 08:05:58 +02:00
Cedric Neveux
49556a8e60 rsa: add rsa key generate with public exponent upto 256 bits
Function rsa_make_key() limits the RSA key generates to a public
exponent of type long (32 bits or 64 bits).
RSA standard specify that public exponent e can be between 65537 (included)
and 2^256 (excluded).

Add function rsa_make_key_ubin_e to use a hexadecimal public exponent.
Add function rsa_make_key_bn_e to use a bignumber public exponent
(op-tee).

Signed-off-by: Cedric Neveux <cedric.neveux@nxp.com>
2021-06-04 08:05:58 +02:00
Steffen Jaeckel
165c795b65
Merge pull request #546 from libtom/fix-dsa-sha-dependency
fix DSA dependency to SHA2
2021-04-14 15:52:41 +02:00
Karel Miko
9a07c425bd DSA gen params: fixed check group_size vs LTC_MDSA_MAX_GROUP, updated LTC_MDSA_DELTA, new LTC_MDSA_MAX_MODULUS 2021-04-14 12:10:45 +02:00
Steffen Jaeckel
4bcb2c1873 don't undermine hash-registry concept
This allows registering an own implementation with a different
descriptor name.
2021-04-14 12:07:03 +02:00
Steffen Jaeckel
32d650807c use sha3 if available 2021-04-14 12:07:03 +02:00
Steffen Jaeckel
96c72ec31e fix dependency to sha2
DSA had a hard dependency to the basic sha2 operations.
In case one wanted to compile e.g. only with sha256 this lead to a
compilation error.
2021-04-14 12:07:03 +02:00
Steffen Jaeckel
077f4d6367
Merge pull request #567 from dcantrell/develop
m68k platforms are big endian
2021-04-11 21:01:42 +02:00
David Cantrell
112c32d756 m68k platforms are big endian
The endianness fallback in tomcrypt_cfg.h lacked a check for the gcc
define for m68k.  I discovered this while building dropbear on A/UX
3.1.1 on a Macintosh Quadra 700 (yes, in 2021).  Adding the check for
the gcc __m68k__ define gets everything building.

Signed-off-by: David Cantrell <david.l.cantrell@gmail.com>
2021-04-11 12:21:42 -04:00
Steffen Jaeckel
d34c440421
Merge pull request #560 from libtom/cleanup-and-fixes
Cleanup and fixes
2021-04-10 15:16:55 +02:00
Steffen Jaeckel
c117cd8a85 add comment indicating supported platforms of makefile.shared 2021-04-10 13:02:39 +02:00
Karel Miko
5329bdc5fb missing endif 2021-04-10 13:02:39 +02:00
Steffen Jaeckel
2a6e57fc2f fix unbalanced #ifdef for MIPS R5900
This fixes #562

[skip ci]
2021-04-10 13:02:39 +02:00
Steffen Jaeckel
2bee98076f cast away cast-align warnings 2021-04-10 13:02:39 +02:00
Steffen Jaeckel
9616356abe review CCM
* improve some comments
* harden some arguments
* fix the overflow warning

fixes #555, fixes #544
2021-04-10 13:02:39 +02:00
Steffen Jaeckel
ea7d8eb541 make sure that CTR->pad[] is aligned to 16 bytes
Fixes #549
2021-04-10 13:02:39 +02:00
Steffen Jaeckel
8f36c37acb clarify LTC_PAD_PKCS7 2021-04-10 13:02:39 +02:00
Steffen Jaeckel
748994c55f add LTC_ALIGN() macro 2021-04-10 13:02:39 +02:00
Steffen Jaeckel
5bc034ff55 re-factor some tests 2021-04-10 13:02:39 +02:00
Steffen Jaeckel
ddf1b63ac2
Merge pull request #565 from libtom/fix-cryptx69
make sure basic types are marked as UNIVERSAL&PRIMITIVE
2021-04-10 13:02:19 +02:00
Steffen Jaeckel
df6e14a9cb make sure basic types are marked as UNIVERSAL&PRIMITIVE
This fixes DCIT/perl-CryptX#69
2021-04-09 12:48:17 +02:00
Steffen Jaeckel
ae87fca70a
Merge pull request #564 from Biswa96/develop
Makefile: Fix shared library build in MinGW.
2021-04-09 12:30:37 +02:00
Biswapriyo Nath
e86dbc4591
Makefile: Fix shared library build in MinGW.
This enables -no-undefined linker flag in mingw toolchain.
Previous related commit 9c2c9f8af4
2021-03-28 22:06:52 +05:30
Steffen Jaeckel
910d625277
Merge pull request #558 from jamuir/develop
Add new utf8 test-vector, update comments explaining utf8 decoding
2021-01-19 13:51:22 +01:00
James Muir
2092250088 Add new utf8 test-vector, update comments explaining utf8 decoding
Description:
Minor changes to help test and clarify the way utf8 strings are
decoded.  This originated from my misunderstanding of the fix for
issue #507.  The new test-vector uses two bytes to encode each
wide-char.

The utf8 format is described here:

  https://tools.ietf.org/html/rfc3629#section-3

Testing:

  $ make clean
  $ make CFLAGS="-DUSE_LTM -DLTM_DESC -I../libtommath" EXTRALIBS="../libtommath/libtommath.a" test
  $ ./test

You can confirm that the new utf8 test data is correct using python:

  >>> s="\xD7\xA9\xD7\x9C\xD7\x95\xD7\x9D"
  >>> s.decode("utf-8")
  u'\u05e9\u05dc\u05d5\u05dd'
2021-01-15 20:55:09 -05:00
Steffen Jaeckel
954ab9bcfc
Merge pull request #550 from libtom/clean-up-stuff
Patch & clean up
2020-12-21 19:34:39 +01:00
Steffen Jaeckel
6b12bc5bd8 don't allow LTC_CLEAN_STACK to be enabled until fixed
As discussed in issue #486 [1] the current behavior shouldn't be used
anymore.

[1] https://github.com/libtom/libtomcrypt/issues/486
2020-12-21 13:53:36 +01:00
Steffen Jaeckel
53b0f1e30f update TEA testvectors 2020-12-21 13:53:36 +01:00
Steffen Jaeckel
3ec7f71f4f fix tea_ecb_encrypt()
This fixes #553
2020-12-21 13:53:36 +01:00
Steffen Jaeckel
77a932cb07 fix tea_test() 2020-12-21 13:53:36 +01:00
Steffen Jaeckel
11978c16d7 make sure PKCS#5 iteration count is a "positive integer"
This fixes #552
2020-12-21 13:53:36 +01:00
Steffen Jaeckel
c549f0fb3b add check maketarget 2020-12-21 13:53:36 +01:00
Steffen Jaeckel
f8393fd7c2 Exclude tests/test.key from potential crlf conversion
This closes #521
2020-12-21 13:53:36 +01:00
Steffen Jaeckel
8f12addd0f add comment about padding types 2020-12-21 13:53:36 +01:00
Steffen Jaeckel
7d57bae82c read system timer on AARCH64 2020-12-21 13:53:36 +01:00
Steffen Jaeckel
98dd1df545 recent aesgcm versions have shorter iv/key strings 2020-12-21 13:53:36 +01:00
Steffen Jaeckel
696e781d41 Fix returning too many or too few bits
original patch by @friedrichsenm

This closes #543
2020-12-21 13:53:36 +01:00
Steffen Jaeckel
b3305b05e7
Merge pull request #556 from timgates42/bugfix_typo_success
docs: fix simple typo, succes -> success
2020-12-21 11:16:09 +01:00
Tim Gates
59d8741d65
docs: fix simple typo, succes -> success
There is a small typo in src/mac/f9/f9_test.c, src/mac/xcbc/xcbc_test.c.

Should read `success` rather than `succes`.
2020-12-08 21:44:22 +11:00
Steffen Jaeckel
cfbd7f8d36
Merge pull request #545 from libtom/pattop/fixes
Minor fix & cleanup
2020-08-29 11:30:23 +02:00
Patrick Oppenlander
d63d6faf22 sha256: minor undef cleanup
RND is #defined in both the #if and #else case, so move the #undef after
the #endif.
2020-08-17 09:54:14 +10:00
Patrick Oppenlander
40b9560521 HASH_PROCESS: fix overflow test
state_var.length counts bits, inlen is in bytes.
2020-08-17 09:44:21 +10:00
Steffen Jaeckel
3f1b6877c0
Merge pull request #541 from pattop/fixes
Minor dependency cleanups
2020-08-16 15:13:27 +02:00
Steffen Jaeckel
93ae347132 prevent usage of ifdef in code 2020-08-14 00:49:44 +02:00
Patrick Oppenlander
78f94225c8 error on missing dependencies for LTC_PBES and LTC_PKCS_5 2020-08-13 23:37:16 +02:00
Patrick Oppenlander
3a775da837 support compilation of x509 without LTC_MECC 2020-08-13 23:37:16 +02:00
Patrick Oppenlander
a5765d2b61 make ecc_ssh_ecdsa_encode_name conditional on LTC_SSH
This fixes build breakage when LTC_MECC is not defined:

src/pk/ecc/ecc_ssh_ecdsa_encode_name.c:20:74: error: unknown type name 'ecc_key'
   20 | int ecc_ssh_ecdsa_encode_name(char *buffer, unsigned long *buflen, const ecc_key *key)
2020-08-13 23:37:16 +02:00
Steffen Jaeckel
40eea675cd
Merge pull request #534 from libtom/pr/macro-names-cleanup
Clean up macro names and static functions
2020-08-03 14:01:42 +02:00
Steffen Jaeckel
469eeaf632 prefix static function in multi2 with s_
This fixes #540
2020-07-16 11:03:40 +02:00
Steffen Jaeckel
c5d7bfb2cc manually fix the remaining leading _'s 2020-07-16 10:38:33 +02:00
Steffen Jaeckel
373974edee Revert "rename according to currently still valid rules"
This reverts commit 561d4ab8e8.
2020-07-16 10:38:33 +02:00
Steffen Jaeckel
3447eaff53 also prefix static hash functions by s_ 2020-07-16 10:38:33 +02:00
Steffen Jaeckel
4fd7b5002d prefix static functions with s_ 2020-07-14 18:44:40 +02:00
Karel Miko
cb63d3c074 Fix macro names - related to #448 2020-07-14 18:44:38 +02:00
Karel Miko
89d991e946 add macro name check to helper.pl 2020-07-14 18:44:23 +02:00
Steffen Jaeckel
d8d7a83b34
Merge pull request #539 from libtom/relicense
Relicense
2020-07-14 18:42:24 +02:00
Steffen Jaeckel
3630bee6fc update LICENSE file 2020-07-14 18:41:30 +02:00
Steffen Jaeckel
9824af8e3b update header 2020-07-14 18:41:30 +02:00
Steffen Jaeckel
24765c30c5 remove footer 2020-07-14 18:41:29 +02:00
Steffen Jaeckel
6b85be4095
Merge pull request #533 from libtom/fix-373
really implement DER decoding resursion limit
2020-07-14 18:40:46 +02:00
Steffen Jaeckel
561d4ab8e8 rename according to currently still valid rules 2020-06-20 12:43:08 +02:00
Steffen Jaeckel
cac400cf79 really implement DER decoding resursion limit
PR #373 did not really fix the issue of preventing a potential stack
overflow in case a lot of nested sequences have to be decoded.
Instead it only threw an error after successfully decoding all the nested
sequences.
This change fixes this and prevents the decoding.
2020-06-20 12:28:22 +02:00
Steffen Jaeckel
14ed10c11f
Merge pull request #535 from libtom/fix-532
Add "memory" to clobber list of `STORE/LOAD32`
2020-05-08 14:01:59 +02:00
Frédéric Recoules
19c6e7942d Add "memory" to clobber list of STORE/LOAD32
c.f. cefff85550
2020-05-07 13:00:21 +02:00
Steffen Jaeckel
1937f41260
Merge pull request #523 from libtom/cleanup-hmac-state
remove unused `hashstate` from `hmac_state`
2019-11-22 12:03:27 +01:00
Steffen Jaeckel
c713e9536f remove unused hashstate from hmac_state 2019-11-22 12:02:52 +01:00
Steffen Jaeckel
193086d6eb
Merge pull request #526 from libtom/latest-ltm
allow building against latest ltm
2019-11-22 11:43:15 +01:00
Steffen Jaeckel
8842720236 allow building against latest ltm 2019-11-21 08:53:30 +01:00
Steffen Jaeckel
0c30412a66
Merge pull request #503 from libtom/fix-502
Replace (ed|x)25519_set_key by (ed|x)25519_import_raw
2019-10-21 11:44:04 +02:00
Steffen Jaeckel
354c90517e
Merge pull request #514 from libtom/pr/fix-for-513
Avoid 64-bit rotation for i386 targets
2019-10-20 12:45:51 +02:00
Karel Miko
23a7ba244c Avoid 64-bit rotation for i386 targets 2019-10-20 10:06:51 +02:00
Steffen Jaeckel
2d930616e0 Update docs
[skip ci]
2019-10-19 16:30:18 +02:00
Steffen Jaeckel
461a047afd Update makefiles 2019-10-19 16:30:18 +02:00
Steffen Jaeckel
334876db78 rename x25519_set_key to x25519_import_raw 2019-10-19 16:30:18 +02:00
Steffen Jaeckel
44a18342ba rename ed25519_set_key to ed25519_import_raw 2019-10-19 16:30:18 +02:00
Steffen Jaeckel
3540fd713c fixup x25519_import()
bring x25519_import() in line with its ed25519 counterpart
2019-10-19 16:30:05 +02:00
Steffen Jaeckel
25410c7524
Merge pull request #505 from libtom/rsa-improvements
Add rsa_init() and rsa_shrink_key()
2019-10-17 22:28:18 +02:00
Steffen Jaeckel
5c6212af75 make rsa_shrink_key() private for now 2019-10-17 22:27:54 +02:00
Steffen Jaeckel
08abc93c40 Update makefiles 2019-10-17 22:27:54 +02:00
Steffen Jaeckel
4e28b922a9 add rsa_shrink_key() 2019-10-17 22:27:54 +02:00
Steffen Jaeckel
6fa98beb8a fix comment 2019-10-17 22:27:54 +02:00
Steffen Jaeckel
b9a75829a6 add rsa_init() 2019-10-17 22:27:54 +02:00
Steffen Jaeckel
50584ac7ec do timing on actual RSA key sizes 2019-10-17 22:27:54 +02:00
Steffen Jaeckel
49bb37dff1
Merge pull request #512 from fperrad/20191017_indent
fix indentation
2019-10-17 22:27:32 +02:00
Francois Perrad
38c144870b fix indentation 2019-10-17 17:17:38 +02:00
Steffen Jaeckel
9682df98e4
Merge pull request #511 from libtom/more-fixes
More fixes
2019-10-17 14:50:11 +02:00
Steffen Jaeckel
68cc580602 use macros in more tests 2019-10-17 12:49:20 +02:00
Steffen Jaeckel
a3310959d0 fix changed ltm API 2019-10-17 12:49:20 +02:00
Steffen Jaeckel
a68b703e22 use zeromem in stream-cipher done() functions 2019-10-17 10:29:27 +02:00
Steffen Jaeckel
ef55d1335e fix some MSVC compiler warnings 2019-10-17 10:29:27 +02:00
Steffen Jaeckel
2a63adc1ab add XSTRLEN 2019-10-17 10:29:27 +02:00
Steffen Jaeckel
fcdb14ede1
Merge pull request #500 from libtom/fix-ssh-api
Fix SSH API
2019-10-16 23:16:46 +02:00
Steffen Jaeckel
9b6bf32f88 use unsigned long for the length of a string 2019-10-13 14:05:41 +02:00
Steffen Jaeckel
27ec31d4f3 improve SSH decoding & doc 2019-10-13 14:05:41 +02:00
Steffen Jaeckel
c13dc105f3 verify pointer to be non-NULL before dereferencing 2019-10-13 14:05:41 +02:00
Steffen Jaeckel
58254f76e8 fix SSH string implementation 2019-10-13 14:05:41 +02:00
Steffen Jaeckel
f89909bd6c use macros in ssh_test() 2019-10-13 14:05:41 +02:00
Steffen Jaeckel
8b5ce8ba7e add ENSURE() macro 2019-10-13 14:05:41 +02:00
Steffen Jaeckel
26dc2766bd move LTC_SSHDATA_EOL to the beginning of the enum
If there's an EOL at the end of the enum I'm tempted to add new entries
before that one and then this will break the ABI which I don't like.
2019-10-13 14:05:41 +02:00
Steffen Jaeckel
5ded083bb0
Merge pull request #497 from libtom/bcrypt
Bcrypt
2019-10-13 14:05:13 +02:00
Steffen Jaeckel
36260aea85 Update makefiles 2019-10-12 14:31:38 +02:00
Steffen Jaeckel
d4233e9156 rename arguments 2019-10-12 14:31:38 +02:00
Steffen Jaeckel
e9ff57d5d7 fix varargs error
When compiling with "-g -O0" valgrind complained about "Conditional jump
or move depends on uninitialised value(s)", c.f. e.g. [1]

[1] https://travis-ci.org/libtom/libtomcrypt/jobs/588690930
2019-10-12 14:31:38 +02:00
Steffen Jaeckel
9423f3b26d add bcrypt 2019-10-12 14:31:38 +02:00
Steffen Jaeckel
5e30d3512f add required private API 2019-10-12 13:13:49 +02:00
Steffen Jaeckel
e69579cac2 start re-factor 2019-10-12 13:13:49 +02:00
Steffen Jaeckel
238eb7339a
Merge pull request #504 from libtom/minor-fixes
Minor fixes and improvements
2019-10-12 13:11:20 +02:00
Steffen Jaeckel
c0d1cbdf1d fix #469
[skip ci]
2019-10-11 14:32:22 +02:00
Steffen Jaeckel
4fd4e86ce0 re-order examples 2019-10-11 14:32:22 +02:00
Steffen Jaeckel
d2027d60eb add testcase for issue #507 2019-10-11 14:32:22 +02:00
Steffen Jaeckel
197621d867 re-order vars of travis.yml
the travis UI shows them right besides the build and the name says more
than the script on what is done
2019-10-11 14:32:22 +02:00
Steffen Jaeckel
8d22018065 don't produce any console-output on make V=0 2019-10-11 14:32:22 +02:00
Steffen Jaeckel
5e41924d85 use mp_init_copy() instead of init()+copy() 2019-10-11 14:32:22 +02:00
Steffen Jaeckel
34d865488b update LTC_DEPRECATED macro from ltm 2019-10-11 14:32:22 +02:00
Steffen Jaeckel
3e11e86f3e further updated ltm API 2019-10-11 14:32:22 +02:00
Steffen Jaeckel
c113c03c13 run {A,UB}SAN again with GMP
Fixup of 798d7dc61f
2019-10-11 14:32:22 +02:00
Steffen Jaeckel
9c67f8ac3c Fix includes
Headers which are included with '< >' can only be found if the folder where
the files are located is given as include path.
To be able to install the files to a separate folder, include them instead
with '" "'.
2019-10-11 14:32:22 +02:00
Steffen Jaeckel
0ca8a31cd3 clean-up define 2019-10-11 14:32:22 +02:00
Steffen Jaeckel
f9ab401098 check ranges of more ciphers
Inspired by #493 of @jbech-linaro I reviewed all blockciphers
for similar patterns.

Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
2019-10-11 14:32:22 +02:00
Steffen Jaeckel
659540393e
Merge pull request #506 from libtom/add-tea
Add TEA blockcipher
2019-10-11 14:30:21 +02:00
Steffen Jaeckel
79f812c9f4 update TV's 2019-10-11 14:20:43 +02:00
Steffen Jaeckel
06a58ab519 update doc 2019-10-11 14:20:43 +02:00
Steffen Jaeckel
74197c81c5 Update makefiles 2019-10-11 14:20:43 +02:00
Steffen Jaeckel
0f2c415e7a add TEA 2019-10-11 14:20:43 +02:00
Steffen Jaeckel
8e044b8bf6
Merge pull request #509 from armcc/improve-des-tests
fix and cleanup des and 3des test cases
2019-10-11 09:39:13 +02:00
Andre McCurdy
d85045e18a fix and cleanup des and 3des test cases
- Drop unused 'num' field from struct des_test_case.
 - Fix the order of arguments passed to compare_testvector() (actual
   and expected buffers were swapped, leading to misleading error
   messages for failing tests).
 - Enable all DES test vectors by default and use them for both
   encrypt and decrypt. That allows the struct des_test_case 'mode'
   field (which was previously incorrect for the LTC_TEST_EXT tests)
   to be dropped.
 - Run the "encrypt / decrypt all zero's" tests once, instead of
   running repeatedly from within the test vectors loop.
 - Add minimal set of 128bit key 3DES test vectors.
 - Try to more closely align the des_test() and des3_test() functions
   (common flow, common variable names, etc).
 - Minor indent fixes.

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
2019-10-10 00:58:55 -07:00
Steffen Jaeckel
64d1153e5a
Merge pull request #508 from werew/develop
Fixes #507
2019-10-08 09:07:43 +02:00
werew
25c26a3b7a Fixes #507 2019-10-03 19:57:10 +02:00
Steffen Jaeckel
734ba7ec50
Merge pull request #499 from libtom/minor-improvements
Minor improvements
2019-09-30 15:00:05 +02:00
Steffen Jaeckel
da9f55231f don't exclude other settings when giving make options
Now `make LTC_DEBUG=1` builds a full-speed library but with debug infos.

One has to do `make LTC_DEBUG=1 IGNORE_SPEED=1` now to have the same
results as before.

This was done since
1. it makes sense to enable optimization also when adding debug infos
2. clang+valgrind creates errors if there's no optimization enabled
   (c.f. #497)
2019-09-30 11:55:51 +02:00
Steffen Jaeckel
d4b8d9b507 fix scan-build error 2019-09-30 11:55:51 +02:00
Steffen Jaeckel
9416a88468 install libtool-bin 2019-09-30 11:55:49 +02:00
Steffen Jaeckel
e4dd30af54 run tests on bionic 2019-09-30 11:54:07 +02:00
Steffen Jaeckel
4458e91151 be more strict when searching scan-build-*
clang-9 brings `scan-build-py-9` which matched the old pattern
2019-09-30 11:54:03 +02:00
Steffen Jaeckel
62bbdecaff use rotate intrinsics if available 2019-09-30 11:35:49 +02:00
Steffen Jaeckel
33dabf9693 only run the standard build in travis PR's
all the other builds are only get built, the testrun is skipped
2019-09-30 11:35:49 +02:00
Steffen Jaeckel
e2f5d17dcc test default-build as first 2019-09-30 09:59:59 +02:00
Steffen Jaeckel
6f3a7c9e3e improve GNU Makefiles a bit
* unignore type-limits warning
* add the possibility to do `make V=0 >/dev/null` and still get the
  CFLAGS and LDFLAGS that are used while compilation
2019-09-30 09:59:59 +02:00
Steffen Jaeckel
1e67d81f7b
Merge pull request #498 from libtom/appveyor
Add AppVeyor MSVC builds
2019-09-29 17:33:24 +02:00
Steffen Jaeckel
eaf2c7b6b9 fix build for msvc 2019-09-24 14:09:35 +02:00
Steffen Jaeckel
d25c52b546 add AppVeyor to README 2019-09-24 14:09:35 +02:00
Steffen Jaeckel
b4c6c4c45f also build on appveyor 2019-09-24 13:24:09 +02:00
Steffen Jaeckel
a1f6312416
Merge pull request #493 from jbech-linaro/rijndael_range
check range in _rijndael_ecb_ functions
2019-09-04 13:44:47 +02:00
Joakim Bech
7b4a5c1dcf check range in _rijndael_ecb_ functions
There is no check that the 'skey' structure has been properly
initialized. For example, the skey->rijndael.Nr is assumed to contain a
positive number corresponding to the number of AES rounds to perform. In
_rijndael_ecb_encrypt the skey->rijndael.Nr is subtracted by two, which
can result in an integer underflow if the structure hasn't been
initialized correctly.

By clamping the value for skey->rijndael.Nr into the valid rounds for
AES we can return an error instead of ending up reading outside the
boundaries (of skey->rijndael.eK).

Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
Reported-by: Martijn Bogaard <bogaard@riscure.com>
2019-08-02 10:39:08 +02:00
Steffen Jaeckel
e01e4c5c97
Merge pull request #491 from fperrad/20190610_lint
some linting
2019-06-11 07:55:21 +02:00
Francois Perrad
75d53696c2 remove useless initialization 2019-06-10 23:56:27 +02:00
Steffen Jaeckel
c23f4699fb
Merge pull request #490 from libtom/improve/curve25519
Improve curve25519
2019-06-10 21:53:51 +02:00
Steffen Jaeckel
c971205404 fix clang-tidy warnings: do not use else after return 2019-06-10 12:48:16 +02:00
Steffen Jaeckel
e673906026 fix differing parameter names 2019-06-10 12:48:16 +02:00
Steffen Jaeckel
0b06979b10 prefix tweetnacl crypto_ API 2019-06-10 12:48:16 +02:00
Karel Miko
10056ed540 make crypto_verify_32 static 2019-06-10 12:32:28 +02:00
Karel Miko
1301cc5d2f fix clang-tidy warnings: do not use else after return 2019-06-10 12:31:56 +02:00
Steffen Jaeckel
3da27d71a0 Improve comments&doc
[skip ci]
2019-06-10 03:28:42 +02:00
Steffen Jaeckel
55d6661d48 Update makefiles 2019-06-09 23:20:45 +02:00
Steffen Jaeckel
fef07fd843 add documentation of Curve25519 API 2019-06-09 23:20:45 +02:00
Steffen Jaeckel
e0a9114129 move setting of sig-verification result to crypto_sign_open() 2019-06-09 23:20:45 +02:00
Steffen Jaeckel
0392867678 use shared {ed,x}25519_export() implementation 2019-06-09 23:20:45 +02:00
Steffen Jaeckel
3957c22e28 remove unused code from tweetnacl 2019-06-09 23:20:45 +02:00
Steffen Jaeckel
819656a12f add ed25519_make_key() testcase 2019-06-09 23:20:45 +02:00
Steffen Jaeckel
41731855c9 fix comment 2019-06-09 23:20:45 +02:00
Steffen Jaeckel
e3766e16ca add real pkcs#8 import of Curve25519 private keys 2019-06-09 22:46:57 +02:00
Steffen Jaeckel
8ea0fb1195 rename x25519_set_ku() to x25519_set_key() 2019-06-09 22:46:57 +02:00
Steffen Jaeckel
5d87aa21a5
Merge pull request #364 from libtom/feature/curve25519
Add curve25519
2019-06-09 22:22:39 +02:00
Steffen Jaeckel
47c34b37ef Update makefiles 2019-06-09 20:41:04 +02:00
Steffen Jaeckel
94b894fda9 update tests 2019-06-09 20:41:04 +02:00
Steffen Jaeckel
34196b90b9 add {ed,x}25519_import_x509() 2019-06-09 20:41:04 +02:00
Steffen Jaeckel
54d7c6782b clean-up macros
no need to enable them separately now
2019-06-09 20:41:04 +02:00
Steffen Jaeckel
233f8af490 draft-ietf-curdle-pkix is meanwhile rfc8410 2019-06-09 20:41:02 +02:00
Steffen Jaeckel
fe00be4abc Fix removed oid_st 2019-06-09 20:40:42 +02:00
Steffen Jaeckel
52a24ca3a3 add Curve25519 API 2019-06-09 20:40:40 +02:00
Steffen Jaeckel
59190c4f3c fix warnings & apply required changes 2019-06-09 11:43:54 +02:00
Steffen Jaeckel
a5072b17d5 add new signed datatype 2019-06-09 11:43:54 +02:00
Steffen Jaeckel
5698e0592c remove not required stuff & re-implement crypto_hash() 2019-06-09 11:43:54 +02:00
Steffen Jaeckel
ee11f2d500 add headers & footers 2019-06-09 11:43:54 +02:00
Steffen Jaeckel
85e902bcc0 add tweetnacl.c Version 20140427 2019-06-09 11:43:54 +02:00
Steffen Jaeckel
c600d81e31
Merge pull request #489 from libtom/pr/fix-stringop-truncation
Fix gcc 8.3 warning (stringop-truncation)
2019-06-09 11:40:51 +02:00
Karel Miko
5f09c2c584 Fix gcc 8.3 warning (stringop-truncation) 2019-06-09 11:40:27 +02:00
Steffen Jaeckel
65282c17b5
Merge pull request #488 from libtom/update/ltm
Update ltm
2019-06-09 11:39:19 +02:00
Steffen Jaeckel
7c56243a0f use replacement functions if they're available
we use the fact that in the same move of deprecating those functions,
tommath_class.h also isn't included anymore in tommath.h so those defines
are gone as well and can be used as an indication if the new functions are
available
2019-06-06 15:06:20 +02:00
Steffen Jaeckel
c11287a0ad latest version of ltm deprecated DIGIT_BIT 2019-06-06 15:06:20 +02:00
Steffen Jaeckel
4ed50d8da1
Merge pull request #485 from libtom/minor-fixes
Minor fixes
2019-06-05 09:24:19 +02:00
Steffen Jaeckel
b0bb7c830a fix missing dependencies 2019-06-04 08:50:27 +02:00
Steffen Jaeckel
4b3ef78901 TGTLIBTOOL wasn't always defined 2019-06-04 08:50:27 +02:00
Steffen Jaeckel
061237e6b1
Merge pull request #484 from fperrad/20190603_indent
fix indentation
2019-06-03 09:31:01 +02:00
Francois Perrad
b40cc35c2d fix indentation 2019-06-03 04:18:53 +02:00
Steffen Jaeckel
e9b2277a49
Merge pull request #483 from libtom/improve/x509
Improve/x509
2019-06-02 22:19:43 +02:00
Steffen Jaeckel
f6299995f8 update ecc_import_x509() 2019-05-27 10:05:11 +02:00
Steffen Jaeckel
21fa9cd92e Update makefiles 2019-05-27 10:05:11 +02:00
Steffen Jaeckel
dfa5258db5 update rsa_import_x509() 2019-05-27 10:05:11 +02:00
Steffen Jaeckel
5119e71023 add x509_decode_public_key_from_certificate() 2019-05-27 10:05:11 +02:00
Steffen Jaeckel
c28a8495d2
Merge pull request #481 from RektInator/develop
fixed compile issue on msvc++
2019-05-08 17:19:56 +02:00
Micky Langeveld
596e9a65e6 fixed compile issue on msvc++ 2019-04-18 09:22:38 +02:00
Steffen Jaeckel
e8afa13d5c
Merge pull request #476 from libtom/fix/474
Fix issue #474
2019-04-10 17:05:59 +02:00
Steffen Jaeckel
19e7f73948 fix scan-build warnings 2019-04-10 11:26:33 +02:00
Steffen Jaeckel
99fcbea2a2 don't error-out if no MPI is available 2019-04-10 11:26:33 +02:00
Steffen Jaeckel
a72aa2fc14 try to make travis job error-out if first build fails 2019-04-10 11:26:33 +02:00
Steffen Jaeckel
a76c823992 fix unused-function _sha256() in xsalsa20_test.c 2019-04-10 11:26:32 +02:00
Steffen Jaeckel
5f7feeab59 fix build
* LDFLAGS were missing when building the demo's
* change how CFLAGS and EXTRALIBS are passed
* also use EXTRALIBS when running testbuild.sh
2019-04-10 11:26:32 +02:00
Steffen Jaeckel
1bfde18513 FIPS 186.4 compliant usage of ltm mp_prime_is_prime() 2019-04-10 11:26:32 +02:00
Steffen Jaeckel
5ed32b73e6 improve ecc_test() output 2019-04-10 11:26:32 +02:00
Steffen Jaeckel
27d09b6104 also provide LTC_NORETURN for msvc 2019-04-10 09:17:50 +02:00
Steffen Jaeckel
a9ff2d0dac fixup meta_builds.sh after 798d7dc61f 2019-01-02 23:30:00 +01:00
Steffen Jaeckel
d58103d54f oops, NORETURN isn't only used in crypt_argchk() 2019-01-02 22:22:34 +01:00
Steffen Jaeckel
ee13f6ffec let ssh_test() NOP silently 2018-12-31 17:22:28 +01:00
Steffen Jaeckel
912f6da757 add some more builds to travis 2018-12-29 22:37:50 +01:00
Steffen Jaeckel
b7874c5864 fix warnings when using other ARGTYPE's 2018-12-29 22:37:09 +01:00
Steffen Jaeckel
798d7dc61f turn around static and dynamic build-options in travis recipe 2018-12-29 18:09:33 +01:00
Steffen Jaeckel
252a172c08 SSH requires MPI funtionality 2018-12-29 18:08:46 +01:00
Steffen Jaeckel
f95be00582 unconditonally create ssh_test() 2018-12-29 18:08:31 +01:00
Steffen Jaeckel
f6f70aa2ec fix ssh tests when compiled w/o MPI provider 2018-12-29 18:08:07 +01:00
Steffen Jaeckel
4b448d29a2 fix warnings on ARGTYPE=3 2018-12-29 18:02:42 +01:00
Steffen Jaeckel
01c455c3d5
Merge pull request #473 from libtom/fixup/padding_pad
fix compilation of padding_pad
2018-12-17 15:44:02 +01:00
Jordan Hrycaj
11ee9683e7 fix compilation of padding_pad
... in cases where rng_get_bytes() isn't available
2018-12-17 13:28:47 +01:00
karel-m
d432b13139
Merge pull request #465 from libtom/pr/ecc-test-cleanup
ecc_test cleanup
2018-11-07 13:35:57 +01:00
Karel Miko
ae2ab2083b ecc_test cleanup 2018-11-07 09:25:08 +01:00
Karel Miko
0de6fa3084 Update makefiles 2018-11-07 09:15:34 +01:00
karel-m
3fa462a7f0
Merge pull request #464 from fperrad/20181029_indent
fix indentation
2018-10-29 20:33:05 +01:00
Francois Perrad
acf3fcda84 fix indentation 2018-10-29 18:56:02 +01:00
karel-m
f413335b2a
Merge pull request #463 from libtom/pr/ssh-decode-encode-fix
Avoid using LOAD32H/STORE32H with unsigned long
2018-10-29 13:04:52 +01:00
Karel Miko
09d116da87 avoid using LOAD32H/STORE32H with unsigned long 2018-10-29 11:28:07 +01:00
karel-m
62cd87342e
Merge pull request #451 from libtom/pr/wycheproof-gcm
Wycheproof failing GCM test - invalid/modified tag
2018-10-29 07:28:56 +01:00
Karel Miko
7d8567695b update doc - chacha20poly1305_memory + gcm_memory 2018-10-29 07:28:18 +01:00
Karel Miko
9a1131da14 add tag validation to chacha20poly1305_memory in decrypt mode 2018-10-29 07:28:18 +01:00
Karel Miko
fd4d8fbc05 add tag validation to gcm_memory in decrypt mode 2018-10-29 07:28:18 +01:00
Karel Miko
27c472654c fix chacha20poly1305 encrypt/decrypt empty pt/ct 2018-10-29 07:28:18 +01:00
Karel Miko
2599618ca6 wycheproof failing test - invalid/modified tag 2018-10-29 07:28:18 +01:00
karel-m
60eb5d0591
Merge pull request #454 from libtom/pr/wycheproof-padding
Wycheproof failing PKCS7 depadding test
2018-10-29 07:27:26 +01:00
Karel Miko
dee704d063 padding_depad + PKCS7 - reject invalid pad 0 2018-10-29 07:26:40 +01:00
Karel Miko
2adc261612 wycheproof failing PKCS7 depadding test 2018-10-29 07:26:40 +01:00
karel-m
332f66dfbe
Merge pull request #452 from libtom/pr/wycheproof-ccm
Wycheproof failing CCM test - invalid tag len
2018-10-29 07:25:55 +01:00
Steffen Jaeckel
9a0df8d936 fix scan-build 2018-10-27 10:50:27 +02:00
Steffen Jaeckel
ac5192cf56 update CCM tv's and tv generation 2018-10-27 10:50:27 +02:00
Karel Miko
890c1a8dad fix - CCM invalid tag len 2018-10-27 10:50:27 +02:00
Karel Miko
93c676ccd8 wycheproof failing CCM test - invalid tag len 2018-10-27 10:50:27 +02:00
karel-m
983fd25e40
Merge pull request #459 from libtom/pr/copy_or_zeromem
Avoid LTC_ARGCHK in void functions
2018-10-27 10:46:53 +02:00
Karel Miko
058a7e2c4e properly use LTC_ARGCHKVD in void function 2018-10-26 19:35:06 +02:00
Steffen Jaeckel
99f9181f67
Merge pull request #456 from dinamicoplus/patch-1
Fix RSA Encryption Example
2018-10-25 16:42:54 +02:00
Marcos Brito
be29591812
Fix RSA Encryption Example
RSA Encryption Example is missing a closing comment bracket */
2018-10-25 16:34:45 +02:00
Karel Miko
9c0d708523 fix typo pkcs7_depad > padding_depad [skip-ci] 2018-10-15 10:51:17 +02:00
karel-m
fba6ae3ed7
Merge pull request #447 from libtom/pr/ecc-LTC_ECCSIG_RFC7518_RELAXED
Make LTC_ECCSIG_RFC7518 strict (again)
2018-10-13 18:50:48 +02:00
Karel Miko
c2cdaaab4d make LTC_ECCSIG_RFC7518 strict (again) 2018-10-13 18:48:49 +02:00
karel-m
dec99ed99c
Merge pull request #438 from rmw42/feature/ssh-ecdsa
LTC_ECCSIG_RFC5656 SSH+ECDSA signature format
2018-10-13 17:51:29 +02:00
Russ Williams
4ee5bfc013 GCC 4.8 -Wmaybe-uninitialized is *really* dumb 2018-10-12 10:22:10 +01:00
Russ Williams
7c4d7cb610 Fixes suggested by Matt Johnston 2018-10-12 10:22:10 +01:00
Russ Williams
9706aa62a7 Update makefiles 2018-10-12 10:22:10 +01:00
Russ Williams
b4b50cc0c6 Initial commit of SSH+ECDSA signature format
Wrap signature format in #ifdef LTC_SSH
Update docs
Code review fixes
Replace strcmp/memcmp with XSTRCMP/XMEMCMP for check-source
Fix for check-defines
XSTRCMP/XMEMCMP != 0
GCC7.3 wants only literal strings for sprintf format
Code review changes
Rework SSH decoding and tests
Fix encoding and tests
COMPARE_TESTVECTOR macro
Single return point in ssh_decode_sequence_multi
Actually use XSTRNCPY rather than just defining it
More code review fixes
Code review tweaks
Ensure it's not possible to read past buffer end
Keep track of size remaining, not end pointer
2018-10-12 10:22:10 +01:00
Steffen Jaeckel
2e7c194322
Merge pull request #445 from fperrad/20181007_lint
pbes: some linting
2018-10-08 15:34:49 +02:00
Francois Perrad
a381957846 more const 2018-10-07 14:52:43 +02:00
Francois Perrad
bd767a3116 fix condition 2018-10-07 14:52:36 +02:00
Francois Perrad
46bb470aaa remove useless initialization 2018-10-07 14:52:16 +02:00
Steffen Jaeckel
838feac7c6
Merge pull request #404 from libtom/pr/pkcs8-improved
Improved pkcs8 support
2018-10-07 11:40:30 +02:00
Steffen Jaeckel
a55e7caa48 fix missing handling of optional keyLength in PBKDF2-params 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
f81bdc46e7 add more rsa-pkcs8 PBES2-RC2 test-files 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
c96639bef6 add rsa-pkcs8 PBES2 AES and SHA512-224/256 test-files 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
cbe65fe59a add rsa-pkcs8 PBE-SHA1-3DES test-file 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
8fabca6171 merge duplicated tables into separate chapter
[skip ci]
2018-10-06 23:04:51 +02:00
Karel Miko
14b09138a9 doc update
[skip ci]
2018-10-06 23:04:51 +02:00
Karel Miko
8349eda5a5 fix LTC_EASY test failure 2018-10-06 23:04:51 +02:00
Karel Miko
e5a2683f5b RSA - pkcs8 test keys 2018-10-06 23:04:51 +02:00
Karel Miko
2dd8bcdfe9 rsa_import_pkcs8 tests 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
7af942a66b use pkcs8_decode_flexi() in rsa_import_pkcs8() 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
52c5473a13 use pkcs8_decode_flexi() in ecc_import_pkcs8() 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
bc673c2853 implement pkcs8_decode_flexi() 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
a2ec37b93c refactor PBES into separate modules 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
aac1e592b4 Update makefiles 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
0af0033390 add empty der_decode_pkcs8_flexi.c 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
362e0c9284 add pk_oid_cmp_with_ulong() 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
4abd84b7c3 Update makefiles 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
3d6a49a64b rename pk_oid_asn1.c to pk_oid_cmp.c 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
498a534b9c Update makefiles 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
97d1c17c8d add empty pbes files 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
6bdfa7c428 add _der_flexi_sequence_cmp() 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
c56053870a pkcs#8 support for aes and reduced sha512 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
36d603e3d2 re-factor ecc_import_pkcs8() 2018-10-06 23:04:51 +02:00
Karel Miko
3c9d2ebc5e clang-tidy fix misc-suspicious-string-compare 2018-10-06 23:04:51 +02:00
Karel Miko
e29fecde12 use ecc_find_curve + ecc_set_curve 2018-10-06 23:04:51 +02:00
Karel Miko
8207a6a1c4 use pkcs12_kdf + pkcs12_utf8_to_utf16 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
c4642bacf0 mark fall-through in switch-case to calm linter 2018-10-06 23:04:51 +02:00
Steffen Jaeckel
93e758a82e introduce LTC_ASN1_IS_TYPE() 2018-10-06 23:04:51 +02:00
Karel Miko
bf04bf18a4 add ecc_import_pkcs8 2018-10-06 23:04:51 +02:00
Karel Miko
7529e02b96 Update makefiles 2018-10-06 23:04:51 +02:00
karel-m
223ece7f6d
Merge pull request #443 from libtom/pr/ecc-verify-was-too-strict
Less strict ecc_verify_hash_ex (as it was before ecc_recover_key)
2018-10-05 12:32:49 +02:00
Karel Miko
59bc3b5885 make ecc_verify_hash_ex less strict (as it was before ecc_recover_key addition) 2018-10-05 07:44:15 +02:00
karel-m
4d6f973b2d
Merge pull request #444 from libtom/pr/fix-unused-macros
Remove unused macros
2018-10-05 07:05:29 +02:00
Karel Miko
ef20f2e656 remove unused macros 2018-10-04 23:29:12 +02:00
karel-m
0157bef943
Merge pull request #442 from libtom/pr/ltc-byte
Rename macro 'byte' to 'LTC_BYTE'
2018-10-04 19:52:34 +02:00
Karel Miko
bb5ea12d0b move LTC_BYTE macro from tomcrypt_macros.h to tomcrypt_private.h 2018-10-04 17:21:58 +02:00
Karel Miko
1bbbc60d06 rename macro byte >> LTC_BYTE - related to #439 2018-10-04 17:20:47 +02:00
Steffen Jaeckel
c5e4679b7a
Merge pull request #436 from rmw42/feature/ecrecover
Implement ecc_recover_key to recover public key from hash+signature
2018-09-30 16:28:22 +02:00
Russ Williams
88d9b6db26 Make ECC signature format explicit
Optionally return recovery ID from ecc_sign_hash()

Update documentation

Update tests for ECC recovery

Fix (v,r,s) signature format, regenerate recovery test

Fix over-freeing of private key

Code review fixes to docs

Rename LTC_ECCSIG_BLOCKCHAIN to LTC_ECCSIG_ETH to reflect original definition

Rename to LTC_ECCSIG_ETH27 to make clear it's using the Ethereum +27 convention

Code review changes - calculate recovery ID only if needed, type safety on signature format enum

Use enum for sigformat in docs, and add explanatory note for recid<0

Range checks on v, check RFC7518 signatures' length based on size of key. Fix for when order>prime.

Limit LET_ECCSIG_ETH27 to secp256k1 curve only
2018-09-29 21:07:41 +01:00
Russ Williams
57781c7acd Update makefiles 2018-09-23 09:03:30 +01:00
Russ Williams
76190521e3 Implementation of ecc_recover_key to obtain public key from hash+signature
Workaround for TFM missing sqrtmod_prime

Fix unused variable warnings with USE_TFM, make TomsFastMath a runtime check

Disable ecc_recover_key if no ecc_mul2add available

Wrap ecc_recover_key and its test in #ifdef LTC_ECC_SHAMIR

Fix unused variables when built without LTC_ECC_SHAMIR

Code review tweaks

Code review tweaks - remove sigformat, tidy up (de)allocation

Code review tweaks
2018-09-23 09:03:30 +01:00
Larry Bugbee
b44155fdb0
Merge pull request #431 from libtom/streams-add-single-call-crypt-functions
Streams - add single call crypt functions
2018-09-21 12:03:36 -07:00
buggywhip
a2b343b2d0 streams-add-single-call-crypt-functions
fix mixed declarations and code

add _memory chacha_ivctr32() test
2018-09-10 02:21:09 -07:00
buggywhip
305a589d64 update makefiles 2018-09-10 02:21:09 -07:00
Steffen Jaeckel
e77ad636e7
Merge pull request #435 from fperrad/20180907_lint
some lintings
2018-09-08 17:00:54 +02:00
Francois Perrad
9d9718e56b remove useless initialization 2018-09-08 11:49:36 +02:00
Francois Perrad
698790fdeb explicit condition 2018-09-07 17:06:09 +02:00
Steffen Jaeckel
e5f56d4617
Merge pull request #429 from libtom/rework/oid
Remove oid_st
2018-09-07 16:49:25 +02:00
Steffen Jaeckel
fb7b8799cd rename enum public_key_algorithms to something more generic 2018-09-07 11:58:54 +02:00
Steffen Jaeckel
4cf2e80346 remove oid_st 2018-09-07 11:58:54 +02:00
Steffen Jaeckel
af23fdd1c2 Update makefiles 2018-09-07 11:58:54 +02:00
Steffen Jaeckel
645460a5d5 add pk_oid_cmp_with_asn1() 2018-09-07 11:58:54 +02:00
Steffen Jaeckel
e318f6f1e3 re-work pk_oid_str functions a bit 2018-09-07 11:58:54 +02:00
Steffen Jaeckel
1a90da844c only print der flexi-test on higher debug level
it's smashing the stack for some inputs :>
2018-09-07 11:58:54 +02:00
Steffen Jaeckel
caff4cea40 change pk_get_oid() to return a string 2018-09-07 11:58:54 +02:00
Steffen Jaeckel
41599db904 Update makefiles 2018-09-07 11:58:54 +02:00
Steffen Jaeckel
fdc97f8648 move oid functions to own folder 2018-09-07 11:58:54 +02:00
Steffen Jaeckel
86ff14100f
Merge pull request #430 from libtom/fix/oid-decode
Fix OID issues
2018-09-07 11:57:38 +02:00
Steffen Jaeckel
2e9c80cbc1 fix der_length_object_identifier()
... there are only three root nodes

As of X6.90 Ch. 8.19.4: "NOTE – This packing of the first two
object identifier components recognizes that only three values
are allocated from the root node..."
2018-09-07 08:24:25 +02:00
Steffen Jaeckel
6584569872 add another OID testcase for root-node 3 2018-09-07 08:24:25 +02:00
Steffen Jaeckel
4ffdb915f0 fix der_decode_object_identifier() 2018-09-07 08:24:25 +02:00
Steffen Jaeckel
079ed04b17 add OID testcase from x.690 2018-09-07 08:24:25 +02:00
Steffen Jaeckel
bd542c6c30
Merge pull request #433 from orbea/rlibtool
makefile.shared: Support rlibtool.
2018-09-07 08:24:03 +02:00
orbea
ccc18b9eda makefile.shared: Support rlibtool.
When building libtomcrypt with rlibtool instead of libtool it will fail
when rlibtool fails to parse the generated libtool which does not exist.

Since rlibtool should be the default choice for most slibtool users in
the future this patch will use slibtool-shared instead which will
correctly build the shared library.

This could also help build the shared library on additional targets and
hosts where the stock libtool does not have shared libraries enabled.
2018-09-06 18:19:10 +02:00
Steffen Jaeckel
c9c3c42739 Merge branch 'streams-make_state_names_consistent' into develop
This fixes #427
2018-07-10 07:11:39 +02:00
buggywhip
380d1d2452 streams-make_state_names_consistent 2018-07-09 17:31:24 -07:00
karel-m
c9376c29ba
Merge pull request #428 from libtom/pr/fix-gcc-warnings1
fix -Wmissing-declarations -Wmissing-prototypes -Wmissing-noreturn
2018-07-09 11:32:35 +02:00
Karel Miko
ba8fa04f9a reorganize ifdefs in tv_gen 2018-07-08 21:59:06 +02:00
Karel Miko
4fb0562a3b fix -Wmissing-declarations -Wmissing-prototypes -Wmissing-noreturn 2018-07-07 19:54:08 +02:00
Steffen Jaeckel
b5009d704c
Merge pull request #426 from libtom/feature/pkcs12
Feature/pkcs12
2018-07-06 18:37:54 +02:00
Steffen Jaeckel
53fc5694c9 re-work pkcs12 a bit 2018-07-06 18:26:43 +02:00
Steffen Jaeckel
6fe1b5b765 Update makefiles 2018-07-06 18:26:43 +02:00
Karel Miko
a96997dd29 add pkcs12_utf8_to_utf16() 2018-07-06 18:26:43 +02:00
Karel Miko
b3f483a204 add pkcs12_kdf() 2018-07-06 18:26:43 +02:00
karel-m
98ad88b3ee
Merge pull request #422 from libtom/pr/clang-tidy-google-readability-braces-around-statements
fix clang-tidy warning: google-readability-braces-around-statements
2018-07-06 17:53:12 +02:00
Karel Miko
a3dab04074 fix clang-tidy warning: google-readability-braces-around-statements 2018-07-06 13:58:15 +02:00
karel-m
e02694cfc2
Merge pull request #393 from libtom/pr/ecc-doc-update
ECC doc update
2018-07-06 13:44:17 +02:00
Karel Miko
4f3bce103f move ecc_make_key_ex to Legacy Key Generation
[skip ci]
2018-07-06 13:42:54 +02:00
Karel Miko
b30c27066d new names: ecc_find_curve, ecc_set_curve 2018-07-06 13:42:38 +02:00
Steffen Jaeckel
415c19b8df re-work ECC docs a bit
[skip ci]
2018-07-06 13:42:38 +02:00
Karel Miko
57c884d50d ECC doc update
[skip ci]
2018-07-06 13:42:38 +02:00
karel-m
d3c5890a1b
Merge pull request #423 from libtom/pr/ecc_set_dp--ecc_set_curve
rename ecc_set_dp >> ecc_set_curve + ecc_get_curve >> ecc_find_curve
2018-07-06 13:39:51 +02:00
Karel Miko
4bec98f88c rename ecc_get_curve to ecc_find_curve 2018-07-04 10:43:15 +02:00
Karel Miko
611ca6bf14 rename ecc_set_dp (+related) to ecc_set_curve 2018-07-04 10:41:10 +02:00
Karel Miko
091d52828c Update makefiles 2018-07-04 10:41:02 +02:00
karel-m
4473953742
Merge pull request #415 from libtom/pr/clang-tidy-else-after-return
fix clang-tidy warning: readability-else-after-return
2018-07-03 22:45:28 +02:00
Karel Miko
ed2ec2e3ed add script .ci/clang-tidy.sh 2018-07-03 22:43:26 +02:00
Karel Miko
22b764ec85 fix clang-tidy warning: readability-else-after-return 2018-07-03 22:42:15 +02:00
karel-m
6ac6d36bf4
Merge pull request #416 from libtom/pr/clang-tidy-readability-non-const-parameter
fix clang-tidy warning: readability-non-const-parameter
2018-07-03 22:37:34 +02:00
Karel Miko
ae6aa3dd86 fix clang-tidy warning: readability-non-const-parameter 2018-07-03 22:37:05 +02:00
karel-m
48ad48f900
Merge pull request #417 from libtom/pr/clang-tidy-readability-inconsistent-declaration-parameter-name
fix clang-tidy warning: inconsistent-declaration-parameter-name
2018-07-03 22:35:56 +02:00
Karel Miko
12c3091077 fix clang-tidy warning: readability-inconsistent-declaration-parameter-name - issue #376 2018-07-03 22:33:48 +02:00
karel-m
168f3bd1db
Merge pull request #421 from libtom/pr/tests-cosmetics
fix "make test" built with no math provider or multiple providers
2018-07-03 22:30:41 +02:00
Karel Miko
fc056a645d fix "make test" built with no math provider or multiple providers 2018-07-03 00:12:08 +02:00
Steffen Jaeckel
3fb0eea01b show in SCRYPT etc. that we're on develop 2018-07-02 23:25:20 +02:00
Steffen Jaeckel
215ec5f69d Merge tag 'v1.18.2' into develop
libtomcrypt v1.18.2
2018-07-02 23:23:47 +02:00
Steffen Jaeckel
7e7eb695d5 Merge branch 'release/1.18.2' 2018-07-01 22:49:01 +02:00
Steffen Jaeckel
a015a8f05f don't install test in target install_all
This fixes #396
2018-07-01 22:47:05 +02:00
Steffen Jaeckel
54e6db588a Bump version 2018-07-01 12:51:54 +02:00
Steffen Jaeckel
788a0463b9 Update changes
[skip ci]
2018-06-22 14:25:34 +02:00
Steffen Jaeckel
bf5ad76c28 Merge pull request #414 from libtom/fix/411
Fix/411
(cherry picked from commit 8972027b46)
2018-06-22 11:33:54 +02:00
Steffen Jaeckel
8972027b46
Merge pull request #414 from libtom/fix/411
Fix/411
2018-06-22 11:33:14 +02:00
Steffen Jaeckel
73426f4b26 fix constants and sizes demos 2018-06-22 10:10:23 +02:00
Steffen Jaeckel
ecfe5882ac re-factor crypt_list_all_sizes() 2018-06-22 10:10:23 +02:00
Steffen Jaeckel
8bc889cd64 re-factor crypt_list_all_constants() 2018-06-22 10:10:23 +02:00
Steffen Jaeckel
07b626d7a1 fix-up 250eced904 2018-06-22 02:05:03 +02:00
Steffen Jaeckel
11bdffcf05 fix-up 719d297e9f 2018-06-22 00:31:44 +02:00
karel-m
250eced904 Merge pull request #408 from libtom/pr/fix-cve-2018-12437
ecc_sign_hash blinding CVE-2018-12437
(cherry picked from commit 6aef5e3765)
2018-06-22 00:17:24 +02:00
Steffen Jaeckel
927b196210
Merge pull request #406 from libtom/remove-sosemanuk_setup()-"NOP"
Sosemanuk - remove what is effectively a NOP
2018-06-19 11:45:38 +02:00
Steffen Jaeckel
fd6535c74b remove lying comment 2018-06-19 11:45:13 +02:00
Larry Bugbee
6cfa1fcad7 remove what is effectively a NOP
prior return stmt was a failed attempt to initialize the remaining bytes of the state which is also negated by the policy of enforcing a call to sosemanuk_setiv() before calling sosemanuk_crypt().
2018-06-19 11:44:04 +02:00
karel-m
6aef5e3765
Merge pull request #408 from libtom/pr/fix-cve-2018-12437
ecc_sign_hash blinding CVE-2018-12437
2018-06-19 09:30:51 +02:00
Karel Miko
f0a51bbdbd ecc_sign_hash blinding CVE-2018-12437 2018-06-17 12:54:01 +02:00
Steffen Jaeckel
b7873025b7
Merge pull request #405 from libtom/pr/fix-ecc_import_openssl
fix ecc_import_openssl - bin_seed size
2018-06-12 08:17:48 +02:00
Karel Miko
5efbddc3f4 fix ecc_import_openssl - bin_seed size 2018-06-12 00:00:11 +02:00
Steffen Jaeckel
6238b6381f
Merge pull request #187 from libtom/pr/ecc-asn1-part
ECC-step3: extra import/export (ASN.1 related)
2018-06-11 19:13:21 +02:00
Steffen Jaeckel
4f36e03970 re-factor ecc_import_openssl()
... into several smaller functions
2018-06-11 10:00:37 +02:00
Karel Miko
05d397d634 ECC improved import/export 2018-06-11 10:00:37 +02:00
Karel Miko
abedfa17eb Update makefiles 2018-06-11 10:00:37 +02:00
karel-m
d11a1a7f06
Merge pull request #402 from libtom/pr/fix-ecc_set_key
fix ecc_set_key - no check of private key input buffer size
2018-06-10 19:06:24 +02:00
Karel Miko
70d800f6b3 fix ecc_set_key - no check of private key input buffer size 2018-06-10 17:30:00 +02:00
karel-m
504396764e
Merge pull request #401 from libtom/pr/fix-der_length_custom_type
fix der_length_custom_type - incorrect length of length
2018-06-10 17:27:54 +02:00
Karel Miko
ac1622e042 fix der_length_custom_type - incorrect length of length 2018-06-05 16:39:38 +02:00
karel-m
a8d0442bd3
Merge pull request #400 from libtom/pr/avoid-anonymous-union
avoid anonymous union
2018-06-04 11:49:23 +02:00
Karel Miko
5834223db5 avoid anonymous union (which is not supported by some compilers) 2018-06-04 08:56:29 +02:00
karel-m
10355675a9
Merge pull request #398 from libtom/improve/base16_api
Improve base16 api
2018-06-04 08:55:07 +02:00
Steffen Jaeckel
06c0606da2 generalize caps argument of base16_encode()
probably we want to add more options in the future

I could think of support for some options of `xxd` resp. `hexdump`
2018-06-03 20:50:06 +02:00
Steffen Jaeckel
a1341e028e fix doxygen warning 2018-06-03 20:50:06 +02:00
Steffen Jaeckel
c315b1c3b7
Merge pull request #399 from libtom/remove/katja
Remove katja
2018-06-03 20:49:48 +02:00
Steffen Jaeckel
f8ed30bc22 Update makefiles 2018-06-03 19:19:58 +02:00
Steffen Jaeckel
d9215be060 Remove katja 2018-06-03 19:19:58 +02:00
Steffen Jaeckel
e31e757a86 fix build of crypt.pdf 2018-06-03 17:48:48 +02:00
Steffen Jaeckel
55fbe256ad
Merge pull request #395 from libtom/feature/private_header
Add a new header file for private functions
2018-06-03 17:48:30 +02:00
Steffen Jaeckel
c725be276a add blake2-hash API documentation 2018-06-03 15:07:28 +02:00
Steffen Jaeckel
d752f90d18 fix Doxygen docs 2018-06-03 15:07:28 +02:00
Steffen Jaeckel
7cfc0c93e6 use tomcrypt_private.h 2018-06-03 15:07:28 +02:00
Steffen Jaeckel
2cb77edf4c update makefiles etc. for tomcrypt_private.h 2018-06-03 15:07:27 +02:00
Steffen Jaeckel
f55039bfeb add tomcrypt_private.h 2018-06-03 15:07:27 +02:00
Steffen Jaeckel
5d8f35e5ed
Merge pull request #397 from fperrad/20180601_lint
xsalsa20: some linting
2018-06-02 12:16:01 +02:00
Francois Perrad
57bffbaa82 remove useless initialization 2018-06-01 21:05:49 +02:00
Francois Perrad
772a9e68cf make _sha256 a static function 2018-06-01 21:05:47 +02:00
Steffen Jaeckel
b7493253ea fix misplaced #endif 2018-06-01 14:47:19 +02:00
Karel Miko
7f6a4e1ff1 fix chmod 2018-06-01 10:07:17 +02:00
Larry Bugbee
82ac9a2275
Merge pull request #387 from libtom/add_xsalsa20
Add XSalsa20
2018-05-31 16:42:08 -07:00
buggywhip
8144209695 add XSalsa20 2018-05-31 11:58:21 -07:00
buggywhip
2ffcd1706e update makefiles 2018-05-31 11:58:08 -07:00
Steffen Jaeckel
94132324a9 fix testvectors for two-key 3des
(cherry picked from commit e4a03ca72a)
2018-05-31 14:18:44 +02:00
Steffen Jaeckel
4c2ae4758e fix "two-key 3des"-related things
(cherry picked from commit 715103a203)
2018-05-31 14:18:44 +02:00
Steffen Jaeckel
615b361673 no need to include wchar.h in all cases
(cherry picked from commit a32d1afd10)
2018-05-31 14:18:44 +02:00
Steffen Jaeckel
4c2bb90dec Merge pull request #382 from ararslan/aa/freebsd
Make the build logic more robust for BSD systems
(cherry picked from commit 5ab8dcf04d)
2018-05-31 14:18:13 +02:00
Steffen Jaeckel
e7f4c6e47f Merge pull request #392 from orbea/libtool
makefile.shared: Respect LIBTOOL.
(cherry picked from commit a528528a2b)
2018-05-31 14:18:01 +02:00
Steffen Jaeckel
3d6181d0a7 there should be no need to pass CFLAGS when linking
(cherry picked from commit 196f25e32f)
2018-05-31 14:16:54 +02:00
Steffen Jaeckel
5ab8dcf04d
Merge pull request #382 from ararslan/aa/freebsd
Make the build logic more robust for BSD systems
2018-05-31 13:51:54 +02:00
Alex Arslan
f5c665b9f6
Make the build logic more robust for BSD systems
This properly sets MAKE (when undefined) on BSDs to gmake rather than
make, which refers to the incompatible BSD Make. Further, it betters
detection of Clang as the default compiler, which is the case on FreeBSD
11.0+ and OpenBSD 6.0+.
2018-05-29 14:05:41 -07:00
karel-m
a94b02be94
Merge pull request #390 from libtom/fixes/and/improvements
Fixes and improvements
2018-05-24 17:08:28 +02:00
Steffen Jaeckel
e4a03ca72a fix testvectors for two-key 3des 2018-05-23 10:33:47 +02:00
Steffen Jaeckel
0011f7f927 add generic test_process_dir() 2018-05-23 10:33:47 +02:00
Steffen Jaeckel
715103a203 fix "two-key 3des"-related things 2018-05-23 10:33:47 +02:00
Steffen Jaeckel
a32d1afd10 no need to include wchar.h in all cases 2018-05-23 10:33:47 +02:00
karel-m
fe665c5246
Merge pull request #236 from libtom/pr/ecc-non-asn1-part
ECC curves y^2 = x^3 + ax + b
2018-05-23 09:30:39 +02:00
Karel Miko
24c0eb84f9 ECC curves y^2 = x^3 + ax + b 2018-05-22 23:02:44 +02:00
Karel Miko
ea32b2b194 Update makefiles 2018-05-22 23:02:44 +02:00
Steffen Jaeckel
a528528a2b
Merge pull request #392 from orbea/libtool
makefile.shared: Respect LIBTOOL.
2018-05-20 10:29:56 +02:00
orbea
f2918866bc makefile.shared: Respect LIBTOOL. 2018-05-19 08:36:41 -07:00
karel-m
b0c098e9c0
Merge pull request #389 from libtom/pr/avoid-exit
avoid calling exit() in sosemanuk_setup
2018-05-07 08:18:32 +02:00
Karel Miko
cdc256258a avoid calling exit() in sosemanuk_setup 2018-05-06 22:47:06 +02:00
karel-m
49001f01b3
Merge pull request #383 from libtom/pr/fortuna-fix
new fortuna: fix getting current time
2018-05-05 17:59:26 +02:00
Karel Miko
29af2d95cc fix getting current time on MS Windows + improve gettimeofday/clock_gettime usage on UNIX 2018-05-04 16:42:47 +02:00
Karel Miko
a8aa207381 change fortuna_prng.wd to ulong64 2018-05-04 16:42:47 +02:00
Karel Miko
d2ba3c93f6 introducing LTC_CLOCK_GETTIME macro 2018-05-04 16:42:47 +02:00
karel-m
73465cfb95
Merge pull request #388 from libtom/pr/check-all
do --check-all in check_source.sh
2018-05-04 16:42:02 +02:00
Karel Miko
41341195c5 do --check-all in check_source.sh 2018-05-04 12:48:42 +02:00
karel-m
c2548bf190
Merge pull request #386 from libtom/pr/fix-issue-384
fix #384 "const" related warnings
2018-05-04 07:17:52 +02:00
Karel Miko
11e15eaaa7 fix #384 "const" related warnings 2018-05-03 12:32:32 +02:00
karel-m
d16e5b0b05 Merge pull request #379 from libtom/pr/clang-tidy-misc-misplaced-widening-cast
clang-tidy: misc-misplaced-widening-cast
(cherry picked from commit 248352c36f)

With back-ported patch from src/misc/copy_or_zeromem.c back to
src/encauth/ccm/ccm_memory.c
2018-04-13 09:56:43 +02:00
karel-m
00dfe66081 Merge pull request #378 from libtom/pr/clang-tidy-misc-suspicious-string-compare
clang-tidy: misc-suspicious-string-compare
(cherry picked from commit 24f933d22a)
2018-04-13 09:54:03 +02:00
karel-m
1783100e7b Merge pull request #377 from libtom/pr/clang-tidy-void-return
clang-tidy: readability-redundant-control-flow
(cherry picked from commit 4cc8d08e50)
2018-04-13 09:53:59 +02:00
karel-m
92c5082a25 Merge pull request #375 from libtom/pr/fix-unused-const-variable
Fix -Wunused-const-variable in aes_tab.c
(cherry picked from commit 5c31c3d016)
2018-04-13 09:53:59 +02:00
Steffen Jaeckel
719d297e9f Merge pull request #373 from libtom/fix/der-recursion-limit
implement DER recursion limit
(cherry picked from commit af67321bf3)
2018-04-13 09:52:11 +02:00
Steffen Jaeckel
af67321bf3
Merge pull request #373 from libtom/fix/der-recursion-limit
implement DER recursion limit
2018-04-13 09:42:47 +02:00
Steffen Jaeckel
62c2124b82 implement DER resursion limit 2018-04-11 11:15:21 +02:00
Steffen Jaeckel
2e8371ce0b
Merge pull request #381 from felixdoerre/const_hash
add const to the hashes' compress functions
2018-04-11 11:14:49 +02:00
Felix Dörre
332ae41a2b add const to the hashes' compress functions 2018-04-10 13:30:12 +02:00
Steffen Jaeckel
8236ade38e
Merge pull request #363 from libtom/improve/fortuna
Improve Fortuna PRNG
2018-04-10 04:23:19 +02:00
Steffen Jaeckel
c7a880f222 update docs 2018-04-09 23:30:27 +02:00
Steffen Jaeckel
2dfc2d87da make fortuna_update_seed() public
In order to be able to implement UpdateSeedFile from the original paper
this is required to be available on the public API.
2018-04-09 23:30:27 +02:00
Steffen Jaeckel
7b97911cc6 add build with LTC_FORTUNA_RESEED_RATELIMIT_STATIC to travis 2018-04-09 23:30:27 +02:00
Steffen Jaeckel
ca91ae5a1f add fortuna_add_random_event() 2018-04-09 23:30:27 +02:00
Steffen Jaeckel
75dad9473d implement FORTUNA's reseed rate limit based on time 2018-04-09 23:30:27 +02:00
Steffen Jaeckel
1fb478ea31
Merge pull request #324 from TrinityCoder/fix-missing-const-params
Added missing 'const' qualifier to many functions' parameters
2018-04-09 11:58:37 +02:00
Steffen Jaeckel
1c3629fc06 add more missing const 2018-04-09 10:29:29 +02:00
Miroslav Mareš
228d29d1e7 Added missing 'const' qualifier to many functions' parameters 2018-04-09 10:29:29 +02:00
karel-m
248352c36f
Merge pull request #379 from libtom/pr/clang-tidy-misc-misplaced-widening-cast
clang-tidy: misc-misplaced-widening-cast
2018-04-09 08:56:53 +02:00
Karel Miko
7465d0bac3 fix clang-tidy misc-misplaced-widening-cast 2018-04-09 08:56:41 +02:00
karel-m
24f933d22a
Merge pull request #378 from libtom/pr/clang-tidy-misc-suspicious-string-compare
clang-tidy: misc-suspicious-string-compare
2018-04-09 08:55:32 +02:00
Karel Miko
fa01052b32 fix memcmp is called without explicitly comparing result 2018-04-09 08:55:13 +02:00
karel-m
4cc8d08e50
Merge pull request #377 from libtom/pr/clang-tidy-void-return
clang-tidy: readability-redundant-control-flow
2018-04-09 08:53:20 +02:00
Karel Miko
061fe36114 fix redundant return statement at the end of a function with a void return type 2018-04-08 18:04:34 +02:00
karel-m
5c31c3d016
Merge pull request #375 from libtom/pr/fix-unused-const-variable
Fix -Wunused-const-variable in aes_tab.c
2018-04-08 16:22:05 +02:00
Karel Miko
318451ce66 Fix -Wunused-const-variable in aes_tab.c 2018-04-08 14:28:57 +02:00
Steffen Jaeckel
49b3425de7
Merge pull request #374 from libtom/fix/cygwin
fix aesgcm on cygwin
2018-04-08 02:56:20 +02:00
Steffen Jaeckel
3249dcb963 allow TAB_SIZE to be defined at compile-time 2018-04-06 10:27:12 +02:00
Steffen Jaeckel
ba54b891b9 fix aesgcm on cygwin
This fixes #372
2018-04-06 10:19:53 +02:00
Steffen Jaeckel
70ec9b3b35 back-port of the bugfix done in #363 2018-04-04 19:31:36 +02:00
Steffen Jaeckel
24aab18d5b Merge pull request #359 from vchong/ltc_ctr
ltc: ctr: improve performance
(cherry picked from commit 9b80d07487)
2018-04-04 19:27:40 +02:00
Steffen Jaeckel
affb3d70cb improve fortuna_import()
This makes fortuna_import() kinda compliant to the "Update seed file"
behavior of the original paper.
It differs from the original behavior in that it allows to import
seed files which are larger	than 64 bytes.

(cherry picked from commit 39d4a14c29)
2018-04-04 19:25:31 +02:00
Steffen Jaeckel
89dffe6c7e add comment to Fortuna docs
(cherry picked from commit cccd1e3053)
2018-04-04 19:25:31 +02:00
Steffen Jaeckel
415c57f3af don't ignore additional data on SOBER128-PRNG import
(cherry picked from commit d502869728)
2018-04-04 19:25:31 +02:00
Steffen Jaeckel
b9fa4c063a fortuna_import() shouldn't ignore additional input
(cherry picked from commit 0c05e5386f)
2018-04-04 19:25:31 +02:00
Steffen Jaeckel
67d8ca19f5 ensure that fortuna has been seeded properly
(cherry picked from commit 04ce8cf613)
2018-04-04 19:25:31 +02:00
karel-m
243898972c Merge pull request #351 from libtom/pr/fix-time_cipher_lrw
LTC_EASY & time_cipher_lrw
(cherry picked from commit ea5b6cdce9)
2018-04-04 19:19:52 +02:00
Steffen Jaeckel
873240e7a0 Merge pull request #350 from libtom/fix/no-file-warnings
Fix warnings in `XMAC_file()` functions when compiling with `LTC_NO_FILE`.
(cherry picked from commit 11cda2e274)
2018-04-04 19:19:19 +02:00
karel-m
fa759d8ee9
Merge pull request #371 from libtom/pr/baseNN-consistent-nul
consistent NUL byte handling in baseNN_encode
2018-03-28 09:30:56 +02:00
Karel Miko
6d33ecdbf9 consistent NUL byte handling in baseNN_encode 2018-03-28 07:46:31 +02:00
karel-m
ef1fba20b7
Merge pull request #365 from libtom/pr/base64-decode-less-relaxed
Make base64_decode relaxed mode less relaxed
2018-03-27 23:18:15 +02:00
Karel Miko
f0f1283dbb doc - add indexes for base64url_* 2018-03-27 21:06:31 +02:00
Karel Miko
798f257059 fix base64_decode comments 2018-03-27 21:06:31 +02:00
Karel Miko
229aec965c enhanced base64 related tests 2018-03-27 21:06:30 +02:00
Karel Miko
ad8067eaf7 doc for base64_sane_decode 2018-03-27 21:06:30 +02:00
Karel Miko
964f61709f introducing base64_sane_decode 2018-03-27 21:06:30 +02:00
Karel Miko
b10bf8fa0d make base64_decode relaxed mode less relaxed 2018-03-27 21:06:30 +02:00
Steffen Jaeckel
8b6d9dba76
Merge pull request #369 from libtom/demo/aesgcm
Add aesgcm demo
2018-03-27 19:39:13 +02:00
Steffen Jaeckel
e040ef1a59 add aesgcm demo
yeah I know, it's GNU specific, therefore it's also only added to the
GNU makefiles
2018-03-27 14:26:16 +02:00
Steffen Jaeckel
31088c0e9e add gcm_file() and gcm_filehandle() 2018-03-27 14:26:16 +02:00
Steffen Jaeckel
f4afa5d5bb
Merge pull request #368 from libtom/fix/base16-api
Improve base16
2018-03-27 12:58:18 +02:00
Steffen Jaeckel
ed5025398b check input of base16_decode() 2018-03-27 10:08:29 +02:00
Steffen Jaeckel
efbf38adce update docs 2018-03-27 10:08:29 +02:00
Steffen Jaeckel
73e5330c47 add inlen parameter to base16_decode() 2018-03-27 10:08:29 +02:00
Steffen Jaeckel
9b80d07487
Merge pull request #359 from vchong/ltc_ctr
ltc: ctr: improve performance
2018-03-27 02:25:25 +02:00
Steffen Jaeckel
bed9811d74 fix-up ctr_encrypt.c 2018-03-26 23:34:15 +02:00
Tetsuya Yoshizaki
431319f30b ltc: ctr: improve performance
When accel_ctr_encrypt() is not used, accel_ecb_encrypt() is used via
ecb_encrypt() instead. The accel_ecb_encrypt() is frequently called at
every single block process. VFP assembly code called from the
accel_ecb_encrypt() is protected by
tomcrypt_arm_neon_enable()/disable(). FIQ enable/disable and VFP
register save/restore (64bitx32 registers!) to/from memory are done in
the tomcrypt_arm_neon_enable()/disable(). These overhead exist in each
single block process cause the degradation of system performance
eventually. Cases where h/w accelerated AES-CTR did not show any effects
or showed less performance than pure software processing have been
observed.

This patch resolves the issue by increasing utilization rate of
accel_ctr_encrypt().

Signed-off-by: Tetsuya Yoshizaki <yoshizaki.tetsuya@socionext.com>
Signed-off-by: Victor Chong <victor.chong@linaro.org>
2018-03-26 23:29:07 +02:00
karel-m
f240aeadc2
Merge pull request #366 from libtom/pr/base64-char
base64 - use `char *` for Base64 strings
2018-03-26 21:06:43 +02:00
Karel Miko
e73bb36f3f update doc - base64 & char* 2018-03-26 16:42:19 +02:00
Karel Miko
065c89108e base64_* use char * for Base64 strings 2018-03-26 16:42:19 +02:00
karel-m
f72621e276
Merge pull request #367 from libtom/pr/base32-nul
base32_encode - make the output NUL-terminated
2018-03-26 16:41:25 +02:00
Karel Miko
981f3ef844 base32_encode - make the output NUL-terminated 2018-03-25 22:17:46 +02:00
Karel Miko
7a7b773b3c Revert "make base64_decode relaxed mode less relaxed"
This reverts commit e7117ea9df.
2018-03-25 19:41:43 +02:00
Karel Miko
e7117ea9df make base64_decode relaxed mode less relaxed 2018-03-25 15:46:49 +02:00
Steffen Jaeckel
e299431be8
Merge pull request #343 from libtom/feature/pkcs7
Add padding/depadding support
2018-03-25 14:12:35 +02:00
Steffen Jaeckel
bc2739347d Update makefiles 2018-03-23 22:01:41 +01:00
Steffen Jaeckel
daed6fe91e add padding documentation 2018-03-23 22:01:41 +01:00
Steffen Jaeckel
6a48f7d184 add padding tests 2018-03-23 22:01:41 +01:00
Steffen Jaeckel
ea79c5f8b1 use new padding functions in openssl-enc 2018-03-23 22:01:41 +01:00
Steffen Jaeckel
82482119df add padding module 2018-03-23 22:01:41 +01:00
Steffen Jaeckel
8a6ee82e17
Merge pull request #341 from libtom/review/prngs
Review of prngs
2018-03-23 22:00:56 +01:00
Steffen Jaeckel
39d4a14c29 improve fortuna_import()
This makes fortuna_import() kinda compliant to the "Update seed file"
behavior of the original paper.
It differs from the original behavior in that it allows to import
seed files which are larger	than 64 bytes.
2018-03-23 15:16:13 +01:00
Steffen Jaeckel
4fb3a6468e unify the prng's export() functions
This also makes fortuna_export() compliant to the "Write seed file"
behavior of the original paper.
2018-03-23 15:16:13 +01:00
Steffen Jaeckel
979a36b9bb add possibility to seed PRNG as if it's imported 2018-03-23 15:16:13 +01:00
Steffen Jaeckel
cccd1e3053 add comment to Fortuna docs 2018-03-23 15:16:13 +01:00
Steffen Jaeckel
d502869728 don't ignore additional data on SOBER128-PRNG import 2018-03-23 15:16:13 +01:00
Steffen Jaeckel
0c05e5386f fortuna_import() shouldn't ignore additional input 2018-03-23 15:16:13 +01:00
Steffen Jaeckel
04ce8cf613 ensure that fortuna has been seeded properly 2018-03-23 15:16:13 +01:00
Steffen Jaeckel
70fd5dd83d
Merge pull request #353 from libtom/minor/improvements
Minor improvements
2018-03-23 15:15:30 +01:00
Steffen Jaeckel
0dc3ab00d9 update/improve docs 2018-03-22 16:12:56 +01:00
Steffen Jaeckel
9d72e81ce8 use 'char*' in base32
... instead of 'unsigned char*'
2018-03-22 16:12:56 +01:00
Steffen Jaeckel
6f20738057 Update makefiles 2018-03-22 16:12:56 +01:00
Steffen Jaeckel
3d99d9b443 add base16_{de,en}code() 2018-03-22 16:12:56 +01:00
Steffen Jaeckel
b026c23b0a use do_compare_testvector() where possible 2018-03-22 16:12:56 +01:00
Steffen Jaeckel
e1cba4da7d fix der_test and rsa_test when compiling for msvc 2018-03-22 16:12:56 +01:00
Steffen Jaeckel
e36e512459 use DO() macro in file_test 2018-03-22 16:12:56 +01:00
Steffen Jaeckel
ffd4dd9e6a give a name to the public-key-type enum
... and add PK_STD to it
2018-03-22 16:12:56 +01:00
Steffen Jaeckel
ccc7cf4af2 improve/fix x509_decode_subject_public_key_info()
1. only pass in as many alg_id sequence elements as used
2. we weren't able to import into exactly sized public_key buffers
3. fix types in API signature
4. make `public_key` arg a `const*`
2018-03-22 14:39:16 +01:00
Steffen Jaeckel
ecd3fb714d add do_compare_testvector() 2018-03-22 14:39:16 +01:00
Steffen Jaeckel
4d17d1328d
Merge pull request #358 from libtom/travis/build-debug
Travis/build debug
2018-03-10 22:42:35 +01:00
Steffen Jaeckel
7fb108d884 add full-debug build to ci-tests 2018-03-10 17:37:54 +01:00
Steffen Jaeckel
3cfdd4bfdb fix compilation with debug output enabled 2018-03-10 11:34:05 +01:00
Steffen Jaeckel
2c07ff6fbe
Merge pull request #355 from MilkywayPwns/develop
renamed class -> klass
2018-03-10 10:43:14 +01:00
RektInator
b477e2c221 Renamed class->klass 2018-03-09 16:37:18 +01:00
karel-m
249d4694da
Merge pull request #356 from libtom/pr/keccak
Keccak
2018-03-08 09:58:46 +01:00
Karel Miko
e1ffc82bfb add keccak_NNN_init + keccak_process defines 2018-03-08 07:18:33 +01:00
Karel Miko
3cd8044290 Keccak 2018-03-08 07:18:33 +01:00
karel-m
2731b9a873
Merge pull request #357 from libtom/pr/357-msvc-warning
MSVC fix warning: signed/unsigned mismatch
2018-03-08 07:10:52 +01:00
Karel Miko
1871c5dff4 fix warning: signed/unsigned mismatch 2018-03-07 23:39:43 +01:00
Steffen Jaeckel
0a4f36d45d
Merge pull request #352 from fperrad/20180226_lint
some linting after ecc-asn1-minimal-part merge
2018-03-01 08:47:59 +01:00
Francois Perrad
1662910b40 refactor der_encode_asn1_length
in order to avoid comparison : len <= 0xffffffffffffffffULL
2018-02-28 16:19:15 +01:00
Francois Perrad
995e575521 variable 'len' must be initialized in all case 2018-02-27 22:16:57 +01:00
Francois Perrad
525b129466 fix indentation 2018-02-26 21:11:44 +01:00
karel-m
ea5b6cdce9
Merge pull request #351 from libtom/pr/fix-time_cipher_lrw
LTC_EASY & time_cipher_lrw
2018-02-26 12:55:41 +01:00
Karel Miko
733d3e5d7d fix: return with a value, in function returning void (LTC_EASY) 2018-02-26 09:52:57 +01:00
Steffen Jaeckel
64298c1819
Merge pull request #309 from libtom/pr/ecc-asn1-part-minimal
ECC-step1: ASN.1 changes required for future ECC enhancements
2018-02-25 23:34:09 +01:00
Steffen Jaeckel
d89326bbea update doc 2018-02-25 20:42:26 +01:00
Steffen Jaeckel
e4efd70382 add der_decode_custom_type_ex()
This merges der_decode_sequence_ex() into a new der_decode_custom_type_ex()
which can decode SEQUENCEs, SETs and custom types.
2018-02-25 20:42:26 +01:00
Steffen Jaeckel
9d03c38ea4 add flags to der_decode_sequence() 2018-02-25 20:42:26 +01:00
Karel Miko
3044b227f8 improve style of length-checks
As `der_decode_asn1_length()` will now also decode a uint64 with all 0xff
the old style would overflow in that check which "wouldn't be good"^TM.

The old way the length-checks were written were kind of fine when building
on 64bit architectures, but have the same problem on 32bit.
2018-02-25 20:42:26 +01:00
Steffen Jaeckel
7e2d163d1d add testvectors from [1]
[1] https://misc.daniel-marschall.de/asn.1/oid_facts.html
2018-02-25 20:42:26 +01:00
Steffen Jaeckel
756bc7fa21 use new ASN.1 functionality 2018-02-25 20:42:26 +01:00
Steffen Jaeckel
3431763275 update/add more DER tests 2018-02-25 20:42:26 +01:00
Steffen Jaeckel
b75c3ce9db remove LTC_ASN1_CONSTRUCTED and LTC_ASN1_CONTEXT_SPECIFIC 2018-02-25 20:42:26 +01:00
Steffen Jaeckel
799e147254 Update makefiles 2018-02-25 20:42:26 +01:00
Steffen Jaeckel
5230977219 implement the Custom-type de-/encoders 2018-02-25 20:42:26 +01:00
Steffen Jaeckel
0d02137a8e add required ASN.1 custom-types functions 2018-02-25 20:42:26 +01:00
Steffen Jaeckel
1b3a757345 add ASN.1-identifier functions 2018-02-25 20:42:26 +01:00
Steffen Jaeckel
509ad5222f add maps for ASN.1 en-/decoding 2018-02-25 20:42:26 +01:00
Steffen Jaeckel
64875d3a8f add ASN.1-length functions 2018-02-25 20:42:26 +01:00
Steffen Jaeckel
2a78ed31bf add CRYPT_PK_ASN1_ERROR 2018-02-25 20:42:26 +01:00
Steffen Jaeckel
54dd6ce840 fix naming of SubjectPublicKeyInfo de-&encoder 2018-02-25 20:42:26 +01:00
Karel Miko
fd7c2b8c1f no need for der_decode_subject_public_key_info_ex 2018-02-25 20:42:26 +01:00
Karel Miko
f155d3c530 ASN.1 changes required fo future ECC enhancements 2018-02-25 20:42:26 +01:00
Steffen Jaeckel
11cda2e274
Merge pull request #350 from libtom/fix/no-file-warnings
Fix warnings in `XMAC_file()` functions when compiling with `LTC_NO_FILE`.
2018-02-25 20:35:49 +01:00
Steffen Jaeckel
b1b40d48fa silencio por favor
Fix warnings in `XMAC_file()` functions when compiling with `LTC_NO_FILE`.
2018-02-25 17:17:04 +01:00
Steffen Jaeckel
5a3a12c9b3 don't export .travis.yml in future releases 2018-01-22 11:09:38 +01:00
Steffen Jaeckel
fa96614366 Update makefiles 2018-01-22 11:05:22 +01:00
Steffen Jaeckel
d68de4d26d show in SCRYPT etc. that we're on develop 2018-01-22 11:05:20 +01:00
Steffen Jaeckel
7de2d910fe libtomcrypt v1.18.1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 Comment: Gnu Privacy Tools
 
 iF4EABEIAAYFAlpltt4ACgkQrwyxdiHtrXIaugD+PZ1lGJ3Hhm5nQzVycQqp5ryc
 BbfeJhhrRVr1art3ftMA/2AOFXS0SEKtkgALCh1qJkK9YwZIZcDGPqSl/6uTEbKq
 =1DpZ
 -----END PGP SIGNATURE-----

Merge tag 'v1.18.1' into develop

libtomcrypt v1.18.1
2018-01-22 11:04:49 +01:00
Steffen Jaeckel
e08fd8630f Merge branch 'release/1.18.1' 2018-01-22 11:02:57 +01:00
Steffen Jaeckel
60df7d360a Fix 'fixme check'
The error produced by `make zipup` - but ignored by make - was:

```
...
fixme check
makefile_include.mk:448: recipe for target 'zipup' failed
make: [zipup] Error 123 (ignored)
mkdir -p libtomcrypt-...
```
2018-01-22 11:01:34 +01:00
Steffen Jaeckel
c7ff3bb86e Bump revision 2018-01-22 10:45:28 +01:00
Steffen Jaeckel
08e0424d52 Update changes 2018-01-22 10:06:54 +01:00
Steffen Jaeckel
4800543664 add -p switch to install commands in GNU makefiles
This fixes #340

[skip ci]

(cherry picked from commit fc6eb3ecf0)
2018-01-22 10:05:03 +01:00
Steffen Jaeckel
fc6eb3ecf0 add -p switch to install commands in GNU makefiles
This fixes #340

[skip ci]
2018-01-21 13:23:14 +01:00
Steffen Jaeckel
da7054820c Fix some latex formatting errors
[skip ci]
2018-01-20 15:31:00 +01:00
Tetsuya Yoshizaki
144839a8db ltc: ctr: update pt and ct after acceleration
Problem occurs in the condition of the following case:

1st decryption:
Decrypt a ciphertext whose length is a multiple of the block size (16B)
(len = n * block_size)
2nd decryption:
Decrypt the continuing ciphertext whose length is not a multiple of the
block size
(len = m * block_size + l)

In this case accel_ctr_encrypt() is firstly used at the 2nd decryption.
If pt and ct are not updated, the top (l = len % block_size) bytes of
decryption result are sometimes destroyed.

From: Tetsuya Yoshizaki <yoshizaki.tetsuya@socionext.com>
Signed-off-by: Tetsuya Yoshizaki <yoshizaki.tetsuya@socionext.com>
Signed-off-by: Victor Chong <victor.chong@linaro.org>
(cherry picked from commit d1d3ae2d1e)
2018-01-19 10:01:03 +01:00
Tetsuya Yoshizaki
d1d3ae2d1e ltc: ctr: update pt and ct after acceleration
Problem occurs in the condition of the following case:

1st decryption:
Decrypt a ciphertext whose length is a multiple of the block size (16B)
(len = n * block_size)
2nd decryption:
Decrypt the continuing ciphertext whose length is not a multiple of the
block size
(len = m * block_size + l)

In this case accel_ctr_encrypt() is firstly used at the 2nd decryption.
If pt and ct are not updated, the top (l = len % block_size) bytes of
decryption result are sometimes destroyed.

From: Tetsuya Yoshizaki <yoshizaki.tetsuya@socionext.com>
Signed-off-by: Tetsuya Yoshizaki <yoshizaki.tetsuya@socionext.com>
Signed-off-by: Victor Chong <victor.chong@linaro.org>
2018-01-19 09:39:25 +01:00
Steffen Jaeckel
5501572b35 Merge pull request #339 from libtom/minor_improvements
Minor improvements
(cherry picked from commit df8ed5c76b)
2018-01-15 00:39:26 +01:00
Steffen Jaeckel
df8ed5c76b
Merge pull request #339 from libtom/minor_improvements
Minor improvements
2018-01-14 22:31:24 +01:00
Steffen Jaeckel
aa8441409e fix some DER bugs
1. the "ask for required memory size" pattern wasn't implemented for
`der_decode_object_identifier()`
2. fix wrong "required memory size" returned by UTF-8 de- & encoder
2018-01-11 18:06:23 +01:00
Steffen Jaeckel
a898fde5b7 better debug output 2018-01-11 18:06:23 +01:00
Larry Bugbee
48a798261d
Merge pull request #334 from libtom/add-rabbit
Add Rabbit stream cipher
2017-12-18 04:16:32 -08:00
Larry Bugbee
8ef60f7b47 add rabbit 2017-12-17 08:05:41 -08:00
Larry Bugbee
784fc5313c makefile updates 2017-12-17 08:05:41 -08:00
Steffen Jaeckel
f4d2b37cf4 Merge pull request #337 from libtom/fix/prng_pthread
prevent undefined behavior with LTC_PTHREAD
(cherry picked from commit 45db2a9d9a)
2017-12-17 01:20:32 +01:00
Karel Miko
dd868600b3 fix staticfunc_name detection
(cherry picked from commit 6d71d657ef)
2017-12-17 01:05:53 +01:00
Steffen Jaeckel
10ad3b5b41 fixup type of type in ltc_asn1_list doc
(cherry picked from commit 5e3e7e5304)
2017-12-17 01:05:43 +01:00
Steffen Jaeckel
8ef3b9dffd
Merge pull request #335 from libtom/minor_cleanup
Minor cleanup
2017-12-17 00:43:35 +01:00
Steffen Jaeckel
35c4d157d0 as of POSIX.1-2008 gettimeofday() is obsolete 2017-12-16 16:02:00 +01:00
Steffen Jaeckel
b84bea8e78 easier calculation 2017-12-16 16:02:00 +01:00
Steffen Jaeckel
38143771d7 Update makefiles 2017-12-16 16:02:00 +01:00
Steffen Jaeckel
fd46a74331 re-order tomcrypt_mac.h 2017-12-16 16:02:00 +01:00
Steffen Jaeckel
8fffebc395 fix .travis.yml 2017-12-16 16:02:00 +01:00
Steffen Jaeckel
5c0b1b4bf6 add copy_or_zeromem() 2017-12-16 16:02:00 +01:00
Steffen Jaeckel
c0b7c8dd67 more output in debug build
make compare_testvector() a bit more verbose in debug build
2017-12-10 12:35:59 +01:00
Steffen Jaeckel
5546e85218 introduce LTC_EXTRALIBS
it's used for libraries added in the makefile
2017-12-10 12:35:59 +01:00
Karel Miko
6d71d657ef fix staticfunc_name detection 2017-12-10 12:35:59 +01:00
Steffen Jaeckel
5e3e7e5304 fixup type of type in ltc_asn1_list doc 2017-12-10 12:35:59 +01:00
Steffen Jaeckel
ea43e5dd68 suppress 'missing-braces' warnings 2017-12-10 12:35:59 +01:00
Steffen Jaeckel
196f25e32f there should be no need to pass CFLAGS when linking 2017-12-10 12:35:59 +01:00
Steffen Jaeckel
45db2a9d9a
Merge pull request #337 from libtom/fix/prng_pthread
prevent undefined behavior with LTC_PTHREAD
2017-12-10 12:35:01 +01:00
Steffen Jaeckel
c0eefc2b20 prevent undefined behavior with LTC_PTHREAD
as of `man pthread_mutex_init`:

"Attempting to initialize an already initialized mutex
results in undefined behavior."
2017-12-07 14:56:44 +01:00
Larry Bugbee
479cce29ab
Merge pull request #332 from libtom/sosemanuk--cleanup-comments-and-doc
sosemanuk updated comments and doc
2017-12-05 12:20:06 -08:00
Larry Bugbee
b6ae9ab000
grammatical change 2017-12-05 09:53:15 -08:00
Steffen Jaeckel
cec171c17e Update changes 2017-12-05 18:41:11 +01:00
Steffen Jaeckel
c7bdb247bf Update makefiles 2017-12-05 18:40:57 +01:00
Steffen Jaeckel
cfaf964284 Bump version 2017-12-05 18:40:49 +01:00
Steffen Jaeckel
ce93eaa577 add fixme-check to zipup make-target
(cherry picked from commit 6c83a2f363)
2017-12-05 18:39:46 +01:00
Steffen Jaeckel
f9e90f5b1c revert the change of MAXBLOCKSIZE
Currently this only plays a role in HMAC which still uses dynamic
allocation depending on the real blocksize defined by the hash
algorithm.
2017-12-05 17:46:08 +01:00
Steffen Jaeckel
f122e9b887 Merge pull request #329 from libtom/pr/sha3-blocksize
Correct SHA3 block sizes
(cherry picked from commit 64d028832b)
2017-12-05 17:43:46 +01:00
Steffen Jaeckel
64d028832b
Merge pull request #329 from libtom/pr/sha3-blocksize
Correct SHA3 block sizes
2017-12-05 17:41:44 +01:00
Karel Miko
8fdc46cc4b updated tv_gen outputs 2017-12-05 13:00:13 +01:00
Karel Miko
e89a1f2ae6 correct SHA3 block sizes 2017-12-05 13:00:13 +01:00
Larry Bugbee
83ee79ac56
change crypt() length data name to match doc 2017-12-05 01:02:10 -08:00
Larry Bugbee
c4fdf5c1fc
rephrase one sentence 2017-12-05 00:55:07 -08:00
Steffen Jaeckel
13d91e7c8b Merge pull request #327 from libtom/fix/ccm_segfault
Fix ccm_memory() cleaning user-supplied key
(cherry picked from commit 85ac227862)
2017-12-05 09:23:06 +01:00
Steffen Jaeckel
368dc60ff3 Merge pull request #326 from libtom/pr/ccm_process
fixes #323 ccm_process fails to process input buffer longer than 256
(cherry picked from commit 7c4c61d7ef)
2017-12-05 09:21:52 +01:00
Karel Miko
153b897984 helper.pl - detect sizeof without brackets
(cherry picked from commit b7e35e9f57)
2017-12-05 09:21:27 +01:00
Karel Miko
f10c2055dc helper.pl - improved detection of static functions without _
(cherry picked from commit 5c34fb2bad)
2017-12-05 09:21:17 +01:00
Karel Miko
a674de7408 Merge branch 'diamondo25-patch-2' into develop
Fix not defined warnings (-Wundef)

(cherry picked from commit 617698e544)
2017-12-05 09:20:41 +01:00
karel-m
7f6af93798 Merge pull request #320 from diamondo25/patch-1
Remove duplicate prototypes
(cherry picked from commit b4eae5231d)
2017-12-05 09:20:15 +01:00
karel-m
00ca140c57 Merge pull request #316 from libtom/pr/register-all
register_all_* should return CRYPT_OK on success
(cherry picked from commit e4763d940a)
2017-12-05 09:19:40 +01:00
Steffen Jaeckel
521d0737ea fix typo
(cherry picked from commit 442bb90a51)
2017-12-05 09:17:30 +01:00
Steffen Jaeckel
035e958edd Merge pull request #310 from libtom/pr/fix-changes
proper 1.18.0 date in changes
(cherry picked from commit a6c8be292e)
2017-12-05 09:16:30 +01:00
Larry Bugbee
f42bf2f942 updated comments and doc 2017-12-04 22:15:18 -08:00
Steffen Jaeckel
c6cccf9120
Merge pull request #330 from J08nY/fix/sosemanuk-doc
Fix docs build in Sosemanuk section.
2017-11-29 09:52:39 +01:00
J08nY
684c0890e7 Fix docs build in Sosemanuk section. 2017-11-28 17:13:09 +01:00
karel-m
af10ad084d
Merge pull request #328 from fperrad/20171122_lint
sosemanuk: some linting
2017-11-22 18:00:51 +01:00
Francois Perrad
77b0aff4e6 remove always true condition
ivlen is unsigned, so always >= 0
2017-11-22 10:34:45 +01:00
Francois Perrad
e985a9c111 add const 2017-11-22 10:34:42 +01:00
Karel Miko
2dec37044c chmod sosemanuk.c 2017-11-21 08:55:01 +01:00
Larry Bugbee
174f0aaf33
Merge pull request #322 from libtom/add-sosemanuk
add Sosemanuk
2017-11-20 14:35:56 -08:00
Steffen Jaeckel
85ac227862
Merge pull request #327 from libtom/fix/ccm_segfault
Fix ccm_memory() cleaning user-supplied key
2017-11-20 14:25:45 +01:00
Steffen Jaeckel
2a5f5cff16 test that ccm_memory() doesn't touch user-supplied key 2017-11-20 12:11:12 +01:00
Steffen Jaeckel
e05097e413 fix segfault in ccm_memory() with LTC_CLEAN_STACK
we shouldn't clean user-supplied variables
2017-11-20 12:11:12 +01:00
Larry Bugbee
108ddf5b50 add Sosemanuk 2017-11-20 02:41:30 -08:00
Larry Bugbee
807ae09916 Update makefiles 2017-11-20 02:40:45 -08:00
Steffen Jaeckel
7c4c61d7ef
Merge pull request #326 from libtom/pr/ccm_process
fixes #323 ccm_process fails to process input buffer longer than 256
2017-11-10 00:41:50 +01:00
Karel Miko
08dee27359 fixes #323 ccm_process fails to process input buffer longer than 256 bytes 2017-11-09 19:47:51 +01:00
Steffen Jaeckel
28d44b35f3
Merge pull request #325 from libtom/pr/new_63
Statically allocated key in hmac_state

This fixes #63 and closes #64
2017-11-09 19:44:28 +01:00
Pascal Brand
c2ce5a18e7 Statically allocated key in hmac_state
Signed-off-by: Pascal Brand <pascal.brand@st.com>
2017-11-09 15:32:01 +01:00
Steffen Jaeckel
b159ca0d12 add missing file footers
[skip ci]
2017-11-09 15:31:51 +01:00
Steffen Jaeckel
f5e5c6eed7 simplify calculation 2017-11-06 12:13:16 +01:00
Karel Miko
b7e35e9f57 helper.pl - detect sizeof without brackets 2017-11-05 17:08:02 +01:00
Karel Miko
5c34fb2bad helper.pl - improved detection of static functions without _ 2017-11-05 11:40:01 +01:00
Karel Miko
617698e544 Merge branch 'diamondo25-patch-2' into develop
Fix not defined warnings (-Wundef)
2017-11-03 17:06:23 +01:00
Karel Miko
053996dc5e Fix _POSIX_C_SOURCE not defined warning (-Wundef) 2017-11-03 17:05:56 +01:00
Erwin Oegema
5a6c258679 Fix LTC_TEST_DBG not defined warning (-Wundef) 2017-11-03 17:04:32 +01:00
karel-m
b4eae5231d
Merge pull request #320 from diamondo25/patch-1
Remove duplicate prototypes
2017-11-03 17:01:51 +01:00
Erwin Oegema
b1115b4e8f
Remove duplicate prototypes 2017-11-01 15:30:36 +01:00
Larry Bugbee
9b65d46584 Merge pull request #318 from libtom/add-salsa20
Add salsa20
2017-10-24 13:28:55 -07:00
Larry Bugbee
f1da5783eb fixed C90 warning: value after decl
warning: ISO C90 forbids mixed declarations and code
2017-10-23 22:40:21 -07:00
Larry Bugbee
74dcbc810f fixed C90 warning: value after decl
warning: ISO C90 forbids mixed declarations and code
2017-10-23 22:00:45 -07:00
Larry Bugbee
6ada199d7d added keystream regression test 2017-10-23 21:43:17 -07:00
Larry Bugbee
4341424ce9 Add Salsa20 2017-10-23 15:45:02 -07:00
Larry Bugbee
aa5a2e5a26 Update makefiles 2017-10-23 15:41:04 -07:00
Karel Miko
6c5dea3e61 __declspec(deprecated) is supported since Visual Studio 2008 2017-10-23 20:18:59 +02:00
Steffen Jaeckel
80665ac576 Merge pull request #317 from libtom/pr/base32
Base32
2017-10-22 11:04:40 +02:00
Karel Miko
854a145c92 Base32: alpha_id >> id 2017-10-20 20:00:46 +02:00
Karel Miko
3fc98adaf5 tuning base32 stuff 2017-10-20 19:51:40 +02:00
Karel Miko
8674eb3097 base32_decode + base32_encode 2017-10-20 19:51:40 +02:00
Karel Miko
035205af85 update makefiles 2017-10-20 19:51:40 +02:00
Steffen Jaeckel
c8edd3c2e9 Merge pull request #315 from libtom/improve/travis_build
Improve/travis build
2017-10-20 15:44:41 +02:00
Steffen Jaeckel
1fc46a0f15 fix travis detection in coverage.sh 2017-10-19 09:54:47 +02:00
Steffen Jaeckel
742a6c7a33 fix paths 2017-10-19 09:54:47 +02:00
Steffen Jaeckel
b070672f59 move ci scripts to .ci/ 2017-10-19 09:54:47 +02:00
Steffen Jaeckel
c5caac505b print stderr on the fly also to console 2017-10-19 09:54:47 +02:00
Steffen Jaeckel
29c640f7e1 enable parallel builds 2017-10-19 09:54:47 +02:00
Steffen Jaeckel
30948fc0e9 move valgrind build to own travis instance
testing under valgrind takes forever, so we start a separate build-job
2017-10-19 09:54:47 +02:00
Steffen Jaeckel
384f82d0a9 also create coverage for gmp_desc 2017-10-19 09:54:47 +02:00
Steffen Jaeckel
91e1d04831 incorporate scan_build.sh in meta_builds.sh 2017-10-19 09:54:47 +02:00
Steffen Jaeckel
65e1eb68e9 fix missing valgrind & don't be that noisy 2017-10-19 09:54:47 +02:00
Steffen Jaeckel
ce3da7c06f use correct set of parameters 2017-10-19 09:54:47 +02:00
Steffen Jaeckel
2dad6d30bf add meta_builds.sh
This fixes #267 #268 #269
2017-10-19 09:54:47 +02:00
Steffen Jaeckel
18ba0cbda9 fix tv_gen.c for scan-build run 2017-10-19 09:54:47 +02:00
Steffen Jaeckel
3f024c0685 only run scan_build for clang 2017-10-19 09:54:47 +02:00
Steffen Jaeckel
315d03ccd5 use parameters instead of pre-defined values 2017-10-19 09:54:47 +02:00
karel-m
e4763d940a Merge pull request #316 from libtom/pr/register-all
register_all_* should return CRYPT_OK on success
2017-10-19 07:29:05 +02:00
Karel Miko
152513477b fix return value of register_all_*() 2017-10-18 22:35:16 +02:00
karel-m
d470f8a7ab Merge pull request #314 from libtom/pr/serpent-cipher
Serpent cipher
2017-10-18 17:24:18 +02:00
Karel Miko
aa3e5a43bb fix warning: Value stored to 'e' is never read 2017-10-18 17:21:46 +02:00
Karel Miko
a37a93aecc doc update 2017-10-18 17:21:46 +02:00
Karel Miko
c5735be01e update makefiles 2017-10-18 17:21:46 +02:00
Karel Miko
5a63e7ef7d Serpent cipher 2017-10-18 17:21:46 +02:00
Steffen Jaeckel
49f732101c Merge pull request #297 from libtom/improve/mpi_selection
Improve MPI provider selection
2017-10-18 08:47:10 +02:00
Steffen Jaeckel
d709e3d9a3 Update doc
[skip ci]
2017-10-18 08:46:17 +02:00
Steffen Jaeckel
1a892960fe don't be that strict 2017-10-18 08:46:17 +02:00
Steffen Jaeckel
bfef6350a2 deprecate init_{LTM,TFM,GMP} 2017-10-18 08:46:17 +02:00
Steffen Jaeckel
beb1e279ec add LTC_DEPRECATED 2017-10-18 08:46:17 +02:00
Steffen Jaeckel
735566993b add crypt_mp_init() 2017-10-18 08:46:17 +02:00
Steffen Jaeckel
fdc6cd2013 improve tests and timing in regards to MPI provider selection 2017-10-18 08:46:17 +02:00
Steffen Jaeckel
442bb90a51 fix typo 2017-10-18 08:45:56 +02:00
Steffen Jaeckel
6c83a2f363 add fixme-check to zipup make-target 2017-10-18 08:45:56 +02:00
karel-m
dd95518db4 Merge pull request #312 from libtom/pr/idea-cipher
IDEA cipher
2017-10-18 07:08:04 +02:00
Karel Miko
ee484a0bc0 burn_stack 2017-10-16 23:15:54 +02:00
Karel Miko
a2dd766ed5 IDEA cipher 2017-10-16 21:20:33 +02:00
Karel Miko
295bde14c1 update makefiles 2017-10-16 21:19:54 +02:00
Steffen Jaeckel
a6c8be292e Merge pull request #310 from libtom/pr/fix-changes
proper 1.18.0 date in changes
2017-10-12 19:41:52 +02:00
karel-m
437cb0207a proper 1.18.0 date in changes 2017-10-12 17:19:38 +02:00
Steffen Jaeckel
44b15a76aa add issue and PR templates 2017-10-10 18:08:35 +02:00
Steffen Jaeckel
976e7c4e31 Merge tag 'v1.18.0' into develop
libtomcrypt v1.18.0
2017-10-10 15:52:19 +02:00
Steffen Jaeckel
0676c9aec7 Merge branch 'release/1.18.0' 2017-10-10 15:51:36 +02:00
Steffen Jaeckel
c165f3a23a Update makefiles 2017-10-10 15:48:35 +02:00
Steffen Jaeckel
a7d0008f52 bump version 2017-10-10 15:48:35 +02:00
Steffen Jaeckel
b3c9f586dc also patch doc/Doxyfile automatically 2017-10-10 15:48:35 +02:00
Steffen Jaeckel
62143d96bd fix doxygen warning 2017-10-10 15:43:26 +02:00
Steffen Jaeckel
58b5e5c7ca improve README
[skip ci]
2017-10-10 15:19:23 +02:00
Steffen Jaeckel
ea5cb8bff6 make it possible to use LTC_NOTHING with a math provider 2017-10-10 15:19:01 +02:00
Steffen Jaeckel
233ef83530 suppress some warnings when compiling with mingw-gcc
[skip ci]
2017-10-10 14:29:34 +02:00
Steffen Jaeckel
e40482f82a review README.md and changes 2017-10-09 18:26:38 +02:00
Steffen Jaeckel
dd0bbdeac0 increase default value of Miller-Rabin rounds to 40 2017-10-09 17:58:47 +02:00
Steffen Jaeckel
4503ddcfb0 improve wording
[skip ci]
2017-10-08 01:05:12 +02:00
Steffen Jaeckel
6493f0fe94 Merge pull request #308 from libtom/pr/avoid-dulplicit-manes
Aviod duplicit rc4.c sober128.c
2017-10-08 00:57:47 +02:00
Steffen Jaeckel
bab6af73e5 fix check_source() 2017-10-07 18:09:13 +02:00
Karel Miko
2041f9528e update makefiles 2017-10-07 11:35:27 +02:00
Karel Miko
959121253d rename duplicit rc4.c sober128.c 2017-10-07 11:35:10 +02:00
Steffen Jaeckel
adcd6ee9fd only try to print the version from git if there's git installed 2017-10-03 19:54:27 +02:00
Steffen Jaeckel
58b71292c3 fixup caed025f8a
Simply always use an unsigned long long for ltc_mp_digit on 64-bit besides
when using MSVC.
2017-10-03 19:20:33 +02:00
Steffen Jaeckel
e438dbc3bf add ltc_mp_digit to sizes and tests 2017-10-03 18:43:32 +02:00
Steffen Jaeckel
caed025f8a define ltc_mp_digit as 'unsigned long' resp 'unsigned long long' for x32
This fixes #306
2017-10-03 18:42:26 +02:00
Steffen Jaeckel
cb34ef8626 fix-up LTC_FAST related defines/typedefs 2017-10-03 13:32:17 +02:00
Steffen Jaeckel
bb291cbbeb init_GMP() works perfectly fine 2017-10-02 14:06:42 +02:00
Steffen Jaeckel
01a61e64ef Merge pull request #302 from libtom/fix/pr/301
re-work PK crypto im- & export
2017-10-02 14:05:58 +02:00
Steffen Jaeckel
7f302dab54 make sure size is valid 2017-10-02 01:18:36 +02:00
Steffen Jaeckel
c702ac6f1c improve rsa_test a bit 2017-10-02 01:18:19 +02:00
Karel Miko
67f9064b71 missing rsa_free in _rsa_issue_301 test 2017-10-01 22:56:47 +02:00
Steffen Jaeckel
ce7ae84d0d correctly fix decoding of SubjectPublicKeyInfo 2017-10-01 22:56:47 +02:00
Steffen Jaeckel
db7d7a866e Revert "fix bit-length check in der_decode_raw_bit_string()"
This reverts commit 2b8d83ff93da0764f19f494de0a8211515428cef.
2017-10-01 22:56:47 +02:00
Steffen Jaeckel
e5de0a0004 Revert "catch case where blen%8 != 0"
This reverts commit 548ee347c0d3366a41e5fa28ac3c0b44b362fdb5.
2017-10-01 22:56:47 +02:00
Steffen Jaeckel
d1d9566250 format code 2017-10-01 22:56:47 +02:00
Steffen Jaeckel
30b3a9a986 remove {MIN,MAX}_RSA_SIZE 2017-10-01 22:56:47 +02:00
Steffen Jaeckel
40e4a66693 catch case where blen%8 != 0 2017-10-01 22:56:47 +02:00
Steffen Jaeckel
3fef07c03e also clear bits in der_decode_raw_bit_string() 2017-10-01 22:56:47 +02:00
Steffen Jaeckel
1d20c32a45 update README
[skip ci]
2017-10-01 22:56:47 +02:00
Steffen Jaeckel
9cfbaa83a3 mostly remove MAX_RSA_SIZE 2017-10-01 22:56:47 +02:00
Steffen Jaeckel
ab02d2e450 fix rsa_import() of MAX_RSA_SIZE'ed keys
The ASN1 encoded RSA key contains two MPI's therefore MAX_RSA_SIZE / 8
isn't enough.
2017-10-01 22:56:47 +02:00
Steffen Jaeckel
0500aaec45 add tests for MAX_RSA_SIZE sized openssl-standard RSA keys 2017-10-01 22:56:47 +02:00
Steffen Jaeckel
efa089e211 fixup #290 2017-10-01 22:56:47 +02:00
Steffen Jaeckel
15eab9702b don't over-allocate that much in der_decode_subject_public_key_info() 2017-10-01 22:56:46 +02:00
Steffen Jaeckel
0b04279890 fix bit-length check in der_decode_raw_bit_string() 2017-10-01 22:56:46 +02:00
Steffen Jaeckel
062fc3ffe3 print info when doing a debug build 2017-10-01 22:56:46 +02:00
Rob Swindell
6da2211ee9 Update rsa_import.c
Bug-fix: MAX_RSA_SIZE is the maximum RSA key size in *bits* (as commented in tomcrypt_custom.h), so the proper conversion to bytes (as the argument value to XCALLOC) would be to divide by 8 (bits per byte), not multiply by 8. This excessive allocation (32 Kbytes instead of 512 bytes) is readily apparent in memory-constrained environments.
2017-10-01 22:56:46 +02:00
karel-m
c2f0675ede Merge pull request #304 from libtom/pr/fix-303
missing dsa_free
2017-10-01 17:24:08 +02:00
Karel Miko
98536fa5bf add missing dsa_free to _dsa_wycheproof_test - fixes #303 2017-10-01 15:40:19 +02:00
Steffen Jaeckel
f4802ef40a add ltc_math_descriptor to crypt_sizes 2017-09-30 13:01:08 +02:00
Steffen Jaeckel
9ff889b330 Update makefiles 2017-09-27 21:37:23 +02:00
Steffen Jaeckel
07c5e6b0a4 bump version 2017-09-27 21:37:21 +02:00
Steffen Jaeckel
5f89a5ce2c Merge pull request #298 from libtom/strict_der_decoding
initialize 'flags' etc. to invalid values before trying to decode
2017-09-27 21:34:30 +02:00
Steffen Jaeckel
4a8bfc0a21 introduce CRYPT_INPUT_TOO_LONG 2017-09-27 21:34:11 +02:00
Steffen Jaeckel
13cb43ad4c initialize 'flags' etc. to invalid values before trying to decode 2017-09-27 21:34:11 +02:00
Steffen Jaeckel
8935cd9a8a Merge pull request #299 from libtom/pr/libtool-cygwin
libtool + cygwin
2017-09-27 21:33:29 +02:00
Karel Miko
9c2c9f8af4 libtool on cygwin needs -no-undefined 2017-09-27 21:25:19 +02:00
Steffen Jaeckel
5049463774 bump the libtool version
yeah, helper.pl doesn't update it anymore automagically...
we'll probably find a new way to do that in the future...
or we keep on updating it manually...

This fixes #300
2017-09-27 21:19:33 +02:00
Steffen Jaeckel
f868a16a44 Update makefiles 2017-09-25 16:56:59 +02:00
Steffen Jaeckel
20c6bf812b bump version 2017-09-25 16:56:57 +02:00
Karel Miko
83e7f4a1c7 keep dh_key.x instead of free'ing it
the approach before probably saves some bytes on the heap, but it's
inconsistent in regards to what we normally do
2017-09-25 15:35:29 +02:00
Steffen Jaeckel
f7c0b25146 add missing math constants 2017-09-23 11:42:05 +02:00
Steffen Jaeckel
91a10318f1 Merge pull request #296 from libtom/cleanup/3
General clean-up 3
2017-09-21 20:46:41 +02:00
Karel Miko
ea43d9a1d2 Fix openssl-enc compilation 2017-09-21 18:37:37 +02:00
Steffen Jaeckel
8f7986bbb2 fix coverage_more.sh after updating hashsum 2017-09-21 18:37:37 +02:00
Steffen Jaeckel
5bb63f1bca hashsum: improve help 2017-09-21 18:37:37 +02:00
Steffen Jaeckel
eb75c894db hashsum: cleanup at exit 2017-09-21 18:37:37 +02:00
Steffen Jaeckel
312247fa0b better comments for PKCS#5 2017-09-21 18:37:37 +02:00
Steffen Jaeckel
da4f854329 make sure chacha_crypt() can only be called after setting the IV 2017-09-21 18:37:37 +02:00
Steffen Jaeckel
342a10cc14 make PK_MAX_RETRIES a config option 2017-09-21 18:37:37 +02:00
Steffen Jaeckel
a278f72659 skip comment lines when checking hashes
[skip ci]
2017-09-20 17:43:07 +02:00
Steffen Jaeckel
9a83397376 catch case where we could BOF should_buffer[]
[skip ci]
2017-09-20 17:29:05 +02:00
Steffen Jaeckel
b6213309ca Merge pull request #197 from libtom/update/doc
Update documentation
2017-09-20 15:14:54 +02:00
Steffen Jaeckel
f8d132ea03 update changes
[skip ci]
2017-09-20 15:14:10 +02:00
Steffen Jaeckel
7cc9aad5cc remove TODO 2017-09-20 15:06:40 +02:00
Steffen Jaeckel
9fb08af23d fix location of some of the tables
this fixes the last open issue of #54
2017-09-20 15:06:40 +02:00
Steffen Jaeckel
2d3a921de4 align code
[skip-ci]
2017-09-20 15:06:40 +02:00
Steffen Jaeckel
4f7747eaec DSA not DH 2017-09-20 15:06:40 +02:00
Steffen Jaeckel
c210f24853 IV is short for 'initialization vector' 2017-09-20 15:06:40 +02:00
Karel Miko
fff9fee129 DSA new functions - doc 2017-09-20 15:06:40 +02:00
Karel Miko
f3f839ec6c BLAKE2s + BLAKE2b MAC doc 2017-09-20 15:06:40 +02:00
Karel Miko
50e52d0b4c poly1305 doc 2017-09-20 15:06:40 +02:00
Karel Miko
11827feef3 ChaCha20-Poly1305 doc 2017-09-20 15:06:40 +02:00
Steffen Jaeckel
35d920a688 moar doc
[skip ci]
2017-09-20 15:06:40 +02:00
Steffen Jaeckel
8b3af12d70 add radix_to_bin() docs
[skip ci]
2017-09-20 15:06:40 +02:00
Steffen Jaeckel
78e9601eb6 review "Configuring and Building the Library"
[skip ci]
2017-09-20 15:06:40 +02:00
Steffen Jaeckel
13b484f8a5 moar doc
[skip ci]
2017-09-20 15:06:40 +02:00
Steffen Jaeckel
0742a99fb5 update README
[skip ci]
2017-09-20 15:06:40 +02:00
Steffen Jaeckel
fc65352261 moar doc
[skip ci]
2017-09-20 15:06:40 +02:00
Steffen Jaeckel
dd01232bcb review stream ciphers
[skip ci]
2017-09-20 15:06:40 +02:00
Steffen Jaeckel
2ccb3fb53d update OCB3 doc
[skip ci]
2017-09-20 15:06:40 +02:00
Steffen Jaeckel
56d17c8e55 some more doc updates 2017-09-20 15:06:40 +02:00
Karel Miko
5d74fee9dc doc tuning 2017-09-20 15:06:40 +02:00
Karel Miko
468245ce56 doc: stream ciphers 2017-09-20 15:06:40 +02:00
Karel Miko
9584975a6d some crypt.tex hacking 2017-09-20 15:06:40 +02:00
Karel Miko
7edc41162d fix crypt.pdf building 2017-09-20 15:06:40 +02:00
Steffen Jaeckel
39650b4a08 add doc of new RSA API functions 2017-09-20 15:06:40 +02:00
Steffen Jaeckel
583b2b3938 document PKCS#1 v1.5 signatures w/o ASN.1 2017-09-20 15:06:40 +02:00
Steffen Jaeckel
09c3196930 use v1.18.0 instead of v1.18 2017-09-20 15:06:40 +02:00
Steffen Jaeckel
9a0e208f5e add 'ltc_mp_digit' docs 2017-09-20 15:06:40 +02:00
Steffen Jaeckel
728bc4a6a4 update "Primality Testing" 2017-09-20 15:06:40 +02:00
Steffen Jaeckel
ce68fa34ee add rand_bn_X() doc 2017-09-20 15:06:40 +02:00
Steffen Jaeckel
a0a7daea6f add termdoc option to view documentation on the terminal 2017-09-20 15:06:40 +02:00
Steffen Jaeckel
01cb819c48 trim trailing spaces 2017-09-20 15:06:40 +02:00
Steffen Jaeckel
a9d9466694 beautify some strings
[skip-ci]
2017-09-20 15:06:28 +02:00
karel-m
632d2b757b Merge pull request #291 from libtom/pr/dsa-test-wycheproof
dsa_verify_hash fix + dsa_wycheproof_test
2017-09-20 13:23:51 +02:00
Karel Miko
66abefc54b add dsa_wycheproof_test + fix old dsa tests 2017-09-20 11:59:03 +02:00
Karel Miko
155e29dd68 dsa_verify_hash must set stat=0 on any error 2017-09-20 11:58:32 +02:00
Steffen Jaeckel
4b36f0654f Add 'Installation' section
This closes #293

[skip-ci]
2017-09-19 14:19:43 +02:00
Steffen Jaeckel
d169aa2af2 Merge pull request #290 from libtom/pr/write-strings
Add -Wwrite-strings (char* vs. const char*)
2017-09-19 13:24:13 +02:00
Karel Miko
b2813480bf LTC_CFLAGS += -Wwrite-strings 2017-09-18 12:35:03 +02:00
Karel Miko
5057af3ef1 fix char* vs. const char* 2017-09-18 12:35:03 +02:00
karel-m
565be29bb0 Merge pull request #292 from libtom/pr/write-strings-test-part
Partial changes from #290 (char* vs. const char* - tests related part)
2017-09-18 12:34:14 +02:00
Karel Miko
3b663a199f fix char* vs. const char* (tests related part) 2017-09-18 09:24:19 +02:00
karel-m
0ceb1c1213 Merge pull request #289 from libtom/pr/scan-build-status-bugs
scan-build --status-bugs, related to #287
2017-09-15 06:47:08 +02:00
Karel Miko
84fcd4aec7 scan_build --status-bugs - related to #287 2017-09-14 23:07:18 +02:00
karel-m
04cc6cc652 Merge pull request #288 from libtom/pr/fix-tv_gen-scan-build
Fix scan-build bug/warning in tv_gen - related to #287
2017-09-14 23:05:10 +02:00
Karel Miko
3ddb45a6b7 fix scan-build bug/warning in tv_gen 2017-09-14 20:32:47 +02:00
Karel Miko
5e71849942 properly exit dsa_int_validate_pqg 2017-09-14 20:07:32 +02:00
karel-m
5934eb3b7c Merge pull request #280 from libtom/pr/fix-dsa-cdf
fixes necessary to pass DSA cdf tests
2017-09-14 19:10:13 +02:00
Karel Miko
bb6a7e1c6c if dsa_int_validate_* fails return consistently CRYPT_INVALID_PACKET 2017-09-14 18:53:09 +02:00
Karel Miko
a990a8252e mp_clear_multi - reverse the order 2017-09-14 18:51:02 +02:00
Karel Miko
6200f301a5 add comment #ifdef LTC_SOURCE + internal helper functions 2017-09-14 18:49:42 +02:00
Karel Miko
d91d59421f fix de-referencing stat before checking for NULL 2017-09-14 18:48:04 +02:00
Karel Miko
444d9f3fb7 do dsa_int_validate_* in dsa_import 2017-09-14 17:38:12 +02:00
Karel Miko
fd94e9540f move qord trest to dsa_int_validate_pqg 2017-09-14 17:37:39 +02:00
Karel Miko
9765befd6b do dsa_int_validate_pqg in dsa_set_pqg_dsaparam 2017-09-14 17:29:59 +02:00
Karel Miko
45b6b947da dsa_int_validate_primes & LTC_MILLER_RABIN_REPS 2017-09-14 17:21:48 +02:00
Karel Miko
c806ea17f9 fix dsa_int_validate_xy 2017-09-14 17:21:48 +02:00
Karel Miko
1ea4fecc81 FIPS 186-4 DSA validity tests 2017-09-14 17:21:48 +02:00
Karel Miko
5fb4c9f89b another approach for dsa_int_validate_* 2017-09-14 17:21:48 +02:00
Karel Miko
aa5b9dafc4 fix dsa_int_validate_key related compiler warnings 2017-09-14 17:21:48 +02:00
Steffen Jaeckel
1625ce4001 re-factor & re-name internal dsa key validation 2017-09-14 17:21:48 +02:00
Karel Miko
053ba6d600 introducing dsa_verify_key_ex 2017-09-14 17:21:48 +02:00
Karel Miko
2505e3b609 add basic validity tests to dsa_set 2017-09-14 17:21:48 +02:00
Karel Miko
c908eb16bb Merge pull request #283 from apjanke-build-on-mac-darnit 2017-09-14 17:15:53 +02:00
Steffen Jaeckel
2dd446dbdb clang and -Wno-missing-field-initializers 2017-09-14 17:11:06 +02:00
Andrew Janke
cfce691a50 initialize ltc_mp to force allocation under all compilers, including clang on macOS 2017-09-14 17:07:49 +02:00
karel-m
32d60ac134 Merge pull request #278 from libtom/pr/fix-dsa-wycheproof
DSA wycheproof tests
2017-09-10 14:00:54 +02:00
Karel Miko
c927e4315a dsa_verify_hash: fix wycheproof - appending unused 0's 2017-09-02 14:16:52 +02:00
Karel Miko
7e4bd971de dsa_verify_hash: properly handle (=reject) negative r, s 2017-09-02 14:16:52 +02:00
karel-m
aade47c62c Merge pull request #286 from libtom/pr/fix-dsa-rsa-trouble
Fix DSA dependency on RSA
2017-09-01 20:15:52 +02:00
Karel Miko
59857ba5e0 fix DSA dependency on RSA #285 2017-09-01 18:24:15 +02:00
Karel Miko
87f94e1f0d Merge branch 'apjanke-add-sizes-and-constants-demo-targets' into release/1.18.0
PR #282
2017-08-31 19:08:00 +02:00
Andrew Janke
f5353a613d makefile.msvc: add targets for sizes and constants demos 2017-08-31 18:55:31 +02:00
Andrew Janke
d7461a91bc makefile.mingw: add targets for sizes and constants demos 2017-08-31 18:55:31 +02:00
Andrew Janke
509086253e makefile.unix: add targets for sizes and constants demos 2017-08-31 18:55:31 +02:00
Karel Miko
c04e8a397f Merge branch 'apjanke-fix-typos-in-makefile.shared-help' into release/1.18.0
PR #284
2017-08-31 18:52:53 +02:00
Andrew Janke
39c721c8da makefile.shared: protect commas in function calls through variable substitution 2017-08-31 05:51:37 -04:00
Karel Miko
9ea6247da1 Revert "add basic validity tests to dsa_set"
This reverts commit 9003e87e5a.
2017-08-30 00:03:04 +02:00
Karel Miko
9003e87e5a add basic validity tests to dsa_set 2017-08-30 00:01:00 +02:00
karel-m
a86287b698 Merge pull request #277 from libtom/pr/fix-rsa-wycheproof
RSA wycheproof tests
2017-08-29 22:13:35 +02:00
Steffen Jaeckel
43e6860925 fix RSA - wycheproof "wrong length" 2017-08-29 17:26:14 +02:00
Karel Miko
fe9af6cfbd RSA: handle wycheproof test vectors - Legacy:missing NULL 2017-08-29 17:26:14 +02:00
Steffen Jaeckel
a22140f94c oops, fix .common_uninstall make-target
[skip-ci]
2017-08-28 17:31:44 +02:00
Steffen Jaeckel
e6d23834ae Merge pull request #276 from libtom/pr/fix-gcm-iv
GCM zero size IV
2017-08-28 17:28:30 +02:00
Karel Miko
105abdd8cd GCM: 0 size IV is not valid #273 2017-08-28 16:10:30 +02:00
Steffen Jaeckel
042df8ca20 Merge pull request #279 from libtom/cleanup/2
Yet another clean-up and bugfix PR
2017-08-28 09:14:25 +02:00
Steffen Jaeckel
bb42345234 fix missing registration of PRNG's in ltcrypt 2017-08-26 12:07:24 +02:00
Steffen Jaeckel
b49ce35b2c fix DH timing when compiling with TFM support 2017-08-26 12:05:53 +02:00
Steffen Jaeckel
33e70b427a CRYPT_INVALID_KEYSIZE isn't only used for block ciphers 2017-08-26 12:03:35 +02:00
Steffen Jaeckel
041b7aa5c0 Update makefiles 2017-08-23 22:35:35 +02:00
Steffen Jaeckel
0afbefc549 bump version 2017-08-23 22:35:32 +02:00
Larry Bugbee
725532c6b6 Merge pull request #272 from libtom/update-demos-demo_dynamic.py
Update demos demo dynamic.py - everything is green
2017-08-19 18:19:00 -07:00
Larry Bugbee
de6ac748c7 refine comments 2017-08-19 16:29:48 -07:00
Larry Bugbee
3794ecaf94 Update demo_dynamic.py
removed trailing spaces
2017-08-18 20:34:03 -07:00
Larry Bugbee
631de35ee3 Update and rename demo_dynamic.py3 to demo_dynamic.py
this version runs under python2 and python3 so only one version need be distributed
2017-08-17 21:11:59 -07:00
Larry Bugbee
ae16210939 Delete demo_dynamic.py 2017-08-17 21:06:50 -07:00
Steffen Jaeckel
d502c247db Merge pull request #271 from libtom/rel-1.18-sm-demo-cleanup
Rel 1.18 sm demo cleanup
2017-08-17 10:11:30 +02:00
Larry Bugbee
147a406243 Update demo_dynamic.py3
clean comments
2017-08-16 23:50:23 -07:00
Larry Bugbee
5d3e2d1e90 Update demo_dynamic.py
clean comments
2017-08-16 23:49:39 -07:00
Steffen Jaeckel
7a64e13845 Merge pull request #270 from libtom/minor_changes
Minor changes
2017-08-16 13:42:22 +02:00
Steffen Jaeckel
1fa8caff6c fix call to gettimeofday()
as of `man gettimeofday`
"The use of the timezone structure is obsolete;
the tz argument should normally be specified as NULL."
2017-08-16 11:52:40 +02:00
Steffen Jaeckel
bb9d397975 default ChaCha to ChaCha20 2017-08-16 11:49:25 +02:00
karel-m
385bae81a1 Merge pull request #266 from libtom/pr/fix-lint-issues
Fix lint issues
2017-08-13 18:16:55 +02:00
Karel Miko
de8a53a2e5 ocb3_test cosmetics
[skip ci]
2017-08-13 18:15:44 +02:00
Karel Miko
2a52c68f2e fix lint issues from #199 2017-08-13 14:54:39 +02:00
Steffen Jaeckel
daaab843f3 Merge pull request #263 from libtom/pr/crypt_sizes
missing items in crypt sizes
2017-08-11 13:27:23 +02:00
Larry Bugbee
6bbb450d40 remove trailing space 2017-08-11 02:17:31 -07:00
Larry Bugbee
8b703c1505 remove traling space for Travis 2017-08-11 02:16:26 -07:00
Larry Bugbee
bab115c631 converted demo_dynamic.py to Python3 2017-08-11 01:27:21 -07:00
Larry Bugbee
ee55c4e51c minor cleanup and formatting changes 2017-08-11 01:21:59 -07:00
Larry Bugbee
695c3b235d Update demo_dynamic.py
added error strings (with function returning a string type) and a decryption to ChCha.
2017-08-10 16:40:28 -07:00
Steffen Jaeckel
87d876f6ac add comment about usage to demo_dynamic
[skip ci]
2017-08-09 16:06:11 +02:00
Steffen Jaeckel
35925eada5 improve constants demo 2017-08-09 16:06:11 +02:00
Steffen Jaeckel
d5d4cadbde PKA_{D,R}SA shouldn't be public 2017-08-09 16:06:11 +02:00
Steffen Jaeckel
a247583e63 add error-codes to crypt_constants 2017-08-09 16:06:11 +02:00
Larry Bugbee
9f548c9928 update demo_dynamic.py 2017-08-09 16:06:11 +02:00
Steffen Jaeckel
91e5e8350b ltc_dh_set_type can be hidden as well 2017-08-09 16:06:11 +02:00
Steffen Jaeckel
d22b20833e we don't expose internal structs 2017-08-09 16:06:11 +02:00
Steffen Jaeckel
22822417c9 really define LTC_{DE,EN}CRYPT 2017-08-09 16:06:11 +02:00
Larry Bugbee
a3a199e14b update crypt_sizes.c 2017-08-09 16:06:11 +02:00
Larry Bugbee
7a2aabf47e update crypt_constants.c 2017-08-09 16:06:11 +02:00
Steffen Jaeckel
9f02fde06e improve sizes demo a bit 2017-08-09 16:06:11 +02:00
Karel Miko
b79ae63408 add missing items to crypt_sizes 2017-08-09 16:06:11 +02:00
Steffen Jaeckel
b5ab8ec811 update README.md a bit
[skip ci]
2017-08-09 15:55:15 +02:00
karel-m
231af66e03 Merge pull request #264 from libtom/pr/doxygen-warnings
fix doxygen warnings (as mentioned in #228)
2017-08-09 09:53:19 +02:00
Karel Miko
0286b36ad6 fix doxygen warnings (as mentioned in #228)
[skip ci]
2017-08-09 09:44:12 +02:00
Steffen Jaeckel
65dc00e23a align HASH_PROCESS() macro 2017-08-08 19:05:59 +02:00
Steffen Jaeckel
c29c9f140d disable DSA4096 timing tests when building for TFM
this fixes #260
2017-08-08 08:47:58 +02:00
Steffen Jaeckel
227838bb09 Merge pull request #261 from libtom/improve/test_without_mpi
make it possible to 'make all' w/o an MPI provider
2017-08-08 08:46:31 +02:00
Steffen Jaeckel
a65cfb8dbe make it possible to 'make all' w/o an MPI provider 2017-08-07 21:11:42 +02:00
Steffen Jaeckel
7993ce8e10 Merge pull request #262 from libtom/pr/ocb3-done-taglen-fix
ocb3_done taglen fix
2017-08-07 21:07:25 +02:00
Steffen Jaeckel
9139b59699 OCBv3: fix testvector generation 2017-08-07 19:43:09 +02:00
Steffen Jaeckel
9952fac68e tv.txt contains errors from tv_gen 2017-08-07 19:37:53 +02:00
Karel Miko
f647baa778 OCBv3: ocb3_init taglen check 2017-08-07 18:24:59 +02:00
Karel Miko
af63d0a55f OCBv3: improved handling of taglen in ocb3_done 2017-08-07 18:24:59 +02:00
Steffen Jaeckel
41130900d0 fix 1. help-line of openssl-enc
[skip ci]
2017-08-07 17:28:49 +02:00
Steffen Jaeckel
28ecdd5d12 minor improvements
[skip ci]
2017-08-07 16:33:38 +02:00
Steffen Jaeckel
ac4687d88d also put LTC_TEST_DBG in crypt_build_settings 2017-08-07 16:18:15 +02:00
Steffen Jaeckel
44076e3815 Merge branch 'fix/254' into release/1.18.0
This fixes #254
2017-08-07 16:05:38 +02:00
Steffen Jaeckel
7a59f71af8 fix warning
warning: 'ltc_asn1_type {aka enum ltc_asn1_type_}' is promoted to 'int' when passed through '...'
        type = va_arg(args, ltc_asn1_type);
note: (so you should pass 'int' not 'ltc_asn1_type {aka enum ltc_asn1_type_}' to 'va_arg')
note: if this code is reached, the program will abort
2017-08-07 16:04:57 +02:00
Steffen Jaeckel
32355d04bb fix endianness detection for some versions of gcc
This fixes #254
2017-08-07 16:04:57 +02:00
Steffen Jaeckel
9f020b17df limit malloc'ed data in eax_decrypt_verify_memory() 2017-08-07 16:04:36 +02:00
Steffen Jaeckel
05f7393067 Merge pull request #256 from libtom/fix/256
OCB3 is not according to RFC7253
2017-08-07 16:03:39 +02:00
Karel Miko
6ac1c5fa34 OCBv3: fix demos/timing failures 2017-08-07 07:48:21 +02:00
Steffen Jaeckel
3ecd18763b OCBv3: better taglen limitation 2017-08-03 13:40:57 +02:00
Steffen Jaeckel
3b4d39ea45 OCBv3: improve a bit when ARGCHK'ing pointers
* it didn't really make sense to check that the _in_ pointer is NULL
* instead we should check that _in_ and _out_ are not NULL when there's
  something to process
2017-08-03 13:40:26 +02:00
Steffen Jaeckel
868c5a82c3 OCBv3: fix handling of empty plaintext 2017-08-03 13:19:12 +02:00
Steffen Jaeckel
bc0c18f347 Update makefiles 2017-08-02 18:55:42 +02:00
Steffen Jaeckel
0c2ff4a1b0 OCBv3: small review
* better LTC_ARGCHK()
* move unnecessary functions from API to be static
* limit malloc'ed data in ocb3_decrypt_verify_memory()
2017-08-02 18:55:34 +02:00
Steffen Jaeckel
d77cf0e248 OCBv3: implement RFC7253 compliance
This fixes #256
2017-08-02 17:45:59 +02:00
Steffen Jaeckel
1aaa5abb33 ocb3: check the length of the nonce 2017-08-02 14:41:46 +02:00
Steffen Jaeckel
b2448c593a ocb3: properly handle empty AAD
* allow passing "no additional data" to ocb3_decrypt_verify_memory() and
  ocb3_encrypt_authenticate_memory()
* ensure that the caller didn't want to add AAD
2017-08-01 14:44:37 +02:00
Steffen Jaeckel
4805c89adb add ARGTYPE to crypt_build_settings 2017-08-01 14:21:11 +02:00
Michael Stapelberg
541ab1c16c Fix crypt.tex with newer TeXLive (thanks Norbert Preining)
See https://lists.debian.org/debian-tex-maint/2017/08/msg00000.html for details
2017-08-01 12:04:01 +02:00
Steffen Jaeckel
129bc7175f beautify dh & rsa 2017-07-21 10:16:19 +02:00
Steffen Jaeckel
6b925485a8 make sure to request an element which is always available 2017-07-20 13:34:16 +02:00
Steffen Jaeckel
ab8c5b8b49 fix help of {un,}install targets 2017-07-20 12:58:28 +02:00
Steffen Jaeckel
61eb98b76e add compile-time check for sprng requirements 2017-07-20 12:47:19 +02:00
Steffen Jaeckel
a46d6eb819 remove define of LTC_NO_FILE when defining LTC_NOTHING
it doesn't make sense to define this opt-out option especially
since there's no way to undefine it again.
2017-07-19 16:44:37 +02:00
Steffen Jaeckel
83407feaa6 Merge pull request #250 from libtom/pr/readme-building
README building instructions
2017-07-17 18:34:52 +02:00
Steffen Jaeckel
1e1170df29 move timing to BROKEN_DEMOS 2017-07-17 13:36:34 +02:00
Steffen Jaeckel
24c5b74193 introduce 'make help' 2017-07-17 13:36:34 +02:00
Steffen Jaeckel
bffaab4eed re-group demos and really build everything in 'all' target 2017-07-17 13:36:34 +02:00
Steffen Jaeckel
22c13b49d8 oops, refman.pdf can't be built with DOT 2017-07-17 13:36:34 +02:00
Steffen Jaeckel
0e081d666a improve error message when using makefile on Mac OSX
[skip ci]
2017-07-17 13:36:34 +02:00
Steffen Jaeckel
4cb8936a31 update readme
[skip ci]
2017-07-17 13:36:34 +02:00
Karel Miko
bfe6c4d35c improved README - building instructions
[skip ci]
2017-07-17 13:36:34 +02:00
karel-m
ff54ec2f0d Merge pull request #253 from libtom/pr/rc2-fix-win64
Fix MS Windows/64bit related warnings
2017-07-14 20:41:10 +02:00
Karel Miko
909b4954a9 fix MS Windows/64bit related warnings 2017-07-14 19:59:03 +02:00
Steffen Jaeckel
aa0f396c0c Update makefiles 2017-07-13 14:58:01 +02:00
Steffen Jaeckel
535358ec28 bump version 2017-07-13 14:57:45 +02:00
Steffen Jaeckel
89d0c64335 Merge pull request #247 from libtom/pr/custom_compile_flags
introduce LTC_CFLAGS and LTC_LDFLAGS
2017-07-13 14:34:05 +02:00
Steffen Jaeckel
a2f48578e9 also pre-pend -Itests 2017-07-12 22:48:46 +02:00
Steffen Jaeckel
a949ef5a89 append instead of prepend CFLAGS for the other makefiles 2017-07-11 15:37:31 +02:00
Steffen Jaeckel
b1c0227d54 introduce LTC_CFLAGS and LTC_LDFLAGS 2017-07-11 15:33:33 +02:00
Steffen Jaeckel
24e69b2956 more printf() clean-up
* remove last occurences in non-test code
* minimize in tests
2017-07-11 15:29:45 +02:00
Steffen Jaeckel
8b7edf5478 update DOT max values 2017-07-11 15:29:45 +02:00
Steffen Jaeckel
c6b93ae72e Merge branch 'pr/245' into release/1.18.0
This closes #245
2017-07-11 15:29:45 +02:00
Francois Perrad
37de73db01 add static _chc_process like in its prototype 2017-07-11 15:29:45 +02:00
Francois Perrad
53c62b3670 remove redundant prototypes
already declared in src/headers/tomcrypt_hash.h
2017-07-11 15:29:45 +02:00
Steffen Jaeckel
70f8a57f01 Merge pull request #249 from libtom/pr/dh-dsa-api
dh_set_key + dsa_set_key
2017-07-11 10:36:09 +02:00
Steffen Jaeckel
1819a02d5a update comments
[skip ci]
2017-07-11 10:32:53 +02:00
Karel Miko
e20e204b8c dh_set_key + dsa_set_key API change described in #248 2017-07-11 00:13:26 +02:00
karel-m
fa4713b68e Merge pull request #246 from libtom/pr/gcm-corner-cases
GCM allow skipping gcm_add_aad and gcm_process
2017-07-10 23:26:13 +02:00
Karel Miko
0792e3701e GCM allow skipping gcm_add_aad and gcm_process 2017-07-10 22:35:42 +02:00
Steffen Jaeckel
dd5996dd1f don't find the lo's to link, but use the list of objects 2017-07-10 10:20:36 +02:00
Steffen Jaeckel
221f7f223d add 'uninstall' make target
[skip ci]
2017-07-10 10:16:35 +02:00
Steffen Jaeckel
3806629e9e fix default make target 2017-07-09 17:34:45 +02:00
Steffen Jaeckel
4d897a36a3 Merge pull request #243 from libtom/pr/fix-chmod
Fix: chmod -x
2017-07-09 17:34:04 +02:00
Karel Miko
b89f3d8b5a fix: chmod -x notes/rsa-testvectors/*.txt 2017-07-09 16:22:28 +02:00
Karel Miko
2aa42f002f fix: chmod -x 2017-07-09 16:22:28 +02:00
Steffen Jaeckel
68bf547f9c use rsa_free() on error in rsa_make_key() 2017-07-09 16:02:11 +02:00
Steffen Jaeckel
749873c306 fix docs generation with TeX Live 2017
[skip ci]
2017-07-06 10:19:38 +02:00
Steffen Jaeckel
f15e0172ca Travis: also build master and 'release/*' branches 2017-07-05 14:43:21 +02:00
Steffen Jaeckel
e53858c740 update VERSION variables in makefiles
VERSION is now VERSION_PC
the new VERSION contains the entire string of SCRYPT
2017-07-05 14:30:17 +02:00
Steffen Jaeckel
a8965f048a Update makefiles 2017-07-05 14:30:17 +02:00
Steffen Jaeckel
fa5acee802 bump version 2017-07-05 14:30:17 +02:00
Steffen Jaeckel
d03635acab support patch-releases in helper.pl 2017-07-05 14:30:17 +02:00
Steffen Jaeckel
ac6f62badc update changes 2017-07-05 14:30:16 +02:00
Steffen Jaeckel
b59f066de3 update prng section in doc 2017-07-05 14:27:05 +02:00
Steffen Jaeckel
ac6fb72ef1 fix some doxygen headers 2017-07-05 14:27:05 +02:00
Steffen Jaeckel
6598dc0c3f update Doxyfile 2017-07-05 14:27:05 +02:00
Steffen Jaeckel
e1fcd3ab04 add hashsum multi-hash option 2017-07-05 14:26:53 +02:00
Steffen Jaeckel
ebc9d2943b Merge pull request #239 from libtom/pr/asn1-small-fixes
ASN.1 changes extracted from ECC stuff
2017-07-05 12:46:59 +02:00
Steffen Jaeckel
7d60fd2bfe don't expose der_length_sequence_ex() 2017-07-05 11:52:46 +02:00
Karel Miko
4bc1489584 small ASN.1 changes extracted from ECC stuff 2017-07-05 11:34:27 +02:00
Steffen Jaeckel
ce1ba58f00 Merge pull request #238 from libtom/proposal/ltc_pk_part
Re-factor X_import_radix() etc. API's
2017-07-05 11:33:17 +02:00
Steffen Jaeckel
c2f50459e2 better doc of radix_to_bin() 2017-07-05 10:25:01 +02:00
Steffen Jaeckel
4221c44fbc rename rand_bn_range() to rand_bn_upto() 2017-07-05 10:03:56 +02:00
Steffen Jaeckel
22919cd4f2 rand_bn_range(): count bits once 2017-07-04 10:58:10 +02:00
Steffen Jaeckel
8167b4d1cc Update makefiles 2017-07-04 10:30:50 +02:00
Steffen Jaeckel
a6aef23438 dh_make_key() is now dh_generate_key() 2017-07-04 10:30:39 +02:00
Steffen Jaeckel
e647f9a0e4 not good to check that prng is non-NULL
e.g. sprng() lives w/o context
2017-07-04 10:25:38 +02:00
Steffen Jaeckel
a0f2abc5b5 re-format 2017-07-04 10:25:38 +02:00
Steffen Jaeckel
a80abb1222 put dh_set_pg_dhparam() in own c file 2017-07-04 10:25:38 +02:00
Steffen Jaeckel
5640f8afc7 put dsa_set_pqg_dsaparam() in own c file 2017-07-04 10:25:38 +02:00
Steffen Jaeckel
3c2e0d6686 dsa_make_key_ex() is now dsa_generate_key() 2017-07-04 10:25:38 +02:00
Steffen Jaeckel
dbeaefd65b remove LTC_{DH,DSA}_KEY_INITIALIZER 2017-07-04 10:25:38 +02:00
Steffen Jaeckel
d1ecd82a42 use rand_bn_range() where possible 2017-06-28 20:50:21 +02:00
Steffen Jaeckel
bdfecc5f3c more doc updates 2017-06-28 16:45:29 +02:00
Steffen Jaeckel
d64880eeb1 add dsa_set_pqg_dsaparam() 2017-06-28 16:07:54 +02:00
Steffen Jaeckel
35e0c5fc71 clean-up a bit around DSA
* comments
* dsa_test()
* order of alloc/free of key parts
2017-06-28 16:07:32 +02:00
Steffen Jaeckel
1cce065676 Update makefiles 2017-06-28 14:44:17 +02:00
Steffen Jaeckel
0aad68c20d clean-up some PK tests
no need to test the same functionality multiple times
these tests were multiplied for the XX_import_radix() functions which
are gone now.
2017-06-28 14:44:06 +02:00
Steffen Jaeckel
cfff656e25 re-factor dsa_make_key() etc. 2017-06-28 14:40:30 +02:00
Steffen Jaeckel
24946d08b7 use mp_cleanup_multi() 2017-06-28 14:40:30 +02:00
Steffen Jaeckel
ed149c9396 add tests for radix_to_bin() 2017-06-28 14:40:30 +02:00
Steffen Jaeckel
76b9bba857 introduce mp_cleanup_multi() 2017-06-28 14:40:30 +02:00
Steffen Jaeckel
292f42d3c0 Merge pull request #227 from libtom/pr/dh_make_key_ex
DH facelift part 2 (dh_make_key_ex & co.)
2017-06-27 22:25:00 +02:00
Steffen Jaeckel
37ce78fdc8 Update makefiles 2017-06-27 22:10:10 +02:00
Steffen Jaeckel
f2f113880b also rename file 2017-06-27 22:10:07 +02:00
Steffen Jaeckel
c493a2a0a3 re-factor dh_export_radix() to dh_export_key() 2017-06-27 22:09:21 +02:00
Steffen Jaeckel
f226efc9a9 Update makefiles 2017-06-27 22:00:13 +02:00
Steffen Jaeckel
9d6689fc08 re-factor dh_make_key() and variants 2017-06-27 22:00:13 +02:00
Steffen Jaeckel
fbc54756c1 replace dh_import_radix() by dh_set_{pg,key} 2017-06-27 21:53:02 +02:00
Karel Miko
b3e535f933 update makefiles 2017-06-27 20:11:52 +02:00
Karel Miko
f60e2902ed dh_make_key_ex dh_export_radix dh_import_radix 2017-06-27 20:11:52 +02:00
Steffen Jaeckel
a42f467ff1 Update makefiles 2017-06-27 20:05:36 +02:00
Steffen Jaeckel
ae7d4d2947 re-factor rsa_test() to new rsa_set_X() API 2017-06-27 20:05:36 +02:00
Steffen Jaeckel
627f6696cb add radix_to_bin() 2017-06-27 20:05:36 +02:00
Steffen Jaeckel
6b798ca6a6 replace rsa_import_radix() by rsa_set_{key,factors,crt_params}() 2017-06-27 20:05:36 +02:00
Steffen Jaeckel
05e9f0ee79 Revert "use ltc_pk_part in rsa_import_radix()"
This reverts commit 023e4a2c23641d852cf47000948fa29a53249457.
2017-06-27 20:05:36 +02:00
Steffen Jaeckel
083e8af78b Revert "also test binary import"
This reverts commit 8b6f8c8cce325fa1ce3b61805aa80cdabc1826b4.
2017-06-27 20:05:36 +02:00
Steffen Jaeckel
4afc024f6a also test binary import 2017-06-27 20:05:36 +02:00
Steffen Jaeckel
bfae92e4ab use compare_testvector() in rsa_test() 2017-06-27 20:05:36 +02:00
Steffen Jaeckel
00a5212d99 use ltc_pk_part in rsa_import_radix() 2017-06-27 20:05:36 +02:00
Steffen Jaeckel
51ac4da8fc Merge pull request #241 from libtom/cleanup/4
Fourth general clean-up
2017-06-27 20:04:59 +02:00
Steffen Jaeckel
0a6af8d333 rsa_exptmod(): verify that p and q are valid before going the CRT path 2017-06-27 19:01:56 +02:00
Steffen Jaeckel
f5b8cc9dae this should really implement a patch for the illegal access 2017-06-27 12:35:39 +02:00
Steffen Jaeckel
1a3880fda5 Revert "re-factor size checks in blake2 implementations"
This reverts commit af38b1830e.
2017-06-27 12:33:40 +02:00
Steffen Jaeckel
af38b1830e re-factor size checks in blake2 implementations 2017-06-26 14:02:52 +02:00
Steffen Jaeckel
907d5301ee update coverity build script to use makefile.unix
it seems like the regular makefile is somehow broken...
2017-06-23 16:46:31 +02:00
Steffen Jaeckel
3cfb2a5e2e hide some of the 'new since 1.17' internal functions 2017-06-23 14:14:05 +02:00
Steffen Jaeckel
a80d3c00a8 no need for DH_BUF_SIZE 2017-06-23 14:05:57 +02:00
Steffen Jaeckel
c15d656a23 crypt{,.exe} is now ltcrypt{,.exe} 2017-06-23 14:05:57 +02:00
Steffen Jaeckel
e68d846429 hopefully finally fix usage of $(DESTDIR)
This closes #232
2017-06-23 14:05:57 +02:00
Steffen Jaeckel
cd6e602b48 Merge pull request #240 from fperrad/20170622_lint
more linting
2017-06-23 10:06:13 +02:00
Francois Perrad
446fec1bc4 refactor switch with default 2017-06-22 17:13:40 +02:00
Steffen Jaeckel
1725b87098 Merge pull request #234 from libtom/cleanup/3
Third general clean-up
2017-06-22 16:01:14 +02:00
Steffen Jaeckel
5ce602558f Revert "also use DESTDIR in makefile.m{ingw,svc}"
This reverts commit 1655e63c49.

As of @karel-m [1]

"I am not sure whether DESTDIR concept make sense for MS Windows
paths. For example: `make -f makefile.mingw DESTDIR=c:\builddir\
PREFIX=c:\installdir` means that `"$(DESTDIR)$(PREFIX)\bin"` will
expand to `"c:\builddir\c:\installdir\bin"` which is obviously
invalid.
I propose reverting `also use DESTDIR in makefile.m{ingw,svc}`."

[1] https://github.com/libtom/libtomcrypt/pull/234#issuecomment-310366602
2017-06-22 14:41:37 +02:00
Steffen Jaeckel
09c4d4c93b proper use of $(DESTDIR)
@rofl0r @ [1]

"...still it's unusual/unexpected to embed DESTDIR in LIBPATH
etc. where this could hickup is when for example hardcoded paths need
to be embedded into the resulting binary. for example, in the
netbsd-curses makefile i linked earlier, such a case would be reference
to the terminfo DB location, which is derived from PREFIX.
other possible cases might be stuff that dlopen()s its own libs using an
absolute path, or uses other data files. for such a case a contributor
would typically re-use DATAPATH oslt and put it into CPPFLAGS or write
it into a header, to find the required files. when now these paths have
DESTDIR in them too, this will not work. thus it is good practice to use
$(DESTDIR) only in install targets, and keep it out of other vars."


[1] 8e29a6061f (commitcomment-22678488)

This closes #232
2017-06-22 14:21:14 +02:00
Steffen Jaeckel
e3937a2906 fix compile warning when building w/o tests 2017-06-22 14:21:14 +02:00
Steffen Jaeckel
11338d2496 introduce XMEMMOVE and check for its usage 2017-06-22 14:21:14 +02:00
Steffen Jaeckel
e9c90e7f63 no need to use XMEM_NEQ() in PK crypto 2017-06-22 14:21:14 +02:00
Steffen Jaeckel
ae698927ff improve mem_neq() documentation 2017-06-22 14:21:14 +02:00
Steffen Jaeckel
1655e63c49 also use DESTDIR in makefile.m{ingw,svc} 2017-06-22 14:21:14 +02:00
Steffen Jaeckel
af984dc33e exclude more sources from "static function check" 2017-06-22 14:21:14 +02:00
Steffen Jaeckel
1bf42ea99a update some of the static functions 2017-06-22 14:21:14 +02:00
Karel Miko
8f433f1a36 add check for static function names 2017-06-22 14:21:14 +02:00
Steffen Jaeckel
27b3ffc627 use compare_testvector() instead of XMEMCMP() in tests 2017-06-22 14:21:14 +02:00
Steffen Jaeckel
05e28d6cfa fix potential timing attacks in rsa, eax, ocb and ocb3 2017-06-22 14:21:14 +02:00
Steffen Jaeckel
b03b93099d allow to give only a part as parameter to ./test 2017-06-22 14:21:14 +02:00
Steffen Jaeckel
36132b016f update title page of pdf doc 2017-06-22 14:21:14 +02:00
karel-m
316450c20e Merge pull request #237 from libtom/pr/dh-facelift-part1
DH facelift part 1
2017-06-22 14:16:36 +02:00
Karel Miko
243a1dc33e drop _dh_make_key_ex 2017-06-22 13:19:48 +02:00
Karel Miko
cba1569c82 fix tomcrypt_pk.h 2017-06-22 13:19:48 +02:00
Karel Miko
a0257df999 update makefiles 2017-06-22 13:19:47 +02:00
Karel Miko
5eaff56d90 remove dh_export_radix.c dh_import_radix.c 2017-06-22 13:19:47 +02:00
Karel Miko
f4ce5a21c8 helper.pl - enable check_comments for --check-all 2017-06-22 13:19:47 +02:00
Karel Miko
f9802359c9 update makefiles 2017-06-22 13:19:47 +02:00
Karel Miko
771d67e102 DH facelift part1 2017-06-22 13:19:47 +02:00
Steffen Jaeckel
5e71ac27e2 Merge pull request #230 from libtom/math/miller-rabin
Fix number of Miller-Rabin rounds
2017-06-22 12:44:33 +02:00
Steffen Jaeckel
26b57032e7 use correct amount of M-R tests in dsa_make_params() 2017-06-22 11:55:08 +02:00
Steffen Jaeckel
7453eddae9 improve ltc_math_descriptor a bit
* introduce LTC_MILLER_RABIN_REPS which is used as default value
  in the isprime() implementations
2017-06-22 11:55:08 +02:00
karel-m
6f85293672 Merge pull request #235 from libtom/pr/ecc_sign+verify_hash_rfc7518
ECC ecc_sign+verify_hash_raw > ecc_sign+verify_hash_rfc7518
2017-06-21 14:33:37 +02:00
Karel Miko
ac02f7422b ecc_sign+verify_hash_rfc7518 tests 2017-06-21 13:43:25 +02:00
Karel Miko
b8f22157b3 PK_MAX_RETRIES 2017-06-21 13:38:39 +02:00
Karel Miko
0c115a162d whitespace 2017-06-21 13:26:52 +02:00
Karel Miko
fff832091f ecc_sign_hash max_iterations 2017-06-21 13:25:06 +02:00
Karel Miko
cdf04b6140 fix mp_montgomery_setup 2017-06-21 13:01:22 +02:00
Karel Miko
a937f23821 static functions name fix 2017-06-21 12:49:19 +02:00
Karel Miko
67200b641d ecc_sign+verify_hash_raw > ecc_sign+verify_hash_rfc7518 2017-06-21 12:11:35 +02:00
Steffen Jaeckel
c14bcf4d30 Merge pull request #233 from libtom/cleanup/2
Second general clean-up
2017-06-20 17:51:16 +02:00
Steffen Jaeckel
18c00ddcd6 better usage of find() 2017-06-20 15:16:11 +02:00
Steffen Jaeckel
5246c7de64 fix links in pdf doc 2017-06-20 15:16:11 +02:00
Steffen Jaeckel
8e29a6061f use {BIN,DATA,INC,LIB}PATH in makefile.unix 2017-06-20 15:16:11 +02:00
Steffen Jaeckel
6fc0a90a1e fix headers & footers in demos & tests 2017-06-20 15:16:11 +02:00
Steffen Jaeckel
4cd1355b8f more clean-up of headers/footers 2017-06-20 15:16:11 +02:00
Steffen Jaeckel
fe19dad623 replace SVN tags 2017-06-20 15:16:11 +02:00
Steffen Jaeckel
8c11490e2d fix usage of PREFIX vs. DESTDIR
This closes #232
2017-06-20 15:16:11 +02:00
Steffen Jaeckel
7597d20c78 use CROSS_COMPILE instead of PREFIX to indicate toolchain prefix 2017-06-20 15:16:11 +02:00
Steffen Jaeckel
b16066cbfc Add possibility to change install options
This closes #231
2017-06-20 15:16:11 +02:00
Steffen Jaeckel
66527b3e5e include "tomcrypt.h", not <tomcrypt.h>
we want to include the local version of the header, not the system-version
2017-06-20 15:16:11 +02:00
Steffen Jaeckel
fb35d5be54 more clean-up of headers 2017-06-20 15:16:11 +02:00
Steffen Jaeckel
4dc211e19d clean-up headers 2017-06-20 15:16:11 +02:00
Karel Miko
2fd5808897 timing - silence valgrind warning (memleak) 2017-06-20 01:33:23 +02:00
Karel Miko
e5f25b6553 tests+timing - silence valgrind warning (memleak) 2017-06-19 20:34:08 +02:00
Karel Miko
03437a1bdd timing - silence valgrind warning 2017-06-19 18:51:04 +02:00
Karel Miko
8dec4d9ac4 prng_test - silence valgrind warning 2017-06-19 12:28:22 +02:00
Steffen Jaeckel
cbc4260314 Merge pull request #229 from libtom/cleanup/1
First general clean-up
2017-06-15 10:31:14 +02:00
Steffen Jaeckel
f2076f0700 use zeromem() where appropriate 2017-06-15 01:07:44 +02:00
Steffen Jaeckel
258de3cecc use ltc_mp_digit instead of unsigned long 2017-06-15 01:07:44 +02:00
Steffen Jaeckel
d6e2a585d0 sync doc from ltc_math_descriptor 2017-06-15 01:07:44 +02:00
Steffen Jaeckel
98b500e873 update crypt_build_settings et al. 2017-06-15 01:07:44 +02:00
Steffen Jaeckel
0cf7c49045 sync ltc_math_descriptor from doc 2017-06-15 00:46:50 +02:00
Steffen Jaeckel
a0e5c2e4ff add some makefile docs 2017-06-15 00:46:50 +02:00
Steffen Jaeckel
3995f971d7 make sure to use makefile.shared on Mac 2017-06-15 00:46:50 +02:00
Steffen Jaeckel
048cbc55b0 disable yet another warning 2017-06-15 00:46:50 +02:00
Karel Miko
2cd69fb541 improved helper.pl (check mandatory comments - not included in "--check-all" yet) 2017-06-14 17:16:26 +02:00
Steffen Jaeckel
23d5a02ecd Merge pull request #217 from libtom/scan-build
Travis-CI: clang static analyzer
2017-06-14 09:19:19 +02:00
Steffen Jaeckel
31ddf7c894 ...
https://www.youtube.com/watch?v=6bbIBs0P2t0
2017-06-13 18:41:09 +02:00
Steffen Jaeckel
ac41d07247 try libtommath from ubuntu 2017-06-13 18:41:09 +02:00
Steffen Jaeckel
ea08fbb777 use libtommath from debian sid 2017-06-13 18:41:09 +02:00
Steffen Jaeckel
ba94b536be this is a horrible PR 2017-06-13 18:41:09 +02:00
Steffen Jaeckel
1ee2662ab5 only run scan_build.sh once 2017-06-13 18:41:09 +02:00
Steffen Jaeckel
52672bc358 m( 2017-06-13 18:41:09 +02:00
Steffen Jaeckel
9baba0a83a fix usage of makefile.unix 2017-06-13 18:41:09 +02:00
Steffen Jaeckel
ebfd164246 alright, let's also use ltm from packagecloud 2017-06-13 18:41:09 +02:00
Steffen Jaeckel
3bb9193d6f alright, let's try if upgrading to trusty helps... 2017-06-13 18:41:09 +02:00
Steffen Jaeckel
75e00e097c well, then install a new clang version and see... 2017-06-13 18:41:09 +02:00
Steffen Jaeckel
ff2de0b07a looks like precise doesn't have scan-build under that name
...but we should be able to find it somewhere in /usr/bin/
2017-06-13 18:41:09 +02:00
Steffen Jaeckel
742b4cee78 add clang scan-build 2017-06-13 18:41:09 +02:00
Steffen Jaeckel
bda493d770 Merge pull request #226 from fperrad/20170609_lint
some linting

[skip ci]
2017-06-13 12:17:16 +02:00
Steffen Jaeckel
caa05540b7 Merge pull request #172 from libtom/test_tfm
Run tests for tomsfastmath

[skip ci]
2017-06-12 23:08:10 +02:00
Francois Perrad
0bc0d55245 refactor REGISTER_* 2017-06-12 20:07:23 +02:00
Francois Perrad
ec51f880b5 Right hand side of assignment needs parenthesis 2017-06-12 20:07:23 +02:00
Francois Perrad
f40bda7cb3 fix indentation 2017-06-12 20:07:23 +02:00
Steffen Jaeckel
f45f2f4faf only create coverage for ltm build 2017-06-12 18:45:24 +02:00
Steffen Jaeckel
a9838f7745 fix linking to tomsfastmath & clean-up 2017-06-12 18:45:24 +02:00
Steffen Jaeckel
104a451def use packagecloud repo to install tfm 2017-06-12 18:45:24 +02:00
Steffen Jaeckel
e2af986085 make output verbose again 2017-06-12 18:45:24 +02:00
Steffen Jaeckel
fec05471ae the latest tfm version has fp_rand() available, so we can test this now 2017-06-12 18:45:24 +02:00
Steffen Jaeckel
a4671110d5 Merge pull request #198 from libtom/test/pthread
Travis-CI: a new build with -DLTC_PTHREAD

[skip ci]
2017-06-12 18:44:01 +02:00
Steffen Jaeckel
5de7e58e84 disable yet another clang warning 2017-06-12 17:19:43 +02:00
Steffen Jaeckel
73934ad2fd add ld option -pthread when LTC_PTHREAD is enabled 2017-06-12 17:19:43 +02:00
Steffen Jaeckel
48e4ec07be use LTC_ARGCHK() for all mutex operations 2017-06-12 17:19:43 +02:00
Steffen Jaeckel
3b4e5df858 create separate no_prng instances
now they shouldn't collide anymore and can always be unregistered
2017-06-12 17:19:43 +02:00
Steffen Jaeckel
42a82ce3ed fix valgrind errors
Uninitialized key caused the following error:

Conditional jump or move depends on uninitialised value(s)
   at ...: __memcmp_sse4_1 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   ...
2017-06-12 17:19:43 +02:00
Steffen Jaeckel
a06cba4cb5 fix tests when compiled for pthread 2017-06-12 17:19:43 +02:00
Steffen Jaeckel
b38cf104f0 move prng-tests away from cipher_hash_test() 2017-06-12 17:19:43 +02:00
Steffen Jaeckel
904366eb0f check that all ciphers/hashes/prngs are unregistered 2017-06-12 17:19:43 +02:00
Steffen Jaeckel
be9c598ee7 add new travis tests with pthread support 2017-06-12 17:19:43 +02:00
Steffen Jaeckel
e6cd8e8112 fix failing tests with pthreads enabled 2017-06-12 17:19:43 +02:00
Steffen Jaeckel
d6a77f5d6d implement pthread support for tests 2017-06-12 17:19:43 +02:00
karel-m
4a6d107227 Merge pull request #225 from libtom/pr/fix-114-dh-primes
Better DH primes
2017-06-12 17:12:33 +02:00
Karel Miko
4f12e41d29 fix trailing ; 2017-06-12 16:35:27 +02:00
Karel Miko
114b694735 trying to fix dh_shared_secret - #119 2017-06-11 23:20:46 +02:00
Karel Miko
bc4236d90f tuning dh_make_key 2017-06-11 21:12:14 +02:00
Karel Miko
361778d2ac another dh_make_key redesign 2017-06-11 19:43:08 +02:00
Karel Miko
71884788e3 fix warning: comparison between signed and unsigned integer 2017-06-11 10:12:18 +02:00
Karel Miko
532c511f52 improved dh_make_key 2017-06-10 23:02:30 +02:00
Steffen Jaeckel
c9f4628693 don't call rng_make_prng() from dh_make_key()
While testing with multiple threads I had spurious errors where some tests
can't read from the PRNG.
If I tracked it down correctly that's caused by `dh_make_key()`
calling `rng_make_prng()` which re-initializes the selected PRNG.

I like the idea of "refreshing" the PRNG with entropy from a hopefully
secure RNG before generating a new key, but I don't think it's the duty
of a key-generation function to ensure that, but merely the application
that implements key-generation.
2017-06-09 18:56:04 +02:00
Steffen Jaeckel
e3329bec26 make it possible to pass a single timing test to run 2017-06-09 18:33:51 +02:00
Steffen Jaeckel
e60d2076c5 resurrect DH in timing 2017-06-09 18:33:51 +02:00
Steffen Jaeckel
f31d8ff864 implement smaller private key sizes 2017-06-09 18:33:51 +02:00
Karel Miko
f46b32ba2e better DH primes 2017-06-09 14:14:07 +02:00
karel-m
3922868082 Merge pull request #224 from libtom/pr/fix-154-dsa-api
Do not expose dsa_make_params as a public API
2017-06-09 14:13:04 +02:00
Karel Miko
2a883b44c7 do not expose dsa_make_params as a public API 2017-06-09 13:01:30 +02:00
Steffen Jaeckel
4fa9e96d49 Merge pull request #157 from libtom/feature/rsa_import_pkcs8
RSA import pkcs8

[skip ci]
2017-06-09 11:38:35 +02:00
Steffen Jaeckel
ef450fe14a fix error handling 2017-06-08 23:34:16 +02:00
Karel Miko
2d8816607b update makefiles 2017-06-08 23:34:16 +02:00
Karel Miko
52a496e9e1 rsa_import_pkcs8 - passwd is now "const void *" 2017-06-08 23:34:16 +02:00
Karel Miko
d96f4bdcff rsa_import_pkcs8 2017-06-08 23:34:16 +02:00
Steffen Jaeckel
2816da42af Merge pull request #219 from libtom/feature/common
Introduce testprof/common.c

[skip ci]
2017-06-08 23:30:28 +02:00
Karel Miko
d72d7d1d32 tuning makefile.mingw+msvc 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
f47a71bc6c Update makefiles 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
5a3a27bbd6 rename der_tests to der_test 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
4bbce780c4 always provide compare_testvector() as a function 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
ad45277745 use print_hex() in rsa_test() 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
e45e02d635 Update makefiles 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
4e971a8518 don't use print_hex() from library 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
fe0b72ef51 remove dependency of demos to tests/common 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
da3b61c7b6 re-structure tests/common.c 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
4ceb82bf54 add register_all_{ciphers,hashes,prngs}() 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
7f91e5ae65 requiring 'name != NULL' in find_cipher_any() doesn't make sense 2017-06-08 22:20:45 +02:00
Karel Miko
7aaa423004 tuning makefiles - mingw, msvc, cygwin 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
b51a3f6dab update notes/hashsum_tv.txt 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
8c1d55f4c0 fix error when compiling w/ LTC_CLEAN_STACK but w/o LTC_FAST 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
40747cfcfd add a build-run with debugging-options 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
b83f9472c0 Update makefiles 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
b78c5551f7 move compare_testvector() implementation to the library 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
e1a1145802 rename 'testprof/' to 'tests/' 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
07ffa0f1a2 remove tomcrypt_prof test-only library 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
201681ee3b merge testprof/timing_test.c into demos/timing.c 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
70a27a852e Update makefiles 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
8ef805817c rename time_cipher[2-4]? appropriately 2017-06-08 22:20:44 +02:00
Steffen Jaeckel
9d4094b8e9 rename x86_prof.c to timing_test.c 2017-06-08 22:20:44 +02:00
Steffen Jaeckel
abe8d26246 move epoch_usec() to test.c 2017-06-08 22:20:44 +02:00
Steffen Jaeckel
f7d3c2bfa1 merge testprof/test_driver.c to testprof/common.c 2017-06-08 22:20:44 +02:00
Steffen Jaeckel
0a23c6d32e also check for cipher descriptors 2017-06-08 22:20:44 +02:00
Steffen Jaeckel
1c4c84e7f9 fix tv_gen 2017-06-08 22:20:44 +02:00
Steffen Jaeckel
3f66f7df83 Update makefiles 2017-06-08 22:20:44 +02:00
Steffen Jaeckel
eaf20dda5b demos must now link against testprof/common.o 2017-06-08 22:20:44 +02:00
Steffen Jaeckel
9b8fff6260 add testprof/common.c
so we can remove all the duplicate registration implementations
...and we can put some other shared stuff in there as well
2017-06-08 22:20:44 +02:00
Steffen Jaeckel
db5438ca55 don't build openssl-enc for tests 2017-06-08 22:19:48 +02:00
Steffen Jaeckel
08a461b39c also build openssl-enc 2017-06-08 21:32:10 +02:00
Steffen Jaeckel
4929860641 fix file modes 2017-05-31 01:57:40 +02:00
Steffen Jaeckel
1de3f2a1f6 correctly NOP
there's still mac_test() which doesn't NOP correctly but who cares anyway?
2017-05-30 11:20:18 +02:00
Steffen Jaeckel
f1118b4647 Merge pull request #222 from bmwiedemann/develop
sort input files
2017-05-29 18:18:57 +02:00
Bernhard M. Wiedemann
704055810f sort input files
when building packages (e.g. for openSUSE Linux)
(random) filesystem order of input files
influences ordering of functions in the output,
thus without the patch, builds (in disposable VMs) would differ.

See https://reproducible-builds.org/ for why this matters.
2017-05-29 14:58:07 +02:00
Steffen Jaeckel
04573d8100 Merge pull request #221 from ksherlock/echo-n
echo -n portability
2017-05-24 09:46:02 +02:00
Kelvin Sherlock
9913c1dcb8 AIX and OS X (and maybe BSD) sh has a built-in echo which doesn’t support the -n flag (OS X sh is actually bash but it doesn’t support -n based on compile-time flags and the POSIXLY_CORRECT environment variable).
AIX /bin/echo doesn’t support -n.

AIX echo and OS X /bin/echo support \c to prevent a trailing newline but linux echo (bash builtin and /bin/echo) don’t support it unless you also use the -e flag (which is not support by AIX /bin/echo or OS X sh or /bin/echo).

The BSD echo man page suggests using printf to avoid trailing newline, which is available on linux, OS X, and AIX.
2017-05-22 17:30:30 -04:00
Steffen Jaeckel
88eec86d1a Merge pull request #220 from ksherlock/compare_testvector
replace XMEMCMP with compare_testvector
2017-05-22 21:50:04 +02:00
Kelvin Sherlock
a8d81a7214 fix sha3 test numbers 2017-05-21 15:32:16 -04:00
Kelvin Sherlock
30f8aaad8c replace XMEMCMP with compare_testvector, other consistency cleanup in testing code. 2017-05-14 22:17:59 -04:00
Steffen Jaeckel
4efe229726 Merge pull request #208 from libtom/improve/makefiles
Re-work, improve & fix makefiles
2017-05-11 23:56:47 +02:00
Steffen Jaeckel
a12b97f84e travis doesn't seem to provide lcov... 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
90d5fe5bdb re-format .travis.yml
no sudo required to gem install
2017-05-11 23:04:37 +02:00
Steffen Jaeckel
56283c947a improve coverage creation 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
6a4978ef5e better EXTRALIBS 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
81f0297285 small fix-ups 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
7379c94f0a merge .include and .common makefiles 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
2c27aee5d4 fixup df733f79fa 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
ea67579298 further clean-up
- improve doc generation
- update version handling
  no need for VERSION_{MAJ,MIN}
2017-05-11 23:04:37 +02:00
Steffen Jaeckel
6cd8f2504b clean-up some makefiles
move shared variables between makefile and makefile.shared
  to makefile.include
2017-05-11 23:04:37 +02:00
Steffen Jaeckel
d996958133 move biggest part of install rules to makefile.common 2017-05-11 23:04:37 +02:00
Karel Miko
2b9dbb4ff7 cosmetics in makefile.unix|mingw|msvc 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
0cd9e94736 Partially revert "don't include testprof for library build"
This partially reverts commit 3a1cbcfee2a16d15167876423b6ca720458e801a.
2017-05-11 23:04:37 +02:00
Steffen Jaeckel
794a416715 fix libtomcrypt.pc installation 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
abe9116de5 introduce makefile.common 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
ee0874b50b minor improvements 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
3c5ec6b699 split-out binary installation in separate install target 2017-05-11 23:04:37 +02:00
Karel Miko
7ed5a832b0 tuning makefile.msvc+mingw 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
37fa03829c use gnu-make wildcard to get source files 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
12cf50d4e2 move translation rule after modifications of CFLAGS 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
39f12dafc4 make travis build a bit more verbose 2017-05-11 23:04:37 +02:00
Karel Miko
ab34b0bd93 or perhaps exclude .git* 2017-05-11 23:04:37 +02:00
Karel Miko
85197a485a do not exclude anything during make zipup 2017-05-11 23:04:37 +02:00
Karel Miko
add3495bfc fix perlcritics warnings in helper.pl 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
5e4415427a OSX touch has no "--reference" long-option, only "-r" 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
c93bee9575 rename perlcritic make target & also run helper.pl -a 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
b35ce0467b move documentation-related files to doc folder 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
6e484cd420 use make internal macros 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
c0abe2a5dc crypt doesn't exist anymore 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
8ee458b625 don't include testprof for library build
...well msvc still does it as I can't test it...
2017-05-11 23:04:37 +02:00
Steffen Jaeckel
1b71e23e42 fix some testprof related errors 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
544f7cc6ce ignore eclipse special files 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
ee17cc2e67 compress archive to xz 2017-05-11 23:04:37 +02:00
Karel Miko
1300c5ade5 make fixupind.pl part of helper.pl 2017-05-11 23:04:37 +02:00
Karel Miko
3176103c15 fix makefile.icc in makefile update scripts 2017-05-11 23:04:37 +02:00
Karel Miko
31cf796011 updated makefile.unix should work fine with Intel C compiler, so no need to keep an extra clone - makefile.icc 2017-05-11 23:04:37 +02:00
Karel Miko
9a3db508bb typo in "git commit: .." 2017-05-11 23:04:37 +02:00
Karel Miko
5c2bea093a zipup target facelift 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
3fd1771d35 also install useful demos 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
90daad0764 add new make-target 'bins'
so you can easily build the useful demos
2017-05-11 23:04:37 +02:00
Steffen Jaeckel
85dc39483f rename crypt to ltcrypt
a binary called crypt already exists and creates a name-clash as we won't
implement the entire CLI even if this tool implements similar functionality
2017-05-11 23:04:37 +02:00
Karel Miko
f544418d56 re-work makefile.mingw in the same style as makefile.unix 2017-05-11 23:04:37 +02:00
Karel Miko
c225f22a23 remove building dynamic libs from makefile.unix 2017-05-11 23:04:37 +02:00
Karel Miko
ceb7332631 typo 2017-05-11 23:04:37 +02:00
Karel Miko
3540eedb4a HP-UX make does not like ?= and $< 2017-05-11 23:04:37 +02:00
Karel Miko
bb4a051e40 makefile.unix facelift 2017-05-11 23:04:37 +02:00
Karel Miko
bf45ea66e5 drop the need for testprof/makefile* 2017-05-11 23:04:37 +02:00
Karel Miko
2c97498554 wipe out testprof/makefile* 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
93067e189a fix testprof/makefile.shared 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
7ac857686d add git version as compile flag 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
7898864b24 use glibtool on Macs 2017-05-11 23:04:37 +02:00
Steffen Jaeckel
d21d01bcb5 consolidate makefiles a bit 2017-05-11 23:04:37 +02:00
karel-m
c2bb38555e Merge pull request #218 from libtom/pr/fix-clang-static-analyzer-warnings
Clang static analyzer warnings/errors - related to #217
2017-05-11 22:55:39 +02:00
Karel Miko
43e46a2efc fix clang static analyzer warnings/errors - see #217 2017-05-11 20:37:06 +02:00
karel-m
08cc78007b Merge pull request #211 from libtom/pr/win32-rng_nix
Windows: fix various compiler warnings
2017-05-11 18:10:08 +02:00
Karel Miko
786853cb5c move #if defined(LTC_BASE64) 2017-05-11 17:42:43 +02:00
Karel Miko
ef6223f013 fix misleading-indentation warnings (mingw + gcc 7.1 + -Wall -Wextra) 2017-05-11 17:42:43 +02:00
Karel Miko
9d2b352867 fix ulong64 related format errors 2017-05-11 17:42:43 +02:00
Karel Miko
af4f6b374d better warning fix in der_tests 2017-05-11 17:42:43 +02:00
Karel Miko
9ba9677d94 x86_prof - spd1, spd2, avg are now ulong64 2017-05-11 17:42:43 +02:00
Karel Miko
a69e55ba54 tuning win warnings fixes 2017-05-11 17:42:43 +02:00
Karel Miko
e2cf11da25 fix windows warnings - #212 and #213 2017-05-11 17:42:43 +02:00
Karel Miko
6d70827d1f Windows: fix warning: 'rng_nix' defined but not used 2017-05-11 17:42:43 +02:00
karel-m
55a7eead7f Merge pull request #215 from libtom/pr/lint-20170509
Another fixes related to  #199
2017-05-10 19:36:20 +02:00
Karel Miko
91b61630be improved #ifdefs - related to: 'num' not referenced 2017-05-09 21:43:28 +02:00
Karel Miko
04262d3aec fix: local struct member 'poly_div' not referenced 2017-05-09 21:31:12 +02:00
Karel Miko
f6ea738fee fix: Loss of sign (initialization) (int to unsigned long long) 2017-05-09 21:30:44 +02:00
karel-m
b439f83018 Merge pull request #210 from libtom/pr/aix-fix
IBM xlc compiler related fixes
2017-05-05 19:58:14 +02:00
Karel Miko
421266cf5f fix void *orig 2017-05-05 19:57:20 +02:00
Karel Miko
adf0ad95c9 IBM xlc compiler does not like "static inline" (related to #209) 2017-05-05 19:57:20 +02:00
Steffen Jaeckel
87be6d3d70 Merge pull request #203 from libtom/improve/crypt
Improve hashsum
2017-05-04 16:03:57 +02:00
Steffen Jaeckel
85c2186ae6 better output on stderr 2017-05-03 18:10:46 +02:00
Steffen Jaeckel
e9923129c8 fix LTC_EASY compilation 2017-05-03 18:10:46 +02:00
Steffen Jaeckel
b472ef31a2 looks like the previous output was not really shaXsum compatible... 2017-05-03 18:10:46 +02:00
Steffen Jaeckel
28f8a85246 update coverage.sh
* hashsum requires now a '-a' option flag for the algorithm
* '-h' is required to output the list of algorithms to stdout
* the algorithms are printed in columns, so we have to sort differently
2017-05-03 18:10:46 +02:00
Steffen Jaeckel
9893566ae9 add shasum compatibility for '-a' option 2017-05-03 18:10:45 +02:00
Steffen Jaeckel
ea7115dc65 implement file checking 2017-05-03 18:10:45 +02:00
Steffen Jaeckel
31dcb9ff2a only set outlen on success 2017-05-03 18:10:45 +02:00
Steffen Jaeckel
d02531d4d2 improve hashsum a bit 2017-05-03 18:10:45 +02:00
karel-m
1712c0eae1 Merge pull request #205 from libtom/pr/shake-be-fix
SHAKE (SHA3 related) big endian fix
2017-05-03 17:06:27 +02:00
Karel Miko
4e66160ac2 one more readable for loop 2017-05-03 17:01:18 +02:00
Karel Miko
f831e27702 more readable for loops 2017-05-03 12:56:25 +02:00
Karel Miko
a1615daa3c shake be fix (hopefully final) 2017-05-03 12:56:25 +02:00
Karel Miko
961b6109d5 cosmetics 2017-05-03 12:56:25 +02:00
Karel Miko
da8501f55a sha3_shake_done another be fix 2017-05-03 12:56:25 +02:00
Karel Miko
c3f2e4530a declaration of ‘i’ shadows a previous local (better) 2017-05-03 12:56:25 +02:00
Karel Miko
df4e47978e declaration of ‘i’ shadows a previous local 2017-05-03 12:56:25 +02:00
Karel Miko
e5c0e7ffd3 SHAKE (SHA3 related) big endian fix 2017-05-03 12:56:25 +02:00
Steffen Jaeckel
67ca1c0b9a fix for compilation with LTC_DEBUG 2017-05-03 12:37:24 +02:00
karel-m
d936273711 Merge pull request #207 from libtom/feature/pkcs1ssl
PKCS #1 v1.5 padding - No ASN.1
2017-05-02 09:17:16 +02:00
Karel Miko
f00f857224 tests for rsa_sign|verify with LTC_PKCS_1_V1_5_NA1 2017-05-01 23:17:32 +02:00
Steffen Jaeckel
aa4bae5ae9 add option to do PKCS#1 v1.5 EMSA without ASN.1 around hash
Somehow someone forgot to add the OID in the signature field
of a SERVER_KEY_EXCHANGE message in early versions of the SSL protocol.
Therefore provide an option to be able to sign/verify a message
in that format.
2017-05-01 23:15:11 +02:00
Steffen Jaeckel
25878ed632 Merge pull request #202 from fperrad/20170430_lint
more linting
2017-05-01 22:07:51 +02:00
Francois Perrad
a52b586ed2 Unusual use of a Boolean expression 2017-05-01 14:51:35 +02:00
Steffen Jaeckel
2858373e2e clean stack properly 2017-05-01 14:12:47 +02:00
Steffen Jaeckel
3e2ac192a1 Merge pull request #200 from fperrad/20170429_lint
LTC_PTHREAD: some linting
2017-05-01 14:08:59 +02:00
karel-m
91c0071b6b Merge pull request #201 from libtom/pr/lint-20170429
lint fixes discussed in #199
2017-04-30 09:43:47 +02:00
Karel Miko
87142382da lint fixes discussed in #199 2017-04-29 19:59:03 +02:00
Francois Perrad
7e72dafe5f remove useless semicolon
the macro LTC_MUTEX_TYPE already contains a semicolon
see https://github.com/libtom/libtomcrypt/blob/develop/src/headers/tomcrypt_custom.h#L552
2017-04-29 17:52:27 +02:00
karel-m
253f3c45e1 Merge pull request #186 from libtom/pr/stream_rc4_sober128
Move rc4 + sober128 to src/stream/
2017-04-29 15:50:38 +02:00
Karel Miko
6417f96ea9 fortuna - import does not fail when input data are larger than export_size 2017-04-29 14:12:36 +02:00
Karel Miko
d7f2b2dd6e fortuna - move LBL_UNLOCK before zeromem 2017-04-29 13:39:48 +02:00
Karel Miko
c6cee7bef0 prngs/sober128 - import fix 2017-04-29 13:36:45 +02:00
Karel Miko
9c972c833d fix chacha20poly1305_test 2017-04-29 13:30:19 +02:00
Karel Miko
eb209aa2f9 more error checking in *_test 2017-04-28 19:24:58 +02:00
Karel Miko
90b482aa1e stream/chacha - improved counter increment 2017-04-28 19:24:58 +02:00
Karel Miko
9232f2e970 fortuna/yarrow & export_size 2017-04-28 19:24:58 +02:00
Karel Miko
1732ed8ce8 increase coverage 2017-04-28 19:24:58 +02:00
Karel Miko
784a009efe increase coverage 2017-04-28 19:24:58 +02:00
Karel Miko
da25a23712 increasing prngs/rc4 coverage 2017-04-28 19:24:58 +02:00
Karel Miko
28927be1dd typo LTC_CHACHA_PRNG / LTC_CHACHA20_PRNG 2017-04-28 19:24:58 +02:00
Karel Miko
0df0c9b12c LTC_CHACHA_STREAM >> LTC_CHACHA 2017-04-28 19:24:58 +02:00
Karel Miko
dd35e86c60 renaming rc4+sober128 stream API to *_stream_* 2017-04-28 19:24:58 +02:00
Karel Miko
28835a513f update makefiles 2017-04-28 19:24:58 +02:00
Karel Miko
fe14c8bfaf Move RC4 + SOBER128 to src/stream/ 2017-04-28 19:24:58 +02:00
Steffen Jaeckel
93317a1d6a Merge pull request #54 from libtom/feature/doc
Feature/doc (only crypt.tex + changes)
2017-04-26 00:23:34 +02:00
Steffen Jaeckel
0094552828 add doc for ASN.1 GeneralizedTime 2017-04-25 21:23:25 +02:00
Steffen Jaeckel
57c703b14c update doc process a bit
* remove crypt.pdf from repo
* ignore generated PDF's
* make refman.pdf generation silent
2017-04-25 21:23:25 +02:00
Kelvin Sherlock
b234e6b4ca add missing hash descriptors to the documentation. sha1 no longer recommended. 2017-04-25 21:23:25 +02:00
Steffen Jaeckel
8e03799eb6 fix/improve doxygen generation 2017-04-25 21:23:25 +02:00
Steffen Jaeckel
6c1d614a92 update Doxyfile to a more recent version of doxygen 2017-04-25 21:23:25 +02:00
Steffen Jaeckel
434280587a also apply the verbosity settings to the doc generation 2017-04-25 21:23:25 +02:00
Michael Stapelberg
deeea5a1ec fix crypt.tex with newer LaTeX: s/here/h/g
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=790321 for context
2017-04-25 21:23:24 +02:00
Steffen Jaeckel
84606ab8de minor spelling corrections 2017-04-25 21:23:24 +02:00
Pascal Brand
1cf965cfcc Add doc for CCM Authentication full set of functions
Change-Id: I2830ea3c04fd0410cc12137be41e6c511c4a47fe
2017-04-25 21:23:24 +02:00
Steffen Jaeckel
699f52418e don't use SHA1
@buggywhip is right

[skip ci]
2017-04-25 21:23:24 +02:00
Steffen Jaeckel
17b961e554 update changes document
include changes proposed by @buggywhip
fix typos

[skip ci]
2017-04-25 21:23:24 +02:00
Steffen Jaeckel
6a47cb5931 describe behavior of the flexi decoder on unknown identifiers 2017-04-25 21:23:24 +02:00
Steffen Jaeckel
627aef962c add documentation of ASN.1 context-specific decoding 2017-04-25 21:23:24 +02:00
Steffen Jaeckel
3233e51a23 update documentation regarding RSA key import/export 2017-04-25 21:23:24 +02:00
Steffen Jaeckel
2a98d0a11f adapt dynamic language documentation to modified API and functionality 2017-04-25 21:23:24 +02:00
Larry Bugbee
d2047f4b61 added sec 11.3, dynamic lang support 2017-04-25 21:23:24 +02:00
Steffen Jaeckel
3c8743e102 add SHA512/t documentation 2017-04-25 21:23:24 +02:00
Steffen Jaeckel
a5d95448e1 use ulong32 resp. ulong64 in the tables of the Macros section
This closes #16
2017-04-25 21:23:23 +02:00
Steffen Jaeckel
1367c1d685 fix build error 2017-04-25 21:23:23 +02:00
Steffen Jaeckel
d010f19587 add documentation of the new RSA API functions 2017-04-25 21:23:23 +02:00
Steffen Jaeckel
331f76c0ec add documentation of the newly added ASN.1 types 2017-04-25 21:23:23 +02:00
Steffen Jaeckel
df8814dfef some minor corrections/improvements 2017-04-25 21:23:23 +02:00
Steffen Jaeckel
e212f04f0f trim trailing spaces 2017-04-25 21:23:23 +02:00
Steffen Jaeckel
82ea2ee3da update changes document 2017-04-25 21:23:23 +02:00
Steffen Jaeckel
f73a342b17 oops, it's not yet released
[skip ci]
2017-04-25 21:23:23 +02:00
Steffen Jaeckel
f44c972b10 update changes document
[skip ci]
2017-04-25 21:23:23 +02:00
Steffen Jaeckel
4d35336e38 more documentation 2017-04-25 21:23:22 +02:00
Steffen Jaeckel
94f1b407d1 start updating documentation 2017-04-25 21:23:22 +02:00
Karel Miko
0d998fd4c8 stream/chacha ivlen cosmetics 2017-04-25 01:10:15 +02:00
karel-m
e4793b50d0 Merge pull request #193 from libtom/pr/mac-blake2
BLAKE2 based MACs
2017-04-25 00:11:45 +02:00
Karel Miko
0f0f1e40be indentation 2017-04-24 21:59:21 +02:00
Karel Miko
3ea8a00ecd new multi_test 2017-04-23 23:29:10 +02:00
Karel Miko
08ea7fc0f4 demos/multi.c -> testprof/multi_test.c 2017-04-23 23:27:54 +02:00
Karel Miko
d587b380e6 updating demos/multi.c 2017-04-23 23:27:54 +02:00
Karel Miko
61105b67f4 test vectors from https://github.com/BLAKE2 2017-04-23 23:27:54 +02:00
Karel Miko
1c68bf9a74 update file_test 2017-04-23 23:27:54 +02:00
Karel Miko
f767ea3dcd update makefiles 2017-04-23 23:27:54 +02:00
Karel Miko
0d585958c1 BLAKE2 based MACs 2017-04-23 23:27:54 +02:00
Steffen Jaeckel
76fbac87e2 Merge pull request #195 from libtom/pr/hashes
improve hashsum
2017-04-23 23:24:11 +02:00
Steffen Jaeckel
943c7a7cfc use hash_filehandle() to read from stdin 2017-04-23 22:37:32 +02:00
Steffen Jaeckel
a6b8e52c43 make output equal to output of sha1sum etc. 2017-04-23 17:32:21 +02:00
Steffen Jaeckel
4ddee31de7 run hashsum for all hash algorithms 2017-04-23 16:10:01 +02:00
Steffen Jaeckel
7a83cea4db use appropriate names for sha3 hashes 2017-04-23 15:55:49 +02:00
karel-m
7ad6fcfa63 Merge pull request #194 from libtom/pr/helperpl-check-hashes
helper.pl --check-hashes + related fixes
2017-04-21 21:21:19 +02:00
Karel Miko
6d404afc97 helper.pl --check-hashes + related fixes 2017-04-21 21:20:31 +02:00
Steffen Jaeckel
75f2529cdf also run multi for coverage 2017-04-21 19:45:59 +02:00
Steffen Jaeckel
290926fe8a include CFLAGS when building demos 2017-04-21 19:45:59 +02:00
karel-m
65ace1a378 Merge pull request #184 from libtom/pr/file-related-tests
Facelift of *_file functions
2017-04-21 17:20:41 +02:00
Karel Miko
dae70f9ba4 update testprof/makefile* 2017-04-21 16:12:41 +02:00
Karel Miko
d1ae2889ae add file_test() 2017-04-21 16:12:18 +02:00
Karel Miko
336c52ca5f Facelift of *_file functions 2017-04-21 16:11:22 +02:00
Steffen Jaeckel
513fcf35fe Merge pull request #191 from ksherlock/blake2s
blake2s hash
2017-04-20 21:03:14 +02:00
Kelvin Sherlock
609d0afd00 updated hash_tv.txt 2017-04-20 12:28:38 -04:00
Kelvin Sherlock
56a2efa729 fix blake2s-160/224 hash sizes. 2017-04-20 11:22:16 -04:00
Kelvin Sherlock
4f7264135f update test vectors 2017-04-20 09:36:35 -04:00
Kelvin Sherlock
0109e3ca78 update tv_gen.c 2017-04-19 17:03:34 -04:00
Kelvin Sherlock
4905232eda more tests. 2017-04-19 16:50:34 -04:00
Kelvin Sherlock
c65d24222e always zeromem hash_state when done 2017-04-19 16:47:03 -04:00
Kelvin Sherlock
2dc574d477 use - in hash descriptors. 2017-04-19 16:46:36 -04:00
Kelvin Sherlock
4ee9d767bb add key/keylen parameters to blake2x_init 2017-04-10 18:29:51 -04:00
Kelvin Sherlock
0f97bb7415 fix burn blake2b stack size. 2017-04-10 16:37:34 -04:00
Kelvin Sherlock
55450078ea use compare_testvector in tests. 2017-04-10 12:00:22 -04:00
Kelvin Sherlock
ea8dde7f63 formatting 2017-04-10 11:34:59 -04:00
Kelvin Sherlock
dfbdb626c3 add missing const. 2017-04-10 10:50:34 -04:00
Kelvin Sherlock
6b46b447b5 replace packed parameter struct with offsets into a unsigned char buffer. 2017-04-10 10:40:20 -04:00
Kelvin Sherlock
6acdfe9a55 cleanup, resins with updated reference source 2017-04-10 10:22:50 -04:00
Kelvin Sherlock
afc6e8d370 minor cleanup. 2017-04-10 10:21:51 -04:00
Kelvin Sherlock
b4594ab3c6 remove inline and c99 variable declarations. 2017-04-09 17:22:42 -04:00
Kelvin Sherlock
268c87e33d add LTC_ARGCHK for blake2b_process. 2017-04-08 17:00:39 -04:00
Kelvin Sherlock
b412ab539a update makefiles for blake2b. 2017-04-08 15:44:30 -04:00
Kelvin Sherlock
6f6e2d30a8 clang-format 2017-04-08 15:43:38 -04:00
Kelvin Sherlock
7c5fef9b71 add blake2b hash 2017-04-08 15:40:56 -04:00
Kelvin Sherlock
5924bd43e6 tweak source to conform a little better 2017-04-08 15:40:20 -04:00
Kelvin Sherlock
b0e9a23e31 makefile updates. 2017-04-07 23:47:16 -04:00
Kelvin Sherlock
51075724c1 use hash_state * for all arguments. 2017-04-07 23:46:52 -04:00
Kelvin Sherlock
063df0bffe more tests. 2017-04-07 23:46:17 -04:00
Kelvin Sherlock
4449cdcea3 sort and number the ltc_hash_descriptors. 2017-04-07 23:45:49 -04:00
Kelvin Sherlock
1b5ae955d2 moe clang-format 2017-04-07 21:24:47 -04:00
Kelvin Sherlock
51f6b063d6 clang format 2017-04-07 21:12:54 -04:00
Kelvin Sherlock
647b53d880 add blake2s to various places. 2017-04-07 20:50:28 -04:00
Kelvin Sherlock
68296e0608 blake2s hash 2017-04-07 20:47:44 -04:00
Steffen Jaeckel
904eee0975 Merge pull request #190 from fperrad/20170407_lint
chacha: more linting
2017-04-07 18:49:47 +02:00
Francois Perrad
b6c27c2f08 no room for nul terminator 2017-04-07 12:16:48 +02:00
Francois Perrad
0be45a6341 remove unreachable code 2017-04-07 12:16:44 +02:00
Steffen Jaeckel
13b2220c61 Merge pull request #189 from fperrad/20170406_lint
remove suspicious ;
2017-04-07 10:35:11 +02:00
Francois Perrad
9941648125 remove suspicious ; 2017-04-07 00:17:43 +02:00
Steffen Jaeckel
08415d37f3 fix compare_testvector() macro 2017-04-06 22:47:36 +02:00
Steffen Jaeckel
e4331bcc17 Merge pull request #188 from fperrad/20170405_lint
misuse of compare_testvector
2017-04-06 22:46:24 +02:00
Francois Perrad
168472f753 misuse of compare_testvector 2017-04-05 09:28:32 +02:00
karel-m
fbe7d222c3 Merge pull request #185 from libtom/pr/chacha_prng-chacha20_prng
chacha_prng > chacha20_prng
2017-04-04 00:47:17 +02:00
Karel Miko
eefb8dc479 renaming prngs/chacha.c prngs/chacha20.c 2017-04-03 22:54:27 +02:00
Karel Miko
bfe9484a3d renaming chacha_prng > chacha20_prng 2017-04-03 22:52:17 +02:00
karel-m
5199b54635 Merge pull request #171 from libtom/pr/chacha20poly1305
RFC 7539 - ChaCha20 and Poly1305 + ChaCha20 based PRNG
2017-04-03 21:21:20 +02:00
Karel Miko
2520e6c061 add link to arc4random.c which was the inspiration for chacha_prng 2017-04-03 20:04:00 +02:00
Karel Miko
7b93f04390 wrong use of sizeof(buf) 2017-04-03 19:54:51 +02:00
Karel Miko
ce37498ec6 chacha_prng_desc > chacha20_prng_desc 2017-04-03 19:52:03 +02:00
Karel Miko
08a028ab04 missing LTC_FILE_READ_BUFSIZE in crypt.c 2017-04-02 18:13:45 +02:00
Karel Miko
883db95da2 FILE_READ_BUFSIZE > LTC_FILE_READ_BUFSIZE 2017-04-02 18:13:45 +02:00
Karel Miko
06b1582de6 new #define FILE_READ_BUFSIZE 2017-04-02 18:13:45 +02:00
Karel Miko
ff5b02d371 LTC_CHACHA vs. LTC_CHACHA20_PRNG 2017-04-02 18:13:45 +02:00
Karel Miko
2656a040e0 chacha_prng > chacha20_prng 2017-04-02 18:13:45 +02:00
Karel Miko
3a05f0331d chachapoly_state > chacha20poly1305_state 2017-04-02 18:13:45 +02:00
Karel Miko
11a9dc50b3 poly_state > poly1305_state 2017-04-02 18:13:45 +02:00
Karel Miko
39028bbeed more tests in chacha20poly1305_test 2017-04-02 18:13:45 +02:00
Karel Miko
31b52a354d padlen in chacha20poly1305_decrypt 2017-04-02 18:13:45 +02:00
Karel Miko
5797b0cc1e test for chacha_ivctr64 (2) 2017-04-02 18:13:45 +02:00
Karel Miko
53c00d14e5 test for chacha_ivctr64 2017-04-02 18:13:45 +02:00
Karel Miko
a517db2514 cosmetics 2017-04-02 18:13:45 +02:00
Karel Miko
3cfb58c2f4 update makefiles 2017-04-02 18:13:45 +02:00
Karel Miko
c8cb714e08 added chacha_done 2017-04-02 18:13:45 +02:00
Karel Miko
ff6abc776c RFC 7539 - ChaCha20 and Poly1305 + chacha based PRNG 2017-04-02 18:13:45 +02:00
Karel Miko
6844275e82 silence MSVC compiler warning 2017-04-02 17:42:28 +02:00
Karel Miko
df733f79fa removing VS2005 residual that should be removed in #168 2017-04-02 17:42:22 +02:00
Steffen Jaeckel
e3b5a858c3 Merge pull request #182 from libtom/feature/generalizedtime
add GeneralizedTime DER processing
2017-03-31 20:22:38 +02:00
Steffen Jaeckel
78a32430d4 more tests 2017-03-31 18:24:42 +02:00
Steffen Jaeckel
2c52bf75f4 bugfixing 2017-03-31 18:24:42 +02:00
Steffen Jaeckel
08503a02f5 update error codes
This closes #180
2017-03-31 15:12:12 +02:00
Steffen Jaeckel
1f0daf1eff fix compiler warning 2017-03-31 00:57:22 +02:00
Steffen Jaeckel
83780d4764 add timezone-offset support to GeneralizedTime
this also fixes a bug in the length generation
2017-03-30 22:48:42 +02:00
Steffen Jaeckel
59b4026fa7 Update makefiles 2017-03-30 22:29:02 +02:00
Steffen Jaeckel
2bd517307c add GeneralizedTime DER en-/decode 2017-03-30 22:29:02 +02:00
Steffen Jaeckel
f7cb199066 add test proposed by @karel-m 2017-03-30 22:29:02 +02:00
Steffen Jaeckel
77019928dd Merge pull request #79 from libtom/feature/rsa_import_x509
RSA import x509
2017-03-30 22:28:24 +02:00
Steffen Jaeckel
ac7915ed13 Update makefiles 2017-03-30 18:46:05 +02:00
Steffen Jaeckel
856d542a1c turn around the order when free'ing an rsa_key struct 2017-03-30 18:46:05 +02:00
Steffen Jaeckel
ec327b3d86 move x509 processing to rsa_import_x509() 2017-03-30 18:46:05 +02:00
Steffen Jaeckel
019a9e9850 add stinky certificate 2017-03-30 18:46:04 +02:00
Steffen Jaeckel
27722734b2 let's use an empty list element to signal an empty sequence 2017-03-30 18:46:04 +02:00
Steffen Jaeckel
39b2a8daca add tests for new functionality of der_encode_flexi() and rsa_import() 2017-03-30 18:46:04 +02:00
Steffen Jaeckel
f9bce83329 add possibility to rsa_import() the public key of an x.509 certificate 2017-03-30 18:46:04 +02:00
Steffen Jaeckel
2e822a80a8 add der_sequence_shrink()
in case you want to keep a sequence over a longer time, but you don't
need all the raw constructed, set or sequence data
2017-03-30 18:46:04 +02:00
Steffen Jaeckel
7ddce245b8 save the plain constructed-, sequence- or set-data details 2017-03-30 18:46:04 +02:00
karel-m
0a400f465f Merge pull request #181 from libtom/pr/demo-test-facelift 2017-03-30 16:59:43 +02:00
Karel Miko
2a2968ae92 demos/test facelift 2017-03-30 16:56:10 +02:00
Steffen Jaeckel
4874430dec send travis notifications to #libtom-notifications 2017-03-30 15:49:04 +02:00
karel-m
4bcd48411a Merge pull request #173 from libtom/pr/sha3 2017-03-29 13:46:04 +02:00
Karel Miko
c6a0362c88 SHA3 2017-03-29 13:44:04 +02:00
karel-m
1b81848576 Merge pull request #168 from libtom/pr/msvc-cleanup
Improving MS Windows builds (msvc)
2017-03-29 09:07:58 +02:00
Karel Miko
7bb7bdde1d improving MS Windows builds (msvc) 2017-03-29 08:48:33 +02:00
Steffen Jaeckel
783cbc7917 Merge branch 'fix/25' into develop
This closes #25
2017-03-28 22:57:35 +02:00
Steffen Jaeckel
d153d1303a Update makefiles 2017-03-28 22:57:22 +02:00
Steffen Jaeckel
8af93d1d0d Remove ccm_memory_ex() 2017-03-28 22:57:22 +02:00
Steffen Jaeckel
363a57fc87 Merge branch 'fix/6' into develop
This closes #6 & #179
2017-03-28 22:55:49 +02:00
Steffen Jaeckel
8518b56dbf Revert "fix rotate_test to pass rotate by zero with LTC_NO_ASM"
This reverts commit 82080f0b87.
2017-03-28 21:18:22 +02:00
Steffen Jaeckel
70ee598c5e fix LTC_NO_ASM rotate macros when compiling with clang 2017-03-28 21:18:22 +02:00
Karel Miko
82080f0b87 fix rotate_test to pass rotate by zero with LTC_NO_ASM 2017-03-27 22:03:33 +02:00
Karel Miko
e5aa2bd453 added rotate_test 2017-03-27 19:32:05 +02:00
Steffen Jaeckel
7532b89a6d Merge pull request #177 from libtom/pr/177
Add -Wdeclaration-after-statement to travis-ci tests
2017-03-26 23:47:42 +02:00
Steffen Jaeckel
862a02767d fix constants and sizes demo 2017-03-26 21:38:02 +02:00
Steffen Jaeckel
101a7a71ae enable -Wdeclaration-after-statement by default 2017-03-26 19:30:18 +02:00
Steffen Jaeckel
7885c91af3 print math provider when running tests 2017-03-26 15:46:41 +02:00
Steffen Jaeckel
ea355dbc79 there's no reason to disable DH when using GMP as MPI provider 2017-03-24 16:58:04 +01:00
Steffen Jaeckel
ba338eced8 also build executables in makefile.shared from template 2017-03-24 16:42:49 +01:00
Karel Miko
b465881b58 fix "declaration-after-statement" warnings (tests only) 2017-03-24 10:17:02 +01:00
Steffen Jaeckel
fd1e351316 Merge pull request #78 from libtom/idea/ltc_rng
add ltc_rng function pointer
2017-03-22 12:16:46 +01:00
Karel Miko
15db3eab59 fix travis failure 2017-03-22 11:24:21 +01:00
Steffen Jaeckel
27f8e8bf75 Update makefiles 2017-03-22 11:24:21 +01:00
Steffen Jaeckel
cd08a8cec3 disable ltc_rng by default 2017-03-22 11:24:21 +01:00
Steffen Jaeckel
fcae7e2c49 test the ltc_rng 2017-03-22 11:24:21 +01:00
Steffen Jaeckel
fe7c4e3993 add ltc_rng function pointer
the idea is to be able to easily provide a plug-in rng for a specific
platform without the need to touch the library.
2017-03-22 11:24:21 +01:00
Steffen Jaeckel
a00aba8370 add pre-commit hook 2017-03-22 11:21:49 +01:00
Steffen Jaeckel
f7bd454dd5 Revert "add release flag to makefile.shared"
This reverts commit 14272976d0.

This is neither a 'package-internal library' nor
one 'whose interfaces change very frequently' so we remove the
release information again from the shared library.
2017-03-22 11:21:39 +01:00
Karel Miko
283ea0c426 improving helper.pl 2017-03-21 19:56:43 +01:00
karel-m
63e6f7647f Merge pull request #169 from libtom/pr/more-src-checks
Improved source checks
2017-03-15 23:14:40 +01:00
Karel Miko
39425a94c5 improved source checks 2017-03-15 23:13:46 +01:00
Steffen Jaeckel
9babf374ee add '-c' option (again) to updatemakes.sh 2017-03-15 22:21:53 +01:00
karel-m
6df687403a Merge pull request #167 from libtom/pr/avoid-cpp-style-comments
avoid C++ style comments
2017-03-15 15:22:40 +01:00
Karel Miko
54a26525dc avoid C++ style comments 2017-03-15 15:22:06 +01:00
Karel Miko
db32cc3a81 Merge branch 'fperrad-20170315_lint' into develop 2017-03-15 13:07:54 +01:00
karel-m
bda8019862 Merge pull request #161 from libtom/pr/83-polished
Just polished #83 (Add OpenSSL-Compatible PKCSv5#1)
2017-03-15 09:05:58 +01:00
Karel Miko
3396513e81 improving demos/openssl-enc.c 2017-03-15 08:59:49 +01:00
Francois Perrad
937f186db1 use #ifdef instead of #if 2017-03-15 06:55:19 +01:00
Karel Miko
4503868da2 fix pkcs_5_test crash 2017-03-14 18:22:46 +01:00
Karel Miko
0e9b3da3ea PKCS#5 alg1 tests 2017-03-14 18:22:46 +01:00
BJ Black
c7d6c3ad28 Add OpenSSL-compatible PKCS#5v1 KDF, demo of OpenSSL-compatible aes-256-cbc command. 2017-03-14 18:22:46 +01:00
karel-m
bbe54053ec Merge pull request #109 from libtom/fix/109-alternative-approach
crc32 test fails on ppc64 BE (tomcrypt_cfg.h facelift)
2017-03-14 18:18:44 +01:00
Karel Miko
e26078d2f7 fix #109 - improved arch/endianness detection + tomcrypt_cfg.h facelift 2017-03-14 18:14:57 +01:00
karel-m
44f29d895c Merge pull request #164 from libtom/pr/wchar-warnings-visual-studio-2008
fix wchar_t related warnings on Visual Studio 2008
2017-03-09 21:01:26 +01:00
Karel Miko
591ef19c7a comment: it might happen that LTC_WCHAR_MAX is undefined 2017-03-09 20:48:24 +01:00
Karel Miko
02b92405e2 simplified #ifdef 2017-03-09 20:48:24 +01:00
Karel Miko
7ab76a464e introducing LTC_WCHAR_MAX 2017-03-09 20:48:24 +01:00
Karel Miko
2f9c426487 fix wchar_t related warnings on Visual Studio 2008 2017-03-09 20:48:24 +01:00
karel-m
78e9b0fca8 Merge pull request #122 from libtom/fix/122
adler32 vs. crc32 inconsistency
2017-03-09 20:33:13 +01:00
Karel Miko
a4d61e0bea fixes #122 adler32 vs. crc32 inconsistency (bad byte order) 2017-03-09 20:32:29 +01:00
karel-m
33e1c4acca Merge pull request #158 from libtom/pr/check-makefiles
check makefiles (check_source.sh)
2017-03-09 20:29:28 +01:00
Karel Miko
84f2557cc2 updatemakes.sh newline at end of file 2017-03-09 20:19:54 +01:00
Karel Miko
6f9e427f77 comment with aes_enc "hack" (but still disabled for MS Win *.vcproj builds) 2017-03-09 20:19:53 +01:00
Karel Miko
df258453ba msvc sorting hack 2017-03-09 20:19:52 +01:00
Karel Miko
c260954b52 ordering file list whe generating msvc.proj 2017-03-09 20:19:51 +01:00
Karel Miko
8c831e1e30 no aes_enc on ms windows 2017-03-09 20:19:50 +01:00
Karel Miko
2711e40309 updatet MSVC projects 2017-03-09 20:19:48 +01:00
Karel Miko
58375b0287 updatemakes.sh now updates MS Visual C++ projects as well 2017-03-09 20:19:47 +01:00
Karel Miko
421a241ccf travis script - check wheather makefiles are updated 2017-03-09 20:19:46 +01:00
karel-m
14a7ed4609 Merge pull request #156 from libtom/improve/tests
Improve tests
2017-03-09 20:10:50 +01:00
Steffen Jaeckel
ea1228d3ab I like aligned output :)
...and I dislike c&p'ed code
2017-03-09 20:09:55 +01:00
Steffen Jaeckel
90da7e71e1 There's no need running the same test multiple times
If there would be some random input okay, but like that it's just running
the same functionality over and over again.
2017-03-09 20:09:55 +01:00
karel-m
4ef8c27031 Merge pull request #163 from libtom/pr/xts_test-move-declaration
move declaration at block beginning (+msvc 2008 tuning)
2017-03-09 20:08:45 +01:00
Karel Miko
ac3f55fd92 there is no snprintf before Visual C++ 2015 2017-03-09 20:07:39 +01:00
Karel Miko
52eaabefa9 msvc 2008 does not like { } initialization 2017-03-06 19:53:04 +01:00
Karel Miko
fb749199db moving declaration to block beginning 2017-03-06 19:51:46 +01:00
Karel Miko
081ee45712 move declaration at block beginning 2017-03-06 10:43:39 +01:00
karel-m
456908eb90 Merge pull request #159 from libtom/fix/159
Travis-CI + the latest libtommath
2017-03-02 19:45:13 +01:00
Steffen Jaeckel
2277b420f0 also install binutils from debian-sid 2017-03-02 12:18:47 +01:00
Steffen Jaeckel
f94ee4a5a7 location of new libtommath.a has changed 2017-03-02 11:41:01 +01:00
Steffen Jaeckel
8c90cba6f6 install libtommath-dev from debian sid 2017-03-02 11:27:39 +01:00
Karel Miko
61ae75a823 sort filenames on perl level during updatemakes.sh 2017-03-01 22:07:28 +01:00
Steffen Jaeckel
1e977e662f fix updatemakes.sh indentation 2017-03-01 17:52:05 +01:00
Steffen Jaeckel
199ff63e5f add '-c' option to updatemakes.sh 2017-03-01 16:00:35 +01:00
Steffen Jaeckel
2df86d65e8 don't execute coverage script for private travis 2017-03-01 15:19:34 +01:00
Steffen Jaeckel
d4cc79011b Merge branch 'pr/crc32-declaration-block-beginning' into develop
This closes #155
2017-03-01 15:03:16 +01:00
Karel Miko
1a1addcefd move declarations at the block beginning (ANSI C) 2017-03-01 15:02:08 +01:00
Steffen Jaeckel
9092470843 fix doxygen warnings 2017-03-01 15:00:41 +01:00
Steffen Jaeckel
3dd0845dec Merge pull request #139 from libtom/fix/139
rand_prime undefined reference when using  CFLAGS="-DLTM_DESC -DLTC_EASY
2017-03-01 14:58:35 +01:00
Steffen Jaeckel
4f120531ab add separate CHECK_SOURCES build target 2017-03-01 14:09:29 +01:00
Karel Miko
631a11cd35 removing "checking white spaces" part from build.sh 2017-03-01 14:00:45 +01:00
Karel Miko
be9c66ab43 tuning build.sh to handle -DLTC_EASY 2017-03-01 13:35:19 +01:00
Karel Miko
856be9cae8 tv_gen needs more #ifdefs 2017-03-01 12:09:50 +01:00
Karel Miko
dde11de781 fixing compile failure in demos for -DLTC_EASY 2017-03-01 11:48:39 +01:00
Steffen Jaeckel
00308d8651 fix base64url related errors when only LTC_BASE64 is defined 2017-03-01 11:37:49 +01:00
Steffen Jaeckel
0b79bbaf5b fix missing symbol rand_prime 2017-03-01 11:37:49 +01:00
Steffen Jaeckel
6cfc27d310 add EASY build to tests 2017-03-01 11:37:49 +01:00
Karel Miko
50aedb099c fixing warning introduced by __WCHAR_MAX__ patch 2017-02-28 23:20:19 +01:00
Karel Miko
b3534def42 Merge branch 'fperrad-20170225_lint' into develop 2017-02-28 23:07:31 +01:00
Francois Perrad
eca2290b1e missing prototypes 2017-02-28 23:07:06 +01:00
Francois Perrad
27280b86b3 static functions 2017-02-28 23:07:06 +01:00
Steffen Jaeckel
acfd16c60a fix compile error 2017-02-28 21:23:39 +01:00
karel-m
c8c0898bcb Merge pull request #149 from libtom/feature/travis_clang
Add clang to the travis build matrix
2017-02-28 20:30:15 +01:00
Steffen Jaeckel
3dbd250bc9 Add clang to the travis build matrix 2017-02-28 20:29:36 +01:00
karel-m
2edc0aeb66 Merge pull request #152 from libtom/pr/wchar-troubles-max-FFFF
better handling wchar_t when __WCHAR_MAX__ is 0xFFFF (2 bytes only)
2017-02-28 20:27:03 +01:00
Karel Miko
4bd327a4cc better handling wchar_t when __WCHAR_MAX__ is 0xFFFF (2 bytes only) 2017-02-28 20:24:49 +01:00
Karel Miko
05f85c3e6d RS2 remove 40bit limit 2017-02-28 20:20:51 +01:00
Karel Miko
797031170d Merge branch 'fix/135' into develop 2017-02-28 20:17:11 +01:00
Steffen Jaeckel
03f0674985 add compare_testvector() prototype to tomcrypt_misc.h 2017-02-28 20:09:32 +01:00
Steffen Jaeckel
9a29428f8e Add secondary rc2 setup function
...to be able to pass the effective key length.
2017-02-28 20:09:32 +01:00
Steffen Jaeckel
43c50423ad add yet another testvector 2017-02-28 20:09:32 +01:00
Steffen Jaeckel
952caf3cd7 add testvectors for smaller RC2 keysizes
originates from rfc2268

1 byte keylen is commented
2017-02-28 20:09:32 +01:00
Steffen Jaeckel
19c81bbbee fix typo 2017-02-28 20:09:32 +01:00
Karel Miko
344620a0e7 fixes #135 RC2 min keylen 40bit (was 64bit) 2017-02-28 20:09:32 +01:00
Karel Miko
e96a895d0d Merge branch 'fperrad-perlcritic' into develop 2017-02-28 20:00:25 +01:00
Francois Perrad
808616d406 sanitize some Perl scripts
(Perl4 is gone)
2017-02-28 19:59:58 +01:00
karel-m
4cdc304e37 Merge pull request #153 from libtom/fix/54-part1
part of feature/doc changes from #54
2017-02-28 19:53:03 +01:00
Karel Miko
6c8d00d1fd part of feature/doc changes 2017-02-28 17:35:57 +01:00
karel-m
b44aa8fa83 Merge pull request #151 from libtom/pr/adler32-declaration-block-beginning
move declarations at the block beginning (ANSI C)
2017-02-28 16:41:05 +01:00
Karel Miko
efbd73fbc8 move declarations at the block beginning (ANSI C) 2017-02-28 16:11:42 +01:00
karel-m
6596746c5d Merge pull request #150 from libtom/pr/conversion-related-troubles
conversion related troubles (int, size_t, ptrdiff_t ..)
2017-02-28 11:38:32 +01:00
Karel Miko
88412a9fc2 conversion related troubles (int, size_t, ptrdiff_t ..) 2017-02-28 11:30:19 +01:00
karel-m
8141ca617a Merge pull request #106 from libtom/fix/106
_base64_decode_internal not compliant with RFC4648
2017-02-28 01:28:44 +01:00
Steffen Jaeckel
abf0a18290 add some testcases 2017-02-28 01:27:07 +01:00
Steffen Jaeckel
eee936d752 add base64url_strict_encode() 2017-02-28 01:27:06 +01:00
Karel Miko
006c601efb no trailing = for base64url 2017-02-28 01:27:05 +01:00
Karel Miko
ff3a03a1d0 tuning base64 decoding implementation 2017-02-28 01:27:04 +01:00
Steffen Jaeckel
c1dd1cbe30 re-work strict/relaxed base64 decoding implementation
Instead of one API function with an option parameter, provide two API
functions.
Instead of defaulting to strict decoding, default to relaxed decoding.
2017-02-28 01:27:03 +01:00
Steffen Jaeckel
53359ccfc6 fix failing test 2017-02-28 01:27:02 +01:00
Steffen Jaeckel
bc16c149fc fix base64[url] strict/relaxed decode 2017-02-28 01:27:01 +01:00
Steffen Jaeckel
063bac396d add LTC_BASE64_STRICT to crypt_build_settings and crypt_constants 2017-02-28 01:27:00 +01:00
Steffen Jaeckel
1c0edfdead add/fix tests
add explicit strict&loose base64-decode tests
2017-02-28 01:26:58 +01:00
Steffen Jaeckel
b10f9502f8 add RFC4648 base64 decoding compliance 2017-02-28 01:26:57 +01:00
karel-m
30382d0e31 Merge pull request #144 from libtom/fix/coverity-dsa_import-double-free
fix coverity finding: dsa_import double free
2017-02-28 01:17:18 +01:00
Karel Miko
faa18e71c8 tuning indentation 2017-02-28 00:51:25 +01:00
Karel Miko
1e260eeaae fir coverity finding: dsa_import double free 2017-02-28 00:51:25 +01:00
Karel Miko
6499c70492 Merge branch 'mattkelly-fix-clang-cast-align-warnings' into develop 2017-02-27 18:13:44 +01:00
Steffen Jaeckel
ce1043c55d ignore warnings of clang created by my stdlib 2017-02-27 18:12:22 +01:00
Matt Kelly
e187f4cbf4 Fix all warnings from -Wcast-align 2017-02-26 10:12:16 -05:00
karel-m
d777f9d1dc Merge pull request #145 from libtom/fix/coverity-cbc_decrypt-out-of-bounds-read
fix coverity finding: cbc_decrypt out-of-bound read
2017-02-25 20:44:47 +01:00
Karel Miko
7246ab50da fix coverity finding: cbc_decrypt out-of-bound read 2017-02-25 19:53:52 +01:00
karel-m
7c2cc079ec Merge pull request #146 from libtom/fix/85-part3
Fix for #85 (part3)
2017-02-25 13:23:03 +01:00
Francois Perrad
4349993ad3 Suspicious use of & (part 2) 2017-02-25 13:21:34 +01:00
Karel Miko
824f3af98c check-source.pl cosmetics 2017-02-24 20:57:47 +01:00
Karel Miko
c911427cf2 check-source.pl script for checking whitespace related troubles 2017-02-24 20:51:31 +01:00
Karel Miko
953080bcea more trailing spaces + tabs outside of "src" dir 2017-02-24 20:50:37 +01:00
Karel Miko
477d621224 more trailing spaces + tabs in src 2017-02-24 20:31:48 +01:00
karel-m
f60e045034 Merge pull request #143 from libtom/fix/85-part2
Fix/85 part2
2017-02-24 19:04:46 +01:00
Francois Perrad
fc55a8fd1b remove trailing spaces 2017-02-24 19:02:43 +01:00
Francois Perrad
b0f06ed1ec add parenthese in macro 2017-02-24 19:00:36 +01:00
Francois Perrad
79d6e61aca use the variable 'err' 2017-02-24 19:00:32 +01:00
Francois Perrad
31f88a9c9b default for switch 2017-02-24 19:00:28 +01:00
Francois Perrad
203087d6d7 bug: wrong parentheses in condition with assignment 2017-02-24 19:00:24 +01:00
Karel Miko
649ef0faef forgotten trailing space 2017-02-24 16:54:01 +01:00
karel-m
01bb22e865 Merge pull request #142 from libtom/fix/85-part1
Fix/85 part1
2017-02-24 16:35:19 +01:00
Francois Perrad
58353f51e2 remove trailing spaces 2017-02-24 16:29:54 +01:00
Francois Perrad
5d7036ebe2 remove hard tab 2017-02-24 16:26:48 +01:00
Francois Perrad
9f8df116be remove useless code 2017-02-24 16:23:27 +01:00
Francois Perrad
cebf33cdce add some const 2017-02-24 16:23:23 +01:00
Francois Perrad
9749958fe5 the comment FALLTHROUGH is common for several lint tool 2017-02-24 16:23:19 +01:00
Francois Perrad
c22acc2d07 remove useless include 2017-02-24 16:23:15 +01:00
Francois Perrad
7b48f4d5f7 fix indentation 2017-02-24 16:23:10 +01:00
Steffen Jaeckel
ecb2402ba8 remove [X]CLOCKS_PER_SEC 2017-02-24 00:28:59 +01:00
Karel Miko
979e9a9d15 fix for #90 ltc_ecc_mul2add.c integer sign issue (sjaeckel's way) 2017-02-24 00:18:55 +01:00
Karel Miko
0c226834cc introducing LTC_INLINE 2017-02-23 23:47:56 +01:00
Steffen Jaeckel
c39390dba1 Merge branch 'fix/132' into develop
This closes #132
2017-02-23 11:04:10 +01:00
Karel Miko
3d5b90d24d LTC_NO_PROTOTYPES related cosmetics 2017-02-23 11:03:55 +01:00
Steffen Jaeckel
76b289833c only define LTC_NO_PROTOTYPES on one point
This closes #132
2017-02-23 11:03:55 +01:00
Steffen Jaeckel
ef023f3329 fix rsa/dsa test duplicate symbols 2017-02-21 17:32:30 +01:00
Steffen Jaeckel
fa4637e7a9 Merge branch 'fix/97' into develop
This closes #97
2017-02-21 16:57:38 +01:00
Steffen Jaeckel
55776b0ac9 update makefiles 2017-02-21 16:57:21 +01:00
Karel Miko
bbbbf5f1d5 adding rsa_import_radix tests 2017-02-21 16:55:10 +01:00
Karel Miko
a2c87f54de adding rsa_import_radix 2017-02-21 16:55:09 +01:00
Steffen Jaeckel
0cf80ef631 Merge branch 'fix/98' into develop
This closes #98
2017-02-21 16:54:25 +01:00
Karel Miko
ac6f69e8fe adding dsa_import_radix tests 2017-02-21 16:54:11 +01:00
Steffen Jaeckel
43517bca83 update makefiles 2017-02-21 16:54:11 +01:00
Karel Miko
10545366d2 adding dsa_import_radix 2017-02-21 16:54:10 +01:00
Steffen Jaeckel
a8df316581 Merge branch 'pr/133' into develop
This closes #133
2017-02-21 16:45:12 +01:00
Karel Miko
bcf7753a26 use MIN macro 2017-02-21 16:36:17 +01:00
Karel Miko
ecbac7324e DSA: properly handle FIPS 186-4 (4.6 + 4.7) 2017-02-21 16:36:17 +01:00
Steffen Jaeckel
498538f6ef Merge pull request #103 from libtom/fix/103
Serious bug in rng_get_bytes @ MS Windows
2017-02-21 14:39:54 +01:00
Karel Miko
b36e75b7f1 don't read from c:\dev\random on windows 2017-02-21 13:34:52 +01:00
Steffen Jaeckel
d727b16898 use proper defines as of [1]
[1] http://predef.sourceforge.net
2017-02-21 13:34:52 +01:00
Steffen Jaeckel
5757fdb035 Merge branch 'pr/124' into develop
This closes #124
2017-02-21 11:50:25 +01:00
zeromus
c341d36c6a do it differently 2017-02-21 11:49:35 +01:00
zeromus
32f19995f8 do it differently 2017-02-21 11:49:35 +01:00
zeromus
793ff08986 do it differently 2017-02-21 11:49:35 +01:00
zeromus
c83763bd46 fix tiny compile error in tomcrypt_pk.h macro
An ARM compiler gives me this: 

libtomcrypt\pk\asn1\der\sequence\der_decode_subject_public_key_info.c(65,4): error #188-D: enumerated type mixed with another type

Since der_decode_subject_public_key_info's parameters_type is of type 'unsigned long', an attempt to assign it to ltc_asn1_list's member 'ltc_asn1_type type' fails.

My fix solves this in a simple way by casting it at the point of assignment.

But while studying this I noticed there's no use of enum in the codebase other than a few PK-related things.  Perhaps a more appropriate solution would be to remove these enums. I mean, enums seem like an OK enough idea, but I don't know anything about the practicality of using enums in archaic C dialects like libtomcrypt conforms (thankfully!) to...
2017-02-21 11:49:35 +01:00
Steffen Jaeckel
600004fecc print ascii in print_hex() 2017-02-21 11:42:24 +01:00
Steffen Jaeckel
60bb5440fb add compare_testvector() 2017-02-21 11:42:24 +01:00
Steffen Jaeckel
383f200cb6 fix LTC_MINIMAL 2017-02-20 19:19:44 +01:00
Steffen Jaeckel
fd99c3e3c0 remove duplicate define 2017-02-20 18:58:20 +01:00
Steffen Jaeckel
08aabc7f8c improve print_hex() prototype 2017-02-17 11:53:14 +01:00
Steffen Jaeckel
8fc1af1b7e make implementation easier to read
damn you negated logic...
2017-02-15 23:15:43 +01:00
Steffen Jaeckel
f784793891 Merge pull request #129 from libtom/fix/gcm_counter_reuse
GCM counter incrementation isn't stopped at 2^32 blocks, which breaks GCM
2016-10-02 20:51:01 +02:00
Steffen Jaeckel
7d418b34b3 Fix GCM counter reuse
GCM should error out after processing (2^32)-1 blocks / (2^39)-256 bits
2016-09-28 20:18:09 +02:00
Karel Miko
6ad5225268 removing forgotten debug comment 2016-07-07 15:03:33 +02:00
Steffen Jaeckel
bb56ef08eb bring coverage results near reality 2016-04-03 17:45:16 +02:00
Steffen Jaeckel
892342c769 automatically determine the number of parallel make jobs for the tests 2016-04-03 14:12:27 +02:00
Steffen Jaeckel
da3ade0807 increase coverage by running 'sizes' and 'constants' 2016-04-03 14:12:27 +02:00
Steffen Jaeckel
1c6c02e18d fix gitignore 2016-04-03 14:12:27 +02:00
Steffen Jaeckel
f2f1b61164 Merge pull request #115 from fperrad/install
install without USER and GROUP
2016-04-03 01:46:24 +02:00
Francois Perrad
5d5694dbc4 install without USER and GROUP
like in libtommath.
really more friendly for packaging.
2016-04-01 09:26:28 +02:00
Steffen Jaeckel
912eff4949 make testprof/makefile silent 2016-01-23 19:11:30 +01:00
Steffen Jaeckel
61d730323a introduce new all_test make-target 2016-01-23 19:11:30 +01:00
Steffen Jaeckel
23cad07701 refactor makefile a bit more 2016-01-23 19:00:23 +01:00
Steffen Jaeckel
d1eeecb137 fix some compiler warnings 2016-01-23 18:59:44 +01:00
Steffen Jaeckel
4572357e87 make easily built demos in a template 2016-01-23 18:59:30 +01:00
Steffen Jaeckel
7c9450084f fix some compile errors 2016-01-23 18:42:50 +01:00
Steffen Jaeckel
3184c6d8a0 Merge branch 'miko-GCM-HPUX-IA64-fix' into develop
This closes #100
2016-01-23 18:11:01 +01:00
Karel Miko
966496ea1a fixing GCM troubles at HP-UX/IA64 2016-01-23 18:09:03 +01:00
Steffen Jaeckel
a6417387c0 make check_defines silent 2016-01-23 17:06:57 +01:00
Steffen Jaeckel
6905e4113f make build process silent 2016-01-19 00:38:05 +01:00
Steffen Jaeckel
de15a6fad9 Merge branch 'miko-const-int-fix' into develop
This closes #92 and closes #96
2016-01-19 00:04:27 +01:00
Karel Miko
af77f1fae9 RORc instead of ROR 2016-01-19 00:03:54 +01:00
Karel Miko
d0a534393a fix for issue #92 - const is meaningless on cast type 2016-01-19 00:03:54 +01:00
Steffen Jaeckel
4a3b53dbee Merge branch 'miko-avoid-declaration-after-statements' into develop
This closes #101
2016-01-14 21:47:16 +01:00
Karel Miko
15b3f39a4f avoid using declaration after statements (rng_win32) 2016-01-14 21:46:53 +01:00
Karel Miko
7c1e251e75 avoid using declaration after statements 2016-01-14 21:46:53 +01:00
Steffen Jaeckel
f108863dc3 Merge branch 'miko-ecc_ansi_x963_export-fix' into develop
This closes #58 and closes #99
2016-01-14 21:33:04 +01:00
Steffen Jaeckel
10e577e24a there's no need to check out on function entry
...someone could then do something like this...

unsigned char* out = NULL;
unsigned long len = 0;
while(ecc_ansi_x963_export(key, out, &len) == CRYPT_BUFFER_OVERFLOW &&
	len == 0) {
  out = malloc(len);
}

...as if someone would ever like to do something like that...
2016-01-14 21:32:33 +01:00
Karel Miko
42bad9f580 fix for issue #58 - possible overflow in ecc_ansi_x963_export 2016-01-11 00:25:13 +01:00
Steffen Jaeckel
af70cb6a01 Merge remote-tracking branch 'km/miko-setbit-fix' into develop
This closes #91
2016-01-11 00:23:25 +01:00
Karel Miko
8cf7eb1801 fix for issue #91 - redefinition of macro "setbit" 2016-01-10 18:45:04 +01:00
Steffen Jaeckel
7c2ff8ebfe show ROtate operator configuration in build settings
[skip ci]
2016-01-05 23:55:06 +01:00
Steffen Jaeckel
645a82d9e6 travis: update local package index as first step 2016-01-05 23:24:47 +01:00
Steffen Jaeckel
012dfe8001 Make the build output cleaner so diagnostics are easier to spot
Signed-off-by: Tom St Denis <tstdenis82@gmail.com>
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2015-12-05 14:31:38 +01:00
Steffen Jaeckel
8def190877 Merge branch 'fix/hkdf' into develop
This fixes #81
2015-12-05 14:31:38 +01:00
Steffen Jaeckel
f5016d88dd Prevent undefined behavior
Don't call XMEMCPY() in case info (the source parameter to memcpy) is NULL
as this would trigger UB
2015-12-05 14:31:38 +01:00
Steffen Jaeckel
318dbbccc3 fix wrongly used LTC_ARGCHK/LTC_ARGCHKVD macros 2015-12-05 14:31:37 +01:00
Steffen Jaeckel
460b8716c9 fix clang-analyzer warnings
This fixes #80
2015-12-05 14:31:01 +01:00
Steffen Jaeckel
16f397d55c prevent segfault in case we hit an empty sequence 2015-09-10 19:17:42 +02:00
Steffen Jaeckel
d4945ac521 add (nearly) all defines from tomcrypt_custom.h to crypt_build_settings
... and provide a new make target to check if something is missing
2015-09-08 21:09:49 +02:00
Steffen Jaeckel
0b140206cf Merge branch 'feature/rsa-crt_hardening' into develop
This fixes #77
2015-09-08 21:04:54 +02:00
Steffen Jaeckel
733c52aa00 add LTC_RSA_CRT_HARDENING to crypt_build_settings 2015-09-08 21:04:33 +02:00
Steffen Jaeckel
01f1845402 harden RSA CRT by implementing the proposed countermeasure
... from ch. 1.3 of [1]

[1] https://people.redhat.com/~fweimer/rsa-crt-leaks.pdf
2015-09-08 02:44:17 +02:00
Steffen Jaeckel
19e2526b82 add some make targets regarding code coverage 2015-09-08 02:35:35 +02:00
Steffen Jaeckel
7db5760c91 add possibility to create combined coverage
Define the environment variable LTC_COVERAGE to something, run testme.sh
with all the coverage compile time options enabled and then 'make lcov'
creates the combined coverage for all combinations of compile-time
options handled in testme.sh.

e.g. LTC_COVERAGE=1 ./testme.sh "makefile -j3" "-DUSE_LTM -DLTM_DESC -I../libtommath -fprofile-arcs -ftest-coverage" "../libtommath/libtommath.a -lgcov"
2015-09-08 01:36:13 +02:00
Steffen Jaeckel
21ed315527 ignore output of 'make doxy' 2015-09-08 01:14:57 +02:00
Steffen Jaeckel
fd94034ba7 sort HEADERS in makefiles, so it doesn't change spontaneously 2015-09-01 17:36:43 +02:00
Steffen Jaeckel
6ec93afa3c clean-up test-build and extend tomcrypt_custom.h
added LTC_MINIMAL to be able do a build without nearly any
functionality :)
make sure timing resistant RSA & ECC are enabled if not said otherwise
2015-09-01 17:36:43 +02:00
Steffen Jaeckel
8cb20e6059 add more DES test vectors 2015-08-31 15:09:36 +02:00
Steffen Jaeckel
eb26b7efd4 Merge branch 'fix/ccm_constant_time' into develop
This closes #73 and closes #76
2015-08-26 00:16:09 +02:00
Sebastian Verschoor
75b114517a make sure no cache-based timing attack is possible
instead of two different buffers, there is just one buffer. Based upon the verification result, a mask is applied to the buffer before it is written to the output buffer.
2015-08-26 00:08:38 +02:00
Steffen Jaeckel
09e4b0ec9b don't reveal plaintext if authentication failed
Create two buffers of the same size as the input data.
Copy the input data to the first one and work with that version to hold the
decrypted data, zeroize the second one.
Copy depending on the verification result, either the zero-buffer or the
real plaintext to the output buffer.
2015-08-26 00:08:38 +02:00
Steffen Jaeckel
6c11ca771b fix compile error of tests 2015-08-26 00:08:38 +02:00
Sebastian Verschoor
25af184cd5 Quickfix for issue #73
The API of the function is changed (for decryption, tag is now an input
parameter). With the old API it is impossible to confirm to the NIST
specification and a timing sidechannel leak is inevitable.
2015-08-26 00:08:38 +02:00
Steffen Jaeckel
38bfef2996 Merge branch 'aes-xts-accel' into develop
This fixes #70
2015-08-26 00:05:31 +02:00
Steffen Jaeckel
f9c8c9c229 also test XTS accelerators 2015-08-26 00:05:07 +02:00
Steffen Jaeckel
181d2f2df7 auto-format xts code 2015-08-26 00:02:50 +02:00
Steffen Jaeckel
b25d04ed94 fix pointer check 2015-08-25 23:58:22 +02:00
Jerome Forissier
5c3f177b34 Add function pointers for accelerated XTS to ltc_cipher_descriptor
Similar to what already exists for other modes.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
2015-08-25 23:58:22 +02:00
Steffen Jaeckel
99214b53f6 add .clang-format 2015-08-25 23:58:08 +02:00
Steffen Jaeckel
a13257094e handle LTC_NO_FAST before handling LTC_FAST 2015-08-23 22:59:15 +02:00
Steffen Jaeckel
61efc10852 update makefiles 2015-08-23 22:59:14 +02:00
Steffen Jaeckel
ee03c97cde add crc32 2015-08-23 22:59:14 +02:00
Steffen Jaeckel
9585faca2b re-work debug output of some tests 2015-08-23 22:59:14 +02:00
Steffen Jaeckel
1987a2f975 add adler32 checksum algorithm 2015-08-23 22:59:14 +02:00
Steffen Jaeckel
d6cea55b13 Merge branch 'pascal-brand-st-dev/ecc_raw' into develop
This fixes #69
2015-08-21 22:18:42 +02:00
Pascal Brand
3605983f09 Introduce ECC raw algorithms for sign and verify
As it is performed on dsa, raw sign and verify on ECC
are introduced.

Signed-off-by: Pascal Brand <pascal.brand@st.com>
2015-08-21 22:14:03 +02:00
Steffen Jaeckel
0e8d8f8d81 Merge branch 'pascal-brand-st-dev/ecctest' into develop
This fixes #68
2015-08-21 22:12:02 +02:00
Pascal Brand
7313d1e6b0 Update ECC timing tests
Signed-off-by: Pascal Brand <pascal.brand@st.com>
2015-08-21 22:09:25 +02:00
Steffen Jaeckel
08629ed2b0 Merge branch 'fix/issue74' into develop
This closes #74
2015-08-21 21:30:38 +02:00
Sebastian Verschoor
67973b04ae fix #74 2015-08-21 21:29:56 +02:00
Steffen Jaeckel
c28cc9e3e9 crypt_build_settings: remove build date and time 2015-05-07 10:32:12 +02:00
Karel Miko
aeaa6d4a51 cygwin related fix - variable name B0 changed to B_0 (part 2) 2015-04-17 08:59:35 +02:00
Karel Miko
6a257e15cd cygwin related fix - variable name B0 changed to B_0 as it caused collision when compiling libtomcrypt as a perl module (for some reason only on cygwin) 2015-04-17 08:56:42 +02:00
Karel Miko
a8e91afb16 cygwin/64bit related fix - added !defined(__x86_64__) 2015-04-17 08:50:38 +02:00
Steffen Jaeckel
4981e2ab3f Merge pull request #61 from ulikoehler/reffix
Fix config file reference
2015-03-28 08:31:21 -04:00
Uli Köhler
d24e9cd32d Fix config file reference 2015-03-27 21:41:51 +01:00
Steffen Jaeckel
925f1ec0e6 Merge pull request #60 from pascal-brand-st-dev/memneq
Use XMEM_NEQ instead of mem_neq
2015-02-27 10:11:14 +01:00
Pascal Brand
f20b5daf39 Use XMEM_NEQ instead of mem_neq
mem_neq is no more used directly. XMEM_NEQ is used instead,
in the same way XMEMCMP, XMEMCPY,... are.

Signed-off-by: Pascal Brand <pascal.brand@st.com>
2015-02-27 08:54:30 +01:00
Steffen Jaeckel
dfa938a4f6 verify outcome when defining LTC_NOTHING
check that LTC_NOTHING really creates nothing but the libraries' basic
API functions
2015-02-15 17:25:45 +01:00
Steffen Jaeckel
90e968a202 der_decode_subject_public_key_info: fix compile error
also make it possible to define min/max RSA key sizes externally

This closes #59
2015-02-15 16:32:12 +01:00
Saleem Abdulrasool
62878de0c5 adjust inline asm requiring constants
In order to ensure that the shift is within range, convert the inline assembly
routines into macros with compound statements.
2015-01-20 22:36:07 +01:00
Steffen Jaeckel
e9f9c6fa55 create a makefile.include
it contains all the preparation and targets for the static and shared lib
2015-01-20 22:36:07 +01:00
Steffen Jaeckel
0b6915740c saferp: enclose macros in do{}while(0) loop 2015-01-20 22:36:07 +01:00
Steffen Jaeckel
9782c09a3a use XMEM{CMP, CPY, SET} macros instead of standard versions 2015-01-20 22:36:06 +01:00
Steffen Jaeckel
b8bf2f13b8 Merge branch 'feature/const_memcmp' into develop
This closes #57
2015-01-20 22:35:44 +01:00
Steffen Jaeckel
46c038f7d4 adapt rsa_test() to modified pkcs#1 decoding routines 2014-11-13 22:30:07 +01:00
Steffen Jaeckel
1e9e98aa0d make pkcs#1 decode functions constant-time
as proposed in RFC 3447 only one error return code is used when there are
errors while decoding the pkcs#1 format.
also, all steps are executed and only the "output" is skipped if something
went wrong.

Sorry this could break backwards compatibility, since there's no more
BUFFER_OVERFLOW messaging.
Former error-handling code could also be affected because now there's only
OK as return code in cases where "res" is also set to '1'.
2014-11-13 22:26:59 +01:00
Steffen Jaeckel
e57c92fd23 replace calls to standard memcmp with constant memcmp where necessary 2014-11-13 22:09:45 +01:00
Steffen Jaeckel
d54425adb4 update makefiles 2014-11-13 22:09:20 +01:00
Steffen Jaeckel
26c5d54e5c add constant-time memcmp()
[skip ci]
2014-11-12 23:59:27 +01:00
Steffen Jaeckel
ddca3d6422 Merge branch 'pascal-brand-st-dev/ccm' into develop
This closes #55
2014-11-02 17:02:21 +01:00
Steffen Jaeckel
f2f8342c43 ccm test: add missing AAD 2014-11-02 17:01:56 +01:00
Steffen Jaeckel
943a858d6c also run testvectors on new CCM API
[skip ci]
2014-10-31 19:41:14 +01:00
Steffen Jaeckel
4efa27ead1 add missing pointer checks 2014-10-31 19:39:03 +01:00
Steffen Jaeckel
53917750d8 trim trailing spaces 2014-10-31 19:38:47 +01:00
Pascal Brand
992506cb49 Add incremental CCM authentication processing
CCM is only meant for packet mode where the length of the input is known in
advance. Since it is a packet mode function, CCM only had one function that
performs the protocol.

However, incremental authentication is usefull in some usecases. It also
ensure some kind of coherencies when processing with a given authentication
mode or another. To achieve this aim, this commit adds the following functions:
    ccm_init()
    ccm_add_aad()
    cm_add_nonce()
    ccm_process()
    ccm_done()
    ccm_reset()
as well as the data structure
    ccm_state

Change-Id: I5225a42bb098708c4af07518b561bb00f85bc243
2014-10-17 09:00:19 +02:00
Steffen Jaeckel
ed28703804 der_decode_sequence_multi: calm coverity 2014-10-10 01:07:58 +02:00
Steffen Jaeckel
e6b1c7101e der test: also run der_length_utf8_string() 2014-10-10 00:56:23 +02:00
Steffen Jaeckel
3ecdd29847 fix coverity script 2014-10-10 00:55:18 +02:00
Steffen Jaeckel
ee1631f8b3 dsa import: no output on stderr please 2014-10-06 19:00:50 +02:00
Steffen Jaeckel
f75b5ec8f4 der tests: improve/implement handling of context-specific data
no more "EOL" in the output as the flexi decoder handles now
context-specific data
2014-10-06 18:59:40 +02:00
Steffen Jaeckel
6da3b856d6 der test: print list-element details on EOL
EOL indicates an unitialized list-element
2014-10-06 18:57:42 +02:00
Steffen Jaeckel
6bd6319fb0 der flexi decoder: implement decoding of context-specific data 2014-10-06 18:57:42 +02:00
Steffen Jaeckel
2d8933e4f1 der: add new enum element for context-specific encodings 2014-10-06 18:57:42 +02:00
Steffen Jaeckel
f0a1235614 der flexi decoder: remove duplicate code 2014-10-06 18:57:41 +02:00
Steffen Jaeckel
3d1231ab15 der flexi decoder: improve CONSTRUCTED type decoding
remove all teh flags
save the entire original identifier
2014-10-06 17:51:25 +02:00
Steffen Jaeckel
2e426e2d57 der test: add example of decoding a X.509 v3 cert with the flexi decoder
you can define "LTC_DER_TESTS_PRINT_FLEXI" at compile time to print
the decoded cert whenn running the test executable...
well not all of it, since some parts of the cert are marked as
"context-specific" so we would need to do some further digging
...these are the parts that are output as "EOL"...
2014-09-30 17:57:53 +02:00
Steffen Jaeckel
c1e81ad469 minor changes
print MP_DIGIT_BIT when running test
der_test: improve error output of 'short integer' test
2014-09-30 13:26:18 +02:00
Steffen Jaeckel
1cc26da35c fix coverity script 2014-09-30 10:53:05 +02:00
Steffen Jaeckel
b1b3d5870f Merge branch 'feature/formatRsaDsa' into develop
This closes #50
2014-09-29 23:45:34 +02:00
Steffen Jaeckel
eea24fe2c0 bring back possibility to import/export old DSA key format 2014-09-29 23:44:47 +02:00
Steffen Jaeckel
f58c87866e add possibility to export RSA public key in SubjectPublicKeyInfo format 2014-09-29 23:44:47 +02:00
Steffen Jaeckel
b1f29539be Revert "removed testing of "stripped" rsa key"
This reverts commit 496453f289.
2014-09-29 23:44:47 +02:00
Steffen Jaeckel
7842e338bf fix API of dynamic language helpers
it is easier to handle 'int' than 'long' in the foreign language
2014-09-29 23:30:02 +02:00
Steffen Jaeckel
b3b93675f5 Merge branch 'feature/sha2t' into develop 2014-09-29 19:57:43 +02:00
Steffen Jaeckel
1924e6fd47 add sha512/224 and sha512/256 to tests and crypt_build_settings 2014-09-29 19:57:21 +02:00
Steffen Jaeckel
06321b8602 update makefiles 2014-09-29 19:57:21 +02:00
Steffen Jaeckel
c58e2cae75 add special build rules for sha512/224 and sha512/256 2014-09-29 19:57:21 +02:00
Steffen Jaeckel
23fb224e19 add sha512/224 and sha512/256 2014-09-29 19:57:21 +02:00
Steffen Jaeckel
5ce0c7f70e Merge branch 'pascal-brand-st/xts' into develop
This closes #52
2014-09-29 19:47:44 +02:00
Steffen Jaeckel
3d905ca178 add testcase for multiple XTS encryption/decryption 2014-09-29 19:47:18 +02:00
Pascal Brand
adc54d08d0 Enable multiple XTS encryption or decryption
multiple xts_encrypt() cannot be performed because the
tweak is not updated. That means that
  xts_encrypt(buffer1, tweak)
  xts_encrypt(buffer2, tweak)
is not the same as
  xts_encrypt(concat(buffer1, buffer2), tweak)

Current patch enables such functionalities by
updating the tweak as output of the encryption.
Note that the tweak is no more constant.

The very same modification is performed
on xts_decrypt()

Signed-off-by: Pascal Brand <pascal.brand@st.com>
2014-09-28 22:55:02 +02:00
Steffen Jaeckel
824c7bf16a Merge branch 'pascal-brand-st/rsa' into develop
This closes #53
2014-09-28 22:53:22 +02:00
Steffen Jaeckel
94363b601c add testcase to verify that this patch is working 2014-09-28 22:52:32 +02:00
Pascal Brand
a6e89d58d4 RSA in CRT optimization parameters are empty 2014-09-28 22:48:21 +02:00
Pascal Brand
2bb3f0246f RSA in case CRT optimization parameters are not populated
rsa_exptmod(), ran on the private key, makes use of CRT optimization
parameters. In some use-cases, the given key does not include the
optimization parameters.

This patch allows rsa_exptmod() to run without the CRT parameters,
using directly mp_exptmod().

Signed-off-by: Pascal Brand <pascal.brand@st.com>
2014-09-28 22:45:46 +02:00
Steffen Jaeckel
cb2322f8de Merge branch 'fix/x32' into develop
This closes #51
2014-09-28 22:43:58 +02:00
Steffen Jaeckel
afaef3993c fix compiler warning when compiling with GMP_DESC 2014-09-10 16:16:46 +02:00
Steffen Jaeckel
f597f29ece math: change get_digit() return value
unsigned long is 32bit wide when compiling with the compiler flag "-mx32"
but the digit size of the math libraries is still 64 bit which lead to
the buggy ecc code.

Therefore define a new type ltc_mp_digit with the correct width and use
that as return value of get_digit()

Has been tested with all three math providers
2014-09-10 16:15:35 +02:00
Steffen Jaeckel
1793072c67 fix CC parameter given to make in testprof folder 2014-09-10 16:08:49 +02:00
Steffen Jaeckel
67b9cd8a95 trim trailing spaces 2014-09-02 02:17:43 +02:00
Steffen Jaeckel
e8d4598616 Merge branch 'fix/mingw64' into develop 2014-09-01 19:29:44 +02:00
Steffen Jaeckel
fff4fd15c4 build.sh: improve diff parameters 2014-08-31 18:47:21 +02:00
Steffen Jaeckel
ee4c00b753 some more ASN.1 fixes
these should have been in #49
2014-08-31 18:26:14 +02:00
Steffen Jaeckel
c342cb5a21 Merge branch 'fix/asn1' into develop
This closes #49

[skip ci]
2014-08-31 18:02:52 +02:00
Steffen Jaeckel
e5fb4d5ebe use DO() macro when calling API functions in tests 2014-08-28 14:02:57 +02:00
Steffen Jaeckel
7a5ea10e60 add missing ASN1 types in der_encode_set() 2014-08-28 14:02:57 +02:00
Steffen Jaeckel
ddede01d16 trim trailing spaces 2014-08-28 14:02:57 +02:00
Steffen Jaeckel
b06270645e add missing check of the OID 2014-08-28 14:02:57 +02:00
Steffen Jaeckel
6bba3a2a70 change the ASN1 type to be a typedef
replace all 'default' cases in the switch statements
2014-08-28 14:02:57 +02:00
Steffen Jaeckel
00c111b1c8 add missing types to decode routines 2014-08-28 14:02:57 +02:00
Steffen Jaeckel
800182338e unwind conditional expressions
I prefer readability
2014-08-28 14:02:57 +02:00
Christopher Brown
3cdb64eca6 bypass constructed type identification for sets / sequences 2014-08-28 14:02:56 +02:00
Christopher Brown
678b6d9641 fix constructed type identifier check 2014-08-28 14:02:56 +02:00
Steffen Jaeckel
171eae5378 asn1: use LTC_SET_ASN1 macro to access ltc_asn1_list elements 2014-08-28 14:02:56 +02:00
Steffen Jaeckel
4071475558 fix compiler warnings 2014-08-28 13:53:51 +02:00
Steffen Jaeckel
78e367895a Merge branch 'feature/testRsaPkcs1' into develop
This closes #48
2014-08-28 13:35:13 +02:00
Steffen Jaeckel
efc6844f9c tests: add function print_hex() 2014-08-28 13:30:26 +02:00
Steffen Jaeckel
64f887e8f3 predictable rand() values please 2014-08-28 13:30:26 +02:00
Steffen Jaeckel
8ce125f8a8 mp_rand() assumes the number of digits and not the bitsize as parameter 2014-08-28 13:30:26 +02:00
Steffen Jaeckel
f86d36c676 rsa_test: improve a bit 2014-08-28 13:30:26 +02:00
Steffen Jaeckel
536a199203 rsa_test: fix valgrind warnings 2014-08-28 13:30:26 +02:00
Steffen Jaeckel
d51715db72 pkcs#1 v1.5 decode: fix missing check of PS length in EMSA mode 2014-08-28 13:30:26 +02:00
Steffen Jaeckel
2b3c603c6c udpate bleichenbacher signature attack
also test for too short padding strings
2014-08-28 13:30:26 +02:00
Steffen Jaeckel
e227000578 tests: remove surplus ';' in DO()/DOX() macros 2014-08-28 13:30:26 +02:00
Steffen Jaeckel
5eb9743410 rsa_verify_hash: fix possible bleichenbacher signature attack 2014-08-28 13:30:26 +02:00
Steffen Jaeckel
c6dfef95eb testprof/rsa_test: add testcase for bleichenbacher signature attack 2014-08-28 13:30:26 +02:00
Steffen Jaeckel
dc0c6ed9d9 regen rsa-testvectors 2014-08-28 13:30:26 +02:00
Steffen Jaeckel
7c10ec9dd2 add makefile for rsa-testvectors 2014-08-28 13:30:26 +02:00
Steffen Jaeckel
2c69088be8 execute only one testcase per default 2014-08-28 13:30:26 +02:00
Steffen Jaeckel
92274aafb5 add testprof/pkcs_1_eme_test 2014-08-28 13:30:26 +02:00
Steffen Jaeckel
c24e2a1e6b fix pkcs1v15crypt-vectors.txt 2014-08-28 13:30:25 +02:00
Steffen Jaeckel
b51824748a rt.py: extend for PKCS#1 v1.5 EME 2014-08-28 13:30:25 +02:00
Steffen Jaeckel
7302a7cfcb add testprof/pkcs_1_emsa_test 2014-08-28 13:30:25 +02:00
Steffen Jaeckel
25fcd4c70f rt.py: add possibility to parse PKCS#1 v1.5 EMSA testvectors 2014-08-28 13:30:25 +02:00
Steffen Jaeckel
95f9d527f6 rt.py: start making even more generic, fixed naming of p and q 2014-08-28 13:30:25 +02:00
Steffen Jaeckel
c99a147d4a add testprof/pkcs_1_oaep_test 2014-08-28 13:30:25 +02:00
Steffen Jaeckel
ed0982b7e7 add oaep testvectors 2014-08-28 13:30:25 +02:00
Steffen Jaeckel
b0c7cbfaae improve testprof/pkcs_1_pss_test 2014-08-28 13:30:25 +02:00
Steffen Jaeckel
60b9c5a6f1 make pkcs1 test more generic 2014-08-28 13:30:25 +02:00
Steffen Jaeckel
faa9c6a607 add missing unregister of no_prng 2014-08-28 13:30:25 +02:00
Jonathan Herzog
3324da2601 Fixed small padding error in the PKCS#1 PSS code.
The existing LTC code for padding meassages for PSS signatures
contained a small error. In particular, the PSS-passing algorithms is
supposed to be given (bitlength of key - 1) as an argument. The LTC
code passes (bitlength of key), and subtracts 1 in the middle of the
PSS-padding. This subtraction unfortunately comes too late: a
calculation using that argument has already been made. Fortunately,
this bug only appeared if the bit-length of the key was 1 mod 8, and
so is unlikely to show up in practice. Still, this patch fixes the
problem.

Conflicts:
	src/pk/pkcs1/pkcs_1_pss_decode.c
2014-08-28 13:30:25 +02:00
Steffen Jaeckel
fe1b6eced7 add testprof/pkcs_1_pss_test 2014-08-28 13:30:25 +02:00
Steffen Jaeckel
b570175b47 add testprof/no_prng
a PRNG that is no PRNG as its output is predefined and can be set
by calling add_entropy()
2014-08-28 13:30:25 +02:00
Steffen Jaeckel
4a819b2f1b add generated file pss-vect.c 2014-08-28 13:30:25 +02:00
Steffen Jaeckel
269516533c rt.py: add name of testcase in struct 2014-08-28 13:30:25 +02:00
Steffen Jaeckel
055c515161 fix pss-vect.txt 2014-08-28 13:30:25 +02:00
Steffen Jaeckel
6dfe0013e1 rt.py: initial version 2014-08-28 13:30:24 +02:00
Steffen Jaeckel
b2317279b8 add original RSA testvector files 2014-08-28 13:30:24 +02:00
Steffen Jaeckel
394806cab1 tests: use correct format string parameter for 64bit values on windows 2014-08-28 13:27:52 +02:00
Steffen Jaeckel
14272976d0 add release flag to makefile.shared 2014-08-27 18:20:47 +02:00
Steffen Jaeckel
47b8ccc07c fix hash ID's of ripemd 256 & 320 2014-08-26 17:42:10 +02:00
Steffen Jaeckel
473b0319ad re-enable "unused-parameters" warning 2014-08-24 18:25:24 +02:00
Steffen Jaeckel
01c34dc236 trim trailing spaces 2014-08-24 18:25:24 +02:00
Steffen Jaeckel
1fb649d394 chc: don't execute tests if LTC_TEST is not defined 2014-08-07 01:36:03 +02:00
Steffen Jaeckel
f8449f55d9 trim trailing spaces 2014-08-07 01:36:03 +02:00
Jonathan Herzog
ff736a61bb Hash functions now check for input-length overflow.
Because many of the hash-functions implemented by LTC use the length
of the input when padding the input out to a block-length, LTC keeps
track of the input length in a 64-bit integer. However, it did not
previously test for overflow of this value. Since many of the
hash-functions implemented by LTC are defined for inputs of length
2^128 bits or more, this means that LTC was incorrectly implementing
these hash functions for extremely long inputs. Also, this might have
been a minor security problem: A clever attacker might have been able
to take a message with a known hash and find another message (longer
by 2^64 bits) that would be hashed to the same value by LTC.

Fortunately, LTC uses a pre-processor macro to make the actual code
for hashing, and so this problem could be fixed by adding an
overflow-check to that macro.
2014-08-06 19:06:00 +02:00
Steffen Jaeckel
757ac982a5 if selected, always make targets 'test' and 'testprof/$(LIBTEST)' 2014-08-06 15:16:37 +02:00
Steffen Jaeckel
09a0de69a0 update makefile.mingw 2014-08-06 15:16:30 +02:00
Steffen Jaeckel
98e05b10a0 trim trailing spaces in mingw makefiles 2014-08-06 15:11:45 +02:00
Steffen Jaeckel
a8598b0faf fix unregister_prng() where always the first prng would have been removed 2014-08-05 17:47:50 +02:00
Steffen Jaeckel
3cda802deb fixed ecc_test.c
luckily gcc 4.6 of travis CI complained!

shame on you gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1)
2014-07-17 12:10:05 +02:00
Steffen Jaeckel
48bd6702aa uncomment argchk in camellia_setup() 2014-07-17 11:32:52 +02:00
Steffen Jaeckel
155a54ba40 add LTC prefix to most macros 2014-07-17 10:50:36 +02:00
Steffen Jaeckel
3c76dcdd29 fix compiler warning when enabling LTC_GCM_TABLES_SSE2 2014-07-17 10:50:35 +02:00
Steffen Jaeckel
1a61b42775 update output; remove unused define 2014-07-16 15:11:14 +02:00
Steffen Jaeckel
97256daeed remove surplus ';' 2014-07-15 20:26:40 +02:00
Steffen Jaeckel
f8c536a349 add CC tag when linking 2014-07-15 20:25:32 +02:00
Steffen Jaeckel
9af6d311ec Merge branch 'buggywhip/dynHlp2' into develop
This closes #41
2014-07-15 15:51:43 +02:00
Steffen Jaeckel
7189998ba1 update gitignore 2014-07-15 15:45:39 +02:00
Steffen Jaeckel
5fa34ad171 update makefiles 2014-07-15 15:45:33 +02:00
Steffen Jaeckel
542ba9995c update math inititializers
make math initializer functions dependant on the xxx_DESC macro instead
of the USE_xxx macro, which is only relevant when building tests etc.
2014-07-15 15:38:18 +02:00
Steffen Jaeckel
746fd583c9 update demos according to changed naming 2014-07-15 15:28:29 +02:00
Steffen Jaeckel
fc7eeac218 update/rework constants and sizes 2014-07-15 15:27:31 +02:00
Steffen Jaeckel
fd7b3cd875 use snprintf() instead of sprintf() 2014-07-15 14:09:50 +02:00
Steffen Jaeckel
e628fb9203 clean up/trim trailing spaces 2014-07-15 13:58:48 +02:00
Larry Bugbee
a6b6884982 minor editorial changes 2014-07-14 15:47:20 +02:00
Larry Bugbee
46b6e36ea6 to know if LTC compiled big/little endian, 32/64-bit word 2014-07-14 15:47:20 +02:00
Larry Bugbee
f07234fd93 removed redundant include 2014-07-14 15:47:20 +02:00
Larry Bugbee
ef1fe79ca5 added missing signatures 2014-07-14 15:47:20 +02:00
Larry Bugbee
a543e0caa6 changed to keep it simple 2014-07-14 15:47:20 +02:00
Larry Bugbee
3f9144c9a7 added signatures to header file 2014-07-14 15:47:20 +02:00
Larry Bugbee
d99b970a8b added a Python demo 2014-07-14 15:47:20 +02:00
Larry Bugbee
1b29ce896f include compiler defines and other minor refinements 2014-07-14 15:47:20 +02:00
Steffen Jaeckel
fd140d4535 clean up makefile 2014-07-14 15:42:32 +02:00
Steffen Jaeckel
4089cc963c update shared makefiles
split up install target in "install" and "install_test" as in
standard makefile

use libtool to compile and link

clean up and bring in sync with standard makefile targets
2014-07-14 15:35:04 +02:00
Steffen Jaeckel
a0d0a17acf update gitignore 2014-07-14 15:35:04 +02:00
Steffen Jaeckel
9e2e7fdfd4 tests: bring back mult and sqr timing 2014-07-12 17:31:03 +02:00
Steffen Jaeckel
3c6a80525f current icc defines the same macros and functionset as gcc
as a result the special detection of icc has been removed
2014-07-12 17:28:54 +02:00
Steffen Jaeckel
6dfb080810 spit errors if 32- AND 64-bit wordsize is defined 2014-07-12 17:26:30 +02:00
Steffen Jaeckel
1f96647d70 update icc makefiles to current compiler versions
As the current icc can act as a gcc drop-in, I took over all compile flags
from the standard makefile.

The "-x?" options have been deprecated, so they're updated.

The "-xP" has been removed, since it makes no sense in my eyes to define
the optimization for a specific architecture in the makefile.
2014-07-12 17:25:12 +02:00
Steffen Jaeckel
098bc9f06d tests: use the gcc rdtsc() implementation also for intel cc 2014-07-12 16:46:36 +02:00
Steffen Jaeckel
8c488289f0 improve some error and informational output 2014-07-12 16:44:28 +02:00
Steffen Jaeckel
79bc7ef2e5 testprof: add missing object files to makefiles 2014-07-12 16:19:08 +02:00
Steffen Jaeckel
6ac2d6141d update clean target of makefile and testprof/makefile 2014-07-12 16:18:29 +02:00
Steffen Jaeckel
98893c077b fix possible free of not yet allocated key parameters
There would have been a call to mp_clear_multi() of all the key parameters
that are not yet allocated, in the case where the calculations of p, q,
tmp1 or tmp2 created an error.

This also includes a proposed improvement from the OLPC project to free
elements in the reverse order as they were allocated.
2014-07-11 16:44:43 +02:00
Steffen Jaeckel
30278d1121 fix possible missing free of rnd and rndi
There could have been a 'goto error', which misses the free of rnd and
rndi even if they were initialized.
This could happen in cases where a private key operation was done and
afterwards one of the operations like reading back or conversion, would
have failed (which is likely not to happen)

This also includes a proposed improvement from the OLPC project to free
elements in the reverse order as they were allocated.
2014-06-15 11:51:38 +02:00
Steffen Jaeckel
48f521688f ltc_init_multi: fix missing call to va_end() 2014-05-25 00:35:03 +02:00
Steffen Jaeckel
8652f33f35 pmac_init: prevent possible out of bounds access of polys[] 2014-05-25 00:35:03 +02:00
Steffen Jaeckel
ea9b2a858a der_encode_utf8_string: calm coverity 2014-05-25 00:35:03 +02:00
Steffen Jaeckel
4c8949e449 aes: calm coverity 2014-05-25 00:35:03 +02:00
Steffen Jaeckel
50d10790e3 trim trailing spaces 2014-05-25 00:35:03 +02:00
Steffen Jaeckel
f9984d1e24 add coverity badge 2014-05-25 00:35:03 +02:00
Steffen Jaeckel
389bbf0d05 update gitignore 2014-05-25 00:35:03 +02:00
Steffen Jaeckel
2de05c4d3e add coverity build and upload script 2014-05-25 00:35:03 +02:00
Steffen Jaeckel
681e5fcdfc Merge branch 'fix/dsa' into develop 2014-05-11 18:10:03 +02:00
Steffen Jaeckel
03385a4419 rand_bn: fix call to zeromem() 2014-05-09 23:29:11 +02:00
Steffen Jaeckel
ca42862d52 math descriptor: add parameter "b" to isprime() 2014-05-09 23:07:41 +02:00
Steffen Jaeckel
5d2fe0da8c trim trailing spaces 2014-05-09 23:07:41 +02:00
Steffen Jaeckel
dc31ca545f dsa_make_key: fix free of wrong pointer resulting in double-free 2014-05-09 23:07:40 +02:00
Steffen Jaeckel
198ad7ef50 update makefiles 2014-05-09 23:07:33 +02:00
Steffen Jaeckel
c9f93f6571 dsa_make_key: remove surplus semicolon 2014-05-09 22:43:29 +02:00
Karel Miko
e9a0a27917 DSA params+key generation according FIPS-186-4 (part 1) 2014-05-09 17:58:50 +02:00
Karel Miko
77b4b16030 dsa_make_key minor isuue 2014-05-09 17:58:50 +02:00
Karel Miko
a43bb0fda6 dsa_encrypt_key small correction 2014-05-09 17:58:50 +02:00
Karel Miko
655336f0cb tuning RSA interoperability + small fixes 2014-05-09 17:58:50 +02:00
Karel Miko
67a547086c DSA sign improvement 2014-05-09 17:58:50 +02:00
Karel Miko
3908c70d68 tuning DSA key generation 2014-05-09 17:58:50 +02:00
Karel Miko
e271b9fdbe ECC key pair generation according to FIPS-186-4 2014-05-09 17:58:39 +02:00
Karel Miko
e600ab9d35 dsa_sign_hash: testing k < q 2014-05-09 16:26:24 +02:00
Karel Miko
72022edb8d dsa_make_key: improved testing x < q 2014-05-09 16:26:24 +02:00
Steffen Jaeckel
24d03dd823 testme.sh: add test runs without "timing resistance" 2014-05-08 15:11:38 +02:00
Steffen Jaeckel
e723d1289f travis.yml: add test runs without "timing resistance" 2014-05-08 15:10:09 +02:00
Steffen Jaeckel
3b97738ee9 travis.yml: rewrite to be better human-readable; trim trailing spaces 2014-05-08 15:08:31 +02:00
Steffen Jaeckel
c63c0433c1 enable timing resistant ECC calculations by default 2014-05-08 15:06:42 +02:00
Steffen Jaeckel
26743d0749 ecc_mulmod_timing: fix compiler warnings 2014-05-08 13:06:24 +02:00
Steffen Jaeckel
5707e319c2 Merge branch 'feature/coverage' into develop 2014-05-08 12:57:31 +02:00
Steffen Jaeckel
3dcf2df988 coverage: exclude some folders 2014-05-07 17:36:50 +02:00
Steffen Jaeckel
a59e5548ec tests: unregister ciphers etc. at exit, call error_to_string() 2014-05-07 17:36:09 +02:00
Steffen Jaeckel
2b04f3d8ed Readme: display the coverage status
[skip ci]
2014-05-07 17:03:12 +02:00
Steffen Jaeckel
1a44e2d22d send coverage results to coveralls 2014-05-07 16:16:08 +02:00
Steffen Jaeckel
f9a1041222 printinfo: display version of correct compiler if CC does not point to gcc
[skip ci]
2014-05-07 16:15:50 +02:00
Steffen Jaeckel
be5418368c Merge branch 'fix/anubis' into develop 2014-05-01 23:02:40 +02:00
Steffen Jaeckel
bbf278c779 anubis: fix left-shift
this has been brought up in #26
2014-05-01 23:02:21 +02:00
Steffen Jaeckel
ca1a1d18ab anubis: trim trailing spaces 2014-05-01 23:02:21 +02:00
Steffen Jaeckel
d2318d6c24 travis.yml: fix typo 2014-05-01 23:02:05 +02:00
Steffen Jaeckel
a06e40aa17 only run tests when build was without warnings 2014-05-01 18:13:21 +02:00
Steffen Jaeckel
4929e4e989 fix warnings in tests 2014-05-01 18:01:13 +02:00
Steffen Jaeckel
c211ce7f66 omac: fix accidentally reverted patch
introduced in 6816ac3f3f
reverted in 8e7777b554
2014-05-01 15:44:09 +02:00
Steffen Jaeckel
aa72cfe1d9 ccm: clarify pt and ct parameters in doc and API description
this fixes #42
[skip ci]
2014-04-30 20:19:11 +02:00
mudzot
3b7c6512ac Add #ifdef to make it easier to embed libtomcrypt with LTC_NOTHING
Restore LTC_NO_MATH and make rand_prime.c depend on LTC_NO_MATH & LTC_NO_PRNGS
2014-04-30 01:13:51 +02:00
Steffen Jaeckel
b895f13484 minor changes/clean-up sources 2014-04-30 01:10:22 +02:00
Steffen Jaeckel
b10c03aead flush content of CVS/SVN tags 2014-04-29 21:13:49 +02:00
Steffen Jaeckel
8a2bd89518 don't use assembler rotate when compiling for windows 64bit 2014-04-29 19:15:28 +02:00
karel-m
8afdb8831d ifdefs related to 64bit MS Windows build
Conflicts:
	src/headers/tomcrypt_cfg.h
	src/prngs/rng_get_bytes.c
2014-04-29 19:15:28 +02:00
karel-m
232f412709 makefiles for MS Windows gcc compiler 2014-04-29 18:25:15 +02:00
Karel Miko
0bda0770d9 fix for ASM failures on freebsd/netbsd 2014-04-29 17:32:14 +02:00
Steffen Jaeckel
e08480f621 update documentation according to new 3des mode 2014-04-28 21:08:56 +02:00
Steffen Jaeckel
f4d7baaacc Merge pull request #43 from pghmcfc/develop
Add support for two-key Triple-DES
2014-04-28 21:05:26 +02:00
Paul Howarth
445dfa67a6 des.c: Add support for two-key Triple-DES
Add two-key 3DES support, needed by pycrypto.

This commit is based on the one for the bundled libtomcrypt 1.16
code in pycrypto:

65085f16
2014-04-15 11:25:18 +01:00
Steffen Jaeckel
449d5e718d gitignore: add files that are generated while profiling 2014-04-04 01:03:58 +02:00
Steffen Jaeckel
ae5cc35298 surround most macros with "do{}while(0)" 2014-04-04 01:03:54 +02:00
Steffen Jaeckel
2849087906 Merge branch 'feature/rmCincludes' into develop 2014-04-04 00:54:14 +02:00
Steffen Jaeckel
1ce4e766ff update makefiles 2014-04-04 00:38:10 +02:00
Steffen Jaeckel
a15ea906c1 genlist.sh: update 2014-04-04 00:38:09 +02:00
Steffen Jaeckel
2bdebb3932 dh: remove including of c-files 2014-04-04 00:38:08 +02:00
Steffen Jaeckel
71ccad06bd dh: remove unused variables 2014-04-04 00:38:07 +02:00
Steffen Jaeckel
f3cdac05ec sha2: remove including of c-files 2014-04-04 00:38:06 +02:00
Steffen Jaeckel
cbd59421bd protect all tables by an ifdef; adjust safer to the same concept 2014-04-04 00:38:05 +02:00
Steffen Jaeckel
5d8091b6cf Merge branch 'fix/strict-aliasing' into develop 2014-04-04 00:36:07 +02:00
Steffen Jaeckel
ffeb70b48a fix typedef of LTC_FAST_TYPE on x86_64 2014-04-03 22:22:01 +02:00
Steffen Jaeckel
68bfdd0fac move mac_test() before modes_test()
since lrw uses gcm it makes sense to fail already at gcm
2014-04-03 15:08:17 +02:00
Steffen Jaeckel
53f04b8e6b only use ulong32 or ulong64 in the macros 2014-04-03 15:06:56 +02:00
Steffen Jaeckel
1f7cf9dc0b move typedefs from tomcrypt_macros.h to tomcrypt_cfg.h 2014-04-03 15:05:56 +02:00
Steffen Jaeckel
e027dda26f travis: add "after_failure" section 2014-03-12 10:53:23 +02:00
Steffen Jaeckel
561fe83532 fix strict-aliasing compiler warnings 2014-03-04 21:59:16 +01:00
Steffen Jaeckel
0aee5f3217 fix wrong spelled macros 2014-03-04 21:50:18 +01:00
Steffen Jaeckel
84298440f4 trim trailing spaces 2014-03-04 21:50:17 +01:00
Steffen Jaeckel
621a75ab28 base64: add and most important - execute tests 2014-03-04 21:50:16 +01:00
Steffen Jaeckel
1d52f3b49b tomcrypt_custom.h: move dependency checks together 2014-03-04 18:09:12 +01:00
Steffen Jaeckel
ec73cfa257 Merge branch 'stapelberg/respect-ldflags' into develop 2014-02-25 10:47:20 +01:00
Michael Stapelberg
ed2743d524 makefile.shared: respect LDFLAGS when linking 2014-02-25 10:47:05 +01:00
Steffen Jaeckel
6b7e79e1ee Merge branch 'stapelberg/pkgconfig' into develop 2014-02-25 10:46:40 +01:00
Michael Stapelberg
90928d6dfd pkgconfig: set libdir= to $LIBPATH (for multi-arch) 2014-02-25 10:45:20 +01:00
Michael Stapelberg
30022b114c add and install pkgconfig file for the shared library 2014-02-25 10:45:19 +01:00
Steffen Jaeckel
4dfd24d434 Merge branch 'stapelberg/fix-spelling' into develop 2014-02-25 10:44:28 +01:00
Michael Stapelberg
8d7e3d8216 fix typo: s/Endianess/Endianness/ 2014-02-25 10:38:29 +01:00
Steffen Jaeckel
722c128051 Merge branch 'feature/travis' into develop 2014-02-25 10:32:10 +01:00
Steffen Jaeckel
e97d921c8d travis: print version information in build scripts 2014-02-25 10:31:13 +01:00
Steffen Jaeckel
c5b57cfee4 travis: use build matrix instead of testme script 2014-02-25 10:09:59 +01:00
Steffen Jaeckel
feaa31968e travis: add IRC notifications 2014-02-25 10:09:58 +01:00
Steffen Jaeckel
65fd19c1fb dh: fix renamed macro 2014-02-25 10:09:35 +01:00
Steffen Jaeckel
77cca4175f ccm_memory_ex: disable until documented and fixed 2014-02-18 16:07:24 +01:00
Steffen Jaeckel
8b24397f84 update makefiles 2014-02-18 15:23:23 +01:00
Steffen Jaeckel
8e02874031 Merge branch 'stapelberg/deterministic-latex' into develop 2014-02-16 18:55:29 +01:00
Steffen Jaeckel
460bcfe31b remove crypt.lof from the repository 2014-02-16 18:55:28 +01:00
Steffen Jaeckel
a3811e2000 add -b flag to sed that enables binary processing (required on windows) 2014-02-16 18:55:27 +01:00
Michael Stapelberg
4ab63ccd3a deterministically build crypt.pdf
This entails:

 • Using pdflatex to influence the modification/creation timestamp in
   the resulting PDF
 • Replacing the unique ID with 0/0
 • Using the timestamp from crypt.tex instead of the current date/time

See also http://superuser.com/a/130804

This change is necessary because for Multi-Arch Debian packages,
non-arch-dependent files need to have the same checksum, which is not
guaranteed without this commit. See http://bugs.debian.org/734109
2014-02-16 18:55:25 +01:00
Steffen Jaeckel
ed9940175d hmac test: add some more tests from RFC's 2014-02-16 18:55:24 +01:00
Steffen Jaeckel
ddb26a4276 hmac test: remove comments, prepare for extension 2014-02-16 18:41:33 +01:00
Steffen Jaeckel
2adca46735 pkcs#5: add tests for 'algo 2' 2014-02-16 18:41:33 +01:00
Steffen Jaeckel
e48838559b der_encode_setof: fix compiler warning when compiling for windows 64bit 2014-02-16 18:41:32 +01:00
Karel Miko
45dcbc654d fixing broken camellia 2014-02-16 18:41:31 +01:00
Steffen Jaeckel
d2c1329f77 camellia: add new testvector 2014-02-16 18:41:30 +01:00
karel-m
f3789b31b6 fixing warnings when compiling camellia.c with 64bit MS compiler 2014-02-16 18:41:30 +01:00
Steffen Jaeckel
3da9adc366 aes: remove compiler warning when compiled with ENCRYPT_ONLY 2014-02-16 18:41:29 +01:00
Steffen Jaeckel
8e7777b554 trim trailing spaces/clean up 2014-02-16 18:41:28 +01:00
Steffen Jaeckel
d78aa37c10 base64: add define LTC_BASE64_URL, make _internal functions static 2013-11-24 22:11:44 +01:00
Karel Miko
947fe41bbb Add URL safe base64 de-/encoding 2013-10-27 21:49:26 +02:00
Steffen Jaeckel
4f86ad7dcf hkdf: don't compile if not requested 2013-10-15 10:17:53 +02:00
Steffen Jaeckel
b1b15910ed fix rng_get_bytes() when compiling with mingw-gcc 2013-10-15 10:17:17 +02:00
Steffen Jaeckel
5fd9b5057d Merge branch 'feature/rsaGetSizes' into develop 2013-10-14 14:18:54 +02:00
Steffen Jaeckel
bf1ccb629b fix rsa_sign_saltlen_get_max_ex() 2013-10-14 14:16:44 +02:00
Steffen Jaeckel
25f4817d48 update makefiles 2013-10-14 14:16:43 +02:00
Steffen Jaeckel
aacfec441e add rsa_sign_saltlen_get_max_ex() 2013-10-14 14:16:42 +02:00
Steffen Jaeckel
73c201da1f add rsa_get_size() 2013-10-14 14:16:41 +02:00
Steffen Jaeckel
fb65cd0772 fix clang compiler warnings 2013-10-02 01:03:40 +02:00
Steffen Jaeckel
a667a93d52 trim trailing spaces 2013-10-02 01:02:58 +02:00
Steffen Jaeckel
3eae4b42fb makefile: allow CC to be replaced
this allows building with clang by doing:
  CC=clang PREFIX=llvm- make
2013-10-01 23:08:30 +02:00
Steffen Jaeckel
61a3206f06 clean-up makefiles 2013-09-03 14:27:32 +02:00
Steffen Jaeckel
ab07d6a283 updatemakes.sh: trim trailing spaces 2013-09-03 14:25:50 +02:00
Steffen Jaeckel
c02097e74b Readme: fix link to travis-ci 2013-08-14 16:58:14 +02:00
Steffen Jaeckel
031e551c57 tomcrypt_custom.h: improve and clean-up
Add the possibility to define LTC_NOTHING that disables everything
Remove LTC_NO_MATH as it didn't do anything at all
Enable RSA blinding by default
2013-08-14 16:12:56 +02:00
Steffen Jaeckel
10511d329c update makefiles 2013-08-14 15:56:10 +02:00
Steffen Jaeckel
c0b8774cc1 move hkdf to misc 2013-08-14 15:47:07 +02:00
Steffen Jaeckel
d0a83df7f8 update makefile to be able to define a target platform prefix 2013-08-06 13:52:26 +02:00
Steffen Jaeckel
e5e8cc2e50 Update README.md
add Build status
2013-05-29 14:30:47 +03:00
Steffen Jaeckel
50ad0b8639 fix makefiles 2013-05-29 12:58:15 +02:00
Steffen Jaeckel
be96ed3ba9 add travis-ci configuration 2013-05-29 12:52:00 +02:00
Steffen Jaeckel
1748cc616b der_tests: trim trailing spaces 2013-04-18 11:22:25 +02:00
Steffen Jaeckel
9cb6c6b910 Merge branch 'fix/xtea' into develop 2013-03-22 16:08:31 +02:00
Steffen Jaeckel
d2e7b0c38f fixed 'golden' XTEA testvectors that are used when running testme.sh 2013-03-22 15:15:07 +02:00
Steffen Jaeckel
9e88fcb9b1 remove unused variable in demos/encrypt.c 2013-03-22 15:15:06 +02:00
Steffen Jaeckel
bfcf1eb200 trim trailing spaces in header files 2013-03-22 15:15:05 +02:00
Steffen Jaeckel
2526d5df8f xtea: use correct load and store macros 2013-03-22 15:15:04 +02:00
Steffen Jaeckel
0f0b182610 xtea: add new testvectors 2013-03-22 15:15:04 +02:00
Steffen Jaeckel
1050ecea4a demos/encrypt.c: add possibility to use parameter -t for testing a cipher 2013-03-22 15:15:03 +02:00
Steffen Jaeckel
fa7051c21e xtea: trim trailing spaces 2013-03-22 15:15:02 +02:00
Steffen Jaeckel
e531af7add ecc: fix compiler warnings 2013-03-22 15:14:44 +02:00
Steffen Jaeckel
14b3a5290e include stddef.h per default 2013-03-22 15:14:44 +02:00
Steffen Jaeckel
9203472789 dsa: fix compiler warning 2013-03-22 15:14:43 +02:00
Steffen Jaeckel
2addbcf315 noekeon: fix compiler warning 2013-03-22 15:14:42 +02:00
Steffen Jaeckel
57ea144874 README: add section 'Branches' 2013-03-20 17:47:23 +01:00
Steffen Jaeckel
ee4a9477ec update gitignore 2013-03-20 18:34:16 +02:00
Steffen Jaeckel
f107e6e465 demos: trim trailing spaces 2013-03-20 18:34:00 +02:00
Steffen Jaeckel
5d0eadcd42 Merge branch 'feature/OCBv3' into develop 2013-03-20 18:32:38 +02:00
Steffen Jaeckel
6b5b35e6cc ocb3: don't zero ocb3 context in ocb3_{de,en}crypt_last 2013-03-20 18:10:51 +02:00
Steffen Jaeckel
05b050b943 update makefiles 2013-03-15 17:46:58 +02:00
Steffen Jaeckel
faaa17aec2 add OCBv3 testvectors 2013-03-15 17:46:45 +02:00
Karel Miko
c5c067fd12 ocb_init fix (preventing index overflow) 2013-03-15 13:30:40 +02:00
Karel Miko
9c2193b722 ocb3_init fix (preventing index overflow) 2013-03-15 13:30:39 +02:00
karel-m
abab7089a3 OCBv3 according http://tools.ietf.org/html/draft-krovetz-ocb-03 2013-03-15 13:30:29 +02:00
Larry Bugbee
8e22b17a8e fix define LTC_YARROW_AES 2013-03-15 12:24:00 +02:00
Steffen Jaeckel
7efe74427b update gitignore 2013-03-15 12:23:59 +02:00
Steffen Jaeckel
d540496db1 Merge branch 'feature/hkdf' into develop 2013-03-15 11:17:16 +01:00
RyanC
fe18c95e76 add the rest of the hkdf test cases 2013-03-15 11:16:17 +01:00
RyanC
11f50bfb3c fix hkdf_expand arguments 2013-03-15 11:16:17 +01:00
Steffen Jaeckel
1c779b88f1 moar debug output 2013-03-15 11:16:17 +01:00
Steffen Jaeckel
8fcd408a98 fixed latex compile errors 2013-03-15 11:16:17 +01:00
Steffen Jaeckel
e81ac102bd add misc_test() 2013-03-15 11:16:17 +01:00
Steffen Jaeckel
c1243feef2 hkdf: improve argument validation 2013-03-15 11:16:16 +01:00
Steffen Jaeckel
13c42a00f6 hkdf: fix compiler warning 2013-03-15 11:16:16 +01:00
Steffen Jaeckel
abeddd6c4b add hkdf_test() 2013-03-15 11:16:16 +01:00
RyanC
d7a1480f9e docs for HKDF 2013-03-15 11:16:16 +01:00
RyanC
c98857a47e add hkdf impl 2013-03-15 11:16:16 +01:00
Steffen Jaeckel
d84af284a3 build/testme: remove -j4 parameter 2013-03-15 11:08:54 +01:00
Steffen Jaeckel
2b2f5de743 rename README 2013-02-13 11:42:19 +01:00
Steffen Jaeckel
8a53674b18 updated README 2013-02-13 11:38:25 +01:00
Steffen Jaeckel
eb9bad79bf udpate testme to display correct version when run out of repository 2013-02-13 11:33:39 +01:00
Steffen Jaeckel
dda83c9da1 Merge branch 'ccbrown/master' into develop 2013-02-13 10:05:02 +01:00
Christopher Brown
9953c69455 update makefiles 2013-02-13 10:01:21 +01:00
Christopher Brown
2cb8c44113 der fixes and additions 2013-02-13 10:01:20 +01:00
Steffen Jaeckel
7050bdb7c8 use corrected version of zeromem() from @dtrebbien 2012-11-23 00:53:54 +01:00
Steffen Jaeckel
f32e52d5ac mark scripts as executable 2012-11-23 00:49:26 +01:00
Steffen Jaeckel
21ddcf3568 fix multi2 as proposed by kmx 2012-11-18 18:44:14 +01:00
Steffen Jaeckel
8cda684a0e improved multi2_test() 2012-11-18 18:41:46 +01:00
Steffen Jaeckel
bb8bd034f5 Merge branch 'ppelleti/ltc-fix-noekeon-gmp' into develop 2012-11-18 15:24:52 +01:00
Patrick Pelletier
5b662d6ed8 Fix some small typos in documentation 2012-11-18 15:24:15 +01:00
Patrick Pelletier
80ef95f3c1 Checked in program which generates Noekeon vectors using BouncyCastle. 2012-11-18 15:24:15 +01:00
Patrick Pelletier
e7b4705fca corrected Noekeon vectors 2012-11-18 15:24:14 +01:00
Patrick Pelletier
0e143a5cfe EAX-noekeon vectors from BouncyCastle 2012-11-18 15:24:14 +01:00
Patrick Pelletier
6dc089015a Fix LTC's bug in PI1/PI2 of Noekeon. Add vectors from BouncyCastle. 2012-11-18 15:24:13 +01:00
Patrick Pelletier
5708adb6c1 Add Camellia to the test vectors. 2012-11-18 15:24:12 +01:00
Patrick Pelletier
65254f65bf Fix camellia_keysize() to not change the keysize if it is correct.
It was rounding 32 down to 24, 24 down to 16, and claiming 16 was invalid.
2012-11-18 15:24:12 +01:00
Patrick Pelletier
e3acd4cabe Make GMP use uppercase to match LibTomMath. 2012-11-18 15:24:11 +01:00
Patrick Pelletier
3fbccfcb5c support base 64 for GMP 2012-11-18 15:24:11 +01:00
Steffen Jaeckel
20f0c74d17 Merge branch 'ppelleti/ltc-fixes' into develop 2012-11-18 15:21:51 +01:00
Patrick Pelletier
382c9d4d85 Some fixes necessary to support the Clang compiler
First of all, it had a failure in SEED:

LTC_KSEED failed for x=0, I got:
expected    actual   (ciphertext)
     5e  ==  5e
     ba  ==  ba
     c6  ==  c6
     e0  ==  e0
     05  !=  00
     4e  !=  00
     16  !=  00
     68  !=  00
     19  ==  19
     af  ==  af
     f1  ==  f1
     cc  ==  cc
     6d  !=  00
     34  !=  00
     6c  !=  00
     db  !=  00

Since SEED uses the 32H macros, this is really analogous to the
problem I saw with the 64H macros in Camellia with gcc.  Not sure why
gcc only had a problem with 64H and not 32H, but since this is an
interaction with the optimizer, it's not going to happen every time
the macro is used (hence why the store tests pass; only when you get
into the complexity of a real cipher do you start having problems) and
it makes sense it will vary from compiler to compiler.

Anyway, I went ahead and added the ability to use __builtin_bswap32,
in addition to __builtin_bswap64, which I already did in a previous
commit.  This solves the problem for clang, although I had to add new
logic to detect the bswap builtins in clang, since it has a different
way to detect them than gcc (see the comments in the code).  The
detection logic was complicated enough, and applied to both the 32H
and 64H macros, so I factored out the detection logic into
tomcrypt_cfg.h.
2012-11-18 15:20:12 +01:00
Patrick Pelletier
ad566e1b00 Use __builtin_bswap64 if it is available
This produces slightly better performance than the inline assembly,
and has the added benefit that it should be portable to other systems
that use gcc, not just x86-64.

Here are the results on my "AMD Athlon(tm) 7450 Dual-Core Processor"
with "gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3":

with portable 64H macros:

camellia            : Schedule at   1659
camellia            [ 23]: Encrypt at   431, Decrypt at   434
whirlpool           : Process at    55

with inline assembly (with "memory clobber" for correctness):

camellia            : Schedule at   1380
camellia            [ 23]: Encrypt at   406, Decrypt at   403
whirlpool           : Process at    50

with __builtin_bswap64:

camellia            : Schedule at   1352
camellia            [ 23]: Encrypt at   396, Decrypt at   391
whirlpool           : Process at    46
2012-11-18 15:20:12 +01:00
Patrick Pelletier
cefff85550 Add "memory" as a clobber for bswap inline assembly.
This had been causing Camellia (the only cipher that uses these
macros) to fail when compiling "out-of-the-box" with gcc version
"4.3.3-5ubuntu4".  I think because the compiler had no idea any memory
access was going on in these macros.

Adding "memory" as a clobber solves the problem, but is probably
overkill.  I suspect that if we specify the constraint for y
differently, we could get rid of both "memory" and __volatile__, which
would allow the compiler to optimize much more.

Also, in gcc versions that support it, we should probably use the
bswap builtins instead.
2012-11-18 15:20:11 +01:00
Patrick Pelletier
ee7c031ddf Added some code (commented out) to print details about Camellia test failure
(and ditto for SEED)

This is modeled after similar commented-out code in sober128_test(),
but slightly fancier.
2012-11-18 15:20:10 +01:00
Patrick Pelletier
cecbbb88fc When a test fails, print the algorithm that it failed on.
As near as I can tell, LibTomCrypt doesn't provide any way to tell
which cipher failed when it reports a cipher test failure.  For
example, I was getting:

Algorithm failed test vectors. (5)
cipher_hash_test.c:14:cipher_descriptor[x].test()

But there's no way to tell what value x has, and even if there was, it
would take a bit of digging to determine which algorithm that
corresponds to.  So, I added a variant of the DO() macro, DOX(), which
takes an additional string argument which is displayed on failure.  So
now I get:

Algorithm failed test vectors. (5) - camellia
cipher_hash_test.c:14:cipher_descriptor[x].test()
2012-11-18 15:20:10 +01:00
Patrick Pelletier
9228cbbd1e don't delete doc/crypt.pdf in "make clean"
"make clean" was deleting "doc/*.pdf", despite the fact that there
were two comments (one above and one below) stating that it did not.

Since doc/crypt.pdf is checked into git, running "make clean" made my
git state dirty, which seems undesirable.

I took sort of a compromise position and had "make clean" continue to
delete any other .pdf files in doc (such as refman.pdf), but
explicitly not delete crypt.pdf.
2012-11-18 15:20:09 +01:00
Patrick Pelletier
4a2b54a446 Changed "make clean" to not delete crypt.lof (which is checked into git)
This line:
rm -f `find . -type f | grep "[.]lo"  | xargs`

was deleting crypt.lof, which seemed undesirable.  One solution would
be to end the grep expression with "$", but it seemed more
straightforward just to pass "-name" to "find", rather than piping
through grep.
2012-11-18 15:20:08 +01:00
Patrick Pelletier
d61c537a2a missing a comma 2012-11-18 15:20:08 +01:00
Patrick Pelletier
233f207c17 Use "GMP_DESC" instead of "GPM_DESC"
This seemed to be the only place in the code that was using this
particular transposition.  And, indeed, when compiling with
"GMP_DESC", it looks like it is necessary to disable Diffie-Hellman.
(Otherwise, the test fails for me.)
2012-11-18 15:20:07 +01:00
Steffen Jaeckel
bd7933cc2b add check for defines of math provider 2012-10-08 10:20:21 +02:00
Steffen Jaeckel
77860ba866 yarrow: prevent access to NULL pointer 2012-05-04 01:01:24 +02:00
Steffen Jaeckel
9c4fc762fc yarrow: trim trailing spaces 2012-05-04 01:00:25 +02:00
Steffen Jaeckel
2cd666f284 rsa_import: prevent double-free 2012-04-24 18:08:13 +02:00
Steffen Jaeckel
5c9fa403ff Merge pull request #3 from gpakosz/patch-1
replaced free(in) by XFREE(in) at line 56
2011-07-12 06:01:19 -07:00
Gregory Pakosz
1346ccdee8 replaced free(in) by XFREE(in) at line 56 2011-07-12 05:56:48 -07:00
Steffen Jaeckel
8859f6e73d fixed wrong return value interpretation of register_crypt/hash/prng function calls 2011-06-14 20:56:42 +02:00
Steffen Jaeckel
2b0ce25778 testme.sh: added parameter checking 2011-05-20 09:41:57 +02:00
Steffen Jaeckel
5ec1e53e02 updated gitignore 2011-03-21 22:59:59 +01:00
Steffen Jaeckel
8dc8a2d551 Added define LTC_RSA_BLINDING to be able to disable rsa blinding 2011-03-21 22:50:49 +01:00
Steffen Jaeckel
380693edd9 fixed error causing segmentation fault 2011-03-21 21:17:59 +01:00
Steffen Jaeckel
496453f289 removed testing of "stripped" rsa key 2011-03-21 21:17:31 +01:00
Steffen Jaeckel
25bd5c1275 added missing handling of new type LTC_ASN1_RAW_BIT_STRING in der_encode_sequence_multi() 2011-03-21 21:12:46 +01:00
Steffen Jaeckel
43c6b5ab89 make build.sh less verbose when test fails 2011-03-21 21:10:23 +01:00
Nikos Mavrogiannopoulos
fa22e791d4 RSA and DSA public keys are stored using the SubjectPublicKeyInfo format. 2011-03-21 19:24:10 +01:00
Nikos Mavrogiannopoulos
8c2850f8d9 Added RSA blinding (requires mp_rand()). 2011-03-21 08:26:41 +01:00
Nikos Mavrogiannopoulos
ed6897d90f DSA private keys are being exported to a compatible with OpenSSL and GnuTLS format. 2011-03-21 08:26:27 +01:00
Steffen Jaeckel
2895c9d7fe updated gitignore 2011-01-25 11:27:28 +01:00
Steffen Jaeckel
5b1c0108c9 updated gitignore and VS2008 project file 2011-01-24 10:41:30 +01:00
Steffen Jaeckel
412b2ee1fc after multiple objections of libtom users [1], we decided to change licensing
to a dual licensing model.

[1] https://groups.google.com/group/libtom/browse_thread/thread/d7b67bc6410250b3
2011-01-19 10:18:15 +01:00
Steffen Jaeckel
4a8927d5c0 updated gitignore to ignore files generated when executing build.sh 2011-01-19 09:21:19 +01:00
Steffen Jaeckel
edf11c62c0 Diffie-Hellman/Math: introduced the proposed changes by Alexander Kurpiers
addmod and submod are moved to the end of the math descriptor, in order
to be able to run existing software against a new version of ltc without need
to rebuild the software.
2011-01-18 21:16:11 +01:00
Steffen Jaeckel
6fecec107d rejoined diffie hellman code from ltc 1.05, thanks to Alexander Kurpiers 2011-01-18 20:06:03 +01:00
Steffen Jaeckel
5039e6520f fixed tests and testvectors 2011-01-18 19:42:38 +01:00
Steffen Jaeckel
77e31fb6a9 Re-licensed all code under WTFPL, c.f. http://sam.zoy.org/wtfpl/ 2010-10-26 16:02:34 +02:00
Steffen Jaeckel
e7ce129e9b flushed content of CVS/SVN tags 2010-06-16 20:02:51 +02:00
Steffen Jaeckel
c3018d69d0 removed gcc compiler warnings 2010-06-16 20:02:11 +02:00
Steffen Jaeckel
59f9c00f98 removed IAR compiler warnings 2010-06-16 20:02:01 +02:00
Daniel Akesson
e960ff887c Added project and solution files for Visual Studio 2005 and Visual Studio 2008. 2010-06-16 20:01:47 +02:00
Steffen Jaeckel
3522c754aa changed LTC_LTC_PKCS_1_* enum members to LTC_PKCS_1_* 2010-06-16 20:01:31 +02:00
Steffen Jaeckel
0a432b6b08 adjusted file dependant functions
when LTC_NO_FILE is defined, the functions hash_filehandle()
and hash_file() won't be available at all instead of returning CRYPT_NOP
2010-06-16 20:00:50 +02:00
Steffen Jaeckel
6816ac3f3f modification to suppress compiler warning when LTC_FAST is not defined 2010-06-16 19:59:39 +02:00
Steffen Jaeckel
fcd5faf947 added gitignore to suppress .o and .a files 2010-06-16 19:58:57 +02:00
Steffen Jaeckel
2f1fc7c50d import of libtomcrypt
out of
  lt_tree.tar.bz2
checksums of lt_tree.tar.bz2
MD5: 3c36e1ca95518f4d00a76dc9b7049952
SHA1: 4f31d1aa8cd1b9d7452b777cd52f8280dc7ebcbc
2010-06-16 19:58:20 +02:00
Tom St Denis
bbc52b9e1b added libtomcrypt-1.17 2010-06-16 12:39:13 +02:00
Tom St Denis
e24b01d392 added libtomcrypt-1.16 2010-06-16 12:39:09 +02:00
Tom St Denis
2de2976d25 added libtomcrypt-1.15 2010-06-16 12:39:06 +02:00
Tom St Denis
479cc9c261 added libtomcrypt-1.14 2010-06-16 12:39:03 +02:00
1101 changed files with 168519 additions and 33283 deletions

View file

@ -0,0 +1,6 @@
{
<s_decode_header>
Memcheck:Cond
...
fun:s_decode_header
}

71
.ci/build.sh Executable file
View file

@ -0,0 +1,71 @@
#!/bin/bash
echo "$1 ($2, $3)..."
make clean 1>/dev/null 2>/dev/null
echo -n "building..."
if [ -f /proc/cpuinfo ]
then
MAKE_JOBS=$(( ($(cat /proc/cpuinfo | grep -E '^processor[[:space:]]*:' | tail -n -1 | cut -d':' -f2) + 1) * 2 + 1 ))
else
MAKE_JOBS=8
fi
CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" make -j$MAKE_JOBS -f $3 all_test 1>gcc_1.txt 2>gcc_2.txt
mret=$?
cnt=$(wc -l < gcc_2.txt)
# ignore 1 line since ar prints to stderr instead of stdout and ar is called for
# $(LIBNAME)
if [[ $mret -ne 0 ]] || [[ $cnt -gt 1 ]]; then
echo "build $1 failed! printing gcc_2.txt now for convenience"
cat gcc_2.txt
exit 1
fi
# remove the standard arguments from the make options
opts=${3//makefile.shared/}
opts=${opts//makefile/}
opts=${opts//V=1/}
opts=${opts//COVERAGE=1/}
opts=$(echo $opts | tr -d '[:space:]')
# if there's something else than the standard arguments we check if we're currently
# building a Travis PR and if it's like that, we skip those tests
if [ ! -z "$opts" ]; then
if [ ! -z "$TRAVIS_PULL_REQUEST" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo "PR Tests skipped" | tee testok.txt
exit 0
fi
fi
echo -n "testing..."
if [ -a test ] && [ -f test ] && [ -x test ]; then
((./test >test_std.txt 2>test_err.txt && ./tv_gen > tv.txt) && echo "$1 test passed." && echo "y" > testok.txt) || (echo "$1 test failed, look at test_err.txt or tv.txt" && exit 1)
if find *_tv.txt -type f 1>/dev/null 2>/dev/null ; then
for f in *_tv.txt; do
# check for lines starting with '<' ($f might be a subset of notes/$f)
difftroubles=$(diff -i -w -B $f notes/$f | grep '^<')
if [ -n "$difftroubles" ]; then
echo "FAILURE: $f"
diff -i -w -B $f notes/$f
echo "tv_gen $f failed" && rm -f testok.txt && exit 1
else
true
fi
done
fi
fi
if [ -a testok.txt ] && [ -f testok.txt ]; then
if [ "$LTC_COVERAGE" != "" ]; then
bash .ci/coverage_more.sh > test_coverage_more.txt || exit 1
lcov_opts="--capture --no-external --directory src -q"
lcov_out=$(echo coverage_$1_$2_$3 | tr ' -=+' '_')".info"
lcov $lcov_opts --output-file $lcov_out
fi
exit 0
fi
exit 1

46
.ci/build_options.sh Executable file
View file

@ -0,0 +1,46 @@
#!/bin/bash
if [ "$#" != "5" ]; then
echo "Usage is: ${0} \"build_options\" \"<prepend CFLAGS>\" \"<makefile>\" \"<append CFLAGS>\" <math library to link to>"
echo "CC=gcc ${0} \"build_options\" \" \" \"makefile\" \"-DUSE_LTM -DLTM_DESC -I../libtommath\" ../libtommath/libtommath.a"
exit -1
fi
# output version
bash .ci/printinfo.sh
set -e
options=(
-DLTC_EASY
-DLTC_FORTUNA_RESEED_RATELIMIT_STATIC
-DLTC_FORTUNA_USE_ENCRYPT_ONLY
-DLTC_MECC_FP
-DLTC_NO_TABLES
-DLTC_NO_FAST
-DLTC_NO_ASM
-DLTC_NO_DEPRECATED_APIS
-DLTC_NO_ECC_TIMING_RESISTANT
-DLTC_NO_RSA_BLINDING
-DLTC_PTHREAD
-DLTC_SMALL_CODE
-DLTC_SMALL_STACK
)
make clean V=0
make pre_gen
for opt in ${options[@]}; do
echo "Build: $opt"
CFLAGS="$2 $CFLAGS $4 $opt" EXTRALIBS="$5" make -j$(nproc) -f $3 AMALGAM=1 all 1>>gcc_1.txt 2>>gcc_2.txt
./small
make clean V=0
done
# we don't want LTC_EASY when running the tests now
unset 'options[0]'
echo "All: ${options[@]}"
CFLAGS="$2 $CFLAGS $4 ${options[@]}" EXTRALIBS="$5" make -j$(nproc) -f $3 AMALGAM=1 all 1>>gcc_1.txt 2>>gcc_2.txt
./test >test_std.txt 2>test_err.txt
exit 0

11
.ci/check_source.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash
# output version
bash .ci/printinfo.sh
make clean > /dev/null
echo "checking..."
./helper.pl --check-all || exit 1
exit 0

47
.ci/clang-tidy.sh Executable file
View file

@ -0,0 +1,47 @@
#!/bin/bash
# output version
bash .ci/printinfo.sh
# tested with clang-tidy from llvm-6.0.0
# not tested with Travis-CI
#### we use the main test sets:
# readability
# misc
# clang-analyzer
# google
# performance
# modernize
# cert
# bugprone
# portability
#### the following checks are skipped
# google-readability-function-size
# readability-function-size
# google-readability-casting
# readability-braces-around-statements
# misc-macro-parentheses
# clang-analyzer-valist.Uninitialized
echo "Run clang-tidy version"
clang-tidy --version || exit 1
echo "Run clang-tidy..."
clang-tidy src/*/*.c src/*/*/*.c src/*/*/*/*.c src/*/*/*/*/*.c -warnings-as-errors='*' --quiet --checks=-*,\
readability-*,-readability-function-size,-readability-braces-around-statements,\
misc-*,-misc-macro-parentheses,\
clang-analyzer-*,-clang-analyzer-valist.Uninitialized,\
google-*,-google-readability-function-size,-google-readability-casting,\
performance-*,\
modernize-*,\
cert-*,\
bugprone-*,\
portability-* -- -DUSE_LTM -DLTM_DESC -Isrc/headers -I../libtommath || { echo "clang-tidy FAILED!"; exit 1; }
echo "clang-tidy ok"
exit 0

9
.ci/cmake.bat Normal file
View file

@ -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..

47
.ci/coverage.sh Executable file
View file

@ -0,0 +1,47 @@
#!/bin/bash
set -e
if [ "$TRAVIS_CI" == "private" ]; then
exit 0
fi
if [ "$#" != "5" ]; then
echo "Usage is: ${0} \"coverage\" \"<prepend CFLAGS>\" \"<makefile>\" \"<append CFLAGS>\" <math library to link to>"
echo "CC=gcc ${0} \"coverage\" \" \" \"makefile\" \"-DUSE_LTM -DLTM_DESC -I../libtommath\" ../libtommath/libtommath.a"
exit -1
fi
if [ -z "$(echo $CC | grep "gcc")" ]; then
echo "no gcc detected, early exit success"
exit 0
fi
if [ "$(echo $3 | grep -v 'makefile[.]')" == "" ]; then
echo "only run $0 for the regular makefile, early exit success"
exit 0
fi
# output version
bash .ci/printinfo.sh
bash .ci/build.sh " $1" " $2" " $3 COVERAGE=1" "$4" "$5"
if [ -a testok.txt ] && [ -f testok.txt ]; then
echo
else
echo
echo "Test failed"
exit 1
fi
bash .ci/coverage_more.sh "$5" > test_coverage_more.txt || { rm -f testok.txt && exit 1 ; }
make lcov-single
# if this isn't run on CI create coverage locally
if [ "$CI" == "" ]; then
make lcov-html
else
coveralls-lcov coverage.info --service-job-id="$GITHUB_RUN_ID" --service-name="github" --repo-token="$REPO_TOKEN" --branch="$GITHUB_REF_NAME" --service-pull-request="$PR_NUMBER"
fi
exit 0

48
.ci/coverage_more.sh Executable file
View file

@ -0,0 +1,48 @@
#!/bin/bash
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
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"
diff -i -w -B hashsum_tv.txt notes/hashsum_tv.txt
echo "hashsum failed"
exit 1
else
echo "hashsum okay"
fi
pdiv "aesgcm"
./hashsum -a sha256 aesgcm > aesgcm.sha256sum
./aesgcm -e aesgcm aesgcm.enc0 "00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF"
./aesgcm -d aesgcm.enc0 aesgcm.dec0 "00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF"
./aesgcm -e aesgcm aesgcm.enc1 "00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABB"
./aesgcm -d aesgcm.enc1 aesgcm.dec1 "00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABB"
for i in {0..1}; do
rm aesgcm
mv aesgcm.dec${i} aesgcm
./hashsum -c aesgcm.sha256sum
done
chmod +x aesgcm
exit 0

114
.ci/meta_builds.sh Executable file
View file

@ -0,0 +1,114 @@
#!/bin/bash
#
# This builds different stuff depending on the compiler:
# gcc - valgrind, coverage
# clang - asan, ubsan, scan-build
# both - the two testbuild's NOTEST and NOFILE
set -e
if [ "$#" = "5" -a "$(echo $3 | grep -v 'makefile[.]')" = "" ]; then
echo "only run $0 for the regular makefile, early exit success"
exit 0
fi
if [ -f /proc/cpuinfo ]
then
MAKE_JOBS=$(( ($(cat /proc/cpuinfo | grep -E '^processor[[:space:]]*:' | tail -n -1 | cut -d':' -f2) + 1) * 2 + 1 ))
else
MAKE_JOBS=8
fi
function run_gcc() {
bash .ci/check_source.sh "CHECK_SOURCES" "$2" "$3" "$4" "$5"
make -j$(nproc) latex-tables V=0
./latex-tables
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 < <(./latex-tables | grep '^\\' | sed 's@\\@\\\\@g')
echo "docs OK"
make clean &>/dev/null
echo
echo "Build for ASAN..."
make -j$MAKE_JOBS CFLAGS="-fsanitize=address -fno-omit-frame-pointer -static-libasan $2 $CFLAGS $4" EXTRALIBS="-lasan $5" test LTC_DEBUG=1 V=1 1>gcc_1.txt 2>gcc_2.txt
echo
echo "Run ASAN tests with LTM..."
ASAN_OPTIONS=verbosity=1 ./test t ltm 1>test_std.txt 2> test_err.txt || exit 1
if echo $* | grep -q GMP ; then
echo
echo "Run ASAN tests with GMP..."
ASAN_OPTIONS=verbosity=1 ./test t gmp 1>test_std.txt 2> test_err.txt || exit 1
fi
make clean &>/dev/null
echo
echo "Create code coverage"
bash .ci/coverage.sh "COVERAGE" "$2" "$3" "$4" "$5"
}
function run_clang() {
# output version
bash .ci/printinfo.sh
scan_build=$(which scan-build) || true
[ -z "$scan_build" ] && scan_build=$(find /usr/bin/ -name 'scan-build-[0-9]*' | sort -nr | head -n1) || true
[ -z "$scan_build" ] && { echo "couldn't find clang scan-build"; exit 1; } || echo "run $scan_build"
$scan_build --status-bugs make -j$MAKE_JOBS all CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5"
make clean &>/dev/null
echo
echo "Build for UBSAN..."
make -j$MAKE_JOBS LDFLAGS="-fsanitize=undefined" CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" all LTC_DEBUG=1 V=1 1>gcc_1.txt 2>gcc_2.txt
echo "Run UBSAN tests with LTM..."
UBSAN_OPTIONS=verbosity=1 ./test t ltm 1>test_std.txt 2> test_err.txt || exit 1
if echo $* | grep -q GMP ; then
echo
echo "Run UBSAN tests with GMP..."
UBSAN_OPTIONS=verbosity=1 ./test t gmp 1>test_std.txt 2> test_err.txt || exit 1
fi
}
make clean &>/dev/null
EXTRALIBS="$5"
echo $* | grep -q GMP && EXTRALIBS="$EXTRALIBS -lgmp"
if [ -z "$(echo $CC | grep "clang")" ]; then
run_gcc "$1" "$2" "$3" "$4" "$EXTRALIBS"
else
run_clang "$1" "$2" "$3" "$4" "$EXTRALIBS"
fi
make clean &>/dev/null
bash .ci/testbuild.sh "NOTEST" "-DLTC_NO_TEST" "$3" "$4" "$EXTRALIBS"
make clean &>/dev/null
bash .ci/testbuild.sh "NOFILE" "-DLTC_NO_FILE" "$3" "$4" "$EXTRALIBS"
make clean &>/dev/null
echo
echo "Build full debug..."
make -j$MAKE_JOBS CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$EXTRALIBS" all_test LTC_DEBUG=2 V=1 1>gcc_1.txt 2>gcc_2.txt

20
.ci/printinfo.sh Normal file
View file

@ -0,0 +1,20 @@
#!/bin/bash
version=$(git describe --tags --always --dirty 2>/dev/null)
if [ ! -e ".git" ] || [ -z $version ]
then
version=$(grep "^VERSION=" makefile_include.mk | sed "s/.*=//")
fi
echo "Testing version:" $version
#grep "VERSION=" makefile | perl -e "@a = split('=', <>); print @a[1];"`
# get uname
echo "uname="`uname -a`
# get gcc name
if [ -z ${CC} ]
then
CC="gcc"
fi
echo "${CC}="`${CC} -dumpversion`
echo

45
.ci/run.sh Executable file
View file

@ -0,0 +1,45 @@
#!/bin/bash
# output version
bash .ci/printinfo.sh
bash .ci/build.sh " $1" "$2" "$3" "$4" "$5"
if [ -a testok.txt ] && [ -f testok.txt ]; then
echo
else
echo
echo "Test failed"
exit 1
fi
rm -f testok.txt
bash .ci/build.sh " $1" "$2" "$3 LTC_DEBUG=1" "$4" "$5"
if [ -a testok.txt ] && [ -f testok.txt ]; then
echo
else
echo
echo "Test failed"
exit 1
fi
rm -f testok.txt
bash .ci/build.sh " $1" "$2 -O2" "$3 IGNORE_SPEED=1" "$4" "$5"
if [ -a testok.txt ] && [ -f testok.txt ]; then
echo
else
echo
echo "Test failed"
exit 1
fi
rm -f testok.txt
bash .ci/build.sh " $1" "$2" "$3 IGNORE_SPEED=1 LTC_SMALL=1" "$4" "$5"
if [ -a testok.txt ] && [ -f testok.txt ]; then
echo
else
echo
echo "Test failed"
exit 1
fi
exit 0

22
.ci/testbuild.sh Executable file
View file

@ -0,0 +1,22 @@
#!/bin/bash
# output version
bash .ci/printinfo.sh
if [ -f /proc/cpuinfo ]
then
MAKE_JOBS=$(( ($(cat /proc/cpuinfo | grep -E '^processor[[:space:]]*:' | tail -n -1 | cut -d':' -f2) + 1) * 2 + 1 ))
else
MAKE_JOBS=8
fi
echo "$1 (Build Only, $2, $3)..."
make clean 1>/dev/null 2>/dev/null
echo -n "building..."
touch testok.txt
make -j$MAKE_JOBS -f $3 test tv_gen CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" 1>gcc_1.txt 2>gcc_2.txt || (echo "build $1 failed see gcc_2.txt for more information" && cat gcc_2.txt && rm -f testok.txt && exit 1)
if find testok.txt -type f 1>/dev/null 2>/dev/null ; then
echo "successful"
exit 0
fi
exit 1

43
.ci/valgrind.sh Executable file
View file

@ -0,0 +1,43 @@
#!/bin/bash
set -e
if [ "$#" = "5" -a "$(echo $3 | grep -v 'makefile[.]')" = "" ]; then
echo "only run $0 for the regular makefile, early exit success"
exit 0
fi
if [ -f /proc/cpuinfo ]
then
MAKE_JOBS=$(( ($(cat /proc/cpuinfo | grep -E '^processor[[:space:]]*:' | tail -n -1 | cut -d':' -f2) + 1) * 2 + 1 ))
else
MAKE_JOBS=8
fi
# output version
bash .ci/printinfo.sh
make clean &>/dev/null
echo "Build for valgrind..."
# set DWARFv4 as debug format for clang, since it creates DWARFv5 as default which isn't support in old valgrind
[ -z "$(echo $CC | grep "clang")" ] || GFLAG="-gdwarf-4"
make -j$MAKE_JOBS CFLAGS="$2 $CFLAGS $4 $GFLAG" EXTRALIBS="$5" test LTC_DEBUG=1 1>gcc_1.txt 2>gcc_2.txt
echo "Run tests with valgrind..."
for i in `seq 1 10` ; do sleep 300 && echo "Valgrind tests in Progress..."; done &
alive_pid=$!
readonly VALGRIND_OPTS="--error-exitcode=666 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all"
readonly distro="$(lsb_release -si)_$(lsb_release -sc)"
readonly suppfile=".ci/Valgrind-${distro}.supp"
function get_suppfile() { [ -f "$suppfile" ] && echo "--suppressions=$suppfile" || echo ""; }
readonly VALGRIND_EXTRA_OPTS=$(get_suppfile)
valgrind $VALGRIND_OPTS $VALGRIND_EXTRA_OPTS ./test >test_std.txt 2> >(tee -a test_err.txt >&2) || { kill $alive_pid; echo "Valgrind failed"; exit 1; }
kill $alive_pid

42
.clang-format Normal file
View file

@ -0,0 +1,42 @@
---
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakTemplateDeclarations: false
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
ColumnLimit: 120
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerBinding: true
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: false
PenaltyBreakComment: 60
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerBindsToType: false
SpacesBeforeTrailingComments: 1
Cpp11BracedListStyle: false
Standard: Cpp03
IndentWidth: 3
TabWidth: 8
UseTab: Never
BreakBeforeBraces: Linux
IndentFunctionDeclarationAfterType: false
SpacesInParentheses: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
...

7
.gitattributes vendored Normal file
View file

@ -0,0 +1,7 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/** export-subst
/tests/test.key -text

39
.github/ISSUE_TEMPLATE/01-bug_report.md vendored Normal file
View file

@ -0,0 +1,39 @@
---
name: Bug report
about: Create a bug report
title: ''
labels: bug
assignees: ''
---
<!--
Do you want to ask a question? Are you looking for support? The Mailing list is the best place for getting support: https://groups.google.com/forum/#!forum/libtom
This is a very generic template, remove items that do not apply. For completed items, change [ ] to [x].
-->
### Prerequisites
* [ ] Checked the developer manual
* [ ] Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=repo%3Alibtom%2Flibtomcrypt
* [ ] Checked that your issue isn't due to the fact that you're using asymmetric cryptography and you forgot linking in and/or setting an MPI provider (usually this causes either random crashes or runtime errors like `LTC_ARGCHK 'ltc_mp.name != NULL' failure ...`). c.f. Ch. "Math Descriptors" of the developer manual.
* [ ] Checked that your issue isn't related to TomsFastMath's limitation that PK operations can by default only be done with max. 2048bit keys
### Description
[Description of the issue]
### Steps to Reproduce
<!-- Please either describe your issue or even better, provide a functional code example reproducing your issue. -->
### Version
You can get this information from the define `SCRYPT` in `src/include/tomcrypt.h` or your local git repository by running `git describe --always --tags --dirty`.
Also, please include the compiler, the compiler version, the architecture and (if applicable) the MPI provider, the OS and what version of the OS you're experiencing the issue.
### Additional Information
Any additional information, configuration or data that might be necessary to reproduce the issue.

18
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,18 @@
<!--
Thank you for your pull request.
If this fixes an existing github issue, make sure to have a line saying 'Fixes: <github-issue>' (without quotes) in the commit message.
Please use the long format to refer to an issue 'libtom/libtomcrypt#<issue-id>'.
If this fixes something (even if there exists no github issue), make sure to have a line saying 'Fixes: <commit-id> ("Description")'
This can be created via e.g. `git --no-pager log -1 --pretty=fixes <commid-id>
-->
### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->
* [ ] documentation is added or updated
* [ ] tests are added or updated
* [ ] if this fixes something: added a `Fixes:` tag to the commit message

168
.github/workflows/main.yml vendored Normal file
View file

@ -0,0 +1,168 @@
name: CI
on:
push:
branches:
- master
- develop
- 'release/**'
- 'support/**'
- 'ci/**'
pull_request:
branches:
- master
- develop
- 'release/**'
- 'support/**'
- 'ci/**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
Docs:
runs-on: ubuntu-24.04
container: texlive/texlive:latest-medium
steps:
- uses: actions/checkout@v4
- name: generate PDF
run: |
make docs
cp doc/crypt.pdf crypt-${{ github.run_id }}.pdf
- name: upload PDF
uses: actions/upload-artifact@v4
with:
name: crypt-${{ github.run_id }}.pdf
path: crypt-${{ github.run_id }}.pdf
Build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
cc: [ gcc, clang ]
os: [ ubuntu-22.04, ubuntu-24.04 ]
config:
- { BUILDNAME: 'META_BUILDS', BUILDOPTIONS: '-DGMP_DESC', BUILDSCRIPT: '.ci/meta_builds.sh' }
- { BUILDNAME: 'VALGRIND', BUILDOPTIONS: '', BUILDSCRIPT: '.ci/valgrind.sh' }
- { BUILDNAME: 'STOCK', BUILDOPTIONS: '', BUILDSCRIPT: '.ci/run.sh' }
- { BUILDNAME: 'BUILD_OPTIONS', BUILDOPTIONS: '', BUILDSCRIPT: '.ci/build_options.sh' }
- { BUILDNAME: 'STOCK-MPI', BUILDOPTIONS: '-ULTM_DESC -UTFM_DESC -UUSE_LTM -UUSE_TFM', BUILDSCRIPT: '.ci/run.sh' }
- { BUILDNAME: 'STOCK+ARGTYPE=1', BUILDOPTIONS: '-DARGTYPE=1', BUILDSCRIPT: '.ci/run.sh' }
- { BUILDNAME: 'STOCK+ARGTYPE=2', BUILDOPTIONS: '-DARGTYPE=2', BUILDSCRIPT: '.ci/run.sh' }
- { BUILDNAME: 'STOCK+ARGTYPE=3', BUILDOPTIONS: '-DARGTYPE=3', BUILDSCRIPT: '.ci/run.sh' }
- { BUILDNAME: 'STOCK+ARGTYPE=4', BUILDOPTIONS: '-DARGTYPE=4', BUILDSCRIPT: '.ci/run.sh' }
steps:
- uses: actions/checkout@v4
- name: install dependencies
uses: nick-fields/retry@v4.0.0
with:
timeout_minutes: 20
max_attempts: 3
command: |
sudo apt-get update -qq
sudo apt-get install -y libgmp-dev valgrind libtool-bin clang-tools lcov ruby clang
sudo apt-get remove -y libtommath1
sudo gem install coveralls-lcov
curl -s https://packagecloud.io/install/repositories/libtom/packages/script.deb.sh | sudo bash
sudo apt-get install libtfm-git-dev libtommath-git-dev
- name: run tests
env:
CC: "${{ matrix.cc }}"
PR_NUMBER: ${{ github.event.number }}
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
bash "${{ matrix.config.BUILDSCRIPT }}" "${{ matrix.config.BUILDNAME }}" "-DUSE_LTM -DLTM_DESC" "makefile V=1" "${{ matrix.config.BUILDOPTIONS }}" "-ltommath"
bash "${{ matrix.config.BUILDSCRIPT }}" "${{ matrix.config.BUILDNAME }}" "-DUSE_TFM -DTFM_DESC" "makefile.shared V=1" "${{ matrix.config.BUILDOPTIONS }}" "-ltfm"
- name: regular logs
if: ${{ !failure() }}
run: |
cat gcc_1.txt || true
cat gcc_2.txt || true
- name: error logs
if: ${{ failure() }}
run: |
cat gcc_1.txt || true
cat gcc_2.txt || true
cat test_std.txt || true
cat test_err.txt || true
cat tv.txt || true
- name: pack build directory
if: ${{ failure() }}
run: |
tar cJf build-${{ github.run_id }}.tar.xz --exclude ./build-${{ github.run_id }}.tar.xz .
- name: upload Artifact
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: build-${{ github.run_id }}.tar.xz
path: build-${{ github.run_id }}.tar.xz
retention-days: 1
Amalgam:
runs-on: ${{ matrix.os }}
strategy:
matrix:
cc: [ gcc, clang ]
os: [ ubuntu-22.04, ubuntu-24.04 ]
steps:
- uses: actions/checkout@v4
- name: install dependencies
uses: nick-fields/retry@v4.0.0
with:
timeout_minutes: 20
max_attempts: 3
command: |
sudo apt-get update -qq
sudo apt-get remove -y libtommath1
curl -s https://packagecloud.io/install/repositories/libtom/packages/script.deb.sh | sudo bash
sudo apt-get install libtommath-git-dev
- name: run tests
env:
CC: "${{ matrix.cc }}"
run: |
make pre_gen
make CFLAGS="-DLTM_DESC -DUSE_LTM" EXTRALIBS="-ltommath" AMALGAM=1 -j$(nproc) check
CMake:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-22.04, ubuntu-24.04, ubuntu-22.04-arm, ubuntu-24.04-arm ]
build_type: [ '', -DCMAKE_BUILD_TYPE=Debug, -DCMAKE_BUILD_TYPE=Release, -DCMAKE_BUILD_TYPE=RelWithDebInfo, -DCMAKE_BUILD_TYPE=MinSizeRel ]
cc: [ clang, gcc ]
cflags: [ '', '-DLTC_CFLAGS="-DLTC_NO_ASM"']
config:
# Static library build
- { CMAKEOPTIONS: '-DBUILD_SHARED_LIBS=Off' }
# Shared library build
- { CMAKEOPTIONS: '-DBUILD_SHARED_LIBS=On' }
steps:
- uses: actions/checkout@v4
- name: install dependencies
uses: nick-fields/retry@v4.0.0
with:
timeout_minutes: 20
max_attempts: 3
command: |
sudo apt-get update -qq
sudo apt-get remove -y libtommath1
curl -s https://packagecloud.io/install/repositories/libtom/packages/script.deb.sh | sudo bash
sudo apt-get install libtommath-git-dev
sudo apt-get install -y cmake gcc clang llvm
- name: build
run: |
mkdir build
cd build
CC=${{ matrix.cc }} cmake ${{ matrix.config.CMAKEOPTIONS }} ${{ matrix.build_type }} ${{ matrix.cflags }} ..
make -j$(nproc)
- name: test
run: |
cd build
CC=${{ matrix.cc }} cmake ${{ matrix.config.CMAKEOPTIONS }} ${{ matrix.build_type }} ${{ matrix.cflags }} -DBUILD_TESTING=On ..
make -j$(nproc)
ctest
- name: error logs
if: ${{ failure() }}
run: |
cat build/Testing/Temporary/LastTest.log || true
cat demo/build/Testing/Temporary/LastTest.log || true

121
.gitignore vendored Normal file
View file

@ -0,0 +1,121 @@
# suppress compiler/linker output
*.[oa]
*.obj
*.dylib*
*.dll*
*.so*
[Dd]ebug/
[Rr]elease/
/MSVC_*
.bin/
# release files
/libtomcrypt-*
/crypt-*
pre_gen/
# suppress output of build process
gcc_[12].txt
testok.txt
test_*.txt
tv.txt
*_tv.txt
doxygen/
doc/crypt.pdf
doc/refman.pdf
# *nix/windows test executables
ltc-*
aesgcm
aesgcm.exe
constants
constants.exe
crypt
crypt.exe
der_print_flexi
der_print_flexi.exe
hashsum
hashsum.exe
multi
multi.exe
openssl-enc
openssl-enc.exe
openssh-privkey
openssh-privkey.exe
latex-tables
latex-tables.exe
sizes
sizes.exe
small
small.exe
test
test.exe
tv_gen
tv_gen.exe
timing
timing.exe
# Visual Studio special files
# ignore user specific settings
*.user
*.suo
# ignore non-compressed browse file (holds information for ClassView, IntelliSense and WizardBar)
*.ncb
# ignore VS intermediate and program database files
*.idb
*.pdb
# Eclipse special files
.project
.cproject
.settings/
# KDevelop special files
*.kdev4
# macOS special files
.DS_Store
# other special files
showlibs # symlink to .libs
# oops ;) but we don't want them to appear in the repository...
*.stackdump
*.core
# misc
*.rej
*.patch
*.diff
*.orig
*.out
*.ll
*.gcda
*.gcno
*.gcov
libtomcrypt.pc
# output from doc generation
doxygen/
*.dvi
*.log
*.aux
*.toc
*.idx
*.ilg
*.ind
*.out
*.lof
*.bak
coverage*/
coverage*.info
# coverity intermediate directory etc.
cov-int/
.coverity_*
libtomcrypt.lzma
# cmake build directories
build*/

441
CMakeLists.txt Normal file
View file

@ -0,0 +1,441 @@
# SPDX-License-Identifier: Unlicense
#
# LibTomCrypt, modular cryptographic library -- Tom St Denis
#
cmake_minimum_required(VERSION 3.22)
project(
libtomcrypt
VERSION 1.18.2
DESCRIPTION "A modular cryptographic library."
HOMEPAGE_URL "https://www.libtom.net/LibTomCrypt"
LANGUAGES C
)
# package release version
#
# * bump if re-releasing the same VERSION + patches
# * set to 1 if releasing a new VERSION
set(PACKAGE_RELEASE_VERSION 1)
# -----------------------------------------------------------------------------
# Include CMake modules
# -----------------------------------------------------------------------------
include(GNUInstallDirs)
include(CheckIPOSupported)
include(CMakePackageConfigHelpers)
# for potential builds against gnump
include(FindPkgConfig)
# for potential builds with MSVC
include(CMakePushCheckState)
include(CheckSymbolExists)
# default is "No tests"
option(BUILD_TESTING "" OFF)
include(CTest)
include(sources.cmake)
# -----------------------------------------------------------------------------
# Options
# -----------------------------------------------------------------------------
option(WITH_LTM "Build with support for libtommath" TRUE)
option(WITH_TFM "Build with support for tomsfastmath" FALSE)
option(WITH_GMP "Build with support for GNU Multi Precision Arithmetic Library" FALSE)
set(MPI_PROVIDER
"LTM"
CACHE STRING "Build tests and demos against 'LTM', 'TFM' or 'GMP', default is LTM"
)
option(BUILD_SHARED_LIBS
"Build shared library and only the shared library if \"ON\", default is static" OFF
)
option(WITH_PTHREAD "Build with pthread support" FALSE)
# -----------------------------------------------------------------------------
# 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
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE "Release")
endif()
# We differentiate between MSVC, WATCOM and GCC-compatible compilers
if(MSVC)
set(LTC_C_FLAGS -W3)
elseif(WATCOM)
set(LTC_C_FLAGS -fo=.obj -oaxt -3r -w3)
else()
set(LTC_C_FLAGS
-Wall
-Wsign-compare
-Wextra
-Wshadow
-Wdeclaration-after-statement
-Wbad-function-cast
-Wcast-align
-Wstrict-prototypes
-Wpointer-arith
-Wsystem-headers
)
set(CMAKE_C_FLAGS_DEBUG "-g3")
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()
# What compiler do we have and what are their...uhm... peculiarities
if(CMAKE_C_COMPILER_ID MATCHES "(C|c?)lang")
list(APPEND LTC_C_FLAGS -Wno-typedef-redefinition -Wno-tautological-compare
-Wno-builtin-requires-header
)
# Clang requires at least '-O1' for dead code eliminiation
set(CMAKE_C_FLAGS_DEBUG "-O1 ${CMAKE_C_FLAGS_DEBUG}")
endif()
if(CMAKE_C_COMPILER MATCHES "mingw")
list(APPEND LTC_C_FLAGS -Wno-shadow -Wno-expansion-to-defined -Wno-declaration-after-statement
-Wno-bad-function-cast
)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
list(APPEND LTC_C_FLAGS -Wno-nullability-completeness)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "CYGWIN")
list(APPEND LTC_C_FLAGS -no-undefined)
endif()
# If the user set the environment variables at generate-time, append them in order to allow
# overriding our defaults.
# ~~~
# ${LTC_CFLAGS} means the user passed it via sth like:
# $ cmake -DLTC_CFLAGS="foo"
# ~~~
list(APPEND LTC_C_FLAGS ${LTC_CFLAGS})
list(APPEND LTC_LD_FLAGS ${LTC_LDFLAGS})
# -----------------------------------------------------------------------------
# Library targets
# -----------------------------------------------------------------------------
add_library(${PROJECT_NAME} ${SOURCES} ${PUBLIC_HEADERS} ${PRIVATE_HEADERS})
target_include_directories(
${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/headers>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}>
)
target_compile_options(${PROJECT_NAME} BEFORE PRIVATE ${LTC_C_FLAGS})
target_link_options(${PROJECT_NAME} BEFORE PRIVATE ${LTC_LD_FLAGS})
set_target_properties(
${PROJECT_NAME}
PROPERTIES OUTPUT_NAME tomcrypt
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
PUBLIC_HEADER "${PUBLIC_HEADERS}"
)
if(MSVC)
cmake_push_check_state()
set(CMAKE_REQUIRED_LIBRARIES bcrypt)
check_symbol_exists(BCryptGenRandom "Windows.h;bcrypt.h" BCRYPT_AVAILABLE)
cmake_pop_check_state()
if(BCRYPT_AVAILABLE)
target_link_libraries(${PROJECT_NAME} PRIVATE Bcrypt)
list(APPEND LTC_C_FLAGS -DLTC_WIN32_BCRYPT)
endif()
endif()
option(COMPILE_LTO "Build with LTO enabled")
if(COMPILE_LTO)
check_ipo_supported(RESULT COMPILER_SUPPORTS_LTO)
if(COMPILER_SUPPORTS_LTO)
set_property(TARGET ${PROJECT_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
else()
message(
SEND_ERROR
"This compiler does not support LTO. Reconfigure ${PROJECT_NAME} with -DCOMPILE_LTO=OFF."
)
endif()
endif()
# -----------------------------------------------------------------------------
# MPI provider
# -----------------------------------------------------------------------------
# libtommath
if(WITH_LTM)
find_package(libtommath 1.2.0 REQUIRED)
target_compile_definitions(${PROJECT_NAME} PUBLIC LTM_DESC)
if(MPI_PROVIDER MATCHES "LTM")
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_LTM)
endif()
target_link_libraries(${PROJECT_NAME} PUBLIC libtommath)
list(APPEND LTC_PKG_CONFIG_CFLAGS -DLTM_DESC)
list(APPEND LTC_PKG_CONFIG_LIBS -ltommath)
list(APPEND LTC_DEBIAN_MPI_PROVIDER_DEPENDS libtommath-dev)
endif()
# tomsfastmath
if(WITH_TFM)
find_package(tomsfastmath 0.13.1 REQUIRED)
target_compile_definitions(${PROJECT_NAME} PUBLIC TFM_DESC)
if(MPI_PROVIDER MATCHES "TFM")
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_TFM)
endif()
target_link_libraries(${PROJECT_NAME} PUBLIC tomsfastmath)
list(APPEND LTC_PKG_CONFIG_CFLAGS -DTFM_DESC)
list(APPEND LTC_PKG_CONFIG_LIBS -ltfm)
list(APPEND LTC_DEBIAN_MPI_PROVIDER_DEPENDS libtfm-dev)
endif()
# GNU MP
if(WITH_GMP)
pkg_check_modules(GMP REQUIRED gmp>=6.1.2)
target_compile_definitions(${PROJECT_NAME} PUBLIC GMP_DESC)
if(MPI_PROVIDER MATCHES "GMP")
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_GMP)
endif()
target_link_libraries(${PROJECT_NAME} PUBLIC ${GMP_LIBRARIES})
list(APPEND LTC_PKG_CONFIG_CFLAGS -DGMP_DESC)
list(APPEND LTC_PKG_CONFIG_LIBS -lgmp)
list(APPEND LTC_DEBIAN_MPI_PROVIDER_DEPENDS libgmp-dev)
endif()
# -----------------------------------------------------------------------------
# other options
# -----------------------------------------------------------------------------
if(WITH_PTHREAD)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
if(CMAKE_USE_PTHREADS_INIT)
target_compile_definitions(${PROJECT_NAME} PUBLIC LTC_PTHREAD)
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads)
list(APPEND LTC_PKG_CONFIG_CFLAGS -DLTC_PTHREAD)
else()
message(
SEND_ERROR
"pthreads not supported. Reconfigure ${PROJECT_NAME} with -DWITH_PTHREAD=OFF."
)
endif()
endif()
list(JOIN LTC_PKG_CONFIG_CFLAGS " " PKG_CONFIG_CFLAGS)
list(JOIN LTC_PKG_CONFIG_LIBS " " PKG_CONFIG_LIBS)
list(JOIN LTC_DEBIAN_MPI_PROVIDER_DEPENDS " " DEBIAN_MPI_PROVIDER_DEPENDS)
# -----------------------------------------------------------------------------
# demos&test targets
# -----------------------------------------------------------------------------
add_subdirectory(demos)
if(BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
endif()
# ---------------------------------------------------------------------------------------
# Install/export targets and files
# ---------------------------------------------------------------------------------------
set(CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(PROJECT_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake")
set(PROJECT_CONFIG_FILE "${PROJECT_NAME}-config.cmake")
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
# install targets
install(
TARGETS ${PROJECT_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Libraries
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
)
# Install libtomcrypt.pc for pkg-config if we build a shared library
if(BUILD_SHARED_LIBS)
# Let the user override the default directory of the pkg-config file (usually this shouldn't be
# required to be changed)
set(CMAKE_INSTALL_PKGCONFIGDIR
"${CMAKE_INSTALL_LIBDIR}/pkgconfig"
CACHE PATH "Folder where to install .pc files"
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
DESTINATION ${CMAKE_INSTALL_PKGCONFIGDIR}
)
endif()
# generate package version file
write_basic_package_version_file(
${PROJECT_VERSION_FILE}
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
# install version file
install(FILES ${PROJECT_VERSION_FILE} DESTINATION ${CONFIG_INSTALL_DIR})
# build directory package config
export(EXPORT ${TARGETS_EXPORT_NAME} FILE ${PROJECT_CONFIG_FILE})
# installed package config
install(
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION ${CONFIG_INSTALL_DIR}
FILE ${PROJECT_CONFIG_FILE}
)
# add to CMake registry
export(PACKAGE ${PROJECT_NAME})
# ---------------------------------------------------------------------------------------
# Create release packages
# ---------------------------------------------------------------------------------------
# determine distribution and architecture
find_program(LSB_RELEASE lsb_release)
find_program(SYSCTL sysctl)
find_program(UNAME uname)
if(UNAME)
execute_process(
COMMAND uname -m
OUTPUT_VARIABLE MACHINE_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
elseif(SYSCTL)
execute_process(
COMMAND sysctl -b hw.machine_arch
OUTPUT_VARIABLE MACHINE_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
string(TOLOWER ${CMAKE_SYSTEM_NAME} MACHINE_ARCH)
endif()
if(LSB_RELEASE)
execute_process(
COMMAND lsb_release -si
OUTPUT_VARIABLE LINUX_DISTRO
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND lsb_release -sc
OUTPUT_VARIABLE LINUX_DISTRO_CODENAME
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND lsb_release -sr
OUTPUT_VARIABLE LINUX_DISTRO_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(TOLOWER ${LINUX_DISTRO} LINUX_DISTRO)
if(LINUX_DISTRO_CODENAME STREQUAL "n/a")
set(DISTRO_PACK_PATH ${LINUX_DISTRO}/${LINUX_DISTRO_VERSION}/)
else()
set(DISTRO_PACK_PATH ${LINUX_DISTRO}/${LINUX_DISTRO_CODENAME}/)
endif()
else()
set(DISTRO_PACK_PATH ${CMAKE_SYSTEM_NAME}/)
endif()
# make sure untagged versions get a different package name
execute_process(
COMMAND git describe --exact-match --tags
ERROR_QUIET
RESULT_VARIABLE REPO_HAS_TAG
)
if(REPO_HAS_TAG EQUAL 0)
set(PACKAGE_NAME_SUFFIX "")
else()
set(PACKAGE_NAME_SUFFIX "-git")
message(STATUS "Use -git suffix")
endif()
# default CPack generators
set(CPACK_GENERATOR TGZ STGZ)
# extra CPack generators
if(LINUX_DISTRO STREQUAL "debian"
OR LINUX_DISTRO STREQUAL "ubuntu"
OR LINUX_DISTRO STREQUAL "linuxmint"
)
list(APPEND CPACK_GENERATOR DEB)
elseif(
LINUX_DISTRO STREQUAL "fedora"
OR LINUX_DISTRO STREQUAL "opensuse"
OR LINUX_DISTRO STREQUAL "centos"
)
list(APPEND CPACK_GENERATOR RPM)
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
list(APPEND CPACK_GENERATOR FREEBSD)
endif()
set(LTC_DEBIAN_SHARED_PACKAGE_NAME "${PROJECT_NAME}${PACKAGE_NAME_SUFFIX}${PROJECT_VERSION_MAJOR}")
# general CPack config
set(CPACK_PACKAGE_DIRECTORY ${CMAKE_BINARY_DIR}/packages/${DISTRO_PACK_PATH})
message(STATUS "CPack: packages will be generated under ${CPACK_PACKAGE_DIRECTORY}")
if(BUILD_SHARED_LIBS)
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}${PROJECT_VERSION_MAJOR}")
set(CPACK_DEBIAN_PACKAGE_NAME "${LTC_DEBIAN_SHARED_PACKAGE_NAME}")
else()
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}-devel")
set(CPACK_DEBIAN_LIBRARIES_PACKAGE_NAME "${PROJECT_NAME}${PACKAGE_NAME_SUFFIX}-dev")
endif()
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LibTomCrypt")
set(CPACK_PACKAGE_VENDOR "libtom projects")
set(CPACK_PACKAGE_CONTACT "libtom@googlegroups.com")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set(PACKAGE_NAME_TRAILER ${CPACK_PACKAGE_VERSION}-${PACKAGE_RELEASE_VERSION}_${MACHINE_ARCH})
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${PACKAGE_NAME_TRAILER})
set(CPACK_STRIP_FILES ON)
# deb specific CPack config
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set(CPACK_DEBIAN_DEBUGINFO_PACKAGE ON)
set(CPACK_DEBIAN_PACKAGE_RELEASE ${PACKAGE_RELEASE_VERSION})
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
if(BUILD_SHARED_LIBS)
set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
set(CPACK_DEBIAN_PACKAGE_DEPENDS ${DEBIAN_MPI_PROVIDER_DEPENDS})
else()
set(CPACK_DEBIAN_PACKAGE_SECTION "libdevel")
set(CPACK_DEBIAN_PACKAGE_DEPENDS ${LTC_DEBIAN_SHARED_PACKAGE_NAME})
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_COMPONENTS_ALL Libraries)
endif()
# rpm specific CPack config
set(CPACK_RPM_PACKAGE_RELEASE ${PACKAGE_RELEASE_VERSION})
set(CPACK_RPM_PACKAGE_ARCHITECTURE ${MACHINE_ARCH})
set(CPACK_RPM_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-${PROJECT_VERSION}")
set(CPACK_RPM_PACKAGE_LICENSE "The Unlicense")
# FreeBSD specific CPack config
set(CPACK_FREEBSD_PACKAGE_MAINTAINER "gahr@FreeBSD.org")
set(CPACK_FREEBSD_PACKAGE_ORIGIN "security/libtomcrypt")
set(CPACK_FREEBSD_PACKAGE_CATEGORIES "security")
include(CPack)

1155
Doxyfile

File diff suppressed because it is too large Load diff

25
LICENSE
View file

@ -1,5 +1,26 @@
LibTomCrypt is public domain. As should all quality software be.
The LibTom license
Tom St Denis
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>

204
README.md Normal file
View file

@ -0,0 +1,204 @@
# libtomcrypt
Previously the git repository contained `doc/crypt.pdf` for detailed documentation.
This was changed and the file is now only available from the tarball of the appropriate version
or from the page https://github.com/libtom/libtomcrypt/releases .
## Project Status
### Travis CI
master: [![Build Status](https://github.com/libtom/libtomcrypt/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/libtom/libtomcrypt/actions/workflows/main.yml?query=branch%3Amaster+++) [![Coverage Status](https://coveralls.io/repos/libtom/libtomcrypt/badge.png?branch=master)](https://coveralls.io/r/libtom/libtomcrypt)
develop: [![Build Status](https://github.com/libtom/libtomcrypt/actions/workflows/main.yml/badge.svg?branch=develop)](https://github.com/libtom/libtomcrypt/actions/workflows/main.yml?query=branch%3Adevelop+++) [![Coverage Status](https://coveralls.io/repos/libtom/libtomcrypt/badge.png?branch=develop)](https://coveralls.io/r/libtom/libtomcrypt)
### AppVeyor
master: [![Build status](https://ci.appveyor.com/api/projects/status/xyl2nbdsyp1tj9ye/branch/master?svg=true)](https://ci.appveyor.com/project/libtom/libtomcrypt/branch/master)
develop: [![Build status](https://ci.appveyor.com/api/projects/status/xyl2nbdsyp1tj9ye/branch/develop?svg=true)](https://ci.appveyor.com/project/libtom/libtomcrypt/branch/develop)
### Coverity
[![Coverity Scan Build Status](https://scan.coverity.com/projects/487/badge.svg)](https://scan.coverity.com/projects/487)
### ABI Laboratory
API/ABI changes: [check here](https://abi-laboratory.pro/tracker/timeline/libtomcrypt/)
## Submitting patches
Please branch off from develop if you want to submit a patch.
Patch integration will be faster if tests and documentation are included.
Please update the makefiles in a separate commit. To update them simply run the `updatemakes.sh` script.
If you have something bigger to submit, feel free to contact us beforehand.
Then we can give you write access to this repo, so you can open your PR based on this repo
and we can easier follow the rebase-before-merge approach we're using (or even do the rebase ourself).
### Reviews
We're using Pull Request reviews to make sure that the code is in line with the existing code base.
Please have a look [here](https://help.github.com/articles/approving-a-pull-request-with-required-reviews/) to get an idea of the approach.
## Branches
Please be aware, that all branches besides _master_ and _develop_ __can__ and __will be__ force-pushed, rebased and/or removed!
If you want to rely on such an _unstable_ branch, create your own fork of this repository to make sure nothing breaks for you.
## Configuration options
By default the library builds its entire feature set (besides `katja`) in a (depending on your needs more or less) optimal way.
There are numerous configuration options available if you want to trim down the functionality of the library.
Please have a look at `src/headers/tomcrypt_custom.h` for all available configuration options.
The following list is a small part of the available, but the most often required, configuration switches.
| Flag | Behavior |
| ---- | -------- |
| `LTC_NO_TEST` | Remove all algorithm self-tests from the library |
| `LTC_NO_FILE` | Remove all API functions requiring a pre-defined `FILE` data-type (mostly useful for embedded targets) |
| `GMP_DESC` | enable [gmp](https://gmplib.org/) as MPI provider *\*1* |
| `LTM_DESC` | enable [libtommath](http://www.libtom.net/) as MPI provider *\*1* |
| `TFM_DESC` | enable [tomsfastmath](http://www.libtom.net/) as MPI provider *\*1* *\*2* |
| `USE_GMP` | use `gmp` as MPI provider when building the binaries *\*3* |
| `USE_LTM` | use `libtommath` as MPI provider when building the binaries *\*3* |
| `USE_TFM` | use `tomsfastmath` as MPI provider when building the binaries *\*3* |
*\*1* It is possible to build the library against all MPI providers in parallel and choose at startup-time which math library should be used.
*\*2* Please be aware that `tomsfastmath` has the limitation of a fixed max size of MPI's.
*\*3* Only one is supported at the time & this is only required when building the binaries, not when building the library itself.
## Building the library
There are several `makefile`s provided. Please choose the one that fits best for you.
| makefile | use-case |
| -------- | -------- |
| `makefile` | builds a static library (GNU Make required) |
| `makefile.shared` | builds a shared (and static) library (GNU Make required) |
| `makefile.unix` | for unusual UNIX platforms, or if you do not have GNU Make |
| `makefile.mingw` | for usage with the mingw compiler on MS Windows |
| `makefile.msvc` | for usage with the MSVC compiler on MS Windows |
| `libtomcrypt_VS2008.sln` | A VisualStudio 2008 project for MS Windows |
### Make targets
The `makefile`s provide several targets to build (VS project excluded).
The following list does not claim to be complete resp. to be available across all `makefile` variants.
| target | application |
| ------ | ----------- |
| *empty target*/none given | c.f. `library`
| `library` | builds only the library |
| `hashsum` | builds the `hashsum` binary, similar to [`shasum`](https://linux.die.net/man/1/shasum), but with support for all hash-algorithms included in the library *\*4* |
| `crypt` | builds the `crypt` binary, implementing something similar to [`crypt`](https://linux.die.net/man/3/crypt) *\*4* |
| `sizes` | builds the `sizes` binary, printing all internal data sizes on invocation *\*4* |
| `constants` | builds the `constants` binary, printing all internal constants on invocation *\*4* |
| `openssl-enc` | builds the `openssl-enc` binary, which is more or less compatible to [`openssl enc`](https://linux.die.net/man/1/enc) *\*4* *\*5* |
| `test` | builds the `test` binary, which runs all algorithm self-tests + some extended tests *\*4* |
| `timing` | builds the `timing` binary, which can be used to measure timings for algorithms and modes *\*4* |
| `bins` | builds `hashsum` *\*4* |
| `all_test` | builds `test`, `hashsum`, `crypt`, `small`, `tv_gen`, `sizes` & `constants` *\*4* |
| `docs` | builds the developer documentation `doc/crypt.pdf` |
| `install` | installs the `library` and header files *\*7* *\*8* |
| `install_bins` | installs the binaries created by the `bins` target *\*7* *\*8* |
| `install_docs` | installs the documentation created by the `docs` target *\*7* *\*8* |
| `install_test` | installs the test-app created by the `test` target *\*7* *\*8* |
| `install_all` | installs everything (i.e. `library`, `bins`, `docs` and `test`) *\*8* |
| `uninstall` | uninstalls the `library` and header files |
*\*4* also builds `library`
*\*5* broken build in some configurations, therefore not built by default
*\*7* also builds the necessary artifact(s) before installing it
*\*8* also have a look at the 'Installation' section of this file
### Examples
You want to build the library as static library
make
You want to build the library as shared library
make -f makefile.shared
You have `libtommath` installed on your system and want to build a static library and the `test` binary to run the self-tests.
make CFLAGS="-DUSE_LTM -DLTM_DESC" EXTRALIBS="-ltommath" test
You have `tomsfastmath` installed on your system and want to build a shared library and all binaries
make -f makefile.shared CFLAGS="-DUSE_TFM -DTFM_DESC" EXTRALIBS="-ltfm" all demos
You have `gmp`, `libtommath` and `tomsfastmath` installed on your system and want to build a static library and the `timing` binary to measure timings against `gmp`.
make CFLAGS="-DUSE_GMP -DGMP_DESC -DLTM_DESC -DTFM_DESC" EXTRALIBS="-lgmp" timing
If you have `libtommath` in a non-standard location:
make CFLAGS="-DUSE_LTM -DLTM_DESC -I/opt/devel/ltm" EXTRALIBS="/opt/devel/ltm/libtommath.a" all
You want to enable AES-NI support:
make CFLAGS=-DLTC_AES_NI
## Installation
There exist several _install_ make-targets which are described in the table above.
These targets support the standard ways (c.f. [[GNU]], [[FreeBSD]])
to modify the installation path via the following set of variables:
DESTDIR
PREFIX
LIBPATH
INCPATH
DATAPATH
BINPATH
The entire set of the variables is only supported in `makefile`, `makefile.shared` and `makefile.unix`.
In case you have to use one of the other makefiles, check in the file which variables are supported.
### Examples
You want to install the static library to the default paths
make install
You want to install the shared library to a special path and use it from this path
make -f makefile.shared PREFIX=/opt/special/path
Have a look at the developer documentation, [[GNU]] or [[FreeBSD]] to get a detailed explanation of all the variables.
## CMake support
The project provides support for the CMake build system.
```
git clone https://github.com/libtom/libtomcrypt.git
mkdir -p libtomcrypt/build
cd libtomcrypt/build
cmake ..
make -j$(nproc)
```
More details around building with CMake can be found in the developer documentation.
[GNU]: https://www.gnu.org/prep/standards/html_node/DESTDIR.html
[FreeBSD]: https://www.freebsd.org/doc/en/books/porters-handbook/porting-prefix.html

2
TODO
View file

@ -1,2 +0,0 @@
- long term, start moving macros like CTR over to LTC_CTR to make LTC a bit more "drop-in-able".

56
appveyor.yml Normal file
View file

@ -0,0 +1,56 @@
version: 1.18.2-develop+{build}
branches:
only:
- master
- develop
- /^release/
- /^appveyor/
- /^build-ci/
image:
- Visual Studio 2022
- Visual Studio 2019
- Visual Studio 2017
- Visual Studio 2015
environment:
matrix:
- LTC_CC: cl
- LTC_CC: clang-cl
matrix:
exclude:
- image: Visual Studio 2019
LTC_CC: clang-cl
- image: Visual Studio 2017
LTC_CC: clang-cl
- image: Visual Studio 2015
LTC_CC: clang-cl
build_script:
- cmd: >-
if "Visual Studio 2022"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
if "Visual Studio 2019"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
if "Visual Studio 2017"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
if "Visual Studio 2015"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
if "Visual Studio 2015"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
if "clang-cl"=="%LTC_CC%" set "PATH=C:\Program Files\LLVM\bin;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin;%PATH%"
if "clang-cl"=="%LTC_CC%" clang-cl --version
cd..
git clone https://github.com/libtom/libtommath.git --branch=master
cp libtomcrypt\.ci\cmake.bat libtommath\cmake.bat
cd libtommath
cmake.bat
nmake -f makefile.msvc
cd..
cd libtomcrypt
.ci\cmake.bat
nmake -f makefile.msvc all CC=%LTC_CC%
cp test.exe test-stock.exe
cp timing.exe timing-stock.exe
nmake -f makefile.msvc clean
nmake -f makefile.msvc all CC=%LTC_CC% CFLAGS="/Ox /DUSE_LTM /DLTM_DESC /DLTC_NO_ACCEL /I../libtommath"
test_script:
- cmd: >-
test-stock.exe
test.exe
timing-stock.exe cipher_ecb aes
timing.exe cipher_ecb aes
timing-stock.exe hash sha
timing.exe hash sha

19
bin.in Normal file
View file

@ -0,0 +1,19 @@
#!/bin/sh
# Shell wrapper script for the executables when built with the shared
# libtomcrypt library.
set -euf
rootdir="$(cd -- "${0%/*}/" && pwd -P)"
binpath="$rootdir/.bin/${0##*/}"
[ -z "${LD_LIBRARY_PATH:=$rootdir}" ] ||
LD_LIBRARY_PATH="$rootdir:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH
if [ -n "${1+x}" ]; then
exec "$binpath" "${@:-}"
else
exec "$binpath"
fi

View file

@ -1,20 +0,0 @@
#!/bin/bash
echo "$1 ($2, $3)..."
make clean 1>/dev/null 2>/dev/null
echo -n "building..."
CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" make -j4 -f $3 test tv_gen 1>gcc_1.txt 2>gcc_2.txt || (echo "build $1 failed see gcc_2.txt for more information" && cat gcc_2.txt && exit 1)
echo -n "testing..."
if [ -a test ] && [ -f test ] && [ -x test ]; then
((./test >test_std.txt 2>test_err.txt && ./tv_gen > tv.txt) && echo "$1 test passed." && echo "y" > testok.txt) || (echo "$1 test failed" && cat test_err.txt && exit 1)
if find *_tv.txt -type f 1>/dev/null 2>/dev/null ; then
for f in *_tv.txt; do if (diff --ignore-case $f notes/$f) then true; else (echo "tv_gen $f failed" && rm -f testok.txt && exit 1); fi; done
fi
fi
if [ -a testok.txt ] && [ -f testok.txt ]; then
exit 0
fi
exit 1
# $Source: /cvs/libtom/libtomcrypt/build.sh,v $
# $Revision: 1.9 $
# $Date: 2006/03/18 14:10:55 $

185
changes
View file

@ -1,4 +1,183 @@
June 17th, 2005
July 1st, 2018
v1.18.2
-- Fix Side Channel Based ECDSA Key Extraction (CVE-2018-12437) (PR #408)
-- Fix potential stack overflow when DER flexi-decoding (CVE-2018-0739) (PR #373)
-- Fix two-key 3DES (PR #390)
-- Fix accelerated CTR mode (PR #359)
-- Fix Fortuna PRNG (PR #363)
-- Fix compilation on platforms where cc doesn't point to gcc (PR #382)
-- Fix using the wrong environment variable LT instead of LIBTOOL (PR #392)
-- Fix build on platforms where the compiler provides __WCHAR_MAX__ but wchar.h is not available (PR #390)
-- Fix & re-factor crypt_list_all_sizes() and crypt_list_all_constants() (PR #414)
-- Minor fixes (PR's #350 #351 #375 #377 #378 #379)
January 22nd, 2018
v1.18.1
-- Fix wrong SHA3 blocksizes, thanks to Claus Fischer for reporting this via Mail (PR #329)
-- Fix NULL-pointer dereference in `ccm_memory()` with LTC_CLEAN_STACK enabled (PR #327)
-- Fix `ccm_process()` being unable to process input buffers longer than 256 bytes (PR #326)
-- Fix the `register_all_{ciphers,hashes,prngs}()` return values (PR #316)
-- Fix some typos, warnings and duplicate prototypes in code & doc (PR's #310 #320 #321 #335)
-- Fix possible undefined behavior with LTC_PTHREAD (PR #337)
-- Fix some DER bugs (PR #339)
-- Fix CTR-mode when accelerator is used (OP-TEE/optee_os #2086)
-- Fix installation procedure (Issue #340)
October 10th, 2017
v1.18.0
-- Bugfix multi2
-- Bugfix Noekeon
-- Bugfix XTEA
-- Bugfix rng_get_bytes() on windows where we could read from c:\dev\random
-- Fixed the Bleichbacher Signature attack in PKCS#1 v1.5 EMSA, thanks to Alex Dent
-- Fixed a potential cache-based timing attack in CCM, thanks to Sebastian Verschoor
-- Fix GCM counter reuse and potential timing attacks in EAX, OCB and OCBv3,
thanks to Raphaël Jamet
-- Implement hardened RSA operations when CRT is used
-- Enabled timing resistant calculations of ECC and RSA operations per default
-- Applied some patches from the OLPC project regarding PKCS#1 and preventing
the hash algorithms from overflowing
-- Larry Bugbee contributed the necessary stuff to more easily call libtomcrypt
from a dynamic language like Python, as shown in his pyTomCrypt
-- Nikos Mavrogiannopoulos contributed RSA blinding and export of RSA and DSA keys
in OpenSSL/GnuTLS compatible format
-- Patrick Pelletier contributed a smart volley of patches
-- Christopher Brown contributed some patches and additions to ASN.1/DER
-- Pascal Brand of STMicroelectronics contributed patches regarding CCM, the
XTS mode and RSA private key operations with keys without CRT parameters
-- RC2 now also works with smaller key-sizes
-- Improved/extended several tests & demos
-- Hardened DSA and RSA by testing (through Karel's perl-CryptX)
against Google's "Wycheproof" and Kudelski Security's "CDF"
-- Fixed all compiler warnings
-- Fixed several build issues on FreeBSD, NetBSD, Linux x32 ABI, HP-UX/IA64,
Mac OS X, Windows (32&64bit, Cygwin, MingW & MSVC) ...
-- Re-worked all makefiles
-- Re-worked most PRNG's
-- The code is now verified by a linter, thanks to Francois Perrad
-- Documentation (crypt.pdf) is now built deterministically, thanks to Michael Stapelberg
-- Add Adler32 and CRC32 checksum algorithms
-- Add Base64-URL de-/encoding and some strict variants
-- Add Blake2b & Blake2s (hash & mac), thanks to Kelvin Sherlock
-- Add Camellia block cipher
-- Add ChaCha (stream cipher), Poly1305 (mac), ChaCha20Poly1305 (encauth)
-- Add constant-time mem-compare mem_neq()
-- Add DER GeneralizedTime de-/encoding
-- Add DSA and ECC key generation FIPS-186-4 compliance
-- Add HKDF, thanks to RyanC (especially for also providing documentation :-) )
-- Add OCBv3
-- Add PKCS#1 v1.5 mode of SSL3.0
-- Add PKCS#1 testvectors from RSA
-- Add PKCS#8 & X.509 import for RSA keys
-- Add stream cipher API
-- Add SHA3 & SHAKE
-- Add SHA512/256 and SHA512/224
-- Add Triple-DES 2-key mode, thanks to Paul Howarth
-- Brought back Diffie-Hellman
May 12th, 2007
v1.17 -- Cryptography Research Inc. contributed another small volley of patches, one to fix __WCHAR_DEFINED__ for BSD platforms,
another to silence MSVC warnings.
-- Added LTC_XCBC_PURE to XCBC mode which lets you use it in three-key mode.
-- [CRI] Added libtomcrypt.dsp for Visual C++ users.
-- [CRI] Added more functions for manipulating the ECC fixed point cache (including saving and loading)
-- [CRI] Modified ecc_make_key() to always produce keys smaller than base point order, for standards-compliance
-- Elliptic Semiconductor contributed XTS chaining mode to the cipher suite (subsequently optimized it)
-- Fixed xcbc_init() keylen when using single key mode.
-- Bruce Fortune pointed out a typo in the hmac_process() description in the manual. Fixed.
-- Added variable width counter support to CTR mode
-- Fixed CMAC (aka OMAC) when using 64-bit block ciphers and LTC_FAST ... my bad.
-- Fixed bug in ecc_is_valid() that would basically always return true
-- renamed a lot of macros to add the LTC_ prefix [e.g. RIJNDAEL => LTC_RIJNDAEL]
December 16th, 2006
v1.16 -- Brian Gladman pointed out that a recent change to GCM broke how the IV was handled. Currently the code complies against his test vectors
so the code should be considered frozen now.
-- Trevor from Cryptography Research Inc. submitted patches to convert the ECC code to be generic allowing curve parameters to be submitted
at runtime.
-- Fixed various doxygen comments
-- Added UTF8 support to the ASN1 code
-- Fixed STOREXXH macros for x86 platforms (Fix found at Elliptic Inc.)
-- Added makefile.unix which is BSD compatible, you have to manually tweak it since well I don't use it normally
-- removed a few lingering memcpy's
-- Fixed memory free errors in ecc_sign_hash() that can arise if the mp_init_multi() fails
-- Fixed incorrect return value in pkcs_1_pss_decode() which would correctly set res to 0 (indicating an incorrect signature) but
would return CRYPT_OK to the caller
-- ltc_ecc_mulmod() could leak memory if mp_init(&mu) failed, fixed. Would you believe that ltc_ecc_mulmod_timing() had the same
bug? Also fixed. :-)
-- Added Shamir's trick to the ECC side (defined as LTC_ECC_SHAMIR, enabled by default), gets ~1.34x to ~1.40x faster ECC verifications
-- Added Brian's vector #46 to the GCM code. It catches the ctr counter error from v1.15. Originally I was going to add all of his vectors,
but they're not as easy to parse and I got a lot of other things to do. Regression!
-- Various other small fixes to the ECC code to clean up error handling (I think most of that was from the move in 1.06 to the plugins)
All of the errors were in cleaning up from heap failures. So they were not likely to be triggered in normal usage
Made similar fixes to the RSA and DSA code (my bad)
-- Cryptography Research Inc. contributed a bunch of fixes to silence warnings (with MSVC) w.r.t. assigned data to unsigned char types.
-- Martin Marko suggested some fixes to make the RNG build with WinCE.
-- Updates to the manual for print (some fixes thanks to Martin Marko)
November 17th, 2006
v1.15 -- Andreas Lange found that if sha256_init DID fail in fortuna it wouldn't clean up the state correctly. Thanks.
Fortunately sha256_init cannot fail (as of v1.14) :-)
-- Andreas Lange contributed RMD-256 and RMD-320 code.
-- Removed mutex locks from fortuna_import as they create a deadlock and aren't required anyways [Avi Zelmanovich]
-- Added LTC_NO_PROTOTYPES to avoid prototyping functions like memset/memcpy. Required for fans of GCC 3.3.x
-- David Eder caught a off by one overrun bug in pmac_done() which can be exploited if your output tag buffer is
smaller than the block size of the cipher, e.g. if you have a 4-byte buffer and you tell pmac_done that you want
a 4-byte TAG it will store 4 bytes but return an outlen of 5.
-- Added signatures to the ECC and RSA benchmarks
-- Added LTC_PROFILE to run the PK tests only once in the timing demo (so you can capture events properly)
-- Andreas contributed PKCS #1 v1.5 code that merged cleanly with the existing PKCS code. w00t.
(update: I had to fix it to include the digestInfo and what not. Bad Andreas, bad! hehehe)
-- Fixed a signed variable error in gcm_process() (hard to trigger bug fortunately)
-- Removed all memcmp/memset/memcpy from the source (replaced with X macros)
-- Renamed macros HMAC/OMAC/PMAC to have a LTC_ prefix. If you pass these on the command line please update your makefiles
-- Added XCBC-MAC support [RFC 3566]
-- fixed LOAD32H and LOAD64H to stop putting out that darn warning :-)
-- Added the Korean SEED block cipher [RFC 4269]
-- Added LTC_VALGRIND define which makes SOBER-128 and RC4 a pure PRNG (and not a stream cipher). Useful if you use
Valgrind to debug your code (reported by Andreas Lange)
-- Made SOBER-128 more portable by removing the ASCII key in the test function (my bad, sorry).
-- Martin Mocko pointed out that if you have no PRNGs defined the lib won't build. Fixed, also fixed for if you have no
hashes defined.
-- Sped up F8 mode with LTC_FAST
-- Made CTR mode RFC 3686 compliant (increment counter first), to enable, OR the value LTC_CTR_RFC3686 to the "mode"
parameter you pass to ctr_start(), otherwise it will be LTC compliant (e.g. encrypt then increment)
-- Added ctr_test() to test CTR mode against RFC 3686
-- Added crypt_fsa() ... O_o
-- Fixed LTC_ECC_TIMING_RESISTANT so it once again builds properly (pt add/dbl are through the plugin now)
-- Added ANSI X9.63 (sec 4.3.6) import/export of public keys (cannot export to compressed formats but will import
hybrid compressed)
-- Added SECP curves for 112, 128, and 160 bits (only the 'r1' curves)
-- Added 3GPP-F9 MAC (thanks to Greg Rose for the test vectors)
-- Added the KASUMI block cipher
-- Added F9/XCBC/OMAC callbacks to the cipher plugin
-- Added RSA PKCS #1 v1.5 signature/encrypt tests to rsa_test.c
-- Fix to yarrow_test() to not call yarrow_done() which is invalid in that context (thanks Valgrind)
-- Christophe Devine pointed out that Anubis would fail on various 64-bit UNIX boxes when "x>>24" was used as an index, we needed
to mask it with 0xFF. Thanks. Fixed.
August 0x1E, 0x07D6
v1.14 -- Renamed the chaining mode macros from XXX to LTC_XXX_MODE. Should help avoid polluting the macro name space.
-- clean up of SHA-256
-- Chris Colman pointed out that der_decode_sequence_* allows LTC_ASN1_SETOF to accept SEQUENCEs and vice versa.
Decoder [non-flexi decoder that is] is more strict now and requires a match.
-- Steffen Jaeckel pointed out a typo in the user manual (re: rsa_exptmod). Fixed. This disproves the notion that
nobody reads it. :-)
-- Made GCM a bit more portable w.r.t. handling the CTR IV (e.g. & with 255)
-- Add LTC_VERBOSE if you really want to see what test is doing :-)
-- Added SSE2 support to GCM [use GCM_TABLES_SSE2 to enable], shaves 2 cycles per byte on Opteron processors
Shaved 4 cycles on a Prescott (Intel P4)
Requires you align your gcm_state on a 16 byte boundary, see gcm_memory() for more info
-- Added missing prototype for f8_test_mode()
-- two fixes to CCM for corner cases [L+noncelen > 15] and fixing the CTR pad to encrypt the CBC-MAC tag
-- Franz Glasner pointed out the ARGTYPE=4 is not actually valid. Fixed.
-- Fixed bug in f8_start() if your key < saltkey unspecified behaviour occurs. :-(
-- Documented F8 mode. Yeah, because you read the manual.
-- Minor updates to the technotes.
June 17th, 2006
v1.13 -- Fixed to fortuna_start() to clean up state if an error occurs. Not really useful at this stage (sha256 can't fail) but useful
if I ever make fortuna pluggable
-- Mike Marin submitted a whole bunch of patches for fixing up the libs on traditional UNIX platforms. Go AIX! Thanks!
@ -1464,6 +1643,6 @@ v0.02 -- Changed RC5 to only allow 12 to 24 rounds
v0.01 -- We will call this the first version.
/* $Source: /cvs/libtom/libtomcrypt/changes,v $ */
/* $Revision: 1.213 $ */
/* $Date: 2006/06/18 01:42:59 $ */
/* $Revision: 1.288 $ */
/* $Date: 2007/05/12 14:37:41 $ */

241
cmake-format.py Normal file
View file

@ -0,0 +1,241 @@
# ----------------------------------
# Options affecting listfile parsing
# ----------------------------------
with section("parse"):
# Specify structure for custom cmake functions
additional_commands = { 'foo': { 'flags': ['BAR', 'BAZ'],
'kwargs': {'DEPENDS': '*', 'HEADERS': '*', 'SOURCES': '*'}}}
# Override configurations per-command where available
override_spec = {}
# Specify variable tags.
vartags = []
# Specify property tags.
proptags = []
# -----------------------------
# Options affecting formatting.
# -----------------------------
with section("format"):
# Disable formatting entirely, making cmake-format a no-op
disable = False
# How wide to allow formatted cmake files
line_width = 100
# How many spaces to tab for indent
tab_size = 4
# If true, lines are indented using tab characters (utf-8 0x09) instead of
# <tab_size> space characters (utf-8 0x20). In cases where the layout would
# require a fractional tab character, the behavior of the fractional
# indentation is governed by <fractional_tab_policy>
use_tabchars = False
# If <use_tabchars> is True, then the value of this variable indicates how
# fractional indentions are handled during whitespace replacement. If set to
# 'use-space', fractional indentation is left as spaces (utf-8 0x20). If set
# to `round-up` fractional indentation is replaced with a single tab character
# (utf-8 0x09) effectively shifting the column to the next tabstop
fractional_tab_policy = 'use-space'
# If an argument group contains more than this many sub-groups (parg or kwarg
# groups) then force it to a vertical layout.
max_subgroups_hwrap = 2
# If a positional argument group contains more than this many arguments, then
# force it to a vertical layout.
max_pargs_hwrap = 6
# If a cmdline positional group consumes more than this many lines without
# nesting, then invalidate the layout (and nest)
max_rows_cmdline = 2
# If true, separate flow control names from their parentheses with a space
separate_ctrl_name_with_space = False
# If true, separate function names from parentheses with a space
separate_fn_name_with_space = False
# If a statement is wrapped to more than one line, than dangle the closing
# parenthesis on its own line.
dangle_parens = True
# If the trailing parenthesis must be 'dangled' on its on line, then align it
# to this reference: `prefix`: the start of the statement, `prefix-indent`:
# the start of the statement, plus one indentation level, `child`: align to
# the column of the arguments
dangle_align = 'prefix'
# If the statement spelling length (including space and parenthesis) is
# smaller than this amount, then force reject nested layouts.
min_prefix_chars = 4
# If the statement spelling length (including space and parenthesis) is larger
# than the tab width by more than this amount, then force reject un-nested
# layouts.
max_prefix_chars = 10
# If a candidate layout is wrapped horizontally but it exceeds this many
# lines, then reject the layout.
max_lines_hwrap = 2
# What style line endings to use in the output.
line_ending = 'unix'
# Format command names consistently as 'lower' or 'upper' case
command_case = 'lower'
# Format keywords consistently as 'lower' or 'upper' case
keyword_case = 'upper'
# A list of command names which should always be wrapped
always_wrap = []
# If true, the argument lists which are known to be sortable will be sorted
# lexicographicall
enable_sort = True
# If true, the parsers may infer whether or not an argument list is sortable
# (without annotation).
autosort = False
# By default, if cmake-format cannot successfully fit everything into the
# desired linewidth it will apply the last, most agressive attempt that it
# made. If this flag is True, however, cmake-format will print error, exit
# with non-zero status code, and write-out nothing
require_valid_layout = False
# A dictionary mapping layout nodes to a list of wrap decisions. See the
# documentation for more information.
layout_passes = {}
# ------------------------------------------------
# Options affecting comment reflow and formatting.
# ------------------------------------------------
with section("markup"):
# What character to use for bulleted lists
bullet_char = '*'
# What character to use as punctuation after numerals in an enumerated list
enum_char = '.'
# If comment markup is enabled, don't reflow the first comment block in each
# listfile. Use this to preserve formatting of your copyright/license
# statements.
first_comment_is_literal = False
# If comment markup is enabled, don't reflow any comment block which matches
# this (regex) pattern. Default is `None` (disabled).
literal_comment_pattern = None
# Regular expression to match preformat fences in comments default=
# ``r'^\s*([`~]{3}[`~]*)(.*)$'``
fence_pattern = '^\\s*([`~]{3}[`~]*)(.*)$'
# Regular expression to match rulers in comments default=
# ``r'^\s*[^\w\s]{3}.*[^\w\s]{3}$'``
ruler_pattern = '^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$'
# If a comment line matches starts with this pattern then it is explicitly a
# trailing comment for the preceeding argument. Default is '#<'
explicit_trailing_pattern = '#<'
# If a comment line starts with at least this many consecutive hash
# characters, then don't lstrip() them off. This allows for lazy hash rulers
# where the first hash char is not separated by space
hashruler_min_length = 10
# If true, then insert a space between the first hash char and remaining hash
# chars in a hash ruler, and normalize its length to fill the column
canonicalize_hashrulers = True
# enable comment markup parsing and reflow
enable_markup = True
# ----------------------------
# Options affecting the linter
# ----------------------------
with section("lint"):
# a list of lint codes to disable
disabled_codes = []
# regular expression pattern describing valid function names
function_pattern = '[0-9a-z_]+'
# regular expression pattern describing valid macro names
macro_pattern = '[0-9A-Z_]+'
# regular expression pattern describing valid names for variables with global
# (cache) scope
global_var_pattern = '[A-Z][0-9A-Z_]+'
# regular expression pattern describing valid names for variables with global
# scope (but internal semantic)
internal_var_pattern = '_[A-Z][0-9A-Z_]+'
# regular expression pattern describing valid names for variables with local
# scope
local_var_pattern = '[a-z][a-z0-9_]+'
# regular expression pattern describing valid names for privatedirectory
# variables
private_var_pattern = '_[0-9a-z_]+'
# regular expression pattern describing valid names for public directory
# variables
public_var_pattern = '[A-Z][0-9A-Z_]+'
# regular expression pattern describing valid names for function/macro
# arguments and loop variables.
argument_var_pattern = '[a-z][a-z0-9_]+'
# regular expression pattern describing valid names for keywords used in
# functions or macros
keyword_pattern = '[A-Z][0-9A-Z_]+'
# In the heuristic for C0201, how many conditionals to match within a loop in
# before considering the loop a parser.
max_conditionals_custom_parser = 2
# Require at least this many newlines between statements
min_statement_spacing = 1
# Require no more than this many newlines between statements
max_statement_spacing = 2
max_returns = 6
max_branches = 12
max_arguments = 5
max_localvars = 15
max_statements = 50
# -------------------------------
# Options affecting file encoding
# -------------------------------
with section("encode"):
# If true, emit the unicode byte-order mark (BOM) at the start of the file
emit_byteorder_mark = False
# Specify the encoding of the input file. Defaults to utf-8
input_encoding = 'utf-8'
# Specify the encoding of the output file. Defaults to utf-8. Note that cmake
# only claims to support utf-8 so be careful when using anything else
output_encoding = 'utf-8'
# -------------------------------------
# Miscellaneous configurations options.
# -------------------------------------
with section("misc"):
# A dictionary containing any per-command configuration overrides. Currently
# only `command_case` is supported.
per_command = {}

14
contrib/libtomcrypt.cmake Normal file
View file

@ -0,0 +1,14 @@
# To find libtomcrypt no matter what the installation look like, start with
# looking for the CMake specific configuration, and failing that, try the
# pkg-config package instead. The resulting target is different in each
# case, but is recorded in the variable ${LIBTOMCRYPT}, so please use that
# for all targets that depend on libtomcrypt.
find_package(libtomcrypt QUIET)
if (libtomcrypt_FOUND)
set(LIBTOMCRYPT libtomcrypt)
else()
find_package(PkgConfig)
pkg_check_modules(libtomcrypt REQUIRED IMPORTED_TARGET libtomcrypt)
set(LIBTOMCRYPT PkgConfig::libtomcrypt)
endif()

40
contrib/sbom.cdx.json Normal file
View file

@ -0,0 +1,40 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.6",
"version": 1,
"metadata": {
"authors": [
{
"name": "@VCS_SBOM_AUTHORS@"
}
]
},
"components": [
{
"type": "library",
"bom-ref": "pkg:github/libtom/libtomcrypt@@VCS_TAG@",
"cpe": "cpe:2.3:a:libtom:libtomcrypt:@VCS_TAG@:*:*:*:*:*:*:*",
"name": "libtomcrypt",
"version": "@VCS_VERSION@",
"description": "Modular and portable cryptographic toolkit",
"authors": [
{
"name": "libtomcrypt developers"
}
],
"licenses": [
{
"license": {
"id": "Unlicense"
}
}
],
"externalReferences": [
{
"type": "vcs",
"url": "https://github.com/libtom/libtomcrypt"
}
]
}
]
}

42
coverity.sh Executable file
View file

@ -0,0 +1,42 @@
#!/bin/bash
if [ $# -lt 2 ]
then
echo "usage is: ${0##*/} <path to coverity scan> <extra compiler options>"
echo "e.g. \"${0##*/} \"/usr/local/bin/coverity\" \"-DLTM_DESC -I/path/to/libtommath/\"\""
exit -1
fi
PATH=$PATH:$1/bin
make clean
rm -r cov-int/
myCflags=""
myCflags="$myCflags -O2 ${2}"
myCflags="$myCflags -pipe -Werror -Wpointer-arith -Winit-self -Wextra -Wall -Wformat -Wformat-security"
CFLAGS="$myCflags" cov-build --dir cov-int make -f makefile.unix $MAKE_OPTS IGNORE_SPEED=1 1>gcc_1.txt
if [ $? -ne 0 ]
then
echo "make failed"
exit -1
fi
# zipup everything
tar caf libtomcrypt.lzma cov-int
mytoken=$(cat .coverity_token)
mymail=$(cat .coverity_mail)
myversion=$(git describe --dirty)
curl -k --form project=libtomcrypt \
--form token=${mytoken} \
--form email=${mymail} \
--form file=@libtomcrypt.lzma \
--form version=\"${myversion}\" \
--form description="\"libtomcrypt version ${myversion}\"" \
https://scan.coverity.com/builds?project=libtom%2Flibtomcrypt
# EOF

5245
crypt.tex

File diff suppressed because it is too large Load diff

81
demos/CMakeLists.txt Normal file
View file

@ -0,0 +1,81 @@
# -----------------------------------------------------------------------------
# Options
# -----------------------------------------------------------------------------
option(INSTALL_DEMOS "Install enabled demos (USEFUL and/or USABLE) and ltc wrapper script" FALSE)
# -----------------------------------------------------------------------------
# Useful demos
#
# Demos that are even somehow useful and could be installed as a system-tool
#
# -----------------------------------------------------------------------------
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 ${USEFUL_DEMOS})
endif()
# -----------------------------------------------------------------------------
# Usable demos
#
# Demos that are usable but only rarely make sense to be installed
#
# -----------------------------------------------------------------------------
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 ${USABLE_DEMOS})
endif()
# -----------------------------------------------------------------------------
# Test demos
#
# Demos that are used for testing or measuring
#
# -----------------------------------------------------------------------------
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 ${TEST_DEMOS})
endif()
# -----------------------------------------------------------------------------
# Generate executables
# -----------------------------------------------------------------------------
# USABLE_DEMOS can get installed, so they're prefixed with `ltc-`
foreach(target ${USABLE_DEMOS_TARGETS})
list(APPEND ALL_DEMOS_INSTALL_TARGETS ltc-${target})
add_executable(ltc-${target} ${CMAKE_CURRENT_SOURCE_DIR}/${target}.c)
target_link_libraries(ltc-${target} PRIVATE ${PROJECT_NAME})
endforeach()
foreach(target ${ALL_DEMOS_TARGETS})
add_executable(${target} ${CMAKE_CURRENT_SOURCE_DIR}/${target}.c)
target_link_libraries(${target} PRIVATE ${PROJECT_NAME})
endforeach()
# -----------------------------------------------------------------------------
# Install targets
# -----------------------------------------------------------------------------
if(INSTALL_DEMOS)
install(
TARGETS ${ALL_DEMOS_INSTALL_TARGETS}
COMPONENT "runtime"
EXPORT ${TARGETS_EXPORT_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
# Also install the `ltc` wrapper script
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/ltc DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

140
demos/aesgcm.c Normal file
View file

@ -0,0 +1,140 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
/**
@file aesgcm.c
AES128-GCM demo - file en-&decryption, Steffen Jaeckel
Uses the format: |ciphertext|tag-16-bytes|
*/
#define _GNU_SOURCE
#include <tomcrypt.h>
#include <stdio.h>
#include <stdint.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#ifndef LTC_GCM_MODE
int main(void)
{
return -1;
}
#else
#include "gcm-file/gcm_filehandle.c"
#include "gcm-file/gcm_file.c"
static off_t fsize(const char *filename)
{
struct stat st;
if (stat(filename, &st) == 0) return st.st_size;
return -1;
}
#if defined(__linux__) && defined(__GLIBC_PREREQ)
#if __GLIBC_PREREQ(2, 14)
#define HAS_SYNCFS
#endif
#endif
static int mv(const char *old_name, const char *new_name)
{
int fd;
if (rename(old_name, new_name) == -1) return -1;
fd = open(new_name, 0);
if (fd == -1) return -1;
#if !defined(_WIN32)
if (fsync(fd) != 0) goto OUT;
#if defined(HAS_SYNCFS)
syncfs(fd);
#else
sync();
#endif
OUT:
#endif
close(fd);
return 0;
}
static void LTC_NORETURN die(int ret)
{
fprintf(stderr, "Usage: aesgcm <-e|-d> <infile> <outfile> <88|96 char hex-string 'IV | key'>\n");
exit(ret);
}
int main(int argc, char **argv)
{
int ret = 0, err, arg, direction, res, tmp;
size_t keylen;
uint8_t keybuf[48] = {0};
char *out = NULL;
const char *mode, *in_file, *out_file, *key_string;
unsigned long ivlen, key_len;
if (argc < 5) {
if (argc > 1 && strstr(argv[1], "-h"))
die(0);
else
die(__LINE__);
}
arg = 1;
mode = argv[arg++];
in_file = argv[arg++];
out_file = argv[arg++];
key_string = argv[arg++];
if(strcmp(mode, "-d") == 0) direction = GCM_DECRYPT;
else if(strcmp(mode, "-e") == 0) direction = GCM_ENCRYPT;
else die(__LINE__);
if (fsize(in_file) <= 0) die(__LINE__);
keylen = XSTRLEN(key_string);
if (keylen != 88 && keylen != 96) die(__LINE__);
key_len = sizeof(keybuf);
if ((err = base16_decode(key_string, keylen, keybuf, &key_len)) != CRYPT_OK) {
fprintf(stderr, "boooh %s\n", error_to_string(err));
die(__LINE__);
}
register_all_ciphers();
if(asprintf(&out, "%s-XXXXXX", out_file) < 0) die(__LINE__);
if((tmp = mkstemp(out)) == -1) {
ret = __LINE__;
goto cleanup;
}
close(tmp);
ivlen = keylen/2 - 32;
if((err = gcm_file(find_cipher("aes"), &keybuf[ivlen], 32, keybuf, ivlen, NULL, 0, in_file, out, 16, direction, &res)) != CRYPT_OK) {
fprintf(stderr, "boooh %s\n", error_to_string(err));
ret = __LINE__;
goto cleanup;
}
if(res != 1) {
ret = __LINE__;
}
else
{
if (mv(out, out_file) != 0) ret = __LINE__;
}
cleanup:
if(ret != 0) unlink(out);
free(out);
return ret;
}
#endif

76
demos/constants.c Normal file
View file

@ -0,0 +1,76 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
#define _POSIX_C_SOURCE 200809L /* otherwise PATH_MAX + strdup are not defined for build with -std=c99 */
#include "tomcrypt.h"
#include <string.h>
#define basename(path) ( strrchr((path), '/') ? strrchr((path), '/') + 1 : strrchr((path), '\\') ? strrchr((path), '\\') + 1 : (path) )
/**
@file demo_crypt_constants.c
Demo how to get various constants to dynamic languages
like Python
Larry Bugbee, February 2013
*/
static void s_print_line(const char* cmd, const char* desc)
{
printf(" %-16s - %s\n", cmd, desc);
}
int main(int argc, char **argv)
{
if (argc == 1) {
/* given a specific constant name, get and print its value */
char name[] = "CTR_COUNTER_BIG_ENDIAN";
int value;
char *names_list;
unsigned int names_list_len;
if (crypt_get_constant(name, &value) != 0) exit(EXIT_FAILURE);
printf("\n %s is %d \n\n", name, value);
/* get and print the length of the names (and values) list */
if (crypt_list_all_constants(NULL, &names_list_len) != 0) exit(EXIT_FAILURE);
printf(" need to allocate %u bytes \n\n", names_list_len);
/* get and print the names (and values) list */
if ((names_list = malloc(names_list_len)) == NULL) exit(EXIT_FAILURE);
if (crypt_list_all_constants(names_list, &names_list_len) != 0) exit(EXIT_FAILURE);
printf(" supported constants:\n\n%s\n\n", names_list);
free(names_list);
} else if (argc == 2) {
if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) {
char* base = strdup(basename(argv[0]));
printf("Usage: %s [-a] [-s name]\n\n", base);
s_print_line("<no argument>", "The old behavior of the demo");
s_print_line("-a", "Only lists all constants");
s_print_line("-s name", "List a single constant given as argument");
s_print_line("-h", "The help you're looking at");
free(base);
} else if (strcmp(argv[1], "-a") == 0) {
char *names_list;
unsigned int names_list_len;
/* get and print the length of the names (and values) list */
if (crypt_list_all_constants(NULL, &names_list_len) != 0) exit(EXIT_FAILURE);
/* get and print the names (and values) list */
if ((names_list = malloc(names_list_len)) == NULL) exit(EXIT_FAILURE);
if (crypt_list_all_constants(names_list, &names_list_len) != 0) exit(EXIT_FAILURE);
printf("%s\n", names_list);
free(names_list);
}
} else if (argc == 3) {
if (strcmp(argv[1], "-s") == 0) {
int value;
if (crypt_get_constant(argv[2], &value) != 0) exit(EXIT_FAILURE);
printf("%s,%u\n", argv[2], value);
}
}
return 0;
}

View file

@ -1,3 +1,6 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
/* encrypt V1.1 Fri Oct 18 04:28:03 NZDT 2002 */
/* File de/encryption, using libtomcrypt */
/* Written by Daniel Richards <kyhwana@world-net.co.nz> */
@ -9,90 +12,32 @@
#include <tomcrypt.h>
int errno;
int usage(char *name)
static int LTC_NORETURN die(int status)
{
int x;
printf("Usage: %s [-d](ecrypt) cipher infile outfile\nCiphers:\n", name);
int x, w, tot = 0;
FILE* o = status == EXIT_SUCCESS ? stdout : stderr;
fprintf(o,
"Usage encrypt: crypt <cipher> <infile> <outfile>\n"
"Usage decrypt: crypt -d <cipher> <infile> <outfile>\n"
"Usage test: crypt -t <cipher>\n"
"This help: crypt -h\n\nCiphers:\n\t");
for (x = 0; cipher_descriptor[x].name != NULL; x++) {
printf("%s\n",cipher_descriptor[x].name);
w = fprintf(o, "%-14s",cipher_descriptor[x].name);
if (w < 0) {
status = EXIT_FAILURE;
break;
}
tot += w;
if (tot >= 70) {
fprintf(o, "\n\t");
tot = 0;
}
}
exit(1);
if (tot != 0) fprintf(o, "\n");
exit(status);
}
void register_algs(void)
{
int x;
#ifdef RIJNDAEL
register_cipher (&aes_desc);
#endif
#ifdef BLOWFISH
register_cipher (&blowfish_desc);
#endif
#ifdef XTEA
register_cipher (&xtea_desc);
#endif
#ifdef RC5
register_cipher (&rc5_desc);
#endif
#ifdef RC6
register_cipher (&rc6_desc);
#endif
#ifdef SAFERP
register_cipher (&saferp_desc);
#endif
#ifdef TWOFISH
register_cipher (&twofish_desc);
#endif
#ifdef SAFER
register_cipher (&safer_k64_desc);
register_cipher (&safer_sk64_desc);
register_cipher (&safer_k128_desc);
register_cipher (&safer_sk128_desc);
#endif
#ifdef RC2
register_cipher (&rc2_desc);
#endif
#ifdef DES
register_cipher (&des_desc);
register_cipher (&des3_desc);
#endif
#ifdef CAST5
register_cipher (&cast5_desc);
#endif
#ifdef NOEKEON
register_cipher (&noekeon_desc);
#endif
#ifdef SKIPJACK
register_cipher (&skipjack_desc);
#endif
#ifdef KHAZAD
register_cipher (&khazad_desc);
#endif
#ifdef ANUBIS
register_cipher (&anubis_desc);
#endif
if (register_hash(&sha256_desc) == -1) {
printf("Error registering SHA256\n");
exit(-1);
}
if (register_prng(&yarrow_desc) == -1) {
printf("Error registering yarrow PRNG\n");
exit(-1);
}
if (register_prng(&sprng_desc) == -1) {
printf("Error registering sprng PRNG\n");
exit(-1);
}
}
int main(int argc, char *argv[])
int main(int argc, char *argv[])
{
unsigned char plaintext[512],ciphertext[512];
unsigned char tmpkey[512], key[MAXBLOCKSIZE], IV[MAXBLOCKSIZE];
@ -103,12 +48,36 @@ int main(int argc, char *argv[])
char *infile, *outfile, *cipher;
prng_state prng;
FILE *fdin, *fdout;
int err;
/* register algs, so they can be printed */
register_algs();
register_all_ciphers();
register_all_hashes();
register_all_prngs();
if (argc < 4) {
return usage(argv[0]);
if ((argc > 2) && (!strcmp(argv[1], "-t"))) {
cipher = argv[2];
cipher_idx = find_cipher(cipher);
if (cipher_idx == -1) {
fprintf(stderr, "Invalid cipher %s entered on command line.\n", cipher);
die(EXIT_FAILURE);
} /* if */
if (cipher_descriptor[cipher_idx].test) {
if (cipher_descriptor[cipher_idx].test() != CRYPT_OK) {
fprintf(stderr, "Error when testing cipher %s.\n", cipher);
die(EXIT_FAILURE);
}
else {
printf("Testing cipher %s succeeded.\n", cipher);
exit(EXIT_SUCCESS);
}
} else {
fprintf(stderr, "Cipher %s has no tests.\n", cipher);
exit(EXIT_SUCCESS);
}
}
return die(argc > 1 && strstr(argv[1], "-h") != NULL ? EXIT_SUCCESS : EXIT_FAILURE);
}
if (!strcmp(argv[1], "-d")) {
@ -121,7 +90,7 @@ int main(int argc, char *argv[])
cipher = argv[1];
infile = argv[2];
outfile = argv[3];
}
}
/* file handles setup */
fdin = fopen(infile,"rb");
@ -131,11 +100,11 @@ int main(int argc, char *argv[])
}
fdout = fopen(outfile,"wb");
if (fdout == NULL) {
if (fdout == NULL) {
perror("Can't open output for writing");
exit(-1);
}
cipher_idx = find_cipher(cipher);
if (cipher_idx == -1) {
printf("Invalid cipher entered on command line.\n");
@ -144,34 +113,35 @@ int main(int argc, char *argv[])
hash_idx = find_hash("sha256");
if (hash_idx == -1) {
printf("SHA256 not found...?\n");
printf("LTC_SHA256 not found...?\n");
exit(-1);
}
ivsize = cipher_descriptor[cipher_idx].block_length;
ks = hash_descriptor[hash_idx].hashsize;
if (cipher_descriptor[cipher_idx].keysize(&ks) != CRYPT_OK) {
if (cipher_descriptor[cipher_idx].keysize(&ks) != CRYPT_OK) {
printf("Invalid keysize???\n");
exit(-1);
}
printf("\nEnter key: ");
fgets((char *)tmpkey,sizeof(tmpkey), stdin);
if(fgets((char *)tmpkey,sizeof(tmpkey), stdin) == NULL)
exit(-1);
outlen = sizeof(key);
if ((errno = hash_memory(hash_idx,tmpkey,strlen((char *)tmpkey),key,&outlen)) != CRYPT_OK) {
printf("Error hashing key: %s\n", error_to_string(errno));
if ((err = hash_memory(hash_idx,tmpkey,XSTRLEN((char *)tmpkey),key,&outlen)) != CRYPT_OK) {
printf("Error hashing key: %s\n", error_to_string(err));
exit(-1);
}
if (decrypt) {
/* Need to read in IV */
if (fread(IV,1,ivsize,fdin) != ivsize) {
printf("Error reading IV from input.\n");
exit(-1);
}
if ((errno = ctr_start(cipher_idx,IV,key,ks,0,CTR_COUNTER_LITTLE_ENDIAN,&ctr)) != CRYPT_OK) {
printf("ctr_start error: %s\n",error_to_string(errno));
if ((err = ctr_start(cipher_idx,IV,key,ks,0,CTR_COUNTER_LITTLE_ENDIAN,&ctr)) != CRYPT_OK) {
printf("ctr_start error: %s\n",error_to_string(err));
exit(-1);
}
@ -179,8 +149,8 @@ int main(int argc, char *argv[])
do {
y = fread(inbuf,1,sizeof(inbuf),fdin);
if ((errno = ctr_decrypt(inbuf,plaintext,y,&ctr)) != CRYPT_OK) {
printf("ctr_decrypt error: %s\n", error_to_string(errno));
if ((err = ctr_decrypt(inbuf,plaintext,y,&ctr)) != CRYPT_OK) {
printf("ctr_decrypt error: %s\n", error_to_string(err));
exit(-1);
}
@ -194,10 +164,10 @@ int main(int argc, char *argv[])
} else { /* encrypt */
/* Setup yarrow for random bytes for IV */
if ((errno = rng_make_prng(128, find_prng("yarrow"), &prng, NULL)) != CRYPT_OK) {
printf("Error setting up PRNG, %s\n", error_to_string(errno));
}
if ((err = rng_make_prng(128, find_prng("yarrow"), &prng, NULL)) != CRYPT_OK) {
printf("Error setting up PRNG, %s\n", error_to_string(err));
}
/* You can use rng_get_bytes on platforms that support it */
/* x = rng_get_bytes(IV,ivsize,NULL);*/
@ -206,22 +176,22 @@ int main(int argc, char *argv[])
printf("Error reading PRNG for IV required.\n");
exit(-1);
}
if (fwrite(IV,1,ivsize,fdout) != ivsize) {
printf("Error writing IV to output.\n");
exit(-1);
}
if ((errno = ctr_start(cipher_idx,IV,key,ks,0,CTR_COUNTER_LITTLE_ENDIAN,&ctr)) != CRYPT_OK) {
printf("ctr_start error: %s\n",error_to_string(errno));
if ((err = ctr_start(cipher_idx,IV,key,ks,0,CTR_COUNTER_LITTLE_ENDIAN,&ctr)) != CRYPT_OK) {
printf("ctr_start error: %s\n",error_to_string(err));
exit(-1);
}
do {
y = fread(inbuf,1,sizeof(inbuf),fdin);
if ((errno = ctr_encrypt(inbuf,ciphertext,y,&ctr)) != CRYPT_OK) {
printf("ctr_encrypt error: %s\n", error_to_string(errno));
if ((err = ctr_encrypt(inbuf,ciphertext,y,&ctr)) != CRYPT_OK) {
printf("ctr_encrypt error: %s\n", error_to_string(err));
exit(-1);
}
@ -229,13 +199,9 @@ int main(int argc, char *argv[])
printf("Error writing to output.\n");
exit(-1);
}
} while (y == sizeof(inbuf));
} while (y == sizeof(inbuf));
fclose(fdout);
fclose(fdin);
}
return 0;
}
/* $Source$ */
/* $Revision$ */
/* $Date$ */

309
demos/demo_dynamic.py Normal file
View file

@ -0,0 +1,309 @@
"""
demo_dynamic.py v2b
This program demonstrates Python's use of the dynamic
language support additions to LTC, namely access to LTC
constants, struct and union sizes, and the binding of a
math package to LTC. Also provided are simple code
fragments to illustrate how one might write a Python
wrapper for LTC and how an app might call the wrapper.
This or a similar model should work for Ruby and other
dynamic languages.
This instance uses Python's ctypes and requires a single
.dylib linking together LTC and a math library. Building
a single .dylib is needed because LTC wants a fairly tight
relationship between itself and the mathlib. (ctypes can
load multiple .dylibs, but it does not support this level
of tight coupling between otherwise independent libraries.)
My .dylib was created on OSX/macOS with the following:
sudo make -j5 -f makefile.shared \
CFLAGS="-DUSE_TFM -DTFM_DESC -I/usr/local/include" \
EXTRALIBS=/usr/local/lib/libtfm.a install
For python 2.7.12 on Ubuntu Xenial the following worked for
me (without MPI support):
sudo make -f makefile.shared install PREFIX="/usr"
Reminder: you don't need to bind in a math library unless
you are going to use LTC functions that need a
mathlib. For example, public key crypto requires
a mathlib; hashing and symmetric encryption do not.
------
This code was originally written for Python 2.7 with the
ctypes standard library. This version is modified to run
under both Python 2.7 and 3.6.
Arguably the biggest change for Python3 has to do with
strings. Under Python2, native strings are ASCII bytes and
passing them to LTC is natural and requires no conversion.
Under Python3 all native strings are Unicode which requires
they be converted to bytes before use by LTC.
Note the following for Python3.
- ASCII keys, IVs and other string arguments must be
'bytes'. Define them with a 'b' prefix or convert
via the 'bytes()' function.
- "strings" returned from LTC are bytes and conversion
to Unicode might be necessary for proper printing.
If so, use <string>.decode('utf-8').
- The Python2 'print' statement becomes a function in
Python3 which requires parenthesis, eg. 'print()'.
NB: Unicode is achieved under Python2 by either defining
a Unicode string with a 'u' prefix or passing ASCII
strings thru the 'unicode()' function.
Larry Bugbee
March 2014 v1
August 2017 v2b
"""
import sys
from ctypes import *
from ctypes.util import find_library
# switches to enable/disable selected output
SHOW_ALL_CONSTANTS = True
SHOW_ALL_SIZES = True
SHOW_SELECTED_CONSTANTS = True
SHOW_SELECTED_SIZES = True
SHOW_BUILD_OPTIONS_ALGS = True
SHOW_SHA256_EXAMPLE = True
SHOW_CHACHA_EXAMPLE = True
print(' ')
print(' demo_dynamic.py')
def inprint(s, indent=0):
"prints strings indented, including multline strings"
for line in s.split('\n'):
print(' '*indent + line)
#-------------------------------------------------------------------------------
# load the .dylib
libname = 'tomcrypt'
libpath = find_library(libname)
print(' ')
print(' path to library %s: %s' % (libname, libpath))
LTC = cdll.LoadLibrary(libpath)
print(' loaded: %s' % LTC)
print(' ')
#-------------------------------------------------------------------------------
# get list of all supported constants followed by a list of all
# supported sizes. One alternative: these lists may be parsed
# and used as needed.
if SHOW_ALL_CONSTANTS:
print('-'*60)
print(' all supported constants and their values:')
# get size to allocate for constants output list
str_len = c_int(0)
ret = LTC.crypt_list_all_constants(None, byref(str_len))
print(' need to allocate %d bytes to build list \n' % str_len.value)
# allocate that size and get (name, size) pairs, each pair
# separated by a newline char.
names_sizes = c_buffer(str_len.value)
ret = LTC.crypt_list_all_constants(names_sizes, byref(str_len))
print(names_sizes.value.decode("utf-8"))
print(' ')
if SHOW_ALL_SIZES:
print('-'*60)
print(' all supported sizes:')
# get size to allocate for sizes output list
str_len = c_int(0)
ret = LTC.crypt_list_all_sizes(None, byref(str_len))
print(' need to allocate %d bytes to build list \n' % str_len.value)
# allocate that size and get (name, size) pairs, each pair
# separated by a newline char.
names_sizes = c_buffer(str_len.value)
ret = LTC.crypt_list_all_sizes(names_sizes, byref(str_len))
print(names_sizes.value.decode("utf-8"))
print(' ')
#-------------------------------------------------------------------------------
# get individually named constants and sizes
if SHOW_SELECTED_CONSTANTS:
print('-'*60)
print('\n selected constants:')
names = [
b'ENDIAN_LITTLE',
b'ENDIAN_64BITWORD',
b'PK_PUBLIC',
b'LTC_MILLER_RABIN_REPS',
b'CTR_COUNTER_BIG_ENDIAN',
]
for name in names:
const_value = c_int(0)
rc = LTC.crypt_get_constant(name, byref(const_value))
value = const_value.value
print(' %-25s %d' % (name.decode("utf-8"), value))
print(' ')
if SHOW_SELECTED_SIZES:
print('-'*60)
print('\n selected sizes:')
names = [
b'rijndael_key',
b'rsa_key',
b'symmetric_CTR',
b'twofish_key',
b'ecc_point',
b'gcm_state',
b'sha512_state',
]
for name in names:
size_value = c_int(0)
rc = LTC.crypt_get_size(name, byref(size_value))
value = size_value.value
print(' %-25s %d' % (name.decode("utf-8"), value))
print(' ')
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# LibTomCrypt exposes one interesting string that can be accessed
# via Python's ctypes module, "crypt_build_settings", which
# provides a list of this build's compiler switches and supported
# algorithms. If someday LTC exposes other interesting strings,
# they can be found with:
# nm /usr/local/lib/libtomcrypt.dylib | grep " D "
def get_named_string(lib, name):
return c_char_p.in_dll(lib, name).value.decode("utf-8")
if SHOW_BUILD_OPTIONS_ALGS:
print('-'*60)
print('This is a string compiled into LTC showing compile')
print('options and algorithms supported by this build \n')
# print(get_named_string(LTC, 'crypt_build_settings'))
inprint(get_named_string(LTC, 'crypt_build_settings'), 4)
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# here is an example of how Python code can be written to access
# LTC's implementation of SHA256 and ChaCha,
# - - - - - - - - - - - - -
# definitions
from binascii import hexlify, unhexlify
def _err2str(err):
# define return type
errstr = LTC.error_to_string
errstr.restype = c_char_p
# get and return err string
return errstr(err)
def _get_size(name):
size = c_int(0)
rc = LTC.crypt_get_size(bytes(name), byref(size))
if rc != 0:
raise Exception('LTC.crypt_get_size(%s) rc = %d' % (name, rc))
return size.value
def _get_constant(name):
constant = c_int(0)
rc = LTC.crypt_get_constant(bytes(name), byref(constant))
if rc != 0:
raise Exception('LTC.crypt_get_constant(%s) rc = %d' % (name, rc))
return constant.value
CRYPT_OK = _get_constant(b'CRYPT_OK')
class SHA256(object):
def __init__(self):
self.state = c_buffer(_get_size(b'sha256_state'))
LTC.sha256_init(byref(self.state))
def update(self, data):
LTC.sha256_process(byref(self.state), data, len(data))
def digest(self):
md = c_buffer(32)
LTC.sha256_done(byref(self.state), byref(md))
return md.raw
# - - - - - - - - - - - - -
# a SHA256 app fragment
if SHOW_SHA256_EXAMPLE:
print('-'*60)
data = b'hello world' # we want bytes, not Unicode
sha256 = SHA256()
sha256.update(data)
md = sha256.digest()
template = '\n the SHA256 digest for "%s" is %s \n'
print(template % (data, hexlify(md)))
class ChaCha(object):
def __init__(self, key, rounds):
self.state = c_buffer(_get_size(b'chacha_state'))
self.counter = c_uint(1)
err = LTC.chacha_setup(byref(self.state), key, len(key), rounds)
if err != CRYPT_OK:
raise Exception('LTC.chacha_setup(), err = %d, "%s"' % (err, _err2str(err)))
def set_iv32(self, iv):
err = LTC.chacha_ivctr32(byref(self.state), iv, len(iv), self.counter)
if err != CRYPT_OK:
raise Exception('LTC.chacha_ivctr32(), err = %d, "%s"' % (err, _err2str(err)))
def crypt(self, datain):
dataout = c_buffer(len(datain))
err = LTC.chacha_crypt(byref(self.state), datain, len(datain), byref(dataout))
if err != CRYPT_OK:
raise Exception('LTC.chacha_crypt(), err = %d, "%s"' % (err, _err2str(err)))
return dataout.raw
# - - - - - - - - - - - - -
# a ChaCha app fragment
if SHOW_CHACHA_EXAMPLE:
print('-'*60)
key = b'hownowbrowncow\x00\x00' # exactly 16 or 32 bytes
rounds = 12 # common values: 8, 12, 20
iv = b'123456789012' # exactly 12 bytes
plain = b'Kilroy was here, there, and everywhere!'
cha = ChaCha(key, rounds)
cha.set_iv32(iv)
cipher = cha.crypt(plain)
template = '\n ChaCha%d ciphertext for "%s" is "%s"'
print(template % (rounds, plain, hexlify(cipher)))
cha.set_iv32(iv) # reset to decrypt
decrypted = cha.crypt(cipher)
template = ' ChaCha%d decoded text for "%s" is "%s" \n'
print(template % (rounds, plain, decrypted.decode("utf-8")))
# Footnote: Keys should be erased fm memory as soon as possible after use,
# and that includes Python. For a tip on how to do that in Python, see
# http://buggywhip.blogspot.com/2010/12/erase-keys-and-credit-card-numbers-in.html
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------

327
demos/der_print_flexi.c Normal file
View file

@ -0,0 +1,327 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
/* DER flexi-decode a certificate */
#include "tomcrypt_private.h"
#include <wchar.h>
#define ASN1_FMTSTRING_FMT "line: %d, type=%d, size=%lu, data=%p, self=%p, next=%p, prev=%p, parent=%p, child=%p"
#define ASN1_FMTSTRING_VAL(l) __LINE__, (l)->type, (l)->size, (l)->data, (l), (l)->next, (l)->prev, (l)->parent, (l)->child
static void* s_xmalloc(int l)
{
void *r = XCALLOC(1, l);
#if defined(LTC_TEST_DBG) && LTC_TEST_DBG > 3
fprintf(stderr, "ALLOC %9d to %p\n", l, r);
#endif
if (!r) {
fprintf(stderr, "Could not allocate %d bytes of memory\n", l);
exit(EXIT_FAILURE);
}
return r;
}
#ifndef S_FREE
static void s_free(void *p)
{
#if defined(LTC_TEST_DBG) && LTC_TEST_DBG > 3
fprintf(stderr, "FREE %p\n", p);
#endif
XFREE(p);
}
#endif
static void s_der_print_flexi_i(const ltc_asn1_list* l, unsigned int level)
{
char *buf = NULL;
const char *name = NULL;
const char *text = NULL;
ltc_asn1_list *ostring = NULL;
unsigned int n;
int slen;
const wchar_t *wtmp;
switch (l->type)
{
case LTC_ASN1_EOL:
name = "EOL";
slen = snprintf(NULL, 0, ASN1_FMTSTRING_FMT "\n", ASN1_FMTSTRING_VAL(l));
buf = s_xmalloc(slen);
snprintf(buf, slen, ASN1_FMTSTRING_FMT "\n", ASN1_FMTSTRING_VAL(l));
text = buf;
break;
case LTC_ASN1_BOOLEAN:
name = "BOOLEAN";
{
if (*(int*) l->data)
text = "true";
else
text = "false";
}
break;
case LTC_ASN1_INTEGER:
name = "INTEGER";
buf = s_xmalloc(((ltc_mp_get_digit_count(l->data) + 1) * ltc_mp.bits_per_digit) / 3);
ltc_mp_toradix(l->data, buf, 10);
text = buf;
break;
case LTC_ASN1_SHORT_INTEGER:
name = "SHORT INTEGER";
break;
case LTC_ASN1_BIT_STRING:
name = "BIT STRING";
if (l->size <= 16) {
int r;
int sz = l->size + 1;
char *s = buf = s_xmalloc(sz);
for (n = 0; n < l->size; ++n) {
r = snprintf(s, sz, "%c", ((unsigned char*) l->data)[n] ? '1' : '0');
if (r < 0 || r >= sz) {
fprintf(stderr, "%s boom\n", name);
exit(EXIT_FAILURE);
}
s += r;
sz -= r;
}
} else {
slen = snprintf(NULL, 0, "Length %lu", l->size);
buf = s_xmalloc(slen);
snprintf(buf, slen, "Length %lu", l->size);
}
text = buf;
break;
case LTC_ASN1_OCTET_STRING:
name = "OCTET STRING";
{
unsigned long ostring_l = l->size;
/* sometimes there's another sequence in an octet string...
* try to decode that... if it fails print out the octet string
*/
if (der_decode_sequence_flexi(l->data, &ostring_l, &ostring) == CRYPT_OK) {
text = "";
} else {
int r;
int sz = l->size * 2 + 1;
char *s = buf = s_xmalloc(sz);
for (n = 0; n < l->size; ++n) {
r = snprintf(s, sz, "%02X", ((unsigned char*) l->data)[n]);
if (r < 0 || r >= sz) {
fprintf(stderr, "%s boom\n", name);
exit(EXIT_FAILURE);
}
s += r;
sz -= r;
}
text = buf;
}
}
break;
case LTC_ASN1_NULL:
name = "NULL";
text = "";
break;
case LTC_ASN1_OBJECT_IDENTIFIER:
name = "OBJECT IDENTIFIER";
{
unsigned long len = 0;
if (pk_oid_num_to_str(l->data, l->size, buf, &len) != CRYPT_BUFFER_OVERFLOW) {
fprintf(stderr, "%s WTF\n", name);
exit(EXIT_FAILURE);
}
buf = s_xmalloc(len);
if (pk_oid_num_to_str(l->data, l->size, buf, &len) != CRYPT_OK) {
fprintf(stderr, "%s boom\n", name);
exit(EXIT_FAILURE);
}
text = buf;
}
break;
case LTC_ASN1_IA5_STRING:
name = "IA5 STRING";
text = l->data;
break;
case LTC_ASN1_PRINTABLE_STRING:
name = "PRINTABLE STRING";
text = l->data;
break;
case LTC_ASN1_UTF8_STRING:
name = "UTF8 STRING";
wtmp = l->data;
slen = wcsrtombs(NULL, &wtmp, 0, NULL);
if (slen != -1) {
slen++;
buf = s_xmalloc(slen);
if (wcsrtombs(buf, &wtmp, slen, NULL) == (size_t)-1) {
fprintf(stderr, "%s boom\n", name);
exit(EXIT_FAILURE);
}
text = buf;
}
break;
case LTC_ASN1_UTCTIME:
name = "UTCTIME";
{
ltc_utctime *ut = l->data;
slen = 32;
buf = s_xmalloc(slen);
snprintf(buf, slen, "%02d-%02d-%02d %02d:%02d:%02d %c%02d:%02d", ut->YY, ut->MM, ut->DD, ut->hh, ut->mm,
ut->ss, ut->off_dir ? '-' : '+', ut->off_hh, ut->off_mm);
text = buf;
}
break;
case LTC_ASN1_GENERALIZEDTIME:
name = "GENERALIZED TIME";
{
ltc_generalizedtime *gt = l->data;
slen = 32;
buf = s_xmalloc(slen);
if (gt->fs)
snprintf(buf, slen, "%04d-%02d-%02d %02d:%02d:%02d.%02dZ", gt->YYYY, gt->MM, gt->DD, gt->hh, gt->mm,
gt->ss, gt->fs);
else
snprintf(buf, slen, "%04d-%02d-%02d %02d:%02d:%02dZ", gt->YYYY, gt->MM, gt->DD, gt->hh, gt->mm, gt->ss);
text = buf;
}
break;
case LTC_ASN1_CHOICE:
name = "CHOICE";
break;
case LTC_ASN1_SEQUENCE:
name = "SEQUENCE";
text = "";
break;
case LTC_ASN1_SET:
name = "SET";
text = "";
break;
case LTC_ASN1_SETOF:
name = "SETOF";
text = "";
break;
case LTC_ASN1_RAW_BIT_STRING:
name = "RAW BIT STRING";
break;
case LTC_ASN1_TELETEX_STRING:
name = "TELETEX STRING";
text = l->data;
break;
case LTC_ASN1_CUSTOM_TYPE:
name = "NON STANDARD";
{
int r;
int sz = 128;
char *s = buf = s_xmalloc(sz);
r = snprintf(s, sz, "[%s %s %llu]", der_asn1_class_to_string_map[l->klass],
der_asn1_pc_to_string_map[l->pc], l->tag);
if (r < 0 || r >= sz) {
fprintf(stderr, "%s boom\n", name);
exit(EXIT_FAILURE);
}
text = buf;
}
break;
}
for (n = 0; n < level; ++n) {
fprintf(stderr, " ");
}
if (name) {
if (text)
fprintf(stderr, "%s %s\n", name, text);
else
fprintf(stderr, "%s <missing decoding>\n", name);
} else
fprintf(stderr, "WTF type=%i\n", l->type);
if (buf) {
s_free(buf);
buf = NULL;
}
if (ostring) {
s_der_print_flexi_i(ostring, level + 1);
der_free_sequence_flexi(ostring);
}
if (l->child) s_der_print_flexi_i(l->child, level + 1);
if (l->next) s_der_print_flexi_i(l->next, level);
}
#ifndef LTC_DER_PRINT_FLEXI_NO_MAIN
static void s_der_print_flexi(const ltc_asn1_list* l)
{
fprintf(stderr, "\n\n");
s_der_print_flexi_i(l, 0);
fprintf(stderr, "\n\n");
}
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
static int fd;
static ltc_asn1_list *l;
static void print_err(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
}
static void die_(int err, int line)
{
print_err("%3d: LTC sez %s\n", line, error_to_string(err));
der_free_sequence_flexi(l);
close(fd);
exit(EXIT_FAILURE);
}
#define die(i) do { die_(i, __LINE__); } while(0)
#define DIE(s, ...) do { print_err("%3d: " s "\n", __LINE__, ##__VA_ARGS__); exit(EXIT_FAILURE); } while(0)
int main(int argc, char **argv)
{
void *addr;
int err, argn = 1;
struct stat sb;
unsigned long len;
if ((err = register_all_hashes()) != CRYPT_OK) {
die(err);
}
if ((err = crypt_mp_init("ltm")) != CRYPT_OK) {
die(err);
}
if (argc > argn) fd = open(argv[argn], O_RDONLY);
else fd = STDIN_FILENO;
if (fd == -1) DIE("open sez no");
if (fstat(fd, &sb) == -1) DIE("fstat");
addr = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if (addr == MAP_FAILED) DIE("mmap");
len = sb.st_size;
if ((err = der_decode_sequence_flexi(addr, &len, &l)) != CRYPT_OK) {
die(err);
}
s_der_print_flexi(l);
der_free_sequence_flexi(l);
close(fd);
return 0;
}
#endif /* LTC_DER_PRINT_FLEXI_NO_MAIN */

84
demos/gcm-file/gcm_file.c Normal file
View file

@ -0,0 +1,84 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
#include "tomcrypt.h"
/**
@file gcm_file.c
GCM process a file, Steffen Jaeckel
*/
#ifdef LTC_GCM_MODE
#ifndef LTC_NO_FILE
/**
Process a file.
c.f. gcm_filehandle() for basic documentation.
It is possible, that in error-cases the 'out' file
will be created and after the error occurred it will
be removed again.
@param cipher Index of cipher to use
@param key The secret key
@param keylen The length of the secret key
@param IV The initial vector
@param IVlen The length of the initial vector
@param adata The additional authentication data (header)
@param adatalen The length of the adata
@param in The input file
@param out The output file
@param taglen The MAC tag length
@param direction Encrypt or Decrypt mode (GCM_ENCRYPT or GCM_DECRYPT)
@param res [out] Result of the operation, 1==valid, 0==invalid
@return CRYPT_OK on success
*/
static int gcm_file(int cipher,
const unsigned char *key, unsigned long keylen,
const unsigned char *IV, unsigned long IVlen,
const unsigned char *adata, unsigned long adatalen,
const char *in,
const char *out,
unsigned long taglen,
int direction,
int *res)
{
int err;
FILE *f_in = NULL, *f_out = NULL;
LTC_ARGCHK(in != NULL);
LTC_ARGCHK(out != NULL);
LTC_ARGCHK(res != NULL);
*res = 0;
f_in = fopen(in, "rb");
if (f_in == NULL) {
err = CRYPT_FILE_NOTFOUND;
goto LBL_ERR;
}
f_out = fopen(out, "w+b");
if (f_out == NULL) {
err = CRYPT_FILE_NOTFOUND;
goto LBL_ERR;
}
err = gcm_filehandle(cipher, key, keylen, IV, IVlen, adata, adatalen, f_in, f_out, taglen, direction, res);
LBL_ERR:
if (f_out != NULL && fclose(f_out) != 0) {
err = CRYPT_ERROR;
}
if (*res != 1) {
remove(out);
}
if (f_in != NULL && fclose(f_in) != 0) {
err = CRYPT_ERROR;
}
return err;
}
#endif
#endif

View file

@ -0,0 +1,194 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
#include "tomcrypt.h"
/**
@file gcm_filehandle.c
GCM process a filehandle, Steffen Jaeckel
*/
#ifdef LTC_GCM_MODE
#ifndef LTC_NO_FILE
#if defined(_MSC_VER)
#define ftruncate _chsize
#else
#include <unistd.h>
#endif
/**
Process a filehandle.
This uses the widely established scheme where the tag is appended
to the ciphertext.
encrypted_file = aesgcm(plain_file) | aesgcm_tag(plain_file)
Depending on 'direction' this function does:
Encrypt file 'in' to 'out' and append the tag of length 'taglen'
to 'out'.
or
Decrypt file 'in' to 'out' and check the tag of length 'taglen'
and strip the tag from 'in'.
In error-cases 'out' will be zeroed out first and then truncated to
a length of 0.
@param cipher Index of cipher to use
@param key The secret key
@param keylen The length of the secret key
@param IV The initial vector
@param IVlen The length of the initial vector
@param adata The additional authentication data (header)
@param adatalen The length of the adata
@param in The input file
@param out The output file
@param taglen The MAC tag length
@param direction Encrypt or Decrypt mode (GCM_ENCRYPT or GCM_DECRYPT)
@param res [out] Result of the operation, 1==valid, 0==invalid
@return CRYPT_OK on success
*/
static int gcm_filehandle(int cipher,
const unsigned char *key, unsigned long keylen,
const unsigned char *IV, unsigned long IVlen,
const unsigned char *adata, unsigned long adatalen,
FILE *in,
FILE *out,
unsigned long taglen,
int direction,
int *res)
{
void *orig;
gcm_state *gcm;
int err;
unsigned char *buf, tag[16];
size_t x, tot_data;
unsigned long tag_len;
LTC_ARGCHK(in != NULL);
LTC_ARGCHK(out != NULL);
LTC_ARGCHK(res != NULL);
*res = 0;
if ((err = cipher_is_valid(cipher)) != CRYPT_OK) {
return err;
}
#ifndef LTC_GCM_TABLES_SSE2
orig = gcm = XMALLOC(sizeof(*gcm));
#else
orig = gcm = XMALLOC(sizeof(*gcm) + 16);
#endif
if (gcm == NULL) {
return CRYPT_MEM;
}
if ((buf = XMALLOC(LTC_FILE_READ_BUFSIZE)) == NULL) {
XFREE(gcm);
return CRYPT_MEM;
}
/* Force GCM to be on a multiple of 16 so we can use 128-bit aligned operations
* note that we only modify gcm and keep orig intact. This code is not portable
* but again it's only for SSE2 anyways, so who cares?
*/
#ifdef LTC_GCM_TABLES_SSE2
gcm = LTC_ALIGN_BUF(gcm, 16);
#endif
if ((err = gcm_init(gcm, cipher, key, keylen)) != CRYPT_OK) {
goto LBL_ERR;
}
if ((err = gcm_add_iv(gcm, IV, IVlen)) != CRYPT_OK) {
goto LBL_ERR;
}
if ((err = gcm_add_aad(gcm, adata, adatalen)) != CRYPT_OK) {
goto LBL_ERR;
}
fseek(in, 0, SEEK_END);
tot_data = ftell(in);
if (direction == GCM_DECRYPT) {
tot_data -= taglen;
}
fseek(in, 0, SEEK_SET);
do {
x = MIN(tot_data, LTC_FILE_READ_BUFSIZE);
x = fread(buf, 1, x, in);
tot_data -= x;
if ((err = gcm_process(gcm, buf, (unsigned long)x, buf, direction)) != CRYPT_OK) {
goto LBL_CLEANBUF;
}
if(fwrite(buf, 1, x, out) != x) {
err = CRYPT_ERROR;
goto LBL_CLEANBUF;
}
} while (x == LTC_FILE_READ_BUFSIZE);
tag_len = taglen;
if ((err = gcm_done(gcm, tag, &tag_len)) != CRYPT_OK) {
goto LBL_CLEANBUF;
}
if (tag_len != taglen) {
err = CRYPT_ERROR;
goto LBL_CLEANBUF;
}
if (direction == GCM_DECRYPT) {
if (feof(in) || ferror(in)) {
err = CRYPT_ERROR;
goto LBL_CLEANBUF;
}
x = fread(buf, 1, taglen, in);
if (x != taglen) {
err = CRYPT_ERROR;
goto LBL_CLEANBUF;
}
if (XMEM_NEQ(buf, tag, taglen) == 0) {
*res = 1;
}
} else {
if(fwrite(tag, 1, taglen, out) != taglen) {
err = CRYPT_ERROR;
goto LBL_CLEANBUF;
}
*res = 1;
}
LBL_CLEANBUF:
zeromem(buf, LTC_FILE_READ_BUFSIZE);
zeromem(tag, sizeof(tag));
LBL_ERR:
#ifdef LTC_CLEAN_STACK
#ifndef LTC_GCM_TABLES_SSE2
zeromem(orig, sizeof(*gcm));
#else
zeromem(orig, sizeof(*gcm) + 16);
#endif
#endif
if(*res == 0) {
x = ftell(out);
fseek(in, 0, SEEK_SET);
while((size_t)ftell(out) < x) {
fwrite(buf, 1, LTC_FILE_READ_BUFSIZE, out);
}
if(ftruncate(fileno(out), 0)) {
/* well, what shall we do here... */
}
}
fflush(out);
XFREE(buf);
XFREE(orig);
return err;
}
#endif
#endif

View file

@ -1,3 +1,6 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
/*
* Written by Daniel Richards <kyhwana@world-net.co.nz> 6/7/2002
* hash.c: This app uses libtomcrypt to hash either stdin or a file
@ -7,113 +10,288 @@
* more functions ;)
*/
#define _POSIX_C_SOURCE 200809L /* otherwise PATH_MAX + strdup are not defined for build with -std=c99 */
#include <tomcrypt.h>
int errno;
#include <string.h>
#define basename(path) ( strrchr((path), '/') ? strrchr((path), '/') + 1 : strrchr((path), '\\') ? strrchr((path), '\\') + 1 : (path) )
void register_algs();
#if !defined(PATH_MAX) && defined(_MSC_VER)
#include <windows.h>
#define PATH_MAX MAX_PATH
#endif
/* thanks http://stackoverflow.com/a/8198009 */
#define s_base(x) ((x >= '0' && x <= '9') ? '0' : \
(x >= 'a' && x <= 'f') ? 'a' - 10 : \
(x >= 'A' && x <= 'F') ? 'A' - 10 : \
'\255')
#define HEXOF(x) (x - s_base(x))
#ifndef LTC_ARRAY_SIZE
#define LTC_ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
#endif
static char* hashsum;
static void cleanup(void)
{
free(hashsum);
}
static void die(int status)
{
unsigned long w, x;
FILE* o = status == EXIT_SUCCESS ? stdout : stderr;
fprintf(o,
"Usage: %s [-a <algorithm>...] [-c|-h] [<file>...]\n\n"
"\t-c\tCheck the hash(es) of the file(s) written in <file>.\n"
"\t\tNote: -a is not required when checking the hash(es).\n"
"\t-h\tThis help\n\n"
"Examples:\n"
"\t%s -a sha1 file > file.sha1sum\n"
"\t%s -c file.sha1sum\n"
"\t%s -a sha1 -a sha256 -a sha512-256 file > file.hashsum\n"
"\t%s -c file.hashsum\n\n"
"Algorithms:\n\t", hashsum, hashsum, hashsum, hashsum, hashsum);
w = 0;
for (x = 0; hash_descriptor[x].name != NULL; x++) {
w += fprintf(o, "%-14s", hash_descriptor[x].name);
if (w >= 70) {
fprintf(o, "\n\t");
w = 0;
}
}
if (w != 0) fprintf(o, "\n");
exit(status);
}
static void printf_hex(unsigned char* hash_buffer, unsigned long w)
{
unsigned long x;
for (x = 0; x < w; x++) {
printf("%02x",hash_buffer[x]);
}
}
static void check_file(int argn, int argc, char **argv)
{
int err, failed = 0, invalid = 0;
unsigned char is_buffer[MAXBLOCKSIZE], should_buffer[MAXBLOCKSIZE];
char buf[PATH_MAX + (MAXBLOCKSIZE * 3)];
/* iterate through all files */
while(argn < argc) {
char* s;
FILE* f = fopen(argv[argn], "rb");
if(f == NULL) {
int n = snprintf(buf, sizeof(buf), "%s: %s", hashsum, argv[argn]);
if (n > 0 && n < (int)sizeof(buf))
perror(buf);
else
perror(argv[argn]);
exit(EXIT_FAILURE);
}
/* read the file line by line */
while((s = fgets(buf, sizeof(buf), f)) != NULL)
{
int tries, n;
unsigned long hash_len, w, x;
char* space = strstr(s, " ");
/* skip lines with comments */
if (buf[0] == '#') continue;
if (space == NULL) {
fprintf(stderr, "%s: no properly formatted checksum lines found\n", hashsum);
goto ERR;
}
hash_len = space - s;
hash_len /= 2;
if (hash_len > sizeof(should_buffer)) {
fprintf(stderr, "%s: hash too long\n", hashsum);
goto ERR;
}
/* convert the hex-string back to binary */
for (x = 0; x < hash_len; ++x) {
should_buffer[x] = HEXOF(s[x*2]) << 4 | HEXOF(s[x*2 + 1]);
}
space++;
if (*space != '*') {
fprintf(stderr, "%s: unsupported input mode '%c'\n", hashsum, *space);
goto ERR;
}
space++;
for (n = 0; n < (buf + sizeof(buf)) - space; ++n) {
if(iscntrl((int)space[n])) {
space[n] = '\0';
break;
}
}
/* try all hash algorithms that have the appropriate hash size */
tries = 0;
for (x = 0; hash_descriptor[x].name != NULL; ++x) {
if (hash_descriptor[x].hashsize == hash_len) {
tries++;
w = sizeof(is_buffer);
if ((err = hash_file(x, space, is_buffer, &w)) != CRYPT_OK) {
fprintf(stderr, "%s: File hash error: %s: %s\n", hashsum, space, error_to_string(err));
ERR:
fclose(f);
exit(EXIT_FAILURE);
}
if(XMEMCMP(should_buffer, is_buffer, w) == 0) {
printf("%s: OK\n", space);
break;
}
}
} /* for */
if (hash_descriptor[x].name == NULL) {
if(tries > 0) {
printf("%s: FAILED\n", space);
failed++;
}
else {
invalid++;
}
}
} /* while */
fclose(f);
if(invalid) {
fprintf(stderr, "%s: WARNING: %d %s is improperly formatted\n", hashsum, invalid, invalid > 1?"lines":"line");
}
if(failed) {
fprintf(stderr, "%s: WARNING: %d computed %s did NOT match\n", hashsum, failed, failed > 1?"checksums":"checksum");
}
argn++;
}
exit(failed == 0 && invalid == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
int main(int argc, char **argv)
{
int idx, x, z;
unsigned long w;
int idxs[TAB_SIZE], idx, check, y, z, err, argn;
unsigned long w, x;
unsigned char hash_buffer[MAXBLOCKSIZE];
hash_state md;
hashsum = strdup(basename(argv[0]));
atexit(cleanup);
/* You need to register algorithms before using them */
register_algs();
if (argc < 2) {
printf("usage: ./hash algorithm file [file ...]\n");
printf("Algorithms:\n");
for (x = 0; hash_descriptor[x].name != NULL; x++) {
printf(" %s (%d)\n", hash_descriptor[x].name, hash_descriptor[x].ID);
}
exit(EXIT_SUCCESS);
register_all_ciphers();
register_all_hashes();
if (argc > 1 && strstr(argv[1], "-h")) {
die(EXIT_SUCCESS);
}
if (argc < 3) {
die(EXIT_FAILURE);
}
idx = find_hash(argv[1]);
if (idx == -1) {
fprintf(stderr, "\nInvalid hash specified on command line.\n");
return -1;
for (x = 0; x < LTC_ARRAY_SIZE(idxs); ++x) {
idxs[x] = -2;
}
argn = 1;
check = 0;
idx = 0;
while(argn < argc){
if(strcmp("-a", argv[argn]) == 0) {
argn++;
if(argn < argc) {
idxs[idx] = find_hash(argv[argn]);
if (idxs[idx] == -1) {
struct {
const char* is;
const char* should;
} shasum_compat[] =
{
#ifdef LTC_SHA1
{ "1", sha1_desc.name },
#endif
#ifdef LTC_SHA224
{ "224", sha224_desc.name },
#endif
#ifdef LTC_SHA256
{ "256", sha256_desc.name },
#endif
#ifdef LTC_SHA384
{ "384", sha384_desc.name },
#endif
#ifdef LTC_SHA512
{ "512", sha512_desc.name },
#endif
#ifdef LTC_SHA512_224
{ "512224", sha512_224_desc.name },
#endif
#ifdef LTC_SHA512_256
{ "512256", sha512_256_desc.name },
#endif
{ NULL, NULL }
};
for (x = 0; shasum_compat[x].is != NULL; ++x) {
if(XSTRCMP(shasum_compat[x].is, argv[argn]) == 0) {
idxs[idx] = find_hash(shasum_compat[x].should);
break;
}
}
}
if (idxs[idx] == -1) {
fprintf(stderr, "%s: Unrecognized algorithm\n", hashsum);
die(EXIT_FAILURE);
}
idx++;
if ((size_t)idx >= LTC_ARRAY_SIZE(idxs)) {
fprintf(stderr, "%s: Too many '-a' options chosen\n", hashsum);
die(EXIT_FAILURE);
}
argn++;
continue;
}
else {
die(EXIT_FAILURE);
}
}
if(strcmp("-c", argv[argn]) == 0) {
check = 1;
argn++;
continue;
}
break;
}
if (argc == 2) {
hash_descriptor[idx].init(&md);
do {
x = fread(hash_buffer, 1, sizeof(hash_buffer), stdin);
hash_descriptor[idx].process(&md, hash_buffer, x);
} while (x == sizeof(hash_buffer));
hash_descriptor[idx].done(&md, hash_buffer);
for (x = 0; x < (int)hash_descriptor[idx].hashsize; x++) {
printf("%02x",hash_buffer[x]);
if (check == 1) {
check_file(argn, argc, argv);
}
if (argc == argn) {
w = sizeof(hash_buffer);
if ((err = hash_filehandle(idxs[0], stdin, hash_buffer, &w)) != CRYPT_OK) {
fprintf(stderr, "%s: File hash error: %s\n", hashsum, error_to_string(err));
return EXIT_FAILURE;
} else {
for (x = 0; x < w; x++) {
printf("%02x",hash_buffer[x]);
}
printf(" *-\n");
}
printf(" (stdin)\n");
} else {
for (z = 2; z < argc; z++) {
w = sizeof(hash_buffer);
if ((errno = hash_file(idx,argv[z],hash_buffer,&w)) != CRYPT_OK) {
printf("File hash error: %s\n", error_to_string(errno));
} else {
for (x = 0; x < (int)hash_descriptor[idx].hashsize; x++) {
printf("%02x",hash_buffer[x]);
}
printf(" %s\n", argv[z]);
for (z = argn; z < argc; z++) {
for (y = 0; y < idx; ++y) {
w = sizeof(hash_buffer);
if ((err = hash_file(idxs[y],argv[z],hash_buffer,&w)) != CRYPT_OK) {
fprintf(stderr, "%s: File hash error: %s\n", hashsum, error_to_string(err));
return EXIT_FAILURE;
} else {
printf_hex(hash_buffer, w);
printf(" *%s\n", argv[z]);
}
}
}
}
return EXIT_SUCCESS;
}
void register_algs(void)
{
int err;
#ifdef TIGER
register_hash (&tiger_desc);
#endif
#ifdef MD2
register_hash (&md2_desc);
#endif
#ifdef MD4
register_hash (&md4_desc);
#endif
#ifdef MD5
register_hash (&md5_desc);
#endif
#ifdef SHA1
register_hash (&sha1_desc);
#endif
#ifdef SHA224
register_hash (&sha224_desc);
#endif
#ifdef SHA256
register_hash (&sha256_desc);
#endif
#ifdef SHA384
register_hash (&sha384_desc);
#endif
#ifdef SHA512
register_hash (&sha512_desc);
#endif
#ifdef RIPEMD128
register_hash (&rmd128_desc);
#endif
#ifdef RIPEMD160
register_hash (&rmd160_desc);
#endif
#ifdef WHIRLPOOL
register_hash (&whirlpool_desc);
#endif
#ifdef CHC_HASH
register_hash(&chc_desc);
if ((err = chc_register(register_cipher(&aes_enc_desc))) != CRYPT_OK) {
printf("chc_register error: %s\n", error_to_string(err));
exit(EXIT_FAILURE);
}
#endif
}
/* $Source$ */
/* $Revision$ */
/* $Date$ */

349
demos/latex-tables.c Normal file
View file

@ -0,0 +1,349 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
/* print all PEM related infos */
#include "tomcrypt_private.h"
#if defined(LTC_PEM_SSH)
static const struct {
const char *is, *should;
} cipher_name_map[] = {
{ "", "none" },
{ "aes", "AES" },
{ "aria", "ARIA" },
{ "blowfish", "Blowfish" },
{ "c20p1305", "ChaCha20Poly1305" },
{ "camellia", "Camellia" },
{ "cast5", "CAST5" },
{ "chacha20", "ChaCha20" },
{ "3des", "3DES (EDE)" },
{ "des", "DES" },
{ "desx", "DES-X" },
{ "idea", "IDEA" },
{ "rc5", "RC5" },
{ "rc2", "RC2" },
{ "seed", "SEED" },
{ "serpent", "Serpent" },
{ "twofish", "Twofish" },
};
static const char *s_map_cipher(const char *name)
{
unsigned long n;
for (n = 0; n < LTC_ARRAY_SIZE(cipher_name_map); ++n) {
if (strcmp(name, cipher_name_map[n].is) == 0)
return cipher_name_map[n].should;
}
fprintf(stderr, "Error: Can't map %s\n", name);
exit(1);
}
static const struct {
enum cipher_mode mode;
const char *name;
} cipher_mode_map[] = {
{ cm_none, "none", },
{ cm_cbc, "CBC", },
{ cm_cfb, "CFB", },
{ cm_cfb1, "CFB1", },
{ cm_cfb8, "CFB8", },
{ cm_ctr, "CTR", },
{ cm_ofb, "OFB", },
{ cm_stream, "STREAM", },
{ cm_gcm, "GCM", },
};
static const char *s_map_mode(enum cipher_mode mode)
{
size_t n;
mode &= cm_modes | cm_1bit | cm_8bit;
for (n = 0; n < LTC_ARRAY_SIZE(cipher_mode_map); ++n) {
if (cipher_mode_map[n].mode == mode)
return cipher_mode_map[n].name;
}
fprintf(stderr, "Error: Can't map cipher_mode %d\n", mode);
exit(1);
}
static int print_pem_ciphers(void)
{
unsigned long n;
printf("\nPEM ciphers:\n\n");
for (n = 0; n < pem_dek_infos_num; ++n) {
char nbuf[32] = {0};
size_t nlen = strlen(pem_dek_infos[n].name);
memcpy(nbuf, pem_dek_infos[n].name, nlen);
nbuf[nlen-1] = '}';
printf("\\hline \\texttt{%-18s & %-15s & %-25ld & %-6s \\\\\n",
nbuf, s_map_cipher(pem_dek_infos[n].algo),
pem_dek_infos[n].keylen * 8,
s_map_mode(pem_dek_infos[n].mode));
}
return 0;
}
static int print_ssh_ciphers(void)
{
unsigned long n;
printf("\nSSH ciphers:\n\n");
for (n = 0; n < ssh_ciphers_num; ++n) {
char nbuf[32] = {0};
size_t nlen = strlen(ssh_ciphers[n].name);
memcpy(nbuf, ssh_ciphers[n].name, nlen);
nbuf[nlen] = '}';
printf("\\hline \\texttt{%-30s & %-16s & %-24ld & %-6s \\\\\n",
nbuf, s_map_cipher(ssh_ciphers[n].algo),
ssh_ciphers[n].keylen * 8,
s_map_mode(ssh_ciphers[n].mode));
}
return 0;
}
static int s_to_lower(const char *in, char *out, unsigned long *outlen)
{
unsigned long n;
for (n = 0; n < *outlen && in[n]; ++n) {
out[n] = tolower(in[n]);
}
if (n == *outlen)
return CRYPT_BUFFER_OVERFLOW;
out[n] = '\0';
*outlen = n;
return CRYPT_OK;
}
static int print_ecc_curves(void)
{
unsigned long n;
printf("\nECC curves:\n\n");
for (n = 0; ltc_ecc_curves[n].OID != NULL; ++n) {
const char * const *names;
char lower[32] = {0}, buf[64] = {0};
unsigned long m, bufl = 0, lowerl;
int err = ecc_get_curve_names(ltc_ecc_curves[n].OID, &names);
if (err != CRYPT_OK) {
printf("\\error: OID %s not found (%s)\n", ltc_ecc_curves[n].OID, error_to_string(err));
return EXIT_FAILURE;
}
for (m = 1; names[m]; ++m) {
const char *name = names[m];
if (memcmp(name, "P-", 2) == 0 || memcmp(name, "ECC-", 4) == 0) {
/* Use the original name */
} else {
lowerl = sizeof(lower);
if ((err = s_to_lower(name, lower, &lowerl)) != CRYPT_OK) {
printf("\\error: %s could not be converted to lowercase (%s)\n", name, error_to_string(err));
return EXIT_FAILURE;
}
name = lower;
}
if (m == 1) {
err = snprintf(buf + bufl, sizeof(buf) - bufl, "%s", name);
} else {
err = snprintf(buf + bufl, sizeof(buf) - bufl, ", %s", name);
}
if (err == -1 || (unsigned)err > sizeof(buf) - bufl) {
printf("\\error: snprintf returned %d at %s\n", err, name);
return EXIT_FAILURE;
}
bufl += err;
}
lower[0] = '{';
lowerl = sizeof(lower) - 2;
if ((err = s_to_lower(names[0], &lower[1], &lowerl)) != CRYPT_OK) {
printf("\\error: %s could not be converted to lowercase (%s)\n", names[0], error_to_string(err));
return EXIT_FAILURE;
}
lower[lowerl + 1] = '}';
lower[lowerl + 2] = '\0';
printf("\\hline \\texttt%-17s & %-36s & %-21s \\\\\n", lower, buf, ltc_ecc_curves[n].OID);
}
return 0;
}
static int s_to_upper(const char *in, char *out, unsigned long *outlen)
{
unsigned long n;
for (n = 0; n < *outlen && in[n]; ++n) {
out[n] = toupper(in[n]);
}
if (n == *outlen)
return CRYPT_BUFFER_OVERFLOW;
out[n] = '\0';
*outlen = n;
return CRYPT_OK;
}
static int s_to_desc(const char *in, char *out, unsigned long outlen, int has_desc)
{
unsigned long n, m;
if (outlen < 6) goto err_exit;
XMEMCPY(out, "\\code{", 6);
m = 6;
for (n = 0; m < outlen - 1 && in[n]; ++n, ++m) {
if (in[n] == '-' || in[n] == '_') {
out[m++] = '\\';
out[m] = '_';
} else
out[m] = tolower(in[n]);
}
if (outlen <= m) goto err_exit;
if (!has_desc) {
XMEMCPY(&out[m], "\\_desc", 6);
m += 6;
}
out[m++] = '}';
out[m] = '\0';
return CRYPT_OK;
err_exit:
fprintf(stderr, "Error: Can't print descriptor %s\n", in);
exit(1);
}
struct desc {
void *orig;
char desc[64];
};
static int hash_sorter(const void *a, const void *b)
{
const struct ltc_hash_descriptor *A, *B;
A = ((const struct desc*)a)->orig;
B = ((const struct desc*)b)->orig;
if (A->hashsize < B->hashsize) return 1;
if (A->hashsize > B->hashsize) return -1;
if (A->ID < B->ID) return -1;
if (A->ID > B->ID) return 1;
return 0;
}
static void print_hash_line(const char *name, const struct ltc_hash_descriptor *p)
{
char nbuf[32];
unsigned long nlen = sizeof(nbuf);
s_to_upper(p->name, nbuf, &nlen);
printf("\\hline %-17s & %-32s & %lu & %2d \\\\\n", nbuf, name, p->hashsize, p->ID);
}
static int print_hash_descriptors(void)
{
const struct {
const char *name;
const struct ltc_hash_descriptor * desc;
} special_hash_descriptors[] = {
#define HASH_DESC(name) { #name, &name }
HASH_DESC(sha256_portable_desc),
#ifdef LTC_SHA256_X86
HASH_DESC(sha256_x86_desc),
#endif
HASH_DESC(sha224_portable_desc),
#ifdef LTC_SHA224_X86
HASH_DESC(sha224_x86_desc),
#endif
HASH_DESC(sha1_portable_desc),
#ifdef LTC_SHA1_X86
HASH_DESC(sha1_x86_desc),
#endif
HASH_DESC(sha512_portable_desc),
#ifdef LTC_SHA512_X86
HASH_DESC(sha512_x86_desc),
#endif
HASH_DESC(sha384_portable_desc),
#ifdef LTC_SHA384_X86
HASH_DESC(sha384_x86_desc),
#endif
HASH_DESC(sha512_224_portable_desc),
#ifdef LTC_SHA512_224_X86
HASH_DESC(sha512_224_x86_desc),
#endif
HASH_DESC(sha512_256_portable_desc),
#ifdef LTC_SHA512_256_X86
HASH_DESC(sha512_256_x86_desc),
#endif
};
struct desc descs[TAB_SIZE + 1] = {0};
int ids[TAB_SIZE + 1] = {0};
unsigned long n;
printf("\nhash descriptors:\n\n");
register_all_hashes();
for (n = 0; hash_descriptor[n].name != NULL && n < TAB_SIZE; ++n) {
if (hash_descriptor[n].ID > TAB_SIZE) {
printf("Hash descriptor '%s' has invalid ID %d\n", hash_descriptor[n].name, hash_descriptor[n].ID);
return EXIT_FAILURE;
}
if (ids[hash_descriptor[n].ID] != 0) {
printf("Hash descriptor '%s' has duplicate ID %d\n", hash_descriptor[n].name, hash_descriptor[n].ID);
return EXIT_FAILURE;
}
ids[hash_descriptor[n].ID] = 1;
descs[n].orig = &hash_descriptor[n];
s_to_desc(hash_descriptor[n].name, descs[n].desc, sizeof(descs[n].desc), 0);
}
qsort(descs, n, sizeof(struct desc), &hash_sorter);
for (n = 0; hash_descriptor[n].name != NULL && n < TAB_SIZE; ++n) {
print_hash_line(descs[n].desc, descs[n].orig);
}
printf("\nspecial hash descriptors:\n\n");
for (n = 0; n < LTC_ARRAY_SIZE(special_hash_descriptors); ++n) {
char nbuf[64];
unsigned long nlen = sizeof(nbuf);
s_to_desc(special_hash_descriptors[n].name, nbuf, nlen, 1);
print_hash_line(nbuf, special_hash_descriptors[n].desc);
}
return 0;
}
static void LTC_NORETURN die(int status)
{
FILE* o = status == EXIT_SUCCESS ? stdout : stderr;
fprintf(o,
"Usage: latex-tables [<-h|-l|type>]\n\n"
"Generate LaTeX tables from some library internal data.\n\n"
"\ttype\tThe type of table to print.\n"
"\t-l\tList all built-in types that can be printed.\n"
"\t-h\tThe help you're looking at.\n"
);
exit(status);
}
int main(int argc, char **argv)
{
const struct {
const char *name;
int (*printer)(void);
} printers[] = {
#define PRINTER(name) { #name, print_ ## name }
PRINTER(hash_descriptors),
PRINTER(pem_ciphers),
PRINTER(ssh_ciphers),
PRINTER(ecc_curves),
#undef PRINTER
};
int err;
unsigned long n;
if (argc > 1) {
if (strstr(argv[1], "-h"))
die(0);
if (strstr(argv[1], "-l")) {
for (n = 0; n < LTC_ARRAY_SIZE(printers); ++n) {
printf("%s\n", printers[n].name);
}
return 0;
}
}
printf("libtomcrypt latex tables\n");
for (n = 0; n < LTC_ARRAY_SIZE(printers); ++n) {
if (argc > 1 && strstr(printers[n].name, argv[1]) == NULL)
continue;
if ((err = printers[n].printer()) != 0)
return err;
}
return 0;
}
#else
int main(void) { return EXIT_FAILURE; }
#endif

34
demos/ltc Executable file
View file

@ -0,0 +1,34 @@
#!/bin/sh
RELDIR="/$0"
RELDIR="${RELDIR%/*}"
RELDIR="${RELDIR:-.}"
RELDIR="${RELDIR##/}/"
BINDIR=`cd "$RELDIR"; pwd`
err_out() {
err=$1
shift
echo $* >&2
exit $err
}
usage() {
cat >&$(($1 + 1)) << EOF
Available commands are:
`ls -1 $BINDIR/ltc-* | sed "s@$BINDIR/ltc-@ @g"`
help
EOF
exit $1
}
[ $# -gt 0 ] || usage 1
TOOL="$1"
shift
[ "$TOOL" == "help" ] || [ "$TOOL" == "--help" ] || [ "$TOOL" == "-h" ] && usage 0
test -x "$BINDIR/ltc-$TOOL" || err_out 1 "Unknown command: $TOOL"
[ $# -gt 0 ] && "$BINDIR/ltc-$TOOL" "$@" || "$BINDIR/ltc-$TOOL"

View file

@ -1,110 +0,0 @@
/* test the multi helpers... */
#include <tomcrypt.h>
int main(void)
{
unsigned char key[16], buf[2][MAXBLOCKSIZE];
unsigned long len, len2;
/* register algos */
register_hash(&sha256_desc);
register_cipher(&aes_desc);
/* HASH testing */
len = sizeof(buf[0]);
hash_memory(find_hash("sha256"), (unsigned char*)"hello", 5, buf[0], &len);
len2 = sizeof(buf[0]);
hash_memory_multi(find_hash("sha256"), buf[1], &len2, (unsigned char*)"hello", 5, NULL);
if (len != len2 || memcmp(buf[0], buf[1], len)) {
printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
return EXIT_FAILURE;
}
len2 = sizeof(buf[0]);
hash_memory_multi(find_hash("sha256"), buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL, 0);
if (len != len2 || memcmp(buf[0], buf[1], len)) {
printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
return EXIT_FAILURE;
}
len2 = sizeof(buf[0]);
hash_memory_multi(find_hash("sha256"), buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
if (len != len2 || memcmp(buf[0], buf[1], len)) {
printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
return EXIT_FAILURE;
}
/* HMAC */
len = sizeof(buf[0]);
hmac_memory(find_hash("sha256"), key, 16, (unsigned char*)"hello", 5, buf[0], &len);
len2 = sizeof(buf[0]);
hmac_memory_multi(find_hash("sha256"), key, 16, buf[1], &len2, (unsigned char*)"hello", 5UL, NULL);
if (len != len2 || memcmp(buf[0], buf[1], len)) {
printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
return EXIT_FAILURE;
}
len2 = sizeof(buf[0]);
hmac_memory_multi(find_hash("sha256"), key, 16, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
if (len != len2 || memcmp(buf[0], buf[1], len)) {
printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
return EXIT_FAILURE;
}
len2 = sizeof(buf[0]);
hmac_memory_multi(find_hash("sha256"), key, 16, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
if (len != len2 || memcmp(buf[0], buf[1], len)) {
printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
return EXIT_FAILURE;
}
/* OMAC */
len = sizeof(buf[0]);
omac_memory(find_cipher("aes"), key, 16, (unsigned char*)"hello", 5, buf[0], &len);
len2 = sizeof(buf[0]);
omac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"hello", 5UL, NULL);
if (len != len2 || memcmp(buf[0], buf[1], len)) {
printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
return EXIT_FAILURE;
}
len2 = sizeof(buf[0]);
omac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
if (len != len2 || memcmp(buf[0], buf[1], len)) {
printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
return EXIT_FAILURE;
}
len2 = sizeof(buf[0]);
omac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
if (len != len2 || memcmp(buf[0], buf[1], len)) {
printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
return EXIT_FAILURE;
}
/* PMAC */
len = sizeof(buf[0]);
pmac_memory(find_cipher("aes"), key, 16, (unsigned char*)"hello", 5, buf[0], &len);
len2 = sizeof(buf[0]);
pmac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"hello", 5, NULL);
if (len != len2 || memcmp(buf[0], buf[1], len)) {
printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
return EXIT_FAILURE;
}
len2 = sizeof(buf[0]);
pmac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
if (len != len2 || memcmp(buf[0], buf[1], len)) {
printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
return EXIT_FAILURE;
}
len2 = sizeof(buf[0]);
pmac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
if (len != len2 || memcmp(buf[0], buf[1], len)) {
printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
return EXIT_FAILURE;
}
printf("All passed\n");
return EXIT_SUCCESS;
}
/* $Source$ */
/* $Revision$ */
/* $Date$ */

131
demos/openssh-privkey.c Normal file
View file

@ -0,0 +1,131 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
/**
@file openssh-privkey.c
OpenSSH Private Key decryption demo, Steffen Jaeckel
*/
#include <tomcrypt.h>
#include <stdarg.h>
#include <termios.h>
#if defined(LTC_PEM_SSH)
static void print_err(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
}
static void die_(int err, int line)
{
print_err("%3d: LTC sez %s\n", line, error_to_string(err));
exit(EXIT_FAILURE);
}
#define die(i) do { die_(i, __LINE__); } while(0)
#define DIE(s, ...) do { print_err("%3d: " s "\n", __LINE__, ##__VA_ARGS__); exit(EXIT_FAILURE); } while(0)
static char* getpassword(const char *prompt, size_t maxlen)
{
char *wr, *end, *pass = XCALLOC(1, maxlen + 1);
struct termios tio;
tcflag_t c_lflag;
if (pass == NULL)
return NULL;
wr = pass;
end = pass + maxlen;
tcgetattr(0, &tio);
c_lflag = tio.c_lflag;
tio.c_lflag &= ~ECHO;
tcsetattr(0, TCSANOW, &tio);
printf("%s", prompt);
fflush(stdout);
while (pass < end) {
int c = getchar();
if (c == '\r' || c == '\n' || c == -1)
break;
*wr++ = c;
}
tio.c_lflag = c_lflag;
tcsetattr(0, TCSAFLUSH, &tio);
printf("\n");
return pass;
}
static int password_get(void **p, unsigned long *l, void *u)
{
(void)u;
*p = getpassword("Enter passphrase: ", 256);
*l = strlen(*p);
return 0;
}
static void print(ltc_pka_key *k)
{
int err = CRYPT_OK;
unsigned char buf[256];
unsigned long lbuf = sizeof(buf);
char pubkey[256*4/3];
unsigned long lpubkey = sizeof(pubkey);
void *mpint = NULL;
switch (k->id) {
case LTC_PKA_ED25519:
ltc_mp.init(&mpint);
ltc_mp.unsigned_read(mpint, k->u.ed25519.pub, sizeof(k->u.ed25519.pub));
if ((err = ssh_encode_sequence_multi(buf, &lbuf,
LTC_SSHDATA_STRING, "ssh-ed25519", strlen("ssh-ed25519"),
LTC_SSHDATA_MPINT, mpint,
0, NULL)) != CRYPT_OK)
goto errout;
if ((err = base64_encode(buf, lbuf, pubkey, &lpubkey)) != CRYPT_OK)
goto errout;
printf("\rssh-ed25519 %s\n", pubkey);
break;
default:
print_err("Unsupported key type: %d\n", k->id);
break;
}
errout:
if (mpint != NULL)
ltc_mp.deinit(mpint);
if (err != CRYPT_OK)
die(err);
}
int main(int argc, char **argv)
{
int err;
FILE *f = NULL;
ltc_pka_key k;
password_ctx pw_ctx = { .callback = password_get };
if ((err = register_all_ciphers()) != CRYPT_OK) {
die(err);
}
if ((err = register_all_hashes()) != CRYPT_OK) {
die(err);
}
if ((err = crypt_mp_init("ltm")) != CRYPT_OK) {
die(err);
}
if (argc > 1) f = fopen(argv[1], "r");
else f = stdin;
if (f == NULL) DIE("fopen sez no");
if ((err = pem_decode_openssh_filehandle(f, &k, &pw_ctx))) {
die(err);
}
print(&k);
return EXIT_SUCCESS;
}
#else
int main(void) { return EXIT_FAILURE; }
#endif

385
demos/openssl-enc.c Normal file
View file

@ -0,0 +1,385 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
/*
* Demo to do the rough equivalent of:
*
* openssl enc -aes-256-cbc -pass pass:foobar -in infile -out outfile -p
*
* Compilation:
*
* $(CC) -I /path/to/headers -L .../libs \
* -o openssl-enc \
* openssl-enc.c -ltomcrypt
*
* Usage:
*
* ./openssl-enc <enc|dec> infile outfile "passphrase" [salt]
*
* If provided, the salt must be EXACTLY a 16-char hex string.
*
* Demo is an example of:
*
* - (When decrypting) yanking salt out of the OpenSSL "Salted__..." header
* - OpenSSL-compatible key derivation (in OpenSSL's modified PKCS#5v1 approach)
* - Grabbing an Initialization Vector from the key generator
* - Performing simple block encryption using AES
*
* This program is free for all purposes without any express guarantee it
* works. If you really want to see a license here, assume the WTFPL :-)
*
* BJ Black, bblack@barracuda.com, https://wjblack.com
*
* BUGS:
* Passing a password on a command line is a HORRIBLE idea. Don't use
* this program for serious work!
*/
#include <tomcrypt.h>
#include <termios.h>
#if !defined(LTC_RIJNDAEL) || !defined(LTC_CBC_MODE) || !defined(LTC_PKCS_5) || !defined(LTC_RNG_GET_BYTES) || !defined(LTC_MD5)
int main(void)
{
return -1;
}
#else
/* OpenSSL by default only runs one hash round */
#define OPENSSL_ITERATIONS 1
/* Use aes-256-cbc, so 256 bits of key, 128 of IV */
#define KEY_LENGTH (256>>3)
#define IV_LENGTH (128>>3)
/* PKCS#5v1 requires exactly an 8-byte salt */
#define SALT_LENGTH 8
/* The header OpenSSL puts on an encrypted file */
static char salt_header[] = { 'S', 'a', 'l', 't', 'e', 'd', '_', '_' };
#include <errno.h>
#include <stdio.h>
#include <string.h>
/* A simple way to handle the possibility that a block may increase in size
after padding. */
union paddable {
unsigned char unpad[1024];
unsigned char pad[1024+MAXBLOCKSIZE];
};
/*
* Print usage and exit with a bad status (and perror() if any errno).
*
* Input: argv[0] and the error string
* Output: <no return>
* Side Effects: print messages and barf (does exit(3))
*/
static void LTC_NORETURN barf(const char *pname, const char *err)
{
FILE* o = err == NULL ? stdout : stderr;
fprintf(o,
"Usage: %s <enc|dec> infile outfile [passphrase | -] [salt]\n"
"\n"
" The passphrase can either be given at the command line\n"
" or if it's passed as '-' it will be read interactively.\n"
"\n"
" # encrypts infile->outfile, random salt\n"
" %s enc infile outfile pass\n"
"\n"
" # encrypts infile->outfile, salt from cmdline\n"
" %s enc infile outfile pass 0123456789abcdef\n"
"\n"
" # decrypts infile->outfile, pulls salt from infile\n"
" %s dec infile outfile pass\n"
"\n"
" # decrypts infile->outfile, salt specified\n"
" # (don't try to read the salt from infile)\n"
" %s dec infile outfile pass 0123456789abcdef\n"
"\n"
"Application Error: %s\n", pname, pname, pname, pname, pname, err ? err : "None");
if(errno)
perror(
" System Error");
exit(err == NULL ? 0 : -1);
}
/*
* Parse the Salted__[+8 bytes] from an OpenSSL-compatible file header.
*
* Input: file to read from and a to put the salt in (exactly 8 bytes!)
* Output: CRYPT_OK if parsed OK, CRYPT_ERROR if not
* Side Effects: infile's read pointer += 16
*/
static int parse_openssl_header(FILE *in, unsigned char *out)
{
unsigned char tmp[SALT_LENGTH];
if(fread(tmp, 1, sizeof(tmp), in) != sizeof(tmp))
return CRYPT_ERROR;
if(memcmp(tmp, salt_header, sizeof(tmp)))
return CRYPT_ERROR;
if(fread(tmp, 1, sizeof(tmp), in) != sizeof(tmp))
return CRYPT_ERROR;
memcpy(out, tmp, sizeof(tmp));
return CRYPT_OK;
}
/*
* Dump a hexed stream of bytes (convenience func).
*
* Input: buf to read from, length
* Output: none
* Side Effects: bytes printed as a hex blob, no lf at the end
*/
static void dump_bytes(unsigned char *in, unsigned long len)
{
unsigned long idx;
for(idx=0; idx<len; idx++)
printf("%02hhX", *(in+idx));
}
/*
* Pad or unpad a message using PKCS#7 padding.
* Padding will add 1-(blocksize) bytes and unpadding will remove that amount.
* Set is_padding to 1 to pad, 0 to unpad.
*
* Input: paddable buffer, size read, block length of cipher, mode
* Output: number of bytes after padding resp. after unpadding
* Side Effects: none
*/
static size_t s_pkcs7_pad(union paddable *buf, size_t nb, int block_length,
int is_padding)
{
unsigned long length;
if(is_padding) {
length = sizeof(buf->pad);
if (padding_pad(buf->pad, nb, &length, LTC_PAD_PKCS7 | block_length) != CRYPT_OK)
return 0;
return length;
} else {
length = nb;
if (padding_depad(buf->pad, &length, LTC_PAD_PKCS7) != CRYPT_OK)
return 0;
return length;
}
}
/*
* Perform an encrypt/decrypt operation to/from files using AES+CBC+PKCS7 pad.
* Set encrypt to 1 to encrypt, 0 to decrypt.
*
* Input: in/out files, key, iv, and mode
* Output: CRYPT_OK if no error
* Side Effects: bytes slurped from infile, pushed to outfile, fds updated.
*/
static int do_crypt(FILE *infd, FILE *outfd, unsigned char *key, unsigned char *iv,
int encrypt)
{
union paddable inbuf, outbuf;
int cipher, ret;
symmetric_CBC cbc;
size_t nb;
/* Register your cipher! */
cipher = register_cipher(&aes_desc);
if(cipher == -1)
return CRYPT_INVALID_CIPHER;
/* Start a CBC session with cipher/key/val params */
ret = cbc_start(cipher, iv, key, KEY_LENGTH, 0, &cbc);
if( ret != CRYPT_OK )
return -1;
do {
/* Get bytes from the source */
nb = fread(inbuf.unpad, 1, sizeof(inbuf.unpad), infd);
if(!nb)
return encrypt ? CRYPT_OK : CRYPT_ERROR;
/* Barf if we got a read error */
if(ferror(infd))
return CRYPT_ERROR;
if(encrypt) {
/* We're encrypting, so pad first (if at EOF) and then
crypt */
if(feof(infd))
nb = s_pkcs7_pad(&inbuf, nb,
aes_desc.block_length, 1);
ret = cbc_encrypt(inbuf.pad, outbuf.pad, nb, &cbc);
if(ret != CRYPT_OK)
return ret;
} else {
/* We're decrypting, so decrypt and then unpad if at
EOF */
ret = cbc_decrypt(inbuf.unpad, outbuf.unpad, nb, &cbc);
if( ret != CRYPT_OK )
return ret;
if(feof(infd))
nb = s_pkcs7_pad(&outbuf, nb,
aes_desc.block_length, 0);
if(nb == 0)
/* The file didn't decrypt correctly */
return CRYPT_ERROR;
}
/* Push bytes to outfile */
if(fwrite(outbuf.unpad, 1, nb, outfd) != nb)
return CRYPT_ERROR;
} while(!feof(infd));
/* Close up */
cbc_done(&cbc);
return CRYPT_OK;
}
static char* getpassword(const char *prompt, size_t maxlen)
{
char *wr, *end, *pass = XCALLOC(1, maxlen + 1);
struct termios tio;
tcflag_t c_lflag;
if (pass == NULL)
return NULL;
wr = pass;
end = pass + maxlen;
tcgetattr(0, &tio);
c_lflag = tio.c_lflag;
tio.c_lflag &= ~ECHO;
tcsetattr(0, TCSANOW, &tio);
printf("%s", prompt);
fflush(stdout);
while (pass < end) {
int c = getchar();
if (c == '\r' || c == '\n' || c == -1)
break;
*wr++ = c;
}
tio.c_lflag = c_lflag;
tcsetattr(0, TCSAFLUSH, &tio);
printf("\n");
return pass;
}
/* Convenience macro for the various barfable places below */
#define BARF(a) { \
if(password) free(password); \
if(infd) fclose(infd); \
if(outfd) { fclose(outfd); remove(argv[3]); } \
barf(argv[0], a); \
}
/*
* The main routine. Mostly validate cmdline params, open files, run the KDF,
* and do the crypt.
*/
int main(int argc, char *argv[]) {
unsigned char salt[SALT_LENGTH];
FILE *infd = NULL, *outfd = NULL;
int encrypt = -1;
int hash = -1;
int ret;
unsigned char keyiv[KEY_LENGTH + IV_LENGTH];
unsigned long keyivlen = (KEY_LENGTH + IV_LENGTH);
unsigned char *key, *iv;
const void *pass;
char *password = NULL;
unsigned long saltlen = sizeof(salt);
if (argc > 1 && strstr(argv[1], "-h"))
barf(argv[0], NULL);
/* Check proper number of cmdline args */
if(argc < 5 || argc > 6)
BARF("Invalid number of arguments");
/* Check proper mode of operation */
if (!strncmp(argv[1], "enc", 3))
encrypt = 1;
else if(!strncmp(argv[1], "dec", 3))
encrypt = 0;
else
BARF("Bad command name");
/* Check we can open infile/outfile */
infd = fopen(argv[2], "rb");
if(infd == NULL)
BARF("Could not open infile");
outfd = fopen(argv[3], "wb");
if(outfd == NULL)
BARF("Could not open outfile");
/* Get the salt from wherever */
if(argc == 6) {
/* User-provided */
if(base16_decode(argv[5], strlen(argv[5]), salt, &saltlen) != CRYPT_OK)
BARF("Bad user-specified salt");
} else if(encrypt) {
/* Encrypting; get from RNG */
if(rng_get_bytes(salt, sizeof(salt), NULL) != sizeof(salt))
BARF("Not enough random data");
} else {
/* Parse from infile (decrypt only) */
if(parse_openssl_header(infd, salt) != CRYPT_OK)
BARF("Invalid OpenSSL header in infile");
}
/* Fetch the MD5 hasher for PKCS#5 */
hash = register_hash(&md5_desc);
if(hash == -1)
BARF("Could not register MD5 hash");
/* Set things to a sane initial state */
zeromem(keyiv, sizeof(keyiv));
key = keyiv + 0; /* key comes first */
iv = keyiv + KEY_LENGTH; /* iv comes next */
if (argv[4] && strcmp(argv[4], "-")) {
pass = argv[4];
} else {
password = getpassword("Enter password: ", 256);
if (!password)
BARF("Could not get password");
pass = password;
}
/* Run the key derivation from the provided passphrase. This gets us
the key and iv. */
ret = pkcs_5_alg1_openssl(pass, XSTRLEN(pass), salt,
OPENSSL_ITERATIONS, hash, keyiv, &keyivlen );
if(ret != CRYPT_OK)
BARF("Could not derive key/iv from passphrase");
/* Display the salt/key/iv like OpenSSL cmdline does when -p */
printf("salt="); dump_bytes(salt, sizeof(salt)); printf("\n");
printf("key="); dump_bytes(key, KEY_LENGTH); printf("\n");
printf("iv ="); dump_bytes(iv, IV_LENGTH ); printf("\n");
/* If we're encrypting, write the salt header as OpenSSL does */
if(!strncmp(argv[1], "enc", 3)) {
if(fwrite(salt_header, 1, sizeof(salt_header), outfd) !=
sizeof(salt_header) )
BARF("Error writing salt header to outfile");
if(fwrite(salt, 1, sizeof(salt), outfd) != sizeof(salt))
BARF("Error writing salt to outfile");
}
/* At this point, the files are open, the salt has been figured out,
and we're ready to pump data through crypt. */
/* Do the crypt operation */
if(do_crypt(infd, outfd, key, iv, encrypt) != CRYPT_OK)
BARF("Error during crypt operation");
/* Clean up */
if(password) free(password);
fclose(infd); fclose(outfd);
return 0;
}
#endif

70
demos/sizes.c Normal file
View file

@ -0,0 +1,70 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
#define _POSIX_C_SOURCE 200809L /* otherwise PATH_MAX + strdup are not defined for build with -std=c99 */
#include "tomcrypt.h"
#include <string.h>
#define basename(path) ( strrchr((path), '/') ? strrchr((path), '/') + 1 : strrchr((path), '\\') ? strrchr((path), '\\') + 1 : (path) )
/**
@file demo_crypt_sizes.c
Demo how to get various sizes to dynamic languages
like Python - Larry Bugbee, February 2013
*/
static void s_print_line(const char* cmd, const char* desc)
{
printf(" %-16s - %s\n", cmd, desc);
}
int main(int argc, char **argv)
{
if (argc == 1) {
/* given a specific size name, get and print its size */
char name[] = "ltc_hash_descriptor";
unsigned int size;
char *sizes_list;
unsigned int sizes_list_len;
if (crypt_get_size(name, &size) != 0) exit(EXIT_FAILURE);
printf("\n size of '%s' is %u \n\n", name, size);
/* get and print the length of the names (and sizes) list */
if (crypt_list_all_sizes(NULL, &sizes_list_len) != 0) exit(EXIT_FAILURE);
printf(" need to allocate %u bytes \n\n", sizes_list_len);
/* get and print the names (and sizes) list */
if ((sizes_list = malloc(sizes_list_len)) == NULL) exit(EXIT_FAILURE);
if (crypt_list_all_sizes(sizes_list, &sizes_list_len) != 0) exit(EXIT_FAILURE);
printf(" supported sizes:\n\n%s\n\n", sizes_list);
free(sizes_list);
} else if (argc == 2) {
if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) {
char* base = strdup(basename(argv[0]));
printf("Usage: %s [-a] [-s name]\n\n", base);
s_print_line("<no argument>", "The old behavior of the demo");
s_print_line("-a", "Only lists all sizes");
s_print_line("-s name", "List a single size given as argument");
s_print_line("-h", "The help you're looking at");
free(base);
} else if (strcmp(argv[1], "-a") == 0) {
char *sizes_list;
unsigned int sizes_list_len;
/* get and print the length of the names (and sizes) list */
if (crypt_list_all_sizes(NULL, &sizes_list_len) != 0) exit(EXIT_FAILURE);
/* get and print the names (and sizes) list */
if ((sizes_list = malloc(sizes_list_len)) == NULL) exit(EXIT_FAILURE);
if (crypt_list_all_sizes(sizes_list, &sizes_list_len) != 0) exit(EXIT_FAILURE);
printf("%s\n", sizes_list);
free(sizes_list);
}
} else if (argc == 3) {
if (strcmp(argv[1], "-s") == 0) {
unsigned int size;
if (crypt_get_size(argv[2], &size) != 0) exit(EXIT_FAILURE);
printf("%s,%u\n", argv[2], size);
}
}
return 0;
}

View file

@ -1,14 +1,16 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
/* small demo app that just includes a cipher/hash/prng */
#include <tomcrypt.h>
int main(void)
{
#ifdef LTC_RIJNDAEL
#ifdef ENCRYPT_ONLY
register_cipher(&rijndael_enc_desc);
#endif
#endif
register_prng(&yarrow_desc);
register_hash(&sha256_desc);
return 0;
}
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View file

@ -1,36 +0,0 @@
#include <tomcrypt_test.h>
int main(void)
{
int x;
reg_algs();
#ifdef USE_LTM
ltc_mp = ltm_desc;
#elif defined(USE_TFM)
ltc_mp = tfm_desc;
#elif defined(USE_GMP)
ltc_mp = gmp_desc;
#else
extern ltc_math_descriptor EXT_MATH_LIB;
ltc_mp = EXT_MATH_LIB;
#endif
printf("build == \n%s\n", crypt_build_settings);
printf("\nstore_test...."); fflush(stdout); x = store_test(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
printf("\ncipher_test..."); fflush(stdout); x = cipher_hash_test(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
printf("\nmodes_test...."); fflush(stdout); x = modes_test(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
printf("\nder_test......"); fflush(stdout); x = der_tests(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
printf("\nmac_test......"); fflush(stdout); x = mac_test(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
printf("\npkcs_1_test..."); fflush(stdout); x = pkcs_1_test(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
printf("\nrsa_test......"); fflush(stdout); x = rsa_test(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
printf("\necc_test......"); fflush(stdout); x = ecc_tests(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
printf("\ndsa_test......"); fflush(stdout); x = dsa_test(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
printf("\nkatja_test...."); fflush(stdout); x = katja_test(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
printf("\n");
return EXIT_SUCCESS;
}
/* $Source$ */
/* $Revision$ */
/* $Date$ */

File diff suppressed because it is too large Load diff

View file

@ -1,129 +1,24 @@
#include <tomcrypt.h>
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
#include "tomcrypt_private.h"
void reg_algs(void)
{
int err;
#define OPEN_FILE(f, o) do { \
o = fopen(f, "w"); \
if (o == NULL) { \
perror("can't open " f); \
return; \
} \
} while(0)
#ifdef RIJNDAEL
register_cipher (&aes_desc);
#endif
#ifdef BLOWFISH
register_cipher (&blowfish_desc);
#endif
#ifdef XTEA
register_cipher (&xtea_desc);
#endif
#ifdef RC5
register_cipher (&rc5_desc);
#endif
#ifdef RC6
register_cipher (&rc6_desc);
#endif
#ifdef SAFERP
register_cipher (&saferp_desc);
#endif
#ifdef TWOFISH
register_cipher (&twofish_desc);
#endif
#ifdef SAFER
register_cipher (&safer_k64_desc);
register_cipher (&safer_sk64_desc);
register_cipher (&safer_k128_desc);
register_cipher (&safer_sk128_desc);
#endif
#ifdef RC2
register_cipher (&rc2_desc);
#endif
#ifdef DES
register_cipher (&des_desc);
register_cipher (&des3_desc);
#endif
#ifdef CAST5
register_cipher (&cast5_desc);
#endif
#ifdef NOEKEON
register_cipher (&noekeon_desc);
#endif
#ifdef SKIPJACK
register_cipher (&skipjack_desc);
#endif
#ifdef ANUBIS
register_cipher (&anubis_desc);
#endif
#ifdef KHAZAD
register_cipher (&khazad_desc);
#endif
#ifdef TIGER
register_hash (&tiger_desc);
#endif
#ifdef MD2
register_hash (&md2_desc);
#endif
#ifdef MD4
register_hash (&md4_desc);
#endif
#ifdef MD5
register_hash (&md5_desc);
#endif
#ifdef SHA1
register_hash (&sha1_desc);
#endif
#ifdef SHA224
register_hash (&sha224_desc);
#endif
#ifdef SHA256
register_hash (&sha256_desc);
#endif
#ifdef SHA384
register_hash (&sha384_desc);
#endif
#ifdef SHA512
register_hash (&sha512_desc);
#endif
#ifdef RIPEMD128
register_hash (&rmd128_desc);
#endif
#ifdef RIPEMD160
register_hash (&rmd160_desc);
#endif
#ifdef WHIRLPOOL
register_hash (&whirlpool_desc);
#endif
#ifdef CHC_HASH
register_hash(&chc_desc);
if ((err = chc_register(register_cipher(&aes_desc))) != CRYPT_OK) {
printf("chc_register error: %s\n", error_to_string(err));
exit(EXIT_FAILURE);
}
#endif
#ifdef USE_LTM
ltc_mp = ltm_desc;
#elif defined(USE_TFM)
ltc_mp = tfm_desc;
#elif defined(USE_GMP)
ltc_mp = gmp_desc;
#else
extern ltc_math_descriptor EXT_MATH_LIB;
ltc_mp = EXT_MATH_LIB;
#endif
}
void hash_gen(void)
static void hash_gen(void)
{
unsigned char md[MAXBLOCKSIZE], *buf;
unsigned long outlen, x, y, z;
FILE *out;
int err;
out = fopen("hash_tv.txt", "w");
if (out == NULL) {
perror("can't open hash_tv");
}
OPEN_FILE("hash_tv.txt", out);
fprintf(out, "Hash Test Vectors:\n\nThese are the hashes of nn bytes '00 01 02 03 .. (nn-1)'\n\n");
for (x = 0; hash_descriptor[x].name != NULL; x++) {
buf = XMALLOC(2 * hash_descriptor[x].blocksize + 1);
@ -153,23 +48,23 @@ void hash_gen(void)
fclose(out);
}
void cipher_gen(void)
static void cipher_gen(void)
{
unsigned char *key, pt[MAXBLOCKSIZE];
unsigned long x, y, z, w;
int err, kl, lastkl;
FILE *out;
symmetric_key skey;
out = fopen("cipher_tv.txt", "w");
fprintf(out,
OPEN_FILE("cipher_tv.txt", out);
fprintf(out,
"Cipher Test Vectors\n\nThese are test encryptions with key of nn bytes '00 01 02 03 .. (nn-1)' and original PT of the same style.\n"
"The output of step N is used as the key and plaintext for step N+1 (key bytes repeated as required to fill the key)\n\n");
for (x = 0; cipher_descriptor[x].name != NULL; x++) {
fprintf(out, "Cipher: %s\n", cipher_descriptor[x].name);
/* three modes, smallest, medium, large keys */
lastkl = 10000;
for (y = 0; y < 3; y++) {
@ -182,7 +77,7 @@ void cipher_gen(void)
printf("keysize error: %s\n", error_to_string(err));
exit(EXIT_FAILURE);
}
if (kl == lastkl) break;
if (kl == lastkl) continue;
lastkl = kl;
fprintf(out, "Key Size: %d bytes\n", kl);
@ -199,7 +94,7 @@ void cipher_gen(void)
printf("setup error: %s\n", error_to_string(err));
exit(EXIT_FAILURE);
}
for (z = 0; (int)z < cipher_descriptor[x].block_length; z++) {
pt[z] = (unsigned char)z;
}
@ -226,25 +121,25 @@ void cipher_gen(void)
fprintf(out, "\n");
}
fclose(out);
}
}
void hmac_gen(void)
static void hmac_gen(void)
{
unsigned char key[MAXBLOCKSIZE], output[MAXBLOCKSIZE], *input;
int x, y, z, err;
FILE *out;
unsigned long len;
out = fopen("hmac_tv.txt", "w");
fprintf(out,
OPEN_FILE("hmac_tv.txt", out);
fprintf(out,
"HMAC Tests. In these tests messages of N bytes long (00,01,02,...,NN-1) are HMACed. The initial key is\n"
"of the same format (the same length as the HASH output size). The HMAC key in step N+1 is the HMAC output of\n"
"step N.\n\n");
for (x = 0; hash_descriptor[x].name != NULL; x++) {
fprintf(out, "HMAC-%s\n", hash_descriptor[x].name);
/* initial key */
for (y = 0; y < (int)hash_descriptor[x].hashsize; y++) {
key[y] = (y&255);
@ -255,7 +150,7 @@ void hmac_gen(void)
perror("Can't malloc memory");
exit(EXIT_FAILURE);
}
for (y = 0; y <= (int)(hash_descriptor[x].blocksize * 2); y++) {
for (z = 0; z < y; z++) {
input[z] = (unsigned char)(z & 255);
@ -279,17 +174,18 @@ void hmac_gen(void)
}
fclose(out);
}
void omac_gen(void)
#ifdef LTC_OMAC
static void omac_gen(void)
{
unsigned char key[MAXBLOCKSIZE], output[MAXBLOCKSIZE], input[MAXBLOCKSIZE*2+2];
int err, x, y, z, kl;
FILE *out;
unsigned long len;
out = fopen("omac_tv.txt", "w");
fprintf(out,
OPEN_FILE("omac_tv.txt", out);
fprintf(out,
"OMAC Tests. In these tests messages of N bytes long (00,01,02,...,NN-1) are OMAC'ed. The initial key is\n"
"of the same format (length specified per cipher). The OMAC key in step N+1 is the OMAC output of\n"
"step N (repeated as required to fill the array).\n\n");
@ -304,19 +200,23 @@ void omac_gen(void)
kl = cipher_descriptor[x].max_key_length;
}
fprintf(out, "OMAC-%s (%d byte key)\n", cipher_descriptor[x].name, kl);
/* initial key/block */
for (y = 0; y < kl; y++) {
key[y] = (y & 255);
}
for (y = 0; y <= (int)(cipher_descriptor[x].block_length*2); y++) {
for (z = 0; z < y; z++) {
input[z] = (unsigned char)(z & 255);
}
len = sizeof(output);
if ((err = omac_memory(x, key, kl, input, y, output, &len)) != CRYPT_OK) {
printf("Error omacing: %s\n", error_to_string(err));
printf("Error OMAC'ing: %s\n", error_to_string(err));
exit(EXIT_FAILURE);
}
if (len == 0) {
printf("Error OMAC'ing: zero length\n");
exit(EXIT_FAILURE);
}
fprintf(out, "%3d: ", y);
@ -334,19 +234,21 @@ void omac_gen(void)
}
fclose(out);
}
#endif
void pmac_gen(void)
#ifdef LTC_PMAC
static void pmac_gen(void)
{
unsigned char key[MAXBLOCKSIZE], output[MAXBLOCKSIZE], input[MAXBLOCKSIZE*2+2];
int err, x, y, z, kl;
FILE *out;
unsigned long len;
out = fopen("pmac_tv.txt", "w");
fprintf(out,
"PMAC Tests. In these tests messages of N bytes long (00,01,02,...,NN-1) are OMAC'ed. The initial key is\n"
"of the same format (length specified per cipher). The OMAC key in step N+1 is the OMAC output of\n"
OPEN_FILE("pmac_tv.txt", out);
fprintf(out,
"PMAC Tests. In these tests messages of N bytes long (00,01,02,...,NN-1) are PMAC'ed. The initial key is\n"
"of the same format (length specified per cipher). The PMAC key in step N+1 is the PMAC output of\n"
"step N (repeated as required to fill the array).\n\n");
for (x = 0; cipher_descriptor[x].name != NULL; x++) {
@ -359,19 +261,23 @@ void pmac_gen(void)
kl = cipher_descriptor[x].max_key_length;
}
fprintf(out, "PMAC-%s (%d byte key)\n", cipher_descriptor[x].name, kl);
/* initial key/block */
for (y = 0; y < kl; y++) {
key[y] = (y & 255);
}
for (y = 0; y <= (int)(cipher_descriptor[x].block_length*2); y++) {
for (z = 0; z < y; z++) {
input[z] = (unsigned char)(z & 255);
}
len = sizeof(output);
if ((err = pmac_memory(x, key, kl, input, y, output, &len)) != CRYPT_OK) {
printf("Error omacing: %s\n", error_to_string(err));
printf("Error PMACing: %s\n", error_to_string(err));
exit(EXIT_FAILURE);
}
if (len == 0) {
printf("Error PMAC'ing: zero length\n");
exit(EXIT_FAILURE);
}
fprintf(out, "%3d: ", y);
@ -389,16 +295,18 @@ void pmac_gen(void)
}
fclose(out);
}
#endif
void eax_gen(void)
#ifdef LTC_EAX_MODE
static void eax_gen(void)
{
int err, kl, x, y1, z;
FILE *out;
unsigned char key[MAXBLOCKSIZE], nonce[MAXBLOCKSIZE*2], header[MAXBLOCKSIZE*2],
unsigned char key[MAXBLOCKSIZE], nonce[MAXBLOCKSIZE*2], header[MAXBLOCKSIZE*2],
plaintext[MAXBLOCKSIZE*2], tag[MAXBLOCKSIZE];
unsigned long len;
out = fopen("eax_tv.txt", "w");
OPEN_FILE("eax_tv.txt", out);
fprintf(out, "EAX Test Vectors. Uses the 00010203...NN-1 pattern for header/nonce/plaintext/key. The outputs\n"
"are of the form ciphertext,tag for a given NN. The key for step N>1 is the tag of the previous\n"
"step repeated sufficiently.\n\n");
@ -418,7 +326,7 @@ void eax_gen(void)
for (z = 0; z < kl; z++) {
key[z] = (z & 255);
}
for (y1 = 0; y1 <= (int)(cipher_descriptor[x].block_length*2); y1++){
for (z = 0; z < y1; z++) {
plaintext[z] = (unsigned char)(z & 255);
@ -430,67 +338,8 @@ void eax_gen(void)
printf("Error EAX'ing: %s\n", error_to_string(err));
exit(EXIT_FAILURE);
}
fprintf(out, "%3d: ", y1);
for (z = 0; z < y1; z++) {
fprintf(out, "%02X", plaintext[z]);
}
fprintf(out, ", ");
for (z = 0; z <(int)len; z++) {
fprintf(out, "%02X", tag[z]);
}
fprintf(out, "\n");
/* forward the key */
for (z = 0; z < kl; z++) {
key[z] = tag[z % len];
}
}
fprintf(out, "\n");
}
fclose(out);
}
void ocb_gen(void)
{
int err, kl, x, y1, z;
FILE *out;
unsigned char key[MAXBLOCKSIZE], nonce[MAXBLOCKSIZE*2],
plaintext[MAXBLOCKSIZE*2], tag[MAXBLOCKSIZE];
unsigned long len;
out = fopen("ocb_tv.txt", "w");
fprintf(out, "OCB Test Vectors. Uses the 00010203...NN-1 pattern for nonce/plaintext/key. The outputs\n"
"are of the form ciphertext,tag for a given NN. The key for step N>1 is the tag of the previous\n"
"step repeated sufficiently. The nonce is fixed throughout.\n\n");
for (x = 0; cipher_descriptor[x].name != NULL; x++) {
kl = cipher_descriptor[x].block_length;
/* skip ciphers which do not have 64 or 128 bit block sizes */
if (kl != 8 && kl != 16) continue;
if (cipher_descriptor[x].keysize(&kl) != CRYPT_OK) {
kl = cipher_descriptor[x].max_key_length;
}
fprintf(out, "OCB-%s (%d byte key)\n", cipher_descriptor[x].name, kl);
/* the key */
for (z = 0; z < kl; z++) {
key[z] = (z & 255);
}
/* fixed nonce */
for (z = 0; z < cipher_descriptor[x].block_length; z++) {
nonce[z] = z;
}
for (y1 = 0; y1 <= (int)(cipher_descriptor[x].block_length*2); y1++){
for (z = 0; z < y1; z++) {
plaintext[z] = (unsigned char)(z & 255);
}
len = sizeof(tag);
if ((err = ocb_encrypt_authenticate_memory(x, key, kl, nonce, plaintext, y1, plaintext, tag, &len)) != CRYPT_OK) {
printf("Error OCB'ing: %s\n", error_to_string(err));
if (len == 0) {
printf("Error EAX'ing: zero length\n");
exit(EXIT_FAILURE);
}
fprintf(out, "%3d: ", y1);
@ -512,17 +361,90 @@ void ocb_gen(void)
}
fclose(out);
}
#endif
void ccm_gen(void)
#ifdef LTC_OCB3_MODE
static void ocb3_gen(void)
{
int err, kl, x, y1, z;
int err, kl, x, y1, z, noncelen;
FILE *out;
unsigned char key[MAXBLOCKSIZE], nonce[MAXBLOCKSIZE*2],
unsigned char key[MAXBLOCKSIZE], nonce[MAXBLOCKSIZE*2],
plaintext[MAXBLOCKSIZE*2], tag[MAXBLOCKSIZE];
unsigned long len;
out = fopen("ccm_tv.txt", "w");
OPEN_FILE("ocb3_tv.txt", out);
fprintf(out, "OCB3 Test Vectors. Uses the 00010203...NN-1 pattern for nonce/plaintext/key. The outputs\n"
"are of the form ciphertext,tag for a given NN. The key for step N>1 is the tag of the previous\n"
"step repeated sufficiently. The nonce is fixed throughout. AAD is fixed to 3 bytes (ASCII) 'AAD'.\n\n");
for (x = 0; cipher_descriptor[x].name != NULL; x++) {
kl = cipher_descriptor[x].block_length;
/* skip ciphers which do not have 64 or 128 bit block sizes */
if (kl != 16) continue;
if (cipher_descriptor[x].keysize(&kl) != CRYPT_OK) {
kl = cipher_descriptor[x].max_key_length;
}
fprintf(out, "OCB3-%s (%d byte key)\n", cipher_descriptor[x].name, kl);
/* the key */
for (z = 0; z < kl; z++) {
key[z] = (z & 255);
}
/* fixed nonce */
noncelen = MIN(15, cipher_descriptor[x].block_length);
for (z = 0; z < noncelen; z++) {
nonce[z] = z;
}
for (y1 = 0; y1 <= (int)(cipher_descriptor[x].block_length*2); y1++){
for (z = 0; z < y1; z++) {
plaintext[z] = (unsigned char)(z & 255);
}
len = 16;
if ((err = ocb3_encrypt_authenticate_memory(x, key, kl, nonce, noncelen, (unsigned char*)"AAD", 3, plaintext, y1, plaintext, tag, &len)) != CRYPT_OK) {
printf("Error OCB3'ing: %s\n", error_to_string(err));
exit(EXIT_FAILURE);
}
if (len == 0) {
printf("Error OCB3'ing: zero length\n");
exit(EXIT_FAILURE);
}
fprintf(out, "%3d: ", y1);
for (z = 0; z < y1; z++) {
fprintf(out, "%02X", plaintext[z]);
}
fprintf(out, ", ");
for (z = 0; z <(int)len; z++) {
fprintf(out, "%02X", tag[z]);
}
fprintf(out, "\n");
/* forward the key */
for (z = 0; z < kl; z++) {
key[z] = tag[z % len];
}
}
fprintf(out, "\n");
}
fclose(out);
}
#endif
#ifdef LTC_CCM_MODE
static void ccm_gen(void)
{
int err, kl, x, y1, z;
unsigned int t;
FILE *out;
unsigned char key[MAXBLOCKSIZE], nonce[MAXBLOCKSIZE*2],
plaintext[MAXBLOCKSIZE*2], tag[16];
unsigned long len;
const unsigned int taglen[] = {4, 6, 8, 10, 12, 14, 16};
OPEN_FILE("ccm_tv.txt", out);
fprintf(out, "CCM Test Vectors. Uses the 00010203...NN-1 pattern for nonce/header/plaintext/key. The outputs\n"
"are of the form ciphertext,tag for a given NN. The key for step N>1 is the tag of the previous\n"
"step repeated sufficiently. The nonce is fixed throughout at 13 bytes 000102...\n\n");
@ -547,44 +469,52 @@ void ccm_gen(void)
for (z = 0; z < cipher_descriptor[x].block_length; z++) {
nonce[z] = z;
}
for (y1 = 0; y1 <= (int)(cipher_descriptor[x].block_length*2); y1++){
for (z = 0; z < y1; z++) {
plaintext[z] = (unsigned char)(z & 255);
}
len = sizeof(tag);
if ((err = ccm_memory(x, key, kl, NULL, nonce, 13, plaintext, y1, plaintext, y1, plaintext, tag, &len, CCM_ENCRYPT)) != CRYPT_OK) {
printf("Error CCM'ing: %s\n", error_to_string(err));
exit(EXIT_FAILURE);
}
fprintf(out, "%3d: ", y1);
for (z = 0; z < y1; z++) {
fprintf(out, "%02X", plaintext[z]);
}
fprintf(out, ", ");
for (z = 0; z <(int)len; z++) {
fprintf(out, "%02X", tag[z]);
}
fprintf(out, "\n");
/* forward the key */
for (z = 0; z < kl; z++) {
key[z] = tag[z % len];
for (t = 0; t < LTC_ARRAY_SIZE(taglen); ++t) {
for (y1 = 0; y1 <= (int)(cipher_descriptor[x].block_length*2); y1++){
for (z = 0; z < y1; z++) {
plaintext[z] = (unsigned char)(z & 255);
}
len = taglen[t];
if ((err = ccm_memory(x, key, kl, NULL, nonce, 13, plaintext, y1, plaintext, y1, plaintext, tag, &len, CCM_ENCRYPT)) != CRYPT_OK) {
printf("Error CCM'ing: %s\n", error_to_string(err));
exit(EXIT_FAILURE);
}
if (len == 0) {
printf("Error CCM'ing: zero length\n");
exit(EXIT_FAILURE);
}
fprintf(out, "%3d: ", y1);
for (z = 0; z < y1; z++) {
fprintf(out, "%02X", plaintext[z]);
}
fprintf(out, ", ");
for (z = 0; z <(int)len; z++) {
fprintf(out, "%02X", tag[z]);
}
fprintf(out, "\n");
/* forward the key */
for (z = 0; z < kl; z++) {
key[z] = tag[z % len];
}
}
}
fprintf(out, "\n");
}
fclose(out);
}
#endif
void gcm_gen(void)
#ifdef LTC_GCM_MODE
static void gcm_gen(void)
{
int err, kl, x, y1, z;
FILE *out;
unsigned char key[MAXBLOCKSIZE], plaintext[MAXBLOCKSIZE*2], tag[MAXBLOCKSIZE];
unsigned long len;
out = fopen("gcm_tv.txt", "w");
OPEN_FILE("gcm_tv.txt", out);
fprintf(out, "GCM Test Vectors. Uses the 00010203...NN-1 pattern for nonce/header/plaintext/key. The outputs\n"
"are of the form ciphertext,tag for a given NN. The key for step N>1 is the tag of the previous\n"
"step repeated sufficiently. The nonce is fixed throughout at 13 bytes 000102...\n\n");
@ -604,8 +534,8 @@ void gcm_gen(void)
for (z = 0; z < kl; z++) {
key[z] = (z & 255);
}
for (y1 = 0; y1 <= (int)(cipher_descriptor[x].block_length*2); y1++){
for (y1 = 1; y1 <= (int)(cipher_descriptor[x].block_length*2); y1++){
for (z = 0; z < y1; z++) {
plaintext[z] = (unsigned char)(z & 255);
}
@ -614,6 +544,10 @@ void gcm_gen(void)
printf("Error GCM'ing: %s\n", error_to_string(err));
exit(EXIT_FAILURE);
}
if (len == 0) {
printf("Error GCM'ing: zero length\n");
exit(EXIT_FAILURE);
}
fprintf(out, "%3d: ", y1);
for (z = 0; z < y1; z++) {
fprintf(out, "%02X", plaintext[z]);
@ -633,18 +567,20 @@ void gcm_gen(void)
}
fclose(out);
}
#endif
void base64_gen(void)
static void base64_gen(void)
{
FILE *out;
unsigned char dst[256], src[32];
unsigned long x, y, len;
out = fopen("base64_tv.txt", "w");
unsigned char src[32], ch;
char dst[256];
unsigned long x, len;
OPEN_FILE("base64_tv.txt", out);
fprintf(out, "Base64 vectors. These are the base64 encodings of the strings 00,01,02...NN-1\n\n");
for (x = 0; x <= 32; x++) {
for (y = 0; y < x; y++) {
src[y] = y;
for (ch = 0; ch < x; ch++) {
src[ch] = ch;
}
len = sizeof(dst);
base64_encode(src, x, dst, &len);
@ -653,63 +589,66 @@ void base64_gen(void)
fclose(out);
}
void math_gen(void)
static void math_gen(void)
{
}
void ecc_gen(void)
static void ecc_gen(void)
{
FILE *out;
unsigned char str[512];
void *k, *order, *modulus;
void *k, *order, *modulus, *a;
ecc_point *G, *R;
int x;
out = fopen("ecc_tv.txt", "w");
OPEN_FILE("ecc_tv.txt", out);
fprintf(out, "ecc vectors. These are for kG for k=1,3,9,27,...,3**n until k > order of the curve outputs are <k,x,y> triplets\n\n");
G = ltc_ecc_new_point();
R = ltc_ecc_new_point();
mp_init(&k);
mp_init(&order);
mp_init(&modulus);
ltc_mp_init(&k);
ltc_mp_init(&order);
ltc_mp_init(&modulus);
ltc_mp_init(&a);
for (x = 0; ltc_ecc_sets[x].size != 0; x++) {
fprintf(out, "ECC-%d\n", ltc_ecc_sets[x].size*8);
mp_set(k, 1);
for (x = 0; ltc_ecc_curves[x].prime != NULL; x++) {
fprintf(out, "%s\n", ltc_ecc_curves[x].OID);
ltc_mp_set(k, 1);
mp_read_radix(order, (char *)ltc_ecc_sets[x].order, 16);
mp_read_radix(modulus, (char *)ltc_ecc_sets[x].prime, 16);
mp_read_radix(G->x, (char *)ltc_ecc_sets[x].Gx, 16);
mp_read_radix(G->y, (char *)ltc_ecc_sets[x].Gy, 16);
mp_set(G->z, 1);
ltc_mp_read_radix(order, ltc_ecc_curves[x].order, 16);
ltc_mp_read_radix(modulus, ltc_ecc_curves[x].prime, 16);
ltc_mp_read_radix(a, ltc_ecc_curves[x].A, 16);
ltc_mp_read_radix(G->x, ltc_ecc_curves[x].Gx, 16);
ltc_mp_read_radix(G->y, ltc_ecc_curves[x].Gy, 16);
ltc_mp_set(G->z, 1);
while (mp_cmp(k, order) == LTC_MP_LT) {
ltc_mp.ecc_ptmul(k, G, R, modulus, 1);
mp_tohex(k, (char*)str); fprintf(out, "%s, ", (char*)str);
mp_tohex(R->x, (char*)str); fprintf(out, "%s, ", (char*)str);
mp_tohex(R->y, (char*)str); fprintf(out, "%s\n", (char*)str);
mp_mul_d(k, 3, k);
while (ltc_mp_cmp(k, order) == LTC_MP_LT) {
ltc_mp.ecc_ptmul(k, G, R, a, modulus, 1);
ltc_mp_tohex(k, (char*)str); fprintf(out, "%s, ", (char*)str);
ltc_mp_tohex(R->x, (char*)str); fprintf(out, "%s, ", (char*)str);
ltc_mp_tohex(R->y, (char*)str); fprintf(out, "%s\n", (char*)str);
ltc_mp_mul_d(k, 3, k);
}
}
mp_clear_multi(k, order, modulus, NULL);
ltc_mp_deinit_multi(k, order, modulus, a, LTC_NULL);
ltc_ecc_del_point(G);
ltc_ecc_del_point(R);
fclose(out);
}
void lrw_gen(void)
#ifdef LTC_LRW_MODE
static void lrw_gen(void)
{
FILE *out;
unsigned char tweak[16], key[16], iv[16], buf[1024];
int x, y, err;
symmetric_LRW lrw;
/* initialize default key and tweak */
for (x = 0; x < 16; x++) {
tweak[x] = key[x] = iv[x] = x;
}
out = fopen("lrw_tv.txt", "w");
OPEN_FILE("lrw_tv.txt", out);
for (x = 16; x < (int)(sizeof(buf)); x += 16) {
if ((err = lrw_start(find_cipher("aes"), iv, key, 16, tweak, 0, &lrw)) != CRYPT_OK) {
fprintf(stderr, "Error starting LRW-AES: %s\n", error_to_string(err));
@ -760,27 +699,71 @@ void lrw_gen(void)
lrw_done(&lrw);
}
fclose(out);
}
}
#endif
int main(void)
static void LTC_NORETURN die(int status)
{
reg_algs();
FILE* o = status == EXIT_SUCCESS ? stdout : stderr;
fprintf(o,
"Usage: tv_gen [<-h>]\n\n"
"Generate the internal test-vectors.\n\n"
"\t-h\tThe help you're looking at.\n"
);
exit(status);
}
int main(int argc, char **argv)
{
if (argc > 1) {
if (strstr(argv[1], "-h")) {
die(EXIT_SUCCESS);
} else {
die(EXIT_FAILURE);
}
}
register_all_ciphers();
register_all_hashes();
register_all_prngs();
#ifdef USE_LTM
ltc_mp = ltm_desc;
#elif defined(USE_TFM)
ltc_mp = tfm_desc;
#elif defined(USE_GMP)
ltc_mp = gmp_desc;
#elif defined(EXT_MATH_LIB)
extern ltc_math_descriptor EXT_MATH_LIB;
ltc_mp = EXT_MATH_LIB;
#endif
printf("Generating hash vectors..."); fflush(stdout); hash_gen(); printf("done\n");
printf("Generating cipher vectors..."); fflush(stdout); cipher_gen(); printf("done\n");
printf("Generating HMAC vectors..."); fflush(stdout); hmac_gen(); printf("done\n");
#ifdef LTC_OMAC
printf("Generating OMAC vectors..."); fflush(stdout); omac_gen(); printf("done\n");
#endif
#ifdef LTC_PMAC
printf("Generating PMAC vectors..."); fflush(stdout); pmac_gen(); printf("done\n");
#endif
#ifdef LTC_EAX_MODE
printf("Generating EAX vectors..."); fflush(stdout); eax_gen(); printf("done\n");
printf("Generating OCB vectors..."); fflush(stdout); ocb_gen(); printf("done\n");
#endif
#ifdef LTC_OCB3_MODE
printf("Generating OCB3 vectors..."); fflush(stdout); ocb3_gen(); printf("done\n");
#endif
#ifdef LTC_CCM_MODE
printf("Generating CCM vectors..."); fflush(stdout); ccm_gen(); printf("done\n");
#endif
#ifdef LTC_GCM_MODE
printf("Generating GCM vectors..."); fflush(stdout); gcm_gen(); printf("done\n");
#endif
printf("Generating BASE64 vectors..."); fflush(stdout); base64_gen(); printf("done\n");
printf("Generating MATH vectors..."); fflush(stdout); math_gen(); printf("done\n");
printf("Generating ECC vectors..."); fflush(stdout); ecc_gen(); printf("done\n");
if (ltc_mp.name != NULL) {
printf("Generating MATH vectors..."); fflush(stdout); math_gen(); printf("done\n");
printf("Generating ECC vectors..."); fflush(stdout); ecc_gen(); printf("done\n");
}
#ifdef LTC_LRW_MODE
printf("Generating LRW vectors..."); fflush(stdout); lrw_gen(); printf("done\n");
#endif
return 0;
}
/* $Source$ */
/* $Revision$ */
/* $Date$ */

2429
doc/Doxyfile Normal file

File diff suppressed because it is too large Load diff

Binary file not shown.

11325
doc/crypt.tex Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,10 +0,0 @@
<hr width="80%">
Code by <a href="http://www.libtomcrypt.com/">Tom</a><br>
Docs using <img src="doxygen.png" alt="doxygen" align="middle" border=0>
<a href="http://jlcooke.ca/tom/hidden_image.png">
<!--
/* $Source: /cvs/libtom/libtomcrypt/doc/footer.html,v $ */
/* $Revision: 1.4 $ */
/* $Date: 2006/03/31 14:15:34 $ */
-->

View file

@ -1,12 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>LibTomCrypt: Main Page</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.8 -->
<!--
/* $Source: /cvs/libtom/libtomcrypt/doc/header.html,v $ */
/* $Revision: 1.3 $ */
/* $Date: 2005/05/07 10:09:20 $ */
-->

BIN
doc/libtomsm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

63
doc/makefile Normal file
View file

@ -0,0 +1,63 @@
ifeq ($V,1)
silent=
silent_stdout=
else
silent=@
silent_stdout= > /dev/null
endif
#Files left over from making the crypt.pdf.
LEFTOVERS=*.dvi *.log *.aux *.toc *.idx *.ilg *.ind *.out *.lof
#build the doxy files (requires Doxygen, tetex and patience)
.PHONY: doxygen
doxygen:
doxygen $(silent_stdout)
patched_doxygen:
(cat Doxyfile && echo "HAVE_DOT=no") | doxygen - $(silent_stdout)
doxy: patched_doxygen
${MAKE} -C doxygen/latex $(silent_stdout) && mv -f doxygen/latex/refman.pdf .
@echo The huge doxygen PDF should be available as doc/refman.pdf
#This builds the crypt.pdf file. Note that the rm -f *.pdf has been removed
#from the clean command! This is because most people would like to keep the
#nice pre-compiled crypt.pdf that comes with libtomcrypt! We only need to
#delete it if we are rebuilding it.
docs crypt.pdf: crypt.tex
rm -f crypt.pdf $(LEFTOVERS)
cp crypt.tex crypt.bak
touch -r crypt.tex crypt.bak
(printf "%s" "\def\fixedpdfdate{"; date +'D:%Y%m%d%H%M%S%:z' -u -d @$${SOURCE_DATE_EPOCH:-$$(stat --format=%Y crypt.tex)} | sed "s/:\([0-9][0-9]\)$$/'\1'}/g") > crypt-deterministic.tex
printf "%s\n" "\pdfinfo{" >> crypt-deterministic.tex
printf "%s\n" " /CreationDate (\fixedpdfdate)" >> crypt-deterministic.tex
printf "%s\n}\n" " /ModDate (\fixedpdfdate)" >> crypt-deterministic.tex
cat crypt.tex >> crypt-deterministic.tex
mv crypt-deterministic.tex crypt.tex
touch -r crypt.bak crypt.tex
echo "hello" > crypt.ind
latex crypt $(silent_stdout)
latex crypt $(silent_stdout)
makeindex crypt.idx $(silent_stdout)
perl ../helper.pl --fixupind crypt.ind
pdflatex crypt $(silent_stdout)
sed -b -i 's,^/ID \[.*\]$$,/ID [<0> <0>],g' crypt.pdf
mv crypt.bak crypt.tex
rm -f $(LEFTOVERS)
docdvi: crypt.tex
echo hello > crypt.ind
latex crypt $(silent_stdout)
latex crypt $(silent_stdout)
makeindex crypt.idx
perl ../helper.pl --fixupind crypt.ind
latex crypt $(silent_stdout)
latex crypt $(silent_stdout)
termdoc: docdvi
dvi2tty crypt.dvi -w120
clean:
${silent} rm -f $(LEFTOVERS)
${silent} rm -rf doxygen/

View file

@ -1,30 +0,0 @@
#!/usr/bin/perl
# we want to filter every between START_INS and END_INS out and then insert crap from another file (this is fun)
$dst = shift;
$ins = shift;
open(SRC,"<$dst");
open(INS,"<$ins");
open(TMP,">tmp.delme");
$l = 0;
while (<SRC>) {
if ($_ =~ /START_INS/) {
print TMP $_;
$l = 1;
while (<INS>) {
print TMP $_;
}
close INS;
} elsif ($_ =~ /END_INS/) {
print TMP $_;
$l = 0;
} elsif ($l == 0) {
print TMP $_;
}
}
close TMP;
close SRC;

View file

@ -1,10 +0,0 @@
#!/bin/bash
# aes_tab.o is a pseudo object as it's made from aes.o and MPI is optional
export a=`echo -n "src/ciphers/aes/aes_enc.o " ; find . -type f | sort | grep "[.]/src" | grep "[.]c" | grep -v "sha224" | grep -v "sha384" | grep -v "aes_tab" | grep -v "twofish_tab" | grep -v "whirltab" | grep -v "dh_sys" | grep -v "ecc_sys" | grep -v "mpi[.]c" | grep -v "sober128tab" | sed -e 'sE\./EE' | sed -e 's/\.c/\.o/' | xargs`
perl ./parsenames.pl OBJECTS "$a"
export a=`find . -type f | grep [.]/src | grep [.]h | sed -e 'se\./ee' | xargs`
perl ./parsenames.pl HEADERS "$a"
# $Source: /cvs/libtom/libtomcrypt/genlist.sh,v $
# $Revision: 1.4 $
# $Date: 2005/07/17 23:15:12 $

409
helper.pl Executable file
View file

@ -0,0 +1,409 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long;
use File::Find 'find';
use File::Basename 'basename';
use File::Glob 'bsd_glob';
sub read_file {
my $f = shift;
open my $fh, "<", $f or die "FATAL: read_rawfile() cannot open file '$f': $!";
binmode $fh;
return do { local $/; <$fh> };
}
sub write_file {
my ($f, $data) = @_;
die "FATAL: write_file() no data" unless defined $data;
open my $fh, ">", $f or die "FATAL: write_file() cannot open file '$f': $!";
binmode $fh;
print $fh $data or die "FATAL: write_file() cannot write to '$f': $!";
close $fh or die "FATAL: write_file() cannot close '$f': $!";
return;
}
sub check_source {
my @all_files = (bsd_glob("makefile*"), bsd_glob("*.sh"), bsd_glob("*.pl"));
find({ wanted=>sub { push @all_files, $_ if -f $_ }, no_chdir=>1 }, qw/src tests demos/);
my $fails = 0;
for my $file (sort @all_files) {
next unless $file =~ /\.(c|h|pl|py|sh)$/ || basename($file) =~ /^makefile/i;
my $troubles = {};
my $lineno = 1;
my $content = read_file($file);
push @{$troubles->{crlf_line_end}}, '?' if $content =~ /\r/;
for my $l (split /\n/, $content) {
push @{$troubles->{merge_conflict}}, $lineno if $l =~ /^(<<<<<<<|=======|>>>>>>>)([^<=>]|$)/;
push @{$troubles->{trailing_space}}, $lineno if $l =~ / $/;
push @{$troubles->{tab}}, $lineno if $l =~ /\t/ && basename($file) !~ /^makefile/i;
push @{$troubles->{non_ascii_char}}, $lineno if $l =~ /[^[:ascii:]]/;
push @{$troubles->{cpp_comment}}, $lineno if $file =~ /\.(c|h)$/ && ($l =~ /\s\/\// || $l =~ /\/\/\s/);
# in ./src we prefer using XMEMCPY, XMALLOC, XFREE ...
push @{$troubles->{unwanted_memcpy}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bmemcpy\s*\(/;
push @{$troubles->{unwanted_malloc}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bmalloc\s*\(/;
push @{$troubles->{unwanted_realloc}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\brealloc\s*\(/;
push @{$troubles->{unwanted_calloc}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bcalloc\s*\(/;
push @{$troubles->{unwanted_free}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /[^>.]\bfree\s*\(/;
push @{$troubles->{unwanted_memset}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bmemset\s*\(/;
push @{$troubles->{unwanted_memcpy}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bmemcpy\s*\(/;
push @{$troubles->{unwanted_memmove}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bmemmove\s*\(/;
push @{$troubles->{unwanted_memcmp}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bmemcmp\s*\(/;
push @{$troubles->{unwanted_strcmp}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bstrcmp\s*\(/;
push @{$troubles->{unwanted_strcpy}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bstrcpy\s*\(/;
push @{$troubles->{unwanted_strlen}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bstrlen\s*\(/;
push @{$troubles->{unwanted_strncpy}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bstrncpy\s*\(/;
push @{$troubles->{unwanted_clock}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bclock\s*\(/;
push @{$troubles->{unwanted_qsort}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bqsort\s*\(/;
push @{$troubles->{sizeof_no_brackets}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bsizeof\s*[^\(]/;
if ($file =~ m|src/.*\.c$| &&
$file !~ m|src/ciphers/.*\.c$| &&
$file !~ m|src/math/.+_desc.c$| &&
$file !~ m|src/pk/ec25519/tweetnacl.c$| &&
$file !~ m|src/stream/sober128/sober128_stream.c$| &&
$l =~ /^static(\s+[a-zA-Z0-9_]+)+\s++([^s][a-zA-Z0-9_]+)\s*\(/) {
push @{$troubles->{staticfunc_name}}, "$2";
}
if ($file =~ m|src/.*\.[ch]$| && $l =~ /^\s*#\s*define\s+(_[A-Z_][a-zA-Z0-9_]*)\b/) {
my $n = $1;
push @{$troubles->{invalid_macro_name}}, "$lineno($n)"
unless ($file eq 'src/headers/tomcrypt_cfg.h' && $n eq '__has_builtin') ||
($file eq 'src/headers/tomcrypt_cfg.h' && $n eq '__has_attribute') ||
($file eq 'src/headers/tomcrypt_cfg.h' && $n eq '_WIN32_WINNT') ||
($file eq 'src/prngs/rng_get_bytes.c' && $n eq '_WIN32_WINNT');
}
$lineno++;
}
for my $k (sort keys %$troubles) {
warn "[$k] $file line:" . join(",", @{$troubles->{$k}}) . "\n";
$fails++;
}
}
warn( $fails > 0 ? "check-source: FAIL $fails\n" : "check-source: PASS\n" );
return $fails;
}
sub check_defines {
my $fails = 0;
my $cust_h = read_file("src/headers/tomcrypt_custom.h");
my $cryp_c = read_file("src/misc/crypt/crypt.c");
$cust_h =~ s|/\*.*?\*/||sg; # remove comments
$cryp_c =~ s|/\*.*?\*/||sg; # remove comments
my %def = map { $_ => 1 } map { my $x = $_; $x =~ s/^\s*#define\s+(LTC_\S+).*$/$1/; $x } grep { /^\s*#define\s+LTC_\S+/ } split /\n/, $cust_h;
for my $d (sort keys %def) {
next if $d =~ /^LTC_(DH\d+|ECC\d+|ECC_\S+|MPI|MUTEX_\S+\(x\)|NO_\S+)$/;
warn "$d missing in src/misc/crypt/crypt.c\n" and $fails++ if $cryp_c !~ /\Q$d\E/;
}
warn( $fails > 0 ? "check-defines: FAIL $fails\n" : "check-defines: PASS\n" );
return $fails;
}
sub check_descriptor {
my $which = shift;
my $what = shift;
my @src;
my @descriptors;
find({ wanted => sub { push @src, $_ if $_ =~ /\.c$/ }, no_chdir=>1 }, "./src/${which}/");
for my $f (@src) {
my @n = map { my $x = $_; $x =~ s/^.*?ltc_${what}_descriptor\s+(\S+).*$/$1/; $x } grep { $_ =~ /^[^()]*ltc_${what}_descriptor/ } split /\n/, read_file($f);
push @descriptors, @n if @n;
}
my $fails = 0;
for my $d (@descriptors) {
for my $f ("./src/misc/crypt/crypt_register_all_${which}.c") {
my $txt = read_file($f);
warn "$d missing in $f\n" and $fails++ if $txt !~ /\Q$d\E/;
}
}
for my $d (@descriptors) {
for my $f ("./tests/test.c") {
my $txt = read_file($f);
warn "$d missing in $f\n" and $fails++ if $txt !~ /\Q$d\E/;
}
}
my $name = sprintf("%-17s", "check-${which}:");
warn( $fails > 0 ? "${name}FAIL $fails\n" : "${name}PASS\n" );
return $fails;
}
sub check_descriptors {
my $fails = 0;
$fails = $fails + check_descriptor("ciphers", "cipher");
$fails = $fails + check_descriptor("hashes", "hash");
$fails = $fails + check_descriptor("prngs", "prng");
return $fails;
}
sub check_comments {
my $fails = 0;
my $first_comment = <<'MARKER';
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
MARKER
my @all_files;
find({ wanted=> sub { push @all_files, $_ if $_ =~ /\.(c|h)$/ }, no_chdir=>1 }, 'demos', 'src', 'tests');
for my $f (@all_files) {
my $txt = read_file($f);
if ($txt !~ /^\Q$first_comment\E/s) {
warn "[first_comment] $f\n";
$fails++;
}
}
warn( $fails > 0 ? "check-comments: FAIL $fails\n" : "check-comments: PASS\n" );
return $fails;
}
sub prepare_variable {
my ($varname, @list) = @_;
my $output = "$varname=";
my $len = length($output);
foreach my $obj (sort @list) {
$len = $len + length $obj;
$obj =~ s/\*/\$/;
if ($len > 100) {
$output .= "\\\n";
$len = length $obj;
}
$output .= $obj . ' ';
}
$output =~ s/ $//;
return $output;
}
sub prepare_msvc_files_xml {
my ($all, $exclude_re, $targets) = @_;
my $last = [];
my $depth = 2;
# sort files in the same order as visual studio (ugly, I know)
my @parts = ();
for my $orig (@$all) {
my $p = $orig;
$p =~ s|/|/~|g;
$p =~ s|/~([^/]+)$|/$1|g;
# now we have: 'src/pk/rsa/rsa_verify_hash.c' > 'src/~pk/~rsa/rsa_verify_hash.c'
my @l = map { sprintf "% -99s", $_ } split /\//, $p;
push @parts, [ $orig, join(':', @l) ];
}
my @sorted = map { $_->[0] } sort { $a->[1] cmp $b->[1] } @parts;
my $files = "<Files>\r\n";
for my $full (@sorted) {
my @items = split /\//, $full; # split by '/'
$full =~ s|/|\\|g; # replace '/' bt '\'
shift @items; # drop first one (src)
pop @items; # drop last one (filename.ext)
my $current = \@items;
if (join(':', @$current) ne join(':', @$last)) {
my $common = 0;
$common++ while ($last->[$common] && $current->[$common] && $last->[$common] eq $current->[$common]);
my $back = @$last - $common;
if ($back > 0) {
$files .= ("\t" x --$depth) . "</Filter>\r\n" for (1..$back);
}
my $fwd = [ @$current ]; splice(@$fwd, 0, $common);
for my $i (0..scalar(@$fwd) - 1) {
$files .= ("\t" x $depth) . "<Filter\r\n";
$files .= ("\t" x $depth) . "\tName=\"$fwd->[$i]\"\r\n";
$files .= ("\t" x $depth) . "\t>\r\n";
$depth++;
}
$last = $current;
}
$files .= ("\t" x $depth) . "<File\r\n";
$files .= ("\t" x $depth) . "\tRelativePath=\"$full\"\r\n";
$files .= ("\t" x $depth) . "\t>\r\n";
if ($full =~ $exclude_re) {
for (@$targets) {
$files .= ("\t" x $depth) . "\t<FileConfiguration\r\n";
$files .= ("\t" x $depth) . "\t\tName=\"$_\"\r\n";
$files .= ("\t" x $depth) . "\t\tExcludedFromBuild=\"true\"\r\n";
$files .= ("\t" x $depth) . "\t\t>\r\n";
$files .= ("\t" x $depth) . "\t\t<Tool\r\n";
$files .= ("\t" x $depth) . "\t\t\tName=\"VCCLCompilerTool\"\r\n";
$files .= ("\t" x $depth) . "\t\t\tAdditionalIncludeDirectories=\"\"\r\n";
$files .= ("\t" x $depth) . "\t\t\tPreprocessorDefinitions=\"\"\r\n";
$files .= ("\t" x $depth) . "\t\t/>\r\n";
$files .= ("\t" x $depth) . "\t</FileConfiguration>\r\n";
}
}
########### aes_enc "hack" disabled - discussion: https://github.com/libtom/libtomcrypt/pull/158
# if ($full eq 'src\ciphers\aes\aes.c') { #hack
# my %cmd = (
# 'Debug|Win32' => [ 'Debug/aes.obj;Debug/aes_enc.obj', 'cl /nologo /MLd /W3 /Gm /GX /ZI /Od /I &quot;src\headers&quot; /I &quot;..\libtommath&quot; /D &quot;_DEBUG&quot; /D &quot;LTM_DESC&quot; /D &quot;WIN32&quot; /D &quot;_MBCS&quot; /D &quot;_LIB&quot; /D /D &quot;USE_LTM&quot; /Fp&quot;Debug/libtomcrypt.pch&quot; /YX /Fo&quot;Debug/&quot; /Fd&quot;Debug/&quot; /FD /GZ /c $(InputPath)&#x0D;&#x0A;cl /nologo /DENCRYPT_ONLY /MLd /W3 /Gm /GX /ZI /Od /I &quot;src\headers&quot; /I &quot;..\libtommath&quot; /D &quot;_DEBUG&quot; /D &quot;LTM_DESC&quot; /D &quot;WIN32&quot; /D &quot;_MBCS&quot; /D &quot;_LIB&quot; /D /D &quot;USE_LTM&quot; /Fp&quot;Debug/libtomcrypt.pch&quot; /YX /Fo&quot;Debug/aes_enc.obj&quot; /Fd&quot;Debug/&quot; /FD /GZ /c $(InputPath)&#x0D;&#x0A;' ],
# 'Release|Win32' => [ 'Release/aes.obj;Release/aes_enc.obj', 'cl /nologo /MLd /W3 /Gm /GX /ZI /Od /I &quot;src\headers&quot; /I &quot;..\libtommath&quot; /D &quot;_DEBUG&quot; /D &quot;LTM_DESC&quot; /D &quot;WIN32&quot; /D &quot;_MBCS&quot; /D &quot;_LIB&quot; /D /D &quot;USE_LTM&quot; /Fp&quot;Release/libtomcrypt.pch&quot; /YX /Fo&quot;Release/&quot; /Fd&quot;Release/&quot; /FD /GZ /c $(InputPath)&#x0D;&#x0A;cl /nologo /DENCRYPT_ONLY /MLd /W3 /Gm /GX /ZI /Od /I &quot;src\headers&quot; /I &quot;..\libtommath&quot; /D &quot;_DEBUG&quot; /D &quot;LTM_DESC&quot; /D &quot;WIN32&quot; /D &quot;_MBCS&quot; /D &quot;_LIB&quot; /D /D &quot;USE_LTM&quot; /Fp&quot;Release/libtomcrypt.pch&quot; /YX /Fo&quot;Release/aes_enc.obj&quot; /Fd&quot;Release/&quot; /FD /GZ /c $(InputPath)&#x0D;&#x0A;' ],
# );
# for (@$targets) {
# next unless $cmd{$_};
# $files .= ("\t" x $depth) . "\t<FileConfiguration\r\n";
# $files .= ("\t" x $depth) . "\t\tName=\"$_\"\r\n";
# $files .= ("\t" x $depth) . "\t\t>\r\n";
# $files .= ("\t" x $depth) . "\t\t<Tool\r\n";
# $files .= ("\t" x $depth) . "\t\t\tName=\"VCCustomBuildTool\"\r\n";
# $files .= ("\t" x $depth) . "\t\t\tCommandLine=\"$cmd{$_}[1]\"\r\n";
# $files .= ("\t" x $depth) . "\t\t\tOutputs=\"$cmd{$_}[0]\"\r\n";
# $files .= ("\t" x $depth) . "\t\t/>\r\n";
# $files .= ("\t" x $depth) . "\t</FileConfiguration>\r\n";
# }
# }
$files .= ("\t" x $depth) . "</File>\r\n";
}
$files .= ("\t" x --$depth) . "</Filter>\r\n" for (@$last);
$files .= "\t</Files>";
return $files;
}
sub patch_file {
my ($content, @variables) = @_;
for my $v (@variables) {
if ($v =~ /^([A-Z0-9_]+)\s*=.*$/si) {
my $name = $1;
$content =~ s/\n\Q$name\E\b.*?[^\\]\n/\n$v\n/s;
}
else {
die "patch_file failed: " . substr($v, 0, 30) . "..";
}
}
return $content;
}
sub version_from_tomcrypt_h {
my $h = read_file(shift);
if ($h =~ /\n#define\s*SCRYPT\s*"([0-9]+)\.([0-9]+)\.([0-9]+)(\S*)"/s) {
return "VERSION_PC=$1.$2.$3", "VERSION_MAJOR=1", "VERSION_MINOR=0", "VERSION_PATCH=1", "VERSION=$1.$2.$3$4", "PROJECT_NUMBER=$1.$2.$3$4";
}
else {
die "#define SCRYPT not found in tomcrypt.h";
}
}
sub make_sources_cmake {
my ($list, $pub_headers) = @_;
my $output = "set(SOURCES\n";
foreach my $obj (sort @$list) {
$output .= $obj . "\n";
}
$output .= ")\n\n";
if ($pub_headers eq "") {
return $output;
}
$output .= "set(PUBLIC_HEADERS\n";
foreach my $obj (sort @$pub_headers) {
$output .= $obj . "\n";
}
$output .= ")\n\nset(PRIVATE_HEADERS src/headers/tomcrypt_private.h)\n";
$output .= "set_property(GLOBAL PROPERTY PUBLIC_HEADERS \$\{PUBLIC_HEADERS\}\)\n\n";
return $output;
}
sub process_makefiles {
my $write = shift;
my $changed_count = 0;
my @c = ();
find({ no_chdir => 1, wanted => sub { push @c, $_ if -f $_ && $_ =~ /\.c$/ && $_ !~ /tab.c$/ } }, 'src');
my @h = ();
find({ no_chdir => 1, wanted => sub { push @h, $_ if -f $_ && $_ =~ /\.h$/ && $_ !~ /dh_static.h$/ && $_ !~ /tomcrypt_private.h$/ } }, 'src');
my @all = ();
find({ no_chdir => 1, wanted => sub { push @all, $_ if -f $_ && $_ =~ /\.(c|h)$/ } }, 'src');
my @t = qw();
find({ no_chdir => 1, wanted => sub { push @t, $_ if $_ =~ /(common|no_prng|_tests?|test).c$/ } }, 'tests');
my @o = sort ('src/ciphers/aes/aes_enc.o', 'src/ciphers/aes/aes_enc_desc.o', map { my $x = $_; $x =~ s/\.c$/.o/; $x } @c);
my $var_o = prepare_variable("OBJECTS", @o);
my $var_h = prepare_variable("HEADERS_PUB", (sort @h));
(my $var_obj = $var_o) =~ s/\.o\b/.obj/sg;
my @t_srcs = sort (map { my $x = $_; $x =~ s/^tests\///; $x } @t);
my $var_to = prepare_variable("TOBJECTS", sort map { my $x = $_; $x =~ s/\.c$/.o/; $x } @t);
(my $var_tobj = $var_to) =~ s/\.o\b/.obj/sg;
my @ver_version = version_from_tomcrypt_h("src/headers/tomcrypt.h");
# update MSVC project files
my $msvc_files = prepare_msvc_files_xml(\@all, qr/tab\.c$/, ['Debug|Win32', 'Release|Win32', 'Debug|x64', 'Release|x64']);
for my $m (qw/libtomcrypt_VS2008.vcproj/) {
my $old = read_file($m);
my $new = $old;
$new =~ s|<Files>.*</Files>|$msvc_files|s;
if ($old ne $new) {
write_file($m, $new) if $write;
warn "changed: $m\n";
$changed_count++;
}
}
# update OBJECTS + HEADERS in makefile*
for my $m (qw/ makefile makefile.shared makefile.unix makefile.mingw makefile.msvc makefile_include.mk doc\/Doxyfile sources.cmake tests\/sources.cmake /) {
my $old = read_file($m);
my $new = $m eq 'makefile.msvc' ? patch_file($old, $var_obj, $var_h, $var_tobj, @ver_version)
: $m eq 'sources.cmake' ? make_sources_cmake(\@all, \@h)
: $m eq 'tests/sources.cmake' ? make_sources_cmake(\@t_srcs, "")
: patch_file($old, $var_o, $var_h, $var_to, @ver_version);
if ($old ne $new) {
write_file($m, $new) if $write;
warn "changed: $m\n";
$changed_count++;
}
}
if ($write) {
return 0; # no failures
}
else {
warn( $changed_count > 0 ? "check-makefiles: FAIL $changed_count\n" : "check-makefiles: PASS\n" );
return $changed_count;
}
}
sub die_usage {
die <<"MARKER";
usage: $0 -s OR $0 --check-source
$0 -c OR $0 --check-descriptors
$0 -d OR $0 --check-defines
$0 -o OR $0 --check-comments
$0 -m OR $0 --check-makefiles
$0 -a OR $0 --check-all
$0 -u OR $0 --update-makefiles
$0 --fixupind crypt.ind
MARKER
}
GetOptions( "s|check-source" => \my $check_source,
"c|check-descriptors" => \my $check_descriptors,
"d|check-defines" => \my $check_defines,
"o|check-comments" => \my $check_comments,
"m|check-makefiles" => \my $check_makefiles,
"a|check-all" => \my $check_all,
"u|update-makefiles" => \my $update_makefiles,
"f|fixupind=s" => \my $fixupind,
"h|help" => \my $help
) or die_usage;
if ($fixupind) {
my $txt = read_file($fixupind);
$txt =~ s/^([^\n]*\n)/$1\n\\addcontentsline{toc}{chapter}{Index}\n/s;
write_file($fixupind, $txt);
exit 0;
}
my $failure;
$failure ||= check_source() if $check_all || $check_source;
$failure ||= check_defines() if $check_all || $check_defines;
$failure ||= check_descriptors() if $check_all || $check_descriptors;
$failure ||= check_comments() if $check_all || $check_comments;
$failure ||= process_makefiles(0) if $check_all || $check_makefiles;
$failure ||= process_makefiles(1) if $update_makefiles;
die_usage unless defined $failure;
exit $failure ? 1 : 0;

49
hooks/pre-commit Executable file
View file

@ -0,0 +1,49 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
# If you want to allow non-ascii filenames set this variable to true.
allownonascii=$(git config hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# Cross platform projects tend to avoid non-ascii filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
echo "Error: Attempt to add a non-ascii file name."
echo
echo "This can cause problems if you want to work"
echo "with people on other platforms."
echo
echo "To be portable it is advisable to rename the file ..."
echo
echo "If you know what you are doing you can disable this"
echo "check using:"
echo
echo " git config hooks.allownonascii true"
echo
exit 1
fi
exec perl helper.pl --check-all

9
libtomcrypt.pc.in Normal file
View file

@ -0,0 +1,9 @@
prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/@PROJECT_NAME@
Name: LibTomCrypt
Description: public domain open source cryptographic toolkit
Version: @PROJECT_VERSION@
Libs: -L${libdir} -ltomcrypt @PKG_CONFIG_LIBS@
Cflags: -I${includedir} @PKG_CONFIG_CFLAGS@

26
libtomcrypt_VS2008.sln Normal file
View file

@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtomcrypt", "libtomcrypt_VS2008.vcproj", "{E3802982-DCB6-4D85-A2BD-6B08F0657E79}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E3802982-DCB6-4D85-A2BD-6B08F0657E79}.Debug|Win32.ActiveCfg = Debug|Win32
{E3802982-DCB6-4D85-A2BD-6B08F0657E79}.Debug|Win32.Build.0 = Debug|Win32
{E3802982-DCB6-4D85-A2BD-6B08F0657E79}.Debug|x64.ActiveCfg = Debug|x64
{E3802982-DCB6-4D85-A2BD-6B08F0657E79}.Debug|x64.Build.0 = Debug|x64
{E3802982-DCB6-4D85-A2BD-6B08F0657E79}.Release|Win32.ActiveCfg = Release|Win32
{E3802982-DCB6-4D85-A2BD-6B08F0657E79}.Release|Win32.Build.0 = Release|Win32
{E3802982-DCB6-4D85-A2BD-6B08F0657E79}.Release|x64.ActiveCfg = Release|x64
{E3802982-DCB6-4D85-A2BD-6B08F0657E79}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

3202
libtomcrypt_VS2008.vcproj Normal file

File diff suppressed because it is too large Load diff

451
makefile
View file

@ -2,370 +2,167 @@
#
# Tom St Denis
# Modified by Clay Culver
#
# (GNU make only)
# The version
VERSION=1.13
# Compiler and Linker Names
#CC=gcc
#LD=ld
# Archiver [makes .a files]
#AR=ar
#ARFLAGS=r
ifndef MAKE
MAKE=make
ifeq ($V,0)
silent_echo= > /dev/null
else
silent_echo=
endif
ifeq ($V,1)
silent=
silent_stdout=
silent_stderr=
else
silent=@
silent_stdout= > /dev/null
silent_stderr= 2> /dev/null
endif
PLATFORM := $(shell uname | sed -e 's/_.*//')
# ranlib tools
ifndef RANLIB
RANLIB=ranlib
RANLIB:=$(CROSS_COMPILE)ranlib
endif
# Compilation flags. Note the += does not write over the user's CFLAGS!
CFLAGS += -c -I./testprof/ -I./src/headers/ -Wall -Wsign-compare -W -Wshadow -Wno-unused-parameter -DLTC_SOURCE
# additional warnings (newer GCC 3.4 and higher)
ifdef GCC_34
CFLAGS += -Wsystem-headers -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wpointer-arith
endif
ifndef IGNORE_SPEED
# optimize for SPEED
CFLAGS += -O3 -funroll-loops
# add -fomit-frame-pointer. hinders debugging!
CFLAGS += -fomit-frame-pointer
# optimize for SIZE
#CFLAGS += -Os -DLTC_SMALL_CODE
endif
# older GCCs can't handle the "rotate with immediate" ROLc/RORc/etc macros
# define this to help
#CFLAGS += -DLTC_NO_ROLC
# compile for DEBUGING (required for ccmalloc checking!!!)
#CFLAGS += -g3 -DLTC_NO_ASM
INSTALL_CMD = install
UNINSTALL_CMD = rm
#Output filenames for various targets.
ifndef LIBNAME
LIBNAME=libtomcrypt.a
endif
ifndef LIBTEST
LIBTEST=libtomcrypt_prof.a
endif
LIBTEST_S=$(LIBTEST)
HASH=hashsum
CRYPT=encrypt
SMALL=small
PROF=x86_prof
TV=tv_gen
MULTI=multi
TIMING=timing
TEST=test
#LIBPATH-The directory for libtomcrypt to be installed to.
#INCPATH-The directory to install the header files for libtomcrypt.
#DATAPATH-The directory to install the pdf docs.
ifndef DESTDIR
DESTDIR=
include makefile_include.mk
ifeq ($(COVERAGE),1)
all_test: LIB_PRE = -Wl,--whole-archive
all_test: LIB_POST = -Wl,--no-whole-archive
LTC_CFLAGS += -fprofile-arcs -ftest-coverage
LTC_EXTRALIBS += -lgcov
endif
ifndef LIBPATH
LIBPATH=/usr/lib
endif
ifndef INCPATH
INCPATH=/usr/include
endif
ifndef DATAPATH
DATAPATH=/usr/share/doc/libtomcrypt/pdf
endif
LTC_EXTRALIBS += $(EXTRALIBS)
#Who do we install as?
ifdef INSTALL_USER
USER=$(INSTALL_USER)
else
USER=root
endif
ifdef INSTALL_GROUP
GROUP=$(INSTALL_GROUP)
else
GROUP=wheel
endif
#List of objects to compile.
#START_INS
OBJECTS=src/ciphers/aes/aes_enc.o src/ciphers/aes/aes.o src/ciphers/anubis.o src/ciphers/blowfish.o \
src/ciphers/cast5.o src/ciphers/des.o src/ciphers/khazad.o src/ciphers/noekeon.o src/ciphers/rc2.o \
src/ciphers/rc5.o src/ciphers/rc6.o src/ciphers/safer/safer.o src/ciphers/safer/safer_tab.o \
src/ciphers/safer/saferp.o src/ciphers/skipjack.o src/ciphers/twofish/twofish.o src/ciphers/xtea.o \
src/encauth/ccm/ccm_memory.o src/encauth/ccm/ccm_test.o src/encauth/eax/eax_addheader.o \
src/encauth/eax/eax_decrypt.o src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o \
src/encauth/eax/eax_encrypt.o src/encauth/eax/eax_encrypt_authenticate_memory.o \
src/encauth/eax/eax_init.o src/encauth/eax/eax_test.o src/encauth/gcm/gcm_add_aad.o \
src/encauth/gcm/gcm_add_iv.o src/encauth/gcm/gcm_done.o src/encauth/gcm/gcm_gf_mult.o \
src/encauth/gcm/gcm_init.o src/encauth/gcm/gcm_memory.o src/encauth/gcm/gcm_mult_h.o \
src/encauth/gcm/gcm_process.o src/encauth/gcm/gcm_reset.o src/encauth/gcm/gcm_test.o \
src/encauth/ocb/ocb_decrypt.o src/encauth/ocb/ocb_decrypt_verify_memory.o \
src/encauth/ocb/ocb_done_decrypt.o src/encauth/ocb/ocb_done_encrypt.o src/encauth/ocb/ocb_encrypt.o \
src/encauth/ocb/ocb_encrypt_authenticate_memory.o src/encauth/ocb/ocb_init.o src/encauth/ocb/ocb_ntz.o \
src/encauth/ocb/ocb_shift_xor.o src/encauth/ocb/ocb_test.o src/encauth/ocb/s_ocb_done.o \
src/hashes/chc/chc.o src/hashes/helper/hash_file.o src/hashes/helper/hash_filehandle.o \
src/hashes/helper/hash_memory.o src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o \
src/hashes/md5.o src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/sha1.o src/hashes/sha2/sha256.o \
src/hashes/sha2/sha512.o src/hashes/tiger.o src/hashes/whirl/whirl.o src/mac/hmac/hmac_done.o \
src/mac/hmac/hmac_file.o src/mac/hmac/hmac_init.o src/mac/hmac/hmac_memory.o \
src/mac/hmac/hmac_memory_multi.o src/mac/hmac/hmac_process.o src/mac/hmac/hmac_test.o \
src/mac/omac/omac_done.o src/mac/omac/omac_file.o src/mac/omac/omac_init.o src/mac/omac/omac_memory.o \
src/mac/omac/omac_memory_multi.o src/mac/omac/omac_process.o src/mac/omac/omac_test.o \
src/mac/pelican/pelican.o src/mac/pelican/pelican_memory.o src/mac/pelican/pelican_test.o \
src/mac/pmac/pmac_done.o src/mac/pmac/pmac_file.o src/mac/pmac/pmac_init.o src/mac/pmac/pmac_memory.o \
src/mac/pmac/pmac_memory_multi.o src/mac/pmac/pmac_ntz.o src/mac/pmac/pmac_process.o \
src/mac/pmac/pmac_shift_xor.o src/mac/pmac/pmac_test.o src/math/fp/ltc_ecc_fp_mulmod.o \
src/math/gmp_desc.o src/math/ltm_desc.o src/math/multi.o src/math/rand_prime.o src/math/tfm_desc.o \
src/misc/base64/base64_decode.o src/misc/base64/base64_encode.o src/misc/burn_stack.o \
src/misc/crypt/crypt.o src/misc/crypt/crypt_argchk.o src/misc/crypt/crypt_cipher_descriptor.o \
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_find_cipher.o \
src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher_id.o \
src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_any.o \
src/misc/crypt/crypt_find_hash_id.o src/misc/crypt/crypt_find_hash_oid.o \
src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_hash_descriptor.o \
src/misc/crypt/crypt_hash_is_valid.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
src/misc/crypt/crypt_prng_descriptor.o src/misc/crypt/crypt_prng_is_valid.o \
src/misc/crypt/crypt_register_cipher.o src/misc/crypt/crypt_register_hash.o \
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_unregister_cipher.o \
src/misc/crypt/crypt_unregister_hash.o src/misc/crypt/crypt_unregister_prng.o \
src/misc/error_to_string.o src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o src/misc/zeromem.o \
src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o \
src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o \
src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o \
src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o \
src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o \
src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o \
src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \
src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \
src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \
src/modes/lrw/lrw_decrypt.o src/modes/lrw/lrw_done.o src/modes/lrw/lrw_encrypt.o \
src/modes/lrw/lrw_getiv.o src/modes/lrw/lrw_process.o src/modes/lrw/lrw_setiv.o \
src/modes/lrw/lrw_start.o src/modes/lrw/lrw_test.o src/modes/ofb/ofb_decrypt.o src/modes/ofb/ofb_done.o \
src/modes/ofb/ofb_encrypt.o src/modes/ofb/ofb_getiv.o src/modes/ofb/ofb_setiv.o \
src/modes/ofb/ofb_start.o src/pk/asn1/der/bit/der_decode_bit_string.o \
src/pk/asn1/der/bit/der_encode_bit_string.o src/pk/asn1/der/bit/der_length_bit_string.o \
src/pk/asn1/der/boolean/der_decode_boolean.o src/pk/asn1/der/boolean/der_encode_boolean.o \
src/pk/asn1/der/boolean/der_length_boolean.o src/pk/asn1/der/choice/der_decode_choice.o \
src/pk/asn1/der/ia5/der_decode_ia5_string.o src/pk/asn1/der/ia5/der_encode_ia5_string.o \
src/pk/asn1/der/ia5/der_length_ia5_string.o src/pk/asn1/der/integer/der_decode_integer.o \
src/pk/asn1/der/integer/der_encode_integer.o src/pk/asn1/der/integer/der_length_integer.o \
src/pk/asn1/der/object_identifier/der_decode_object_identifier.o \
src/pk/asn1/der/object_identifier/der_encode_object_identifier.o \
src/pk/asn1/der/object_identifier/der_length_object_identifier.o \
src/pk/asn1/der/octet/der_decode_octet_string.o src/pk/asn1/der/octet/der_encode_octet_string.o \
src/pk/asn1/der/octet/der_length_octet_string.o \
src/pk/asn1/der/printable_string/der_decode_printable_string.o \
src/pk/asn1/der/printable_string/der_encode_printable_string.o \
src/pk/asn1/der/printable_string/der_length_printable_string.o \
src/pk/asn1/der/sequence/der_decode_sequence_ex.o \
src/pk/asn1/der/sequence/der_decode_sequence_flexi.o \
src/pk/asn1/der/sequence/der_decode_sequence_multi.o \
src/pk/asn1/der/sequence/der_encode_sequence_ex.o \
src/pk/asn1/der/sequence/der_encode_sequence_multi.o src/pk/asn1/der/sequence/der_length_sequence.o \
src/pk/asn1/der/sequence/der_sequence_free.o src/pk/asn1/der/set/der_encode_set.o \
src/pk/asn1/der/set/der_encode_setof.o src/pk/asn1/der/short_integer/der_decode_short_integer.o \
src/pk/asn1/der/short_integer/der_encode_short_integer.o \
src/pk/asn1/der/short_integer/der_length_short_integer.o src/pk/asn1/der/utctime/der_decode_utctime.o \
src/pk/asn1/der/utctime/der_encode_utctime.o src/pk/asn1/der/utctime/der_length_utctime.o \
src/pk/dsa/dsa_decrypt_key.o src/pk/dsa/dsa_encrypt_key.o src/pk/dsa/dsa_export.o src/pk/dsa/dsa_free.o \
src/pk/dsa/dsa_import.o src/pk/dsa/dsa_make_key.o src/pk/dsa/dsa_shared_secret.o \
src/pk/dsa/dsa_sign_hash.o src/pk/dsa/dsa_verify_hash.o src/pk/dsa/dsa_verify_key.o src/pk/ecc/ecc.o \
src/pk/ecc/ecc_decrypt_key.o src/pk/ecc/ecc_encrypt_key.o src/pk/ecc/ecc_export.o src/pk/ecc/ecc_free.o \
src/pk/ecc/ecc_get_size.o src/pk/ecc/ecc_import.o src/pk/ecc/ecc_make_key.o \
src/pk/ecc/ecc_shared_secret.o src/pk/ecc/ecc_sign_hash.o src/pk/ecc/ecc_sizes.o src/pk/ecc/ecc_test.o \
src/pk/ecc/ecc_verify_hash.o src/pk/ecc/ltc_ecc_is_valid_idx.o src/pk/ecc/ltc_ecc_map.o \
src/pk/ecc/ltc_ecc_mulmod.o src/pk/ecc/ltc_ecc_mulmod_timing.o src/pk/ecc/ltc_ecc_points.o \
src/pk/ecc/ltc_ecc_projective_add_point.o src/pk/ecc/ltc_ecc_projective_dbl_point.o \
src/pk/katja/katja_decrypt_key.o src/pk/katja/katja_encrypt_key.o src/pk/katja/katja_export.o \
src/pk/katja/katja_exptmod.o src/pk/katja/katja_free.o src/pk/katja/katja_import.o \
src/pk/katja/katja_make_key.o src/pk/pkcs1/pkcs_1_i2osp.o src/pk/pkcs1/pkcs_1_mgf1.o \
src/pk/pkcs1/pkcs_1_oaep_decode.o src/pk/pkcs1/pkcs_1_oaep_encode.o src/pk/pkcs1/pkcs_1_os2ip.o \
src/pk/pkcs1/pkcs_1_pss_decode.o src/pk/pkcs1/pkcs_1_pss_encode.o src/pk/rsa/rsa_decrypt_key.o \
src/pk/rsa/rsa_encrypt_key.o src/pk/rsa/rsa_export.o src/pk/rsa/rsa_exptmod.o src/pk/rsa/rsa_free.o \
src/pk/rsa/rsa_import.o src/pk/rsa/rsa_make_key.o src/pk/rsa/rsa_sign_hash.o \
src/pk/rsa/rsa_verify_hash.o src/prngs/fortuna.o src/prngs/rc4.o src/prngs/rng_get_bytes.o \
src/prngs/rng_make_prng.o src/prngs/sober128.o src/prngs/sprng.o src/prngs/yarrow.o
HEADERS=src/headers/tomcrypt_cfg.h src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h \
src/headers/tomcrypt_custom.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cipher.h \
src/headers/tomcrypt_pk.h src/headers/tomcrypt_hash.h src/headers/tomcrypt_math.h \
src/headers/tomcrypt_misc.h src/headers/tomcrypt.h src/headers/tomcrypt_pkcs.h \
src/headers/tomcrypt_prng.h testprof/tomcrypt_test.h
#END_INS
TESTOBJECTS=demos/test.o
HASHOBJECTS=demos/hashsum.o
CRYPTOBJECTS=demos/encrypt.o
SMALLOBJECTS=demos/small.o
TVS=demos/tv_gen.o
MULTIS=demos/multi.o
TIMINGS=demos/timing.o
TESTS=demos/test.o
#Files left over from making the crypt.pdf.
LEFTOVERS=*.dvi *.log *.aux *.toc *.idx *.ilg *.ind *.out
#Compressed filenames
COMPRESSED=crypt-$(VERSION).tar.bz2 crypt-$(VERSION).zip
#The default rule for make builds the libtomcrypt library.
default:library
#ciphers come in two flavours... enc+dec and enc
#AES comes in two flavours... enc+dec and enc
src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
$(CC) $(CFLAGS) -DENCRYPT_ONLY -c src/ciphers/aes/aes.c -o src/ciphers/aes/aes_enc.o
ifneq ($V,1)
@echo " * ${CC} $@" ${silent_echo}
endif
${silent} ${CC} ${LTC_CFLAGS} -DENCRYPT_ONLY -c $< -o $@
src/ciphers/aes/aes_enc_desc.o: src/ciphers/aes/aes_desc.c
ifneq ($V,1)
@echo " * ${CC} $@" ${silent_echo}
endif
${silent} ${CC} ${LTC_CFLAGS} -DENCRYPT_ONLY -c $< -o $@
#These are the rules to make certain object files.
src/ciphers/aes/aes.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
src/ciphers/twofish/twofish.o: src/ciphers/twofish/twofish.c src/ciphers/twofish/twofish_tab.c
src/hashes/whirl/whirl.o: src/hashes/whirl/whirl.c src/hashes/whirl/whirltab.c
src/hashes/sha2/sha512.o: src/hashes/sha2/sha512.c src/hashes/sha2/sha384.c
src/hashes/sha2/sha256.o: src/hashes/sha2/sha256.c src/hashes/sha2/sha224.c
#This rule makes the libtomcrypt library.
library: $(LIBNAME)
testprof/$(LIBTEST):
cd testprof ; CFLAGS="$(CFLAGS)" LIBTEST_S=$(LIBTEST_S) $(MAKE)
.c.o:
ifneq ($V,1)
@echo " * ${CC} $@" ${silent_echo}
endif
${silent} ${CC} ${LTC_CFLAGS} -c $< -o $@
$(LIBNAME): $(OBJECTS)
$(AR) $(ARFLAGS) $@ $(OBJECTS)
$(RANLIB) $@
ifneq ($V,1)
@echo " * ${AR} $@" ${silent_echo}
endif
${silent} $(AR) $(ARFLAGS) $@ $(OBJECTS)
ifneq ($V,1)
@echo " * ${RANLIB} $@" ${silent_echo}
endif
${silent} $(RANLIB) $@
#This rule makes the hash program included with libtomcrypt
hashsum: library $(HASHOBJECTS)
$(CC) $(HASHOBJECTS) $(LIBNAME) $(EXTRALIBS) -o $(HASH) $(WARN)
test: $(call print-help,test,Builds the library and the 'test' application to run all self-tests) $(LIBNAME) $(TOBJECTS)
ifneq ($V,1)
@echo " * ${CC} $@" ${silent_echo}
endif
${silent} $(CC) $(LTC_LDFLAGS) $(TOBJECTS) $(LIB_PRE) $(LIBNAME) $(LIB_POST) $(LTC_EXTRALIBS) -o $(TEST)
#makes the crypt program
crypt: library $(CRYPTOBJECTS)
$(CC) $(CRYPTOBJECTS) $(LIBNAME) $(EXTRALIBS) -o $(CRYPT) $(WARN)
# build the demos from a template
define DEMO_template
$(1): $(call print-help,$(1),Builds the library and the '$(1)' demo) demos/$(1).o $$(LIBNAME)
ifneq ($V,1)
@echo " * $${CC} $$@" ${silent_echo}
endif
$${silent} $$(CC) $$(LTC_LDFLAGS) $$< $$(LIB_PRE) $$(LIBNAME) $$(LIB_POST) $$(LTC_EXTRALIBS) -o $$@
endef
#makes the small program
small: library $(SMALLOBJECTS)
$(CC) $(SMALLOBJECTS) $(LIBNAME) $(EXTRALIBS) -o $(SMALL) $(WARN)
tv_gen: library $(TVS)
$(CC) $(LDFLAGS) $(TVS) $(LIBNAME) $(EXTRALIBS) -o $(TV)
$(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo))))
multi: library $(MULTIS)
$(CC) $(MULTIS) $(LIBNAME) $(EXTRALIBS) -o $(MULTI)
timing: library testprof/$(LIBTEST) $(TIMINGS)
$(CC) $(LDFLAGS) $(TIMINGS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TIMING)
test: library testprof/$(LIBTEST) $(TESTS)
$(CC) $(LDFLAGS) $(TESTS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TEST)
#This rule installs the library and the header files. This must be run
#as root in order to have a high enough permission to write to the correct
#directories and to set the owner and group to root.
ifndef NODOCS
install: library docs
else
install: library
endif
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH)
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(DATAPATH)
install -g $(GROUP) -o $(USER) $(LIBNAME) $(DESTDIR)$(LIBPATH)
install -g $(GROUP) -o $(USER) $(HEADERS) $(DESTDIR)$(INCPATH)
ifndef NODOCS
install -g $(GROUP) -o $(USER) doc/crypt.pdf $(DESTDIR)$(DATAPATH)
endif
install: $(call print-help,install,Installs the library and headers) .common_install
install_test: testprof/$(LIBTEST)
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH)
install -g $(GROUP) -o $(USER) testprof/$(LIBTEST) $(DESTDIR)$(LIBPATH)
install_bins: $(call print-help,install_bins,Installs the useful demos ($(USEFUL_DEMOS))) .common_install_bins
uninstall: $(call print-help,uninstall,Uninstalls the library and headers) .common_uninstall
profile:
CFLAGS="$(CFLAGS) -fprofile-generate" $(MAKE) timing EXTRALIBS="$(EXTRALIBS) -lgcov"
LTC_CFLAGS="$(LTC_CFLAGS) -fprofile-generate" $(MAKE) timing EXTRALIBS="$(LTC_EXTRALIBS) -lgcov"
./timing
rm -f timing `find . -type f | grep [.][ao] | xargs`
CFLAGS="$(CFLAGS) -fprofile-use" $(MAKE) timing EXTRALIBS="$(EXTRALIBS) -lgcov"
LTC_CFLAGS="$(LTC_CFLAGS) -fprofile-use" $(MAKE) timing EXTRALIBS="$(LTC_EXTRALIBS) -lgcov"
# target that pre-processes all coverage data
lcov-single-create:
lcov --capture --no-external --directory src -q --output-file coverage_std.info
# target that removes all coverage output
cleancov-clean:
rm -f `find . -type f -name "*.info" | xargs`
rm -rf coverage/
# merges all coverage_*.info files into coverage.info
coverage.info:
lcov `find -name 'coverage_*.info' -exec echo -n " -a {}" \;` -o coverage.info
# generates html output from all coverage_*.info files
lcov-html: coverage.info
genhtml coverage.info --output-directory coverage -q
# combines all necessary steps to create the coverage from a single testrun with e.g.
# CFLAGS="-DUSE_LTM -DLTM_DESC -I../libtommath" EXTRALIBS="../libtommath/libtommath.a" make coverage -j9
lcov-single:
$(MAKE) cleancov-clean
$(MAKE) lcov-single-create
$(MAKE) coverage.info
#This rule cleans the source tree of all compiled code, not including the pdf
#documentation.
clean:
rm -f `find . -type f | grep "[.]o" | xargs`
rm -f `find . -type f | grep "[.]lo" | xargs`
rm -f `find . -type f | grep "[.]a" | xargs`
rm -f `find . -type f | grep "[.]la" | xargs`
rm -f `find . -type f | grep "[.]obj" | xargs`
rm -f `find . -type f | grep "[.]lib" | xargs`
rm -f `find . -type f | grep "[.]exe" | xargs`
rm -f `find . -type f | grep "[.]gcda" | xargs`
rm -f `find . -type f | grep "[.]gcno" | xargs`
rm -f `find . -type f | grep "[.]il" | xargs`
rm -f `find . -type f | grep "[.]dyn" | xargs`
rm -f `find . -type f | grep "[.]dpi" | xargs`
rm -rf `find . -type d | grep "[.]libs" | xargs`
rm -f crypt.aux crypt.dvi crypt.idx crypt.ilg crypt.ind crypt.log crypt.toc
rm -f $(TV) $(PROF) $(SMALL) $(CRYPT) $(HASHSUM) $(MULTI) $(TIMING) $(TEST)
rm -rf doc/doxygen
rm -f doc/*.pdf
rm -f *.txt
#make the code coverage of the library
coverage: LTC_CFLAGS += -fprofile-arcs -ftest-coverage
coverage: LTC_EXTRALIBS += -lgcov
coverage: LIB_PRE = -Wl,--whole-archive
coverage: LIB_POST = -Wl,--no-whole-archive
#build the doxy files (requires Doxygen, tetex and patience)
doxy:
doxygen
cd doc/doxygen/latex ; ${MAKE} ; mv -f refman.pdf ../../.
echo The huge doxygen PDF should be available as doc/refman.pdf
#This builds the crypt.pdf file. Note that the rm -f *.pdf has been removed
#from the clean command! This is because most people would like to keep the
#nice pre-compiled crypt.pdf that comes with libtomcrypt! We only need to
#delete it if we are rebuilding it.
docs: crypt.tex
rm -f doc/crypt.pdf $(LEFTOVERS)
echo "hello" > crypt.ind
latex crypt > /dev/null
latex crypt > /dev/null
makeindex crypt.idx > /dev/null
latex crypt > /dev/null
dvipdf crypt
mv -ivf crypt.pdf doc/crypt.pdf
rm -f $(LEFTOVERS)
coverage: $(call print-help,coverage,Create code-coverage of the library - but better use coverage.sh) test
./test
docdvi: crypt.tex
echo hello > crypt.ind
latex crypt > /dev/null
latex crypt > /dev/null
makeindex crypt.idx
latex crypt > /dev/null
# cleans everything - coverage output and standard 'clean'
cleancov: cleancov-clean clean
ifndef AMALGAM
AMALGAM_FILTER_OUT = src/ciphers/aes/aes_enc.c src/ciphers/aes/aes_enc_desc.c
TAB_SOURCES = src/ciphers/aes/aes_tab.c src/ciphers/safer/safer_tab.c src/hashes/whirl/whirltab.c src/stream/sober128/sober128tab.c
SOURCES = $(filter-out $(AMALGAM_FILTER_OUT),$(OBJECTS:.o=.c))
pre_gen/tomcrypt_amalgam.c: $(TAB_SOURCES) $(SOURCES)
mkdir -p pre_gen
printf "/*\n * This file has been auto-generated, do not edit!\n */\n\n" > $@
printf "#define LTC_AES_TAB_C\n" >> $@
printf "#define LTC_SAFER_TAB_C\n" >> $@
printf "#define LTC_SOBER128TAB_C\n" >> $@
printf "#define LTC_WHIRLTAB_C\n\n" >> $@
printf "#include \"tomcrypt_private.h\"\n\n" >> $@
cat $^ >> $@
printf "#define ENCRYPT_ONLY\n\n" >> $@
cat src/ciphers/aes/aes.c >> $@
cat src/ciphers/aes/aes_desc.c >> $@
printf "#undef ENCRYPT_ONLY\n\n" >> $@
#zipup the project (take that!)
no_oops: clean
cd .. ; cvs commit
echo Scanning for scratch/dirty files
find . -type f | grep -v CVS | xargs -n 1 bash mess.sh
pre_gen: pre_gen/tomcrypt_amalgam.c
zipup: no_oops docs
cd .. ; rm -rf crypt* libtomcrypt-$(VERSION) ; mkdir libtomcrypt-$(VERSION) ; \
cp -R ./libtomcrypt/* ./libtomcrypt-$(VERSION)/ ; \
cd libtomcrypt-$(VERSION) ; rm -rf `find . -type d | grep CVS | xargs` ; cd .. ; \
tar -cjvf crypt-$(VERSION).tar.bz2 libtomcrypt-$(VERSION) ; \
zip -9r crypt-$(VERSION).zip libtomcrypt-$(VERSION) ; \
gpg -b -a crypt-$(VERSION).tar.bz2 ; gpg -b -a crypt-$(VERSION).zip ; \
mv -fv crypt* ~ ; rm -rf libtomcrypt-$(VERSION)
.PHONY: pre_gen/tomcrypt_amalgam.c
endif
# $Source: /cvs/libtom/libtomcrypt/makefile,v $
# $Revision: 1.126 $
# $Date: 2006/06/16 23:52:08 $

View file

@ -1,282 +0,0 @@
# MAKEFILE for linux ICC (Intel C compiler)
#
# Tested with ICC v8....
#
# Be aware that ICC isn't quite as stable as GCC and several optimization switches
# seem to break the code (that GCC and MSVC compile just fine). In particular
# "-ip" and "-x*" seem to break the code (ROL/ROR macro problems). As the makefile
# is shipped the code will build and execute properly.
#
# Also note that ICC often makes code that is slower than GCC. This is probably due to
# a mix of not being able to use "-ip" and just having fewer optimization algos than GCC.
#
# Tom St Denis
# Compiler and Linker Names
CC=icc
#LD=ld
# Archiver [makes .a files]
#AR=ar
#ARFLAGS=r
# Compilation flags. Note the += does not write over the user's CFLAGS!
CFLAGS += -c -Isrc/headers/ -Itestprof/ -DINTEL_CC -DLTC_SOURCE
#ICC v9 doesn't support LTC_FAST for things like Pelican MAC
#Despite the fact I can't see what's wrong with my code
#Oh well
CFLAGS += -DLTC_NO_FAST
#The default rule for make builds the libtomcrypt library.
default:library
# optimize for SPEED
#
# -mcpu= can be pentium, pentiumpro (covers PII through PIII) or pentium4
# -ax? specifies make code specifically for ? but compatible with IA-32
# -x? specifies compile solely for ? [not specifically IA-32 compatible]
#
# where ? is
# K - PIII
# W - first P4 [Williamette]
# N - P4 Northwood
# P - P4 Prescott
# B - Blend of P4 and PM [mobile]
#
# Default to just generic max opts
ifdef LTC_SMALL
CFLAGS += -O2 -xP -ip
endif
ifndef IGNORE_SPEED
CFLAGS += -O3 -xP -ip
endif
# want to see stuff?
#CFLAGS += -opt_report
#These flags control how the library gets built.
#Output filenames for various targets.
ifndef LIBNAME
LIBNAME=libtomcrypt.a
endif
ifndef LIBTEST
LIBTEST=libtomcrypt_prof.a
LIBTEST_S=$(LIBTEST)
endif
HASH=hashsum
CRYPT=encrypt
SMALL=small
PROF=x86_prof
TV=tv_gen
MULTI=multi
TIMING=timing
TEST=test
#LIBPATH-The directory for libtomcrypt to be installed to.
#INCPATH-The directory to install the header files for libtomcrypt.
#DATAPATH-The directory to install the pdf docs.
ifndef DESTDIR
DESTDIR=
endif
ifndef LIBPATH
LIBPATH=/usr/lib
endif
ifndef INCPATH
INCPATH=/usr/include
endif
ifndef DATAPATH
DATAPATH=/usr/share/doc/libtomcrypt/pdf
endif
#List of objects to compile.
#START_INS
OBJECTS=src/ciphers/aes/aes_enc.o src/ciphers/aes/aes.o src/ciphers/anubis.o src/ciphers/blowfish.o \
src/ciphers/cast5.o src/ciphers/des.o src/ciphers/khazad.o src/ciphers/noekeon.o src/ciphers/rc2.o \
src/ciphers/rc5.o src/ciphers/rc6.o src/ciphers/safer/safer.o src/ciphers/safer/safer_tab.o \
src/ciphers/safer/saferp.o src/ciphers/skipjack.o src/ciphers/twofish/twofish.o src/ciphers/xtea.o \
src/encauth/ccm/ccm_memory.o src/encauth/ccm/ccm_test.o src/encauth/eax/eax_addheader.o \
src/encauth/eax/eax_decrypt.o src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o \
src/encauth/eax/eax_encrypt.o src/encauth/eax/eax_encrypt_authenticate_memory.o \
src/encauth/eax/eax_init.o src/encauth/eax/eax_test.o src/encauth/gcm/gcm_add_aad.o \
src/encauth/gcm/gcm_add_iv.o src/encauth/gcm/gcm_done.o src/encauth/gcm/gcm_gf_mult.o \
src/encauth/gcm/gcm_init.o src/encauth/gcm/gcm_memory.o src/encauth/gcm/gcm_mult_h.o \
src/encauth/gcm/gcm_process.o src/encauth/gcm/gcm_reset.o src/encauth/gcm/gcm_test.o \
src/encauth/ocb/ocb_decrypt.o src/encauth/ocb/ocb_decrypt_verify_memory.o \
src/encauth/ocb/ocb_done_decrypt.o src/encauth/ocb/ocb_done_encrypt.o src/encauth/ocb/ocb_encrypt.o \
src/encauth/ocb/ocb_encrypt_authenticate_memory.o src/encauth/ocb/ocb_init.o src/encauth/ocb/ocb_ntz.o \
src/encauth/ocb/ocb_shift_xor.o src/encauth/ocb/ocb_test.o src/encauth/ocb/s_ocb_done.o \
src/hashes/chc/chc.o src/hashes/helper/hash_file.o src/hashes/helper/hash_filehandle.o \
src/hashes/helper/hash_memory.o src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o \
src/hashes/md5.o src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/sha1.o src/hashes/sha2/sha256.o \
src/hashes/sha2/sha512.o src/hashes/tiger.o src/hashes/whirl/whirl.o src/mac/hmac/hmac_done.o \
src/mac/hmac/hmac_file.o src/mac/hmac/hmac_init.o src/mac/hmac/hmac_memory.o \
src/mac/hmac/hmac_memory_multi.o src/mac/hmac/hmac_process.o src/mac/hmac/hmac_test.o \
src/mac/omac/omac_done.o src/mac/omac/omac_file.o src/mac/omac/omac_init.o src/mac/omac/omac_memory.o \
src/mac/omac/omac_memory_multi.o src/mac/omac/omac_process.o src/mac/omac/omac_test.o \
src/mac/pelican/pelican.o src/mac/pelican/pelican_memory.o src/mac/pelican/pelican_test.o \
src/mac/pmac/pmac_done.o src/mac/pmac/pmac_file.o src/mac/pmac/pmac_init.o src/mac/pmac/pmac_memory.o \
src/mac/pmac/pmac_memory_multi.o src/mac/pmac/pmac_ntz.o src/mac/pmac/pmac_process.o \
src/mac/pmac/pmac_shift_xor.o src/mac/pmac/pmac_test.o src/math/fp/ltc_ecc_fp_mulmod.o \
src/math/gmp_desc.o src/math/ltm_desc.o src/math/multi.o src/math/rand_prime.o src/math/tfm_desc.o \
src/misc/base64/base64_decode.o src/misc/base64/base64_encode.o src/misc/burn_stack.o \
src/misc/crypt/crypt.o src/misc/crypt/crypt_argchk.o src/misc/crypt/crypt_cipher_descriptor.o \
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_find_cipher.o \
src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher_id.o \
src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_any.o \
src/misc/crypt/crypt_find_hash_id.o src/misc/crypt/crypt_find_hash_oid.o \
src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_hash_descriptor.o \
src/misc/crypt/crypt_hash_is_valid.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
src/misc/crypt/crypt_prng_descriptor.o src/misc/crypt/crypt_prng_is_valid.o \
src/misc/crypt/crypt_register_cipher.o src/misc/crypt/crypt_register_hash.o \
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_unregister_cipher.o \
src/misc/crypt/crypt_unregister_hash.o src/misc/crypt/crypt_unregister_prng.o \
src/misc/error_to_string.o src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o src/misc/zeromem.o \
src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o \
src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o \
src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o \
src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o \
src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o \
src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o \
src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \
src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \
src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \
src/modes/lrw/lrw_decrypt.o src/modes/lrw/lrw_done.o src/modes/lrw/lrw_encrypt.o \
src/modes/lrw/lrw_getiv.o src/modes/lrw/lrw_process.o src/modes/lrw/lrw_setiv.o \
src/modes/lrw/lrw_start.o src/modes/lrw/lrw_test.o src/modes/ofb/ofb_decrypt.o src/modes/ofb/ofb_done.o \
src/modes/ofb/ofb_encrypt.o src/modes/ofb/ofb_getiv.o src/modes/ofb/ofb_setiv.o \
src/modes/ofb/ofb_start.o src/pk/asn1/der/bit/der_decode_bit_string.o \
src/pk/asn1/der/bit/der_encode_bit_string.o src/pk/asn1/der/bit/der_length_bit_string.o \
src/pk/asn1/der/boolean/der_decode_boolean.o src/pk/asn1/der/boolean/der_encode_boolean.o \
src/pk/asn1/der/boolean/der_length_boolean.o src/pk/asn1/der/choice/der_decode_choice.o \
src/pk/asn1/der/ia5/der_decode_ia5_string.o src/pk/asn1/der/ia5/der_encode_ia5_string.o \
src/pk/asn1/der/ia5/der_length_ia5_string.o src/pk/asn1/der/integer/der_decode_integer.o \
src/pk/asn1/der/integer/der_encode_integer.o src/pk/asn1/der/integer/der_length_integer.o \
src/pk/asn1/der/object_identifier/der_decode_object_identifier.o \
src/pk/asn1/der/object_identifier/der_encode_object_identifier.o \
src/pk/asn1/der/object_identifier/der_length_object_identifier.o \
src/pk/asn1/der/octet/der_decode_octet_string.o src/pk/asn1/der/octet/der_encode_octet_string.o \
src/pk/asn1/der/octet/der_length_octet_string.o \
src/pk/asn1/der/printable_string/der_decode_printable_string.o \
src/pk/asn1/der/printable_string/der_encode_printable_string.o \
src/pk/asn1/der/printable_string/der_length_printable_string.o \
src/pk/asn1/der/sequence/der_decode_sequence_ex.o \
src/pk/asn1/der/sequence/der_decode_sequence_flexi.o \
src/pk/asn1/der/sequence/der_decode_sequence_multi.o \
src/pk/asn1/der/sequence/der_encode_sequence_ex.o \
src/pk/asn1/der/sequence/der_encode_sequence_multi.o src/pk/asn1/der/sequence/der_length_sequence.o \
src/pk/asn1/der/sequence/der_sequence_free.o src/pk/asn1/der/set/der_encode_set.o \
src/pk/asn1/der/set/der_encode_setof.o src/pk/asn1/der/short_integer/der_decode_short_integer.o \
src/pk/asn1/der/short_integer/der_encode_short_integer.o \
src/pk/asn1/der/short_integer/der_length_short_integer.o src/pk/asn1/der/utctime/der_decode_utctime.o \
src/pk/asn1/der/utctime/der_encode_utctime.o src/pk/asn1/der/utctime/der_length_utctime.o \
src/pk/dsa/dsa_decrypt_key.o src/pk/dsa/dsa_encrypt_key.o src/pk/dsa/dsa_export.o src/pk/dsa/dsa_free.o \
src/pk/dsa/dsa_import.o src/pk/dsa/dsa_make_key.o src/pk/dsa/dsa_shared_secret.o \
src/pk/dsa/dsa_sign_hash.o src/pk/dsa/dsa_verify_hash.o src/pk/dsa/dsa_verify_key.o src/pk/ecc/ecc.o \
src/pk/ecc/ecc_decrypt_key.o src/pk/ecc/ecc_encrypt_key.o src/pk/ecc/ecc_export.o src/pk/ecc/ecc_free.o \
src/pk/ecc/ecc_get_size.o src/pk/ecc/ecc_import.o src/pk/ecc/ecc_make_key.o \
src/pk/ecc/ecc_shared_secret.o src/pk/ecc/ecc_sign_hash.o src/pk/ecc/ecc_sizes.o src/pk/ecc/ecc_test.o \
src/pk/ecc/ecc_verify_hash.o src/pk/ecc/ltc_ecc_is_valid_idx.o src/pk/ecc/ltc_ecc_map.o \
src/pk/ecc/ltc_ecc_mulmod.o src/pk/ecc/ltc_ecc_mulmod_timing.o src/pk/ecc/ltc_ecc_points.o \
src/pk/ecc/ltc_ecc_projective_add_point.o src/pk/ecc/ltc_ecc_projective_dbl_point.o \
src/pk/katja/katja_decrypt_key.o src/pk/katja/katja_encrypt_key.o src/pk/katja/katja_export.o \
src/pk/katja/katja_exptmod.o src/pk/katja/katja_free.o src/pk/katja/katja_import.o \
src/pk/katja/katja_make_key.o src/pk/pkcs1/pkcs_1_i2osp.o src/pk/pkcs1/pkcs_1_mgf1.o \
src/pk/pkcs1/pkcs_1_oaep_decode.o src/pk/pkcs1/pkcs_1_oaep_encode.o src/pk/pkcs1/pkcs_1_os2ip.o \
src/pk/pkcs1/pkcs_1_pss_decode.o src/pk/pkcs1/pkcs_1_pss_encode.o src/pk/rsa/rsa_decrypt_key.o \
src/pk/rsa/rsa_encrypt_key.o src/pk/rsa/rsa_export.o src/pk/rsa/rsa_exptmod.o src/pk/rsa/rsa_free.o \
src/pk/rsa/rsa_import.o src/pk/rsa/rsa_make_key.o src/pk/rsa/rsa_sign_hash.o \
src/pk/rsa/rsa_verify_hash.o src/prngs/fortuna.o src/prngs/rc4.o src/prngs/rng_get_bytes.o \
src/prngs/rng_make_prng.o src/prngs/sober128.o src/prngs/sprng.o src/prngs/yarrow.o
HEADERS=src/headers/tomcrypt_cfg.h src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h \
src/headers/tomcrypt_custom.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cipher.h \
src/headers/tomcrypt_pk.h src/headers/tomcrypt_hash.h src/headers/tomcrypt_math.h \
src/headers/tomcrypt_misc.h src/headers/tomcrypt.h src/headers/tomcrypt_pkcs.h \
src/headers/tomcrypt_prng.h testprof/tomcrypt_test.h
#END_INS
#Who do we install as?
ifdef INSTALL_USER
USER=$(INSTALL_USER)
else
USER=root
endif
ifdef INSTALL_GROUP
GROUP=$(INSTALL_GROUP)
else
GROUP=wheel
endif
#ciphers come in two flavours... enc+dec and enc
aes_enc.o: aes.c aes_tab.c
$(CC) $(CFLAGS) -DENCRYPT_ONLY -c aes.c -o aes_enc.o
HASHOBJECTS=demos/hashsum.o
CRYPTOBJECTS=demos/encrypt.o
SMALLOBJECTS=demos/small.o
TVS=demos/tv_gen.o
TIMINGS=demos/timing.o
TESTS=demos/test.o
#ciphers come in two flavours... enc+dec and enc
src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
$(CC) $(CFLAGS) -DENCRYPT_ONLY -c src/ciphers/aes/aes.c -o src/ciphers/aes/aes_enc.o
#These are the rules to make certain object files.
src/ciphers/aes/aes.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
src/ciphers/twofish/twofish.o: src/ciphers/twofish/twofish.c src/ciphers/twofish/twofish_tab.c
src/hashes/whirl/whirl.o: src/hashes/whirl/whirl.c src/hashes/whirl/whirltab.c
src/hashes/sha2/sha512.o: src/hashes/sha2/sha512.c src/hashes/sha2/sha384.c
src/hashes/sha2/sha256.o: src/hashes/sha2/sha256.c src/hashes/sha2/sha224.c
#This rule makes the libtomcrypt library.
library: $(LIBNAME)
testprof/$(LIBTEST):
cd testprof ; LIBTEST_S=$(LIBTEST) CFLAGS="$(CFLAGS)" make -f makefile.icc
$(LIBNAME): $(OBJECTS)
$(AR) $(ARFLAGS) $@ $(OBJECTS)
ranlib $@
#This rule makes the hash program included with libtomcrypt
hashsum: library $(HASHOBJECTS)
$(CC) $(HASHOBJECTS) $(LIBNAME) $(EXTRALIBS) -o $(HASH) $(WARN)
#makes the crypt program
crypt: library $(CRYPTOBJECTS)
$(CC) $(CRYPTOBJECTS) $(LIBNAME) $(EXTRALIBS) -o $(CRYPT) $(WARN)
#makes the small program
small: library $(SMALLOBJECTS)
$(CC) $(SMALLOBJECTS) $(LIBNAME) $(EXTRALIBS) -o $(SMALL) $(WARN)
tv_gen: library $(TVS)
$(CC) $(TVS) $(LIBNAME) $(EXTRALIBS) -o $(TV)
timing: library $(TIMINGS) testprof/$(LIBTEST)
$(CC) $(TIMINGS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TIMING)
test: library $(TESTS) testprof/$(LIBTEST)
$(CC) $(TESTS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TEST)
#This rule installs the library and the header files. This must be run
#as root in order to have a high enough permission to write to the correct
#directories and to set the owner and group to root.
install: library
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH)
install -g $(GROUP) -o $(USER) $(LIBNAME) $(DESTDIR)$(LIBPATH)
install -g $(GROUP) -o $(USER) $(LIBTEST) $(DESTDIR)$(LIBPATH)
install -g $(GROUP) -o $(USER) $(HEADERS) $(DESTDIR)$(INCPATH)
# $Source: /cvs/libtom/libtomcrypt/makefile.icc,v $
# $Revision: 1.58 $
# $Date: 2006/06/16 23:52:08 $

353
makefile.mingw Normal file
View file

@ -0,0 +1,353 @@
# MAKEFILE for MS Windows (mingw + gcc + gmake)
#
# BEWARE: variables OBJECTS, TOBJECTS, HEADERS, VERSION are updated via ./updatemakes.sh
### USAGE:
# Open a command prompt with gcc + gmake in PATH and start:
#
# gmake -f makefile.mingw all
# test.exe
# gmake -f makefile.mingw PREFIX=c:\devel\libtom install
#
#Or:
#
# gmake -f makefile.mingw CFLAGS="-O3 -DUSE_LTM -DLTM_DESC -Ic:/path/to/libtommath" EXTRALIBS="-Lc:/path/to/libtommath -ltommath" all
#
#The following can be overridden from command line e.g. make -f makefile.mingw CC=gcc ARFLAGS=rcs
PREFIX = c:\mingw
CC = gcc
AR = ar
ARFLAGS = r
RANLIB = ranlib
STRIP = strip
CFLAGS = -O2 -DUSE_LTM -DLTM_DESC -I../libtommath
EXTRALIBS = -L../libtommath -ltommath
#Compilation flags
LTC_CFLAGS = -Isrc/headers -Itests $(CFLAGS)
LTC_LDFLAGS = $(LDFLAGS) $(EXTRALIBS)
VERSION=1.18.2-develop
#Libraries to be created
LIBMAIN_S =libtomcrypt.a
LIBMAIN_I =libtomcrypt.dll.a
LIBMAIN_D =libtomcrypt.dll
#List of objects to compile (all goes to libtomcrypt.a)
OBJECTS=src/ciphers/aes/aes.o src/ciphers/aes/aes_desc.o src/ciphers/aes/aes_enc.o \
src/ciphers/aes/aes_enc_desc.o src/ciphers/aes/aesni.o src/ciphers/anubis.o src/ciphers/aria.o \
src/ciphers/blowfish.o src/ciphers/camellia.o src/ciphers/cast5.o src/ciphers/des.o src/ciphers/idea.o \
src/ciphers/kasumi.o src/ciphers/khazad.o src/ciphers/kseed.o src/ciphers/multi2.o src/ciphers/noekeon.o \
src/ciphers/rc2.o src/ciphers/rc5.o src/ciphers/rc6.o src/ciphers/safer/safer.o \
src/ciphers/safer/saferp.o src/ciphers/serpent.o src/ciphers/skipjack.o src/ciphers/sm4.o \
src/ciphers/tea.o src/ciphers/twofish/twofish.o src/ciphers/xtea.o src/encauth/ccm/ccm_add_aad.o \
src/encauth/ccm/ccm_add_nonce.o src/encauth/ccm/ccm_done.o src/encauth/ccm/ccm_init.o \
src/encauth/ccm/ccm_memory.o src/encauth/ccm/ccm_process.o src/encauth/ccm/ccm_reset.o \
src/encauth/ccm/ccm_test.o src/encauth/chachapoly/chacha20poly1305_add_aad.o \
src/encauth/chachapoly/chacha20poly1305_decrypt.o src/encauth/chachapoly/chacha20poly1305_done.o \
src/encauth/chachapoly/chacha20poly1305_encrypt.o src/encauth/chachapoly/chacha20poly1305_init.o \
src/encauth/chachapoly/chacha20poly1305_memory.o src/encauth/chachapoly/chacha20poly1305_setiv.o \
src/encauth/chachapoly/chacha20poly1305_setiv_rfc7905.o \
src/encauth/chachapoly/chacha20poly1305_test.o src/encauth/eax/eax_addheader.o \
src/encauth/eax/eax_decrypt.o src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o \
src/encauth/eax/eax_encrypt.o src/encauth/eax/eax_encrypt_authenticate_memory.o \
src/encauth/eax/eax_init.o src/encauth/eax/eax_test.o src/encauth/gcm/gcm_add_aad.o \
src/encauth/gcm/gcm_add_iv.o src/encauth/gcm/gcm_done.o src/encauth/gcm/gcm_gf_mult.o \
src/encauth/gcm/gcm_init.o src/encauth/gcm/gcm_memory.o src/encauth/gcm/gcm_mult_h.o \
src/encauth/gcm/gcm_process.o src/encauth/gcm/gcm_reset.o src/encauth/gcm/gcm_test.o \
src/encauth/gcm_siv/gcm_siv.o src/encauth/gcm_siv/gcm_siv_test.o src/encauth/ocb3/ocb3_add_aad.o \
src/encauth/ocb3/ocb3_decrypt.o src/encauth/ocb3/ocb3_decrypt_last.o \
src/encauth/ocb3/ocb3_decrypt_verify_memory.o src/encauth/ocb3/ocb3_done.o \
src/encauth/ocb3/ocb3_encrypt.o src/encauth/ocb3/ocb3_encrypt_authenticate_memory.o \
src/encauth/ocb3/ocb3_encrypt_last.o src/encauth/ocb3/ocb3_init.o src/encauth/ocb3/ocb3_int_ntz.o \
src/encauth/ocb3/ocb3_int_xor_blocks.o src/encauth/ocb3/ocb3_test.o src/encauth/siv/siv.o \
src/hashes/blake2b.o src/hashes/blake2s.o src/hashes/blake3.o src/hashes/chc/chc.o \
src/hashes/helper/hash_file.o src/hashes/helper/hash_filehandle.o src/hashes/helper/hash_memory.o \
src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o src/hashes/md5.o \
src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/rmd256.o src/hashes/rmd320.o src/hashes/sha1.o \
src/hashes/sha1_desc.o src/hashes/sha1_x86.o src/hashes/sha2/sha224.o src/hashes/sha2/sha224_desc.o \
src/hashes/sha2/sha224_x86.o src/hashes/sha2/sha256.o src/hashes/sha2/sha256_desc.o \
src/hashes/sha2/sha256_x86.o src/hashes/sha2/sha384.o src/hashes/sha2/sha384_desc.o \
src/hashes/sha2/sha384_x86.o src/hashes/sha2/sha512.o src/hashes/sha2/sha512_224.o \
src/hashes/sha2/sha512_224_desc.o src/hashes/sha2/sha512_224_x86.o src/hashes/sha2/sha512_256.o \
src/hashes/sha2/sha512_256_desc.o src/hashes/sha2/sha512_256_x86.o src/hashes/sha2/sha512_desc.o \
src/hashes/sha2/sha512_x86.o src/hashes/sha3.o src/hashes/sha3_test.o src/hashes/sm3.o \
src/hashes/tiger.o src/hashes/whirl/whirl.o src/mac/blake2/blake2bmac.o \
src/mac/blake2/blake2bmac_file.o src/mac/blake2/blake2bmac_memory.o \
src/mac/blake2/blake2bmac_memory_multi.o src/mac/blake2/blake2bmac_test.o src/mac/blake2/blake2smac.o \
src/mac/blake2/blake2smac_file.o src/mac/blake2/blake2smac_memory.o \
src/mac/blake2/blake2smac_memory_multi.o src/mac/blake2/blake2smac_test.o src/mac/f9/f9_done.o \
src/mac/f9/f9_file.o src/mac/f9/f9_init.o src/mac/f9/f9_memory.o src/mac/f9/f9_memory_multi.o \
src/mac/f9/f9_process.o src/mac/f9/f9_test.o src/mac/hmac/hmac_done.o src/mac/hmac/hmac_file.o \
src/mac/hmac/hmac_init.o src/mac/hmac/hmac_memory.o src/mac/hmac/hmac_memory_multi.o \
src/mac/hmac/hmac_process.o src/mac/hmac/hmac_test.o src/mac/kmac/kmac.o src/mac/kmac/kmac_file.o \
src/mac/kmac/kmac_memory.o src/mac/kmac/kmac_memory_multi.o src/mac/kmac/kmac_test.o \
src/mac/omac/omac_done.o src/mac/omac/omac_file.o src/mac/omac/omac_init.o src/mac/omac/omac_memory.o \
src/mac/omac/omac_memory_multi.o src/mac/omac/omac_process.o src/mac/omac/omac_test.o \
src/mac/pelican/pelican.o src/mac/pelican/pelican_memory.o src/mac/pelican/pelican_test.o \
src/mac/pmac/pmac_done.o src/mac/pmac/pmac_file.o src/mac/pmac/pmac_init.o src/mac/pmac/pmac_memory.o \
src/mac/pmac/pmac_memory_multi.o src/mac/pmac/pmac_ntz.o src/mac/pmac/pmac_process.o \
src/mac/pmac/pmac_shift_xor.o src/mac/pmac/pmac_test.o src/mac/poly1305/poly1305.o \
src/mac/poly1305/poly1305_file.o src/mac/poly1305/poly1305_memory.o \
src/mac/poly1305/poly1305_memory_multi.o src/mac/poly1305/poly1305_test.o src/mac/xcbc/xcbc_done.o \
src/mac/xcbc/xcbc_file.o src/mac/xcbc/xcbc_init.o src/mac/xcbc/xcbc_memory.o \
src/mac/xcbc/xcbc_memory_multi.o src/mac/xcbc/xcbc_process.o src/mac/xcbc/xcbc_test.o \
src/math/fp/ltc_ecc_fp_mulmod.o src/math/gmp_desc.o src/math/ltm_desc.o src/math/multi.o \
src/math/radix_to_bin.o src/math/rand_bn.o src/math/rand_prime.o src/math/tfm_desc.o src/misc/adler32.o \
src/misc/algname_match.o src/misc/argon2/argon2.o src/misc/base16/base16_decode.o \
src/misc/base16/base16_encode.o src/misc/base32/base32_decode.o src/misc/base32/base32_encode.o \
src/misc/base64/base64_decode.o src/misc/base64/base64_encode.o src/misc/bcrypt/bcrypt.o \
src/misc/burn_stack.o src/misc/compare_testvector.o src/misc/copy_or_zeromem.o src/misc/crc32.o \
src/misc/crypt/crypt.o src/misc/crypt/crypt_argchk.o src/misc/crypt/crypt_cipher_descriptor.o \
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_constants.o \
src/misc/crypt/crypt_find_cipher.o src/misc/crypt/crypt_find_cipher_any.o \
src/misc/crypt/crypt_find_cipher_id.o src/misc/crypt/crypt_find_hash.o \
src/misc/crypt/crypt_find_hash_any.o src/misc/crypt/crypt_find_hash_id.o \
src/misc/crypt/crypt_find_hash_oid.o src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o \
src/misc/crypt/crypt_hash_descriptor.o src/misc/crypt/crypt_hash_is_valid.o \
src/misc/crypt/crypt_inits.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
src/misc/crypt/crypt_prng_descriptor.o src/misc/crypt/crypt_prng_is_valid.o \
src/misc/crypt/crypt_prng_rng_descriptor.o src/misc/crypt/crypt_register_all_ciphers.o \
src/misc/crypt/crypt_register_all_hashes.o src/misc/crypt/crypt_register_all_prngs.o \
src/misc/crypt/crypt_register_cipher.o src/misc/crypt/crypt_register_hash.o \
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_sizes.o \
src/misc/crypt/crypt_unregister_cipher.o src/misc/crypt/crypt_unregister_hash.o \
src/misc/crypt/crypt_unregister_prng.o src/misc/deprecated.o src/misc/error_to_string.o \
src/misc/hkdf/hkdf.o src/misc/hkdf/hkdf_test.o src/misc/mem_neq.o src/misc/padding/padding_depad.o \
src/misc/padding/padding_pad.o src/misc/password_free.o src/misc/pbes/pbes.o src/misc/pbes/pbes1.o \
src/misc/pbes/pbes2.o src/misc/pem/pem.o src/misc/pem/pem_pkcs.o src/misc/pem/pem_read.o \
src/misc/pem/pem_ssh.o src/misc/pkcs12/pkcs12_kdf.o src/misc/pkcs12/pkcs12_utf8_to_utf16.o \
src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o src/misc/pkcs5/pkcs_5_test.o \
src/misc/scrypt/scrypt.o src/misc/ssh/ssh_decode_sequence_multi.o \
src/misc/ssh/ssh_encode_sequence_multi.o src/misc/zeromem.o src/modes/cbc/cbc_decrypt.o \
src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o src/modes/cbc/cbc_getiv.o \
src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o src/modes/cfb/cfb_decrypt.o \
src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o src/modes/cfb/cfb_getiv.o \
src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o src/modes/ctr/ctr_decrypt.o \
src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o src/modes/ctr/ctr_getiv.o \
src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \
src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \
src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \
src/modes/lrw/lrw_decrypt.o src/modes/lrw/lrw_done.o src/modes/lrw/lrw_encrypt.o \
src/modes/lrw/lrw_getiv.o src/modes/lrw/lrw_process.o src/modes/lrw/lrw_setiv.o \
src/modes/lrw/lrw_start.o src/modes/lrw/lrw_test.o src/modes/ofb/ofb_decrypt.o src/modes/ofb/ofb_done.o \
src/modes/ofb/ofb_encrypt.o src/modes/ofb/ofb_getiv.o src/modes/ofb/ofb_setiv.o \
src/modes/ofb/ofb_start.o src/modes/xts/xts_decrypt.o src/modes/xts/xts_done.o \
src/modes/xts/xts_encrypt.o src/modes/xts/xts_init.o src/modes/xts/xts_mult_x.o \
src/modes/xts/xts_test.o src/pk/asn1/der/bit/der_decode_bit_string.o \
src/pk/asn1/der/bit/der_decode_raw_bit_string.o src/pk/asn1/der/bit/der_encode_bit_string.o \
src/pk/asn1/der/bit/der_encode_raw_bit_string.o src/pk/asn1/der/bit/der_length_bit_string.o \
src/pk/asn1/der/boolean/der_decode_boolean.o src/pk/asn1/der/boolean/der_encode_boolean.o \
src/pk/asn1/der/boolean/der_length_boolean.o src/pk/asn1/der/choice/der_decode_choice.o \
src/pk/asn1/der/custom_type/der_decode_custom_type.o \
src/pk/asn1/der/custom_type/der_encode_custom_type.o \
src/pk/asn1/der/custom_type/der_length_custom_type.o src/pk/asn1/der/general/der_asn1_maps.o \
src/pk/asn1/der/general/der_decode_asn1_identifier.o src/pk/asn1/der/general/der_decode_asn1_length.o \
src/pk/asn1/der/general/der_encode_asn1_identifier.o src/pk/asn1/der/general/der_encode_asn1_length.o \
src/pk/asn1/der/general/der_length_asn1_identifier.o src/pk/asn1/der/general/der_length_asn1_length.o \
src/pk/asn1/der/generalizedtime/der_decode_generalizedtime.o \
src/pk/asn1/der/generalizedtime/der_encode_generalizedtime.o \
src/pk/asn1/der/generalizedtime/der_length_generalizedtime.o \
src/pk/asn1/der/ia5/der_decode_ia5_string.o src/pk/asn1/der/ia5/der_encode_ia5_string.o \
src/pk/asn1/der/ia5/der_length_ia5_string.o src/pk/asn1/der/integer/der_decode_integer.o \
src/pk/asn1/der/integer/der_encode_integer.o src/pk/asn1/der/integer/der_length_integer.o \
src/pk/asn1/der/object_identifier/der_decode_object_identifier.o \
src/pk/asn1/der/object_identifier/der_encode_object_identifier.o \
src/pk/asn1/der/object_identifier/der_length_object_identifier.o \
src/pk/asn1/der/octet/der_decode_octet_string.o src/pk/asn1/der/octet/der_encode_octet_string.o \
src/pk/asn1/der/octet/der_length_octet_string.o \
src/pk/asn1/der/printable_string/der_decode_printable_string.o \
src/pk/asn1/der/printable_string/der_encode_printable_string.o \
src/pk/asn1/der/printable_string/der_length_printable_string.o \
src/pk/asn1/der/sequence/der_decode_sequence_ex.o \
src/pk/asn1/der/sequence/der_decode_sequence_flexi.o \
src/pk/asn1/der/sequence/der_decode_sequence_multi.o \
src/pk/asn1/der/sequence/der_encode_sequence_ex.o \
src/pk/asn1/der/sequence/der_encode_sequence_multi.o \
src/pk/asn1/der/sequence/der_flexi_sequence_cmp.o src/pk/asn1/der/sequence/der_length_sequence.o \
src/pk/asn1/der/sequence/der_sequence_free.o src/pk/asn1/der/sequence/der_sequence_shrink.o \
src/pk/asn1/der/set/der_encode_set.o src/pk/asn1/der/set/der_encode_setof.o \
src/pk/asn1/der/short_integer/der_decode_short_integer.o \
src/pk/asn1/der/short_integer/der_encode_short_integer.o \
src/pk/asn1/der/short_integer/der_length_short_integer.o \
src/pk/asn1/der/teletex_string/der_decode_teletex_string.o \
src/pk/asn1/der/teletex_string/der_length_teletex_string.o \
src/pk/asn1/der/utctime/der_decode_utctime.o src/pk/asn1/der/utctime/der_encode_utctime.o \
src/pk/asn1/der/utctime/der_length_utctime.o src/pk/asn1/der/utf8/der_decode_utf8_string.o \
src/pk/asn1/der/utf8/der_encode_utf8_string.o src/pk/asn1/der/utf8/der_length_utf8_string.o \
src/pk/asn1/oid/pk_get.o src/pk/asn1/oid/pk_oid_cmp.o src/pk/asn1/oid/pk_oid_str.o \
src/pk/asn1/pkcs8/pkcs8_decode_flexi.o src/pk/asn1/pkcs8/pkcs8_get.o \
src/pk/asn1/x509/x509_decode_public_key_from_certificate.o src/pk/asn1/x509/x509_decode_spki.o \
src/pk/asn1/x509/x509_decode_subject_public_key_info.o \
src/pk/asn1/x509/x509_encode_subject_public_key_info.o src/pk/asn1/x509/x509_get_pka.o \
src/pk/asn1/x509/x509_import_spki.o src/pk/dh/dh.o src/pk/dh/dh_check_pubkey.o src/pk/dh/dh_export.o \
src/pk/dh/dh_export_key.o src/pk/dh/dh_free.o src/pk/dh/dh_generate_key.o src/pk/dh/dh_import.o \
src/pk/dh/dh_import_pkcs8.o src/pk/dh/dh_set.o src/pk/dh/dh_set_pg_dhparam.o \
src/pk/dh/dh_shared_secret.o src/pk/dsa/dsa_decrypt_key.o src/pk/dsa/dsa_encrypt_key.o \
src/pk/dsa/dsa_export.o src/pk/dsa/dsa_free.o src/pk/dsa/dsa_generate_key.o \
src/pk/dsa/dsa_generate_pqg.o src/pk/dsa/dsa_import.o src/pk/dsa/dsa_import_pkcs8.o \
src/pk/dsa/dsa_init.o src/pk/dsa/dsa_make_key.o src/pk/dsa/dsa_set.o src/pk/dsa/dsa_set_pqg_dsaparam.o \
src/pk/dsa/dsa_shared_secret.o src/pk/dsa/dsa_sign_hash.o src/pk/dsa/dsa_verify_hash.o \
src/pk/dsa/dsa_verify_key.o src/pk/ec25519/ec25519_crypto_ctx.o src/pk/ec25519/ec25519_export.o \
src/pk/ec25519/ec25519_import_pkcs8.o src/pk/ec25519/tweetnacl.o src/pk/ec448/ec448_common.o \
src/pk/ec448/ec448_crypto_ctx.o src/pk/ec448/ec448_export.o src/pk/ec448/ec448_import_pkcs8.o \
src/pk/ecc/ecc.o src/pk/ecc/ecc_ansi_x963_export.o src/pk/ecc/ecc_ansi_x963_import.o \
src/pk/ecc/ecc_decrypt_key.o src/pk/ecc/ecc_encrypt_key.o src/pk/ecc/ecc_export.o \
src/pk/ecc/ecc_export_openssl.o src/pk/ecc/ecc_find_curve.o src/pk/ecc/ecc_free.o \
src/pk/ecc/ecc_get_key.o src/pk/ecc/ecc_get_oid_str.o src/pk/ecc/ecc_get_size.o src/pk/ecc/ecc_import.o \
src/pk/ecc/ecc_import_openssl.o src/pk/ecc/ecc_import_pkcs8.o src/pk/ecc/ecc_import_x509.o \
src/pk/ecc/ecc_make_key.o src/pk/ecc/ecc_recover_key.o src/pk/ecc/ecc_rfc6979_key.o \
src/pk/ecc/ecc_set_curve.o src/pk/ecc/ecc_set_curve_internal.o src/pk/ecc/ecc_set_key.o \
src/pk/ecc/ecc_shared_secret.o src/pk/ecc/ecc_sign_hash.o src/pk/ecc/ecc_sign_hash_eth27.o \
src/pk/ecc/ecc_sign_hash_internal.o src/pk/ecc/ecc_sign_hash_rfc5656.o \
src/pk/ecc/ecc_sign_hash_rfc7518.o src/pk/ecc/ecc_sign_hash_x962.o src/pk/ecc/ecc_sizes.o \
src/pk/ecc/ecc_ssh_ecdsa_encode_name.o src/pk/ecc/ecc_verify_hash.o src/pk/ecc/ecc_verify_hash_eth27.o \
src/pk/ecc/ecc_verify_hash_internal.o src/pk/ecc/ecc_verify_hash_rfc5656.o \
src/pk/ecc/ecc_verify_hash_rfc7518.o src/pk/ecc/ecc_verify_hash_x962.o \
src/pk/ecc/ltc_ecc_export_point.o src/pk/ecc/ltc_ecc_import_point.o src/pk/ecc/ltc_ecc_is_point.o \
src/pk/ecc/ltc_ecc_is_point_at_infinity.o src/pk/ecc/ltc_ecc_map.o src/pk/ecc/ltc_ecc_mul2add.o \
src/pk/ecc/ltc_ecc_mulmod.o src/pk/ecc/ltc_ecc_mulmod_timing.o src/pk/ecc/ltc_ecc_points.o \
src/pk/ecc/ltc_ecc_projective_add_point.o src/pk/ecc/ltc_ecc_projective_dbl_point.o \
src/pk/ecc/ltc_ecc_verify_key.o src/pk/ed25519/ed25519_export.o src/pk/ed25519/ed25519_import.o \
src/pk/ed25519/ed25519_import_pkcs8.o src/pk/ed25519/ed25519_import_raw.o \
src/pk/ed25519/ed25519_import_x509.o src/pk/ed25519/ed25519_make_key.o src/pk/ed25519/ed25519_sign.o \
src/pk/ed25519/ed25519_verify.o src/pk/ed448/ed448_export.o src/pk/ed448/ed448_import.o \
src/pk/ed448/ed448_import_pkcs8.o src/pk/ed448/ed448_import_raw.o src/pk/ed448/ed448_import_x509.o \
src/pk/ed448/ed448_make_key.o src/pk/ed448/ed448_sign.o src/pk/ed448/ed448_verify.o src/pk/pka_key.o \
src/pk/pkcs1/pkcs_1_i2osp.o src/pk/pkcs1/pkcs_1_mgf1.o src/pk/pkcs1/pkcs_1_oaep_decode.o \
src/pk/pkcs1/pkcs_1_oaep_encode.o src/pk/pkcs1/pkcs_1_os2ip.o src/pk/pkcs1/pkcs_1_pss_decode.o \
src/pk/pkcs1/pkcs_1_pss_encode.o src/pk/pkcs1/pkcs_1_v1_5_decode.o src/pk/pkcs1/pkcs_1_v1_5_encode.o \
src/pk/rsa/rsa_decrypt_key.o src/pk/rsa/rsa_encrypt_key.o src/pk/rsa/rsa_export.o \
src/pk/rsa/rsa_exptmod.o src/pk/rsa/rsa_get_size.o src/pk/rsa/rsa_import.o \
src/pk/rsa/rsa_import_pkcs8.o src/pk/rsa/rsa_import_x509.o src/pk/rsa/rsa_key.o \
src/pk/rsa/rsa_make_key.o src/pk/rsa/rsa_set.o src/pk/rsa/rsa_sign_hash.o \
src/pk/rsa/rsa_sign_saltlen_get.o src/pk/rsa/rsa_verify_hash.o src/pk/x25519/x25519_export.o \
src/pk/x25519/x25519_import.o src/pk/x25519/x25519_import_pkcs8.o src/pk/x25519/x25519_import_raw.o \
src/pk/x25519/x25519_import_x509.o src/pk/x25519/x25519_make_key.o \
src/pk/x25519/x25519_shared_secret.o src/pk/x448/x448_export.o src/pk/x448/x448_import.o \
src/pk/x448/x448_import_pkcs8.o src/pk/x448/x448_import_raw.o src/pk/x448/x448_import_x509.o \
src/pk/x448/x448_make_key.o src/pk/x448/x448_shared_secret.o src/prngs/chacha20.o src/prngs/fortuna.o \
src/prngs/rc4.o src/prngs/rng_get_bytes.o src/prngs/rng_make_prng.o src/prngs/sober128.o \
src/prngs/sprng.o src/prngs/yarrow.o src/stream/chacha/chacha_crypt.o src/stream/chacha/chacha_done.o \
src/stream/chacha/chacha_ivctr32.o src/stream/chacha/chacha_ivctr64.o \
src/stream/chacha/chacha_keystream.o src/stream/chacha/chacha_memory.o \
src/stream/chacha/chacha_setup.o src/stream/chacha/chacha_test.o src/stream/chacha/xchacha20_memory.o \
src/stream/chacha/xchacha20_setup.o src/stream/chacha/xchacha20_test.o src/stream/rabbit/rabbit.o \
src/stream/rabbit/rabbit_memory.o src/stream/rc4/rc4_stream.o src/stream/rc4/rc4_stream_memory.o \
src/stream/rc4/rc4_test.o src/stream/salsa20/salsa20_crypt.o src/stream/salsa20/salsa20_done.o \
src/stream/salsa20/salsa20_ivctr64.o src/stream/salsa20/salsa20_keystream.o \
src/stream/salsa20/salsa20_memory.o src/stream/salsa20/salsa20_setup.o \
src/stream/salsa20/salsa20_test.o src/stream/salsa20/xsalsa20_memory.o \
src/stream/salsa20/xsalsa20_setup.o src/stream/salsa20/xsalsa20_test.o \
src/stream/sober128/sober128_stream.o src/stream/sober128/sober128_stream_memory.o \
src/stream/sober128/sober128_test.o src/stream/sosemanuk/sosemanuk.o \
src/stream/sosemanuk/sosemanuk_memory.o src/stream/sosemanuk/sosemanuk_test.o
#List of test objects to compile
TOBJECTS=tests/argon2_test.o tests/base16_test.o tests/base32_test.o tests/base64_test.o \
tests/bcrypt_test.o tests/cipher_hash_test.o tests/common.o tests/deprecated_test.o tests/der_test.o \
tests/dh_test.o tests/dsa_test.o tests/ecc_test.o tests/ed25519_test.o tests/ed448_test.o \
tests/file_test.o tests/mac_test.o tests/misc_test.o tests/modes_test.o tests/mpi_test.o \
tests/multi_test.o tests/no_null_termination_check_test.o tests/no_prng.o tests/padding_test.o \
tests/pem_test.o tests/pk_oid_test.o tests/pkcs_1_eme_test.o tests/pkcs_1_emsa_test.o \
tests/pkcs_1_oaep_test.o tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/prng_test.o \
tests/rotate_test.o tests/rsa_test.o tests/scrypt_test.o tests/siv_wycheproof_test.o tests/ssh_test.o \
tests/store_test.o tests/test.o tests/x25519_test.o tests/x448_test.o
#The following headers will be installed by "make install"
HEADERS_PUB=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
src/headers/tomcrypt_cipher.h src/headers/tomcrypt_custom.h src/headers/tomcrypt_hash.h \
src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h src/headers/tomcrypt_math.h \
src/headers/tomcrypt_misc.h src/headers/tomcrypt_pk.h src/headers/tomcrypt_pkcs.h \
src/headers/tomcrypt_prng.h
HEADERS=$(HEADERS_PUB) src/headers/tomcrypt_private.h
#The default rule for make builds the libtomcrypt.a library (static)
default: $(LIBMAIN_S)
#SPECIAL: AES comes in two flavours - enc+dec and enc-only
src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
$(CC) $(LTC_CFLAGS) -DENCRYPT_ONLY -c src/ciphers/aes/aes.c -o src/ciphers/aes/aes_enc.o
src/ciphers/aes/aes_enc_desc.o: src/ciphers/aes/aes.c
$(CC) $(LTC_CFLAGS) -DENCRYPT_ONLY -c src/ciphers/aes/aes_desc.c -o src/ciphers/aes/aes_enc_desc.o
#SPECIAL: these are the rules to make certain object files
src/ciphers/aes/aes.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
src/ciphers/twofish/twofish.o: src/ciphers/twofish/twofish.c src/ciphers/twofish/twofish_tab.c
src/hashes/sha2/sha256.o: src/hashes/sha2/sha256.c src/hashes/sha2/sha224.c
src/hashes/sha2/sha384.o: src/hashes/sha2/sha384.c src/hashes/sha2/sha512.c
src/hashes/sha2/sha512.o: src/hashes/sha2/sha512.c src/hashes/sha2/sha384.c
src/hashes/sha2/sha512_224.o: src/hashes/sha2/sha512.c src/hashes/sha2/sha512_224.c
src/hashes/sha2/sha512_256.o: src/hashes/sha2/sha512.c src/hashes/sha2/sha512_256.c
src/hashes/whirl/whirl.o: src/hashes/whirl/whirl.c src/hashes/whirl/whirltab.c
#Dependencies on *.h
$(OBJECTS): $(HEADERS)
$(TOBJECTS): $(HEADERS) tests/tomcrypt_test.h
.c.o:
$(CC) $(LTC_CFLAGS) -c $< -o $@
#Create libtomcrypt.a
$(LIBMAIN_S): $(OBJECTS)
$(AR) $(ARFLAGS) $@ $(OBJECTS)
$(RANLIB) $@
#Create DLL + import library libtomcrypt.dll.a
$(LIBMAIN_D) $(LIBMAIN_I): $(OBJECTS)
$(CC) -s -shared -o $(LIBMAIN_D) $^ -Wl,--enable-auto-import,--export-all -Wl,--out-implib=$(LIBMAIN_I) $(LTC_LDFLAGS)
$(STRIP) -S $(LIBMAIN_D)
#Demo tools/utilities
hashsum.exe: demos/hashsum.o $(LIBMAIN_S)
$(CC) demos/hashsum.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
crypt.exe: demos/crypt.o $(LIBMAIN_S)
$(CC) demos/crypt.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
small.exe: demos/small.o $(LIBMAIN_S)
$(CC) demos/small.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
tv_gen.exe: demos/tv_gen.o $(LIBMAIN_S)
$(CC) demos/tv_gen.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
sizes.exe: demos/sizes.o $(LIBMAIN_S)
$(CC) demos/sizes.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
constants.exe: demos/constants.o $(LIBMAIN_S)
$(CC) demos/constants.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
timing.exe: demos/timing.o $(LIBMAIN_S)
$(CC) demos/timing.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
der_print_flexi.exe: demos/der_print_flexi.o $(LIBMAIN_S)
$(CC) demos/der_print_flexi.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
#Tests
test.exe: $(TOBJECTS) $(LIBMAIN_S)
$(CC) $(TOBJECTS) $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
@echo NOTICE: start the tests by launching test.exe
all: $(LIBMAIN_S) $(LIBMAIN_I) $(LIBMAIN_D) hashsum.exe crypt.exe small.exe tv_gen.exe sizes.exe constants.exe timing.exe test.exe
test: test.exe
clean:
@-cmd /c del /Q *_tv.txt 2>nul
@-cmd /c del /Q /S *.o *.a *.exe *.dll 2>nul
#Install the library + headers
install: $(LIBMAIN_S) $(LIBMAIN_I) $(LIBMAIN_D)
cmd /c if not exist "$(PREFIX)\bin" mkdir "$(PREFIX)\bin"
cmd /c if not exist "$(PREFIX)\lib" mkdir "$(PREFIX)\lib"
cmd /c if not exist "$(PREFIX)\include" mkdir "$(PREFIX)\include"
copy /Y $(LIBMAIN_S) "$(PREFIX)\lib"
copy /Y $(LIBMAIN_I) "$(PREFIX)\lib"
copy /Y $(LIBMAIN_D) "$(PREFIX)\bin"
copy /Y src\headers\tomcrypt*.h "$(PREFIX)\include"
#Install useful tools
install_bins: hashsum.exe
cmd /c if not exist "$(PREFIX)\bin" mkdir "$(PREFIX)\bin"
copy /Y hashsum.exe "$(PREFIX)\bin\ltc-hashsum.exe"
#Install documentation
install_docs: doc/crypt.pdf
cmd /c if not exist "$(PREFIX)\doc" mkdir "$(PREFIX)\doc"
copy /Y doc\crypt.pdf "$(PREFIX)\doc"

View file

@ -1,56 +1,125 @@
#MSVC Makefile [tested with MSVC 6.00 with SP5]
# MAKEFILE for MS Windows (nmake + Windows SDK)
#
#Tom St Denis
CFLAGS = /Isrc/headers/ /Itestprof/ /Ox /DWIN32 /DLTC_SOURCE /W3 /Fo$@ $(CF)
# BEWARE: variables OBJECTS, TOBJECTS, HEADERS, VERSION are updated via ./updatemakes.sh
#START_INS
OBJECTS=src/ciphers/aes/aes_enc.obj src/ciphers/aes/aes.obj src/ciphers/anubis.obj src/ciphers/blowfish.obj \
src/ciphers/cast5.obj src/ciphers/des.obj src/ciphers/khazad.obj src/ciphers/noekeon.obj src/ciphers/rc2.obj \
src/ciphers/rc5.obj src/ciphers/rc6.obj src/ciphers/safer/safer.obj src/ciphers/safer/safer_tab.obj \
src/ciphers/safer/saferp.obj src/ciphers/skipjack.obj src/ciphers/twofish/twofish.obj src/ciphers/xtea.obj \
src/encauth/ccm/ccm_memory.obj src/encauth/ccm/ccm_test.obj src/encauth/eax/eax_addheader.obj \
### USAGE:
# Open a command prompt with WinSDK variables set and start:
#
# nmake -f makefile.msvc all
# test.exe
# nmake -f makefile.msvc PREFIX=c:\devel\libtom install
#
#Or:
#
# nmake -f makefile.msvc CFLAGS="/DUSE_LTM /DLTM_DESC /Ic:\path\to\libtommath" EXTRALIBS=c:\path\to\libtommath\tommath.lib all
#
#The following can be overridden from command line e.g. make -f makefile.msvc CC=gcc ARFLAGS=rcs
PREFIX = c:\devel
CFLAGS = /Ox /DUSE_LTM /DLTM_DESC /I../libtommath
EXTRALIBS = ../libtommath/tommath.lib
#Compilation flags
LTC_CFLAGS = /nologo /Isrc/headers/ /Itests/ /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /W3 $(CFLAGS)
LTC_LDFLAGS = advapi32.lib $(EXTRALIBS)
VERSION=1.18.2-develop
#Libraries to be created (this makefile builds only static libraries)
LIBMAIN_S =tomcrypt.lib
#List of objects to compile (all goes to tomcrypt.lib)
OBJECTS=src/ciphers/aes/aes.obj src/ciphers/aes/aes_desc.obj src/ciphers/aes/aes_enc.obj \
src/ciphers/aes/aes_enc_desc.obj src/ciphers/aes/aesni.obj src/ciphers/anubis.obj src/ciphers/aria.obj \
src/ciphers/blowfish.obj src/ciphers/camellia.obj src/ciphers/cast5.obj src/ciphers/des.obj src/ciphers/idea.obj \
src/ciphers/kasumi.obj src/ciphers/khazad.obj src/ciphers/kseed.obj src/ciphers/multi2.obj src/ciphers/noekeon.obj \
src/ciphers/rc2.obj src/ciphers/rc5.obj src/ciphers/rc6.obj src/ciphers/safer/safer.obj \
src/ciphers/safer/saferp.obj src/ciphers/serpent.obj src/ciphers/skipjack.obj src/ciphers/sm4.obj \
src/ciphers/tea.obj src/ciphers/twofish/twofish.obj src/ciphers/xtea.obj src/encauth/ccm/ccm_add_aad.obj \
src/encauth/ccm/ccm_add_nonce.obj src/encauth/ccm/ccm_done.obj src/encauth/ccm/ccm_init.obj \
src/encauth/ccm/ccm_memory.obj src/encauth/ccm/ccm_process.obj src/encauth/ccm/ccm_reset.obj \
src/encauth/ccm/ccm_test.obj src/encauth/chachapoly/chacha20poly1305_add_aad.obj \
src/encauth/chachapoly/chacha20poly1305_decrypt.obj src/encauth/chachapoly/chacha20poly1305_done.obj \
src/encauth/chachapoly/chacha20poly1305_encrypt.obj src/encauth/chachapoly/chacha20poly1305_init.obj \
src/encauth/chachapoly/chacha20poly1305_memory.obj src/encauth/chachapoly/chacha20poly1305_setiv.obj \
src/encauth/chachapoly/chacha20poly1305_setiv_rfc7905.obj \
src/encauth/chachapoly/chacha20poly1305_test.obj src/encauth/eax/eax_addheader.obj \
src/encauth/eax/eax_decrypt.obj src/encauth/eax/eax_decrypt_verify_memory.obj src/encauth/eax/eax_done.obj \
src/encauth/eax/eax_encrypt.obj src/encauth/eax/eax_encrypt_authenticate_memory.obj \
src/encauth/eax/eax_init.obj src/encauth/eax/eax_test.obj src/encauth/gcm/gcm_add_aad.obj \
src/encauth/gcm/gcm_add_iv.obj src/encauth/gcm/gcm_done.obj src/encauth/gcm/gcm_gf_mult.obj \
src/encauth/gcm/gcm_init.obj src/encauth/gcm/gcm_memory.obj src/encauth/gcm/gcm_mult_h.obj \
src/encauth/gcm/gcm_process.obj src/encauth/gcm/gcm_reset.obj src/encauth/gcm/gcm_test.obj \
src/encauth/ocb/ocb_decrypt.obj src/encauth/ocb/ocb_decrypt_verify_memory.obj \
src/encauth/ocb/ocb_done_decrypt.obj src/encauth/ocb/ocb_done_encrypt.obj src/encauth/ocb/ocb_encrypt.obj \
src/encauth/ocb/ocb_encrypt_authenticate_memory.obj src/encauth/ocb/ocb_init.obj src/encauth/ocb/ocb_ntz.obj \
src/encauth/ocb/ocb_shift_xor.obj src/encauth/ocb/ocb_test.obj src/encauth/ocb/s_ocb_done.obj \
src/hashes/chc/chc.obj src/hashes/helper/hash_file.obj src/hashes/helper/hash_filehandle.obj \
src/hashes/helper/hash_memory.obj src/hashes/helper/hash_memory_multi.obj src/hashes/md2.obj src/hashes/md4.obj \
src/hashes/md5.obj src/hashes/rmd128.obj src/hashes/rmd160.obj src/hashes/sha1.obj src/hashes/sha2/sha256.obj \
src/hashes/sha2/sha512.obj src/hashes/tiger.obj src/hashes/whirl/whirl.obj src/mac/hmac/hmac_done.obj \
src/mac/hmac/hmac_file.obj src/mac/hmac/hmac_init.obj src/mac/hmac/hmac_memory.obj \
src/mac/hmac/hmac_memory_multi.obj src/mac/hmac/hmac_process.obj src/mac/hmac/hmac_test.obj \
src/encauth/gcm_siv/gcm_siv.obj src/encauth/gcm_siv/gcm_siv_test.obj src/encauth/ocb3/ocb3_add_aad.obj \
src/encauth/ocb3/ocb3_decrypt.obj src/encauth/ocb3/ocb3_decrypt_last.obj \
src/encauth/ocb3/ocb3_decrypt_verify_memory.obj src/encauth/ocb3/ocb3_done.obj \
src/encauth/ocb3/ocb3_encrypt.obj src/encauth/ocb3/ocb3_encrypt_authenticate_memory.obj \
src/encauth/ocb3/ocb3_encrypt_last.obj src/encauth/ocb3/ocb3_init.obj src/encauth/ocb3/ocb3_int_ntz.obj \
src/encauth/ocb3/ocb3_int_xor_blocks.obj src/encauth/ocb3/ocb3_test.obj src/encauth/siv/siv.obj \
src/hashes/blake2b.obj src/hashes/blake2s.obj src/hashes/blake3.obj src/hashes/chc/chc.obj \
src/hashes/helper/hash_file.obj src/hashes/helper/hash_filehandle.obj src/hashes/helper/hash_memory.obj \
src/hashes/helper/hash_memory_multi.obj src/hashes/md2.obj src/hashes/md4.obj src/hashes/md5.obj \
src/hashes/rmd128.obj src/hashes/rmd160.obj src/hashes/rmd256.obj src/hashes/rmd320.obj src/hashes/sha1.obj \
src/hashes/sha1_desc.obj src/hashes/sha1_x86.obj src/hashes/sha2/sha224.obj src/hashes/sha2/sha224_desc.obj \
src/hashes/sha2/sha224_x86.obj src/hashes/sha2/sha256.obj src/hashes/sha2/sha256_desc.obj \
src/hashes/sha2/sha256_x86.obj src/hashes/sha2/sha384.obj src/hashes/sha2/sha384_desc.obj \
src/hashes/sha2/sha384_x86.obj src/hashes/sha2/sha512.obj src/hashes/sha2/sha512_224.obj \
src/hashes/sha2/sha512_224_desc.obj src/hashes/sha2/sha512_224_x86.obj src/hashes/sha2/sha512_256.obj \
src/hashes/sha2/sha512_256_desc.obj src/hashes/sha2/sha512_256_x86.obj src/hashes/sha2/sha512_desc.obj \
src/hashes/sha2/sha512_x86.obj src/hashes/sha3.obj src/hashes/sha3_test.obj src/hashes/sm3.obj \
src/hashes/tiger.obj src/hashes/whirl/whirl.obj src/mac/blake2/blake2bmac.obj \
src/mac/blake2/blake2bmac_file.obj src/mac/blake2/blake2bmac_memory.obj \
src/mac/blake2/blake2bmac_memory_multi.obj src/mac/blake2/blake2bmac_test.obj src/mac/blake2/blake2smac.obj \
src/mac/blake2/blake2smac_file.obj src/mac/blake2/blake2smac_memory.obj \
src/mac/blake2/blake2smac_memory_multi.obj src/mac/blake2/blake2smac_test.obj src/mac/f9/f9_done.obj \
src/mac/f9/f9_file.obj src/mac/f9/f9_init.obj src/mac/f9/f9_memory.obj src/mac/f9/f9_memory_multi.obj \
src/mac/f9/f9_process.obj src/mac/f9/f9_test.obj src/mac/hmac/hmac_done.obj src/mac/hmac/hmac_file.obj \
src/mac/hmac/hmac_init.obj src/mac/hmac/hmac_memory.obj src/mac/hmac/hmac_memory_multi.obj \
src/mac/hmac/hmac_process.obj src/mac/hmac/hmac_test.obj src/mac/kmac/kmac.obj src/mac/kmac/kmac_file.obj \
src/mac/kmac/kmac_memory.obj src/mac/kmac/kmac_memory_multi.obj src/mac/kmac/kmac_test.obj \
src/mac/omac/omac_done.obj src/mac/omac/omac_file.obj src/mac/omac/omac_init.obj src/mac/omac/omac_memory.obj \
src/mac/omac/omac_memory_multi.obj src/mac/omac/omac_process.obj src/mac/omac/omac_test.obj \
src/mac/pelican/pelican.obj src/mac/pelican/pelican_memory.obj src/mac/pelican/pelican_test.obj \
src/mac/pmac/pmac_done.obj src/mac/pmac/pmac_file.obj src/mac/pmac/pmac_init.obj src/mac/pmac/pmac_memory.obj \
src/mac/pmac/pmac_memory_multi.obj src/mac/pmac/pmac_ntz.obj src/mac/pmac/pmac_process.obj \
src/mac/pmac/pmac_shift_xor.obj src/mac/pmac/pmac_test.obj src/math/fp/ltc_ecc_fp_mulmod.obj \
src/math/gmp_desc.obj src/math/ltm_desc.obj src/math/multi.obj src/math/rand_prime.obj src/math/tfm_desc.obj \
src/misc/base64/base64_decode.obj src/misc/base64/base64_encode.obj src/misc/burn_stack.obj \
src/mac/pmac/pmac_shift_xor.obj src/mac/pmac/pmac_test.obj src/mac/poly1305/poly1305.obj \
src/mac/poly1305/poly1305_file.obj src/mac/poly1305/poly1305_memory.obj \
src/mac/poly1305/poly1305_memory_multi.obj src/mac/poly1305/poly1305_test.obj src/mac/xcbc/xcbc_done.obj \
src/mac/xcbc/xcbc_file.obj src/mac/xcbc/xcbc_init.obj src/mac/xcbc/xcbc_memory.obj \
src/mac/xcbc/xcbc_memory_multi.obj src/mac/xcbc/xcbc_process.obj src/mac/xcbc/xcbc_test.obj \
src/math/fp/ltc_ecc_fp_mulmod.obj src/math/gmp_desc.obj src/math/ltm_desc.obj src/math/multi.obj \
src/math/radix_to_bin.obj src/math/rand_bn.obj src/math/rand_prime.obj src/math/tfm_desc.obj src/misc/adler32.obj \
src/misc/algname_match.obj src/misc/argon2/argon2.obj src/misc/base16/base16_decode.obj \
src/misc/base16/base16_encode.obj src/misc/base32/base32_decode.obj src/misc/base32/base32_encode.obj \
src/misc/base64/base64_decode.obj src/misc/base64/base64_encode.obj src/misc/bcrypt/bcrypt.obj \
src/misc/burn_stack.obj src/misc/compare_testvector.obj src/misc/copy_or_zeromem.obj src/misc/crc32.obj \
src/misc/crypt/crypt.obj src/misc/crypt/crypt_argchk.obj src/misc/crypt/crypt_cipher_descriptor.obj \
src/misc/crypt/crypt_cipher_is_valid.obj src/misc/crypt/crypt_find_cipher.obj \
src/misc/crypt/crypt_find_cipher_any.obj src/misc/crypt/crypt_find_cipher_id.obj \
src/misc/crypt/crypt_find_hash.obj src/misc/crypt/crypt_find_hash_any.obj \
src/misc/crypt/crypt_find_hash_id.obj src/misc/crypt/crypt_find_hash_oid.obj \
src/misc/crypt/crypt_find_prng.obj src/misc/crypt/crypt_hash_descriptor.obj \
src/misc/crypt/crypt_hash_is_valid.obj src/misc/crypt/crypt_ltc_mp_descriptor.obj \
src/misc/crypt/crypt_cipher_is_valid.obj src/misc/crypt/crypt_constants.obj \
src/misc/crypt/crypt_find_cipher.obj src/misc/crypt/crypt_find_cipher_any.obj \
src/misc/crypt/crypt_find_cipher_id.obj src/misc/crypt/crypt_find_hash.obj \
src/misc/crypt/crypt_find_hash_any.obj src/misc/crypt/crypt_find_hash_id.obj \
src/misc/crypt/crypt_find_hash_oid.obj src/misc/crypt/crypt_find_prng.obj src/misc/crypt/crypt_fsa.obj \
src/misc/crypt/crypt_hash_descriptor.obj src/misc/crypt/crypt_hash_is_valid.obj \
src/misc/crypt/crypt_inits.obj src/misc/crypt/crypt_ltc_mp_descriptor.obj \
src/misc/crypt/crypt_prng_descriptor.obj src/misc/crypt/crypt_prng_is_valid.obj \
src/misc/crypt/crypt_prng_rng_descriptor.obj src/misc/crypt/crypt_register_all_ciphers.obj \
src/misc/crypt/crypt_register_all_hashes.obj src/misc/crypt/crypt_register_all_prngs.obj \
src/misc/crypt/crypt_register_cipher.obj src/misc/crypt/crypt_register_hash.obj \
src/misc/crypt/crypt_register_prng.obj src/misc/crypt/crypt_unregister_cipher.obj \
src/misc/crypt/crypt_unregister_hash.obj src/misc/crypt/crypt_unregister_prng.obj \
src/misc/error_to_string.obj src/misc/pkcs5/pkcs_5_1.obj src/misc/pkcs5/pkcs_5_2.obj src/misc/zeromem.obj \
src/modes/cbc/cbc_decrypt.obj src/modes/cbc/cbc_done.obj src/modes/cbc/cbc_encrypt.obj \
src/modes/cbc/cbc_getiv.obj src/modes/cbc/cbc_setiv.obj src/modes/cbc/cbc_start.obj \
src/modes/cfb/cfb_decrypt.obj src/modes/cfb/cfb_done.obj src/modes/cfb/cfb_encrypt.obj \
src/modes/cfb/cfb_getiv.obj src/modes/cfb/cfb_setiv.obj src/modes/cfb/cfb_start.obj \
src/modes/ctr/ctr_decrypt.obj src/modes/ctr/ctr_done.obj src/modes/ctr/ctr_encrypt.obj \
src/modes/ctr/ctr_getiv.obj src/modes/ctr/ctr_setiv.obj src/modes/ctr/ctr_start.obj \
src/misc/crypt/crypt_register_prng.obj src/misc/crypt/crypt_sizes.obj \
src/misc/crypt/crypt_unregister_cipher.obj src/misc/crypt/crypt_unregister_hash.obj \
src/misc/crypt/crypt_unregister_prng.obj src/misc/deprecated.obj src/misc/error_to_string.obj \
src/misc/hkdf/hkdf.obj src/misc/hkdf/hkdf_test.obj src/misc/mem_neq.obj src/misc/padding/padding_depad.obj \
src/misc/padding/padding_pad.obj src/misc/password_free.obj src/misc/pbes/pbes.obj src/misc/pbes/pbes1.obj \
src/misc/pbes/pbes2.obj src/misc/pem/pem.obj src/misc/pem/pem_pkcs.obj src/misc/pem/pem_read.obj \
src/misc/pem/pem_ssh.obj src/misc/pkcs12/pkcs12_kdf.obj src/misc/pkcs12/pkcs12_utf8_to_utf16.obj \
src/misc/pkcs5/pkcs_5_1.obj src/misc/pkcs5/pkcs_5_2.obj src/misc/pkcs5/pkcs_5_test.obj \
src/misc/scrypt/scrypt.obj src/misc/ssh/ssh_decode_sequence_multi.obj \
src/misc/ssh/ssh_encode_sequence_multi.obj src/misc/zeromem.obj src/modes/cbc/cbc_decrypt.obj \
src/modes/cbc/cbc_done.obj src/modes/cbc/cbc_encrypt.obj src/modes/cbc/cbc_getiv.obj \
src/modes/cbc/cbc_setiv.obj src/modes/cbc/cbc_start.obj src/modes/cfb/cfb_decrypt.obj \
src/modes/cfb/cfb_done.obj src/modes/cfb/cfb_encrypt.obj src/modes/cfb/cfb_getiv.obj \
src/modes/cfb/cfb_setiv.obj src/modes/cfb/cfb_start.obj src/modes/ctr/ctr_decrypt.obj \
src/modes/ctr/ctr_done.obj src/modes/ctr/ctr_encrypt.obj src/modes/ctr/ctr_getiv.obj \
src/modes/ctr/ctr_setiv.obj src/modes/ctr/ctr_start.obj src/modes/ctr/ctr_test.obj \
src/modes/ecb/ecb_decrypt.obj src/modes/ecb/ecb_done.obj src/modes/ecb/ecb_encrypt.obj \
src/modes/ecb/ecb_start.obj src/modes/f8/f8_decrypt.obj src/modes/f8/f8_done.obj src/modes/f8/f8_encrypt.obj \
src/modes/f8/f8_getiv.obj src/modes/f8/f8_setiv.obj src/modes/f8/f8_start.obj src/modes/f8/f8_test_mode.obj \
@ -58,10 +127,22 @@ src/modes/lrw/lrw_decrypt.obj src/modes/lrw/lrw_done.obj src/modes/lrw/lrw_encry
src/modes/lrw/lrw_getiv.obj src/modes/lrw/lrw_process.obj src/modes/lrw/lrw_setiv.obj \
src/modes/lrw/lrw_start.obj src/modes/lrw/lrw_test.obj src/modes/ofb/ofb_decrypt.obj src/modes/ofb/ofb_done.obj \
src/modes/ofb/ofb_encrypt.obj src/modes/ofb/ofb_getiv.obj src/modes/ofb/ofb_setiv.obj \
src/modes/ofb/ofb_start.obj src/pk/asn1/der/bit/der_decode_bit_string.obj \
src/pk/asn1/der/bit/der_encode_bit_string.obj src/pk/asn1/der/bit/der_length_bit_string.obj \
src/modes/ofb/ofb_start.obj src/modes/xts/xts_decrypt.obj src/modes/xts/xts_done.obj \
src/modes/xts/xts_encrypt.obj src/modes/xts/xts_init.obj src/modes/xts/xts_mult_x.obj \
src/modes/xts/xts_test.obj src/pk/asn1/der/bit/der_decode_bit_string.obj \
src/pk/asn1/der/bit/der_decode_raw_bit_string.obj src/pk/asn1/der/bit/der_encode_bit_string.obj \
src/pk/asn1/der/bit/der_encode_raw_bit_string.obj src/pk/asn1/der/bit/der_length_bit_string.obj \
src/pk/asn1/der/boolean/der_decode_boolean.obj src/pk/asn1/der/boolean/der_encode_boolean.obj \
src/pk/asn1/der/boolean/der_length_boolean.obj src/pk/asn1/der/choice/der_decode_choice.obj \
src/pk/asn1/der/custom_type/der_decode_custom_type.obj \
src/pk/asn1/der/custom_type/der_encode_custom_type.obj \
src/pk/asn1/der/custom_type/der_length_custom_type.obj src/pk/asn1/der/general/der_asn1_maps.obj \
src/pk/asn1/der/general/der_decode_asn1_identifier.obj src/pk/asn1/der/general/der_decode_asn1_length.obj \
src/pk/asn1/der/general/der_encode_asn1_identifier.obj src/pk/asn1/der/general/der_encode_asn1_length.obj \
src/pk/asn1/der/general/der_length_asn1_identifier.obj src/pk/asn1/der/general/der_length_asn1_length.obj \
src/pk/asn1/der/generalizedtime/der_decode_generalizedtime.obj \
src/pk/asn1/der/generalizedtime/der_encode_generalizedtime.obj \
src/pk/asn1/der/generalizedtime/der_length_generalizedtime.obj \
src/pk/asn1/der/ia5/der_decode_ia5_string.obj src/pk/asn1/der/ia5/der_encode_ia5_string.obj \
src/pk/asn1/der/ia5/der_length_ia5_string.obj src/pk/asn1/der/integer/der_decode_integer.obj \
src/pk/asn1/der/integer/der_encode_integer.obj src/pk/asn1/der/integer/der_length_integer.obj \
@ -77,63 +158,183 @@ src/pk/asn1/der/sequence/der_decode_sequence_ex.obj \
src/pk/asn1/der/sequence/der_decode_sequence_flexi.obj \
src/pk/asn1/der/sequence/der_decode_sequence_multi.obj \
src/pk/asn1/der/sequence/der_encode_sequence_ex.obj \
src/pk/asn1/der/sequence/der_encode_sequence_multi.obj src/pk/asn1/der/sequence/der_length_sequence.obj \
src/pk/asn1/der/sequence/der_sequence_free.obj src/pk/asn1/der/set/der_encode_set.obj \
src/pk/asn1/der/set/der_encode_setof.obj src/pk/asn1/der/short_integer/der_decode_short_integer.obj \
src/pk/asn1/der/sequence/der_encode_sequence_multi.obj \
src/pk/asn1/der/sequence/der_flexi_sequence_cmp.obj src/pk/asn1/der/sequence/der_length_sequence.obj \
src/pk/asn1/der/sequence/der_sequence_free.obj src/pk/asn1/der/sequence/der_sequence_shrink.obj \
src/pk/asn1/der/set/der_encode_set.obj src/pk/asn1/der/set/der_encode_setof.obj \
src/pk/asn1/der/short_integer/der_decode_short_integer.obj \
src/pk/asn1/der/short_integer/der_encode_short_integer.obj \
src/pk/asn1/der/short_integer/der_length_short_integer.obj src/pk/asn1/der/utctime/der_decode_utctime.obj \
src/pk/asn1/der/utctime/der_encode_utctime.obj src/pk/asn1/der/utctime/der_length_utctime.obj \
src/pk/dsa/dsa_decrypt_key.obj src/pk/dsa/dsa_encrypt_key.obj src/pk/dsa/dsa_export.obj src/pk/dsa/dsa_free.obj \
src/pk/dsa/dsa_import.obj src/pk/dsa/dsa_make_key.obj src/pk/dsa/dsa_shared_secret.obj \
src/pk/dsa/dsa_sign_hash.obj src/pk/dsa/dsa_verify_hash.obj src/pk/dsa/dsa_verify_key.obj src/pk/ecc/ecc.obj \
src/pk/ecc/ecc_decrypt_key.obj src/pk/ecc/ecc_encrypt_key.obj src/pk/ecc/ecc_export.obj src/pk/ecc/ecc_free.obj \
src/pk/ecc/ecc_get_size.obj src/pk/ecc/ecc_import.obj src/pk/ecc/ecc_make_key.obj \
src/pk/ecc/ecc_shared_secret.obj src/pk/ecc/ecc_sign_hash.obj src/pk/ecc/ecc_sizes.obj src/pk/ecc/ecc_test.obj \
src/pk/ecc/ecc_verify_hash.obj src/pk/ecc/ltc_ecc_is_valid_idx.obj src/pk/ecc/ltc_ecc_map.obj \
src/pk/asn1/der/short_integer/der_length_short_integer.obj \
src/pk/asn1/der/teletex_string/der_decode_teletex_string.obj \
src/pk/asn1/der/teletex_string/der_length_teletex_string.obj \
src/pk/asn1/der/utctime/der_decode_utctime.obj src/pk/asn1/der/utctime/der_encode_utctime.obj \
src/pk/asn1/der/utctime/der_length_utctime.obj src/pk/asn1/der/utf8/der_decode_utf8_string.obj \
src/pk/asn1/der/utf8/der_encode_utf8_string.obj src/pk/asn1/der/utf8/der_length_utf8_string.obj \
src/pk/asn1/oid/pk_get.obj src/pk/asn1/oid/pk_oid_cmp.obj src/pk/asn1/oid/pk_oid_str.obj \
src/pk/asn1/pkcs8/pkcs8_decode_flexi.obj src/pk/asn1/pkcs8/pkcs8_get.obj \
src/pk/asn1/x509/x509_decode_public_key_from_certificate.obj src/pk/asn1/x509/x509_decode_spki.obj \
src/pk/asn1/x509/x509_decode_subject_public_key_info.obj \
src/pk/asn1/x509/x509_encode_subject_public_key_info.obj src/pk/asn1/x509/x509_get_pka.obj \
src/pk/asn1/x509/x509_import_spki.obj src/pk/dh/dh.obj src/pk/dh/dh_check_pubkey.obj src/pk/dh/dh_export.obj \
src/pk/dh/dh_export_key.obj src/pk/dh/dh_free.obj src/pk/dh/dh_generate_key.obj src/pk/dh/dh_import.obj \
src/pk/dh/dh_import_pkcs8.obj src/pk/dh/dh_set.obj src/pk/dh/dh_set_pg_dhparam.obj \
src/pk/dh/dh_shared_secret.obj src/pk/dsa/dsa_decrypt_key.obj src/pk/dsa/dsa_encrypt_key.obj \
src/pk/dsa/dsa_export.obj src/pk/dsa/dsa_free.obj src/pk/dsa/dsa_generate_key.obj \
src/pk/dsa/dsa_generate_pqg.obj src/pk/dsa/dsa_import.obj src/pk/dsa/dsa_import_pkcs8.obj \
src/pk/dsa/dsa_init.obj src/pk/dsa/dsa_make_key.obj src/pk/dsa/dsa_set.obj src/pk/dsa/dsa_set_pqg_dsaparam.obj \
src/pk/dsa/dsa_shared_secret.obj src/pk/dsa/dsa_sign_hash.obj src/pk/dsa/dsa_verify_hash.obj \
src/pk/dsa/dsa_verify_key.obj src/pk/ec25519/ec25519_crypto_ctx.obj src/pk/ec25519/ec25519_export.obj \
src/pk/ec25519/ec25519_import_pkcs8.obj src/pk/ec25519/tweetnacl.obj src/pk/ec448/ec448_common.obj \
src/pk/ec448/ec448_crypto_ctx.obj src/pk/ec448/ec448_export.obj src/pk/ec448/ec448_import_pkcs8.obj \
src/pk/ecc/ecc.obj src/pk/ecc/ecc_ansi_x963_export.obj src/pk/ecc/ecc_ansi_x963_import.obj \
src/pk/ecc/ecc_decrypt_key.obj src/pk/ecc/ecc_encrypt_key.obj src/pk/ecc/ecc_export.obj \
src/pk/ecc/ecc_export_openssl.obj src/pk/ecc/ecc_find_curve.obj src/pk/ecc/ecc_free.obj \
src/pk/ecc/ecc_get_key.obj src/pk/ecc/ecc_get_oid_str.obj src/pk/ecc/ecc_get_size.obj src/pk/ecc/ecc_import.obj \
src/pk/ecc/ecc_import_openssl.obj src/pk/ecc/ecc_import_pkcs8.obj src/pk/ecc/ecc_import_x509.obj \
src/pk/ecc/ecc_make_key.obj src/pk/ecc/ecc_recover_key.obj src/pk/ecc/ecc_rfc6979_key.obj \
src/pk/ecc/ecc_set_curve.obj src/pk/ecc/ecc_set_curve_internal.obj src/pk/ecc/ecc_set_key.obj \
src/pk/ecc/ecc_shared_secret.obj src/pk/ecc/ecc_sign_hash.obj src/pk/ecc/ecc_sign_hash_eth27.obj \
src/pk/ecc/ecc_sign_hash_internal.obj src/pk/ecc/ecc_sign_hash_rfc5656.obj \
src/pk/ecc/ecc_sign_hash_rfc7518.obj src/pk/ecc/ecc_sign_hash_x962.obj src/pk/ecc/ecc_sizes.obj \
src/pk/ecc/ecc_ssh_ecdsa_encode_name.obj src/pk/ecc/ecc_verify_hash.obj src/pk/ecc/ecc_verify_hash_eth27.obj \
src/pk/ecc/ecc_verify_hash_internal.obj src/pk/ecc/ecc_verify_hash_rfc5656.obj \
src/pk/ecc/ecc_verify_hash_rfc7518.obj src/pk/ecc/ecc_verify_hash_x962.obj \
src/pk/ecc/ltc_ecc_export_point.obj src/pk/ecc/ltc_ecc_import_point.obj src/pk/ecc/ltc_ecc_is_point.obj \
src/pk/ecc/ltc_ecc_is_point_at_infinity.obj src/pk/ecc/ltc_ecc_map.obj src/pk/ecc/ltc_ecc_mul2add.obj \
src/pk/ecc/ltc_ecc_mulmod.obj src/pk/ecc/ltc_ecc_mulmod_timing.obj src/pk/ecc/ltc_ecc_points.obj \
src/pk/ecc/ltc_ecc_projective_add_point.obj src/pk/ecc/ltc_ecc_projective_dbl_point.obj \
src/pk/katja/katja_decrypt_key.obj src/pk/katja/katja_encrypt_key.obj src/pk/katja/katja_export.obj \
src/pk/katja/katja_exptmod.obj src/pk/katja/katja_free.obj src/pk/katja/katja_import.obj \
src/pk/katja/katja_make_key.obj src/pk/pkcs1/pkcs_1_i2osp.obj src/pk/pkcs1/pkcs_1_mgf1.obj \
src/pk/pkcs1/pkcs_1_oaep_decode.obj src/pk/pkcs1/pkcs_1_oaep_encode.obj src/pk/pkcs1/pkcs_1_os2ip.obj \
src/pk/pkcs1/pkcs_1_pss_decode.obj src/pk/pkcs1/pkcs_1_pss_encode.obj src/pk/rsa/rsa_decrypt_key.obj \
src/pk/rsa/rsa_encrypt_key.obj src/pk/rsa/rsa_export.obj src/pk/rsa/rsa_exptmod.obj src/pk/rsa/rsa_free.obj \
src/pk/rsa/rsa_import.obj src/pk/rsa/rsa_make_key.obj src/pk/rsa/rsa_sign_hash.obj \
src/pk/rsa/rsa_verify_hash.obj src/prngs/fortuna.obj src/prngs/rc4.obj src/prngs/rng_get_bytes.obj \
src/prngs/rng_make_prng.obj src/prngs/sober128.obj src/prngs/sprng.obj src/prngs/yarrow.obj
src/pk/ecc/ltc_ecc_verify_key.obj src/pk/ed25519/ed25519_export.obj src/pk/ed25519/ed25519_import.obj \
src/pk/ed25519/ed25519_import_pkcs8.obj src/pk/ed25519/ed25519_import_raw.obj \
src/pk/ed25519/ed25519_import_x509.obj src/pk/ed25519/ed25519_make_key.obj src/pk/ed25519/ed25519_sign.obj \
src/pk/ed25519/ed25519_verify.obj src/pk/ed448/ed448_export.obj src/pk/ed448/ed448_import.obj \
src/pk/ed448/ed448_import_pkcs8.obj src/pk/ed448/ed448_import_raw.obj src/pk/ed448/ed448_import_x509.obj \
src/pk/ed448/ed448_make_key.obj src/pk/ed448/ed448_sign.obj src/pk/ed448/ed448_verify.obj src/pk/pka_key.obj \
src/pk/pkcs1/pkcs_1_i2osp.obj src/pk/pkcs1/pkcs_1_mgf1.obj src/pk/pkcs1/pkcs_1_oaep_decode.obj \
src/pk/pkcs1/pkcs_1_oaep_encode.obj src/pk/pkcs1/pkcs_1_os2ip.obj src/pk/pkcs1/pkcs_1_pss_decode.obj \
src/pk/pkcs1/pkcs_1_pss_encode.obj src/pk/pkcs1/pkcs_1_v1_5_decode.obj src/pk/pkcs1/pkcs_1_v1_5_encode.obj \
src/pk/rsa/rsa_decrypt_key.obj src/pk/rsa/rsa_encrypt_key.obj src/pk/rsa/rsa_export.obj \
src/pk/rsa/rsa_exptmod.obj src/pk/rsa/rsa_get_size.obj src/pk/rsa/rsa_import.obj \
src/pk/rsa/rsa_import_pkcs8.obj src/pk/rsa/rsa_import_x509.obj src/pk/rsa/rsa_key.obj \
src/pk/rsa/rsa_make_key.obj src/pk/rsa/rsa_set.obj src/pk/rsa/rsa_sign_hash.obj \
src/pk/rsa/rsa_sign_saltlen_get.obj src/pk/rsa/rsa_verify_hash.obj src/pk/x25519/x25519_export.obj \
src/pk/x25519/x25519_import.obj src/pk/x25519/x25519_import_pkcs8.obj src/pk/x25519/x25519_import_raw.obj \
src/pk/x25519/x25519_import_x509.obj src/pk/x25519/x25519_make_key.obj \
src/pk/x25519/x25519_shared_secret.obj src/pk/x448/x448_export.obj src/pk/x448/x448_import.obj \
src/pk/x448/x448_import_pkcs8.obj src/pk/x448/x448_import_raw.obj src/pk/x448/x448_import_x509.obj \
src/pk/x448/x448_make_key.obj src/pk/x448/x448_shared_secret.obj src/prngs/chacha20.obj src/prngs/fortuna.obj \
src/prngs/rc4.obj src/prngs/rng_get_bytes.obj src/prngs/rng_make_prng.obj src/prngs/sober128.obj \
src/prngs/sprng.obj src/prngs/yarrow.obj src/stream/chacha/chacha_crypt.obj src/stream/chacha/chacha_done.obj \
src/stream/chacha/chacha_ivctr32.obj src/stream/chacha/chacha_ivctr64.obj \
src/stream/chacha/chacha_keystream.obj src/stream/chacha/chacha_memory.obj \
src/stream/chacha/chacha_setup.obj src/stream/chacha/chacha_test.obj src/stream/chacha/xchacha20_memory.obj \
src/stream/chacha/xchacha20_setup.obj src/stream/chacha/xchacha20_test.obj src/stream/rabbit/rabbit.obj \
src/stream/rabbit/rabbit_memory.obj src/stream/rc4/rc4_stream.obj src/stream/rc4/rc4_stream_memory.obj \
src/stream/rc4/rc4_test.obj src/stream/salsa20/salsa20_crypt.obj src/stream/salsa20/salsa20_done.obj \
src/stream/salsa20/salsa20_ivctr64.obj src/stream/salsa20/salsa20_keystream.obj \
src/stream/salsa20/salsa20_memory.obj src/stream/salsa20/salsa20_setup.obj \
src/stream/salsa20/salsa20_test.obj src/stream/salsa20/xsalsa20_memory.obj \
src/stream/salsa20/xsalsa20_setup.obj src/stream/salsa20/xsalsa20_test.obj \
src/stream/sober128/sober128_stream.obj src/stream/sober128/sober128_stream_memory.obj \
src/stream/sober128/sober128_test.obj src/stream/sosemanuk/sosemanuk.obj \
src/stream/sosemanuk/sosemanuk_memory.obj src/stream/sosemanuk/sosemanuk_test.obj
HEADERS=src/headers/tomcrypt_cfg.h src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h \
src/headers/tomcrypt_custom.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cipher.h \
src/headers/tomcrypt_pk.h src/headers/tomcrypt_hash.h src/headers/tomcrypt_math.h \
src/headers/tomcrypt_misc.h src/headers/tomcrypt.h src/headers/tomcrypt_pkcs.h \
src/headers/tomcrypt_prng.h testprof/tomcrypt_test.h
#List of test objects to compile
TOBJECTS=tests/argon2_test.obj tests/base16_test.obj tests/base32_test.obj tests/base64_test.obj \
tests/bcrypt_test.obj tests/cipher_hash_test.obj tests/common.obj tests/deprecated_test.obj tests/der_test.obj \
tests/dh_test.obj tests/dsa_test.obj tests/ecc_test.obj tests/ed25519_test.obj tests/ed448_test.obj \
tests/file_test.obj tests/mac_test.obj tests/misc_test.obj tests/modes_test.obj tests/mpi_test.obj \
tests/multi_test.obj tests/no_null_termination_check_test.obj tests/no_prng.obj tests/padding_test.obj \
tests/pem_test.obj tests/pk_oid_test.obj tests/pkcs_1_eme_test.obj tests/pkcs_1_emsa_test.obj \
tests/pkcs_1_oaep_test.obj tests/pkcs_1_pss_test.obj tests/pkcs_1_test.obj tests/prng_test.obj \
tests/rotate_test.obj tests/rsa_test.obj tests/scrypt_test.obj tests/siv_wycheproof_test.obj tests/ssh_test.obj \
tests/store_test.obj tests/test.obj tests/x25519_test.obj tests/x448_test.obj
#END_INS
#The following headers will be installed by "make install"
HEADERS_PUB=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
src/headers/tomcrypt_cipher.h src/headers/tomcrypt_custom.h src/headers/tomcrypt_hash.h \
src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h src/headers/tomcrypt_math.h \
src/headers/tomcrypt_misc.h src/headers/tomcrypt_pk.h src/headers/tomcrypt_pkcs.h \
src/headers/tomcrypt_prng.h
default: library
HEADERS=$(HEADERS_PUB) src/headers/tomcrypt_private.h
#ciphers come in two flavours... enc+dec and enc
#The default rule for make builds the tomcrypt.lib library (static)
default: $(LIBMAIN_S)
#SPECIAL: AES comes in two flavours - enc+dec and enc-only
src/ciphers/aes/aes_enc.obj: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
$(CC) $(CFLAGS) /DENCRYPT_ONLY /c src/ciphers/aes/aes.c /Fosrc/ciphers/aes/aes_enc.obj
$(CC) $(LTC_CFLAGS) /DENCRYPT_ONLY /c src/ciphers/aes/aes.c /Fosrc/ciphers/aes/aes_enc.obj
src/ciphers/aes/aes_enc_desc.obj: src/ciphers/aes/aes_desc.c
$(CC) $(LTC_CFLAGS) /DENCRYPT_ONLY /c src/ciphers/aes/aes_desc.c /Fosrc/ciphers/aes/aes_enc_desc.obj
library: $(OBJECTS)
lib /out:tomcrypt.lib $(OBJECTS)
cd testprof
nmake -f makefile.msvc
cd ..
tv_gen: demos/tv_gen.c library
cl $(CFLAGS) demos/tv_gen.c tomcrypt.lib advapi32.lib $(EXTRALIBS)
#SPECIAL: these are the rules to make certain object files
src/ciphers/aes/aes.obj: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
src/ciphers/twofish/twofish.obj: src/ciphers/twofish/twofish.c src/ciphers/twofish/twofish_tab.c
src/hashes/sha2/sha256.obj: src/hashes/sha2/sha256.c src/hashes/sha2/sha224.c
src/hashes/sha2/sha384.obj: src/hashes/sha2/sha384.c src/hashes/sha2/sha512.c
src/hashes/sha2/sha512.obj: src/hashes/sha2/sha512.c src/hashes/sha2/sha384.c
src/hashes/sha2/sha512_224.obj: src/hashes/sha2/sha512.c src/hashes/sha2/sha512_224.c
src/hashes/sha2/sha512_256.obj: src/hashes/sha2/sha512.c src/hashes/sha2/sha512_256.c
src/hashes/whirl/whirl.obj: src/hashes/whirl/whirl.c src/hashes/whirl/whirltab.c
hashsum: demos/hashsum.c library
cl $(CFLAGS) demos/hashsum.c tomcrypt.lib advapi32.lib $(EXTRALIBS)
#Dependencies on *.h
$(OBJECTS): $(HEADERS)
$(TOBJECTS): $(HEADERS) tests/tomcrypt_test.h
test: demos/test.c library
cl $(CFLAGS) demos/test.c testprof/tomcrypt_prof.lib tomcrypt.lib advapi32.lib $(EXTRALIBS)
.c.obj:
$(CC) $(LTC_CFLAGS) /c $< /Fo$@
timing: demos/timing.c library
cl $(CFLAGS) demos/timing.c testprof/tomcrypt_prof.lib tomcrypt.lib advapi32.lib $(EXTRALIBS)
#Create tomcrypt.lib
$(LIBMAIN_S): $(OBJECTS)
lib /out:$(LIBMAIN_S) $(OBJECTS)
# $Source: /cvs/libtom/libtomcrypt/makefile.msvc,v $
# $Revision: 1.36 $
# $Date: 2006/06/16 23:52:08 $
#Demo tools/utilities
hashsum.exe: demos/hashsum.c tests/common.c $(LIBMAIN_S)
$(CC) $(LTC_CFLAGS) demos/hashsum.c tests/common.c $(LIBMAIN_S) $(LTC_LDFLAGS) /Fe$@
crypt.exe: demos/crypt.c $(LIBMAIN_S)
$(CC) $(LTC_CFLAGS) demos/crypt.c tests/common.c $(LIBMAIN_S) $(LTC_LDFLAGS) /Fe$@
small.exe: demos/small.c $(LIBMAIN_S)
$(CC) $(LTC_CFLAGS) demos/small.c tests/common.c $(LIBMAIN_S) $(LTC_LDFLAGS) /Fe$@
tv_gen.exe: demos/tv_gen.c $(LIBMAIN_S)
$(CC) $(LTC_CFLAGS) demos/tv_gen.c tests/common.c $(LIBMAIN_S) $(LTC_LDFLAGS) /Fe$@
sizes.exe: demos/sizes.c $(LIBMAIN_S)
$(CC) $(LTC_CFLAGS) demos/sizes.c tests/common.c $(LIBMAIN_S) $(LTC_LDFLAGS) /Fe$@
constants.exe: demos/constants.c $(LIBMAIN_S)
$(CC) $(LTC_CFLAGS) demos/constants.c tests/common.c $(LIBMAIN_S) $(LTC_LDFLAGS) /Fe$@
timing.exe: demos/timing.c $(LIBMAIN_S)
$(CC) $(LTC_CFLAGS) demos/timing.c tests/common.c $(LIBMAIN_S) $(LTC_LDFLAGS) /Fe$@
der_print_flexi.exe: demos/der_print_flexi.c $(LIBMAIN_S)
$(CC) $(LTC_CFLAGS) demos/der_print_flexi.c tests/common.c $(LIBMAIN_S) $(LTC_LDFLAGS) /Fe$@
#Tests
test.exe: $(LIBMAIN_S) $(TOBJECTS)
$(CC) $(LTC_CFLAGS) $(TOBJECTS) $(LIBMAIN_S) $(LTC_LDFLAGS) /Fe$@
@echo NOTICE: start the tests by launching test.exe
ALL_TEST=hashsum.exe crypt.exe small.exe tv_gen.exe sizes.exe constants.exe timing.exe test.exe
all: $(LIBMAIN_S) $(ALL_TEST)
test: test.exe
clean:
@-cmd /c del /Q *_tv.txt 2>nul
@-cmd /c del /Q /S *.OBJ *.LIB $(ALL_TEST) *.DLL 2>nul
#Install the library + headers
install: $(LIBMAIN_S)
cmd /c if not exist "$(PREFIX)\bin" mkdir "$(PREFIX)\bin"
cmd /c if not exist "$(PREFIX)\lib" mkdir "$(PREFIX)\lib"
cmd /c if not exist "$(PREFIX)\include" mkdir "$(PREFIX)\include"
copy /Y $(LIBMAIN_S) "$(PREFIX)\lib"
copy /Y src\headers\tomcrypt*.h "$(PREFIX)\include"
#Install useful tools
install_bins: hashsum.exe
cmd /c if not exist "$(PREFIX)\bin" mkdir "$(PREFIX)\bin"
copy /Y hashsum.exe "$(PREFIX)\bin\ltc-hashsum.exe"
#Install documentation
install_docs: doc/crypt.pdf
cmd /c if not exist "$(PREFIX)\doc" mkdir "$(PREFIX)\doc"
copy /Y doc\crypt.pdf "$(PREFIX)\doc"

View file

@ -1,269 +1,131 @@
# MAKEFILE for linux GCC
#
# This makefile produces a shared object and requires libtool to be installed.
# This makefile produces a shared object.
#
# Thanks to Zed Shaw for helping debug this on BSD/OSX.
# Thanks to Zed Shaw for helping debug this on BSD/OSX.
# Tom St Denis
#
# (GNU make only)
# The version
VERSION=0:113
### USAGE:
#
# CFLAGS="-DUSE_LTM -DLTM_DESC -I/path/to/libtommath" make -f makefile.shared all EXTRALIBS=/path/to/libtommath/libtommath.a
# ./test
# make -f makefile.shared PREFIX=/opt/libtom install
#
# Compiler and Linker Names
CC=libtool --mode=compile --tag=CC gcc
PLATFORM := $(shell uname | sed -e 's/_.*//')
### Observed uname outputs:
# MINGW32_NT-6.2 (on MSYS/MINGW old)
# MINGW64_NT-10.0-14393 (on MSYS new)
# MSYS_NT-10.0-19042 (on MSYS2)
# CYGWIN_NT-10.0 (on Cygwin 64bit)
# CYGWIN_NT-6.2-WOW64 (on Cygwin 32bit)
# Linux (on all Linux distros)
# Darwin (on macOS, OS X)
# ranlib tools
ifndef RANLIB
RANLIB=ranlib
INSTALL_CMD := install
UNINSTALL_CMD := rm -f
NAME := libtomcrypt
PIC := -fPIC
SHARED := $(PIC)
ifeq ($(UNAME), Darwin)
NO_UNDEFINED := -Wl,-undefined,error
SHARED += -dynamiclib
else
NO_UNDEFIED := -Wl,--no-undefined
SHARED += -shared
endif
# Compilation flags. Note the += does not write over the user's CFLAGS!
CFLAGS += -c -I./src/headers/ -Wall -Wsign-compare -W -Wshadow -DLTC_SOURCE
# additional warnings (newer GCC 3.4 and higher)
ifdef GCC_34
CFLAGS += -Wsystem-headers -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wpointer-arith
ifeq ($(PLATFORM), Darwin)
TARGET := $(NAME).dylib
else ifeq ($(OS), Windows_NT)
TARGET := $(NAME).dll
else
TARGET := $(NAME).so
endif
ifndef IGNORE_SPEED
# optimize for SPEED
CFLAGS += -O3 -funroll-loops
# add -fomit-frame-pointer. hinders debugging!
CFLAGS += -fomit-frame-pointer
# optimize for SIZE
#CFLAGS += -Os -DLTC_SMALL_CODE
endif
# compile for DEBUGING (required for ccmalloc checking!!!)
#CFLAGS += -g3
# older GCCs can't handle the "rotate with immediate" ROLc/RORc/etc macros
# define this to help
#CFLAGS += -DLTC_NO_ROLC
#Output filenames for various targets.
ifndef LIBTEST_S
LIBTEST_S=libtomcrypt_prof.a
endif
ifndef LIBTEST
LIBTEST=libtomcrypt_prof.la
endif
ifndef LIBNAME
LIBNAME=libtomcrypt.la
endif
ifndef LIBNAME_S
LIBNAME_S=libtomcrypt.a
LIBNAME = $(TARGET).$(VERSION_LT)
endif
HASH=hashsum
CRYPT=encrypt
SMALL=small
PROF=x86_prof
TV=tv_gen
TEST=test
TIMING=timing
include makefile_include.mk
#LIBPATH-The directory for libtomcrypt to be installed to.
#INCPATH-The directory to install the header files for libtomcrypt.
#DATAPATH-The directory to install the pdf docs.
ifndef DESTDIR
DESTDIR=
ifneq ($(findstring -DLTM_DESC,$(LTC_CFLAGS)),)
LTC_PKG_CONFIG_CFLAGS += -DLTM_DESC
LTC_PKG_CONFIG_LIBS += -ltommath
endif
ifndef LIBPATH
LIBPATH=/usr/lib
ifneq ($(findstring -DTFM_DESC,$(LTC_CFLAGS)),)
LTC_PKG_CONFIG_CFLAGS += -DTFM_DESC
LTC_PKG_CONFIG_LIBS += -ltfm
endif
ifndef INCPATH
INCPATH=/usr/include
ifneq ($(findstring -DGMP_DESC,$(LTC_CFLAGS)),)
LTC_PKG_CONFIG_CFLAGS += -DGMP_DESC
LTC_PKG_CONFIG_LIBS += -lgmp
endif
ifndef DATAPATH
DATAPATH=/usr/share/doc/libtomcrypt/pdf
ifneq ($(findstring -DLTC_PTHREAD,$(LTC_CFLAGS)),)
LTC_PKG_CONFIG_CFLAGS += -DLTC_PTHREAD
endif
#Who do we install as?
ifdef INSTALL_USER
USER=$(INSTALL_USER)
else
USER=root
endif
# set PKG_CONFIG_CFLAGS and PKG_CONFIG_LIBS to what your environment requires
LTC_PKG_CONFIG_CFLAGS += $(PKG_CONFIG_CFLAGS)
LTC_PKG_CONFIG_LIBS += $(PKG_CONFIG_LIBS)
ifdef INSTALL_GROUP
GROUP=$(INSTALL_GROUP)
else
GROUP=wheel
endif
.PHONY: check install install_bins uninstall
#List of objects to compile.
#START_INS
OBJECTS=src/ciphers/aes/aes_enc.o src/ciphers/aes/aes.o src/ciphers/anubis.o src/ciphers/blowfish.o \
src/ciphers/cast5.o src/ciphers/des.o src/ciphers/khazad.o src/ciphers/noekeon.o src/ciphers/rc2.o \
src/ciphers/rc5.o src/ciphers/rc6.o src/ciphers/safer/safer.o src/ciphers/safer/safer_tab.o \
src/ciphers/safer/saferp.o src/ciphers/skipjack.o src/ciphers/twofish/twofish.o src/ciphers/xtea.o \
src/encauth/ccm/ccm_memory.o src/encauth/ccm/ccm_test.o src/encauth/eax/eax_addheader.o \
src/encauth/eax/eax_decrypt.o src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o \
src/encauth/eax/eax_encrypt.o src/encauth/eax/eax_encrypt_authenticate_memory.o \
src/encauth/eax/eax_init.o src/encauth/eax/eax_test.o src/encauth/gcm/gcm_add_aad.o \
src/encauth/gcm/gcm_add_iv.o src/encauth/gcm/gcm_done.o src/encauth/gcm/gcm_gf_mult.o \
src/encauth/gcm/gcm_init.o src/encauth/gcm/gcm_memory.o src/encauth/gcm/gcm_mult_h.o \
src/encauth/gcm/gcm_process.o src/encauth/gcm/gcm_reset.o src/encauth/gcm/gcm_test.o \
src/encauth/ocb/ocb_decrypt.o src/encauth/ocb/ocb_decrypt_verify_memory.o \
src/encauth/ocb/ocb_done_decrypt.o src/encauth/ocb/ocb_done_encrypt.o src/encauth/ocb/ocb_encrypt.o \
src/encauth/ocb/ocb_encrypt_authenticate_memory.o src/encauth/ocb/ocb_init.o src/encauth/ocb/ocb_ntz.o \
src/encauth/ocb/ocb_shift_xor.o src/encauth/ocb/ocb_test.o src/encauth/ocb/s_ocb_done.o \
src/hashes/chc/chc.o src/hashes/helper/hash_file.o src/hashes/helper/hash_filehandle.o \
src/hashes/helper/hash_memory.o src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o \
src/hashes/md5.o src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/sha1.o src/hashes/sha2/sha256.o \
src/hashes/sha2/sha512.o src/hashes/tiger.o src/hashes/whirl/whirl.o src/mac/hmac/hmac_done.o \
src/mac/hmac/hmac_file.o src/mac/hmac/hmac_init.o src/mac/hmac/hmac_memory.o \
src/mac/hmac/hmac_memory_multi.o src/mac/hmac/hmac_process.o src/mac/hmac/hmac_test.o \
src/mac/omac/omac_done.o src/mac/omac/omac_file.o src/mac/omac/omac_init.o src/mac/omac/omac_memory.o \
src/mac/omac/omac_memory_multi.o src/mac/omac/omac_process.o src/mac/omac/omac_test.o \
src/mac/pelican/pelican.o src/mac/pelican/pelican_memory.o src/mac/pelican/pelican_test.o \
src/mac/pmac/pmac_done.o src/mac/pmac/pmac_file.o src/mac/pmac/pmac_init.o src/mac/pmac/pmac_memory.o \
src/mac/pmac/pmac_memory_multi.o src/mac/pmac/pmac_ntz.o src/mac/pmac/pmac_process.o \
src/mac/pmac/pmac_shift_xor.o src/mac/pmac/pmac_test.o src/math/fp/ltc_ecc_fp_mulmod.o \
src/math/gmp_desc.o src/math/ltm_desc.o src/math/multi.o src/math/rand_prime.o src/math/tfm_desc.o \
src/misc/base64/base64_decode.o src/misc/base64/base64_encode.o src/misc/burn_stack.o \
src/misc/crypt/crypt.o src/misc/crypt/crypt_argchk.o src/misc/crypt/crypt_cipher_descriptor.o \
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_find_cipher.o \
src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher_id.o \
src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_any.o \
src/misc/crypt/crypt_find_hash_id.o src/misc/crypt/crypt_find_hash_oid.o \
src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_hash_descriptor.o \
src/misc/crypt/crypt_hash_is_valid.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
src/misc/crypt/crypt_prng_descriptor.o src/misc/crypt/crypt_prng_is_valid.o \
src/misc/crypt/crypt_register_cipher.o src/misc/crypt/crypt_register_hash.o \
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_unregister_cipher.o \
src/misc/crypt/crypt_unregister_hash.o src/misc/crypt/crypt_unregister_prng.o \
src/misc/error_to_string.o src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o src/misc/zeromem.o \
src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o \
src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o \
src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o \
src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o \
src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o \
src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o \
src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \
src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \
src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \
src/modes/lrw/lrw_decrypt.o src/modes/lrw/lrw_done.o src/modes/lrw/lrw_encrypt.o \
src/modes/lrw/lrw_getiv.o src/modes/lrw/lrw_process.o src/modes/lrw/lrw_setiv.o \
src/modes/lrw/lrw_start.o src/modes/lrw/lrw_test.o src/modes/ofb/ofb_decrypt.o src/modes/ofb/ofb_done.o \
src/modes/ofb/ofb_encrypt.o src/modes/ofb/ofb_getiv.o src/modes/ofb/ofb_setiv.o \
src/modes/ofb/ofb_start.o src/pk/asn1/der/bit/der_decode_bit_string.o \
src/pk/asn1/der/bit/der_encode_bit_string.o src/pk/asn1/der/bit/der_length_bit_string.o \
src/pk/asn1/der/boolean/der_decode_boolean.o src/pk/asn1/der/boolean/der_encode_boolean.o \
src/pk/asn1/der/boolean/der_length_boolean.o src/pk/asn1/der/choice/der_decode_choice.o \
src/pk/asn1/der/ia5/der_decode_ia5_string.o src/pk/asn1/der/ia5/der_encode_ia5_string.o \
src/pk/asn1/der/ia5/der_length_ia5_string.o src/pk/asn1/der/integer/der_decode_integer.o \
src/pk/asn1/der/integer/der_encode_integer.o src/pk/asn1/der/integer/der_length_integer.o \
src/pk/asn1/der/object_identifier/der_decode_object_identifier.o \
src/pk/asn1/der/object_identifier/der_encode_object_identifier.o \
src/pk/asn1/der/object_identifier/der_length_object_identifier.o \
src/pk/asn1/der/octet/der_decode_octet_string.o src/pk/asn1/der/octet/der_encode_octet_string.o \
src/pk/asn1/der/octet/der_length_octet_string.o \
src/pk/asn1/der/printable_string/der_decode_printable_string.o \
src/pk/asn1/der/printable_string/der_encode_printable_string.o \
src/pk/asn1/der/printable_string/der_length_printable_string.o \
src/pk/asn1/der/sequence/der_decode_sequence_ex.o \
src/pk/asn1/der/sequence/der_decode_sequence_flexi.o \
src/pk/asn1/der/sequence/der_decode_sequence_multi.o \
src/pk/asn1/der/sequence/der_encode_sequence_ex.o \
src/pk/asn1/der/sequence/der_encode_sequence_multi.o src/pk/asn1/der/sequence/der_length_sequence.o \
src/pk/asn1/der/sequence/der_sequence_free.o src/pk/asn1/der/set/der_encode_set.o \
src/pk/asn1/der/set/der_encode_setof.o src/pk/asn1/der/short_integer/der_decode_short_integer.o \
src/pk/asn1/der/short_integer/der_encode_short_integer.o \
src/pk/asn1/der/short_integer/der_length_short_integer.o src/pk/asn1/der/utctime/der_decode_utctime.o \
src/pk/asn1/der/utctime/der_encode_utctime.o src/pk/asn1/der/utctime/der_length_utctime.o \
src/pk/dsa/dsa_decrypt_key.o src/pk/dsa/dsa_encrypt_key.o src/pk/dsa/dsa_export.o src/pk/dsa/dsa_free.o \
src/pk/dsa/dsa_import.o src/pk/dsa/dsa_make_key.o src/pk/dsa/dsa_shared_secret.o \
src/pk/dsa/dsa_sign_hash.o src/pk/dsa/dsa_verify_hash.o src/pk/dsa/dsa_verify_key.o src/pk/ecc/ecc.o \
src/pk/ecc/ecc_decrypt_key.o src/pk/ecc/ecc_encrypt_key.o src/pk/ecc/ecc_export.o src/pk/ecc/ecc_free.o \
src/pk/ecc/ecc_get_size.o src/pk/ecc/ecc_import.o src/pk/ecc/ecc_make_key.o \
src/pk/ecc/ecc_shared_secret.o src/pk/ecc/ecc_sign_hash.o src/pk/ecc/ecc_sizes.o src/pk/ecc/ecc_test.o \
src/pk/ecc/ecc_verify_hash.o src/pk/ecc/ltc_ecc_is_valid_idx.o src/pk/ecc/ltc_ecc_map.o \
src/pk/ecc/ltc_ecc_mulmod.o src/pk/ecc/ltc_ecc_mulmod_timing.o src/pk/ecc/ltc_ecc_points.o \
src/pk/ecc/ltc_ecc_projective_add_point.o src/pk/ecc/ltc_ecc_projective_dbl_point.o \
src/pk/katja/katja_decrypt_key.o src/pk/katja/katja_encrypt_key.o src/pk/katja/katja_export.o \
src/pk/katja/katja_exptmod.o src/pk/katja/katja_free.o src/pk/katja/katja_import.o \
src/pk/katja/katja_make_key.o src/pk/pkcs1/pkcs_1_i2osp.o src/pk/pkcs1/pkcs_1_mgf1.o \
src/pk/pkcs1/pkcs_1_oaep_decode.o src/pk/pkcs1/pkcs_1_oaep_encode.o src/pk/pkcs1/pkcs_1_os2ip.o \
src/pk/pkcs1/pkcs_1_pss_decode.o src/pk/pkcs1/pkcs_1_pss_encode.o src/pk/rsa/rsa_decrypt_key.o \
src/pk/rsa/rsa_encrypt_key.o src/pk/rsa/rsa_export.o src/pk/rsa/rsa_exptmod.o src/pk/rsa/rsa_free.o \
src/pk/rsa/rsa_import.o src/pk/rsa/rsa_make_key.o src/pk/rsa/rsa_sign_hash.o \
src/pk/rsa/rsa_verify_hash.o src/prngs/fortuna.o src/prngs/rc4.o src/prngs/rng_get_bytes.o \
src/prngs/rng_make_prng.o src/prngs/sober128.o src/prngs/sprng.o src/prngs/yarrow.o
.bin/.tag: bin.in
mkdir -p .bin
touch $@
HEADERS=src/headers/tomcrypt_cfg.h src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h \
src/headers/tomcrypt_custom.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cipher.h \
src/headers/tomcrypt_pk.h src/headers/tomcrypt_hash.h src/headers/tomcrypt_math.h \
src/headers/tomcrypt_misc.h src/headers/tomcrypt.h src/headers/tomcrypt_pkcs.h \
src/headers/tomcrypt_prng.h testprof/tomcrypt_test.h
#END_INS
TESTOBJECTS=demos/test.o
HASHOBJECTS=demos/hashsum.o
CRYPTOBJECTS=demos/encrypt.o
SMALLOBJECTS=demos/small.o
TVS=demos/tv_gen.o
TESTS=demos/test.o
TIMINGS=demos/timing.o
#The default rule for make builds the libtomcrypt library.
default:library
#ciphers come in two flavours... enc+dec and enc
#ciphers come in two flavours... enc+dec and enc
src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
$(CC) $(CFLAGS) -DENCRYPT_ONLY -c src/ciphers/aes/aes.c -o src/ciphers/aes/aes_enc.o
$(CC) $(LTC_CFLAGS) $(PIC) $(CPPFLAGS) -DENCRYPT_ONLY -c src/ciphers/aes/aes.c -o src/ciphers/aes/aes_enc.o
src/ciphers/aes/aes_enc_desc.o: src/ciphers/aes/aes_desc.c
$(CC) $(LTC_CFLAGS) $(PIC) $(CPPFLAGS) -DENCRYPT_ONLY -c src/ciphers/aes/aes_desc.c -o src/ciphers/aes/aes_enc_desc.o
#These are the rules to make certain object files.
src/ciphers/aes/aes.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
src/ciphers/twofish/twofish.o: src/ciphers/twofish/twofish.c src/ciphers/twofish/twofish_tab.c
src/hashes/whirl/whirl.o: src/hashes/whirl/whirl.c src/hashes/whirl/whirltab.c
src/hashes/sha2/sha512.o: src/hashes/sha2/sha512.c src/hashes/sha2/sha384.c
src/hashes/sha2/sha256.o: src/hashes/sha2/sha256.c src/hashes/sha2/sha224.c
.c.o:
$(CC) $(LTC_CFLAGS) $(PIC) $(CPPFLAGS) -o $@ -c $<
#This rule makes the libtomcrypt library.
library: $(LIBNAME)
$(LIBNAME): $(OBJECTS)
$(CC) $(LTC_LDFLAGS) $(OBJECTS) $(EXTRALIBS) $(SHARED) -Wl,-soname,$(TARGET).$(VERSION_MAJOR) $(NO_UNDEFINED) -o $@
testprof/$(LIBTEST):
cd testprof ; CFLAGS="$(CFLAGS)" GROUP=$(GROUP) USER=$(USER) VERSION=$(VERSION) LIBPATH=$(LIBPATH) LIBTEST=$(LIBTEST) LIBTEST_S=$(LIBTEST_S) make -f makefile.shared
$(TARGET).$(VERSION_MAJOR) $(TARGET): $(LIBNAME)
ln -sf $< $@
objs: $(OBJECTS)
.bin/$(TEST): $(TARGET).$(VERSION_MAJOR) $(TARGET) $(TOBJECTS) .bin/.tag
$(CC) $(LTC_LDFLAGS) $(TOBJECTS) -L. -ltomcrypt $(EXTRALIBS) $(NO_UNDEFINED) -o $@
$(LIBNAME): $(OBJECTS) testprof/$(LIBTEST)
libtool --silent --mode=link gcc $(CFLAGS) `find . -type f | grep "[.]lo" | grep "src/" | xargs` $(EXTRALIBS) -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION)
test: $(call print-help,test,Builds the library and the 'test' application to run all self-tests) .bin/$(TEST)
$(INSTALL_CMD) -m 755 bin.in $@
install: $(LIBNAME)
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
cd testprof ; CFLAGS="$(CFLAGS)" GROUP=$(GROUP) USER=$(USER) VERSION=$(VERSION) LIBPATH=$(LIBPATH) LIBTEST=$(LIBTEST) LIBTEST_S=$(LIBTEST_S) DESTDIR=$(DESTDIR) make -f makefile.shared install
libtool --silent --mode=install install -c libtomcrypt.la $(DESTDIR)$(LIBPATH)/libtomcrypt.la
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH)
install -g $(GROUP) -o $(USER) $(HEADERS) $(DESTDIR)$(INCPATH)
# build the demos from a template
define DEMO_template
.bin/$(1): demos/$(1).o $$(TARGET).$$(VERSION_MAJOR) $$(TARGET) .bin/.tag
$$(CC) $$(LTC_LDFLAGS) $$< -L. -ltomcrypt $$(EXTRALIBS) $(NO_UNDEFINED) -o $$@
#This rule makes the hash program included with libtomcrypt
hashsum: library
gcc $(CFLAGS) demos/hashsum.c -o hashsum.o
gcc -o hashsum hashsum.o -ltomcrypt $(EXTRALIBS)
$(1): $(call print-help,$(1),Builds the library and the '$(1)' demo) .bin/$(1)
$$(INSTALL_CMD) -m 755 bin.in $(1)
endef
#makes the crypt program
crypt: library
gcc $(CFLAGS) demos/encrypt.c -o encrypt.o
gcc -o crypt encrypt.o -ltomcrypt $(EXTRALIBS)
$(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo))))
tv_gen: library $(TVS)
gcc -o tv_gen $(TVS) -ltomcrypt $(EXTRALIBS)
install: $(call print-help,install,Installs the library + headers + pkg-config file) .common_install
ln -sf $(LIBNAME) $(DESTDIR)/$(LIBPATH)/$(TARGET).$(VERSION_MAJOR)
ln -sf $(LIBNAME) $(DESTDIR)/$(LIBPATH)/$(TARGET)
sed -e 's,^prefix=.*,prefix=$(PREFIX),' -e 's,^Version:.*,Version: $(VERSION_PC),' -e 's,^libdir=.*,libdir=$(LIBPATH),' \
-e 's,^includedir=.*,includedir=$(INCPATH),' \
-e 's,@PKG_CONFIG_LIBS@,$(LTC_PKG_CONFIG_LIBS),' \
-e 's,@PKG_CONFIG_CFLAGS@,$(LTC_PKG_CONFIG_CFLAGS),' libtomcrypt.pc.in > libtomcrypt.pc
$(INSTALL_CMD) -p -d $(DESTDIR)$(LIBPATH)/pkgconfig
$(INSTALL_CMD) -p -m 644 libtomcrypt.pc $(DESTDIR)$(LIBPATH)/pkgconfig/
test: library testprof/$(LIBTEST) $(TESTS)
gcc -o $(TEST) $(TESTS) -ltomcrypt_prof -ltomcrypt $(EXTRALIBS)
install_bins: $(call print-help,install_bins,Installs the useful demos ($(USEFUL_DEMOS))) $(USEFUL_DEMOS) $(DESTDIR)$(BINPATH)
$(INSTALL_CMD) -p -m 775 $(foreach demo, $(strip $(USEFUL_DEMOS)),.bin/$(demo)) $(DESTDIR)$(BINPATH)
timing: library testprof/$(LIBTEST) $(TIMINGS)
gcc -o $(TIMING) $(TIMINGS) -ltomcrypt_prof -ltomcrypt $(EXTRALIBS)
# $Source: /cvs/libtom/libtomcrypt/makefile.shared,v $
# $Revision: 1.58 $
# $Date: 2006/06/16 23:52:08 $
uninstall: $(call print-help,uninstall,Uninstalls the library + headers + pkg-config file) .common_uninstall
$(UNINSTALL_CMD) $(DESTDIR)/$(LIBPATH)/$(TARGET).$(VERSION_MAJOR)
$(UNINSTALL_CMD) $(DESTDIR)/$(LIBPATH)/$(TARGET)
$(UNINSTALL_CMD) $(DESTDIR)$(LIBPATH)/pkgconfig/libtomcrypt.pc

367
makefile.unix Normal file
View file

@ -0,0 +1,367 @@
# MAKEFILE that is intended to be compatible with any kind of make (GNU make, BSD make, ...)
# works on: Linux, *BSD, Cygwin, AIX, HP-UX and hopefully other UNIX systems
#
# Please do not use here neither any special make syntax nor any unusual tools/utilities!
#
# BEWARE: variables OBJECTS, TOBJECTS, HEADERS, VERSION are updated via ./updatemakes.sh
### USAGE:
#
# make -f makefile.unix all
# ./test
# make -f makefile.unix install
#
#Or:
#
# make -f makefile.unix CFLAGS="-O3 -DUSE_LTM -DLTM_DESC -I/path/to/libtommath" EXTRALIBS=/path/to/libtommath/libtommath.a all
# ./test
# make -f makefile.unix PREFIX=/opt/libtom install
#
#Or if you are using Intel C compiler you might need something like:
#
# make -f makefile.unix CC=icc AR=xiar CFLAGS="-fast -DUSE_LTM -DLTM_DESC -I/path/to/libtommath" EXTRALIBS=/path/to/libtommath/libtommath.a all
#
#The following can be overridden from command line e.g. "make -f makefile.unix CC=gcc ARFLAGS=rcs"
DESTDIR =
PREFIX = /usr/local
LIBPATH = $(PREFIX)/lib
INCPATH = $(PREFIX)/include
DATAPATH = $(PREFIX)/share/doc/libtomcrypt/pdf
BINPATH = $(PREFIX)/bin
CC = cc
AR = ar
ARFLAGS = r
RANLIB = ranlib
CFLAGS = -O2 -DUSE_LTM -DLTM_DESC -I../libtommath
EXTRALIBS = ../libtommath/libtommath.a
# pkg-config flags, added to libtomcrypt.pc on install time
PC_CFLAGS = -DLTM_DESC
PC_LIBS = -ltommath
#Compilation flags
LTC_CFLAGS = -Isrc/headers -Itests $(CFLAGS)
LTC_LDFLAGS = $(LDFLAGS) $(EXTRALIBS)
VERSION=1.18.2-develop
VERSION_PC=1.18.2
#Libraries to be created (this makefile builds only static libraries)
LIBMAIN_S =libtomcrypt.a
#List of objects to compile (all goes to libtomcrypt.a)
OBJECTS=src/ciphers/aes/aes.o src/ciphers/aes/aes_desc.o src/ciphers/aes/aes_enc.o \
src/ciphers/aes/aes_enc_desc.o src/ciphers/aes/aesni.o src/ciphers/anubis.o src/ciphers/aria.o \
src/ciphers/blowfish.o src/ciphers/camellia.o src/ciphers/cast5.o src/ciphers/des.o src/ciphers/idea.o \
src/ciphers/kasumi.o src/ciphers/khazad.o src/ciphers/kseed.o src/ciphers/multi2.o src/ciphers/noekeon.o \
src/ciphers/rc2.o src/ciphers/rc5.o src/ciphers/rc6.o src/ciphers/safer/safer.o \
src/ciphers/safer/saferp.o src/ciphers/serpent.o src/ciphers/skipjack.o src/ciphers/sm4.o \
src/ciphers/tea.o src/ciphers/twofish/twofish.o src/ciphers/xtea.o src/encauth/ccm/ccm_add_aad.o \
src/encauth/ccm/ccm_add_nonce.o src/encauth/ccm/ccm_done.o src/encauth/ccm/ccm_init.o \
src/encauth/ccm/ccm_memory.o src/encauth/ccm/ccm_process.o src/encauth/ccm/ccm_reset.o \
src/encauth/ccm/ccm_test.o src/encauth/chachapoly/chacha20poly1305_add_aad.o \
src/encauth/chachapoly/chacha20poly1305_decrypt.o src/encauth/chachapoly/chacha20poly1305_done.o \
src/encauth/chachapoly/chacha20poly1305_encrypt.o src/encauth/chachapoly/chacha20poly1305_init.o \
src/encauth/chachapoly/chacha20poly1305_memory.o src/encauth/chachapoly/chacha20poly1305_setiv.o \
src/encauth/chachapoly/chacha20poly1305_setiv_rfc7905.o \
src/encauth/chachapoly/chacha20poly1305_test.o src/encauth/eax/eax_addheader.o \
src/encauth/eax/eax_decrypt.o src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o \
src/encauth/eax/eax_encrypt.o src/encauth/eax/eax_encrypt_authenticate_memory.o \
src/encauth/eax/eax_init.o src/encauth/eax/eax_test.o src/encauth/gcm/gcm_add_aad.o \
src/encauth/gcm/gcm_add_iv.o src/encauth/gcm/gcm_done.o src/encauth/gcm/gcm_gf_mult.o \
src/encauth/gcm/gcm_init.o src/encauth/gcm/gcm_memory.o src/encauth/gcm/gcm_mult_h.o \
src/encauth/gcm/gcm_process.o src/encauth/gcm/gcm_reset.o src/encauth/gcm/gcm_test.o \
src/encauth/gcm_siv/gcm_siv.o src/encauth/gcm_siv/gcm_siv_test.o src/encauth/ocb3/ocb3_add_aad.o \
src/encauth/ocb3/ocb3_decrypt.o src/encauth/ocb3/ocb3_decrypt_last.o \
src/encauth/ocb3/ocb3_decrypt_verify_memory.o src/encauth/ocb3/ocb3_done.o \
src/encauth/ocb3/ocb3_encrypt.o src/encauth/ocb3/ocb3_encrypt_authenticate_memory.o \
src/encauth/ocb3/ocb3_encrypt_last.o src/encauth/ocb3/ocb3_init.o src/encauth/ocb3/ocb3_int_ntz.o \
src/encauth/ocb3/ocb3_int_xor_blocks.o src/encauth/ocb3/ocb3_test.o src/encauth/siv/siv.o \
src/hashes/blake2b.o src/hashes/blake2s.o src/hashes/blake3.o src/hashes/chc/chc.o \
src/hashes/helper/hash_file.o src/hashes/helper/hash_filehandle.o src/hashes/helper/hash_memory.o \
src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o src/hashes/md5.o \
src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/rmd256.o src/hashes/rmd320.o src/hashes/sha1.o \
src/hashes/sha1_desc.o src/hashes/sha1_x86.o src/hashes/sha2/sha224.o src/hashes/sha2/sha224_desc.o \
src/hashes/sha2/sha224_x86.o src/hashes/sha2/sha256.o src/hashes/sha2/sha256_desc.o \
src/hashes/sha2/sha256_x86.o src/hashes/sha2/sha384.o src/hashes/sha2/sha384_desc.o \
src/hashes/sha2/sha384_x86.o src/hashes/sha2/sha512.o src/hashes/sha2/sha512_224.o \
src/hashes/sha2/sha512_224_desc.o src/hashes/sha2/sha512_224_x86.o src/hashes/sha2/sha512_256.o \
src/hashes/sha2/sha512_256_desc.o src/hashes/sha2/sha512_256_x86.o src/hashes/sha2/sha512_desc.o \
src/hashes/sha2/sha512_x86.o src/hashes/sha3.o src/hashes/sha3_test.o src/hashes/sm3.o \
src/hashes/tiger.o src/hashes/whirl/whirl.o src/mac/blake2/blake2bmac.o \
src/mac/blake2/blake2bmac_file.o src/mac/blake2/blake2bmac_memory.o \
src/mac/blake2/blake2bmac_memory_multi.o src/mac/blake2/blake2bmac_test.o src/mac/blake2/blake2smac.o \
src/mac/blake2/blake2smac_file.o src/mac/blake2/blake2smac_memory.o \
src/mac/blake2/blake2smac_memory_multi.o src/mac/blake2/blake2smac_test.o src/mac/f9/f9_done.o \
src/mac/f9/f9_file.o src/mac/f9/f9_init.o src/mac/f9/f9_memory.o src/mac/f9/f9_memory_multi.o \
src/mac/f9/f9_process.o src/mac/f9/f9_test.o src/mac/hmac/hmac_done.o src/mac/hmac/hmac_file.o \
src/mac/hmac/hmac_init.o src/mac/hmac/hmac_memory.o src/mac/hmac/hmac_memory_multi.o \
src/mac/hmac/hmac_process.o src/mac/hmac/hmac_test.o src/mac/kmac/kmac.o src/mac/kmac/kmac_file.o \
src/mac/kmac/kmac_memory.o src/mac/kmac/kmac_memory_multi.o src/mac/kmac/kmac_test.o \
src/mac/omac/omac_done.o src/mac/omac/omac_file.o src/mac/omac/omac_init.o src/mac/omac/omac_memory.o \
src/mac/omac/omac_memory_multi.o src/mac/omac/omac_process.o src/mac/omac/omac_test.o \
src/mac/pelican/pelican.o src/mac/pelican/pelican_memory.o src/mac/pelican/pelican_test.o \
src/mac/pmac/pmac_done.o src/mac/pmac/pmac_file.o src/mac/pmac/pmac_init.o src/mac/pmac/pmac_memory.o \
src/mac/pmac/pmac_memory_multi.o src/mac/pmac/pmac_ntz.o src/mac/pmac/pmac_process.o \
src/mac/pmac/pmac_shift_xor.o src/mac/pmac/pmac_test.o src/mac/poly1305/poly1305.o \
src/mac/poly1305/poly1305_file.o src/mac/poly1305/poly1305_memory.o \
src/mac/poly1305/poly1305_memory_multi.o src/mac/poly1305/poly1305_test.o src/mac/xcbc/xcbc_done.o \
src/mac/xcbc/xcbc_file.o src/mac/xcbc/xcbc_init.o src/mac/xcbc/xcbc_memory.o \
src/mac/xcbc/xcbc_memory_multi.o src/mac/xcbc/xcbc_process.o src/mac/xcbc/xcbc_test.o \
src/math/fp/ltc_ecc_fp_mulmod.o src/math/gmp_desc.o src/math/ltm_desc.o src/math/multi.o \
src/math/radix_to_bin.o src/math/rand_bn.o src/math/rand_prime.o src/math/tfm_desc.o src/misc/adler32.o \
src/misc/algname_match.o src/misc/argon2/argon2.o src/misc/base16/base16_decode.o \
src/misc/base16/base16_encode.o src/misc/base32/base32_decode.o src/misc/base32/base32_encode.o \
src/misc/base64/base64_decode.o src/misc/base64/base64_encode.o src/misc/bcrypt/bcrypt.o \
src/misc/burn_stack.o src/misc/compare_testvector.o src/misc/copy_or_zeromem.o src/misc/crc32.o \
src/misc/crypt/crypt.o src/misc/crypt/crypt_argchk.o src/misc/crypt/crypt_cipher_descriptor.o \
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_constants.o \
src/misc/crypt/crypt_find_cipher.o src/misc/crypt/crypt_find_cipher_any.o \
src/misc/crypt/crypt_find_cipher_id.o src/misc/crypt/crypt_find_hash.o \
src/misc/crypt/crypt_find_hash_any.o src/misc/crypt/crypt_find_hash_id.o \
src/misc/crypt/crypt_find_hash_oid.o src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o \
src/misc/crypt/crypt_hash_descriptor.o src/misc/crypt/crypt_hash_is_valid.o \
src/misc/crypt/crypt_inits.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
src/misc/crypt/crypt_prng_descriptor.o src/misc/crypt/crypt_prng_is_valid.o \
src/misc/crypt/crypt_prng_rng_descriptor.o src/misc/crypt/crypt_register_all_ciphers.o \
src/misc/crypt/crypt_register_all_hashes.o src/misc/crypt/crypt_register_all_prngs.o \
src/misc/crypt/crypt_register_cipher.o src/misc/crypt/crypt_register_hash.o \
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_sizes.o \
src/misc/crypt/crypt_unregister_cipher.o src/misc/crypt/crypt_unregister_hash.o \
src/misc/crypt/crypt_unregister_prng.o src/misc/deprecated.o src/misc/error_to_string.o \
src/misc/hkdf/hkdf.o src/misc/hkdf/hkdf_test.o src/misc/mem_neq.o src/misc/padding/padding_depad.o \
src/misc/padding/padding_pad.o src/misc/password_free.o src/misc/pbes/pbes.o src/misc/pbes/pbes1.o \
src/misc/pbes/pbes2.o src/misc/pem/pem.o src/misc/pem/pem_pkcs.o src/misc/pem/pem_read.o \
src/misc/pem/pem_ssh.o src/misc/pkcs12/pkcs12_kdf.o src/misc/pkcs12/pkcs12_utf8_to_utf16.o \
src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o src/misc/pkcs5/pkcs_5_test.o \
src/misc/scrypt/scrypt.o src/misc/ssh/ssh_decode_sequence_multi.o \
src/misc/ssh/ssh_encode_sequence_multi.o src/misc/zeromem.o src/modes/cbc/cbc_decrypt.o \
src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o src/modes/cbc/cbc_getiv.o \
src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o src/modes/cfb/cfb_decrypt.o \
src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o src/modes/cfb/cfb_getiv.o \
src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o src/modes/ctr/ctr_decrypt.o \
src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o src/modes/ctr/ctr_getiv.o \
src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \
src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \
src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \
src/modes/lrw/lrw_decrypt.o src/modes/lrw/lrw_done.o src/modes/lrw/lrw_encrypt.o \
src/modes/lrw/lrw_getiv.o src/modes/lrw/lrw_process.o src/modes/lrw/lrw_setiv.o \
src/modes/lrw/lrw_start.o src/modes/lrw/lrw_test.o src/modes/ofb/ofb_decrypt.o src/modes/ofb/ofb_done.o \
src/modes/ofb/ofb_encrypt.o src/modes/ofb/ofb_getiv.o src/modes/ofb/ofb_setiv.o \
src/modes/ofb/ofb_start.o src/modes/xts/xts_decrypt.o src/modes/xts/xts_done.o \
src/modes/xts/xts_encrypt.o src/modes/xts/xts_init.o src/modes/xts/xts_mult_x.o \
src/modes/xts/xts_test.o src/pk/asn1/der/bit/der_decode_bit_string.o \
src/pk/asn1/der/bit/der_decode_raw_bit_string.o src/pk/asn1/der/bit/der_encode_bit_string.o \
src/pk/asn1/der/bit/der_encode_raw_bit_string.o src/pk/asn1/der/bit/der_length_bit_string.o \
src/pk/asn1/der/boolean/der_decode_boolean.o src/pk/asn1/der/boolean/der_encode_boolean.o \
src/pk/asn1/der/boolean/der_length_boolean.o src/pk/asn1/der/choice/der_decode_choice.o \
src/pk/asn1/der/custom_type/der_decode_custom_type.o \
src/pk/asn1/der/custom_type/der_encode_custom_type.o \
src/pk/asn1/der/custom_type/der_length_custom_type.o src/pk/asn1/der/general/der_asn1_maps.o \
src/pk/asn1/der/general/der_decode_asn1_identifier.o src/pk/asn1/der/general/der_decode_asn1_length.o \
src/pk/asn1/der/general/der_encode_asn1_identifier.o src/pk/asn1/der/general/der_encode_asn1_length.o \
src/pk/asn1/der/general/der_length_asn1_identifier.o src/pk/asn1/der/general/der_length_asn1_length.o \
src/pk/asn1/der/generalizedtime/der_decode_generalizedtime.o \
src/pk/asn1/der/generalizedtime/der_encode_generalizedtime.o \
src/pk/asn1/der/generalizedtime/der_length_generalizedtime.o \
src/pk/asn1/der/ia5/der_decode_ia5_string.o src/pk/asn1/der/ia5/der_encode_ia5_string.o \
src/pk/asn1/der/ia5/der_length_ia5_string.o src/pk/asn1/der/integer/der_decode_integer.o \
src/pk/asn1/der/integer/der_encode_integer.o src/pk/asn1/der/integer/der_length_integer.o \
src/pk/asn1/der/object_identifier/der_decode_object_identifier.o \
src/pk/asn1/der/object_identifier/der_encode_object_identifier.o \
src/pk/asn1/der/object_identifier/der_length_object_identifier.o \
src/pk/asn1/der/octet/der_decode_octet_string.o src/pk/asn1/der/octet/der_encode_octet_string.o \
src/pk/asn1/der/octet/der_length_octet_string.o \
src/pk/asn1/der/printable_string/der_decode_printable_string.o \
src/pk/asn1/der/printable_string/der_encode_printable_string.o \
src/pk/asn1/der/printable_string/der_length_printable_string.o \
src/pk/asn1/der/sequence/der_decode_sequence_ex.o \
src/pk/asn1/der/sequence/der_decode_sequence_flexi.o \
src/pk/asn1/der/sequence/der_decode_sequence_multi.o \
src/pk/asn1/der/sequence/der_encode_sequence_ex.o \
src/pk/asn1/der/sequence/der_encode_sequence_multi.o \
src/pk/asn1/der/sequence/der_flexi_sequence_cmp.o src/pk/asn1/der/sequence/der_length_sequence.o \
src/pk/asn1/der/sequence/der_sequence_free.o src/pk/asn1/der/sequence/der_sequence_shrink.o \
src/pk/asn1/der/set/der_encode_set.o src/pk/asn1/der/set/der_encode_setof.o \
src/pk/asn1/der/short_integer/der_decode_short_integer.o \
src/pk/asn1/der/short_integer/der_encode_short_integer.o \
src/pk/asn1/der/short_integer/der_length_short_integer.o \
src/pk/asn1/der/teletex_string/der_decode_teletex_string.o \
src/pk/asn1/der/teletex_string/der_length_teletex_string.o \
src/pk/asn1/der/utctime/der_decode_utctime.o src/pk/asn1/der/utctime/der_encode_utctime.o \
src/pk/asn1/der/utctime/der_length_utctime.o src/pk/asn1/der/utf8/der_decode_utf8_string.o \
src/pk/asn1/der/utf8/der_encode_utf8_string.o src/pk/asn1/der/utf8/der_length_utf8_string.o \
src/pk/asn1/oid/pk_get.o src/pk/asn1/oid/pk_oid_cmp.o src/pk/asn1/oid/pk_oid_str.o \
src/pk/asn1/pkcs8/pkcs8_decode_flexi.o src/pk/asn1/pkcs8/pkcs8_get.o \
src/pk/asn1/x509/x509_decode_public_key_from_certificate.o src/pk/asn1/x509/x509_decode_spki.o \
src/pk/asn1/x509/x509_decode_subject_public_key_info.o \
src/pk/asn1/x509/x509_encode_subject_public_key_info.o src/pk/asn1/x509/x509_get_pka.o \
src/pk/asn1/x509/x509_import_spki.o src/pk/dh/dh.o src/pk/dh/dh_check_pubkey.o src/pk/dh/dh_export.o \
src/pk/dh/dh_export_key.o src/pk/dh/dh_free.o src/pk/dh/dh_generate_key.o src/pk/dh/dh_import.o \
src/pk/dh/dh_import_pkcs8.o src/pk/dh/dh_set.o src/pk/dh/dh_set_pg_dhparam.o \
src/pk/dh/dh_shared_secret.o src/pk/dsa/dsa_decrypt_key.o src/pk/dsa/dsa_encrypt_key.o \
src/pk/dsa/dsa_export.o src/pk/dsa/dsa_free.o src/pk/dsa/dsa_generate_key.o \
src/pk/dsa/dsa_generate_pqg.o src/pk/dsa/dsa_import.o src/pk/dsa/dsa_import_pkcs8.o \
src/pk/dsa/dsa_init.o src/pk/dsa/dsa_make_key.o src/pk/dsa/dsa_set.o src/pk/dsa/dsa_set_pqg_dsaparam.o \
src/pk/dsa/dsa_shared_secret.o src/pk/dsa/dsa_sign_hash.o src/pk/dsa/dsa_verify_hash.o \
src/pk/dsa/dsa_verify_key.o src/pk/ec25519/ec25519_crypto_ctx.o src/pk/ec25519/ec25519_export.o \
src/pk/ec25519/ec25519_import_pkcs8.o src/pk/ec25519/tweetnacl.o src/pk/ec448/ec448_common.o \
src/pk/ec448/ec448_crypto_ctx.o src/pk/ec448/ec448_export.o src/pk/ec448/ec448_import_pkcs8.o \
src/pk/ecc/ecc.o src/pk/ecc/ecc_ansi_x963_export.o src/pk/ecc/ecc_ansi_x963_import.o \
src/pk/ecc/ecc_decrypt_key.o src/pk/ecc/ecc_encrypt_key.o src/pk/ecc/ecc_export.o \
src/pk/ecc/ecc_export_openssl.o src/pk/ecc/ecc_find_curve.o src/pk/ecc/ecc_free.o \
src/pk/ecc/ecc_get_key.o src/pk/ecc/ecc_get_oid_str.o src/pk/ecc/ecc_get_size.o src/pk/ecc/ecc_import.o \
src/pk/ecc/ecc_import_openssl.o src/pk/ecc/ecc_import_pkcs8.o src/pk/ecc/ecc_import_x509.o \
src/pk/ecc/ecc_make_key.o src/pk/ecc/ecc_recover_key.o src/pk/ecc/ecc_rfc6979_key.o \
src/pk/ecc/ecc_set_curve.o src/pk/ecc/ecc_set_curve_internal.o src/pk/ecc/ecc_set_key.o \
src/pk/ecc/ecc_shared_secret.o src/pk/ecc/ecc_sign_hash.o src/pk/ecc/ecc_sign_hash_eth27.o \
src/pk/ecc/ecc_sign_hash_internal.o src/pk/ecc/ecc_sign_hash_rfc5656.o \
src/pk/ecc/ecc_sign_hash_rfc7518.o src/pk/ecc/ecc_sign_hash_x962.o src/pk/ecc/ecc_sizes.o \
src/pk/ecc/ecc_ssh_ecdsa_encode_name.o src/pk/ecc/ecc_verify_hash.o src/pk/ecc/ecc_verify_hash_eth27.o \
src/pk/ecc/ecc_verify_hash_internal.o src/pk/ecc/ecc_verify_hash_rfc5656.o \
src/pk/ecc/ecc_verify_hash_rfc7518.o src/pk/ecc/ecc_verify_hash_x962.o \
src/pk/ecc/ltc_ecc_export_point.o src/pk/ecc/ltc_ecc_import_point.o src/pk/ecc/ltc_ecc_is_point.o \
src/pk/ecc/ltc_ecc_is_point_at_infinity.o src/pk/ecc/ltc_ecc_map.o src/pk/ecc/ltc_ecc_mul2add.o \
src/pk/ecc/ltc_ecc_mulmod.o src/pk/ecc/ltc_ecc_mulmod_timing.o src/pk/ecc/ltc_ecc_points.o \
src/pk/ecc/ltc_ecc_projective_add_point.o src/pk/ecc/ltc_ecc_projective_dbl_point.o \
src/pk/ecc/ltc_ecc_verify_key.o src/pk/ed25519/ed25519_export.o src/pk/ed25519/ed25519_import.o \
src/pk/ed25519/ed25519_import_pkcs8.o src/pk/ed25519/ed25519_import_raw.o \
src/pk/ed25519/ed25519_import_x509.o src/pk/ed25519/ed25519_make_key.o src/pk/ed25519/ed25519_sign.o \
src/pk/ed25519/ed25519_verify.o src/pk/ed448/ed448_export.o src/pk/ed448/ed448_import.o \
src/pk/ed448/ed448_import_pkcs8.o src/pk/ed448/ed448_import_raw.o src/pk/ed448/ed448_import_x509.o \
src/pk/ed448/ed448_make_key.o src/pk/ed448/ed448_sign.o src/pk/ed448/ed448_verify.o src/pk/pka_key.o \
src/pk/pkcs1/pkcs_1_i2osp.o src/pk/pkcs1/pkcs_1_mgf1.o src/pk/pkcs1/pkcs_1_oaep_decode.o \
src/pk/pkcs1/pkcs_1_oaep_encode.o src/pk/pkcs1/pkcs_1_os2ip.o src/pk/pkcs1/pkcs_1_pss_decode.o \
src/pk/pkcs1/pkcs_1_pss_encode.o src/pk/pkcs1/pkcs_1_v1_5_decode.o src/pk/pkcs1/pkcs_1_v1_5_encode.o \
src/pk/rsa/rsa_decrypt_key.o src/pk/rsa/rsa_encrypt_key.o src/pk/rsa/rsa_export.o \
src/pk/rsa/rsa_exptmod.o src/pk/rsa/rsa_get_size.o src/pk/rsa/rsa_import.o \
src/pk/rsa/rsa_import_pkcs8.o src/pk/rsa/rsa_import_x509.o src/pk/rsa/rsa_key.o \
src/pk/rsa/rsa_make_key.o src/pk/rsa/rsa_set.o src/pk/rsa/rsa_sign_hash.o \
src/pk/rsa/rsa_sign_saltlen_get.o src/pk/rsa/rsa_verify_hash.o src/pk/x25519/x25519_export.o \
src/pk/x25519/x25519_import.o src/pk/x25519/x25519_import_pkcs8.o src/pk/x25519/x25519_import_raw.o \
src/pk/x25519/x25519_import_x509.o src/pk/x25519/x25519_make_key.o \
src/pk/x25519/x25519_shared_secret.o src/pk/x448/x448_export.o src/pk/x448/x448_import.o \
src/pk/x448/x448_import_pkcs8.o src/pk/x448/x448_import_raw.o src/pk/x448/x448_import_x509.o \
src/pk/x448/x448_make_key.o src/pk/x448/x448_shared_secret.o src/prngs/chacha20.o src/prngs/fortuna.o \
src/prngs/rc4.o src/prngs/rng_get_bytes.o src/prngs/rng_make_prng.o src/prngs/sober128.o \
src/prngs/sprng.o src/prngs/yarrow.o src/stream/chacha/chacha_crypt.o src/stream/chacha/chacha_done.o \
src/stream/chacha/chacha_ivctr32.o src/stream/chacha/chacha_ivctr64.o \
src/stream/chacha/chacha_keystream.o src/stream/chacha/chacha_memory.o \
src/stream/chacha/chacha_setup.o src/stream/chacha/chacha_test.o src/stream/chacha/xchacha20_memory.o \
src/stream/chacha/xchacha20_setup.o src/stream/chacha/xchacha20_test.o src/stream/rabbit/rabbit.o \
src/stream/rabbit/rabbit_memory.o src/stream/rc4/rc4_stream.o src/stream/rc4/rc4_stream_memory.o \
src/stream/rc4/rc4_test.o src/stream/salsa20/salsa20_crypt.o src/stream/salsa20/salsa20_done.o \
src/stream/salsa20/salsa20_ivctr64.o src/stream/salsa20/salsa20_keystream.o \
src/stream/salsa20/salsa20_memory.o src/stream/salsa20/salsa20_setup.o \
src/stream/salsa20/salsa20_test.o src/stream/salsa20/xsalsa20_memory.o \
src/stream/salsa20/xsalsa20_setup.o src/stream/salsa20/xsalsa20_test.o \
src/stream/sober128/sober128_stream.o src/stream/sober128/sober128_stream_memory.o \
src/stream/sober128/sober128_test.o src/stream/sosemanuk/sosemanuk.o \
src/stream/sosemanuk/sosemanuk_memory.o src/stream/sosemanuk/sosemanuk_test.o
#List of test objects to compile (all goes to libtomcrypt_prof.a)
TOBJECTS=tests/argon2_test.o tests/base16_test.o tests/base32_test.o tests/base64_test.o \
tests/bcrypt_test.o tests/cipher_hash_test.o tests/common.o tests/deprecated_test.o tests/der_test.o \
tests/dh_test.o tests/dsa_test.o tests/ecc_test.o tests/ed25519_test.o tests/ed448_test.o \
tests/file_test.o tests/mac_test.o tests/misc_test.o tests/modes_test.o tests/mpi_test.o \
tests/multi_test.o tests/no_null_termination_check_test.o tests/no_prng.o tests/padding_test.o \
tests/pem_test.o tests/pk_oid_test.o tests/pkcs_1_eme_test.o tests/pkcs_1_emsa_test.o \
tests/pkcs_1_oaep_test.o tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/prng_test.o \
tests/rotate_test.o tests/rsa_test.o tests/scrypt_test.o tests/siv_wycheproof_test.o tests/ssh_test.o \
tests/store_test.o tests/test.o tests/x25519_test.o tests/x448_test.o
#The following headers will be installed by "make install"
HEADERS_PUB=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
src/headers/tomcrypt_cipher.h src/headers/tomcrypt_custom.h src/headers/tomcrypt_hash.h \
src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h src/headers/tomcrypt_math.h \
src/headers/tomcrypt_misc.h src/headers/tomcrypt_pk.h src/headers/tomcrypt_pkcs.h \
src/headers/tomcrypt_prng.h
HEADERS=$(HEADERS_PUB) src/headers/tomcrypt_private.h
#The default rule for make builds the libtomcrypt.a library (static)
default: $(LIBMAIN_S)
#SPECIAL: AES comes in two flavours - enc+dec and enc-only
src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
$(CC) $(LTC_CFLAGS) -DENCRYPT_ONLY -c src/ciphers/aes/aes.c -o src/ciphers/aes/aes_enc.o
src/ciphers/aes/aes_enc_desc.o: src/ciphers/aes/aes_desc.c
$(CC) $(LTC_CFLAGS) -DENCRYPT_ONLY -c src/ciphers/aes/aes_desc.c -o src/ciphers/aes/aes_enc_desc.o
#SPECIAL: these are the rules to make certain object files
src/ciphers/aes/aes.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
src/ciphers/twofish/twofish.o: src/ciphers/twofish/twofish.c src/ciphers/twofish/twofish_tab.c
src/hashes/sha2/sha256.o: src/hashes/sha2/sha256.c src/hashes/sha2/sha224.c
src/hashes/sha2/sha384.o: src/hashes/sha2/sha384.c src/hashes/sha2/sha512.c
src/hashes/sha2/sha512.o: src/hashes/sha2/sha512.c src/hashes/sha2/sha384.c
src/hashes/sha2/sha512_224.o: src/hashes/sha2/sha512.c src/hashes/sha2/sha512_224.c
src/hashes/sha2/sha512_256.o: src/hashes/sha2/sha512.c src/hashes/sha2/sha512_256.c
src/hashes/whirl/whirl.o: src/hashes/whirl/whirl.c src/hashes/whirl/whirltab.c
#Dependencies on *.h
$(OBJECTS): $(HEADERS)
$(TOBJECTS): $(HEADERS) tests/tomcrypt_test.h
#This is necessary for compatibility with BSD make (namely on OpenBSD)
.SUFFIXES: .o .c
.c.o:
$(CC) $(LTC_CFLAGS) -c $< -o $@
#Create libtomcrypt.a
$(LIBMAIN_S): $(OBJECTS)
$(AR) $(ARFLAGS) $@ $(OBJECTS)
$(RANLIB) $@
#Demo tools/utilities
hashsum: demos/hashsum.o $(LIBMAIN_S)
$(CC) demos/hashsum.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
crypt: demos/crypt.o $(LIBMAIN_S)
$(CC) demos/crypt.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
small: demos/small.o $(LIBMAIN_S)
$(CC) demos/small.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
tv_gen: demos/tv_gen.o $(LIBMAIN_S)
$(CC) demos/tv_gen.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
sizes: demos/sizes.o $(LIBMAIN_S)
$(CC) demos/sizes.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
constants: demos/constants.o $(LIBMAIN_S)
$(CC) demos/constants.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
timing: demos/timing.o $(LIBMAIN_S)
$(CC) demos/timing.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
der_print_flexi: demos/der_print_flexi.o $(LIBMAIN_S)
$(CC) demos/der_print_flexi.o $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
#Tests
test: $(TOBJECTS) $(LIBMAIN_S)
$(CC) $(TOBJECTS) $(LIBMAIN_S) $(LTC_LDFLAGS) -o $@
@echo "NOTICE: start the tests by: ./test"
all: $(LIBMAIN_S) hashsum crypt small tv_gen sizes constants timing test
#NOTE: this makefile works also on cygwin, thus we need to delete *.exe
clean:
-@rm -f $(OBJECTS) $(TOBJECTS)
-@rm -f $(LIBMAIN_S)
-@rm -f demos/*.o *_tv.txt
-@rm -f test constants sizes tv_gen hashsum crypt small timing
-@rm -f test.exe constants.exe sizes.exe tv_gen.exe hashsum.exe crypt.exe small.exe timing.exe
#Install the library + headers
install: $(LIBMAIN_S)
@mkdir -p $(DESTDIR)$(INCPATH) $(DESTDIR)$(LIBPATH)/pkgconfig
@cp $(LIBMAIN_S) $(DESTDIR)$(LIBPATH)/
@cp $(HEADERS_PUB) $(DESTDIR)$(INCPATH)/
@sed -e 's,^prefix=.*,prefix=$(PREFIX),' -e 's,^Version:.*,Version: $(VERSION_PC),' -e 's,^libdir=.*,libdir=$(LIBPATH),' \
-e 's,^includedir=.*,includedir=$(INCPATH),' \
-e 's,@MPI_PROVIDERS_LIBS@,$(PC_LIBS),' \
-e 's,@MPI_PROVIDERS_CFLAGS@,$(PC_CFLAGS),' libtomcrypt.pc.in > $(DESTDIR)$(LIBPATH)/pkgconfig/libtomcrypt.pc
#Install useful tools
install_bins: hashsum
@mkdir -p $(DESTDIR)$(BINPATH)
@cp hashsum $(DESTDIR)$(BINPATH)/ltc-hashsum
@cp demos/ltc $(DESTDIR)$(BINPATH)/ltc
#Install documentation
install_docs: doc/crypt.pdf
@mkdir -p $(DESTDIR)$(DATAPATH)
@cp doc/crypt.pdf $(DESTDIR)$(DATAPATH)/

591
makefile_include.mk Normal file
View file

@ -0,0 +1,591 @@
#
# Include makefile used by makefile + makefile.shared
# (GNU make only)
# The version - BEWARE: VERSION, VERSION_PC and VERSION_LT are updated via ./updatemakes.sh
VERSION=1.18.2-develop
VERSION_PC=1.18.2
# https://semver.org/
VERSION_MAJOR=1
VERSION_MINOR=0
VERSION_PATCH=1
VERSION_LT=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
# Compiler and Linker Names
ifndef CROSS_COMPILE
CROSS_COMPILE:=
endif
H := \#
ifeq (CLANG,$(shell printf "$(H)ifdef __clang__\nCLANG\n$(H)endif\n" | $(CC) -E - | grep CLANG))
CC_IS_CLANG := 1
else
CC_IS_CLANG := 0
endif # Clang
ifneq (,$(CROSS_COMPILE))
ifeq ($(origin CC),default)
ifeq ($(CC_IS_CLANG), 1)
CC := $(CROSS_COMPILE)clang
else
CC := $(CROSS_COMPILE)gcc
endif # Clang
endif # cc is Make's default
endif # CROSS_COMPILE non-empty
LD:=$(CROSS_COMPILE)ld
AR:=$(CROSS_COMPILE)ar
# Archiver [makes .a files]
#AR=ar
ARFLAGS:=r
ifndef MAKE
# BSDs refer to GNU Make as gmake
ifneq (,$(findstring $(PLATFORM),FreeBSD OpenBSD DragonFly NetBSD))
MAKE=gmake
else
MAKE=make
endif
endif
ifndef INSTALL_CMD
$(error your makefile must define INSTALL_CMD)
endif
ifndef UNINSTALL_CMD
$(error your makefile must define UNINSTALL_CMD)
endif
ifndef EXTRALIBS
ifneq ($(shell echo $(CFLAGS) | grep USE_LTM),)
EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs libtommath ${silent_stderr} || true)
else ifneq ($(shell echo $(CFLAGS) | grep USE_TFM),)
EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs tomsfastmath ${silent_stderr} || true)
else ifneq ($(shell echo $(CFLAGS) | grep USE_GMP),)
EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --libs gmp ${silent_stderr} || true)
endif
endif # EXTRALIBS
need-help := $(filter help,$(MAKECMDGOALS))
define print-help
$(if $(need-help),$(info $1 -- $2))
endef
#
# Compilation flags. Note the += does not write over the user's CFLAGS!
#
# Also note that we're extending the environments' CFLAGS.
# If you think that our CFLAGS are not nice you can easily override them
# by giving them as a parameter to make:
# make CFLAGS="-I./src/headers/ ..." ...
#
ifneq ($(shell echo $(CFLAGS) | grep LTM_DESC),)
LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I libtommath ${silent_stderr} || true)
endif
ifneq ($(shell echo $(CFLAGS) | grep TFM_DESC),)
LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I tomsfastmath ${silent_stderr} || true)
endif
ifneq ($(shell echo $(CFLAGS) | grep GMP_DESC),)
LTC_CFLAGS+=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config --cflags-only-I gmp ${silent_stderr} || true)
endif
LTC_CFLAGS += -I./src/headers/ -Wall -Wsign-compare -Wshadow
ifdef OLD_GCC
LTC_CFLAGS += -W
# older GCCs can't handle the "rotate with immediate" ROLc/RORc/etc macros
# define this to help
LTC_CFLAGS += -DLTC_NO_ROLC
else
LTC_CFLAGS += -Wextra
# additional warnings
LTC_CFLAGS += -Wsystem-headers -Wbad-function-cast -Wcast-align
LTC_CFLAGS += -Wstrict-prototypes -Wpointer-arith
LTC_CFLAGS += -Wdeclaration-after-statement
LTC_CFLAGS += -Wwrite-strings
endif
ifdef LTC_DEBUG
$(info Debug build)
# compile for DEBUGGING (required for ccmalloc checking!!!)
LTC_CFLAGS += -g3 -DLTC_NO_ASM
ifneq (,$(strip $(LTC_DEBUG)))
LTC_CFLAGS += -DLTC_TEST_DBG=$(LTC_DEBUG)
else
LTC_CFLAGS += -DLTC_TEST_DBG
endif
endif # LTC_DEBUG
ifndef IGNORE_SPEED
# optimize for SPEED
LTC_CFLAGS += -O3 -funroll-loops
# add -fomit-frame-pointer. hinders debugging!
LTC_CFLAGS += -fomit-frame-pointer
endif # IGNORE_SPEED
ifdef LTC_SMALL
# optimize for SIZE
LTC_CFLAGS += -Os -DLTC_SMALL_CODE
endif # LTC_SMALL
ifeq ($(CC_IS_CLANG), 1)
LTC_CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header
LTC_CFLAGS += -Wno-missing-field-initializers -Wno-missing-braces -Wno-incomplete-setjmp-declaration -Wno-cast-align
LTC_CFLAGS += -Wno-declaration-after-statement
endif
ifneq ($(findstring mingw,$(CC)),)
LTC_CFLAGS += -Wno-shadow -Wno-attributes
endif
ifeq ($(PLATFORM), Darwin)
LTC_CFLAGS += -Wno-nullability-completeness
endif
GIT_VERSION := $(shell { [ -e .git ] && which git 2>/dev/null 1>&2 ; } && { printf git- ; git describe --tags --always --dirty ; } || echo $(VERSION))
ifneq ($(GIT_VERSION),)
LTC_CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif
ifndef LTC_DEBUG
ifeq ($(findstring -DARGTYPE,$(CFLAGS)),)
LTC_CFLAGS += -DARGTYPE=4
endif
endif
LTC_CFLAGS := $(LTC_CFLAGS) $(CFLAGS)
ifneq ($(findstring -DLTC_PTHREAD,$(LTC_CFLAGS)),)
LTC_LDFLAGS += -pthread
endif
LTC_LDFLAGS := $(LTC_LDFLAGS) $(LDFLAGS)
ifeq ($(V)$(filter clean,$(MAKECMDGOALS)),0)
$(warning CFLAGS=$(LTC_CFLAGS))
$(warning LDFLAGS=$(LTC_LDFLAGS))
endif
#List of demo objects
DSOURCES = $(wildcard demos/*.c)
DOBJECTS = $(DSOURCES:.c=.o)
#List of tests headers
THEADERS = $(wildcard tests/*.h)
TEST=test
# Demos that are even somehow useful and could be installed as a system-tool
USEFUL_DEMOS = hashsum
# Demos that are usable but only rarely make sense to be installed
USEABLE_DEMOS = aesgcm constants crypt der_print_flexi latex-tables openssh-privkey openssl-enc sizes timing
# Demos that are used for testing or measuring
TEST_DEMOS = small tv_gen
# Combine demos in groups
UNBROKEN_DEMOS = $(TEST_DEMOS) $(USEABLE_DEMOS) $(USEFUL_DEMOS)
DEMOS = $(UNBROKEN_DEMOS) $(BROKEN_DEMOS)
#LIBPATH The directory for libtomcrypt to be installed to.
#INCPATH The directory to install the header files for libtomcrypt.
#DATAPATH The directory to install the pdf docs.
#BINPATH The directory to install the binaries provided.
DESTDIR ?=
PREFIX ?= /usr/local
LIBPATH ?= $(PREFIX)/lib
INCPATH ?= $(PREFIX)/include/libtomcrypt
DATAPATH ?= $(PREFIX)/share/doc/libtomcrypt/pdf
BINPATH ?= $(PREFIX)/bin
#Who do we install as?
ifdef INSTALL_USER
USER=$(INSTALL_USER)
else
USER=root
endif
ifdef INSTALL_GROUP
GROUP=$(INSTALL_GROUP)
else
GROUP=wheel
endif
#The first rule is also the default rule and builds the libtomcrypt library.
library: $(call print-help,library,Builds the library) $(LIBNAME)
# List of objects to compile (all goes to libtomcrypt.a)
ifndef AMALGAM
OBJECTS=src/ciphers/aes/aes.o src/ciphers/aes/aes_desc.o src/ciphers/aes/aes_enc.o \
src/ciphers/aes/aes_enc_desc.o src/ciphers/aes/aesni.o src/ciphers/anubis.o src/ciphers/aria.o \
src/ciphers/blowfish.o src/ciphers/camellia.o src/ciphers/cast5.o src/ciphers/des.o src/ciphers/idea.o \
src/ciphers/kasumi.o src/ciphers/khazad.o src/ciphers/kseed.o src/ciphers/multi2.o src/ciphers/noekeon.o \
src/ciphers/rc2.o src/ciphers/rc5.o src/ciphers/rc6.o src/ciphers/safer/safer.o \
src/ciphers/safer/saferp.o src/ciphers/serpent.o src/ciphers/skipjack.o src/ciphers/sm4.o \
src/ciphers/tea.o src/ciphers/twofish/twofish.o src/ciphers/xtea.o src/encauth/ccm/ccm_add_aad.o \
src/encauth/ccm/ccm_add_nonce.o src/encauth/ccm/ccm_done.o src/encauth/ccm/ccm_init.o \
src/encauth/ccm/ccm_memory.o src/encauth/ccm/ccm_process.o src/encauth/ccm/ccm_reset.o \
src/encauth/ccm/ccm_test.o src/encauth/chachapoly/chacha20poly1305_add_aad.o \
src/encauth/chachapoly/chacha20poly1305_decrypt.o src/encauth/chachapoly/chacha20poly1305_done.o \
src/encauth/chachapoly/chacha20poly1305_encrypt.o src/encauth/chachapoly/chacha20poly1305_init.o \
src/encauth/chachapoly/chacha20poly1305_memory.o src/encauth/chachapoly/chacha20poly1305_setiv.o \
src/encauth/chachapoly/chacha20poly1305_setiv_rfc7905.o \
src/encauth/chachapoly/chacha20poly1305_test.o src/encauth/eax/eax_addheader.o \
src/encauth/eax/eax_decrypt.o src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o \
src/encauth/eax/eax_encrypt.o src/encauth/eax/eax_encrypt_authenticate_memory.o \
src/encauth/eax/eax_init.o src/encauth/eax/eax_test.o src/encauth/gcm/gcm_add_aad.o \
src/encauth/gcm/gcm_add_iv.o src/encauth/gcm/gcm_done.o src/encauth/gcm/gcm_gf_mult.o \
src/encauth/gcm/gcm_init.o src/encauth/gcm/gcm_memory.o src/encauth/gcm/gcm_mult_h.o \
src/encauth/gcm/gcm_process.o src/encauth/gcm/gcm_reset.o src/encauth/gcm/gcm_test.o \
src/encauth/gcm_siv/gcm_siv.o src/encauth/gcm_siv/gcm_siv_test.o src/encauth/ocb3/ocb3_add_aad.o \
src/encauth/ocb3/ocb3_decrypt.o src/encauth/ocb3/ocb3_decrypt_last.o \
src/encauth/ocb3/ocb3_decrypt_verify_memory.o src/encauth/ocb3/ocb3_done.o \
src/encauth/ocb3/ocb3_encrypt.o src/encauth/ocb3/ocb3_encrypt_authenticate_memory.o \
src/encauth/ocb3/ocb3_encrypt_last.o src/encauth/ocb3/ocb3_init.o src/encauth/ocb3/ocb3_int_ntz.o \
src/encauth/ocb3/ocb3_int_xor_blocks.o src/encauth/ocb3/ocb3_test.o src/encauth/siv/siv.o \
src/hashes/blake2b.o src/hashes/blake2s.o src/hashes/blake3.o src/hashes/chc/chc.o \
src/hashes/helper/hash_file.o src/hashes/helper/hash_filehandle.o src/hashes/helper/hash_memory.o \
src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o src/hashes/md5.o \
src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/rmd256.o src/hashes/rmd320.o src/hashes/sha1.o \
src/hashes/sha1_desc.o src/hashes/sha1_x86.o src/hashes/sha2/sha224.o src/hashes/sha2/sha224_desc.o \
src/hashes/sha2/sha224_x86.o src/hashes/sha2/sha256.o src/hashes/sha2/sha256_desc.o \
src/hashes/sha2/sha256_x86.o src/hashes/sha2/sha384.o src/hashes/sha2/sha384_desc.o \
src/hashes/sha2/sha384_x86.o src/hashes/sha2/sha512.o src/hashes/sha2/sha512_224.o \
src/hashes/sha2/sha512_224_desc.o src/hashes/sha2/sha512_224_x86.o src/hashes/sha2/sha512_256.o \
src/hashes/sha2/sha512_256_desc.o src/hashes/sha2/sha512_256_x86.o src/hashes/sha2/sha512_desc.o \
src/hashes/sha2/sha512_x86.o src/hashes/sha3.o src/hashes/sha3_test.o src/hashes/sm3.o \
src/hashes/tiger.o src/hashes/whirl/whirl.o src/mac/blake2/blake2bmac.o \
src/mac/blake2/blake2bmac_file.o src/mac/blake2/blake2bmac_memory.o \
src/mac/blake2/blake2bmac_memory_multi.o src/mac/blake2/blake2bmac_test.o src/mac/blake2/blake2smac.o \
src/mac/blake2/blake2smac_file.o src/mac/blake2/blake2smac_memory.o \
src/mac/blake2/blake2smac_memory_multi.o src/mac/blake2/blake2smac_test.o src/mac/f9/f9_done.o \
src/mac/f9/f9_file.o src/mac/f9/f9_init.o src/mac/f9/f9_memory.o src/mac/f9/f9_memory_multi.o \
src/mac/f9/f9_process.o src/mac/f9/f9_test.o src/mac/hmac/hmac_done.o src/mac/hmac/hmac_file.o \
src/mac/hmac/hmac_init.o src/mac/hmac/hmac_memory.o src/mac/hmac/hmac_memory_multi.o \
src/mac/hmac/hmac_process.o src/mac/hmac/hmac_test.o src/mac/kmac/kmac.o src/mac/kmac/kmac_file.o \
src/mac/kmac/kmac_memory.o src/mac/kmac/kmac_memory_multi.o src/mac/kmac/kmac_test.o \
src/mac/omac/omac_done.o src/mac/omac/omac_file.o src/mac/omac/omac_init.o src/mac/omac/omac_memory.o \
src/mac/omac/omac_memory_multi.o src/mac/omac/omac_process.o src/mac/omac/omac_test.o \
src/mac/pelican/pelican.o src/mac/pelican/pelican_memory.o src/mac/pelican/pelican_test.o \
src/mac/pmac/pmac_done.o src/mac/pmac/pmac_file.o src/mac/pmac/pmac_init.o src/mac/pmac/pmac_memory.o \
src/mac/pmac/pmac_memory_multi.o src/mac/pmac/pmac_ntz.o src/mac/pmac/pmac_process.o \
src/mac/pmac/pmac_shift_xor.o src/mac/pmac/pmac_test.o src/mac/poly1305/poly1305.o \
src/mac/poly1305/poly1305_file.o src/mac/poly1305/poly1305_memory.o \
src/mac/poly1305/poly1305_memory_multi.o src/mac/poly1305/poly1305_test.o src/mac/xcbc/xcbc_done.o \
src/mac/xcbc/xcbc_file.o src/mac/xcbc/xcbc_init.o src/mac/xcbc/xcbc_memory.o \
src/mac/xcbc/xcbc_memory_multi.o src/mac/xcbc/xcbc_process.o src/mac/xcbc/xcbc_test.o \
src/math/fp/ltc_ecc_fp_mulmod.o src/math/gmp_desc.o src/math/ltm_desc.o src/math/multi.o \
src/math/radix_to_bin.o src/math/rand_bn.o src/math/rand_prime.o src/math/tfm_desc.o src/misc/adler32.o \
src/misc/algname_match.o src/misc/argon2/argon2.o src/misc/base16/base16_decode.o \
src/misc/base16/base16_encode.o src/misc/base32/base32_decode.o src/misc/base32/base32_encode.o \
src/misc/base64/base64_decode.o src/misc/base64/base64_encode.o src/misc/bcrypt/bcrypt.o \
src/misc/burn_stack.o src/misc/compare_testvector.o src/misc/copy_or_zeromem.o src/misc/crc32.o \
src/misc/crypt/crypt.o src/misc/crypt/crypt_argchk.o src/misc/crypt/crypt_cipher_descriptor.o \
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_constants.o \
src/misc/crypt/crypt_find_cipher.o src/misc/crypt/crypt_find_cipher_any.o \
src/misc/crypt/crypt_find_cipher_id.o src/misc/crypt/crypt_find_hash.o \
src/misc/crypt/crypt_find_hash_any.o src/misc/crypt/crypt_find_hash_id.o \
src/misc/crypt/crypt_find_hash_oid.o src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o \
src/misc/crypt/crypt_hash_descriptor.o src/misc/crypt/crypt_hash_is_valid.o \
src/misc/crypt/crypt_inits.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
src/misc/crypt/crypt_prng_descriptor.o src/misc/crypt/crypt_prng_is_valid.o \
src/misc/crypt/crypt_prng_rng_descriptor.o src/misc/crypt/crypt_register_all_ciphers.o \
src/misc/crypt/crypt_register_all_hashes.o src/misc/crypt/crypt_register_all_prngs.o \
src/misc/crypt/crypt_register_cipher.o src/misc/crypt/crypt_register_hash.o \
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_sizes.o \
src/misc/crypt/crypt_unregister_cipher.o src/misc/crypt/crypt_unregister_hash.o \
src/misc/crypt/crypt_unregister_prng.o src/misc/deprecated.o src/misc/error_to_string.o \
src/misc/hkdf/hkdf.o src/misc/hkdf/hkdf_test.o src/misc/mem_neq.o src/misc/padding/padding_depad.o \
src/misc/padding/padding_pad.o src/misc/password_free.o src/misc/pbes/pbes.o src/misc/pbes/pbes1.o \
src/misc/pbes/pbes2.o src/misc/pem/pem.o src/misc/pem/pem_pkcs.o src/misc/pem/pem_read.o \
src/misc/pem/pem_ssh.o src/misc/pkcs12/pkcs12_kdf.o src/misc/pkcs12/pkcs12_utf8_to_utf16.o \
src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o src/misc/pkcs5/pkcs_5_test.o \
src/misc/scrypt/scrypt.o src/misc/ssh/ssh_decode_sequence_multi.o \
src/misc/ssh/ssh_encode_sequence_multi.o src/misc/zeromem.o src/modes/cbc/cbc_decrypt.o \
src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o src/modes/cbc/cbc_getiv.o \
src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o src/modes/cfb/cfb_decrypt.o \
src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o src/modes/cfb/cfb_getiv.o \
src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o src/modes/ctr/ctr_decrypt.o \
src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o src/modes/ctr/ctr_getiv.o \
src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \
src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \
src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \
src/modes/lrw/lrw_decrypt.o src/modes/lrw/lrw_done.o src/modes/lrw/lrw_encrypt.o \
src/modes/lrw/lrw_getiv.o src/modes/lrw/lrw_process.o src/modes/lrw/lrw_setiv.o \
src/modes/lrw/lrw_start.o src/modes/lrw/lrw_test.o src/modes/ofb/ofb_decrypt.o src/modes/ofb/ofb_done.o \
src/modes/ofb/ofb_encrypt.o src/modes/ofb/ofb_getiv.o src/modes/ofb/ofb_setiv.o \
src/modes/ofb/ofb_start.o src/modes/xts/xts_decrypt.o src/modes/xts/xts_done.o \
src/modes/xts/xts_encrypt.o src/modes/xts/xts_init.o src/modes/xts/xts_mult_x.o \
src/modes/xts/xts_test.o src/pk/asn1/der/bit/der_decode_bit_string.o \
src/pk/asn1/der/bit/der_decode_raw_bit_string.o src/pk/asn1/der/bit/der_encode_bit_string.o \
src/pk/asn1/der/bit/der_encode_raw_bit_string.o src/pk/asn1/der/bit/der_length_bit_string.o \
src/pk/asn1/der/boolean/der_decode_boolean.o src/pk/asn1/der/boolean/der_encode_boolean.o \
src/pk/asn1/der/boolean/der_length_boolean.o src/pk/asn1/der/choice/der_decode_choice.o \
src/pk/asn1/der/custom_type/der_decode_custom_type.o \
src/pk/asn1/der/custom_type/der_encode_custom_type.o \
src/pk/asn1/der/custom_type/der_length_custom_type.o src/pk/asn1/der/general/der_asn1_maps.o \
src/pk/asn1/der/general/der_decode_asn1_identifier.o src/pk/asn1/der/general/der_decode_asn1_length.o \
src/pk/asn1/der/general/der_encode_asn1_identifier.o src/pk/asn1/der/general/der_encode_asn1_length.o \
src/pk/asn1/der/general/der_length_asn1_identifier.o src/pk/asn1/der/general/der_length_asn1_length.o \
src/pk/asn1/der/generalizedtime/der_decode_generalizedtime.o \
src/pk/asn1/der/generalizedtime/der_encode_generalizedtime.o \
src/pk/asn1/der/generalizedtime/der_length_generalizedtime.o \
src/pk/asn1/der/ia5/der_decode_ia5_string.o src/pk/asn1/der/ia5/der_encode_ia5_string.o \
src/pk/asn1/der/ia5/der_length_ia5_string.o src/pk/asn1/der/integer/der_decode_integer.o \
src/pk/asn1/der/integer/der_encode_integer.o src/pk/asn1/der/integer/der_length_integer.o \
src/pk/asn1/der/object_identifier/der_decode_object_identifier.o \
src/pk/asn1/der/object_identifier/der_encode_object_identifier.o \
src/pk/asn1/der/object_identifier/der_length_object_identifier.o \
src/pk/asn1/der/octet/der_decode_octet_string.o src/pk/asn1/der/octet/der_encode_octet_string.o \
src/pk/asn1/der/octet/der_length_octet_string.o \
src/pk/asn1/der/printable_string/der_decode_printable_string.o \
src/pk/asn1/der/printable_string/der_encode_printable_string.o \
src/pk/asn1/der/printable_string/der_length_printable_string.o \
src/pk/asn1/der/sequence/der_decode_sequence_ex.o \
src/pk/asn1/der/sequence/der_decode_sequence_flexi.o \
src/pk/asn1/der/sequence/der_decode_sequence_multi.o \
src/pk/asn1/der/sequence/der_encode_sequence_ex.o \
src/pk/asn1/der/sequence/der_encode_sequence_multi.o \
src/pk/asn1/der/sequence/der_flexi_sequence_cmp.o src/pk/asn1/der/sequence/der_length_sequence.o \
src/pk/asn1/der/sequence/der_sequence_free.o src/pk/asn1/der/sequence/der_sequence_shrink.o \
src/pk/asn1/der/set/der_encode_set.o src/pk/asn1/der/set/der_encode_setof.o \
src/pk/asn1/der/short_integer/der_decode_short_integer.o \
src/pk/asn1/der/short_integer/der_encode_short_integer.o \
src/pk/asn1/der/short_integer/der_length_short_integer.o \
src/pk/asn1/der/teletex_string/der_decode_teletex_string.o \
src/pk/asn1/der/teletex_string/der_length_teletex_string.o \
src/pk/asn1/der/utctime/der_decode_utctime.o src/pk/asn1/der/utctime/der_encode_utctime.o \
src/pk/asn1/der/utctime/der_length_utctime.o src/pk/asn1/der/utf8/der_decode_utf8_string.o \
src/pk/asn1/der/utf8/der_encode_utf8_string.o src/pk/asn1/der/utf8/der_length_utf8_string.o \
src/pk/asn1/oid/pk_get.o src/pk/asn1/oid/pk_oid_cmp.o src/pk/asn1/oid/pk_oid_str.o \
src/pk/asn1/pkcs8/pkcs8_decode_flexi.o src/pk/asn1/pkcs8/pkcs8_get.o \
src/pk/asn1/x509/x509_decode_public_key_from_certificate.o src/pk/asn1/x509/x509_decode_spki.o \
src/pk/asn1/x509/x509_decode_subject_public_key_info.o \
src/pk/asn1/x509/x509_encode_subject_public_key_info.o src/pk/asn1/x509/x509_get_pka.o \
src/pk/asn1/x509/x509_import_spki.o src/pk/dh/dh.o src/pk/dh/dh_check_pubkey.o src/pk/dh/dh_export.o \
src/pk/dh/dh_export_key.o src/pk/dh/dh_free.o src/pk/dh/dh_generate_key.o src/pk/dh/dh_import.o \
src/pk/dh/dh_import_pkcs8.o src/pk/dh/dh_set.o src/pk/dh/dh_set_pg_dhparam.o \
src/pk/dh/dh_shared_secret.o src/pk/dsa/dsa_decrypt_key.o src/pk/dsa/dsa_encrypt_key.o \
src/pk/dsa/dsa_export.o src/pk/dsa/dsa_free.o src/pk/dsa/dsa_generate_key.o \
src/pk/dsa/dsa_generate_pqg.o src/pk/dsa/dsa_import.o src/pk/dsa/dsa_import_pkcs8.o \
src/pk/dsa/dsa_init.o src/pk/dsa/dsa_make_key.o src/pk/dsa/dsa_set.o src/pk/dsa/dsa_set_pqg_dsaparam.o \
src/pk/dsa/dsa_shared_secret.o src/pk/dsa/dsa_sign_hash.o src/pk/dsa/dsa_verify_hash.o \
src/pk/dsa/dsa_verify_key.o src/pk/ec25519/ec25519_crypto_ctx.o src/pk/ec25519/ec25519_export.o \
src/pk/ec25519/ec25519_import_pkcs8.o src/pk/ec25519/tweetnacl.o src/pk/ec448/ec448_common.o \
src/pk/ec448/ec448_crypto_ctx.o src/pk/ec448/ec448_export.o src/pk/ec448/ec448_import_pkcs8.o \
src/pk/ecc/ecc.o src/pk/ecc/ecc_ansi_x963_export.o src/pk/ecc/ecc_ansi_x963_import.o \
src/pk/ecc/ecc_decrypt_key.o src/pk/ecc/ecc_encrypt_key.o src/pk/ecc/ecc_export.o \
src/pk/ecc/ecc_export_openssl.o src/pk/ecc/ecc_find_curve.o src/pk/ecc/ecc_free.o \
src/pk/ecc/ecc_get_key.o src/pk/ecc/ecc_get_oid_str.o src/pk/ecc/ecc_get_size.o src/pk/ecc/ecc_import.o \
src/pk/ecc/ecc_import_openssl.o src/pk/ecc/ecc_import_pkcs8.o src/pk/ecc/ecc_import_x509.o \
src/pk/ecc/ecc_make_key.o src/pk/ecc/ecc_recover_key.o src/pk/ecc/ecc_rfc6979_key.o \
src/pk/ecc/ecc_set_curve.o src/pk/ecc/ecc_set_curve_internal.o src/pk/ecc/ecc_set_key.o \
src/pk/ecc/ecc_shared_secret.o src/pk/ecc/ecc_sign_hash.o src/pk/ecc/ecc_sign_hash_eth27.o \
src/pk/ecc/ecc_sign_hash_internal.o src/pk/ecc/ecc_sign_hash_rfc5656.o \
src/pk/ecc/ecc_sign_hash_rfc7518.o src/pk/ecc/ecc_sign_hash_x962.o src/pk/ecc/ecc_sizes.o \
src/pk/ecc/ecc_ssh_ecdsa_encode_name.o src/pk/ecc/ecc_verify_hash.o src/pk/ecc/ecc_verify_hash_eth27.o \
src/pk/ecc/ecc_verify_hash_internal.o src/pk/ecc/ecc_verify_hash_rfc5656.o \
src/pk/ecc/ecc_verify_hash_rfc7518.o src/pk/ecc/ecc_verify_hash_x962.o \
src/pk/ecc/ltc_ecc_export_point.o src/pk/ecc/ltc_ecc_import_point.o src/pk/ecc/ltc_ecc_is_point.o \
src/pk/ecc/ltc_ecc_is_point_at_infinity.o src/pk/ecc/ltc_ecc_map.o src/pk/ecc/ltc_ecc_mul2add.o \
src/pk/ecc/ltc_ecc_mulmod.o src/pk/ecc/ltc_ecc_mulmod_timing.o src/pk/ecc/ltc_ecc_points.o \
src/pk/ecc/ltc_ecc_projective_add_point.o src/pk/ecc/ltc_ecc_projective_dbl_point.o \
src/pk/ecc/ltc_ecc_verify_key.o src/pk/ed25519/ed25519_export.o src/pk/ed25519/ed25519_import.o \
src/pk/ed25519/ed25519_import_pkcs8.o src/pk/ed25519/ed25519_import_raw.o \
src/pk/ed25519/ed25519_import_x509.o src/pk/ed25519/ed25519_make_key.o src/pk/ed25519/ed25519_sign.o \
src/pk/ed25519/ed25519_verify.o src/pk/ed448/ed448_export.o src/pk/ed448/ed448_import.o \
src/pk/ed448/ed448_import_pkcs8.o src/pk/ed448/ed448_import_raw.o src/pk/ed448/ed448_import_x509.o \
src/pk/ed448/ed448_make_key.o src/pk/ed448/ed448_sign.o src/pk/ed448/ed448_verify.o src/pk/pka_key.o \
src/pk/pkcs1/pkcs_1_i2osp.o src/pk/pkcs1/pkcs_1_mgf1.o src/pk/pkcs1/pkcs_1_oaep_decode.o \
src/pk/pkcs1/pkcs_1_oaep_encode.o src/pk/pkcs1/pkcs_1_os2ip.o src/pk/pkcs1/pkcs_1_pss_decode.o \
src/pk/pkcs1/pkcs_1_pss_encode.o src/pk/pkcs1/pkcs_1_v1_5_decode.o src/pk/pkcs1/pkcs_1_v1_5_encode.o \
src/pk/rsa/rsa_decrypt_key.o src/pk/rsa/rsa_encrypt_key.o src/pk/rsa/rsa_export.o \
src/pk/rsa/rsa_exptmod.o src/pk/rsa/rsa_get_size.o src/pk/rsa/rsa_import.o \
src/pk/rsa/rsa_import_pkcs8.o src/pk/rsa/rsa_import_x509.o src/pk/rsa/rsa_key.o \
src/pk/rsa/rsa_make_key.o src/pk/rsa/rsa_set.o src/pk/rsa/rsa_sign_hash.o \
src/pk/rsa/rsa_sign_saltlen_get.o src/pk/rsa/rsa_verify_hash.o src/pk/x25519/x25519_export.o \
src/pk/x25519/x25519_import.o src/pk/x25519/x25519_import_pkcs8.o src/pk/x25519/x25519_import_raw.o \
src/pk/x25519/x25519_import_x509.o src/pk/x25519/x25519_make_key.o \
src/pk/x25519/x25519_shared_secret.o src/pk/x448/x448_export.o src/pk/x448/x448_import.o \
src/pk/x448/x448_import_pkcs8.o src/pk/x448/x448_import_raw.o src/pk/x448/x448_import_x509.o \
src/pk/x448/x448_make_key.o src/pk/x448/x448_shared_secret.o src/prngs/chacha20.o src/prngs/fortuna.o \
src/prngs/rc4.o src/prngs/rng_get_bytes.o src/prngs/rng_make_prng.o src/prngs/sober128.o \
src/prngs/sprng.o src/prngs/yarrow.o src/stream/chacha/chacha_crypt.o src/stream/chacha/chacha_done.o \
src/stream/chacha/chacha_ivctr32.o src/stream/chacha/chacha_ivctr64.o \
src/stream/chacha/chacha_keystream.o src/stream/chacha/chacha_memory.o \
src/stream/chacha/chacha_setup.o src/stream/chacha/chacha_test.o src/stream/chacha/xchacha20_memory.o \
src/stream/chacha/xchacha20_setup.o src/stream/chacha/xchacha20_test.o src/stream/rabbit/rabbit.o \
src/stream/rabbit/rabbit_memory.o src/stream/rc4/rc4_stream.o src/stream/rc4/rc4_stream_memory.o \
src/stream/rc4/rc4_test.o src/stream/salsa20/salsa20_crypt.o src/stream/salsa20/salsa20_done.o \
src/stream/salsa20/salsa20_ivctr64.o src/stream/salsa20/salsa20_keystream.o \
src/stream/salsa20/salsa20_memory.o src/stream/salsa20/salsa20_setup.o \
src/stream/salsa20/salsa20_test.o src/stream/salsa20/xsalsa20_memory.o \
src/stream/salsa20/xsalsa20_setup.o src/stream/salsa20/xsalsa20_test.o \
src/stream/sober128/sober128_stream.o src/stream/sober128/sober128_stream_memory.o \
src/stream/sober128/sober128_test.o src/stream/sosemanuk/sosemanuk.o \
src/stream/sosemanuk/sosemanuk_memory.o src/stream/sosemanuk/sosemanuk_test.o
else
OBJECTS=pre_gen/tomcrypt_amalgam.o
LTC_CFLAGS := $(LTC_CFLAGS) -Wno-shadow -Isrc/ciphers/aes -Isrc/ciphers/safer -Isrc/ciphers/twofish -Isrc/hashes/whirl -Isrc/stream/sober128
endif
# List of test objects to compile (all goes to libtomcrypt_prof.a)
TOBJECTS=tests/argon2_test.o tests/base16_test.o tests/base32_test.o tests/base64_test.o \
tests/bcrypt_test.o tests/cipher_hash_test.o tests/common.o tests/deprecated_test.o tests/der_test.o \
tests/dh_test.o tests/dsa_test.o tests/ecc_test.o tests/ed25519_test.o tests/ed448_test.o \
tests/file_test.o tests/mac_test.o tests/misc_test.o tests/modes_test.o tests/mpi_test.o \
tests/multi_test.o tests/no_null_termination_check_test.o tests/no_prng.o tests/padding_test.o \
tests/pem_test.o tests/pk_oid_test.o tests/pkcs_1_eme_test.o tests/pkcs_1_emsa_test.o \
tests/pkcs_1_oaep_test.o tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/prng_test.o \
tests/rotate_test.o tests/rsa_test.o tests/scrypt_test.o tests/siv_wycheproof_test.o tests/ssh_test.o \
tests/store_test.o tests/test.o tests/x25519_test.o tests/x448_test.o
# The following headers will be installed by "make install"
HEADERS_PUB=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
src/headers/tomcrypt_cipher.h src/headers/tomcrypt_custom.h src/headers/tomcrypt_hash.h \
src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h src/headers/tomcrypt_math.h \
src/headers/tomcrypt_misc.h src/headers/tomcrypt_pk.h src/headers/tomcrypt_pkcs.h \
src/headers/tomcrypt_prng.h
HEADERS=$(HEADERS_PUB) src/headers/tomcrypt_private.h
#These are the rules to make certain object files.
src/ciphers/aes/aes.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
src/ciphers/twofish/twofish.o: src/ciphers/twofish/twofish.c src/ciphers/twofish/twofish_tab.c
src/hashes/sha2/sha224.o: src/hashes/sha2/sha224.c src/hashes/sha2/sha256.c
src/hashes/sha2/sha384.o: src/hashes/sha2/sha384.c src/hashes/sha2/sha512.c
src/hashes/sha2/sha512_224.o: src/hashes/sha2/sha512.c src/hashes/sha2/sha512_224.c
src/hashes/sha2/sha512_256.o: src/hashes/sha2/sha512.c src/hashes/sha2/sha512_256.c
src/hashes/whirl/whirl.o: src/hashes/whirl/whirl.c src/hashes/whirl/whirltab.c
$(DOBJECTS): LTC_CFLAGS := -Itests $(LTC_CFLAGS)
$(TOBJECTS): LTC_CFLAGS := -Itests $(LTC_CFLAGS)
#Dependencies on *.h
$(OBJECTS): $(HEADERS)
$(DOBJECTS): $(HEADERS) $(THEADERS)
$(TOBJECTS): $(HEADERS) $(THEADERS)
all: $(call print-help,all,Builds the library and all demos and test utils (test $(UNBROKEN_DEMOS) $(BROKEN_DEMOS))) all_test $(BROKEN_DEMOS)
all_test: $(call print-help,all_test,Builds the library and all unbroken demos and test utils (test $(UNBROKEN_DEMOS))) test $(UNBROKEN_DEMOS)
bins: $(call print-help,bins,Builds the library and all useful demos) $(USEFUL_DEMOS)
check: test
./test
tvs: hashsum sizes constants tv_gen
./tv_gen
./.ci/coverage_more.sh
mv *_tv.txt notes/
pr-check: tvs
./helper.pl -a -u
#build the doxy files (requires Doxygen, tetex and patience)
doxygen: $(call print-help,doxygen,Builds the doxygen html documentation)
$(MAKE) -C doc/ $@ V=$(V)
doxy: $(call print-help,doxy,Builds the complete doxygen documentation including refman.pdf (takes long to generate))
$(MAKE) -C doc/ $@ V=$(V)
docs: $(call print-help,docs,Builds the Developer Manual)
$(MAKE) -C doc/ $@ V=$(V)
doc/crypt.pdf: $(call print-help,doc/crypt.pdf,Builds the Developer Manual)
$(MAKE) -C doc/ crypt.pdf V=$(V)
install_all: $(call print-help,install_all,Install everything - library bins docs tests) install install_bins install_docs
INSTALL_OPTS ?= -m 644
.common_install: $(LIBNAME)
install -p -d $(DESTDIR)$(INCPATH)
install -p -d $(DESTDIR)$(LIBPATH)
$(INSTALL_CMD) -p $(INSTALL_OPTS) $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
install -p -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
$(DESTDIR)$(BINPATH):
install -p -d $(DESTDIR)$(BINPATH)
.common_install_bins: $(USEFUL_DEMOS) $(DESTDIR)$(BINPATH)
for d in $(USEFUL_DEMOS); do $(INSTALL_CMD) -p -m 775 $$d $(DESTDIR)$(BINPATH)/ltc-$$d; done
$(INSTALL_CMD) -p -m 775 demos/ltc $(DESTDIR)$(BINPATH)
install_docs: $(call print-help,install_docs,Installs the Developer Manual) doc/crypt.pdf
install -p -d $(DESTDIR)$(DATAPATH)
install -p -m 644 doc/crypt.pdf $(DESTDIR)$(DATAPATH)
install_test: $(call print-help,install_test,Installs the self-test binary) test $(DESTDIR)$(BINPATH)
$(INSTALL_CMD) -p -m 775 $< $(DESTDIR)$(BINPATH)/ltc-$<
install_hooks: $(call print-help,install_hooks,Installs the git hooks)
for s in `ls hooks/`; do ln -s ../../hooks/$$s .git/hooks/$$s; done
uninstall_hooks: $(call print-help,uninstall_hooks,Uninstalls the git hooks)
for s in `ls hooks/`; do rm .git/hooks/$$s; done
HEADER_FILES=$(notdir $(HEADERS_PUB))
.common_uninstall:
$(UNINSTALL_CMD) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
for d in $(USEFUL_DEMOS) test; do rm -f $(DESTDIR)$(BINPATH)/ltc-$$d; done
$(UNINSTALL_CMD) $(HEADER_FILES:%=$(DESTDIR)$(INCPATH)/%)
#This rule cleans the source tree of all compiled code, not including the pdf
#documentation.
clean: $(call print-help,clean,Clean everything besides the pdf documentation)
${silent} find . -type f \
-name "*.o" \
-o -name "*.a" \
-o -name "*.obj" \
-o -name "*.lib" \
-o -name "*.exe" \
-o -name "*.dll*" \
-o -name "*.dylib*"\
-o -name "*.so*" \
-o -name "*.out" \
-o -name "*.gcov" \
-o -name "*.gcda" \
-o -name "*.gcno" \
-o -name "*.il" \
-o -name "*.dyn" \
-o -name "*.dpi" | xargs rm -f
${silent} rm -f $(TIMING) $(TEST) $(DEMOS)
${silent} rm -f *_tv.txt
${silent} rm -f *.pc
${silent} rm -rf `find . -type d -name "*.bin" | xargs`
${silent} $(MAKE) -C doc/ clean V=${V}
zipup: $(call print-help,zipup,Prepare the archives for a release) doc/crypt.pdf
@# Update the index, so diff-index won't fail in case the pdf has been created.
@# As the pdf creation modifies crypt.tex, git sometimes detects the
@# modified file, but misses that it's put back to its original version.
@git update-index --refresh
@git diff-index --quiet HEAD -- || ( echo "FAILURE: uncommited changes or not a git" && exit 1 )
@perl helper.pl --check-all || ( echo "FAILURE: helper.pl --check-all errors" && exit 1 )
rm -rf libtomcrypt-$(VERSION) crypt-$(VERSION).*
@# files/dirs excluded from "git archive" are defined in .gitattributes
git archive --format=tar --prefix=libtomcrypt-$(VERSION)/ HEAD | tar x
@echo 'fixme check'
-@(find libtomcrypt-$(VERSION)/ -type f | xargs grep 'FIXM[E]') && echo '############## BEWARE: the "fixme" marker was found !!! ##############' || true
mkdir -p libtomcrypt-$(VERSION)/doc
cp doc/crypt.pdf libtomcrypt-$(VERSION)/doc/crypt.pdf
$(MAKE) -C libtomcrypt-$(VERSION)/ pre_gen
tar -c libtomcrypt-$(VERSION)/ | xz -6e -c - > crypt-$(VERSION).tar.xz
zip -9rq crypt-$(VERSION).zip libtomcrypt-$(VERSION)
rm -rf libtomcrypt-$(VERSION)
gpg -b -a crypt-$(VERSION).tar.xz
gpg -b -a crypt-$(VERSION).zip
codecheck: $(call print-help,codecheck,Check the code of the library)
perl helper.pl -a
perlcritic *.pl
help: $(call print-help,help,That's what you're currently looking at)

View file

@ -1,4 +0,0 @@
#!/bin/bash
if cvs log $1 >/dev/null 2>/dev/null; then exit 0; else echo "$1 shouldn't be here, removed"; rm -f $1 ; fi

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -57,23 +57,23 @@ EAX-blowfish (8 byte key)
16: 60A315193F58144F5701D547C79FEEED, 912FDBDB05467DF5
EAX-xtea (16 byte key)
0: , 86881D824E3BC561
1: EE, 4C3505F04611D9C2
2: 80C8, 6A3428BEEAD60738
3: BF88E7, 04F1E99E9F5906C2
4: E06574B7, 33B0153AAEF9776F
5: 42D950AF63, 4A0F415640322FDF
6: C30F6AD46EC9, 9646FE909D2B95CB
7: A0049FCA856A14, A0257289C6BBF278
8: 2814B0C1358440E0, C4B0A2354925E887
9: BF4F062B52C1E489CF, B56442A3CA57A041
10: 63DF433956831B8780FC, ADF9ED0B46DCA19E
11: C317FD079817F50E0E8A16, 2EA0EC993FC603AE
12: 2BD12FDDD81EB11660346D2A, FBC6F69125BBA88D
13: 85D356536FE2843C6BBE60EDBC, BB2FEFD04F230E79
14: 22493009DB01B4746F4927A8C4FB, 64CC08471D93C9AC
15: C0F3C0DB08DC93FBA725D1E02DE084, 77B762213DDCCFFE
16: 568B66D3112556BD98FF9339E9C002E5, C8355F508219FE0C
0: , A04FAC8D0416F081
1: 5E, F95DAA99F8FE28E9
2: B6A7, E2A05E1F1E6D17B5
3: 27D698, CCC0CC54F40DA243
4: C2E81CCC, 283AB8F109D287ED
5: 51B99DF694, A9637DB356B4BC0C
6: C2ED3E79A4F2, 413D3A65FFE803BA
7: 40E35BE6CA019C, 1B68833B90E4E026
8: C246C2B5ACEBEB08, 50CFEB01DEC3BB1F
9: 35E2F7AAB57842D50F, 617804483BFFCA9D
10: 2F855AB7A4664958300D, 6F054767FE484664
11: 2824A5486D1B621D0F992A, 238566B9F56ECAB1
12: BF5C121A6144AA0CC05A380E, 63F4DA4B898FB2A8
13: 2EB53E8A4698EDEBB990FC65E6, 7DFFE0E43187D10C
14: 85F77FD150C6649F5826AD45D50D, AA660F37975768FC
15: 8B4EB3750814EE7E8FC6B97B3ED1ED, F79545FB1F1C389B
16: 980EB7FCEEE37558BEDA0E938325F608, 2FAA9235BFA3EA30
EAX-rc5 (8 byte key)
0: , 169C7954341EF44D
@ -313,6 +313,25 @@ EAX-des (8 byte key)
15: 8D1A1E888BBB8648E638C4E74E11B8, 685E006C441448B8
16: 93AE906B8BE4EAC8ED6D8F48F04A7AFF, 71DD7AF752FE28FB
EAX-desx (24 byte key)
0: , FA66F07E473109A2
1: 4B, 576970495248BB09
2: D81C, 3AE9E470ABFBEEB1
3: 5B2442, F6B3BDC55CBD01A2
4: B1A495A8, AAD2D78BC0525DA2
5: 7723413A8D, 51D3134CBC32AD9B
6: 6F9D40815E10, 552C146A7A769E9E
7: B3292E406C9B92, D3ACE79B2D69877B
8: EF7513D71D52C33A, 64935E1AE8C416B1
9: 068AEDE3E0E1B0DC11, 2C5698925FFC70BF
10: 76A5664A3D5DF553BAC4, 52B9D560C0D9BB0D
11: CC6128B6BD0035354CF3A3, A8BA535862B221BD
12: CB499A58CF55D016B79192EF, 76842391A45C6674
13: 4903FBC696A256D4AC16A3EFD2, 39978842103FE097
14: 9CD5671BEDF4EB8D519A72310A37, F00809AA017E81C5
15: 9F62AB705A285EBF998FCF401166BA, 506244F55C4EAD84
16: 110161EEF9B3CE543DB12EA8682866D4, 7A12BE4371963521
EAX-3des (24 byte key)
0: , 8914311BB990B725
1: D8, 2094EDC5D03E54B1
@ -332,6 +351,41 @@ EAX-3des (24 byte key)
15: 9E8C73EADA105749B5D8D97392EDC3, 2E749EE66C1E6A16
16: 600FA4149AF252C87B828C780AEFF8BC, 33D7D11DCDC19936
EAX-sm4 (16 byte key)
0: , 650501697FAF3887F97E691AD57FD916
1: 56, 34D9D25271FA43908A88585CCA65BB56
2: 0F1A, F5E3D4115EB84F74A2AB8289E696F366
3: A06D88, 4425EAA479E448A034B7B997A6BE84C2
4: BC33483A, 51188AB6D581A1335CD5C2E554B7C68F
5: 353583E113, 45071CBF115D70CF0E7852B87E836B65
6: 3093D4065F4B, 73E28033374C6512E6A135ABA04A6870
7: 349796DFD3F24C, 1A3E0016A50C0018BAA966F99A320A7E
8: 9D7797A751E31590, 30FD2B87E834DF19FED8357CD26BC88B
9: 2ABCB97055D2BE28D0, D69EF4E92C0C50A52E053DE99CA94501
10: BA7B8CA8FB59F7A0263B, F9DC5935366E22AE8B455461E949ED4F
11: D4ADCF3E64D0B2F251479B, 34CFFFC5A89D7CF8BD836421038C7A42
12: 924FC873A8F53C16F37D54A1, 8FA7A0073CC0BED6D34709FE9A7EC600
13: 99AEE0A92D0D6D783FEEE6ABA2, 24F753FFB17EF010E0AA0947FC52BAA4
14: 00BFC12E5B7E14F0EDDFC42A1816, BAAD3E2BED1F6ECFF81D2184C69B3484
15: 4E85F4056D13919731FDAD6E8E974F, F24C6A5E6EB02D4DDF27CB757D1A2423
16: C0F667A42E6B5598398B431814A18273, EC9E34B8E933583E16510ACE9B4DF06B
17: 0F7B8922D29E828148A46FEAC29729032C, 4934C5F94389495195984CFF758E87AB
18: 4C67F1ECF5BE22F16F20A25C79ADBD01ABEB, B6DAE0A254994AE40DF0F29DFAF50364
19: 084D26AD7889C945C2AF7E633D870CE79B4729, 402DEAFE37357D5D9DBAF56D3C5F5800
20: 621482F573F2BF7D3C4E1294D22CA36AD5B8BA56, C42036C948E4158127F7921B0548EB38
21: 807E26EC65A32C6431E16D02F1013F60DA8D6F8FEB, A9451DB25AA897C6E74A7AB0D0CF5E89
22: ECDF3996A964655239C7B1FF36B27AB40233CE920F9F, 7B6E0355E5AC027E52D046A5A21CDE2D
23: 89D9DFA557700E6CCA7825B7055C3A84F50FC1DB2C2140, 850F5596560D461751382E1A2FAAE21F
24: 4B4F825B41D728CFD1E3AEC60ED227A858A2C020EB0D785C, 63B44E988DF17AF1A5999A6CFE4068EA
25: 7D885DEFFC7CFA06C7FC710C6ED78976A40C6D7EA82AA0F7FB, 88B2E50E500C0883141712B2BABEF5A9
26: 65CFF84444B5CCF480E5D3062BDCB4662C5C2B9933841D6F04E5, DAD13A3AD0D51F98356B6FC69C934BB0
27: 95C852409422E090E049218F228DB32CC302BAB911E2C871A21BF4, CF4D1EAF2886CF74479E239AC6CD585D
28: CBAA0B7052DEC9C8DA334EF910FAE656EAAAEFBA5D6C1D5687D78536, 13E40EFAE3336AC5B51415504A9640B5
29: DD0D60752F4EBD70509B1DAC9868A73151FE6950083E3976DC264A7399, C9AE7328F68C537E6C0C6D7A8A3E0D9C
30: 8FF315081B4E87A2753038905A3EC46879E28C6458809E97EEEC7D77EB22, 3C3E1B732EB711E51D4F1F80B38B9741
31: 41CAD696C51CA2F938C3BA517177A22AD17211D4A38F43A81436308E08CC41, 5DAEBD5D3C58CF6CEE1D1EF9FC171DAD
32: BDF417BCDF679E2C981023BBB53D408929A4052F1F04BD59DE618C588786EA90, 1DBC8FA9D1F645E424FC74147ABA4C2C
EAX-cast5 (8 byte key)
0: , 382FB8F7E9F69FDC
1: 99, 20DA959849B3F7AB
@ -352,39 +406,39 @@ EAX-cast5 (8 byte key)
16: 70CABBA983179106AE7FCD5F1F31D5C3, BF7F9168F4F82F56
EAX-noekeon (16 byte key)
0: , 556805EEA595CFB9A30FAD196103D7FD
1: F5, 0A7DAEDFB656526CEF4DDBA8087A227A
2: 7B8C, 249895D79962D5B4D18FE07366281B72
3: ACFF15, DCC489D24832EB106F576AE6B6EB957A
4: 08ADE7DB, 0D3215999E9960EDAB29B78744C7F139
5: 66139213F6, 505E1E7141D043E903C26EE0959EEECD
6: 078B79F880A8, 35B7EB326A55E50332866EEDB682EC20
7: 2809E34D9667D4, FFDEC555F68524A09A6ABACA372077D9
8: 93D267DE1EC635D3, 4FF3561990A56E4B374618722EF850FF
9: F377A4D93FF32F4A51, 91D4070423A90FC54D305169C03F49ED
10: 6244B717E082993EB7A1, 2E3A8A354AFA9473667ED7FDD46BE9FC
11: E917559625D25E6E5F2EDA, 19295C37A70314CC9A1D11FDE8D23C92
12: 1E6DF2EE112A893AB14DFA92, 12C4A89D4CD65F8116A03A135AFD3701
13: 47B18CD762E011770E203CF605, 434909A97E118B20D3AEDC79AFE33A9E
14: 72D9A1A7DA6F33D5E0B927F9F32C, 779C23714FCAA2B2321EC7FB5B03E222
15: DA8B830FFCB3DB274807F780D33240, EDC2F1C8A401F328A53392597730B007
16: B53DD2BB840AD933D36A7B5FFDCCFBBB, 4EC0E6D1F916BF633869239B672B37A1
17: 42936BB9A936C30408660855F4F47F3314, F0DAA6DDA15585E1697ABBB4790B15B5
18: 00372E47F5BA016F1B2A1E680B76AB02052A, CDBF3D241BF7FF96D3DFBEDDB872E901
19: 8AA236B0C8BEF6F67A97C2DF90628F6E5838FF, 731DCD61F7F26004C03519F9500EA824
20: 55338647812FC9D86CBDDCED7120268A4D43F8BA, 0E61B3C835CAD95FD49FEF002C014E72
21: 435820B28E52154B47A04D5E635D8FE37FA47FC985, F6A96DCE4917E8D7C610923627E80970
22: 0D30C15B6FEB4A48B14DD15D41A4B25D442AA677B25C, 28E15CCB74AE992C68BDDC8D87802050
23: D9D701F9AD6B0E13D2CDDA15A5194E7CE8BD2C02137391, 2DB9A15884E9C996C3D6B5BDA44B9598
24: E2390AC5CE10CCFBC72106A52C7F180CB477E3C193CBACA8, 22D3F7DCD6947EA4E78DF57A8E1A9A59
25: ADEFB7D9500658D34996AF6BE6336CD78891064EA1DB8E9785, F239D67D039A15C620A7CD4BE4796B3F
26: 89964C90ABF54A6DF9F13C3681E70C702D80A17BE79F8160F30E, 6336F729ECE1ED7368669D75B7E2DCBA
27: 576B2813CECDA4F905BD5D58349EF070FF41B7EB6BB2B01B061B0B, 125324CBF2ACF1011A44A99A11EC8AFC
28: 430B957481748519A60494F0B5F698F34B1A8235B00AC0D1F0A4442E, 1E80A7FCEBBB8E1E12D6831906154485
29: E781BFE5FCDE0BFC056CC86C4A0B9DD3B815BE8CA678204CF47289B5B5, 190D5AAA9EC1CB4CC86FACE53BF1201B
30: 78BFAC07A9B7B2AE9329BF9F9BF18A1A49DD9587001EFCA00E9AD9752764, 4FB5ECBEEB0995C150EBC66508FA19C1
31: 7D6C20694109DE21F7955855A8FF832347518DD496C2A114DF142C68ACDEAA, B25D4BB34056DC091A7A3950D46C32EC
32: 3E1E4395DEC1AFEA9212B95F37E679B6E2D14DF23C5DE49018C2C8038CC4AD45, 9A6DE7BD41A21918AD504490EF4E581D
0: , 5CB584CC68025F830B42371B9CCE99EB
1: 65, 69D866C00E11E4311ADCD50AE2F91D03
2: 80D2, DA0499598F478A7FF53324908EB4DC74
3: 86EFB4, 7DC1556C65F9E7CF2E3A357B38E326D1
4: 87387A77, 7B58F421766918A179A999520A6E3781
5: D18B9788C6, 924A2FF178FD06BF292A605FCB27BDD9
6: 0075EC03ECD1, 78F553564A25A574E6A4857778A2DB43
7: 5BF96EC79C2E88, C49CBD1C4F631B35D5A3B764251870D2
8: 70DF3B35F6D9B822, 42351BF5C947AF7A0E1F852199B5840C
9: 2E53748525AF367861, 4986BC390AA0DA1E4E78CB2148A2C513
10: 05DE8BAD8C975ACECF87, 1C0F1C18FB8682D76AF9E48D3547D88E
11: 8B2B1D70F6A74059503F42, 839EE120ADC8BF08CD9A7DF6393D1E51
12: 9D7F92F08953B5B300A7410E, 603A43432DAB26882797BB5AA7A75D28
13: 4CA551DDB4BBCFA45BF71C49DA, D2743508826E3E39151F21C0AD81C8DC
14: BAE72091E78013369AF5D0294AC6, 3F0D391BF01C3BA116A9CAF50DC28307
15: B037AFB65588B95BC86E1430E0746A, 2399A4C31F55310AE2C4A2FE3379C74F
16: 842F0B29888C43999545D29CFEFA58DD, 9B6E4FED2A6BE59DC2DFAB407D2FD124
17: 86F7DA57E5C9DE9C88EFC1ED0CA61F76A4, E7278F365289FD0C484A166FA9EDB801
18: CB94AD60C1FBDC9868DDE0D4674251A644B5, D857CE47FB963DFBE7983D183695803B
19: 5A0B24FF167EB133808A3FBF89D9895F30BE1C, 488362E61725BE723CE892F550AF028A
20: 60D43A8C29F1714588672847FA00DE771F2C3D36, 25D7CEF55A2A33953D9B7739F9C98C12
21: CC47C891FAB841800F0AC0F746A257062BE9AF49F3, 220A3EE618FB735B9E801F9B3708D4FE
22: C8E0F9AF7A7C62B6C297B16025DA55BAF5BA13F6ABA7, FA16192047892BC2472AF1DBD95E0D6F
23: 731BDA5BEFCBA427E715839C21E4A176D0E28F042C3089, 4CBE4BB916EEE773B9299FE2FF0BBD81
24: 62C5CD4F7EF81EA4E58847F3F715FA9E9EFB32059D70BA88, 090E92CEED8FB5D472CCDA11363FC904
25: F7FD159377B130633F93B4D18BE68B0872905BDB205025E4FB, 6F335AB81AC8507D5F4018F86FB0230E
26: DC374E5B40E8F4614C2BE685539C97825C7A972CA2BEFF338208, 719F6C042DB09A08C36D92810FCC29FD
27: 1050C71D491237EF77F4F043D7EDCBD41DA0BC155F1CB65EAA1D5E, 44E7CD8CEB27584340270F3CADE1A083
28: 8AE94A4FF500DC889436866D90B8E150B63EDE74074912029FF9C3A0, 3C96328BE53423BEB32FFE0D05F9B71A
29: A801D1571411396C0727B132AEFE114D7BD486DA74C549E7661F2D8B87, DD6A443497AFC9EB14FE6EE9069AD580
30: C79DFE19B0199768EFDD29026863C644A0ADBD14A3F3866DE74EE7AA2E0C, CCB313FE30CD4F04BB3548808FEBAE6E
31: F658ECDD95F960D7C68D03F9BBADF066F8B9CE8108867C7DEA305FF4124AF2, 8AE64618E77A2806B53E239927787ACB
32: C92EF301771E89D5BD3B901B380EBE18BD2A193B5989092006E7AC15345AFD34, B450AC584DF13D9C8BDD32DA686A1AF9
EAX-skipjack (10 byte key)
0: , 85F74B6AFFB10ACD
@ -459,3 +513,219 @@ EAX-khazad (16 byte key)
15: 14DA751E5AF7E01F35B3CE74EE1ACF, 3C76AB64E1724DCE
16: A13BBC7E408D2C550634CBC64690B8FE, 3D4BBC0C76536730
EAX-seed (16 byte key)
0: , 3D0715108CEA3BE144350082B1BC4F25
1: EF, E56898AEDB0F461980587FFBDB83EE59
2: 9552, 9647B7FCEDBB9EF4EDEBCD98831E5BDE
3: 25DCD8, 3647D80EF3529C72F16D223D04D7ACAA
4: 3D169011, 7A741FA2536E5905FD4ABAB104062D3B
5: A92411F6BC, 18A306E5DBF4DBDCE21505F16DA85482
6: 9D4661D2859F, 7B2FC34AB3DE45DB4AE8C97BF3B32BA9
7: 0E8C26E24B0961, DFF098B44E7D57A71F68FD0D2D2416C7
8: 485EE54D5D2684DF, C8FCF501065D23F936A4A530BB028EA0
9: 768888B50865A635A2, 8121463B762AC12D19EE21C58A8A1B7B
10: 647FF44F0B350385BF27, 883241565540347D491C0E397FF5D663
11: FD868A569E2E597EB3B5AC, 4DE96B6810A1FC5F19A085B4F4C8B687
12: 342D72063420F3FCFC1EF71F, 88B94C3FFD74F052CC44722B87E1A45D
13: C768F88646D47D5201FDF47A1E, A01EB1FBB3AB135F258B87C30A8E1A13
14: 44BF87EC9A5F5E20E5D972ECAE4C, 6F1C44EDB3533EFF973B53EAAF84D601
15: FDE60E4F25C4B9388BD3D348912B7F, 863871D706A32F92DAD13803CF2008E1
16: 69881E58AF690C5EEBC00DABDAAFBCA9, BD3911C5E41B327A10DC7D03435FB8AC
17: 41AC0D70E8ECB01CFFFC9352E3800F568E, CCD63A0D20D0FD385EB720B2D60D20EF
18: 88301B40FA8B84ECEE7238F17B08EC2A2DA3, AD10D120ABCCB67FD3F12C8D8BD216F7
19: CCD0F8187B7455274D80A2387599617582B7C5, 3DAA6952A9AA160863E4F489AF04C6A5
20: CB955D3B6044F1712DEDC65451E46B8D9FBE5067, D46FEEFA0A0069115F262877050265E9
21: 373B8AD20672BEADE5B742C72306455549B26DB631, 16DC5FE5C7C0D5478FF67AD00463AEF1
22: CAB49183077EB4DF3BFBF7FE026BCA8311A6BC067EDB, 8F4497F253167AB81A70A05218734C1F
23: C2F860DA7EC7801FE30FF8C362EFA11E9392E029E24407, 1612D514BF9F365EB0E5CA13E974670D
24: F0084F22D7AE598FF5DFEF76CCC0728325BB5D3DF5467B2F, 1DE5CD767D2B731DE4C9B4E303A7E771
25: F5E907AC398B2C7BE124ACCAD1FEB001BC3EC7C77C21E94110, D8C7D50EFB0CCE2926DA9E796EA46E17
26: D65A41B86D24C573D21EE416F2F853E8FF7A0788120102E8BABB, 3EEDB65BCF0E32C24B797D972913F943
27: 3B39B9994248DD1FB3EFD68820D19E8436F66FF0E6D82F40E50AFF, 7892720F9AA0ABC34E05FD982396C13A
28: 9B924A2F620E5160B8F6C8DD313F39D6DC22B7E0596C8D0BFCA14907, E417D1FE5569975E8698C4D80684A613
29: 01068AA5F6FBFFDE1A8290CB315426F8CFD2438C09FD5982BE45EB21CC, A7DB568F037E8A4DB2D73CB2DF2BABA4
30: D39210874C4B7BEB63966BDC89AC7279B67C118618E9C44C1C563A10F74B, FB64939029B8E5DC1318EBE3FDAFC9F6
31: 8338B7BCA36C104C4B7EEBFF582FEAF879894FD6F00434859AD94E644BEC60, 93DECCE7AD61E69A2BD6621FEE2953D9
32: 21DC38BE252ECCA74963965660C98B5D9B5C2411945D8AAF9EF93732748A6162, 2BBE555F1D3C94BC6F1665A6DEDB536C
EAX-kasumi (16 byte key)
0: , 9E0C41B26B960E81
1: 03, 26B904336B9E0BDA
2: 9EB8, 18E90B52DB587A8B
3: F8E4F4, 9842D0A42ACC7717
4: B5688382, 2134820AF25CFFF5
5: 582E9402B2, 9C0F60D5B2D4BEA8
6: 836A3CEA4965, 6EB7565E0FF7FFCA
7: 00DD66F0AB54AE, 0CAFA81DFB52F835
8: F5824156469E77DA, 44AEED7DA55C7C2F
9: FCED54C15FAE6EB601, 95D7A3592D5F3B0E
10: 0630750CAF71D334562C, D8F7432F9AAEC624
11: 25E3C5FAFE86F59D30BEDE, 42E3F6C3B8F73F64
12: B98480D54E604E4CFB988EFB, 2BCA65A62CE3E363
13: F07F1F98A2411749EA11FD87F2, EC7C07D37B7CC07C
14: 19A6D648AD698ADED0AF37001479, F88417372E600717
15: 17CE88FC64ED98233BBAB20AA4DA45, 4959410987AE317B
16: 61EE83703D8CA5D652F8E1E83C86D58F, 57EC73A828C20B68
EAX-multi2 (40 byte key)
0: , E3EB492A2A560816
1: C6, E0A176A66E269255
2: 1D00, 472E25EF8B4ED450
3: 1DFE5A, BEDB3404162C7122
4: 915B77D4, BABBB74A3EE61755
5: 3C966136E8, 603664C04EF42178
6: E4A4925C9F75, 41B77B32F28613DB
7: 365BC4FEF0B1B0, BB09E42F396F3832
8: FFCE6DA57D7FE9D1, C11BA7A7B580032C
9: 0413506EE42819574C, 9B5C6A8111BE7B29
10: 531319C06A4B68AE226C, 77BC1DF09414D212
11: 85C0454EB3B9CDEDD32EF9, 39576F2268A59EF6
12: 8FB1732015FD006D2FFA8D9C, F8F51511ECA4E0A7
13: 1654F11C940FCBA529D2384A0D, 871B4541612C7CCE
14: F119DC9F998D92B4C45185CFA2D1, B50D3A61F3CE76B0
15: 05B051F7DA81609FAC41BF0A19C45A, DF1265F3F69625F5
16: A313136E4E7F1314E7ED504B48324047, A9D1C5527D6EF7D7
EAX-camellia (16 byte key)
0: , 9E8CDB7237166EF9FD0605A0AD3E4070
1: 8A, 23F462AC7E22EB9078DAC34CB1CFFB08
2: EC9D, EBA9E2E3112C18CC2991FFF97EF77E6F
3: D2A9CF, 913472F45F6D6B087D8AEB34B0FF9494
4: 360A7ECC, 6382103D53AB8C9263977AFB1A96AAC4
5: 80B52AAFE6, F855787CD6CCA56CD656A0DBC663CAD1
6: 0915D546F5F0, EBE17981CAB5D59E6376CFE30DE66936
7: 086B525B082B71, 182D76F2DE42F5D0AC252F25E7BC34CA
8: 438DA1E9E78B9D2E, 36BA12456C3AC5ED3A0BDF851A651E82
9: 0F9C9890152D6AD5EC, 06F3A96F40D794552CA799006E76AE7A
10: 7754241DCD040CC449EB, B576881B5E542A73717A6AC24E516079
11: BB536F70C1111BFAC4D149, DDC6043F2B5DF96418799DD13BD04726
12: 4B530B4F67376C4B7EC1CB29, 43A36C14092F19F168ADF0FD9F557424
13: 55D5D285DC88451148C7B2B143, 7C2CB43BD19808EB90F045E6D6EB70D0
14: B321948117659CB06E6B364D00A7, 1B30A37234E3A13A335EFE6A07B070DC
15: BDCCAC5E956953E6D5C43D9436D453, 98F924C659F4112B1D9DAFFF711FB2F6
16: E0A2F28186D79A9494700E5A30351542, C604F7F47C3F18F236DDB289D287BE91
17: 750D6EF87E1C9E1023920D3F355B2BEED8, 96FEEAC4DA36FD36129F67C3EADA75EF
18: E7F91687119D70793B9BB0114C7B588D32F0, A75052978F26EE6FE5D802BD4C06004D
19: 56D7420981DC556AE0137DB0F1BD1CEC0BC945, CC024D30F19EAA3CDF66E51246FC3225
20: F2D61A0E214472663F5F41C9D66EDEEC2F7C824A, 9706F273AF680AE2537D02BE41A2C980
21: 30F76A83CF8010DF0F49F73C06435E0C5D85EDC6E3, 1F18354A73BF506D229369836855EFD5
22: DB9688FB58EB83AF06A579CE56FBC75D93412790924C, C9DD5350751CFF0AB1A8910AC1898E08
23: CBD64BAB16852F40FB00D9FEEF5365C773CA14B77EF5E2, D6A02105B1BD018A5BCF47A69803248D
24: BDCE2AA8092D4790041750DC922F2D6AA12DB3F41A547C7E, 3DF09D758306DAE21C3AAAB3FC51623E
25: FDFF0AFA4D94CB3019AB27234259ED225B1B3B0F2BDC32CDD0, D64E69725D638D9F0F90C44C6BF51722
26: A9D2CC4F7FB98D54A78293C64C2A41CA19CC1F7B9970F3437AE9, BDFC6B10DD012BA057CCCD40AE14569B
27: 81FE813C4A6A47D34F146DD943092940ECEA77F85339A219B6134D, 5F44590AE8CDF89E13AE2BE4D32AB7DB
28: F618779FC6E6F5B7EE3FB4E937097E6A122B979E3DF837F72A8FA3B9, 00F0A3B4C67F68590AAA0BEF2D399D1F
29: 0A8AB66D218268C9181DB8C6EF542AA4B42E53E4623E3385723024CC3A, F28D7D86317D2F509561DD3392F3EF3C
30: 9CD50C94ED5391BED5C8CE2A07F8955744B275B6C5E5B6F453A5E6185C03, 048E889FF70729C55582003ED6169E0C
31: 1CFD6D8EF6F44265703544AFEB2BBA2A067BE8DAB412E071B66B70E357238A, 0A5BB055E00D42F4291CAB3813FC2946
32: 8E6E6433E4FF879155E0612F17EFC00AA8D5236EFAB5D9D6A912898F3124B588, EDF81BB73FF9288F315B988413432823
EAX-idea (16 byte key)
0: , 1EA089EEF0584537
1: 64, E2DAD93E481FF4CA
2: AF89, 1C59390B95864F2B
3: 967B36, 9B17DDF2DDE56ACF
4: 1466E27D, 3F4682ED320CCB0A
5: 2D36047872, 6A654C4B4D125951
6: C765097A4A83, 56C1A3EA50AD6EBF
7: 0D1D54E316B557, D400C71220491CD6
8: C0749FCDC4777FDB, 5A528132145ECBB4
9: 77FAF1DCA9F9D9743E, 9751D64F46B0E936
10: B1620900348AF0A28327, 23965D98E04157A0
11: 95DADF663B30F50719C15B, CD063ACF7A4E5AA0
12: D9E5D2558521BA6482D3A1DC, D823D92F16306198
13: 50AC1D9A7BB5C01F5795B569EB, 8EBE9364D8BA009F
14: C86F400959559607A228D47F2312, A89392C46483F839
15: 7F2F87C5A4DD93A73A1F83FE0D3066, 3B9CFCB7B4C90CAB
16: 22A2BC3531E9FBCAAEB678B419227CE4, A38C34F31BAFA2EA
EAX-serpent (16 byte key)
0: , 97A6952931A6CDA57BCC4716D30F82A1
1: 96, 7C2A3B5E78FD8E51D8EFA5B18704EABF
2: DA43, FC534F23581A3A767EA2EDF709B5AF64
3: 6712DB, 7DBB01EBC12F5DDEF4EA73AFB9333F87
4: 26AA0D44, 0811A8CBB5C44104BD9EFF485A847DB5
5: 3536F9E911, 1A28F0F4140C1EA11433897919C6865C
6: 6FE844A82588, 2AEB14AAEC834F069E4FF8EB58C84D53
7: 9845B4C2DE5C80, ADE2938A7195AA6F3D5311436DDA7AF9
8: BFCFFDBADE812BB1, 86379A0BD9D056C7B8DD13A7A344E0D2
9: AE58D2CEF3546BE633, 7D9AF596AAEB3E64B4DD6548C1EF7C5A
10: BE55A4240519306EC22E, 9D8932C3DAD8F64366F7280D1FF15B57
11: 7D22DF89DE40EDBB5A2CD0, 8D1A5E14933F430D171473E79AFAC748
12: 723E2E279953930DDBF6FB7E, 64F83827882916B8CAEDE297B7CE5E5B
13: 978AEFC3F017FBAEAA71F66E95, 14B825061B7268BD58D0386212CCB2B6
14: E81D5B4A5D124329B35E3542E637, F689AF556D208DBB524025A2AEBA3B54
15: 1DF96C551C75E13FCF077D25314779, 733E93DDC99CE73220336C75E0B0FF13
16: 631EC21D6892E8CD3BA4894AF357602E, 294DCD6EBC59FE575AFD89356E792C92
17: B5EBF5378580BE3BBC1507B2667189BE61, 84AF67D9154C9938660BF8B797878A05
18: B4FD794C8616540EC9BA129AF21A9F0BA768, D6C65005C772005488CAE0EBB75D6A43
19: E607A3F3612D084E187F4E5A1506CB85E5F456, B9AB2A96B877A5DB507F676A3E5820BC
20: 545E4AC37DFC52F7BD113DC2150BA08E3C865039, B1F3E0969DC54CB2A1BAACA190365FCF
21: 65A85C4ED7495E93FCF8EB77C71E6DB3AEB97849B1, 279646B82D6B10944A7FAFFBF62B726D
22: 13650C731A41A257274DA26139C6E1C0D4E0A9302A7F, 4F29AACBACB496E5C30715E4FD6700F4
23: ED9DBDF146A4C2F0FBB0ED17EE8D5155EA2D208A8E8CFA, 20F1E5754C15CA7EBAACBD8673C8BC09
24: 5BA09045237D8DD1D71C8E88611A61D24F16F5813D42ADCF, C5DFF900DC89989E30EC3466B1E807C9
25: 86BB29486407CA1E3D060D67136394FB7A1161F85028FDC632, F2376DA28876CC987434CE7311992FB4
26: 3BD15D58DBC6B050B4ACCC6278F912ECA2E4E3BD86B20041B62E, 6A4786A05D146DFAF8868C511CD63C6C
27: 6A4A427F65A0B6C95E6192FF8F53A4F2810D83015298AD6EBE9A8F, 97DA45CC64772B2041649AFB529C0469
28: 0167FC2B17965AB0D38592796D5CD41D3AC6C7D36EC97A92D4CD38E6, 297C86CCBDE5E7692AB5E4CBA9C7068D
29: 8FFA2B377A264C13DF09C80755543D0BEE76048DD10C405BFCF4318AD6, F64D9A18F677C48A2FE312D7D798C3AD
30: 2BEF6C54A7D57D5DEA5A7A39CD2B201D18F1CA1941F8F9AE9A78F28CE533, 7F64BF8DD0962AC93642564249698777
31: EFD3F06A589F09A08D00A70F2235D64E54ED7E213F4D39191586087AC20833, 9035327451DBC7F9E9A49FF83B704C97
32: 1DFDE8719F4FC7C235A1BB9862E1E6E132EC0C77EFEC71FD7E48C6B000C14291, 0CD8517E1B79FCA166F9D7CA1FB6336F
EAX-tea (16 byte key)
0: , F31507FD2F9DE170
1: 5E, 883F01F57C0A3752
2: 4656, DC2F8425AA00F7D4
3: 86DA0A, CC9CDE3472FA2840
4: 73375083, 276F06F48DA9CFD2
5: FCF867064C, 7DB9052193E77F3F
6: D2F367F6EFEB, AB05FE3267FF2C0F
7: DE33A9E128D6DE, 648884C97F036DB6
8: C5DEC03A2D1C32AB, 1835E8C6266BFA24
9: A09153B81B609A7FE2, EA1DAA9BE8F39403
10: AAA1741EE38A70A37B8B, 63B53E90B1D1B390
11: 829932D95C1E7F343703FF, 6CAFE57B55A67598
12: A04008ECEF2762153B06DE85, 5B4FADA65B67BE59
13: A0881EA826A8072E45ABB7AE4C, 426BC1450AAFEF4F
14: A25B5A049A3DE803C09C6208DB91, 1C12BE6131CDFFA5
15: 457B9E88FD12B1D508D545A5EF74C2, 7A03467F15043DBF
16: BFF0EF485331FAC285BE3B9DFEA372CE, FE06E955E5EE5930
EAX-aria (16 byte key)
0: , F185A77011AE5FF024BE604518A1EAFF
1: 4F, 5A4D972501DB2B9D9A2AA17FFA517B36
2: 1449, 2DDBD36696DDACD6799F3E1BECCD48EB
3: B649C4, FA5D60EEE2F5C0AD5179523742E87B1C
4: 91C1FDCD, D283F0C8DFE4A97A52914A02F7E35B33
5: 0D15000B03, 4268C8904D50BF94BBEAC6BDA6EC1CCE
6: 900A3FD2538D, FE52AA79D98E9A43F9D1F9E29A331809
7: 839ECAD087A1B6, 742062F8759A6DC74D58C8C61F862B56
8: FB302E87C1B96FCB, 5B79570CD6AC1A1EBFA376C4798095AD
9: 5FF3A012C633B4CC6A, 7C054B1C6EE751885630B2A92FAF6BE9
10: 87A3A7283E9B40C141CD, 00912C6719BA32CE8269C1008144DF31
11: AB9CB957617E783B2B02F6, 07B4C5BB517551897F32FF55ACA053CD
12: 2957DECEE9C214F6DE046479, 19451013D0C44F97EE1078E83B8D611B
13: 322D7DCAF0E8F41065EA9FD797, B715D9BC1BFEFFAAC7C2891A25047668
14: 318FD07CAEC7D0D1223EA2ECF242, 4E94AB2B44E9B63C6AF0ACC68676A110
15: 8C9E0AF8A5120D8A86775D50CE06A4, 3C5C9579C468CA971835F7CD580EC9E8
16: ED1C246F9C3FBA08830A87E757F908EA, 3EA59A00880A61FB18971E3D78A4F426
17: 97F0DDAA0CFF8F1361823CAFC1D0CC0063, 9C11F8332CCF5D317341E052B628B6B5
18: 96CD5793C6A3816A7986316F1642E0748FD1, 4F4D3581476BE7D5316D6DAB4A7C7B0B
19: 586564B8AAF406D003223E93935F8D0011D27B, 25684388BBD30917774669B445428102
20: 638EB00875761A0F4CF276D200D8F2F2BCB75AEC, B8061E7B837698EF855528AE6D899103
21: C9E438B63857D7FDFA858889FE4A755BB000348159, 482A9551C6A40BC4F88A9689BFDAE457
22: A905C47F063FA0BFE5794F56C71D4E1A34B9006F9C39, 446FE158D13D9866EDFBE051BEF2F994
23: DB118B2A3C8BF87085269CC3F0874C20F075B1D7E49BB9, D0A5126BD8BB4B1EEAA4EA250FA2D1B4
24: 6E3969111903437FD3A666B30F24782C21340180331441AE, 754A5F33307702AC9BA5455864130FA8
25: D625A2045CA6557ACAF4D68A8D77E09458263D7EF053AA85F2, AB2512561CE643A27CB8783E845A48AD
26: 56AAF078D444A78566B5032D725D252BD62499DE196BEAB9CBEB, E5DC34D84457B1E6ED6C94D5B317C280
27: C45902F58AAE867AEA2A04AA440AFA61803D08D59FFA15640EEB41, B1D00ED9B3F2471FC643E74FCEC1CF31
28: 64F13A8599F9297BC84686FA0033F20827AF27C55186495F66BFE25D, 6A3BB6A711CBBF0BA8AFA355A53A355F
29: 376A701BF469B9CF2C52BCAF9FEDD93C4258EBC4368926D2462F177160, F2246D580085A981373B9C07A57CBD6E
30: 2A90205AA92CDC87893A31A2DE1B4A334C62A3646CB218137F970AC602BA, C50403F076F38EFAF68BB2D4872035A3
31: 9989A35D07A20179A5BDCA2ECBC09F16593B1CB0B6BC66CD10755B44EEF3CF, F59F46552C0350941809788D067F1B5C
32: 0564682D16FE78CC5A93438E1662B2852A530F86B3DEF1D424B6A44FE04E4D67, DE7265B9740611937190B77EFCA574F7

File diff suppressed because it is too large Load diff

249
notes/etc/NoekeonVects.java Normal file
View file

@ -0,0 +1,249 @@
/*
NoekeonVects.java - Generate Noekeon test vectors using BouncyCastle.
Written in 2011 by Patrick Pelletier <code@funwithsoftware.org>
To the extent possible under law, the author(s) have dedicated all
copyright and related and neighboring rights to this software to
the public domain worldwide. This software is distributed without
any warranty.
This file is dedicated to the public domain with the CC0 Public Domain
Dedication: http://creativecommons.org/publicdomain/zero/1.0/legalcode.txt
You may also consider this file to be covered by the WTFPL, as contained
in the LibTomCrypt LICENSE file, if that makes you happier for some reason.
----------------------------------------------------------------------
This program was inspired by the comment in Botan 1.10.1's
doc/examples/eax_test.cpp:
// Noekeon: unknown cause, though LTC's lone test vector does not
// match Botan
So, I investigated the discrepancy by comparing them with a third
implementation, BouncyCastle: http://www.bouncycastle.org/java.html
I determined that there are two reasons why LibTomCrypt's Noekeon does
not match Botan:
1) Botan uses "indirect Noekeon" (with a key schedule), while
LibTomCrypt and BouncyCastle both use "direct Noekeon" (without
a key schedule). See slide 14 of
http://gro.noekeon.org/Noekeon-slides.pdf
2) However, LibTomCrypt's direct Noekeon still does not match
BouncyCastle's direct Noekeon. This is because of a bug in
LibTomCrypt's PI1 and PI2 functions:
https://github.com/libtom/libtomcrypt/issues/5
This program uses BouncyCastle to produce test vectors which are
suitable for Botan (by explicitly scheduling the key, thus
building indirect Noekeon out of BouncyCastle's direct Noekeon),
and also produces test vectors which would be suitable for
LibTomCrypt (direct Noekeon) once its PI1 and PI2 functions are
fixed to match the Noekeon specification.
Although this program uses a PRNG from BouncyCastle to generate
data for the test vectors, it uses a fixed seed and thus will
produce the same output every time it is run.
*/
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Locale;
import org.bouncycastle.crypto.digests.RIPEMD128Digest;
import org.bouncycastle.crypto.engines.NoekeonEngine;
import org.bouncycastle.crypto.modes.EAXBlockCipher;
import org.bouncycastle.crypto.params.AEADParameters;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.prng.DigestRandomGenerator;
import org.bouncycastle.util.encoders.HexEncoder;
public class NoekeonVects
{
private final DigestRandomGenerator r =
new DigestRandomGenerator(new RIPEMD128Digest());
private final HexEncoder h = new HexEncoder();
private final NoekeonEngine noekeon = new NoekeonEngine();
private final KeyParameter null_key = new KeyParameter(new byte[16]);
private final boolean schedule_key;
private final boolean botan_format;
private byte[] randomBytes(int n)
{
byte[] b = new byte[n];
r.nextBytes(b);
return b;
}
private void hexOut(byte[] b) throws IOException
{
// HexEncoder uses lowercase, and Botan's test vectors must
// be in uppercase, so...
ByteArrayOutputStream os = new ByteArrayOutputStream();
h.encode(b, 0, b.length, os);
String s = os.toString("US-ASCII");
System.out.print(s.toUpperCase(Locale.US));
}
private void printCArray(byte[] a) throws IOException
{
byte[] b = new byte[1];
for (int i = 0; i < a.length; i++)
{
if (i > 0)
System.out.print(", ");
System.out.print("0x");
b[0] = a[i];
hexOut(b);
}
}
private void printVector(byte[] key, byte[] plaintext, byte[] ciphertext)
throws IOException
{
if (botan_format)
{
hexOut(plaintext);
System.out.print(":");
hexOut(ciphertext);
System.out.println(":\\");
hexOut(key);
System.out.println();
}
else
{
System.out.println(" {");
System.out.println(" 16,");
System.out.print(" { ");
printCArray (key);
System.out.println(" },");
System.out.print(" { ");
printCArray (plaintext);
System.out.println(" },");
System.out.print(" { ");
printCArray (ciphertext);
System.out.println(" }");
System.out.println(" },");
}
}
private KeyParameter maybe_schedule_key(byte[] key)
{
if (schedule_key)
{
noekeon.init(true, null_key);
byte[] scheduled = new byte[16];
noekeon.processBlock(key, 0, scheduled, 0);
return new KeyParameter(scheduled);
}
else
return new KeyParameter(key);
}
private byte[] encrypt(byte[] plaintext, byte[] key)
{
KeyParameter kp = maybe_schedule_key(key);
noekeon.init(true, kp);
byte[] ciphertext = new byte[16];
noekeon.processBlock(plaintext, 0, ciphertext, 0);
return ciphertext;
}
public NoekeonVects(long seed, boolean schedule_key, boolean botan_format)
{
this.schedule_key = schedule_key;
this.botan_format = botan_format;
r.addSeedMaterial(seed);
}
public void ecb_vectors() throws IOException
{
for (int i = 0; i < 8; i++)
{
byte[] key = randomBytes(16);
byte[] plaintext = randomBytes(16);
byte[] ciphertext = encrypt(plaintext, key);
printVector(key, plaintext, ciphertext);
}
}
public void eax_vectors() throws Exception
{
System.out.println("EAX-noekeon (16 byte key)");
EAXBlockCipher eax = new EAXBlockCipher(new NoekeonEngine());
byte[] output = new byte[48];
byte[] tag = new byte[16];
for (int j = 0; j < 16; j++)
tag[j] = (byte) j;
for (int i = 0; i <= 32; i++)
{
byte[] header_nonce_plaintext = new byte[i];
for (int j = 0; j < i; j++)
header_nonce_plaintext[j] = (byte) j;
AEADParameters params =
new AEADParameters(maybe_schedule_key(tag),
128,
header_nonce_plaintext,
header_nonce_plaintext);
eax.init(true, params);
int off = eax.processBytes(header_nonce_plaintext, 0, i,
output, 0);
off += eax.doFinal(output, off);
if (off != i + 16)
throw new RuntimeException("didn't expect that");
byte[] ciphertext = new byte[i];
for (int j = 0; j < i; j++)
ciphertext[j] = output[j];
for (int j = 0; j < 16; j++)
tag[j] = output[i + j];
System.out.print(i < 10 ? " " : " ");
System.out.print(i);
System.out.print(": ");
hexOut(ciphertext);
System.out.print(", ");
hexOut(tag);
System.out.println();
}
}
public static void main(String[] argv) throws Exception
{
NoekeonVects bot = new NoekeonVects(0xdefacedbadfacadeL, true, true);
NoekeonVects tom = new NoekeonVects(0xdefacedbadfacadeL, false, false);
System.out.println("# ECB vectors for indirect Noekeon, in Botan's");
System.out.println("# test vector format, suitable for insertion");
System.out.println("# into Botan's file checks/validate.dat");
System.out.println("# Block cipher format is plaintext:ciphertext:key");
bot.ecb_vectors();
System.out.println();
System.out.println("/* ECB vectors for direct Noekeon, as C arrays");
System.out.println(" * suitable for insertion into LibTomCrypt's");
System.out.println(" * noekeon_test() in src/ciphers/noekeon.c,");
System.out.println(" * once LTC's PI1/PI2 bug is fixed. */");
tom.ecb_vectors();
System.out.println();
System.out.println("# EAX vectors for indirect Noekeon, in the format");
System.out.println("# generated by LTC's demos/tv_gen.c and consumed");
System.out.println("# by Botan's doc/examples/eax_test.cpp, suitable");
System.out.println("# for insertion in Botan's doc/examples/eax.vec");
bot.eax_vectors();
System.out.println();
System.out.println("# EAX vectors for direct Noekeon, in the format");
System.out.println("# generated by LTC's demos/tv_gen.c and consumed");
System.out.println("# by Botan's doc/examples/eax_test.cpp, which");
System.out.println("# should match LTC's notes/eax_tv.txt, once");
System.out.println("# LTC's PI1/PI2 bug is fixed.");
tom.eax_vectors();
System.out.flush();
}
}

View file

@ -1,4 +1,4 @@
/* emits an optimized version of SAFER+ ... only does encrypt so far... */
/* emits an optimized version of LTC_SAFER+ ... only does encrypt so far... */
#include <stdio.h>
#include <string.h>
@ -170,8 +170,3 @@ printf(" }\n}\n\n");
return 0;
}
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View file

@ -87,9 +87,3 @@ int main(void)
return 0;
}
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View file

@ -12,8 +12,3 @@ int main(void)
}
}
}
/* $Source$ */
/* $Revision$ */
/* $Date$ */

View file

@ -3,212 +3,376 @@ are of the form ciphertext,tag for a given NN. The key for step N>1 is the tag
step repeated sufficiently. The nonce is fixed throughout at 13 bytes 000102...
GCM-aes (16 byte key)
0: , C6A13B37878F5B826F4F8162A1C8D879
1: F1, 397F649A20F3F89A00F45BF230F26B61
2: D6B8, 1653F67C9C716D0FC59F3B14154DECBF
3: 673456, E82EFC79B30CA5235E2DC8BE4C14265D
4: 26DD7C26, B8D1F4DB845F7D7079DEB8920949C14D
5: DA62AD1487, 828A42329320764E5FB74D44A6108F4B
6: FB79F7D51742, 865415BD049E86F3DA2E0B6E25E1A50C
7: 9D96D1034166BF, 50669247A5B338E183DE5139831CD6A4
8: B466050E1330B20A, CB264FA7853A1FFE86E1A07CFA7C7319
9: CF16F0B3D9FC6183DF, 647DD6E1F40F385E1DFE6676FB036242
10: 14D90928C7236050096F, 930CAAA5536406218885475CA823A973
11: 4F2322D66A7079BD7DF519, 3B3931D47413042FAF1313F1041509A3
12: F1497906F1D8F4F9E47E4BE9, 469FB0D62828427C2E9BA04041A1424F
13: 2FAFA2A3EEA4C000702E58D1D4, C9A484FC4ED8644A06060DAE2C3D1568
14: 5D707F8ACF319413D220AA2FC2B2, 0EE9AAF5B1CF622ECF6C4F5E5FF4656A
15: 2C19DBF966D24B2713F82B69934060, 8676246A2F7795ABD435B3C6B4EA6E7A
16: B3FED6C2315CE6D98729DBE69270A11E, B8AC739AD154744A33E906C34D91BD4B
17: B2BC44CE088BC3F654B9703D9C691F17B3, BAD8314A171BC0119942136C5876AACC
18: C6E958E3E9AC836C9626BD66478974D26B0C, 4E6D61833E9DB839117B665A96DC686C
19: D40FADD078B474EBCE130FB44DDB4824077988, F43E3CD978A6E328AF039CC70E291E1C
20: E177B3DF83A117E55F255A6C2CD78AFDAFDA307F, EEF1ABAAB9CBE0EE317CC79E7E5E24B8
21: DBB4569B3E305E4525F1F7B3D2AFEF226F397E661D, 65ACFB70132EEE1D47319A550A506DB5
22: AC2CAF77718DE59131A6B745DE9F3A9897B17580EC71, D8DB9006A9597F640F2594340D69E551
23: 8F62022F72A0D769D2D095A55E28832950870B2B44B0BE, A7E196F869071B7BB713E8A2D15627E9
24: 37F5640F820384B35F13F8C8C7DC31BDE1E4F29DCFBDA321, D5765C39DBCA72AC89100CCB8864E1DB
25: 25059BFC302D0F8DD41BB22CF2391D456630C06F1DAF4DFA86, DC2FFD153C788C28D251B78AB8B7388C
26: 151F158CC4BA9393FDB153C4C72911C120BAB519FAF64719133D, C61915006038BF15DED603832FD179DE
27: F5DCF4231482F72D02F8B9BE0A41113D35AEA1CD85021CEC978D9C, 9CBD02C557180FBD0868C87A0BEA25AE
28: 5D88B5554A2ED73054226473676FAA7159CE12B5357D635DDED35B5A, 5AD11CD6B14C59E64B5B26DFBD00FB5C
29: 5696C7066EA09A30FC8BCBAD96D48A5E5FBCC8756B770F0A89B8711911, B9EA5F3BEF0599D385A9ACEBE4064498
30: 1240FED47B305AC1883F8CF137D58E79052B4E686DCA1423A6A2BECBD5F5, 036A5EA5F4F2D0BF397E8896EB7AB03D
31: AD9517BF392C1EB56D78EDE1C41F3C73B72304DA47F400C390C86B37A50C2A, EB3E026D518EED47F6C927525746AC54
32: 2AE1CEED83C6490A7E5752E91532406EAC6FF4B11AA770EFFF1B255FDB77C528, 74BFBC7F120B58FA2B5E988A41EAF7AC
1: 3A, 03C32E0E9D7E07A410B9BEE40A8F0D26
2: 26AE, 3A635BBDC1A17CA40B58CEEA78105CDC
3: 142FAC, 7E8922E8FA6F1E41E4339F0B52176DE4
4: 20C1863F, A1D12620C22EA7A0AA0E74667A20B8E1
5: B3B796AA54, 53F0F9F03791BBD76BC99D1B5639F3C0
6: FDCFF8EA82D8, B56076B42E3EEAC73DD42FC83B9220F9
7: 4695E719E67849, B4A1A2E29AAD713D5677CF425E65A400
8: EE5BA3309D417697, 146EA95CED151F8C40DF98C1CC54930B
9: 13FF05ABB084FA608F, 55550AADC3461CC190CA22F29C6246CD
10: 008B0102208A22D3A562, 7178534BC7145754BAE525CC06E14A6B
11: 3536DBBB07B026E78E94C8, AB27183AEA2240B0166D702EEB2A7BFA
12: 00739D5A27AE82AC7D6A40EC, 4354578C3D241074D3C1F6496420F239
13: DA41A5F458400C94B84026C052, DC6CB036FCAE9765A69F5B8C38B0B767
14: 4C99797C7EDCEA9D5425565522E2, 3FFEEC557F0D5FA73472D2A3F8E71389
15: D381E7AD2E5BE2C97FB4BD958BC2EB, 6BF713D4E7DA7C4290967A1D23F97EDD
16: 5016C127F16A4787734AF3A3E6F6F0F7, 8CD8458531E94BC8160E2176F63F8D0B
17: BDF3D0F24D9415AB5CF9B87BB45B4A8AE4, D81A3D56451313742ACE53D41223F6AF
18: 68C1FCBE22FBDB296C246F2E34D871A6902E, 7AFD64D4EB0DE7E2A842B518AC6D483F
19: 7D8D3C31E643611B0B557F29B437F635FE3FD0, 8501B61DBF4A4DD19B87E95055B95962
20: 4185EEB0B9B480F69B3EC7A162810073A36AD95A, B9BCA6D9CA0AC2B4B35D7BFF4DB27D25
21: F991F4A481E322FEEC6FE9302D010AC4C811B23B4A, 54FA4DDA92E57509F4D48D206A03624F
22: B288424FF96596B2A30A1EB9480F5EADC2F6D8551B9A, 2C998C8DFDC7663C8DE677B2F1CBCB57
23: 1066FE3DCB9F8AE0DC0693F7179F111E0A7A1FFE944FF4, 65402D1F8AFBDC819D6D1ADB5375AFD0
24: 0A8772CCDE122EFF01D7C187C77F07BDA50997B4320CD0D8, F55823AFC3D9FE6E749E70E82C823925
25: E6E2FBB3E2238BC8CB396F463C2F488B4B4933087728D39815, F06DA35A9AEE65F9AD0DAD5B99AB4DF6
26: 569BD39CB1693CB89B88923ABE0D8CFA0B4F22A48A15E2EACD4A, 661AF51FF0E0E363406AB278BFC9176D
27: 199EED81C2428170EB089060FF9676596EADD2270895A0C8650903, 90AA9C634469D45E7BDD9AB955B90130
28: B5200497A0654009B9F5B0D45FFDCF192F3042D6B05C6D6A8191A7EA, 71F6C4982AA50705D5FFC60512FC674C
29: E39DA262C0E851B5CB5BD55A8B19D0AC0ABDC6FF3F32DF3B1896242D9E, B58AA05F594FC9779E185353CC52B8FB
30: AF349B91BAD4BE2F2D5E4DDE28A1AA74115A9059A5EBBF9E38F341DC368B, 966B04FE43A2A9D94004E756F7DBFEFA
31: 8C87861DFFDE72FA64E926BF741330F64E2B30837650F309A3F979AE43BA2E, A5C825AE1B844D6A8D531077C881BD36
32: 924E178A17FA1CA0E7486F0404123B91DBF797BB9DBDE9B1D48D5C7F53165912, 10F972B6F9E0A3C1CF9CCF56543DCA79
GCM-rc6 (16 byte key)
0: , D595FEDAB06C62D8C5290E76ED84601D
1: 4D, 47A6EDEF8286F9C144B7B51C9BCCCACF
2: 0085, 9788DDF89843EC51120B132EB0D0F833
3: 463701, 673CB8D248E6BECD5A6A7B0B08465EF6
4: F5B3222C, 1C424282D7FB427E55285E20FC2ABFF9
5: 3A4A8361B2, BD40E631B054F280C7973E5AB3F06B42
6: A475866BF2C5, 2067F42FAAA6274270CF9E65D833FDED
7: 689D0D407172C8, 3BCCFFC64E56D5B753352E1DDD5CCAA3
8: D9CE4B051202A1D3, 79B0CCDA3D0B9C9BCF640BC9E6D9CE0D
9: 0317D68BE098D276B7, AF35043DB6213DC5D4F3DFB8E29EE537
10: 154CEF0C6F37AA0A73C4, 61E598A8C6D17B639F9E27AF55DD00F3
11: C3DB1B2B6CCC9170B9C05F, 966871DDD6E110711FB9DD733B6B2B3A
12: E4F22383C75BC0FB0E59C5E8, 971536AF878F4EED68F59046C928EAC8
13: 2FBFB99AABC6209FB8664916DD, 68D0BF2144AD1ADECC4074DAE58540C2
14: 5FEEDFD09BF89719A34CDCCD2AAA, 64DEB7D5E6891103AA54C0EB366715D0
15: E063A076E0C770FB010D26C3AC3EB5, 0CA321B2A7448FEEF84D4E0AD5BA2DA4
16: AFB0DB9959F0906BD346C2D81DC5412C, 425627895E2C4C9546D3227975585459
17: 79179C0D4D6C5E0741DD4CA1E8CF28C75C, D0188A344A1CEE52272FE6368DB0FB75
18: 8A75521139B0DE3C08C9EAEB77D8018A39FE, 47FCC200D8A384320D2F1A5E803A9991
19: 0399381D0A975AE3980A9FB75B991C055AF367, 034915370AF94B96A8A4E50FF9B134CC
20: 8C189094DB13FBE62EA5C4A53C29A428ED587BA2, 99C58F838423033298897841ED526347
21: D91F5144B525AF5D47EF4D5F0AF9915447A55927F9, F6750BF7E089515D35B47BC1C65E2E3A
22: A4E26B554AA277057A5FE3FA08A6138CEEC6D69BB1D8, 7BBEBF52D8251108C7AA1025E213EC44
23: 5C1A8C3A46FCA90D73675706313CADFBB90A535A4B3D5A, E35244A2633478BBDAFCC81161F28B80
24: D69F7264FC594057B89181B83582D799AE54E9EE4FE8AD48, D4B29E5C25F9477D9345526DBDE9372A
25: AFD322D0AC4AF38D5B9CBE0DFE85618C001A7A77CD8FFFCB3E, AD06BB9C59D23D258D6A2AEDD946AA20
26: 179CA8395CD8E75B4E5EA07D25C8036AF08B1A1C330492523D36, E3704C4341A834C087500E332B7DEAE9
27: B9178EF7774684F43F1FCE99A4319B5A4D167B0A848551F562CD7C, 5D5082FB02B9B494D5883DF49DB3B84B
28: 830FCD15A09EC61245D7DA258E308E76D3B542F2345DBFC11AE983A3, F50C3332F8D91911BDACCFE228565E5C
29: 179619B8C7EE9B3121405BBED2AC102A027E6C97EAEDB5ECFEB13792EF, 859EBA3BADCE6E5AB271A261B26DE28C
30: 14264C7E0A154119BF24B7FCF434E81440D42D54738F0BAE55836849AB85, 0B6C9B9CADB1B6EC71CEA090C8C72834
31: 0D7A316F8B873F62CF26CFC569179AB11CBF09D3467936A85ADC265B2C9A8F, 866AE7C51EC2D9DEB32748A1C8B61143
32: F8FD1F967CD3632805AD7FA8ECB40F530927DD5C49D31FDBAE49738E2315905D, 9CB1CB84A727C9F42555EB566E0A1DEE
1: 16, 2CA928694EA91AF92B3ADB402FBBCDEE
2: CD9D, 4A9940BD7148F08AE75A4F238148C174
3: 6D1332, 5CD73043FD797D1375AA011D2E36896A
4: ADC34199, FF5D2B40B02CB58BC63AA6D1CFBA811B
5: 83158D52A1, CB8C45A56D7539CBACBB85DFB4C1F52E
6: 66E32F053C17, 3EB9AC9A066DC66DB4973B5C78C6EC0B
7: F23224FEB14897, 0ED4890D034F20A9A78ACA7492AE9341
8: 3FF9570F77486C86, B82C19DE2C5CA6CAAC223F337173F840
9: 44B4F4130619FD516C, 6689DC410118E0DC2D90ADCD6327049B
10: 6E205B2537935E50A1E3, CE5739FDFC13D279075508786388C08D
11: DB836471D91F2FFC6A199E, 1518E9A6CD2190D32A9EA1AC0849DF09
12: B9936A58667AABD9BB9B2ADA, 388894E75CEF512CD5E3986DFB2CA589
13: 1B5072C8FC0EA19A0486C0E04C, A804D99E2414A314440E5F4B8BDCFB45
14: 614903F301B1E7C092E9A32C195C, B4F7406533C58AC54869F09C4B0801CE
15: F30ADEF328878D174B1AEAF5D7137D, 7C5BB92772540C1E2209B77C78AAB092
16: 776D20B980DDC7C48ACE4225F59E2736, 85DAEE9785EB1BA9C99FFAA5AE565159
17: 6BBA225325564369BB5F11EF5734604938, E41E0E3C31F4B1770AB93750A386286C
18: 6EAAF9EF0C149A13BA535A2AFC398281017D, 10CBB6A874711DE179D8A4EEDC4DE085
19: 9D0B62274F7E5426F5AD9515DAAF4742C291D9, A35D18485F881CB0BBB00A9421C9694C
20: E6A18F640923DBB22FCBCEB0ACD1A2BC94256212, CFCFC7E7E5C64090DF746F8C36F605D4
21: E37EB92C38B47C6E2621C2CC64D83CCCA9104C2095, D88C0FBF2402FBA40EB525118FC2CAC8
22: 0E690F9D73E7E689AF48FE5B99E58AC42F3702EA40FD, 33D698F9C44FEB68C1C442B30DD36B9E
23: DA759D58629FA946FB635538C1AED318890C4D84EB6610, D7BC6A69DA658EE3DB842C01B9085A07
24: 581F86B5A844FD709B13E09A7CF64ADEA84EFC2D7AD9300A, 0296F58775CE4D4E92C4DD0CF65CF8D7
25: 78B346A03098BD6EBE0BF56F5C37C83B3C42288D0E031E0D4B, 2F89EDA70B8A31EE64B264C7C5165AF1
26: ED768B0F18A13ACF40738FD61642C0CFBCF746D60887A8C5FDD9, 56EE211AB10B37D61FD80692A76615B0
27: FCC298575C9F4E1DD2C8B0482F9FFF42EFFE565ED5FB178DC56947, 0EBA843B28F91798D79E2105995EF662
28: 4341133DA062A885DA6D7BF4387C6F28829E65EA7DB7E50B15F2D03F, DAEFA9D1230FE3084FDB91AC7ED35503
29: 777C13A7FC16345BF949508CBC1051540928CB5B9B36569488109FB60E, C8DEE566513233B8E74ACB1046FE87B4
30: 6342B6FEDC0B8868AAB5E870CE1B2E420269CB11DBA74F10C5E978F2B44D, B2B001639A2A0BA045023817947573E4
31: 99A123D836EF76A4250A960DF7DCFA231C3595EAB53024F53B961EF80901ED, 02E8820F6D31A23DC9F0DCE511A1F8FF
32: BF57034D1EA94A6DB86642918EDBC9CC7D6C39025F9EC528EAA2A9EE7B22EAA1, 7801231ADBA83C137D760AA75FF2C9E6
GCM-safer+ (16 byte key)
0: , F769B436C7FB7C0C822E24BB2B2555D3
1: CA, B156298625F5634FA012B23044437807
2: 4960, A64C73E890F3D77B2C3B3C76C2D913C6
3: DBBB8D, 686651A017F89A22F9FE96533C85C52C
4: 150AD99A, 177F7DE9E897DACCAB7EACEE3CDE7601
5: 077055065F, 48B4309C76CAC37BDF11842311BA6CD3
6: B2F8CE062C06, ED04DF96C06959524956E8AC5C338457
7: DCE718211410D8, 3F8D8180BDEAC2F018EA81615177CC8F
8: 0F71E2772402AC83, 2130481B2CA7B4B4C8F3EE73B3B3C28F
9: B69030734E5ADF753C, 8CC4B62BFBC3EA56CCDBF0ED318C784D
10: 6B8A91ABC1BF2F2D0176, 86EAAD80D148A48086987A40A5631DEF
11: 44AD00799EC8E62E34D6A1, 016830D58F06F75E54531B45D9E785F9
12: 0C4B9381D78E0F0A78B3CEAA, 4A79C58DAB131A22F172F9177DC4158B
13: 2C56D4625876524B4D8D5F079B, 7B407F704225B25F1F136C984E564147
14: 36424D69BACC56407D345B3D7B4D, EB126C255A2DCFD32F69DD5CB61876C7
15: FDD3E091C0420D1A4D4A848757FCC2, D319C5C07134D67BA42A4BF312CD874D
16: EFAF6F117EA9A4B4B83052BBF5A07DB9, BB09D473FE82257146E7ABC2EFF6F631
17: 19B71383C414BAC3EF252FFF09F5ACD777, 526DC9AE6895ED33A34A9A4ADB07E1B6
18: 9AB6DFDB930D26E00B3D98DD5AD014E08756, D70B95B20C106A5A03F9B803D2CAC3A0
19: EEB3C236C3031DE4C3F94BD746677AE84B271D, 9483BBCBBFDBA1CC5F6392DABA2ACC19
20: 3A0EBC7536F8717E8FDAFEDAC39E8F1F43C0627A, 3DA7DC2475466CEDF01EB543870A74FA
21: 79D28D2F149E1D97E910342DF383FCEECF5AFD4C6A, 2364F33BCF6F07E381F7E26DAF802D83
22: F1D7C319BAFB740332CA19AB0C9B71728D3AE69BFAC2, 3D4AEE9780A5C98CBC69606CDDDB31F8
23: 1A0D80381A186673FB7B52C40AB6C46A11AB0889333C20, AF5C17E3D0D9724EDC1FC438A16B4EBB
24: 5E503440B22DD6AE6401BA4355C8791BACC598C9E0F1412E, 156D8221BD61F5C108FC18FB2F50D159
25: 7784EFDC6F0FC56FCADAFF17BB52DEB35B64FA19C3F391BDFD, A291E8238EF158A2379692077F70E8D0
26: 184B6E18032D1A70CE5027912E447C357C72EEF7B20EF0FB256C, 0FA0138FB9480E0C4C237BF5D6099777
27: 7AC8FCB64F35B71C5ED0CCD776B1FF76CE352EB57244085ED34FE8, D995B3C1350CC777878108640C1CADAE
28: 86C7A01FB2262A8E37FF38CC99BF3EFAEB8B36166D24913BDD3B91DA, 25EC6D9F69168C5FA32C39631B606B55
29: 91F5D3E3FE0B1976E2915B8DA3E785F4D55768FD727AEF19FA1552F506, AF902DED55E386F0FC4210C97DB9446E
30: 7ABF5BD9CB2EFF8382C6D2B28C1B0B25540E434123AC252046BDDA74DA32, 713259EDDA9B1B63EB68E0283D0259DB
31: 5634B23ACEF2874BE0591BE3268C4538698FF2D93D59B39BC86D0137DACBAD, C4054796AFD335B43C60E7E634122BAF
32: F26C68C36B1E56449595EA4E162391E0C6A306592949F69797B6C2327E533ADB, 7B392AF776A94983078814B6B8428BFE
1: 0F, 62E723CCA67DFC49C1915AD3C69FDFF7
2: 87A7, A73B3D416AD68235C662E9684430FAA0
3: 40FF80, 8EC11FFA3B777664FC6D2AD37AED3765
4: ED5B1716, 1A4FD3FDC9D197866FA8AA1403E3219F
5: 033CF349B9, CA1E6111A5BF539931490D2EFDA7575C
6: 23E30716B131, 79FB546DE6C534A18BBA604E8E2BE8D0
7: DE67DCF5635B0D, 463989CCB9A972468B870C403AB840D8
8: AFB5BCFD6E36E41F, FD3A63618F1D31A8A71D94FE91F41501
9: DBA0EB7B664D303BE5, 2860B5516CF0CE20E35BF766A4375EAF
10: 2826E6EDCFD7E9FB938C, 685E8B032254DFF65DAC8A44C3819E08
11: B70FC9EE54123F45A4E67D, 8661E54524A0F12612E000876E8E6F15
12: 5FC3C79807594E403B82B9DB, 9D88DACCB8654708B241A505AB12FD47
13: 2C7AC463E62BBC014E1A48E15C, B4FB110193F147E4A59EC38983528047
14: 046D692C6B2827453F7BA3EFB609, C4E46E0D5F71D2D477D7CD12B7447713
15: CD693A49640E00134FE33C9E324122, F43001B425E37C094BCCBAC49A6471C8
16: 9FC2042EF22E0F8A767DB0C52109E4F5, F60730D914AA02A3BCED7F737640B9FC
17: F09ECC9AA4FE3596C00D0AF4E052E60755, 199B8C9CEED9B4E70526BFE603FD5E45
18: 0C8BD929E87A21A9F043E47CE79950EA0E75, EC9D38AB193FEC16EC470A15E27FB367
19: F621E43B7FB21D98544817FB229C2F308361D4, B6BDD4053C4DFBD3970A5055E4A7719A
20: 63F1D36ACEDADC63627CD438B379C48D648126A8, B1A7217302F84CF5F6A259F2881484B6
21: 60BAE96D5E0F248A257CB3A7788D6107CFB525D20C, FE60C3B3E2029869EA063BA3B981AB96
22: 01213496633A4525B2C7CAABDCFEB84193A8AE2D8059, 738E7956DA8464FF655CE4F5B0A005C9
23: F6822F3C87B238F6F7E44307C416B6366C18B26B2357C1, A27A98EA0AAFD1D3010DAF4070F52E7A
24: 32B49BE196CC3825B7B6E0DEBD90680B996C3AA161BB52ED, 8505573CC5191577BD992A004F255953
25: 38361B85808140127A44B364046A5E1FB0B86885D5030110D3, 17DF461782D45807A7709EB2BCFAABE1
26: DBEF6C2067BAFF378A285EBF685F559A896B76A517292B4301F0, B6061185764BA316CC0163925F27A1A7
27: 15E2A0634520C0CF4C189436D35DE01CF5C83F0684CBC261A59AC5, DCD96E1687F24676838B60E873D47087
28: F837ACBF63898720B0527477B59A8EA74751DABCF2CC48C768AB421E, 72DD76EADF13C65E6F322E110F9944FD
29: FDA50738B60251E5FF1C38AF0A8E3F619D247C24A20D63B372571AD6D7, F1F1B212BD7E973BA17BDABDF27F5AC3
30: 0CDDC7A10CA3F3616E923A751EB638CF1E67CC2D17A03538C6A2BEB8555F, 7DB533FD15E48FFB217B18E91B7B2928
31: BE0C9A148FC3344025C8BD35AC883B584AC706F540BE1100A92DB67EF900B9, FD172B0942DDC1EA076D46BA46B9F7AC
32: F8256E9A41BC6E09084274A91229DC877257C433E3E43F05FDDBC3584B6093D4, 5CD834DDE7406085CADD5BEE122AF052
GCM-twofish (16 byte key)
0: , 6275E8CA35B36C108AD6D5F84F0CC5A3
1: 38, A714210792F9ED12A28F25CAE3B3BC5E
2: 8E2F, 6357C1F125723F2244DAF344CDFCD47B
3: 900A4C, ED4E0B318346D5B9B646441E946204E9
4: 087EAFF8, B871ED95C873F1EFA24EF8B6915F447D
5: 63FC9EFBD4, 650D0ED98CBECA07040AB97B97129360
6: B6081E94AA19, 6A3BDA8030C5A79B6B9087555A1DA67B
7: E10A7B9CBB20C2, 59EB55DFD0A37C55A869834E597373AF
8: 94E947FEE05780EE, 354918527F855264E37DB6892E868050
9: 9A80C567AA50220862, 814EE57CC9D51D7D900AB4840C4B072F
10: A8741BE1E42BE207C416, 2B28AFD8ABE20664D8BAD7535F82F11A
11: 6AB7E3C68B6682023E8190, 5E48B67541FE83969952394F84D29E93
12: 4F66FB634EB258CEE2955D84, F2632C2135B6E1144673B0EF73499818
13: B29042F3877C2F5E694953C5F6, 03268A30499D57A06AA873EF00160C3C
14: DCC7B5D9F58C88F54A9611389B8D, 5515426FF7CF2EEA91BE2B3752371CE0
15: B665488BCD75FC02A0DF7994B7CF98, B721531E2A317C254FA2ED306ADCF96C
16: 9535DC8A72645E34F948B71A5159AA9B, 5CEED93DE128044F0471C65AA8F21D29
17: 5CBFC61A23D28562FCA929375E5B585327, 3AA842B21631968D1B58B72FEE090EE1
18: 2AC3F780B956A933C0B8565EE527173B8CC8, 16EC4B6D8E2CF3CD0D16E7A5F401C78E
19: 5067FD65870A4EBF6C7FA811A15270E7F8F17D, 9A7563BEDADFA6B6E48F5C13FCEAED6E
20: E3A65A188077E5DC171CFF30BE8B27F10F015166, BD5B3D84D0C1DD51A3909F849141B57F
21: 88D0A65C105823E68BE3987CB205AE0C1A27588FCD, B280221AD0BD83E1D6B37F331F326AB5
22: 7C56D987FEF6807EEFAFD4C7EB9D72AA0E037979D91E, 686E1268A8DC9CD0192A383EA6C2D975
23: B23CCD0A076CB122750B634B9E6551E0585EDEA18C3245, 6DF30A7F0728E2D549AA411AE375E569
24: 767BC3AF206E67C9E27A4D7E814F3B3A65D27BB70BA9DD4D, AB2B16C031FB2C8E85B3B2B38A5CBA4E
25: 9ABF34ABD43705D62F377449461C5DC239A2A86E5A98AFB159, 3DEDEDA85E6BFB53C6F18726CD561604
26: FE756344C05CB12AA0673F1C2069A86556E583FF4B7313A0D395, 21CB0E0BABC3C7E547F5CB207295C0EE
27: B70F16AD19A6B0AF6D8DBF4E98D7D5ADB944D91BD889D9390C3E21, 2AE67812A22C1C785D3BFC184A1C74EA
28: A6389032AA9D08BDBAAA5E230E5130665FB4F0CB868F3F20C4C5438B, ECA054EFA3F39400A587839C4F0605C7
29: A55A41315EAF3A67A0FD0E14C6E04D03A5E38D0F756719F4A0800B290A, 7A5277809D4B65E663603099B4DFFBD8
30: E739633579AA6201A024B9873F28412BB08B08B8616D611BC9D07979BD3A, 390038A93AFD326C5CC1525A24CA91AD
31: ED3266F8B0DAA7C3DB7814427E8139831CFC0EDE668F0DA83FF7090154410D, DE440EC2C6080048BFF3C5455E1BB33F
32: 4D0F751B55DA3A2E0B28DE59E9680669FCB5984E9C0DB942DBAACDDEF0879731, 62F96CFE31D3D6AAA0B9F5130ED1B21B
1: E9, D82A22BF49B52DECE1A3DAA163956EA1
2: 3DE3, 837CB2018053A6FA9A51A18362C0A6E5
3: 1123B2, 280150FC247D06FF79ABE3C6C5ACFDBF
4: 6BE74C72, 52FA635AA14154D3FFD7A4866AC989E7
5: 7610B2DE22, 3E77AF501CA8EF386E2843A2C9F30425
6: 31BBF5CC9F77, DA25899A5B84C4CE3CB031D24BE39EEC
7: 49FE2D43D16BEF, 491CAFC0F9A749AF0F87CB5276FF7BD0
8: 28191B8F4FBE3C03, B8318CE8B7EEE3BD42A35F7EF7B4FE91
9: F6BCC7AD009DF4B71F, 01BDA4572E1B95D0152A8675BBA9F6B4
10: 89B6B6B611CBBD4AB667, 5AD5C05B2FFC3AF07ACA04EC488BC4BF
11: 985A04A3BE0A43A3489870, 57AB64D52976293C09882943B8622A0C
12: 15DDAC26F9C07856F5C11CCA, 183A4FD20C0D7AD1744B77992D4A16C1
13: FE45E506C3C26745D6B5B53A36, 67B3768535D1A50D2756AB4ED83C73F1
14: 8EBA337B5E13FC16BBB18B8F0B10, FA90CD334FA6565E517097C37B7281C7
15: C9F914A669C4C58ACA86884FFF469C, 876599BB8BC1AD6E7B1DBB00ED53276E
16: 8416EEB95A4B3DA645035CBDC76C8532, 405B3A936CE697DCBA9385CAEAFE2B55
17: 312BBF82B6619E5F7EE56AE873CAC9C415, D5FB2028CF3F6C57295BA6F7E5F410A9
18: 1B51044539639A7093D996E3B4174D6A253C, E934D7A7EF90586A56C6C2DB53CD6C40
19: 178762C071950E8E0198E6573BD585EEEE4E69, DD661E463BF3BB45225F7E7A6E0DE3EA
20: FFD6BA51FEDDB7E20593AD2BF0EEE061D3B5C014, 0DCCDAEBE6135EDF787FEEDABFF3A4F3
21: 04BE622B5CBE1058A4C8356F65B8158295F39E1AB1, FCA9B0BCA348B319D0B19DD28EE9DE79
22: 8B49016BFA45DCE019BA9E4606E987A159ED0DA07D2D, 6B93BD424871D5231EB359E40666CC5E
23: FF8D016642B2C3190094423F5A61F7CBD358522A5E5799, 2088A4088AF6F786DFE08AED79A19B3B
24: 07F446A2E3597041B9AFFEDF5DD474CA5FA5C872844A4F8C, 870223F7404BA37C8DB940623F0DDBE2
25: 32C2EF41ED54C8B63AB8151E690C1770CED90D2827EB2C302B, 5BC4EABF30986EE33FE483B8FABCE7D3
26: 3310D94B00007C10D4B3BC3F57DE877D0E2B822B96DA9CFEFEDD, E0E114CEC34558A180675B0438128F30
27: A4C95A5B316AE03A569B7862290DC6340FDEA1299C5B27591333B6, 63288F9CDEB93BF029C194B2C62B4AB6
28: CB63472F93E0325123558620DB9FBA058455D8AF1D23A94BEBB60A79, EC0968F60DCAFEB17411C4A2D7793FCD
29: 74241261257C5610211A3B9D45D62AA0876B63EA289FE938FB03CC8D1C, 4A18EAA2039B29F0CEF7745EB8AA7DDD
30: 6172080F96B60E3BA450BA195EB4D6732A25AF30A109031560915C4C0344, 3B690B088522D3EBD6B647070AECF97F
31: AF52E18DE8608C39FA886377899C66AAF8612513C21C7B815E248D9F75D775, 39F0F712265F44A442A7581D8F314D1B
32: 64F9AE4A9E6735D348343EA7ADD617F0687C2883637468BBFA3664F9194F1683, 947A02C9994DA490BFC9E036305B26EA
GCM-sm4 (16 byte key)
1: 35, FF70BBCF7CCB35AFE8B806BBDA8CF462
2: 418F, 4CB59D26F6F41BA4413339DE202394D5
3: F01644, B06F26255E3BF20393B697283619F4CB
4: AE4871E8, 1E7D9A18D453B5992DDB52975B8B9BD3
5: C280528391, CF1C65604E006F9B79EDF4B6B6EF5B05
6: B2F0185A5F9A, 33981E9B9A58CEA9FCD1219868E4907E
7: 441988562A65B4, 4E6610F9F18F7AECCE0745B8227FB139
8: F70D70319A3B6652, 09BC4E06455D10358AFB36C01AFD0494
9: CEE87EE6FF0078A9A6, 8333A61DDCB965BF4293E6911864CF66
10: 2599C4CC2007F4032AB3, F2F0238D73262488B89F2C25ADFC999E
11: D2EC717E6897299EDB42F6, 05603ECDE2E18AFA4470DF97F8EE4899
12: F8FD6DA197A96D5B3B06287C, 4BA295D367B50E71FACD53214151A7B1
13: 0C7BCD801EBF114EFFFEA84A66, 379C586351C9D2054FC458E0DB5F878F
14: 9C4F1D1D7C98A042AA62A7A28E97, 1A932604F135BB21C2EC2E7D73AF0C3F
15: F80C96AC05523E55881D716BD9E0A6, 5CEA5F26E90EA3588964E374942CEC54
16: F2272532A01D7FE05A47EB04ED422938, 294B483BAEED79A8AC42072D20F9028B
17: 58EB27B530CA20D5A85BA7CE06E9112D2B, FCF9EEA2C4EF185199A67C172DFFFCB1
18: 46CB6F7EC77EAA26A78C2FC5184741F0CDC7, F9ABC0744B86DDA1DA92F317EF9269E4
19: 442355822E3E451F3FA92567BB3FC6488648B6, F51A079916440068677971C70D24C196
20: 5241BBF0112C1802697B8AE0B324853839734FE7, 15A71FFFB4156F88A5585BC5587E9101
21: DE432C494F1CDDE5F5055AFE2DA309E200E6014482, 517FBDAD471B0DE9671B831E797521E9
22: D84AD8B34414E955B8AF0EE292107DE71788B29BFD59, 44C464F41512C71AFFAFF37326A429DB
23: 0E21E74C073C639049EA361606D7C2C2DEF7EBD05FA233, 2169BFF97DD2D677D9512E1BAB6FD5C0
24: 43E116D801E2EF765E9FEB07DD4DD33999796314064FC926, 90A32EDEE61181ED45B5736A31C7256D
25: 506FD9ECAA69A9D608AE2E8D7DFA0E529E9249A57757A76BAB, D7E977F8CCDE9C2FA5FB52D38B9F326C
26: 3D403A81FA1B1BA530E27D9864170BEF4241F373750F4891D117, 416580995A698D7F2B948F86DE09B9AE
27: 1ACC9E429DBBBC790528F7156CFB81D7CD9C42950F97778D0A49F2, 0294F18AC56719B6F0B564D65DC3735D
28: CBEE1B89C717D3DD688132EFC8C26E3A73D0F4371BE2011B33040631, 3D65AE78B1F7191BDCA08E1CA0040EB4
29: CE869BFF3E7F73F41700ABCD63635277B7751838D43CC1EF94CC740A98, 118D7B0B39B7461BA4C465B2CB1E601F
30: F795251BE1FC9D13087DF27051A5F765A95A052DD5BF3779B5110E333A23, CCBD865E6BA507DECD56A56178F2C934
31: F6A93096ABAD485915A035C24341E1EFBB5B23AC7901E12FFFB5E9BEB23685, 07399EBB80C57C761CD355B6752EEE3B
32: 195A9982F24E9310DAC69CCEB62B509E962B6EF55698B95AA2A7ED451B331249, D7472FFC15A99DE62CD2993AFADD9867
GCM-noekeon (16 byte key)
0: , EB5A8E30D5C16311864E2D8D32859ACB
1: 88, EAB88DE1EB7BC784A706B2D7946798D7
2: BA1F, DC3CEC6AA324AC7D053EFF7A99AD3069
3: 9A1457, 4AB65831DE378DFF71C20249C7BEC05E
4: 2F9496D6, 800745CF95EAE3A698EDF9EC949D92B7
5: 84153177A2, F6A05B654435ABDF5F696C0E0588CB5C
6: F80B7865C766, 2334D0061FD488D15A6AC8E44EA1F4B9
7: 872EA486B4EA9D, 3A49671DE347F675AD7904DDF4255F3D
8: A4EE5750507FC831, 956D09F7C5FE812C6FB982E1DDBE864A
9: B5874AC964FBFC1A97, 90FBC75F45BFF58B3A1100393955D0C2
10: 92FF5FCF1EC675E02E71, 983C96A7BD4A0DB5D3B877911CE8A6B3
11: F7BCA69A9C7033D84A2BA0, D4ECE5BB9FFCBB331A646D9CE8078634
12: 5E1041B4554C8CDD14AAF16D, 1EF777F307CB96788B9120FFF8A8BC2F
13: 7BB7289FCAD209D7992EB7AEDC, E8AEFB830DBAED2B4A790FFEF940A20B
14: 12776A7C937A648F0A8628AD8C5C, F070283852AC030819EA67BF82C719AA
15: 7293476D9E935EAE9DEB66F697F662, D6322603671153A1EC1453CDA5978E15
16: DC12A86C85E7358919BABB15A3BF5FD7, BBBFA467EBA8124DFEC82DB0137D56B9
17: 0CC1DAD00A987F9C57E3660D9417F226E5, BB8AF5A0B5BC79BD11C5D41CA80CDE2C
18: D0049115D6EB5495FB391CDC494022AEAA48, 682FF357B2BC059765C29AE6CA668D0C
19: 48FC54A401B4C06CE8567AD298B672191C7E84, 493A4AF4C2A8828FED8442C4EFF877F6
20: 90779795821CB1B7DBD97028E29DC1CE7D0CFAE0, E126F485F73B6F7B3894B4CF7E1C5DDE
21: 8CA5C246C8B7C04BD7171CAE2D1A892D66302433F8, 5D73149A3635A86B3C34DEA5B95CCBCB
22: DF082B665F7A952B2604C04554B81393FCC7C0B816C8, D3569ED7D431176B286EF22414E4CBA8
23: 761908530C9069E189649ED24B6A68A89B067C31E9868C, A258BCD83D3FBC7AE2AEF7516025AB36
24: 717048F5A31F3C89D3704F90069AC5D5174118770C65BDA1, 067EBF18F7E3DF4EA13F9ABAC682C2A2
25: 08C6FCC5D3099347C3FEBA3858A6C22C51298CB591DDB77827, B57BFBA40BE99DF5031918A1A4E2CA80
26: 2CC53EF7EB954234E64CD4D60FB1D7157A489ABABC10900FFCDB, 236E769611D16EB7F463B7578770F886
27: 2556B46F2E831223D632F2691329A874F517687AF81B8322AC55D7, E213A90DBC31DC261A45A9AE41CFEEC3
28: 71241792728594D69791B80AD6DBC6417D1D14D222DF5E6F834B82C8, 601F97617708B1945BCDA8A82496EFB1
29: 5003DC2EAAA23F9E2221CCBB9E20116692CCC99B3CFBD0DDD3A8491E7C, 3743155B792012845550205C8949B73E
30: D0589675357E850333F854FBA160688F06D122DEC00CC2620DA0B2770765, 20E085752FC4D37791C22501ED1DB6AD
31: 645B46D2D114EE7329F14AC1D94E6817EB385EB80C61F014F90530749079EC, 8A18DE86F9555A1070D0BFEDAC15B14F
32: 068389206D37BF5A41C58075FC98901C3B42E6F2F13C09F4E92524021BB1C1C8, 370B86914D63CFEE8303D538A6BEA0E7
1: 05, E18F8A201F281A4F3F4FE6F43A001107
2: 55DF, BE4D95A0BC5966CC2E80FB544AD43B8B
3: 0C5A1D, DDAE782864D5EAC894C863D4D2E3CA54
4: 767CCE5C, 106D7DBE5D9D56D38E6A679528C72688
5: 9F099BF360, D4D50BE3B13DE7B18BE415B21BD9AD4B
6: AE4B0C056B1B, 8E0EA5A5F612835B1A498C671413CA19
7: A8EF51FA62B5F9, 44A65E1A85C9C102467A50297F8256B0
8: C58D955A860EE8E0, 45622020FC40884B61BE3C35B940A870
9: FC5F5562143A7F9AA9, 7FBED30D1594D1DB57BA10EEF0C4AABA
10: C2B2D5B922504BD29C23, F14AF5025799EAF249745F1B91AB554A
11: 62C250C8548BAF088DD01F, 6D49DB3F4D3D8D30DB0B26DCF6CF6A80
12: 3FD64FC5BE13ED2AA041B8C5, EDC192E68D5A7B37F395B794C3D8245F
13: A84B4EA6C8CF088B0C6D40B5E0, 01EE07A0D3F4A1957579C1EE36C5D5A3
14: 39A4C10E5C542FABA9C6138E02D6, 8B31EDD92A71F53ECEF716E08CD0A3C3
15: E4DF855B9065B51C47454CBC3209A1, 4714B347E11804D0AB3241B1D72F4FCB
16: FB6D42C9C44997D4C854BA321C8631CB, 7F0BD8708CC6358899B7C62A7ACEE739
17: 81A2C031F0D5593DBD283A9650A4160185, 3267D10C3BE6044B0D2E0BB59A919AFC
18: 33776FB240A45E1A84B86B49FB04A350B9F8, 3743BA55B523F4BFC25E8B2474347C70
19: 4E19A791B6EA4B776C5449CC3AC486EE9EAAE7, 9D4FD554D57E73B6789D20E262E706FD
20: 10B946D1B1C005516B7DE7F51CD41C8DCC581DA5, 3F41B2B8FFCFDE5298473D2E6FF76227
21: 184C4DD415AFE6FE74B3BE662AC04E6229F517F4A2, 158749C83A13B178F0FB7C48E7A4A19E
22: 6DBD3F3888A2028841B61167C3EDAAE71FC23774C923, E0E87641B9C55DCC041D343960C9417C
23: 6D995776DB3B90B038A4CE44EF2D4EFEA16DFE0A5BB054, E14F63E6C6657CB904B16EC4F2B82972
24: A955576527F9A240B13F9DA2FD67997D5E606D34548C1444, B8FD23A3EFA33E7F4367C61E071F8BEE
25: F7D9EE67BD019E97A5EB7A33B7A307B2268ED7BECA95553D92, 6B31B756C9B3EE98613BB29B357FADAE
26: ED68485EF62E89965CC8B085CAFE89BD9661ACF66939FB014E1F, C57A80259C493520E50902597EA3EFCA
27: 53365AF657B186724902E8011368D6E49DDD2158F51EE0FFFA9658, 8EB890A78716344E79E4AD48C52D423D
28: B49CCFC3FEAEF5C8DE4E41EF538A537552B4957E8965E454FFA3B5F7, 7CA3442BAF416B50431BBBE5CACD44DD
29: F02E7CA72035455ED723EB802E66118D5FA642295416F12AB298567AF8, AB211AB9624F17975279690C6D95EB51
30: CA4C2EC503773BBF34FA411340CBAD6A9115E81B073932444ACEC5537614, D877D5B78FFB31CC54142562BED1890F
31: 9B9BBF2D46D301F3ECDE92A13C1EEE8F9F1533AA4AADFE2E22D36D51F5F469, F03F634BCCAC070F210142F737542491
32: 92AD34E95350275A4CF208CC1A07776E7A6635EB8F2A7D4D9B6B6C96D6812616, 52E49767709D7CE349AAFC0C405A68ED
GCM-anubis (16 byte key)
0: , A0061C2F3B2295BFA33BC74C037EA8DA
1: ED, 9E5648DCE40DE37B56C557D26CB18D83
2: 6719, A6605253C59A101FF85C5102CE92BE45
3: B8873D, 13F3E3ED3646BB296EE4ED5D6379A21B
4: 5AA6E2CB, 1812E8385D15B5BAE043E4E860BEF490
5: 4F6F4CD8E9, 8A80BC5E08929C42A5A74C5D9ACC0C6D
6: 2F0D8B483CE4, 316F588F78FC6A9196C97CE59B9B63B6
7: 82D885FDE1F948, 7160BF556614511F53738A92B5277056
8: E4931462AD41B6DC, 7CE24C4D6B499975FCB72B5E2275ED56
9: 503AA70BE698BC5B41, 10EA0C61FDBA8FF7B4E9927BCCEFD911
10: 6B2D213D14B5D25EBE36, DC3222AED12EE26D3D14E2E733EDB2A7
11: 7D8B0BC1B7443E7267371E, FCACFC73E391865BE86E041F51C45E81
12: 9EF3BF8609E133BEB10565AF, D84326D4CAC9D5B74FCFD8CBAFE79E77
13: 59AE7B1FDE1178CEE7F63C4894, E1BCFCDCA86CAB9C684F7D21962D580D
14: 564E7B8BAC5582A3BF1178916569, 54804D8DF4D7577EF65C15487695F840
15: 758A6DC437C8821274B0F16F911BAA, 19DD27500915F425F34F67CC2374DC36
16: 0468C94A88A27AEEE2B3A973065E53CC, C743996C6F49363B2F4613F24703EF7E
17: 3B0CABA5EEE44B7BFF0D726ECED54763FF, 14D9D09815BCD91DCCE2F5AE1A9929CF
18: 5B945D83B98C43B0248F9BC0479E332869AB, 67A275F0313D4245B1965411CFCC8F17
19: 97332441CA96DE8553A3C6D898FC6D90C86DBF, 73150EC3D6327E3FC8015A6192652D3B
20: B9A1778FAF9767160D0D87816ECE1B99AA727087, 0C173D3C4078392CE377313C48D2BAE8
21: 5882B73911C7D26EFDCCA3AED2EDC8A8BFFE75B1F8, 8F8C535639A0B59537E590C7FC9D2E53
22: 70AEBED8CCFFF6E5CF06F3E841D12387EF8D6C7B4BDE, 4B00C27FCA9BEB82331CC8EB13DCC580
23: 345CCB52BC20DC5F1BF5EEDF5D72A6C48F402557FFD342, 1A790A39573B853DBB8E2E73B7331014
24: 0637C78A817E91D63CE18CEAF8D65C6107283A90C5A97842, 52786CB81724E12C76A0D23D4680E36B
25: 59526D1E86A473DFB720FF25E97D6571077845F73C5E8322F1, 369FBA7823FC83D727FFD25D10130987
26: 2933BB4E7603C313B62332827601F8189E14C1F08EA547E15AB5, 204520E365DAFF6551B01562A4CEFDFB
27: A4098CF2A48A1DC2BCCE65CCE8DF825AF51E7E5F94B6186FF85D77, 9833EBB9A1D5CD0356E023E2C3761C2B
28: 26557B942FD6913D806672EB01526DBD5D6F532F78AB6759DE3415C5, EDAACDD101BC40EE6530D8B5DC031F31
29: DB92C3D77DF0C8F4C98845AA9AD43FB800192E57A53E083862B7E3FAF0, 628DEB1E345303A40700289052080FF8
30: FC57BFAC2C77781723C2B721886D44ED67A52D9AD827874BC4EEC0A97281, 9A222DBC47B4AB4E520D3CC5850D4DEF
31: 72DFB9E91A78EAFE758B4542206A4A957B4523A58428398C11BCF2AEAE1938, 307D0B876130E82804C1167E03B69B2F
32: 7275C6EBDC2680DFCB73326A987D2FBCE83E40A9AEFE6351CFDA7251A6FE10A6, 895E6EEAA9BD88594903325A063CA45F
1: 99, DD35EDAD537F6FCA5BCDEB053BEE36B8
2: 12A6, 24CB6ECAECF376400F7BFF52C4312D08
3: 791DDD, 7C35A987766AC11A4625C92BA4AA419E
4: 601FF830, 69A6E3718404D3A20019D9E7F875C2FA
5: 45A67C8B23, 92EFC3CA67CA0934E5E22A0EBA4E5613
6: 5F2C7A733D42, EB5BF55241D049343457F05BE8B53CB5
7: C356F4D8AC59BB, 12598DA524E6F01EDDB512E3B988B860
8: F24201E87407B8BC, 58FBE9D3E242E16BA16420C354BCF0D0
9: 509A017E05D0075264, 357822F3CAF350972D86F2423FE49040
10: 0BCBA97FD277C65D4BB2, 068F57C866AD35379F108237B39C78C0
11: BFE30A88F0B1FE651D0EC3, EE2F073E23DACD211B1C22074CB32A70
12: 11AA35923D9CCC49AF83DA5D, 9A7E9EED9774C06D1D127D1ADE221893
13: E3FE3E1C2CA4E1C61D530AA46F, 0D26F48272F7DAE98C797F0AE5BD5B3E
14: 6407C7F6DD9E188DB09F584AD32E, A673DD2BB4ACC85983DCD4B5EAC2FB68
15: AEFBD570198C05D5B430A275AA82D5, 3A1CB79A7DDB7601C7F72A5B0DA8531D
16: 40C1B9150E8E09C9483C1CA0CCBDF363, 241FBB631ACEDF77D51594D660BB4981
17: AD3F3FA6D431E12D6B41476D7B5DA77C2C, 4C22BF4240AE4235FEAA2D3ED7AAB8B4
18: 5EB8D86E7B26064D75E56C42B090A17544E0, 44EBE42984F206FA78D19DFC88AA1EAA
19: 75D7E5AD5C2D19E21A1931F88229C1456EBFD4, 1F1CF1F832658DB0804D577BB2FCD2AB
20: F73F1D3F38E8B99898E30FACECEFA40FA933F63B, EFF893CE73B6B30AD144735A5BC759A3
21: 452A09F297A013652273C124085FFE03D5034EC331, 9E71970BCD0EC639049F906589B7FFD1
22: D7BB98AD11A884CC8BF3F2F52CE9F8C17F8B188C190E, 31496C89519DE6F66113C9BEEB151275
23: 97B8305B1D1E02D4D1D8194BC54E4AB394FA8F5C8B2526, 1A153F52C3C67E0DA81B626C159D31A9
24: 1542789709D1FD889E7C5820F920126434D5969C4EC3F6AB, 685A03CA342688A70753953AB27CF0BE
25: BB08A7F815AFA96B96C028EA48D79FF3BA7FFFFFA1902E7822, 98E4377462566EFEE39F65659DEB13CE
26: DC8EC0B08BCADA829B3663980D66B80A2D51500AFD80EA0F18CC, 58D9C85F9561F59BF264393DA954399B
27: 477A3B8344DBCC79577C15524F35B45A7FEA72B0561A0CDCB3CD66, 57343CF1432D30FAF8724C5AB3120539
28: 3CE2DD2869EDF99ABBB3DABC981B5BF294D6AA29A785F1ED6363D6A5, A939560243DC164D46028133C12B16BD
29: 72504872BE65F3DE8F0B63BD24AFEED17B195D270AB20ACBEA7E6B0B8A, 4D5D642AEAFE6A2CE8881577FCD7F2B7
30: 5B71030C43F551C27183A17D08FC1B9C8AC1829D404B8DA8803FBB09343A, A602A88365B46F19DB240F2C077A0334
31: 89C0C85BA495D5F92D91EAC281362F374A0F41C507FD20DF6E05147C8E7208, 7F8994E46CE0548DE8F290303E8F3613
32: 5AC62A000B9A80B6B849F3A36E1B512097922F8475D3C6F237C3DAE23A6B8C6A, 346203E5D4775D002A1022D7F42504C1
GCM-seed (16 byte key)
1: 26, 87B72BF4F343FA59CFA40D1091F50FD1
2: E80F, BF6A3B3F649E3AD1D07D24326C44365A
3: 16C93E, 740A57E99296F82515190712B4B56F00
4: C403D1FF, B210C95ED48A15A8E78DBECA2831CBC8
5: DAF5735AE4, D74ABA53295DAEB4A04842D0F587C0FD
6: B80ECF00DBBA, 91DD19615D6F71F696C4AE9D388D7266
7: 45F170B0D2ADD6, B9FC969B51976A3CE3D8CDD227722A53
8: E3EC82041FE3EEDE, 3B82743C9A974E594D53DCF17204CE55
9: 15B8E18A9D105E2F2A, F1452F649ADEB08006092347A722497D
10: BE3E6D03650BC96975E1, BFA2A6EDEF412FAB922E861514475C21
11: 0361D6CEEAFBA30C30EE5D, AC97D081314CB9CD24113CF38E9E41FB
12: 50E4627778596D55D7A508F4, 99A3E41EC4F3B20DE8D217C06C828F23
13: E3362B153E59770912C7B12FB2, 9A96E56341834743DDF33156AF411B5E
14: 3408B88EEB308F20964DAA903AC7, A4D487202ED5EEC5EA4C45792982A821
15: A6AAA4ACBFF8AE329618B023C1EB99, 5B67A194B6358D44FA5801B588289DF0
16: 4DCF2115BE730CEFA52053E9398EDCA2, 5DE56AA2FFC6FFEAF87225316C74C87B
17: CFFA74C036CD62DCE15843160B39FD18F2, B0CA9A45CCFDD7A61B1D06E0075610B2
18: A68AA4DB35238DCE0D537670D76073ECE5FE, 283B33B1D7B57917B8658B3E957B52A0
19: F99FCDF3990405A203BC6F9F7D56DB5B8A3E5C, 0887CB21263AE7178AB02E287D47E2C2
20: 363664B0944200D152A48C8C27183D7AEE177A1A, 3043B2927916652091951B9E2104E91B
21: C1D9BF607F76D69761A9BDBA7D13D9CE4C8E430F7B, D6E7509B620B7E83B3FF7F931020F56C
22: BB2DC71C8FB4A7A201AF36C4A174AD542D3A34EB2BD6, 2158A10FFA890769882FBB6636F95D1A
23: 6B478DD22EF941F726D89C1B5654260845DC9140317630, 359297946889A740671BBB0BD2857883
24: 3211DA2201F029B1ED2E11187E62D434442D5302E78A3242, 0C1D43B63A4DD329EA11ABE5404E83F4
25: E0398E55D8E5146A715FE9E9A74316BBBD69DE747B5F7C3C68, 74FE8E2F10A96CAB8102EE6F0847380B
26: C404BB08D0BEE8FF032D3EFDE7A15CEE27BA29B43161F0B5E952, 0F21B0E2D83584B65BD7A2F912BF9CEB
27: C61D97BC584FA3CB0E6CA3E966747D75BE90CE32E4E1DFA2F34CAC, 45D4D5B01D578ADE8EB7B58CDEFB7950
28: 2EEC4B1DEF647FAB996C7A5FA5061E5B572E8B1B0BAA0C8B7D01D122, 36E014FF6D8729B2EADF2E0406840B9E
29: 9753865FB716D470C634974C2056D637F11EB2467274D0024A72E5FDCC, 1E2DEAEBBBA78E0E6000275B7CAEC89C
30: E9FE40F4C8F4AF2607E41C6BDCAA28EC7241FBC6C8DEF6F36961EFE9B46B, EC5EDD19299A09A39D2F9006093E4CEB
31: 995FEA1FA6A0B0B141375B12BC9BA18E29229E3D3BA3FF2F67438268B06EAE, 0413AF0B5AAB28C4EE92495ACEAF17B1
32: 746961D162BECF915397F718478F5C1DF7A3FB8BD2413A4BF7C0C43314F6E2B1, FED8ACB5288B6ED8E0556D169CAD99B0
GCM-camellia (16 byte key)
1: 13, 0679D1B662AFDDF3ACFCE419B6DA94AC
2: 26D6, 162A86F8E59F9E6EA5DF0748B890862A
3: 58767A, EE0B79D3ED4B852EEFA323F8EF9839DE
4: 0CA5F75E, A8063610439C0AD6631F6CFBE10C2AEE
5: 5B821141C2, 0568AE410E4EF4C9FD4EC55926FB0300
6: ADCDD0B1C7AC, 84B1E359DF762B7E51084FCE1619D632
7: 75882A4FF78AF6, A13923C17E9006E06FC10710C3F1FAD0
8: C4F2E79246F1CE2C, 27FE18DF274233BF632F91F5C6004C3F
9: B5F5462F5AFD8333EF, 56EE2A3CCF86F4F5CC6FCFF2638283B7
10: FF40C4163E604B0679D7, F813C36C222C5EC2DF7EF51DD12BDA97
11: 93FAF62FB742529F2F1034, 2A67CA1A0CD5ECD3EC62E9A303D11B27
12: 4C7F377995D7FA5D94E740A9, 0F8B822AA9775F742D5436029263520A
13: 357A0DE9ED3E1070808B2AFBA4, FFB8426038E07FD7D23E92876B3CF4CA
14: 281F9A4C95ED6C363A1F00564206, 93D5470EEA15AF8E85019C47728B217F
15: CBBB9CCCBC78A78CF1F571BF667059, 15C7BFE9E2D25DE73BACE501D9BB5346
16: 8A3392119B0B01A9C38C556C6F31AE45, 87886BF5B99CB77FE3B681826286E87B
17: EC52B385BC9CE88DABC560DA23B3684378, F6B71A19E39723BD4D9DCFF7ADE97796
18: DA81EDEBBAD7F6A49D3BC377E5F16272765A, A0D06F71CD2D9947562832E1A83E577C
19: 2146F272EDB8F46958C01887D92BD3AC9B8A47, B5CC3F66E09AD98AB6BCEAFCDED10CB3
20: 3E281F975765DE1DB519696DDEA6F94B462B4717, 515B758DC732EC6CAEEAA4B94C943CF0
21: B3A735243E2D508E2EF3066705D0FA37442C8406BA, A8C1CC8EE8D5935FBEEC31B7132977FE
22: C1272F2CFEE63BA750A7689385ABBCD4D431A99BD2E6, 46511DE41E6ABDBDA73AD854149B03F5
23: 3C66C359BA5DC0AB52EB152DBE89AB28767B7E4A6A05E6, DE4BB656C5B0DDE993ED461A0D9C185A
24: D0248AC2923887E76BAB9FD48D8FB73D93B23E4FA8704C10, 7C120335F1DDBB429431F15E24F64455
25: ACFFD738047C794E9C88BB76C2BD8E300CC5F89C2E5505815F, 7D090676F5CD61FE8BB3E20BB1BC8235
26: 8B2F83612C9B5870782FDC506FD9E7CF08024C6D126AA0E715AC, 5A72E736892087A91E77FE785200ED68
27: DDB64F5869813B94E80975E55BB8B62A23CC8B0DD56357C51A0B2F, FE9B74933C7D6FF5272A0DD90D1F5D71
28: 00A21C6C047DB3551368ACA67B45222386A2DD63297CABC780493A73, BEDAED8C4799594FDB40F992CC82B4A2
29: 35FE5CD3F9ABC78C3B6E96EF11FB601741710FDA8572CF741EF9E5A522, FE34A91C83C93FE08F7D4EEA3F927415
30: 4CEE166BB1E1325C69BFAE06C9422BA735FD5B21EE2D7581E27FC027CDB2, 31D3086C3A0639D79FE08F5DEEB3E81A
31: 6F575BCEF0FC079F8FA300040AA50AD6CF6F4C92A27E24A210AD32FB1FB0E7, 057E5239A6277E1D96BC277D4EEF5FFA
32: 5090FF37EF4F163F5B54AEA54DAF1CDAC1125C46A8617CE3D251576BF52143E2, 182FD3ED463E1A6A615F4E25B34CA748
GCM-serpent (16 byte key)
1: 59, 99CC473736142E231C8E2F7983696FC2
2: A073, 97EA5DB74235D7C9CF7ACDAAE9A0A7D3
3: 7384C2, 0284EC6DBF6EEE7AC038894F0B83E740
4: 6BC5F0D5, B1A9E78ABFDA9DAFD93E3E6F10785402
5: BCFD59F173, 818144A066F55AAEB713F6936CE79501
6: 87DEE1FA7D21, 6694DA4EE26599A6836C7736C5A0A9AA
7: FA2DD1DEAD1ED2, 9B7F45A3E8C5584CA68C5E8C24073036
8: B6AEEC38E4BAE411, CCCB1EBCE819F011241CD295818B4CAE
9: FE2FD69E73754AB2AB, E08D2FF91E5B08DCCAD050A0F399518C
10: 409169EB71E9986BA336, E797131B00564D9A4F420FDCA4EDE649
11: FECDF3D772D5595FD84330, 232FF07D2945D119058EBE9D0A09C852
12: A849518D738FF180519CAC0B, 4E7EE3BBA0442C19A854383255D2A6B0
13: C9F9F35975DA8CD50ED16302DA, 7D9F2B224D975EDECC381B78F845EE88
14: E5AB8D47CAB6B2AF0110C9C9A3EF, 218A677E10FCD9862B5E6C885D7D01C1
15: 82FD0D94DFF3FCFE5C1133F8DBA522, 1930CBD7C04F6B075875C8641FA9E39A
16: 7EDF3267E7E798C0622F31FC7235B86F, AA472388E03067DBFFED9F8DAC6DD296
17: 0A51F0E3D46C47EB677CD33CFE7638D762, A961F757ACCFF8677A9D33D1AB16C7A0
18: 2C5F591358F2BC1CE2FB984CA5BD35680EFF, 6D722B6E47DE42FD33D99C2847951724
19: 4282489BEA7383C82544969E1BED4201687178, 2B70E41844175DA01170DEF7AE4C677E
20: 1A1410118E91AF9D670DA0F3A6245410BF4A58C1, 20214C685137D8E642E5040E020103E8
21: CA792BD1ABC2F0D671D5A24CF7ED286E45A858C15E, 969B7BB2762B440DA35E97AE4A7D8AF6
22: 46035A0BE300E7C6ECF6CFFB9BB0E30C3DA5F33837FA, 0371E1F6A3C71EC92D9A1109539CE20B
23: D0D19F32DD401A2F26CF7CCC3EEA551F9EF6EBC62B4503, 07AC0EDF5BA03782F655C1864FE03A1C
24: 0BA2D9B107991D08020537FAAA73E85733FB2E94E5370A91, 3D192C4A6CEFB1E9C01224A83CE56C22
25: FD83350D639213E2CD87B17C46A3A68FD4744A0E9132A54408, 76DE3B21C33287DA5F6A6496D8EF0544
26: 2AC44A6ACCADB4B3FAA87DA0CA2F0E64435350D5629345862FDD, 9DA24FB432515AF720127024DF7522CB
27: 3E72B3820ED4B358D78275A33BCC06B378BD1075974B66A7BF7CB8, 9D05B7C4C3A394E40D56F8E48D62D1F8
28: 82B4AAAEBEEFBD4960B23E8020733926C4716BDFA6B6DD1A97CA3623, 9D9056217F955B28AC37932A213012E3
29: 85B43B381EBF7D4A61BF261DC2E0018FED9A3BFFA5097150624E00BDEA, 128B0ACC4E5342174BB092BEB87B9A30
30: 8C06161B3CA867B3EB61A9C71C85EB8586772BD45682FD57B15E03C0423B, A17FE2999ACA23CEF1196E3424A0ED0C
31: 4331553A74B44F279B6B007E9714322105AE73ADB83A7FBC5A622DDFAFAED6, EB4781C244484C51A155F2A0F78D38FE
32: 855378D251F29B822948E3788176E96247B7CA292D4DEF383FFD936BE3F7F42B, 6A08DF742301EED938AECC730D187AD2
GCM-aria (16 byte key)
1: 2B, 588D8A797D5CEB2AA14B26B23DE380C4
2: 0724, 884B5363AB5AA07AE0C8A410BD079A7E
3: 44018B, EA3C6C6C053E06CCCF16B6B32855FC66
4: A5DB6607, 7F95AAD5C450A5B9DC0F57DEC357AB68
5: 9B70EE197C, FA09A2E3CD4BFD3DAFDA909D111F80BC
6: 0F23E0728B81, 758C5D228EEC2A3BB515E9B36FEA1FDD
7: 038F215412C0A8, 12F30C9639C93BCC4FCD8F12F182B6E3
8: 1D291AAE5E5C8F5D, 2DB28263C719467FAD40E27778EA4641
9: E3DE58E2B25B6FAEA8, 64C197A174D8198F349253F60EBDAD81
10: C08DE0A91662B88E9D77, 98CDC565E1EC01AFDD1C4161C2C33281
11: B6CED209A6E1F65F3DDCD1, 5F6D9CBECF9C803BAA257BE52796C3FE
12: 4A42C425D548FD9C821D77F5, 321EF78B7C41BCB774EDA7825894579D
13: 6E9391A1E7F005472C977B2A29, CAF81BD97237A31948048F99AD1E0E2D
14: 730A2CAA7C6A0FC93F9CE9B3EEB7, A351C84B4C70C3CC231DF1369D89AD69
15: FC64D7F6406569814B6C3CBEF0C38B, A0C355049D2E7428BC5E62E276C31A73
16: 41F9DF6FA26922ECCB989FE278B07AB7, DB4B01EA6F44397A3FEF8E323B5D60F6
17: C408D91E56F31F3914BDA7DBFDF6896195, FEC1FB48EA866788272445CB572190CE
18: 652BC2873039D4774F41E73338D5D67D912A, 77ED1D0B0EDBA46AB71FE93F00B4B9D7
19: B6933250A2EB77EE9B45B7A565A600757505E3, 1185254D942974C01A62F8069F910C27
20: 2AD1147927FAE72D54FB7C9972DFDC1D04B22B67, 86D6D4894A8B545937B649924DFDA239
21: DFB11C924CAB8478B5F760BB6345394BE8059B93B3, B20124792ABB6CE18C8B7D8A1DDBECD9
22: AE9872F53CF169D205684F14686B7D9B2D5026E54E1B, 8F8E9E7020807E13125157698A4DFDDC
23: 3E5A6D47BE6BF6AC6671BDCEE57357A92EBC0D6D00145B, 30E724C92A189C869D73CB69D3FACF4B
24: 74E0639EC83808E217A2B81D5B8C25E5E1629E3C8948BD24, 557B10EF8C133072267BA2C646DBAEE7
25: CA74B6109BA5591E29AB3405968F383234B18EF12B39AA3151, 670C1911DC49E03AAA0928B15D4F304B
26: B74784A0C1A346A3307FD9F79361EED8CC99A5AFDEED56701DD8, D513308E7F73B9672C2E47C1DF3CD042
27: A66B9C824790EBB44A85711E675242421F40F915FE41188D9B4AE2, 62B6B7EE20E526E2E711A5F163E26686
28: 6A2F04E886BD16ACE2B371A3F9724009A934F7777DA52943FF7DF947, 6F8E87E8EF5D5DBABF2AD8655BD8D083
29: 1A22F02D01AA1F20C4ADE774A02A91F98EC77C5CBD1FEE5AF11567A6A0, EA8D55F23CF93E4ECF797C7EBF8117CC
30: E2EA78F8DDEEF6E2A3D296EA54997FEC9E0721926F72AE9097A0EE861085, 40A17EBE8FF9271038FE7624139E3C7B
31: 2AA70145E304090A0CA4E12EBF238573C8EC8749AD048D957A869E4A4E221A, E6FF72B33CA247D666084CB696085B48
32: 05B4268A698F214E5A05BA41C2B010F589EC063372F9C019D311D983EEEC4426, B5A5601BEF292E284F5F73AD9F1343DC

File diff suppressed because it is too large Load diff

38
notes/hashsum_tv.txt Normal file
View file

@ -0,0 +1,38 @@
blake2b-160: 684b540eb245ebba2cd66b7814fe6d787868a5bb *tests/test.key
blake2b-256: 3aaa08120aa0174c105fd1f3412e3da30c3bbb9073569b0b8ae458b34de7780e *tests/test.key
blake2b-384: c33f39ab19099d5dea6789479e23447857803a3f45361ea58dd69c7b8037c8697544b6a741e236215adcb8b38fa0cfc4 *tests/test.key
blake2b-512: a2daabae6996e3bbfb76c5d277fb881107037c756173f510d83a78f669cf0b70a5088b971e30ca2168381568ea3d30b80a7b500944a5e2e3294f25aed4c3a5f1 *tests/test.key
blake2s-128: 7e1f9b6de11a3c597308f9d8aacd7321 *tests/test.key
blake2s-160: 3d1c9ae1a0afe8a6ef8b61d5380de7b061cd353c *tests/test.key
blake2s-224: 95dacd83d0421b2d69a52d92ee54143bb97c91a61450d917a88d4388 *tests/test.key
blake2s-256: 92ac6dc88b9ce4a75b2a54783435a37919303f713396db0e9ccd976d8c55f1cf *tests/test.key
blake3: 634ba3ee0627293fe3ef89fe7200434fdbf2c40b08266e0fd09708bfd486af0c *tests/test.key
chc_hash: d50da1ea9b53c0b891c8bcb0a4c6e5e0 *tests/test.key
keccak224: c056b64ec1d8066aeb148d38aded0ff96cdb1e17eecaaca407b3bf66 *tests/test.key
keccak256: af91c0982f5f79d51df0f6ccb28c7f0075ef330e09371cbefa660119a74f28c3 *tests/test.key
keccak384: 7345e13adecaed861e2b1c30b2f107265f80e6e6a2670d00209e18ea4221f696f1301fe1824b5a4caa6dfc1688b1fa9e *tests/test.key
keccak512: d4dff58d79a22e9bc5150786bb1cb3ef5598fa8c65bf162f55866560fc3d05852a5a482ff347db288a42f7a1ce7c2e3e30fcfccc7792a6f7cf85cdc024ca9ba4 *tests/test.key
md2: 0b327a17a102580ccde8081c18f137c7 *tests/test.key
md4: 6df7b3c1f7fbcbf6b8246dc0046e9d6b *tests/test.key
md5: 48fd9ed11c633069c3cf721611696a73 *tests/test.key
rmd128: a78170e11d56605eb0f5e05e6a218e61 *tests/test.key
rmd160: 56236b14cd15958c58136a295fa2b07c5edee009 *tests/test.key
rmd256: a0a658b25b8841f20be8151eb5e2c1229f085dd5cf7aa8bef4c8e07ea5738913 *tests/test.key
rmd320: 2ec15ca947f29dd8cef4782aeaeb4541ac00dc29e1649c4f5f4578ef0287091e513f9da423ce7319 *tests/test.key
sha1: c17a11eef02d7a2ad7250bc2ee22bdf37ed21f0f *tests/test.key
sha224: b226daa069512c849d55866470c23543d87e1fb768171efdcc6ab59a *tests/test.key
sha256: 76ec7faebdc42a4de35ca70024c2d273e9f7856ca61612e89f5f66350ba8cf5f *tests/test.key
sha3-224: 09525d6410c462e00e72ccd4304290bc59ff2b1b8e5322dbc197e169 *tests/test.key
sha3-256: b9016fc9976545ad0183775d88f20df5295d40b31db00d85f6916333260b8ae2 *tests/test.key
sha3-384: 5452977763b602df4185bbe7cce193346b09ee20d4a45a780fd44237e335ceaa71b9da06242621e159d796db9043c9be *tests/test.key
sha3-512: 1fadf63073c8613d38d5c944e2e3f7e086d94d93dceb2eec1e9693fd44158f3127c90cbaa8a13035cc9ff9b3572c9dce836bea15c92e8a78b036ec382caceb0f *tests/test.key
sha384: 7cc080c662524617e56d5a49f1c185909e9b1858a86684161ddd97fc5426f693b53f59d779de16da25dcb1259df879e5 *tests/test.key
sha512: f90afe4d254716a9770fd2c4f29ca544f2975f961cbd7fa207117383e4e48f7a2e1ade4aac333a2cb8c227dd6af2fff4d87c31c2a3916ae24d507c7c94c21818 *tests/test.key
sha512-224: 64ec566b5c2de736eab1b4e8542dc110f736819ea7f8f48e3712fbad *tests/test.key
sha512-256: db880bce4beb7246510febb961c7595aab57a15de6f90cd079f145e476b5d773 *tests/test.key
shake128: 9acc6823e58083f1499718d478ea42f75656b4780800c3b105678c4985cdf3a9 *tests/test.key
shake256: 29d0d19db50cb5b90a7ce94883a04bb6a97b0dbb9a648f342d7032d64160dc7019262ed0e055ee209c5a0daa92f36004c9c51d70402145908b4b6e91ea15b5a1 *tests/test.key
sm3: e03629750a6e6be2b1be1dde48b83be44a7ff19f1cbe3d9bcab540aa2b7e4d6c *tests/test.key
tiger: 97d713850e7affac30a642572c1ee7b18793d5b9e0ef5932 *tests/test.key
tiger2: b2dfd53b3edba5b54e1f21a82cbf6a3475efbce33a8cae03 *tests/test.key
whirlpool: d7d41c755e0f28313f254cb198e0bfa42f56670595d97b80dceec754825d69938a9c11e5bf16e9a3809a62a09bddf021f3dbff4302ceec7ba46c88b41772b711 *tests/test.key

File diff suppressed because it is too large Load diff

389
notes/ocb3_tv.txt Normal file
View file

@ -0,0 +1,389 @@
OCB3 Test Vectors. Uses the 00010203...NN-1 pattern for nonce/plaintext/key. The outputs
are of the form ciphertext,tag for a given NN. The key for step N>1 is the tag of the previous
step repeated sufficiently. The nonce is fixed throughout. AAD is fixed to 3 bytes (ASCII) 'AAD'.
OCB3-aes (16 byte key)
0: , B314B579B54365D9094A8A7544FECFA7
1: F9, 3E49FF310B88634BACA91D55DFBAA185
2: 04B6, E13FBD06086CAEF7AD042C93D7BB6FB0
3: 5E9389, 04216D3227A79ED90D60637AACA49318
4: AD4A090A, 71FF49510C87EE5FC004162F146D4C1E
5: A3D8218932, 5AA9FE79861F6B5BC8F3E238D0221388
6: F8FADE0FFCCD, 04FB1C91F3B23E58F6B9614648B1A653
7: 92C4F8CC40044E, 232C049DA70A9AB4B6B3A03B286180C1
8: F93B1744D7C77AA0, 21FBF572E7FE551ECB5025BDE9ED5984
9: BA51E012FF90E40800, 117280C3D04F2376D4B2F020AA661146
10: 71CE4295BF396C6B2338, BE21F998166D7EB96285884217FA8086
11: E8BD27F4EE71D7C8B92B32, D6004359B714792C44B1EF5F9CA04F3D
12: 44F561EA59DD0DC2A2FFF982, 6AAE8B19D5D6FE35A510E53C35C74AE8
13: 644B54237E20C68249B4FCE531, 806FA9F25EA420A8B4CAFA7620C7256A
14: 2AC152EA88E036E58667960CAA99, 04351AF74BC428C37282EF2A85C85B08
15: DBB19579CA7E525544CA6893556BE0, 6847407644710A2DDDC128E4C7223FBF
16: 457557479FDC7F70CCDFDDD53EC950CC, 8B9C8D93E60A881F625B82E200B021BD
17: C07EAF5328D338CA4601560F513A2A4AC7, E882049660635CF0D13F6058773141DA
18: BDEAE23389E05F719CCD723DC972F2C884D3, 0E40806F30CF1F788C3C6D10B89096A2
19: D5F334BC7A5196E460D52F89E129F33D2C9F91, 00C4EF195CB474CD880DF1B6915EA357
20: 74435B9ACFB72DF8D67DE0BBB2F18F34EF1C5962, B33A91F1AFEE65F56C781AD7047E55C4
21: 31618C38EEB4A77E0769131E91F4814C7DFB825409, 8307F47A53FD8CB7B82211E8121738DE
22: 45ADEBF8F29313F13C3919A4246C96142485B58D074C, 268C4072B1FB58F0491EFF34756C1250
23: 2E11364612BE88875F506FD6603CBDCCA10188B3F6BD79, B782DB9E311FA0C3F1489DA839CF37CD
24: 565DB17A001D87FF3B432D80CB6DCF84A389E306845D4BAB, FE514CA6EACFC08D6CA02D4F34CA223B
25: 7819A4A63E4ECE3FB6DBC5208A5E0ECC5803E22F28C083C6B8, FA00969B7C91711E0E70027D13FF0407
26: 27186491315F2F00D125C1266C442FB3C7B6FC824DE4A30B3EAB, 084DA787A8AA2D108B95F3A5B69BFA52
27: 3545DE774BF9CFC3AF51602CCEAFDAD54302C8FC75C3FC1794C6CD, 68A18C2F767BDADD023D85B722BE8D6D
28: 73AB104D83AE82A4D0AF53065D488EEA47C05E201A667581BB046E98, E65DAFCC4DD662232C895602DD8C7582
29: B7B26992F361B7D9CE2782304C6C62495E46216304075A787395948752, 38F99FA3C086CE6B2620302931DB0BC8
30: ADB1E4FC3217F82C2851122B8EEACCFB1C731565AFF856E201E8EEE702D1, 615A3A991F4BA240768FDCB4D9CF16DD
31: F2CF0958F00F11E8564CFFD9AEC71451344E2A35DE7D82D1AAC14649BCD34C, 04E97E02B50CFCC86EC0B9A958057F66
32: 914755B90B12CF5720CC0176AED145ADEC862E51B237AFE862477CF91D729768, EEDA6BE8E7875AA7E1E3393DE81FBAF7
OCB3-rc6 (16 byte key)
0: , E55863F7B850CEA28023BA8E2AB1F4FD
1: E5, C1F5CEA421F84AECACF622BCE507BD21
2: 6443, FB3B7992E057AA4A0E31E8718093740B
3: A1E36C, 0BE1B8CC538E60FDC36165AF5D273F41
4: 4891FC23, C6ADA69F1A613830CFF5E564F01FEA93
5: 6AAFA8549C, 6DDA8C3720633B9E83BBF2DB356EEBCA
6: 254EBFFB3C60, F092EA5FE0DA6B90DD5F2FB75FF92960
7: 1DA9F258ACA84E, 762E38C6545C3ED4AF970B09C6747CFB
8: 289067E54AF4FFC9, C04CFAAC0D919AD6027A7D923705443B
9: 65E083C54F9CC7C228, D6A4A1AC4144217BC07329BCDDD6F27F
10: F78CE1BEE4471E9830FE, A503FBBE2378505EFDD50AD4FEE587E4
11: 31874B00827B810588A635, 287CE2ECEF9247BCBF7537DA052E6A86
12: AC8CB1138A4BC5A19BA96DC3, F443C67A2CC51FE2DF38A8B6C0F08220
13: EFBFF1BCDF7B3F66A402A01459, 274A2DA9F33DB5203A1EBF90366E5064
14: 7A47F5FBA688594319CC14B33458, 9107C62E140339F3FAB445113331DE4C
15: 69957805FC3C51C59F9149306CCED0, C887CB0B1D880BE0ACA16AC513019721
16: 6735D0D5D2ECFB68B718B8A95AFB8922, C97E9187ED00C6D9FAFC76511BE46AD5
17: 00F51550A1875A3517FDE2A3038E1CCDAB, CDA7AE39A8B8708E91A3EB7C94FA7BD6
18: 85184BEF9A31A8F4CBB5CAA56FF5C63845EE, 5BFA7FFF2072E7B4D9AFEA21D23755CE
19: 025F6ACB1A85173A639D8FB24ED4B1E08339B8, BAB248C26F24FCAA94328C9BB0821E55
20: E18DA8E16897E888C73743E0BE165A6F8CC94A04, D759682D03ECE0888B07915D6E3F5FC6
21: 6B94BCF8DE2F326BC7D6BBE1FE7B744E25E717CDC3, A69D284CB8B279297A4FEA3B6561171A
22: B9AEBFF5E08E82451A486BFFAAAAA2564F36BEB8B00D, B0F0B98B97DADF33B25AACE289D8BF9B
23: 5F3C5797CC821B3A3B8559C5A5AF422F85B2803B7A4D9E, E01492AC89D7CB9F87FB8B23B6E55152
24: 2760B653AE34625A78ECC775BF4584DDE6B2D0A1063C7B8C, 2FDB63B68839C6250E0C5F16351C31BF
25: A5CD59CCA78AA4A95B1C1CAFABF90230FBC9F6BE66E1AE7575, 0EE3390FF12980B9C3DBA27802FA7F01
26: 4E9D19900631CBBF3F2326C129C90AC6B5BC3889E1392A05E542, 3CE0EC540949EBF4D70E98B17BC37D58
27: 5448E01EF054DC8B4B6C148CB05D5A20F50EBDFA42E59FAE178058, BD64C93FDE56099E206AD57958A259C4
28: 9D62242B65C51F9BCF41177BE9E992AAB7721A6EB3584CCB25FE13C1, C93E44C0AF6559D8045D89B98CFF59D4
29: B72E80500D0ECA63727E82569B3BCE66F11DADBE374BD0672D0880645F, 8419544A26D030E30085ECF8F97896F1
30: 28F27958226709140EA0867D285376E1B14890F44A18A219E1CAB02FF62D, 77CA96AB5A1F36E7564B7010ED08E540
31: 80F7CA76B988519731D76C4D60DA0E5C77BEC17368C9B237AE60A910312334, 962C1F0C4E7C8137863A48E6E5BFA44B
32: 1B43CDD2D0E13ECAE95F2DE4782760679CDCCE5E74A3C3E6614BAD86DFE073EE, B5A6A14CA26E60AAC3B5C9DB0723ACE5
OCB3-safer+ (16 byte key)
0: , 8F56A79150DEFC6B2CBB3FB6E359FBD2
1: C9, 8E316BB1D0C29B6D7A5A87099B85B72A
2: 2060, BC6DEBA562045204F685BD4AD1095614
3: 0CB79E, FF5C3DD5E0D3C587F73B79871E18D92D
4: EB055446, 68712BEFD76001DEBEB0D49FB45753C9
5: E936796698, DACC5325D10076E3454EA244FDE2C446
6: E64E038A3E72, C790A04E48892CD267FC323EC8606BE6
7: 3530F74D417ACC, F0383D56F2FF810F37DFEC884A7F0189
8: 2B616C4A95A3C681, C2D5793720F925F74693C7A8E117860C
9: CE0C99100C05C3BB31, B1F94A461CD2F81E31AABB949E2B2866
10: 2F4556261D59FB7104EF, F061D0F70B0984C57651ADC2C500FB90
11: B0DC48C26496AF66330E6C, 68276FCFD1C9AC88C54429CA7714662E
12: 5F2ABA85E68BE0FBCB8127A4, C1FF0E5E54CFCB1109E8707E6EFC5548
13: 52560F88ABD9EF2BE8F5693CC9, FDC0F5DEE4C0739869C8D310EDE6D8CB
14: 3FB7DFB38F9CB53B932C09BB4953, 156BFBDE08F2665A3F7C79F711042B40
15: 09031E49212D7F8706DB42929EE5FE, 8A0F8A6634EFA7E56471178F6F906CED
16: CED816F12E02E14B312C6DD520BDD936, 4FE5C914D17C426A3BCF5799A4BE0FA8
17: 30180417B91D913762B8066964F01F7050, F9FF5A968C3B5D6F6F8ABD5BF23461F5
18: 9135A4CE4F8DC27758B9F158F515F89C8B9C, 7B3E446236E33F999D7B586205B55D33
19: FE2BC52A5AD051401471D2487803E2F70679E9, 902CB619F522AC61EE70C5407E23441C
20: 7FD71CB30B9836C6CABAC78AC336BD5775EF3027, 7E6419511E3886BD3736D1BE13FB8599
21: A946EBC8A4F779A6FF805B2B4F9D166479A25C71BB, 850E57C9BD78774FC4CF5BB1A956BD4D
22: 1F3101AB8B7FA06DC3194D66F3997C990C79DD69669F, AC4962DAACEC80D993E52A2170ACF145
23: F8BA79427B329475C7374CD1F48518C5064D3796683978, 39D4EE512DA456B0E6EBE7680766756B
24: 52CD976F3DE59CCAA8E352161BD7867C026D39142FDFADC4, 7BF77402B6CDC953487A1A4C87AE4ED7
25: 1A1D64F1B73C52B698FFED8DCED76292807AB3676004B63064, 6E16BCC6F312A92E80FCB10DB8BC659C
26: 171AF49F6816848A355D92E7DBFD769587EA2B988076BA5D5918, 9F821AC305325BDB9B12B44F82882C63
27: 025152E05F44E7F05C2B4BA3B0023544CFBBEC8F9A98C13E931E2D, C8E3228E2B74FCC935BE1802E092C346
28: 96B96648528B740D15504E299E619A6D0B129407DEFD04C1BF405AA6, D0721CC578C44EF15FAC882A8F49617B
29: 9136905B84ED8A403CA83DC0DE081CAAA0F8E4F775FE0EA1E3E20BF223, EB474F78BFB6BAC8E1B1867ED405DC38
30: D65A403FB587A6839C071167ED096B46FB480468F7C1F702F1B2479CDA5C, 8E82A3BA76E1AFCD82E324FEAC9E3084
31: 017E3A54463EDC279879A07FD7BFF1225CEE307BD8741B6013FE4C9A454EB8, 10449A44C1F90C64CCCA5D808AC705A5
32: DB9C895FF4A59D407344B8254FCD416F0D5EDB2ECB639CF226DEAA76370FB79D, CFE8C49CF0E323F694FAB1805A85DC93
OCB3-twofish (16 byte key)
0: , 924B3293251DA82CC6843F4616DAA68D
1: 01, 4B07AF17FF5D6C2477E90B7843F19D1B
2: 5CFF, 75BF06BF38FA2BEC8A3A546B9E29741E
3: B31197, 0923C75169AAFCA604EDEFB93E7C5D83
4: 8AF83046, 29C744B4A6A1DB80CF625B490FD25A60
5: 0D0AF40357, 477754E1995FC70B3D4D7E6D6DDDA77F
6: 9E6765559AED, 389733D5DCAD65971EDB674B2479F13E
7: 113AD2738DB565, 366AE5F327EE4BDF2CA04A3B82FA3A3F
8: F2235181D51EB014, 3418DCFFEB24E4D94DC72F7F3876A978
9: 303087A4458E3063AE, F3E6B83CAA0A07261BA9D384087D6D5A
10: 98FF08F0E42331B68492, E532298F60E06BB72C57596957400E16
11: CD40F0F4D8000E5096262D, 8AF824C0EC17FF0F88371BF3E05AF7BD
12: A7EE8BD81168FBDC359375E9, E20FD7E1914136C94223F6DF67386099
13: 8BFD44C8A327E7835A9D43A52B, 7AF41E1B25A7BF4D1F5868F0E047E2DF
14: 8DAF93847C1B3D8220B7748A9823, 9787A3B32FD7EE08835DD7A9277F5A4F
15: C602FD9F13259C4D3E3700F89CDDBF, 5711A41B4666248FC3FAE3FE8FB9E861
16: 972734035B0C78BF774279BA3DB7CB0A, 23E96A558B3A64D95FE1669923E10CC5
17: 9D8B4DD8259B51DAC20C4C64693E20AEC0, 66E07F2BF239C0541DF19254F53820CC
18: 4F76EDFD8C101BF1A20B9D337724BE0019A7, E046081F3CBD112CFAD56D9A32FDC6F1
19: 59B667CDFCCC1634C9891DD0D3809A682EDA2C, A0F8E38B41BD82E8010F917F4629184B
20: 0DBF3DD74E0D165C095468824E431B8B5650EB5F, DB7B71633206184ECD6157060DB2E443
21: F5A457AA7ED8C131ABE99EC2C1008DA022D27908F0, 794C3E20F41E7D32B70BF043DBD0D86E
22: ACABF3932E154342873B1EB770A3E5E31C629090EE8B, 4D998537CAFD3453A5D748EF09C81B69
23: 850CA96B3B1287A8726E2B11B7B17EE321CF7D65481F73, D78C52190C81FCCAD299DDBCA72D95BF
24: 5060CD915C916D082579B571FCF340E82224A9704398E033, 30EE449934C54F531D2702F8F1B9F510
25: 0C47F5CAA3F2E8ED47F016918B634474B004B357A35337F14B, 9D749132486F07B06D25428B592CD767
26: F01B95D67392793ED557D2C7289CF899C053ECC5E8BD28BA662B, 3760662B33EAFF659DEDD2AD6E7B32A5
27: BF8B0FB0B069978F0EEE2120F61B6437969C0BDBA700AE279B3239, EF2A1D664F26DAB4F9E8142730C2942F
28: 64E68C83E76FECF44BE02B2E44F182C1F6A08B8DAF396BFA3B395A18, 55AEE32957B9B15AD35F172849308919
29: B594643A43A91DD34A75D30B259EEAFB75145C91D8A862F2526CF47A35, 0E60E4118213E89C28BB71A8003A94FC
30: 5D2E20D31A1F6C48EBF52B63FAE1CC09C85F2307E509CBDD4E8771B65787, 11D347399697D4955028F7B08EE32B93
31: 8726247FAEB21D7F8927DC3E90267ECD744A8452C64B9EBE08D1A590BFA1F9, 8D75DAEC7E4438E7C701A392346EBBF6
32: 0DC0EE528456FEC203AFB12A55A4D3A901B9408958E5387EB42E75730D98B6A6, D7D682F57C1E1671BE459EE33BEA6B26
OCB3-sm4 (16 byte key)
0: , 5AE4874946EAB321286A5C30AA6B4B12
1: FE, EAFB170A60CCAFC101780C51A35A77D7
2: C914, 36606CD5546032064EBB2B2EFB962442
3: 6CDDD3, D7DF2794D1169B1097701EC7EAC97ADC
4: B9EF5F04, 6CEC2C898116792A42E3C823C1274A2A
5: 77201EA353, 40B522CEDB325AC6684F6560C0282555
6: 5A5A86063B5E, 9EAF522E35E9AC2D2AE6F50F707FE8A6
7: B04D78AD924054, 4CA7F758F395154EBD95BF0BC8B28618
8: C089204BEC680CFE, 4DF7DD68E7F468FD070CA876949BE593
9: 4F368531FC342799C5, CAD9C6A6AB8DC5445C8D48BE005819D0
10: EA61FEF7AEA9EEC392AF, 9FAA6F9A39CC88F9F4423534104E26E6
11: 55A79A6EF7F1F75C42B172, 4C8D817200E7A9368866D5DC9619ACE1
12: F0D1A7080D89189D052C7DC1, 7903ED2CCED2DA132DC480EDA4178650
13: 7D55F3544210EBFD2BAC6BB18E, 903AAE3C64CD8993711BADACD2014BB9
14: E8FB86041ABB30374C19B1FBC542, 03ED4A92F7CA8F280F6148E48D2483F4
15: 5DAEBCDE1C64601175B5A6E446C9B9, 1240BA45F11091457D66FA5C58C08D6D
16: 2A4F6718D7333C9415AE69CE5CEC431F, AF79781109795D4BBCBC3C55327C60C4
17: 2FA374A6724EF7CADB0896A3BEBDD1661D, 0105D0D05BFB6E1D1990A20D9294FCD1
18: 9FF356181B833CEA5A0903D3373A8C310B0D, 82AAF55237C5D3D587CA3188B6B57CBB
19: 13CA7A42D6E55A7A03AA09BB77F234DA876A7A, 914B59E12935290A8D68D0F27762D745
20: EB94DEC2EBAB6A8C2D1E412E4F3F337048B3B301, F43394E403FD4F7EE07CF59D4A6ECAF7
21: 8BDDCE25D442F0BDAC4CD1F0FAAB6B0B6D049734AA, 6CAFB1D636A6112402477DE93B853AAE
22: E2298B85A6A6E7271857851EA90E584743B7A0A029FB, 64105E77B6A8C5A4739A1393ADD6E37D
23: ABB540427006B696F59666612E5D123A02CC3C0F908867, 35430C4394E6A7128FA4CD0AA66BBE9C
24: 8B048DB31FDABF2746CF664ACE1B8B138937BCAD03612FBF, CFB7FD35560F1D0E3EC488B799471544
25: 6936BCB5A10B52D27FD13D259D166C415689E1D7BB2F669EAE, FA4BFD853500C958DECF8D77A31A8F46
26: 7C0415C2C28D6F9895755EF3E1214FCC96F3AF2C70DBF6948031, F6D370B244D7F5A6F301BCB5CED7DEDC
27: 195B75E3D72FF9AA5492EBAC7638A8AD551EA9E6B541D9689A5465, 1D8A1BB3A38ECA89ADF8F3B48F34682F
28: 70522F78E5DB3829D61540C641A6C2FCA75BEAD1BC7DC6C3D15C2E2A, DD5072319ED0E24E4D3EE931CB82B3BE
29: FCB983E8F38EFF1931A01E7CEB5AAAF15AD969C84DA1BBCC39E4F45D68, ED463576EFD354B7FCBAC13EC8DC0708
30: CD507929D9E5025781958420C66B1EA4F5397C2F467764591805AEB2A095, 6E0B6BEF6C38D4424926B6DE1B4C315E
31: 782FD749F729A1546E3C105DA7AA2CC6541ABE4192443D3D400C4D6B88A78B, 207918EAC7F7B92C29D5DFB9C3779DA5
32: 4E23AE32EF1C9877F43C0FC3C285B422387EA18BD30F7F8BCD1DE64B9BF7221F, FF6F490EA358433EC439AB1954C6D473
OCB3-noekeon (16 byte key)
0: , B23A40302652E204B694EA78AF5A8FCC
1: B1, 5245C8680A6F4520168B173A39661249
2: CE8C, 05763A489DF8B88DF01862007B2D6655
3: CB7D55, E14463F2230FD60AC779B5608F708A13
4: B4E9D036, 78A9A918D7CC6E742F22BBAB7781CC7F
5: 0CB35CAD63, 1A010E65263EDB85039E81B8BF88B978
6: 7094335707F5, 8EC8C49EFBB77AEF2B443855760CF5D2
7: 734E7D94C8BD6C, 5E701C5886A72499A79B3DB6A6F865A7
8: 5375C12BD7B724F8, 3C12E52B9E0DB5967AA09C84DC4D48BA
9: AE56D9F446D45EF168, 297EED4ED9671F7D9E6433E189C754AB
10: 203F357C80E760BB0D47, AEB8CCB8AA3D0752266E9BFF4B501832
11: 12A9F075BF911C0691338A, 317824AEDC90F284C3702A651BA50488
12: A4F167C8D051DC582892E5B0, CCB64B2CD8CB62212003A4E0A4065B23
13: 42B2F2B5E43D407E2E2E047957, B81F80502CEE49C84BCE21A942BD6206
14: BA5562041E71339AA676E1BFBE07, 7C0920E33B1AD9257FC6FF8732EE4BBA
15: 1D1DE906DDBB4C3FB367DD7FB59622, 10D4E97FF5495A4250B60A1238D21B3D
16: A06A25AFEC795738D0ED17542EF1E691, 1D31E82501E1779FC62E8A2847D89631
17: F7BAFF86763A1BE37F6ABCAEB2E8A64411, 4F3E5E7009B8A09CE47ED7E67D9B6B0C
18: 15A97D2BEA9DA105282144776C710A047F1C, 79406BCFE7C9E8283AA851ACE9D40AB6
19: 80FD02BBAD283477394A3DF93FD6323AB2718C, 30FB621D3A41DD01BF8F4E7EFFE93C22
20: E091A9D6C14A60627FF6BDC59DFE85E9528AF3A6, E8D5A085BC63B7AA48761FE4431A7966
21: 76FC712E7BE90A93015045E96DC102FFC2DAF113AD, D563F913F2A90D653C0764F276F8D0D8
22: D4A6E1FD6DC7504CE40F4A1A7B9342ECCC03CD3788F6, E6C45E97B3B2E00C2DD0C639EC056485
23: 7DB75AADBA75F026F430C7B9A59E4E0F228770990512B1, 09BAFFCA7F69156C6ABD5FA7A8F1F39C
24: 18AF0400D1FCC74AFFD5D2FE4F8224A29BD17DB2294F89DC, BAB2E20E100E6292658A7BBE67F96E13
25: DE47E5BD43101F0688D7149811511E549C8846AB71B35A12F8, AFD0DF5FAF7821759DE3AD928B239570
26: 1826EEBA81A57174214F9953BA88F4324456127D7F7ADDCA8036, A03FF1F7B71611D8E9B41DA61E191A90
27: 73D79CFEC44F7274720BC73B7F2422BDB79A9DE6245B08B006F654, 00F66AADBB4110E77A7A788A1B0CB4B2
28: BA5F0C34A1DF413378C6F49E09BEDE1ED757935934C1FDCD978C2B3D, AC286CAE6E7C3DC2CEE3B6019F5A1662
29: 231AB287C2156BD0E590632E057D7EE92B6DD7976AFB75540FB04FC84C, 12420BEED7F377C4792A0940EA91C34D
30: 7B06F611F07763C65EA542EAF679DDBCADDA4B61238F489331184FAF764D, 56FCBC05F1E3B57286B1AE881FF04BF4
31: 17C5B1127E3D08737590EFB2FEB17562E7FDB4B21A768595ADDD9697CF9B46, 6F4BC0A033BE040350FF4958866BDEA0
32: 4667525E9B39821CF08E6C7A7E37A5020CE23F81DEF05932113E9A6B5B3F9BCF, 5C0350C6F7299192947EB22ED415B05C
OCB3-anubis (16 byte key)
0: , BAF3C352341E4E8F5E1FE11C9CB3E151
1: 1E, 01BAEEA2431B9106129937F135D46215
2: B586, AC89B511AC5F80B2E6F9E6BC96DDCE15
3: F28FB1, EFF43DCF8C909D51ABD58CE44461C35F
4: 2AE6B0DC, 36A21C9193BDB12FCACA73E756C6D75F
5: 4A37080738, F90B5BBA5A103EAF4ED01FF845F7F6C3
6: 369B9FDCA431, 85C530F58C7DB80C6E8B1F3A9A593C69
7: DF0388D34583E9, 4EEF27EABC10A78488F82E8105C52C2C
8: E63011F0E310F68A, 8AC5A7B20B6F4E160EEFA6D16DD868DA
9: 93FBDAD02B07A03C8D, 2C968FA16435934EB40F27019AE00F87
10: 6D91E68224DEAD679298, 2AE270894D8618D4D92485B51B7B5658
11: 53B08EE1F8FFF2590B7CF5, FC9A33C9221C06ED7EBB1D3C33BB0FE9
12: AFE762CDB97A411E0F6D8422, A9A1028C6055FA627007E65CAFE5618C
13: 781464F6A0739FB8EFD8C6130F, 1DBCCACDDC218B76FC27F444FC0CCDB8
14: 1F9AEFACB5D87693CCBB9D173529, EE13B9890D0E05EAF61E1BBE8B0ED0F9
15: 107248D8D565CDBD520E50A139531B, CD7220BB19B95C496FC901C831AB7CAE
16: 1045F21485E1C4FB812D9428C4D29D7C, 08035EF80327E3D238D98A09E3B48542
17: 68E48C74D09B7D07F38BFD1722F6DAF18D, 9D94E4B7CC4F00F1716D830D953E1DC4
18: BF9D274E7DD49FA2ACEE1D65DEB0A5A74D2D, BB841A83356BED14D2A06B5D7F5F8556
19: 4586B730D46E9BEBE34EB52242DE954CD39B90, 40981229C0DC8D47C69AA261D2BC960A
20: 11038CE2E4AB2D2F8258D4DEF25F102352468350, 1EC047D2BD87BDDF02068BFD5742688E
21: 25E4D441758E4953D463D0BB63CAE2B8D5F78B7968, B548855DEC4C11C10F74983D6B426A41
22: 1711526E226559666D2439881650AEED6DA12EA01A72, EE6D4D29BDC8EC975ED90340910EF829
23: A70447A0317930D20C5EBB0841528802B948DA7E437EED, CCB551453425652D6535DAD0A5890431
24: 57D82A93F29B4B2C2CE4D2326D2E224836F0857EC8035972, 87E1F70A7D4140A58851A2C4F0E39F0F
25: 5F065C6406B07A8CA35AE0F05D0D48C631C6FB3D7655D5F6BE, 2E3EE16DFA370D0F988615CA063DD62F
26: 3DE835DAF81C17F45DE11431A6F8294FBDFC062F237A7DF30E1E, 401F8841A7D97F84438B905D2C03A416
27: ABDF9D5E996364C628D4DCF67ECC870117E8CC5A6C52E4663C26C4, 05996C80448BCB0C4B311E05AD0B4C5E
28: 1C2401BB1DA2CEBA1BB56C69728FDAEE42FBFA374E57DE1C593494E6, 8491B62BBF372C671C311A97C173BBE3
29: E504321BA399FFB6E3187B645635273A92C63D014E337EC266334BEC7C, 026444BAAD6C4EF67C660180CCC6E7B4
30: A61D3FCC22988166F57F4585E936CB8CD714713355593780F54EED1681E7, 3507D5E0185318CC4577C5FECB3A348D
31: 55AFBFA3A57B960AC0F8B3DAE6EA60165FF7D5A77731B05BCB7E8C647487AA, E25444D551A823650757DAAD8ED6B588
32: 5553F81F123EC0697C26B00BF20BE287C0A1E9C4035C8EB3036F6D58C8A3B83B, B7349CE03F264F816305A6D46C274980
OCB3-seed (16 byte key)
0: , A7D37A371F0B3596ACF3856B5D18B45E
1: 49, 3C671A1AFA5B253DD8FF67FFED9C33E4
2: B986, 2A069C4C6FF67FA6880D6EDA8490A3C6
3: F78307, AB6D00AB217E62E1C2863A63E7E805FF
4: C43CDED4, 9332E6E78B574354B866EB49B951AD6E
5: 47FBFDFF71, 14B3A25479FC36C71C837680871855C9
6: 4662362F3992, 28B8B162DDEAECC2AFD92C343C49D986
7: 64BE9B49D4E3F2, 6DD06663768ECDEBC64980E0FE11BA9C
8: DC6F456F02349DDD, D4CBE9414C65BEA4F1340707410A8D6F
9: E0C1166D7CA0A919B2, E7B742D40ACECC618A9012DA72C0DBB5
10: 1E9B38CA4B1D2E41173F, 6F87E9D8B7EA96249B533FFB626773BB
11: 7598A106F4A42DC2EBCEAA, 8A1358443F492C6996ECA14D41FCD91A
12: 79C43C511A13395E5F1D259B, 0955EC3B5D6999D1DACA88E4B4B0EE77
13: 39DD979B5CDC450D7E7D49136B, 78E5E86F6FE3EFC5827BF7F088EC8FF0
14: A1C18979318C625FA4FCB0D40FC0, 6F9508959B87F510F3E7B39FF3237B7E
15: D3A55B637FAF068BC97C52265B7DFC, 8C940DFDC990CAD1A08179784E668012
16: DC120E50B38579CB4A45DC7D45C29AE6, 2E0939B538B26E0009B198D5C3E6DE17
17: 266CD82BBCA8FBC6D146CD10DB417685F9, 0AE1614717E23EEFD5F9BE7916494A71
18: 00741031BC893E10F6B86698B4B3787FA14A, C297ED582832F4B77C7AD820F5637EA7
19: FFCF3CF4B06AA83E05E5C049DA2A4F1AB4843A, F2FB3E63B88B56E9D680560F346C6144
20: 381DDB2637F17F8FFC619AF59A4DCAEA227E95A5, 82D692BD1F86AFD28EE140D021E69532
21: 6267EDEE16E3FD95356079CC4366BCAA0739C5831B, 9D4F17B8A5E85E5CDD18FE16D6BE29F7
22: 0B79A1E9B3EE98DD6EF57E4F23171D84D7250562B4C6, D76DB52F53F51553C604FF17E23253B4
23: 1DED7558063E2F8B18514B8F5A3446981D6CD648ED098B, 0B209EE39335BD6336309D1DE1EBC379
24: E3E3CF278C9FB18005A468674E1EC0CDB5DB5B42ED1CA4D3, 772C852C854303FED2DE41F8437E81C7
25: 8D0F93686527DD62C4101B213B88930E375167E48B04446B90, 11BA6E13F45B82FD916644F859689AE6
26: 1B45865FB91DB5E93D87569DDB8A1CC395381E875E5CA6EAC1F1, 8BCB49BD6D413542DC88156758EF8CBD
27: 06C381B8028DAC54D785CABF55B47AD7BD2CFC6D66C4B538F287F4, DEBFCDB4E6C7A43B7D7E0983D4FC0C87
28: D71A0CE6A88F80CC922189EFCA5696FE5C8F6557AB744698E4A65222, 4DCB5B5B0F9794D776C4C63C3E00C78C
29: 23099CF8578E878B58589D6FFCAC8E6A74B373074D90E0F38ACCFB6117, A5B2C145ECF768842A957E47A8511D2F
30: EC19652D148810E8C714D184263FE7E961FECE4C9CFD30D6921C32D2D4A9, 74B900BA5F4AE547C19221081DDC1F91
31: 9DB58E1FEF922A4A1F99602710ABCA029E8A10383465C62967EB0A466F11AD, 08D4FF277C8DA53A2598201B255B7FD7
32: 1BD03BAB70BE842FDB12E49DEB04AE477335B0B3930E75A27C37EBB1594099E7, 3A6DEAE1C289763C4405DE86544DF401
OCB3-camellia (16 byte key)
0: , DFF7EA9ECD4E2AD37B9838E85F9D36EB
1: 1B, D5D37222F530EA2C282A4D8BC55A08EA
2: B73C, 5163F4BD7CBC03DA1B31C7C1105B5511
3: 42B8CB, 997087C18C191D560E3FCF70E77A3C15
4: F533FD5E, 15275FBDDED6459BFD8FBB8FA08DDD3F
5: CA7A675DD6, 11604097A97E10A4724799DC6A349F34
6: 00F4D4CAC81D, 9165C7B49928D47A8F3C17C0B029F44E
7: 8751CBEEC4D29C, F541920B2E92DE956B6468EF83DFECB0
8: B851DACF29824BF3, C16660EB40CF830FFD263C52C1FA8C97
9: 8646C3D808426E03E8, DB30D0CE9F7DA93162D69D42F0B4C644
10: 0715BC4E51EAF610956D, 2475EAB0B92533BD574550F316C86746
11: 12F6C6BE1A4AAD391BCDB4, F1F387AB03A4E36965CF41C6842950C4
12: 4F85DAC1AB5B6D48CFA75266, 57B3ACD0FB6D2F8B672BF097E7C559A9
13: FCD56B0CAF30F6A29324AA3067, 437461CFA9DE7562A572085439CE5B5D
14: 612BD3BDAA826CCCC76722699D51, 90863205C506D85FEE095B32F3E1DF93
15: 5C85AFD2B6A6FC85B282B57D48642E, C59DBD94D744A6F3745EBD9D4EBAE0F4
16: 64173080FB3CB43EA8FD41F23DB88587, D80103E4C578DD4B79A23372E34ED967
17: DBA50DDBF3B3F064F8E40967EB53769FB3, 4751B6EEAA9B2E49BF8B23A3BA13807D
18: 04B8D0D351F3FA3B3B3F641A244EF7036825, 6BB18750DCEBD39DC25E42233475BE7E
19: A15A0C3E91CE8AC01C8A5291D24FA0514453A8, 5DDC4FB9D6C7AAF7660B763EADAAD969
20: 6E223B742F768FA57651AD90B6BDFAA772E6AC04, C987C8A3A27605B6CE04B25777286875
21: 1FBFEA7AB374D972FBF76456048F77745D8E7B64C1, C301981D5C17473953B00818967E9230
22: D642F5D05092443C776E53D6FCF2B65F6D25E8E98F89, 5E87E6BFA1EBD436909126197B2CCAA5
23: A8270C56D2A0084670A0C5D8DA2B495A849D1BFC571912, C4D32192AC893C87C900EE2F80443789
24: 431ED5C50F16D509C8229156E9BF0A7E1998F48F0032D91C, 960F4467E129A002CAC3F75EACCC7D73
25: DB57EDEBCAA10C4B8E0194CEE7E778FDEFA88424883DC476DC, 069F456F5AF43492AEDC7FC24A0ED875
26: DC8AF80FE840605041638184A00F683FB0AB86C4067550B4DB49, 862057189AC987639992EA9F49C7158E
27: 6A67318A81F95E33F741C95BCBCD8623CBF26D2D8801D0E745DFB6, 22DA5E8C63CEBC5A6957FB1A01AC7571
28: 70587F34F31CF711F2558C7DB1B04334DD58D850930ACDD5825EE131, D2436CA4FC757B16509CECA1272A2955
29: 736DF200A877930DA3EC2FD0AF53F08285E02EFB519A443F50B9E2F1F1, 22607EA2C6F1AE1B73785554F9440F2B
30: 62248D90EA60163F9CBDFAEC498802AA816915273093D375B02BBE22241B, BFADB3689B3863AB997D101380F7156A
31: 41C092516DC494E4E165EABAF939858EDAE3D3DAE488D14EFDB0E850675565, F45307A495AFE24E29E2AB744311F07C
32: EFFEAF5A73C2A825AFEE12A2BE80406937C75D4264FD937A310FA57C7D5D01CB, 3B430C0DA47DAA069FCC5C92C5427396
OCB3-serpent (16 byte key)
0: , 41644B8EC26D2E17704E9672E35B7680
1: CB, C2A63BA8383D6B7715F9F9537832AB3A
2: CF55, 05C93C786C5690D7263D1E8A2000FD60
3: C2DC71, C5DD3ADFC37AE996864C668A4FA79661
4: 70B3C079, 196DC9A8BE594ACE825F71BE8ABDC5A4
5: C546167392, 8BFF55BAAEFDA76EC8DE7E5B301C1B78
6: 8F6B6E1C7DA4, F9C28EB7BC64C26F3C862AE5315C9C70
7: BEF54F32A4E502, D931EC6EA9165E4A23DE6531D728F79D
8: 862DA6C6C4C6864A, 8D087F4E192AA08AC14CC0E8FE735A33
9: 5336AB6945FAA347B8, 9CAD11FBE86011F872C68D85B7003DB3
10: F4950C42B79374E4C0D2, 775ADDAD869DD3B912444D33B8B98AE6
11: E445E8B46DA8623E3F6960, AD253749B2453F1D86D5D4CE91C3A11E
12: A9B21268031B0DBC8D091FB4, 11CF154818B007F9E2335DC2CE3692AB
13: 5DDD737D9CAAECA39E9A282CE2, DA8E7275360A6099A5FCD3EE4D65C30F
14: 66631DA582F7A1E8C35ABBB869A5, 71927DD54E189F5C43B68B675F00CCE0
15: 3475EBEF7803C8D3CDB8774FF7AED2, EE2D9370434B6CDC2DAD922265AD0E53
16: 732536E50C887334D05DB25F2ECC6ED3, 9233CF71135D979C27E79FD6AB7DAF25
17: AE5BCDA23B70894E1192ADDA30A10FE30A, D05D97B23D3F813622DE7A7EFC67BF8B
18: 65F2023E4DF6006180709A239A5A9387D649, EDA9F67ABB96AC268E23BFA1F07192F9
19: 837A31A15D3562C99C1A108CE27F81CDEB1245, 91DBA8ADA9BAC949B22B86C08E04C27E
20: EED3C97EE7CBA13815E6EF5E22C75A7D486BF274, 714DE1E7163934419D650D99F1FECB77
21: 59E589AF5ACD014D4AB450490287E7BF766CBDD131, 914DA019D53052AF65BC066112FE7CCD
22: 9F8AB009C4A3E849C8055ECBD7AEDD6A1F70426385C1, 6654B56A1D589EA5486BFE902C355FA2
23: 532438DBE6E47A8729EE02E8C47111E4D7B90A7B098499, 34F3A82F9D7E6BADB6F8CE7193D81663
24: 2FD29C61D3A70C9EDA7EB42CA3DBDB1ED24E20DBD5710F4E, 4CB52CF090FFF15974236428DC0D321F
25: E3E404730231203895EFFDD83495AEFE265D4B4F122EF32894, 3739208F2E9D9AD3FCA138E8BC399A65
26: 2FB6945DFC9144D25C505F991C154243B5BBEE43BEDC3C9F3978, 2C291D274D751C93DA3168A45DF7FF2C
27: 11F244A9265C3D0FF8DE581F28002434C395458143F94C02BD7A55, 8B73783A1BEE7CC879C8944BA15E033E
28: 7AA49DCBC09E877CC91714FE6CE2CADECAF9DF771197DF0EAA2B5B20, 7DFFABCC40089E828F3C1A4DBBE28A68
29: C05269D72B17120FBE86397D655279F7C198467567F0B1FA24BBB077DF, E5487A7BCAFDBC08342369DA09FABF12
30: 7F97808D172665B399495FCAA6A673010E98EB6ADB25C1A41CF0F957B958, 33E6CA26292F6E9F55EBC6BFB3694E89
31: F7435456F02EE5ACE92F7E1F29D239A09AEB487BDA78B08A40837547CBFDC7, 86E15E8711A93AE7F89808D21BD69AD6
32: 9D49A127710AE66D612C8E7089CB254523109DFBB0ED2A3E44412C3BD81326FA, 624FA0DF639EB14A5A337273886E6CE5
OCB3-aria (16 byte key)
0: , 9A8EA3D2791D38324C9BACC96BCF82CE
1: 19, 446F5F8D49C6BAC154EA8384E64A1D48
2: 5A83, C90961D9AB29CECAA99F951A95D23F22
3: 807DDC, 3BA6934C1CCE61E9EDA066E41EFF0AD7
4: 327F5BEE, 0318AF9016A92112CC543E031A1A51A2
5: FFF8DC35BA, A026C07E6DE112EE2B8498A8F396042D
6: 5B5F1FE15EE7, 0318F0DCDF6E9773AE2E37D5C5DB5A99
7: F2C6EB3475234A, 9D6110EC3D8B616F374EC39F6C275D49
8: 4AA76358FB75F90F, CE3863400E138EFC71FD4205CBCA5D77
9: EC82D7475865843ADE, CF515D04E6739F3A0A8B819BA3515A33
10: 19C4E18F818398446949, EEAA0AC20B13766BA15D95CC9464097F
11: 86F1E3908368E3084DB6D0, 9C00BEE8D20E35EA3EE3F81FB474EF42
12: BAF2D547F49B43A60418357B, C2C9BCF9F1B5CAB46DE38E175592BA3C
13: 5BE6212E3764AE40213683EB13, 861258B08C082561494E73768222ABC9
14: 4C17C291FDE263C277FB559D262E, 6E605A88B38F7E5306E1DEB145970F4C
15: 6ACF32B0ADF1AB382DBCB3F8ED4EE3, BF32F0C42281A24024E0BDA55F67F649
16: 42DEF2781B15E36A450A4764841EC4AD, 787EEFFD05338B32935225CD9844EC5D
17: DBF633AEADBB9005FA8A21310AD91C7EC7, AC70191276E1E5032FBF0BB14E51F68F
18: C22A89EC15DCB4B5B3E168B2A424FF4D30E6, E4DD5206C09735952CDD742D889B4815
19: 88146C16D2B00FFEA71408F72093290406AF1A, 51DCCA474F2AE7D311537B0D8ECCC061
20: 796C82E676AB7954CDFE20CB7CA708EAF78D3884, 09730904D0C499AB8CF493A0B02E438D
21: CFD3CBE0AEAA34880FD193D5F4DC4F6102AB55C93A, C5FD5C351C0345225B7EC8D8D50AA580
22: 2318BB06AEC36FDA7827BE179C75E5874CBA42FB9F02, C4A2C3EFC2E443A8E13C73BD5F8B7A38
23: 5FE4AFB1E643F87CCC1E82118843B116BD6A3CF0096666, 77840F0DCE8A8C51F2D77B2634C71302
24: E25A2D277F5A592901159534E947F0D20F448FE5F5E938E0, 1966E0C0E2DAFE83C904B34389922564
25: 67F94D9AC1D7B65630E24D4CEDB286CF8B6C0BCE9B750BDF4C, B1D1E6C0E7FB73F65FD8D1C96A3741EA
26: A22F24E4543CCE061DFCE9AF3B8A1330C6B5FE47B0D16AC272A3, 1C1F0D79857F79A6A8B9433992E8D959
27: 83AC68A0B2D52C850FE35E88215042C69EBFBAA1BB778BA6D7BF84, 2B496731C5EAEAECB8600B9E92A9544A
28: 106FDE139F9930C3F5AC457D22B11F779D971BB24DDB34DD602B1364, 56B7B8B59AE5F2AC8F9F31296082AC09
29: CD4AB7BD24BE095D9503EBCF54A338F4D85A9F7932D97DA006C82491ED, B7DA2A86C88D7EB2580D65F30D15E546
30: B5173B221C65F10D09F2EBD46B7F0CD06E8D75EEF0FC06800BFD68A656D5, 174B7440789F41C7882A3D8C4F988FF7
31: ACFE0D3632331B2295274A572631E9A592554B01B24146175000C00DA69348, 97C729946ADC709ED269C1829E53109C
32: A9981E51A873F0E175591974DF9EF7079FFE785F7EF7ACFE76618533C0FB490E, 827005A3E65F0E018308B32CFEEB5AA9

View file

@ -1,461 +0,0 @@
OCB Test Vectors. Uses the 00010203...NN-1 pattern for nonce/plaintext/key. The outputs
are of the form ciphertext,tag for a given NN. The key for step N>1 is the tag of the previous
step repeated sufficiently. The nonce is fixed throughout.
OCB-aes (16 byte key)
0: , 04ADA45E947BC5B6E00F4C8B8053902D
1: 07, 987354C062CD6251CAA6D93280EFE9BE
2: 1CB7, B9F1620EA8374E1C2D05110878D93069
3: B98C59, 3793FB737C2DFB29E73DD1AD8B8F71C7
4: 8978F240, 5E25316ED13D3300F2EC12D718A0BA8E
5: CB4D261594, EDA252A1A5C7D0A4AB4620F771446DD3
6: 30D6B6688D59, 684037DE07832C6FC38CA42BDF2A7D53
7: D0583F9741BFA4, 3DF53DFF73431C0245982F4EEEAD432F
8: EE3B9596CBEFF520, D283D1B9D990739EA05F4BAE2E96BE4E
9: 6570FC25E6103AC125, 90D3F1FA6595B775749FAE7B00A8E5B1
10: F56750C98C370DFDC4A0, 19389A6875FAB432B72D64BCDD6BD26C
11: 3344AE6D9528603CC1E4E1, 87AB6FBC7F919125A7DB0D17D19056B8
12: F3D9D816A727D3E67330C779, 07AC0F3841DFCFEC58A5AAC22270538C
13: 976651E63ABC3B276799BC1FE4, EE603A8C66099AD6FF8667B3F34ABF29
14: A48E3ABC31336C6B717A96170A9B, A9D1B973D84D3125F5F9D7923BA0A8FF
15: F60E9B2A911FAFB0080FAA3ECDEE42, 4902F8AEB7685F7B255ECC45B5B7D3D4
16: 0855DE488940144AF18C65A9966DDB66, A66B3E7A75D394273AC196FFD062F9DD
17: 172DC1740F75AB2A27B2B80895961A69AB, D6986BB95F7E4137430CAC67F773623B
18: A414234DCCC61B65A79B7C618A6B91ACA410, 6CE32E55E158BC3E51E94116A615F3A2
19: 16A1B16BC0F63D63179901F1CBC772D612C102, 54007EF9822E0E4A4F953838577C76FA
20: 539788EBF85C15B3A638017B4054D71315BFF25F, 9B2511322E16CECD53E3241F3D51EB97
21: 7E74595A3DCFE1EA2C91B67738765463D50A22924A, AC9C9B526251C16F112E769F9FBE74E4
22: A2B61792102B2E44F1DC0E48B40472CE883730504FEB, 76452A49C2524404C8A4B098D6390F98
23: F58174BC06A022AB7D81991E9346F5E4B0AEC535D93473, 47F96374BC094BB2C1A5D1D291806912
24: A3A7713895D178A85D9092EA6138323DC2FF9090D7F01AC5, 3814208FA7009A2934F9A172D029667D
25: 385525DAF9949DCDEB22F7518AF96438E40F7D94933706A9F2, 1249F3DF50084A6D1A76AA350FD85B0B
26: 6838E207D98A5BF8D8E41454CF51663D8F8B76FD26092D45D1D9, 301723D0F49BF8CF37828340B894689C
27: 736413C025A549CB2550E93139DFD5DC3CE241C296C9FE641FF520, BE07259963F251743A85DF51EB1B47FB
28: 7F2CD26367A885BD9E2B515D4E871272AC1BEA1C650B530E5616B2D3, EEB37E8451597E5A53CB49072EDA9346
29: 68F23DCDEF223B60B46E3D724A93BEEF8B110D4394C990AC3D0E34E1B6, 9A60344982F852EFE02CBE9CBBAB60F1
30: 66C5DE3EB27139983D48BED81D0E5FCE6BA1AB402C357062FE989D31C69C, BAFA0A7997A529039F0CE8528E670415
31: D3B9009C1A930EE288C61B0B15C7E92CB73484C345594DC5A3F377147981DB, 1EDAACF7F1F3AC7EA613F94DA4DEF930
32: F7818DF15FE6FBC42A28FDE1D55A2C07EC8D82AA0E7A680DBD3CF26C13448F9B, 67FEB344108008A88067E92B210766D5
OCB-blowfish (8 byte key)
0: , 07B7752047F9E0AE
1: CE, 7D69017C42B06204
2: 1D6F, 4DFD4BD58439062F
3: 30A011, DB49D988798F8842
4: B71C8951, AA3261584B0C20FD
5: 06F89957DA, 88BFA80D36427F64
6: 45BC4CE5FABD, 4CAF71136ED166A7
7: A7405F124D0296, 5D8993CE64FFF0E7
8: ECABEFD9E6574E4D, B69349673CF86E41
9: F7D26A7E82A34ACC71, AFFDEE843ABEA68A
10: E225C5F0FA1D649F81A3, 03AC1D5DF1323EF8
11: 58722FBFB86C2697061217, CE731D80E6355710
12: E577EB8FA70225C5A18D31DC, 2F08B140F0D3A255
13: 92154A94CD7D42EBADB6CFEE14, DC949170E84D3CA2
14: 5A3C08744FD85CA262D51AC6CD25, E83CE45547403BAD
15: 8B2E4980ABA10A20573A402D89AD12, E3D978611DD831D0
16: 3EDC4A0FA95BD8F944BCE4F252B6470C, 87B54BBEA86A5B5C
OCB-xtea (16 byte key)
0: , 56722ECFE6ED1300
1: CA, DF53479333DB86AA
2: 9529, D0B5A859106FCC9B
3: DDBAB2, 3B31FFDA57CF51C8
4: 22EB7DD4, 2BB34D04FFF810CB
5: 108693761A, 7AFF6F52574A019A
6: 391FB7C61E76, 616C5E66297F2CCE
7: 3E22E4A4A0BD13, E84C385ABE25C8D8
8: 94FA11D5243EE34F, 8F017DE96049D0F9
9: DADB6B5D27049240A7, CA69E14047C6BBA7
10: F79C8EA83C69DE914DAC, 1EF042DA68106C64
11: C5B6E04AB8B9491E6A99F8, 143515779A55C972
12: 33F493AB7AE62DADA38C5B24, 531BF7799A778620
13: 6DAA66BF02E66DF8C0B6C1CC24, 6CDF72786C5EC761
14: 4940E22F083A0F3EC01B3D468928, 185EE9CD2D7521AB
15: 5D100BF55708147A9537C7DB6E42A6, 78984C682124E904
16: 744033532DDB372BA4AFADEA1959251E, 438EB9F6B939844C
OCB-rc5 (8 byte key)
0: , E7462C3C0C95A73E
1: C5, 83CB00E780937259
2: 1533, 022FF70566E0BA87
3: 57543B, AC4EF15FC83BDF2D
4: 01E4474B, BD817C06AC2141E0
5: 4CD7E850EE, 7BB6B3BDA5373422
6: 489C0CD1502A, 23DD4406F87EB164
7: 0CBAAE08E07EFF, 92569C958B722413
8: 073612F283F8A6E4, 1DD978D01CE8D1DF
9: CDE676B1A3AC98B00E, C033F099E2620668
10: AD3BC88EEEDA40A83685, 36DA44E13C0C8A4D
11: CA60E8B918F73E99986021, 45634CA0E43E4B13
12: 3B3CF82157ECEACAD8658EF5, E681F57616146CC7
13: EBC1A7068346EC1B7EB815A7DC, 2C806D2A909CCAF1
14: 97CDB3EF8276F1E7D6B6677DA2DB, 53F00B9A2E43DE08
15: 44169B3EDAD9506C51A6DA055EF9C2, 5BB6DD996130896B
16: 35EC29065B1FC640015B0F779E7A358A, 867EBD0E86823F09
OCB-rc6 (16 byte key)
0: , 27B9E3F544B8F567EEBF98ED5FD55C76
1: 92, 219FD2D74D7E3F21AA6C2A507C0A546B
2: BECF, 96A656A16FB3C4579E6955D592AECAE1
3: 4DDE09, 7D1882879B5D6FD8C151502BD8AB220A
4: 0D6B4FCC, E01FBD1ECA2A6A8DC6697A06AB12BDB0
5: E5E19C973B, E5A86AADF2F333D5DEDCE410688CC6A4
6: 90BA7D2A6965, 80523A2CAB2A7BB2E90B121DE80F46A9
7: 6FE258148EC8D0, B7254B11276A77C5F99FE5EC91D81F57
8: D887080095DF8817, F3FB938068A01EF89DE0F1226C544362
9: D9823313289D597614, A547764EF20BD4B4B303882B64FAF2C5
10: FF68942112CF01701E86, 94F3860D4438428EE296CEACB3EB67F5
11: FFD390D3E0B64F64D3192F, 99D2E424C67EBACCD4E2EB9A0CDB8CDD
12: 3162235748BDDECC84FC8C94, BDD400A58AF59100A731DD5B4386444E
13: D2A0EC8B1F20672289F7236C56, B245CF42644BDAC5F077143AF2A57BA7
14: 830929B2850E22F6C1BA2027248C, B6B522F7D6BA3CFFA92D093B383542FE
15: 2A5FCCCCF43F845AA77750D3BC6B1E, 53A0A0882C7844636900509921661FCA
16: 8480234796F9EAC313140CE014B0265C, 0656CA8D851B53FD5C1AAC303B264E43
17: F011A67C22F16A42CEA5E493CB766964AA, 830B8158B7A96224A53FB7F3A08CD128
18: F76274A730A608C2AB37497A049C3699882E, 4DC4DD4DF39D0E68D6169F9DC7F4A6D5
19: 7B38DD237DE552A72E4369A81C30AFEA5E5063, 01A62CBD30153702A5B29FB2A1683899
20: 58EB866F1FCB060ACC821D776AAC4AD9E87C326A, 25AFB8FC48605E1396EA8471F55C1294
21: A25F2C0FAD66B3580627498EC66C994B49C5445911, 0182A951D9A3DA53675612DE8EED1FB9
22: 8813977F092F07F251A1497C898967F3F98F5CB878CB, 80BC353E310880A83DD4DE4FE96AB6F0
23: 52DC8B76F5A6F78D51FB7DB51048E2663563335EC876A5, DC3689AA079C04C19D83646B272F9DEC
24: 965437D3FDF91784B63C73C8CD001BD9372167963DF36B89, 9FF84E2845E3C1E3E6711D1646B18F21
25: ADD40F674BD56FFC8F9B4047FAAD2471F0A48F4544C894F806, 9D684F74F9734F1C497E33D96A27E00C
26: 7B049B688839BC62785082397DEC7AA94B837D094AECA4B14571, EE711DF1C15B5C9E36B6E38B6F7152D2
27: DD4681F9C498A3CF69A9AC876E02BD9CDC4FB1F6798F772013B62D, C5A50676EFAA2A56CBDBE55CFED3050D
28: 471B5E89A1337E75E88AFBAACA1C011790F1657425483229E55C34EE, 20F73F2AC452FFEA423BE2EBDF33CFA1
29: 71812C83DE34DB329C8DCD98890AFB1F7719E890DAE5CEB7AC9668CAD0, 6FAA03E10C6FB67D425C683C6D85FD76
30: 4BC2DB33786CFD29B5CA5B804454169906138E90E29E7BE9197971027AF7, 75053C433EF5572A70C58EEC96F56C53
31: 5E3A0AB41264AB65365458ED3B7E6A25827E50075A9E347F1622ED0723E229, C8F1ECD19AD5FC970CF0D31BF46B0F2B
32: 2E48DEE4B379CD59F5367D17DC397C1BFD53B8C4CE46A8202518614076174EB6, EFCE758ECCB6BE875D16B7E03A498D31
OCB-safer+ (16 byte key)
0: , 88618DEF98FE588E23107E9A5D89C26B
1: 39, 2B01B202E751F957E331ECD1CEDE3456
2: 13CB, 17071E5AFD5D8CE953A73F49412BE8C4
3: DC4428, 4B0B1881C2540FF92E7DE63C479A7750
4: 120382B0, 0BB11D57B5BD9D846CF31033CD4CCB92
5: 97F332F95B, 335E0424D0A820F60DBB968B8B5AA057
6: 3C7AAE72037B, C8034C2C76C1CCD7C1B3F36DD8907E1D
7: 8A99E4A1B89B6D, 06A8165DFADF1EA5ABD89E574422DF7F
8: 676587065F0342B8, 93ADE63994DF2189079234DC204BF92B
9: 8EC394CBC6877B245A, 1A89F0AB0B44BC708EBD9DE489E2EEB8
10: 5FB5366E5CAE4DB72411, 5CA5881A5805D53ACA4904A5EEC01550
11: 72A1994028F09ED6A4E45C, 0FFC0052996CE45DF4A28F7A6E9CFEA6
12: 1D5EF20F52A9B72386D1A601, A697DF1179628DE1120D5E8D9F39DA6E
13: 79BD002AA59D74F125AD9E32DE, 2F02CB6F70BF57BBA0DF100DE503F633
14: 442C6F9016DF4C090056258756A9, 58C6FD3180B9B74459D70B5684BE3F4C
15: 4FC5543D9A892B44ED04EE8B25E232, B8B858B3D3EB4B26E867E429F88A56B4
16: F06E7503167C2210AB332259BAFD6AB4, 73CE2589D1DF34CA3DC2B14CC9FA6276
17: BCCC260BD4823B64090FB33E6816F9C330, 81ABBDC83B2544907840FEB5AF4479EC
18: 450C1105B76F960D1A5F33D7F9D37DAE20C3, C41DDC8980E88E3986D9C84857BBE1E7
19: C9F36EF3A990E0554EDB59E6788F8E9BF1DBC7, 90DD543E148D9A0B79A8B376C5509E09
20: 3666FEEA98A4FC434EDB7517E7FCEE2320C69BCB, 99F11B360DDB3A15C42110831CCBF21C
21: 126F39C19D1E0B87F1180F6589A75712B66209E2CE, B4D268FB8EF5C048CA9A35337D57828A
22: C1B6D14EE8B6D0A653BFCC295D5F94E6BCA09E181D8A, 4B4883B614D5CC412B53ED4203EA93B7
23: D1F2A10F1A9DAB738C61CD0EF66FE5F6D1DA95DC671128, 3F1EFDA55EFEF1A0B24708E132BC4D25
24: 9D457216C584F43DBA1DD55C54822A8B6A86D22DBFFA14D4, 53402970B128E98A5F0D62476A38F959
25: 012828614B5D67C9A1EE24A1EBCD322FE9C8BE0C3F20A53714, 2BFF288D90DBDC638084F80F3F7AADF3
26: B1904AECF599F6C74557475E409E75E646271DEDEC7A830260DB, BF119BDBDA27773E038B7067D2B0EECD
27: ED831771C4346FC19435354AE29F7A9436D6E8D4D42CFF26207DBD, C3F029FC8AE690E84FBD0EF806B801F3
28: E051B958601223FECEADF932A277BCF18C25025AE4DA791155B85035, EB75E56BE7856F1B5ED3D125C092D38A
29: AB3449537C5E22125BC32D483F74C3A3DBDBD5232839A85D300F65B4FD, 851B0FBABD080F783BDE4F47ADCD6D76
30: 4E68550837130652795A8C9D68530717D2B0AA5A17F3AEF92FFB502E46AC, 10E222706527A64E757EDE4B9EFC09DD
31: C2D7033DA7A1857D79497EA6C64779EB969046CCEE6C74E6592FEE6E7C94C4, 2015674ECA80AC9B67AE854E18A7D56E
32: 2F3F0374DDC24AE21F02D4DA74D46C71F0CD2269A68F32F7FAA0BAB64AA8E9BC, 737C8BA1677A8CE97D42FBB07530EE99
OCB-twofish (16 byte key)
0: , 2CD8EF22E5457C7FE4016B0FB82FD204
1: 64, EB7BB60E4932C0E97A7A5906BD044ACF
2: 3A59, E3D2024241666369BB542ED096F20C71
3: 67C038, 7E6F1EB3F2088F6416BB675DCAC0D484
4: BB36BF02, BDEEEF07EBB7A50A5201C8A2D72C0036
5: 6F06C0E293, C63557681D84ACCFFBFEE87D82EF1D3C
6: 2015F94CC5AA, EF1DEAD4134D2A1A47A20F26FAA3554D
7: A5F8CDD07964B0, 672B74D88C8AA7567C6AC4A896E0F6D1
8: 5EFC9D8C3B9E7F3F, DB9160C53AD429D4C22BC0E2E6C509C5
9: B62CB80F75594BC54F, 20020A798FF59F0472E750C796B5CC94
10: 970983B0F889760EEEF0, 360AE43CEBCC27755548D4984CEEA10C
11: 75C3A8CCB30A94CD57D1F8, 79820F3B1625E216B5BC1D1A22B198F9
12: 033DA41CCBFE3C6897230FCE, CFE3EDD11627270CD63916508B058B7A
13: 15358032F30043A66F49D3F76A, 98B8056A7991D5EF498E7C09DAC7B25D
14: 71FBA7D6C2C8DC4A0E2773766F26, 22BA0ECEF19532554335D8F1A1C7DEFC
15: BD761CD92C6F9FB651B38555CDFDC7, 8E3C7E1D8C4702B85C6FCD04184739E4
16: EB6D310E2B7F84C24872EC48BFAA6BD7, 12DE548D982A122716CEDF5B5D2176D9
17: 8DDF6CE25A67B409D3FB42A25C3AA7A842, 3E9FA2C6C65341A8E1101C15E1BBD936
18: 5563DFC29B750FBC647E427C5480B65846DB, 90881C6820901BD41F7B3C2DF529B8A9
19: 93343C1E9624321C2A0A155BA8B4E66FD92BE2, 71A641DDCD49825E10880D54BEF30E91
20: C256BCA0CF0ACCEEC1AA4B9372AF27D2C3C65AFC, 91D45C4DA49BBAD1809A11F4041C7D09
21: 3DE69FDB72C93518A3E317F7B26C425EE3DD42DA7E, 85E37B3E8EC3AF476DB7819D739D07D5
22: 676AC7885C7C8FBE9862242FCCC46C181440EE49AE59, BCDB42B53AC4FDDF9C3BF8849AB96EEC
23: D71B98B88F46CC47D90BB931564CDF0157F0ABCB5E6954, 289CD5799D9E49F36D70F67726A59610
24: 669C16DB9DC175200C08476832155DAA52F1F8969DF3B79A, 835B210EBBE5C9D34C2E052E1843C1F8
25: 2F39346E14A34BBED0491929CD9F1FB3CEC412C25AB703372A, DC4B42E8BA676BA100B87BEE328C5229
26: 1FD0F8BD0AC95E91881635EB0CF0E4FB099CBB214CE556422E2D, 898CEB3CA8FCA565CE5B01EF932FD391
27: 7FBD32B3D88B7E002BA6055585B5D0E1CC648315A81CFECA363CC8, 804820B1E3813D244164F778B9C2A8C8
28: 877A5F336A1D33AB94751A33E285C21666F0D8F103AC1187FC205372, AF9F0AC165EAFCEE8C2A831608F166B4
29: ECCA297705B0395E71B9E4263343D486B29207DA188C2F1BA626EDBF46, A05DC873406B236E4DDBC038DC4D2627
30: FF3BD8D4E1108E98FBAE2E28BC12819CD7956BC491C0B3A291FBEE739599, 68DFE58473BA2818A23095D1D6EC065C
31: F175230606040ADACEBAFE4D58BBD140B2D45E8BF7E5C904510B58E4B53D3F, DAF579E1A12481D39F4DCFB7C28794B1
32: 261388D491EF1CB92C261FD9B91CAD5B95440DE0A747144EB8697699F600801D, 749056EBEAF4F20CD8746AA8C8846C47
OCB-safer-k64 (8 byte key)
0: , 0EDD2A1AB692AA7A
1: 3E, 306F814F3C2C109E
2: 0593, 063D19B734C34715
3: CA72C6, DF6DAAFAD91BE697
4: 08924AEE, 15095FA49E789483
5: 359908A6CD, 16CB7F0741BA4091
6: 97F3BD820CF4, A59DB15B67B95EE8
7: 0A267201AC039E, B4FFC31DBCD8284A
8: 9F6ACD9705C9ECC5, 6B41A938F0B1CAEB
9: F355D5A937DD1582C2, 9D1F932E521CB955
10: ED39758CAF89E7932E48, 398EF517015F118F
11: D8ACF19363A0E0ADC9321B, F98B2A30217766AA
12: F8F54A8202B0F281ED610F33, 36EF7FA4A20E04B7
13: 0F8677DF64B5982DB6E2299140, 4DED2DA806834C81
14: 0C357A9DC321C93B3872881503B0, 7814D1C0C6A8900A
15: 10B6B1A261C3015A18110AD200A7B6, 9A814D6D2BAD850C
16: AA9EA9D1BA7818C0D2EBF23781A5467D, 236A24FC98826702
OCB-safer-sk64 (8 byte key)
0: , 76F16BDCE55B3E23
1: 63, F34B0B471F6F8F75
2: 8651, D7EFE17943D35193
3: D45504, 263224E50E7E9E75
4: 57B414C3, A553D6CABCA0F285
5: 4976E3B303, AC5E9969F739EBD9
6: F10AB8EB94E0, 8301FFE68848D46D
7: 6E954593AC427D, C1CF93BBC0F92644
8: F48F44441B898C0F, 698FFAED1A95E8E4
9: 1DC60156D62782E3D0, 6AFF0DCC65D4C933
10: 71920ADC8997CB8B3A72, 1C101C6A27CFBBBD
11: 890ED7492ED914AC20391B, F66DCD6205D945C6
12: 1B9FAB84A8748BAC187C7393, B450757FCAFAAD52
13: B4C89E1BB280DBC265E43ACE15, AE6BB3D2E6A371FF
14: 24B0C28944BDF22048E2E86644F5, 84E93E2191CEF17A
15: 8F2D5694D55EE235168AAA735943AF, 514252AEF2F2A2D9
16: 568B7E31FFDA726718E40397CFC8DCC6, 3C80BA7FCA9E419E
OCB-safer-k128 (16 byte key)
0: , 4919F68F6BC44ABC
1: 65, C6785F7BE4DE54D3
2: E1B0, C197C93B63F58355
3: BB7247, DFE092EF8184443B
4: 38C2D022, 943FD999227C5596
5: D71E4FD0ED, 51040FE9A01EA901
6: C4B211EADC2A, 329429BE3366F22F
7: 426DEB3FC3A4BC, CF1C976F6A19CE88
8: A6F813C09CE84800, 98D9FF427B3BD571
9: 4D1A9948FD157814B4, 5A389FAEEB85B8C6
10: EC3EA142C3F07F5A9EEB, 31E26E13F032A48F
11: A75FB14365D1533CD3FBE7, 8EF01ACC568C0591
12: 891582B5853DD546FF3EA071, E013CFFE43219C21
13: 54CA848C49DCDEE076780F21F4, 298EFC7B4D6B6CFE
14: EA7611C69A60F1A2EF71D6A7762D, 7D9AA51CFCEC8101
15: B2D1A211BC524B965A084BB4B21710, 7B2AC0EEB5216892
16: 5E81F1BFA270E804A488C9BFAB75811D, A67F627CE1E37851
OCB-safer-sk128 (16 byte key)
0: , E523C6DBB3CA178D
1: 5E, B1CB7EBE5780DF98
2: F4D8, 8036235F2BE7A817
3: 4FE268, 123320394EAC24F6
4: A5BA02B4, B8276B5E027D45DA
5: 1571859CCC, 29406C5F2DF2CFC4
6: CA1E47447B95, 5D4FAF8FD5341791
7: 8710DB37022D96, E10040FEA9AEA9C2
8: 205990DC9A34DA3C, AE25CB49AA7A697B
9: 757AFCB3191DC811C3, AA8CADA8638D6118
10: 6994F8C153522361BB92, 1BCEE09E928EB18B
11: A86FA0CDD051BB60AF5AA8, 50A38F8E9889354D
12: 8D3FD3EB7FF2269AACFD24BA, CB51CF84CEFC45F0
13: 03D2A313925D9490FC5547F95F, A1FF9D72E11C420B
14: D77C0F0F600FE92F14F479FA457C, 1EBE1B4B9685EDFA
15: 0CAF0A8BEB864E26058C7DF8EBA0EB, 1B153DDAE807561F
16: 113D12716DFE0596A2F30C875EC6BA0E, C61F5AC0245154A6
OCB-rc2 (8 byte key)
0: , 1A073F25FF5690BE
1: F4, 3D3221E92E40F634
2: 2C76, C22C20B7231A0DB9
3: C647CB, 3E6348D996399629
4: 2021891A, 8EF76B24E9D55FDA
5: 1966CBCBBF, 310D24024D573E8D
6: 42C15AC9AAF0, 217E83C0CDE4F077
7: AB70F3F73DF0B6, 16AB2679D96A591B
8: B7C7DD845D7E76DD, F33065EA531545CA
9: 468CC16A37CF63EA73, 88879733F70AE3D3
10: 4F769E25A7346E22A932, 26E1A92FEDEE0597
11: 304A8B53B1CD24C6C27C17, 48B46E9F091B0B2E
12: 4E3DF867FEFF0B8E06D5FA70, 53BB48BFB8AB4750
13: 2BAB3F0A8C38A3BD3C49DBBA5A, 52303CADCBB6D312
14: 3D04A29924589AAEF93A29003EE7, 120EF9364B83748F
15: 486127A80E4EC599C461451CF1D79B, 2245D51599CAD629
16: AF8FB3FD2DB343F1AFF564FCBEA58785, 805BF441E660B0B0
OCB-des (8 byte key)
0: , 8A65BD7DE54082AD
1: A8, 3A83897CC8EC7CF6
2: 9256, DC66C39C7DD87D93
3: C145A0, 45967F3764F62F48
4: CD314BAB, EF38B0213259C3D4
5: 7074014741, 6748F4BAF06DD7BD
6: 9A874CAE01F1, E382DB7235624104
7: DFA0D86DC4CA84, 627ABB432E50455E
8: 685C2B2CBDD8D144, D166082E085063BA
9: 53515DAAC7F7B8CE1D, 6680B6C26E1B0994
10: 2B3967812BF4155A8D36, AFED7F38AFEFC543
11: F4E5AC3CC5913B8A7F35FB, 6181DD3C46A6C24F
12: F3EC89AD4235287D53715A81, 12CC354833FE5BD8
13: 66D554AC2CA85C079F051B8459, 097F31088CFBA239
14: 8746061C26D72771A7586949A3E4, 6CEF3565D0E45C6B
15: FB3BCC650B29F418930A467EA4FB73, 64D12723E100F08B
16: DE1C27E9B3C391AF5DF403291F2C084A, 6BADE4638AE46BE2
OCB-3des (24 byte key)
0: , 9CB7074F93CD37DD
1: 4D, 51541A838A154E0B
2: 5C77, 60E86F2F1F4C6F96
3: B3D2F0, 7D74A9E6A061457D
4: B3556075, EAF7A89A07453460
5: 1B61CE7230, F90D18620E1AB877
6: 3987FEC8D0D7, B5EF04DEE2E528F9
7: EBD0A7EBEEFF3B, A72CA24DD77A5DDA
8: 429FB38DDABF76D4, D0578484C37227C8
9: F8DF28BF5C4CD28B1B, 5E7C4DC8E694E3B4
10: 2BF436BBE063F7E830C2, 8D919637C973C71B
11: ED21656C8878319F1B7D29, 8813280C1277DF26
12: F45F90980D38EDF5D0FEC926, F9619341E273A31F
13: 52F2D3CACC294B141B35D73BBF, 7BBC3F1A0D38F61F
14: 2E6DA0FB55962F79B8E890E8DD8D, 8060799DCAB802E4
15: D6F9A6B2420174C499F9FE91178784, D3AAF969ED2F7215
16: 4F1CF285B8748C4F8F4D201C06B343CA, 203A2692C077F1B5
OCB-cast5 (8 byte key)
0: , 77E8002236021687
1: 52, D57DF1037B6A799D
2: 31C9, 7E781759B057D695
3: 5C8324, 56965D6CB2C97C0C
4: 17D99099, 7C52B5D09475F5D3
5: 400082C475, 3CA5CDB9B4A0FAE9
6: 4DF0E4000C24, DCFEE2C3384F9731
7: 10004C3CE32255, 0A6832F985F61658
8: FFA6EA76B346893C, 6202693B153254D6
9: E96378C94D246AB51C, 5B259FEB715B9159
10: A9BED2D59A92D3D9418A, 1E7E066C098A023D
11: 4EF144B7D4622BAD4DC840, 5DAB2C1D0DF56B08
12: 6DBCDF56E57CE47DD3D0CF44, 2A24F2A224368F55
13: 43241A0AD933635D7C8EAD47DC, 86B4B5AC22177F19
14: 920D6BDBE073F3C75052420C883D, 10943DBB23BD894D
15: B2C75DF024269833B039CAB19EC865, 84B7DBB425E45855
16: 6A9424B6A873BB7155C01DC87E23EC52, 82C5047655952B01
OCB-noekeon (16 byte key)
0: , 72751E743D0B7A07EFB23444F1492DDC
1: 61, 41BDE9478A47B2B612A23752B5A42915
2: F4EB, 90EF542D89F867CDFB1A0807F8AA3CC6
3: F5A59B, 1BED873B613096546D4C201347CC3858
4: F454610B, FB4035F28AA75221F599668ABBE21782
5: 382FC932F1, B40270E2084E8DCEB14C6603D080D7C2
6: 18F921441119, 47F1F889B307298150750E81E94AB360
7: EF01C70C9D1810, AE0439DBB3825F27CF846B43E4C3AA80
8: 89863EDCAD471C3A, F4E8AF73BFC4CB79AECBBB3774DAF8C2
9: A6F494092E066A70F6, F73D3B04752B7D913420C17E656C7F86
10: 342459682E0A8D53AF4F, 61E7CF14E9878E0726C64B1E8CA08BFF
11: 65E520D5A99825DE2441D1, 7A2AA740D786EB7015C61B31959E55D9
12: 2F96D0BB72E37DA202410302, 1A313242527FB522289094B9AFDB5F7B
13: 3E8F8A1FCEE3F866EC29128BA0, B8065DA2DABF04129E5AE28ECC11A15B
14: C2C15976D3C2499ACB9454878131, 372CAD486E104098EB1AA78A2922A1BE
15: 1F12CADABAEE80E448B7EDCB42F8FE, 86A38DE5363787F55B16462C684E08DC
16: 3B9ABB3304E75BF5B63E7F5B5A3F3980, 1FBD6B93E457B9779E2D12D78301EFA9
17: DC0CD805E43675A4317452E378AD48AC4C, 40AE4AFA4B3E580EFDB4AD0AF5BC4E4A
18: E9DD52EA7264C6C7BBA39B761B6E87B65687, 4061DD65D5E7FFFE8D3D4261494D4F8C
19: 80A9735CA1175072823828123413CCE772D521, D3378A12E79C49A37378DF527A460AB2
20: 09AD495AFFBF7CB8841262E7E5E8952878D4391A, C25D7A98C6F260B5FBCA3B8B5F7F33C1
21: 3925615707CC40C351D4A49794778545BC1F683175, 97622437A7208383A4A8D276D5551876
22: 5BB0D41ECD7BD2CF0B12A933255D95A3FE35E4C896BB, 4B8AD84EEA3156765A46AC19C68B6F88
23: 1EE71FE23CBFD5683AB1B391FC12B4E5952E4E6AA3D189, B0FD75996F28E071EB6C86BD7102BAA5
24: 0AA3D8C98AADEEE1867B13B017DD263BD16E960DA64FD071, 5204780963A62C2F4F7B3555BFF73836
25: 3A88B6F2AE321B226DA90B98E04A6A1589411BEDBE994632D5, 5638AF04EACF1EB986AC0702B4373A22
26: C2731661AC634A4DC0345F040DA7AEE507A3B9D019B5958543BA, 4C67D3FE37ABEE928B3BB812E7346823
27: D3E7651AA6DA035D05D599EFB806E8FD45177224593B5974758419, 5814E84258E1B9BD56A188AAE6F25138
28: 17818E7102B8C123230C5D64F18BE94C3159B85C8F7B64A7D4712CDA, FAA905B587A93DCF600BA8589A985432
29: BCA4335C6C29D978032C216114D39C01C6F161BF69D5A1CE55FBA8C575, BE24424A162E43A19755E2EFD274DBED
30: 24C33CEE022F8A633DE9DFD009F535B52BCF64F390D2375E5BED65B70D08, 138F21D54B6B7E34628397DCDE0D33BF
31: 838FE950C8165ADBBD6B61E9732F9A727CA7AE74376981382F0C531C331915, 0742E769CCBA2D1CAC7CAD4E0F012810
32: 57CD778DAD477271794FBF763662D97F8A10B17D70A69FDCB974FFE67E558519, 942C7D1C200C3845748F8131DF71AE26
OCB-skipjack (10 byte key)
0: , 90EAAB5131AEB43B
1: 2F, 6274B82063314006
2: DAF6, 6A6BCCE84FD4EF02
3: 5C2A88, C83D54C562A62852
4: B6E8FB5E, C44459EF41C8F296
5: 6C0888C119, 269DD7657BD0225F
6: 1FD9AD7ECCC3, 3CA090F46B107839
7: 1EDBFF8AE458A3, 440380BF9745132B
8: 04DBECC1F31F9F96, 2653620A4877B0E6
9: 908AE5648AF988A896, 00180FF33C1DD249
10: 53E63E0C297C1FC7859B, 36616209504C4230
11: 407BE16144187B4BEBD3A3, 4754B7DD4DB2927B
12: 9961D87CFEDDF9CC22F2C806, 5947FC41E6B9CEC9
13: 9F5254962E4D210ED8AC301252, 97A392BEAF9B3B04
14: 379FDA76ECCFDAAC10F67FBF624C, 1D895ABD932BD5EC
15: 1D5A7AD556FF3078284BB21A536DAA, 01FAE2F4936ED9D2
16: 4B8B71396924880CB33EA6EC6593F969, A0F4B1BE3B9B4CCE
OCB-anubis (16 byte key)
0: , D22ACF880B297DB0513DFAF0D2DF57D9
1: 59, 210A179469D6568AB9470C760415574E
2: AFA5, 1223F9CD160ABE2F257164C6E5533C87
3: 969BEC, A57EC767543CA2ADBA4F5A7423ECA78A
4: CF8B31F1, 13B5BF9CD87CE15CE696F3AF1B082650
5: 9B22DF3852, 4937FDDA0AFDDA04CCD53CCBB0A82745
6: E11719B2F0F8, 6847931DBF0223F5CEF66AE3F4DFCF9B
7: 5A85E0F6DD2266, A1A0AF45A68A681CC396615FE1E1DFB5
8: 7F2DFCC65ED86976, 13614A3C6E0E08611D8DF8EE5B7D788F
9: 1DAF10DFA3F1D53E50, 673632B6DD553BAE90E9E6CC8CDE0FA5
10: AF74FD9671F9C0A9879C, B8B4DD448FE967207227B84E42126D90
11: 49421CED1167A882E26297, 21C8951A1761E4BD13BC85CBD14D30BD
12: BC0BC779B83F07D30CB340DA, FAABD25E14FFD8D468AD6616021F604C
13: 843D7E00F94E61AE950B9AA191, 08933ED5FBDCAF72F788393CD5422D0F
14: 296F15C383C511C36258F528E331, 8BFFADF5655C1864057D69A6706D1739
15: E31D2E80B2DBA4FBFAF52DB0513838, C4CD36821EC631CCBF1F258EE9931288
16: 87F319FE9A48E2D087EDF95563896EE5, 517960488E5A118D150A1573E76C290A
17: 9632B7DC1740BBE0A7AEEFD0F535B5AE8A, 0C24D0950873621D319A928862D3A6AC
18: 359431ED4B3AC537238CAC2F86126972D403, 4A0CED2F4BFA3355C17D6C5DF9FABFAA
19: E15B50172EE8DA9C552D448A5A48BEEAA2F11D, 8166B2A2D3A0745D1055F9F503FD6C03
20: 75842DDC0D5E3BD80225E4BFBD1298421244D7EF, BB957BB2582B67B63978BCFD7A949EDD
21: 3DD69162716D5F3E096E614991CAD7ED8E01F926B8, 40A954F31F5B0A2C5DD220ACED8D2B3E
22: 8A49AC14F59593D5399A10F9346E2FD36F47F64ED419, 4324D408CE7F86370495AF14FBD1A859
23: 6AA8FA353BCAAB4262211D75F13D27BE173526B8BC3CFC, BA3A27D79EC8ECBC5A78CB9FD095B766
24: B918192BB72CFEF980298EEE570460356A4BA1755576FEAA, EB341ECE0A070E769F498600EE4EBF77
25: BEFAE0B77E42A2FD18958D9E43202E8A338562AFF8317461B0, 444C1D6BDC026A01012BB2CEEAD89C2C
26: 07E86D49CFFE6FB08FDF44584033AF321447003D8AD3862C00C9, DA9355A79B224EF662DA65F19BE494A7
27: 911BB223AC6F6E54082FBFEDEC300D73FCAF715CCA35949212B372, 3496160A46A21DCDB5A4C179F159D860
28: ABB563FC803715F59AA35460E98470E2E94E4270455ACEBF4297641B, 899CFE1946A060DE620879B8A7464718
29: 47D98E83B5849CDE19B14ABCF9EA6CA9684AB49A3AB36BD14F328D808C, 6D76CD5EFF6D4AD3B67A56DF1EB42E05
30: C8BF0B71A95884FFB93D64C57E327A4754EC5A1EE26632CF8E0B6B26CBDE, 2B3BE785263B1A400E5893273AFD09AE
31: 9804D668CF2D75CA58C9671F65630E33909269B9511AF9119BE88EBB35F00C, 3DDA028B1A2339CA817DC8D9371E0FF8
32: F6E038A82A09BCD20BAAC7926B2296B78F9CBA9DD12C497C47EA08DBCD8CEA3A, A203FC1E68E21A52E72224891AC10EE2
OCB-khazad (16 byte key)
0: , BDEDFF7AA0070063
1: 00, 67E951582D66ED93
2: 5FED, 09DC8AEAD70673DE
3: 26A7CC, CE1436CE1E37D4B0
4: 3D2BD063, 574C24395F31511A
5: 597F1AFCB1, 6FBBE820C6F26CDB
6: 202DAE442DF6, 58CA6E5706C9852D
7: 7C20EDA18E9444, AABF0DA252A1BAAD
8: DEC02BF76DFD5B77, A0A97446B80EACB6
9: 5D7A42F73843F9200E, A1DD603372D124CB
10: 0D4710E454C19B68369E, CC78E9D7EAA6A39F
11: 126694191BF09A29DCF40E, 76C9B84FA3E8913F
12: A94EBB86BD325B4FA1942FA5, 613DE312DB1666F7
13: 4F9462386469EA0EFDC1BFAFE9, 5247244FD4BBAA6F
14: 4EB794DFCF3823BDC38FA5EF3B23, 0C12017B5E058398
15: D870479780CC5B3B13A7A39029A56F, 003D3FCD31D497B5
16: A47BF1218AC86A60F6002CE004AF5E50, B4EC27091D5DCD58

View file

@ -57,23 +57,23 @@ OMAC-blowfish (8 byte key)
16: 8E6831D5370678EF
OMAC-xtea (16 byte key)
0: 4A0B6160602E6C69
1: 1B797D5E14237F21
2: 938300C83B99D0AC
3: F989B99B3DE563C6
4: F65DEA2A6AD45D1E
5: 1DB329F0239E162E
6: C0C148C4EE8B4E1F
7: D82B387D5DFFE1FB
8: 1D027A4493898DF2
9: 196369F6B0AF971A
10: 2A37A2655191D10A
11: BD514BE32718EB4A
12: B4DBC978F8EE74ED
13: 8ACCAD35C3D436AE
14: 73ABDC1956630C9B
15: 73410D3D169373CE
16: 23D797B3C7919374
0: A821403929958A1A
1: 68C4A02D47C2E7C0
2: 7D37358141506DC1
3: 9BEA3AAE55B75F52
4: 884D053D05CC8DE4
5: E953747483FF4E0D
6: B6E77E72C9738E4F
7: 8AB67D2B24E3D512
8: 329C0B9D504A0D41
9: 50323DA8ACEF4164
10: FA3239C668C34DA3
11: B5A12FC81FC24084
12: 71A01A3ED3936934
13: F29B630CEB6AEDDB
14: F8802F0D4504D55E
15: F844B92162038F99
16: 99AECD7CA69F0465
OMAC-rc5 (8 byte key)
0: E374E40562C3CB23
@ -313,6 +313,25 @@ OMAC-des (8 byte key)
15: 7FB7CE0862958B37
16: 55097816B10C549B
OMAC-desx (24 byte key)
0: 3DCD366D8E4D6EB8
1: AD1DF426B344F922
2: C50DD51B953E37EF
3: F732DD355496D72F
4: B8A9D3819024AD6E
5: 7C4624125A33C0DF
6: 378D83372E82296F
7: 974C7613AF191E95
8: C856C3F7B1A944FA
9: F7898CFD34AFECE2
10: 9B5B09251EB0F44B
11: 369D0AC2E71641E8
12: B798AFD13EDFD831
13: 066207F46EA9B6F2
14: 4083189F5CE42C5F
15: 6D04E4B9E2ECA8DB
16: 9D9EE9A8B5AC27C2
OMAC-3des (24 byte key)
0: 7F07A9EA8ECEDF9E
1: 4E2A652EB5FBF5F8
@ -332,6 +351,41 @@ OMAC-3des (24 byte key)
15: F8637AEEFF10F470
16: 0EA19531D42706EA
OMAC-sm4 (16 byte key)
0: 4DCF78C73B13A3B9494DE1152E66E9EF
1: D969654F96D6A5888051528E4B417231
2: E90E3429E81886D1C31C5B0076DD6967
3: 0200C38838F6AC2547B57CAFB68197FE
4: 7675C0168A1E04AAD697D52B74F354ED
5: F3235CD0A674C4BE3DE00A59C59047B9
6: BDD7ACCEC9155E657BDBC36DF69AD7E7
7: DB9B8E833FED5FC7D5FFE00526DDD6AA
8: 83DBBE2766B9BDB59146CB3CEA4A0AD7
9: 95D3B45E49B41F5EF0D661DC62054A8B
10: CF88F8DFAB57F5966ADBE703EB12A3F1
11: 7BC575121B4F37E7A7BFD22F1B78685C
12: 43DD61A4A29D22970F51DF0573A92670
13: 305B1ADF8D5E5787CE7DAF41A1D383B9
14: B9CB5438AC40D45B15D438A97CA56C3C
15: EA698BFB6B673D2DB6A44CCF45B359A2
16: 6C5F95BFAC3303A1EC872B01453AB9FB
17: C5E8C622028131DDC11EA51AD38CB12A
18: 0D306885AA1E6AC9B4A1F257AFF4F8A2
19: FB942DA9F2BF3A42A48D4F3704F9E4D9
20: 164E103E28C7BF2897212C45465E6BE4
21: 29A8D843431D5383BEF4618186244A88
22: E5198A53CA4D07C652A43F5F9F1284CE
23: 7D7EE2E1992B09A10BFBE257E0965426
24: DB01EACF33255EEC1B91124D20C00EA8
25: 5BC1F4E148752FEB8FFA54638EA34E2A
26: 908D641E82579034EF63BC715E8340BB
27: D22784953DA497AEB56D795FC1576D48
28: 2C5332E28F42758FBC3B35B430B54CFC
29: EAA87F4C87BE3AD58927E556502D68FA
30: 130EE9E3DE2AA6EBC5FC5CF0247D0FDA
31: 8B08E2E6106B8454F2180AEAB5034D65
32: ADF8EE93CC8DC3FC007EA2C361FA995A
OMAC-cast5 (8 byte key)
0: 7413DCDB9F0C3100
1: 423799EDF1472B79
@ -352,39 +406,39 @@ OMAC-cast5 (8 byte key)
16: E8B0B219D4CB699B
OMAC-noekeon (16 byte key)
0: EC61647B281C47C1B43F9815064BF953
1: B100B1B6CD96DCED8F47A77E70670A92
2: A96CDE3C48831A6B0A5ADFECA6399BDB
3: 14E75E7CAD840208834918B29A5D4430
4: 9577083713AE6E44EEC987C77C93C072
5: 2A738C02841E461238C02F5CFC8E66A6
6: A901327E451BE0D2D9DEC83DEEA9A022
7: 5ED7EE1BE04A64A689D15F6970A821A6
8: BA053E24FCFD02C731A8CFCA19EE66A0
9: 57139CA8C91072555B29F85A19E2C84D
10: 4585EAC7EFB84869FD96EE7A5FDD350B
11: 62AF6C415CA73E54E82EA306254C1BDE
12: 75304F9724BD364F84371EE154F5210E
13: 7FE5DBCEE826760434745D417453182B
14: EC98DA2A580E9131218D1CDE835423D4
15: 631BD9EAFD1AE445F2C1C35E2B4416ED
16: CA2D902A1D83388FE35BAB7C29F359BA
17: 0DBF0AF7FCBEEE21FB6159C0A2FFCD4C
18: BD7CD2C49241032DA33B1975EE2EE982
19: B30B090EE8626D77D310EDB957552D46
20: 64F608AC5707C381AC6878AA38345144
21: 28513CA7795B23A02B37DC3732413D23
22: 9F440700094517847E9E013C8915C433
23: 8CA483F313D20BFE7E0C089DAA4145BD
24: FA44872743E20E5E0A069B3C4578DB50
25: F6DE8FFBECD52CC1F213CD9E406DF3BC
26: B9702B7E846735A3DCC0724255F88FEC
27: A1DDAFED2B1732C7BA89C2F194AF039E
28: 2549C5F0E30F8F4002431D2C098805B8
29: 52E3836181BF5C9B09A507D5330CD14F
30: 01C55DCBCCFD9D7A4D27BDE2A89AA8EF
31: 3CF721A0CF006702CDA91F2FF3E4D5E3
32: 6D264B9065BE98C170E68E9D2A4DE86E
0: A9F50A6567FAD338AB5727B3B94DEB82
1: C9EC17EF3656C9056E64E692A449AD24
2: 7D1F6A3373BF20D4E65804B745D40855
3: FE3484F11C338721F3FCB4DCC608BD6E
4: C45670D31D48CE9AD70BADE9F7A6A5B3
5: 6AF86480F1AE638DCAC40939B864D4DE
6: CBBAFED3A5891A7BD8692055E4C59444
7: B23439FC6D1CF0E3B04BE5201CAF9283
8: 385D2C64F55B3FE976E660155FAC4C90
9: 239D4B8F663248076E64CF743AC14EC0
10: B942C5E06C6E68866440EB10747643B6
11: 9B591FA2FD9A20C367FB03366150D1E7
12: F90183F872D062AB4642DCDCED399970
13: 86003C2F260EAFC81BC45A0614F88381
14: C80F88A148FF906D42E6D75A50049468
15: 0A81478238ED815D7CB04C0DC5A4A4D5
16: DFE74730DB9CF4F994084C88923A8931
17: 91194DAAAB458B5B34E991EF534D4BD8
18: DAA1CCA0B644AB9F8B4D889D7F1268FB
19: A93AE4F41DFB6CA311FAAA148A9D53D9
20: 6FFD47B80A991A6C09775060E4A4B13E
21: 4BE3101511BCA3251559ED6D3BFCC304
22: 3C1AA3485241175A9A17F440A1F2FF5F
23: 11D2C5E4FC75639CC61C8FE66C2F5135
24: 3EDBF9F32259650ABC2C835301FA6556
25: 56FA9AA43C01CA5BA798780D3BF40FA1
26: 40AE1F352003026C6D4C5F44430DD5ED
27: 264E11C88266029588A1B8369F0C5B73
28: 60CE0E6D2C2C74D122DBDE57B3EA44AB
29: 5E4078E7CEFA94886E9CF0D083C4B468
30: CEC169560600ECEED6E5C8F06C76E702
31: B4209736F08EAAE6D5B4923D83EB3EE2
32: 5DC8D45C9954B82864F1C2388858D97B
OMAC-skipjack (10 byte key)
0: 84EDFA769040603C
@ -459,3 +513,219 @@ OMAC-khazad (16 byte key)
15: BCAB623CAB7AAA23
16: 9BCEAB857596E478
OMAC-seed (16 byte key)
0: F184C3569AE39C95609E878E8E69D276
1: 6B94C6CEB7347C7E478D33FD1892032B
2: 9FA405B299D5887181C5F09A27AF9F76
3: 7457B824FA672F0D939B3CD161A3D229
4: EF164E3F30058EA7BA10B1D7ABD945F8
5: 22FAD3E42EB96A6E6A66FA73FC96A9E4
6: 9BE414C3CD92860A67AFB7C45D0E0EEE
7: 40DA2A768F6593E45214CB7F054A9BAA
8: 9AFBBEEC8EFAFA7A22752F3BEE055811
9: 45EBA2A3EE9276A90FE7FC705086F59B
10: 9FE7E1DE176065440B45B1F8F012B8E7
11: 5D45CE9EFB14AE973C6567E804492D4A
12: BB37B25C98998B0CBDF7AA2BF86FBF3B
13: D68EA4AD5B7C3E243872F5BCF7F24EE2
14: E880AEA09E328C58ED99928C7BB97DEE
15: 4A9EBD30EAB684544D79A066545B100A
16: CEFD858C3179B39BADA7EA0F6D3AB150
17: BD3336CB8C5AC6D327B310C2093FD087
18: ACB4B352003B45FE5E872647ACD2C945
19: 74FF04F0ED7ACBDFC2B8EDB0193312BF
20: 950B9587B448A73F0566B6E5D30BD85E
21: A1CEB1E515BEE6C0C2253415CEDB7F54
22: 5E3B9B8F983B882D48853403152BBD09
23: E7BB12680BFDC81851D08870862F5F70
24: C89D50E7BC1692A3EE29585F4C2861DB
25: 1ACBB14354F3A1E002BBD065930F56B8
26: AECF4E3972E26A862DC9A0D0F78F4A75
27: 4E8663B1FD460CC7B6CA7D6D880209C8
28: 0350DFE2A107BB68BAD09A9461EE5E64
29: 89B70BBAF6E7F4E7E37F40D122588B0A
30: EB0B22BCD7D61272372502B7EADA68A7
31: CC4FB973D094008F4B90D687CD91B4C9
32: C7162431A53216C22D47FA511B0A619E
OMAC-kasumi (16 byte key)
0: AF4289889D9AD5A1
1: C58E7863B4E8CE54
2: 2927047C455329BD
3: 62905068423B826C
4: 0BC0C92B5162FA20
5: 03E6D71DE770BB3A
6: 6D48AB1CE5EC49FB
7: 338597E9545657E8
8: 418BAF4EFB83DD50
9: A47BA8181D187753
10: 76FAA6B0FF3B9D4D
11: C540C8A06345FAAE
12: 67E454776D871265
13: D4E0ABD317993766
14: BD328F89D3C1FEA5
15: 580E74CB054A9F7D
16: 121002BF94F18D90
OMAC-multi2 (40 byte key)
0: 3A06523F10C9F2C5
1: 310F665F3A12E82A
2: 459FB6A9AC69FE27
3: DEB259E248440826
4: 6598F16BC1BFB8C8
5: B37DFDF8DD61D479
6: 0CE3BD7843FC83C4
7: 3BB7880A7E8D6C9E
8: 74BAA5B4EEFCFDB5
9: B71CC55A72D4BB4F
10: BEF0C7D0781B368B
11: 0CA0D02961398164
12: CF3848FA94C45657
13: 57EA86B185A210D3
14: 05887EB7679F4B62
15: F6A007FF4A175F82
16: 57E61B59AC9F3240
OMAC-camellia (16 byte key)
0: B5664C5148FFB45297703BCC46C19E4E
1: 126EC31A554E8B3B635DE4617092ECE8
2: FD57148685F4AA85AF48017AFD72B410
3: 1427607464A408C1775B4036509E9659
4: D8F5A7112CC8A9DF28B331FE7184BF08
5: 0E29B0F09409DABECF645F05C4A5717C
6: C4155442FDC29685028AF4AADEDCC266
7: 92356ACB98AE2EDAABE0D3ED0C90772B
8: AA3C828618F72258D91BC391876776C3
9: 189458BA4D98E85802E7028E5C57A25F
10: EE652D70328DA00D63B42A5E85D70E63
11: F9D1E5F8E1539F2D657A047755CD232E
12: 56FF5979FD3DEAD90EAAAF79A9AF1DCD
13: 7E8B39D459D5AB449A8C5917B0CD0C4E
14: 822D9B9C434C6FF7F0E5A25281740A91
15: 654909D2836CCB06501CB359C717C1B9
16: E8996FC89D47C91543B7BA3DC1C34B73
17: DC29D51B2372DD7564CF56AF8702924F
18: AD74D081197644DFE2723CABC991B1AC
19: 26145C6DF074CA53125F6F386FBEA373
20: 72C6C760A70FE410FAD113D8BE711D75
21: 099D3B5802D7FB699B6B8F031BE10B3F
22: A9D5DD3988A18AA7BC6F9C050BDBE8D2
23: F7E99E4C3C7D127FF04FF325F7B06997
24: E99A2F7547B5C6EDF3BC2EC2B8F05198
25: 46C42FF49FCCFC49FBC99FEB08FEF10A
26: DC349D600A754F73ACE6A7D2D00D3551
27: FC2E5434ABBA44ABD9D724A9BB6CA2A6
28: BA923927BF0074AD73BA8A6914194297
29: 7DAB39F8D7E5CB93265568E6713C7CCD
30: 9F60259B759B68E1C8F89CC36C7E170E
31: 7D611F8BFEF0491CED8815C0E3D4CAFF
32: 31E04DE5F9D1403C660E39891DE0D8DE
OMAC-idea (16 byte key)
0: B821849AF0FBE074
1: F686CE9F4D057023
2: A76370E35B3F4AF2
3: 77553E49EAA385F2
4: EC535FA524C96DEB
5: 2C0D343664AFFC4E
6: 42CD72FF061B53FF
7: 7FA04FA032DAAC2B
8: 9C9390E1F70D50BC
9: 30CAF924369C5249
10: 9FBB0EFC020AAC6E
11: 131B42C7B807BE1A
12: D2B7B9B0C6DB4EEE
13: AEC00D350FE9B72C
14: 046985BB876162E8
15: 2650AF8B3983AE0D
16: 50F09209EB28179E
OMAC-serpent (16 byte key)
0: 32B85B2D0F6A080E75F1FFE3A9FB5FFB
1: F64B8FE18564E74DCBD49F773D7979CA
2: E3C48FFF5808AA7945481908FC717548
3: E0C62FF36F4B4EA65E1AF2D09039CFE3
4: AB03CE05922E2B6AF001B267DBE31BB1
5: E4064DD1F7B97BB930F38C601375A6ED
6: DC0E7B1BA3CDBD7E12EE7925937551CC
7: 57339E1EF4A9E91D10C3FBE6FE93CC93
8: 85DF3A320B77510535723BDB885C6471
9: 15E3F593D2200F27DEF08CEFE763CBC6
10: FEA659B89FD367CB508411FFED43F1B8
11: 4B7C3776A1520E31A5BC80EBE3470276
12: 425FC3093FEEB420672EA70A71D7C7BC
13: EDE32E118616A02F3E43E1607D5E715E
14: 00ABB127256308E517C12D41D72C6F53
15: 2AC61ED0CE3393129EA22A6715536334
16: 01175B1577CE91E81C27B51372617995
17: ECE4166171B912D090AB134875C7249C
18: 481E14C574AA8AB6DFBDFA81B3B6F298
19: 2CC33E74FC8FF36A268D25E28610B46E
20: 270735B926CE2F9AD7DEC785D4B4F8E3
21: 5A47B86DBF557698B37025A70417FCFF
22: 19130FFE070FD9C2546C98B76D447104
23: C6BC0BED4C8CF5E182F69DAA13AFA47C
24: BC33925A9EFE64C20B24278663C7FBB0
25: 1552EB3F1396031C7306B2D34EEEC01A
26: 8C0BFE93E9FCF490CA4B4254CFD2C24D
27: 3F570BD03EA24C72CF6CC740B4EA2652
28: C34DAA57DED46E788573472F4DAA1743
29: EA26F5DAC00DEC6BC7F5DA35902DB020
30: 71573E129764A4C1B8F8A2D1BF2013CF
31: C7E18CC108DF3FF1E3A024A1B0B928E0
32: 6E458187EC664A776005EA140154ACBF
OMAC-tea (16 byte key)
0: AFFFFA671072AA14
1: 4F2113632BD0300F
2: EA885545F0601DC4
3: 04EE4A961B57D587
4: 7B3CE6D2F53EBA2D
5: 5589B7ABDFA45D88
6: F0932A9958090A36
7: C82ADECA3A6D8FEC
8: 53DEE813EA84E8EB
9: 268DC8EA239A3FBC
10: E716FC17E51609A6
11: 5F0564D9A8F877F5
12: D3F25DE735A5085B
13: 4A125CAA16ADCDE9
14: DCEE8CB047957FAC
15: 33F078C713C6DA61
16: BB936D1B0427DD4F
OMAC-aria (16 byte key)
0: 67A59B2EB6F1FCBE11D03B919CE21D74
1: 217E6B5334A102372909BE481A40096B
2: 62717F16F92963789D11578B85F0DE38
3: 5DD6246AA71A202591FB0F71F7768B13
4: 254F7E8EB8E07CB75FF2652CC8B7BB99
5: 96FF1A46353CCD4384BA76C394A32AB9
6: B879A9845200C450633F7F08E1825463
7: 2E8A63D5EEDE87C132953B6DD5E6D1DF
8: A9E9B43F84B32897843B941FB73858E1
9: 45F43AFB9D05DD69C12965A073EC3C24
10: DF03CD63C572DF4CD5537F528D0163A1
11: 300F0A6287C0F502F1C61E93262AD5B9
12: E01203F8B448F38C11DF3D185ECB9098
13: 824CEE843D99CCD59BADB05B1094D5ED
14: 2C30622B448B6D29BD4712BB8C0EF9D1
15: AA4AACCFC4C831482C1E03180AAE849C
16: 56098D3E4A8E4A5DBD8813E1CBCE7C10
17: 299E1DD62ABC03BEF1F4B16DB6EE5DA2
18: 0E4A1C1FA5168D5EE11958CB239FAE3C
19: 347675845EE92E88B2F3CA39D83913C4
20: 277EA996C0644D9160C19A0A110F2F26
21: 9EF273E90ECF4B64AD341007F7665004
22: 72665C1EC2D1ED3D388DF9FCB52C1548
23: 8A286DE26FBEE852CA9EF042E090E33D
24: E20999726B222B05267291BB0753B4DA
25: 4724172D40E10BFA4E459C3BF2B34250
26: 352854D9F47B1EC253400A31B87A2F82
27: BFBBCDCEBA180255FB2591CEF984A919
28: CCCDFA6C6BE9F12E50855EBE11A99993
29: F247E6AF74BF433C992C376B61C94B22
30: 7D76C11A122437CC5A839D85B11DF173
31: 3485958402AF7C6A606BE91F45734EF8
32: B66E63BC0D9523C93FD5D89E716008B5

View file

@ -1,5 +1,5 @@
PMAC Tests. In these tests messages of N bytes long (00,01,02,...,NN-1) are OMAC'ed. The initial key is
of the same format (length specified per cipher). The OMAC key in step N+1 is the OMAC output of
PMAC Tests. In these tests messages of N bytes long (00,01,02,...,NN-1) are PMAC'ed. The initial key is
of the same format (length specified per cipher). The PMAC key in step N+1 is the PMAC output of
step N (repeated as required to fill the array).
PMAC-aes (16 byte key)
@ -57,23 +57,23 @@ PMAC-blowfish (8 byte key)
16: BDFE0C7F0254BAD5
PMAC-xtea (16 byte key)
0: A7EF6BB667216DDA
1: B039E53812C4ABDC
2: 87D2F8EA5FB6864D
3: F85E3F4C1D9F5EFC
4: 4EB749D982FB5FE2
5: 0BFA0F172027441A
6: FF82D01F36A6EC91
7: 3BC2AA2028EBBD7A
8: 15AA03A97A971E2A
9: C974691F5D66B835
10: 4FC7AA8F399A79ED
11: 2633DA9E94673BAE
12: 82A9FD48C5B60902
13: 31BF6DA9EE0CE7E4
14: 26B2538601B7620E
15: D103F3C0B4579BE5
16: 031346BA20CD87BC
0: F5E28630DFDE34E0
1: FFCC52D905DA5198
2: 25198AB18B2B290D
3: 18914E50791161E9
4: 200F832212AD6747
5: A9D09C41D734DDF7
6: 32D7CCA3F4BD8215
7: 91A1AA9389CD5D02
8: 35CB1F77D7C25E2F
9: D91EEE6D0A3874F3
10: A42872686A8FF6F2
11: 7568908634A79CBD
12: 5B91A633D919BC34
13: 32DCD17176896F1D
14: 2BBBA64F30E672B6
15: AFEB07DBC636AEED
16: 7A417347CA03C598
PMAC-rc5 (8 byte key)
0: C6B48F8DEC631F7C
@ -313,6 +313,25 @@ PMAC-des (8 byte key)
15: FCE22E6CAD528B49
16: 993884FB9B3FB620
PMAC-desx (24 byte key)
0: CFC3AC7F6B9BC6C4
1: 15F83A2E582CA5DB
2: 648B0A54C2A44D96
3: 76BD5FCA60D3E0D8
4: 59E994CED4C82509
5: 15B6B80165023A25
6: 095AEDA02E235237
7: FDEEF329DD64EE7D
8: 1FE317FD5338ADEF
9: 0E0530FC5984E574
10: 7D670A434BDF5E6E
11: AD0C2D07F449969F
12: 023D921C2523A41D
13: E98F2BE666A5749D
14: FA9DB0029446CA31
15: AF3350DCF2A5D6AC
16: E72861AE67EF88E2
PMAC-3des (24 byte key)
0: E42CCBC9C9457DF6
1: FE766F7930557708
@ -332,6 +351,41 @@ PMAC-3des (24 byte key)
15: B13BFD07E7A202CB
16: 58A6931335B4B2C2
PMAC-sm4 (16 byte key)
0: 69265690FA00C7D1E2AD63F9C01C56CC
1: E63B0AEECB1D62691A360E78ECAD7B73
2: B8B95E753F7016CCCCB0BCC8536D2DE9
3: 22F61907C271F6B779AFC0EEDE1E0AB3
4: 8A31DAB6D0F493058328FFE0A6349CF1
5: 6760AA80889EC043BD944A4F18FD2D0F
6: F50F83052E6AF271787815E01DFB4E8A
7: 4F552D36BC345805EC9FCFCE5E54153F
8: AEF8016C64F27C79562C50C335AA3A10
9: C306E855A485ECC4969F66218705CCEF
10: 7FA21114DC4C11212AD1DEABB8BD8AD6
11: 322BD6CE62C0608438C1715F5871308A
12: 4F5A19156E62660043C12FFDE62D9755
13: EA1D701763EA97753EF54C9AA45F8678
14: 64CAFE7A3C93A469D3A37B3C86A75AF2
15: C8E6F0C75A3829EDB9C3570DCA18126D
16: 1140368A72A1EC6AF8A5449924A76AE1
17: B8EAD770AF3070B3712040E35E297D45
18: 3E862A7270F6EFBB54E56B38E226E349
19: BC80B79D95E6B30F33A1FAC0311835BA
20: 292696B550C240DCFEBA46CD94D6B368
21: 22C4BAA7FC406BCD7C67DDB1D4628185
22: E500A8794059239A63169E62E7F13F9A
23: A756B798A6DD9219D57A488AC32C8682
24: 83A8F58D0FFB75A007CB99CAFFE650BC
25: 99827ACA1F014860E687D0EA721657ED
26: 6AF8CC23F2E4B9777BD171812BBA688F
27: 0F31384898582A32808A66D8E986278F
28: 8C36AD9C3CDA4DE1386CDFD6864C5DBC
29: 0CC3D0BFCA51A052D807396B7160A33B
30: 4E6A494B9C6CF7E4C540AB1CB84F5BE3
31: B0FE54FBC1FDFC468419079DF58C74AC
32: AD881C8EE04209E68E31B66458377848
PMAC-cast5 (8 byte key)
0: 0654F2F4BC1F7470
1: 3F725B162A1C8E6B
@ -352,39 +406,39 @@ PMAC-cast5 (8 byte key)
16: 87D907CACA80A138
PMAC-noekeon (16 byte key)
0: A1E4C84B5958726557DF0855B37AA551
1: 5DE20299CA919D3365B493D3D4895F92
2: AF7E70C336571A857F62A18649EDB197
3: C5F55CFE1AA119C352B64252AD246CBD
4: FEF68A0CE08E8BA315B73B62F861824F
5: 8321C2958DE4903DC12C42A8845ECC20
6: 370466D1324AECF1F5B42E0E01381613
7: 5CB900190F5CACBACFE5EAB0CC289D87
8: A13C043E6CAAA1E34601A93C497446A4
9: 865E11622A4CC8A9E1408E00F56C4543
10: 9DC42C26868374649BD17D69D025CA1B
11: 37D33C11B433C91DA09925CA9E86757A
12: 1373D769C270E7137C953AC0F8F37941
13: 7E81DEC583348B1E2F6267ECF82CB994
14: 505B6329338556518FF364CAA730F5E8
15: 0C085AEEB315968B0BDE904E8BBC6FD0
16: 5FED63259364BE7E5133FF0507DD2D4C
17: F7EE5C80A99AAEADB49E7CC69BFFF679
18: 4388FA5E763A641130940EB705BEFD08
19: 1BC31CA79EBE1674CEBE01BC9988267B
20: BE88961637EFFE2D6905D104FEDD51A4
21: 9C341004FB22AFCC496094E3207CA761
22: B9DAA3620E38FFC7C5D5E7D2D8FE3DE4
23: A38D2E571F037061B4400F1131FDBDEA
24: 61DB71AE77A6EB47F2E9E14E8CBF2F4B
25: 9903A072274CC048EF2C51493266D9ED
26: 1EBEA421DD08859C17DDF39B20A82102
27: F425858618E1A86F4912E4714EFB9E75
28: 3B3D4EA07F7FE6DDFDD02D624ACDFC9F
29: CEEE256591D701514EB17DF73B08A970
30: 5CC56D5D46120C530A23B6C511C685FC
31: 68E484CE18BE28EADD0BBF23291B8237
32: ABD58A9CDF8AA68168A1A402074CF520
0: 276019CC8E43A1B3F300C47B55B7AA22
1: B93E353A2CC21CEAD81C91EC2FCD348E
2: E8B9737CAD705C499F246744DCFE9641
3: EF36B0FFB5439FF8668F35FD1822D0EA
4: B7F5AD89538FC3F03923E98ADF95D0CC
5: 558FCA30F602B4BC6697F44053875204
6: 6B2D6D5A1CF670BE80E4BBB945CD3871
7: 9CFA28FCA22EA12A13AC1093EF5D5EB9
8: 04EDA6C71B9F1177F4A5368684FBBAFB
9: 43C56B31D440EBECE4C74B90750A4653
10: 23D5FA9AFFB2DC3DD372F22690487BAC
11: FD61731F27CF8E791535AAB579A018B4
12: 502D3A64FDED3CA2A2C8A5E986B27E03
13: 1EABBC65B0A08F6CB15218E7153A6003
14: B05DBC66CF92B045FC99395E9D405C4F
15: EE841A0BF2C91C1E2078F06D022F2E6C
16: EA749FBAC6BA9F672796C9D58A8C3294
17: BBEF3CDFB93E5F462773579986F08374
18: B17F7645F80BF5A2817C228987B43C03
19: C995A102DFBB38FA397A4E508B85093D
20: 9011CA395AC3FCD8594C13E67C22E95B
21: 364BF53974D68B8BCF53CAADC5469DEC
22: 5BAD7041372F28DE28BAAAC1A89C10A8
23: 77874E908BFCE6F5E36888A484A754C0
24: 9BDA525416A3129C55886134B79BAEDE
25: 84E3201FA7958223B302D1BC2AC57D55
26: 2B8FA1A95DADB4DC2F7A308D8E3D8C81
27: F74EBF0ACCC187569BDE549F5FC96C36
28: 7023D209F1965EC32253D11835CDFFA5
29: C3C6397D9B0A1D741335882ACDFAC20D
30: 7BC92905F2AF6754256BE087CC4F54DB
31: 0BBA0A507767530F26C3A465DAB11359
32: D2891C8EA1F574A6B2AB091057E0FB2C
PMAC-skipjack (10 byte key)
0: 9CD94B75BC43B647
@ -459,3 +513,219 @@ PMAC-khazad (16 byte key)
15: 93098DA8A180AA35
16: BACE2F4DA8A89E32
PMAC-seed (16 byte key)
0: 58844BC0C53AACF808587A7C35C37DE2
1: 481E3E0831DF5AED135C71BBBD075F4A
2: 11355F9D42E7BAD967DF90E9088D45A7
3: 5E3F82EF0B3CA70DCB614C1016DDB052
4: 35E283B0E6C538ED5F2DF4E004324865
5: 56467B8BA87BDE89DF4A64DC9B9409CF
6: 9315AAAE6CA0868FDCBC397B7DC2DF84
7: A265D861DCE6C9B80CCFF92463DB27D3
8: 196A0813E4EB49F47A1C3713950B194E
9: 261372868D259E609BE5080F282B361A
10: DFDC55CDF60A0CB6A33BC6F4B5E5A481
11: 0BD99E075BC93386CDB40C2AAF8E8918
12: CA1B80D0088D7267C9AFB037DCD8FA56
13: 8EDBC9F77D4DAB3DFABEAB0891622F1C
14: D1A8F869C961739ABFE7F401FA41D6F6
15: 653041670E0BAD5D1FE77A19D9439CEE
16: 440EF361908A528B2A3ED7C50C1A47AB
17: DCE2613438A5DC42AC8F5CE753DDF01D
18: F9E313156CA5345CECB1A5F963E9B201
19: 34D72FB89BA3C41E1D0597531849C6C9
20: 7ED20B28067BA27E37606387D641B75F
21: 933A2E06DA91C208297305FFF4F7795B
22: CC455E1FB196CF5B233921AA6A048B81
23: 613AC1EE5B8D0C3123A18BED9A352980
24: 00A2BBEEB98DB190A694B67EF85A65A4
25: 1A7D50E6051D85CA81D9DD7DE81BF02E
26: A7F948B36D7AF08FB405A1B8C8C6AC6D
27: 967DC3981E7C718B562A93E5292B872F
28: 2674544D8D3E3F750590992C0AFB36AF
29: 193A2CC794CB285B4CB87197EE3550ED
30: 312AAC97C92279428FB1AA0882DB7088
31: 3B9CBA2FF7FF4113BB2DC0DF6BCADDD0
32: 45C5C71122C70F4337F5EC74BA6B446D
PMAC-kasumi (16 byte key)
0: 52DF2D9A9EB4816A
1: 201C1024E6D2AF23
2: 04E7B341BFC96D1A
3: CC11D07594C50F31
4: EE27EAEED00E2F97
5: 51DB73EC42ADB789
6: 097A5F01A90BFE7F
7: 7FD121FD6B504A9D
8: 8A09BC5C1E7FA48C
9: B7A88328D7D84C9E
10: 1D34173FA9F1DFCD
11: 129AC84C0429E80E
12: 81D236AC427123E4
13: 72D4EFEDD56F6253
14: ACFC8D6AF30F8B64
15: C7F75094394C1765
16: D95208BCB48FAA38
PMAC-multi2 (40 byte key)
0: 4799ECD07D95FF68
1: 5B94DBFD53C531D7
2: DF09EDE792536619
3: 01FB72E4EE79DFEF
4: 4159642D6ED0D4D8
5: B6909A449A0A85BB
6: 20B167D3AA349DEA
7: E550AAB246D99D92
8: 5E1042397C86B08C
9: 3789D96B64C85AC0
10: 72C0921EF5B5DEDE
11: 5923493300FA910E
12: B589609B09B4D12F
13: 5EA42FE501CD696D
14: 4413763D2689108B
15: 07207040BAFC8E6D
16: 4E80F408AA6F1DD9
PMAC-camellia (16 byte key)
0: 33C03F6AA205F3816A17DA92BEE0BAD2
1: AD1EC293DD032511579235B2F29CC909
2: E71363EAF5A311DCFB035C69BBCE5DC0
3: 22661D6CD3496FB5C9B3D89FC62E3981
4: B142A96AF9C481B61E55B7B5896847C4
5: A286C0769989120F8A31A8DAD7574F22
6: 09E711382FDB6B938C802D11A66EF657
7: DF9ABA4F5CF5B0647F045C3AA631BB62
8: 499A8F68DAEC7FE56E64DB59B0993741
9: AFFDA4F40A1BDF673EE9123CAE321F16
10: B6F2E39D0126AA85D9152C4457365235
11: 2922AAC2FF4F0B77DEE4B3E28EF5094F
12: 369D18F985D18B5ADDFFFC1151DE6BBA
13: 1B7641D1A38C4114EE829B7D25BF0EFF
14: DEF9092BA185FD5238A25C6FCF410C52
15: D59FEE8047D64032329318DC7A2277B8
16: B4561A4A092E031F8FE998FAC87F9BFB
17: F27EF7D0823B056F692BA369D1B2E7B4
18: F62C4F7B749CF31A6F5485BFDED7EEBD
19: 22BD3AB334BE6E04C84D6197FF69CAE3
20: E617D108BED8E9ACBA55FAF60863F8C3
21: 0DB60AE0725D37855F3AF1DDF78E98EB
22: C76DD5A075AB30AB66FC448BD19B6588
23: 60231366598BEB2D16D33A1A8019B9A1
24: 247E925C96064801490A1D062A0C1F18
25: 1C1081E20DE3BE26FF24BEC3DFBA9BF2
26: 3B16562B3CD862C00A03B7ADC99E46C5
27: C1E8BA560851254640D523A0CEE846AF
28: C36E8CF324A0A4EBC6C76EA01CDFD158
29: EAED84E721777F5E30184E496DA2C0FA
30: 6655CA0D8741440212AA0DB218E5C7FE
31: D5C0143E1BA233BA5F862EE6E11A8F58
32: C8DAF08BD68F4AE401C6663393C257CB
PMAC-idea (16 byte key)
0: 1B010822EBB2E3F0
1: 943AA2133BD2CAE7
2: 6AB636AFF380D7E1
3: 9F5CA3037C13D0A9
4: 8EBB7A3E8757A414
5: C01F7BF5986987D7
6: FA9C1B62100EF6C7
7: F69FC035FD89BDB9
8: FA5C607B2D97FD7D
9: A112CDFAFF150870
10: ABBFD9DC6D530842
11: 6FF72677F0A845D2
12: A6803A517E9F1C34
13: A5A45E3AD8300F30
14: 3854B6FABF268B8A
15: DD3E679D6387A082
16: 872DDF68887A9606
PMAC-serpent (16 byte key)
0: F339DEF404209BCB165EB7BCFD992CBE
1: 4AC8EFF62CBCF0DF5EED09C481DAEC02
2: 8D89B71DE01632A07641FA5A92DB8F3F
3: CD3BA1D7DD7ABE17BFBD48E1B391EB77
4: 579BF88799B0B67F2E1B12D34B20DF9C
5: 56C6AACC2B142F18A680B6AAA5AA82A4
6: 082EFD0AA9B9BA02132F2B74B748E243
7: 6B800A69716D6FFF5C9836176F724AA3
8: FF406270AED77526DC8E84FEFC7A57C2
9: C2E5741342F888E4CE0D661986388FEE
10: 47AB010F388A9E10017155D88F35F20B
11: A5623D8A148DF62024F2C621DE0C4E2A
12: C6B47AAAF01A7E4683C461D119288354
13: FB7274149DB6E4E2CC757E8A95EBE335
14: FE74C4559520165DABCB75942C333950
15: EFD0DEBF6304F04C6CFAD4B6A4DF6C58
16: 89BDE6A86A4A14ED553732CF979F9599
17: AEB77664F24297E6471218B2F68A5BFD
18: 1AD0F4ED52FDEF747BF3E3C8DF7334DE
19: 16273AD4918181B8E183F661D1EE7991
20: 061DBAABEA31DFBD68A57151633FEDF5
21: 2206B89F47FA497C506B25736B672F70
22: 86F3809E186C70B2FD7B0BC88A0A81F6
23: 193CD2D4777DAE6FD7EF176EA9065C81
24: 9274BBB50D1CB86C39CA0AC0A5224A9E
25: F7BD94AB66D03AA22CB41F72874316DE
26: 1E48C30E5502E98B7F7038BEE7BC658A
27: AB7E6F468283DA5219CC76D83915CA63
28: 54CBD6BB08511366E56EA95414766D97
29: 73E91132A2B53930D4415A5B4F7BD523
30: 67E45427A9CCFAB9A11BD6AF2C4E9A80
31: 11F399978DB69A7957F2DF1A44206841
32: D6C0DE7EEB98DA9EB0F800D2734B100A
PMAC-tea (16 byte key)
0: 9C47729C9C2F4813
1: 1E9EDE66951A751E
2: 5F0FF355F5C067AB
3: EDE26E1BF7FF7662
4: 9C2D4A377660E475
5: C9A605E660C8E954
6: 578873E2BF4CCC0B
7: 1D888213B1AA95DB
8: A6631112C99F4E47
9: 02312F3A134B9DCA
10: 35D9138A4B5ABA96
11: A21B17E07D6E3F9B
12: DC6D9724BF55DE13
13: 87E31C1EFD9D35E9
14: 38DCBC571E62088A
15: B63413E18BEC7ABE
16: 200DA2D5CD5B9AA9
PMAC-aria (16 byte key)
0: 2CE69C7A23FC33E16BCE520FF817A5B1
1: 3A0A6074E3A355AF2B01EC6E2A9D1743
2: DE301897CB79D1433F1EF129A7095D7E
3: 42D58203CE8A9156CA2AF2DA8E73E9A7
4: 3FE6DA83BDFF1BCBACD774378B240A00
5: A41049220180391995DF4A1F5012537F
6: E7F61B5FB93FCA8CBF7444BB13169DFB
7: 818876083F41B10D64CA019C573835BA
8: 7B85D7BDFBD58647DD1D3AA70CDBF37A
9: E52F9631A00AC724B4F9F6F10E0C827A
10: 060AC14DE545A11A54F891C628974FCD
11: E3C2BA3377011C4F7460DDCAF2B09B75
12: 15D1FAA72C1D6343CEC360A79A28BC4C
13: F31CF0E65EBFE9E03C3AA5855BB0FEB8
14: 317B7B98E32E92290E1796C2F2DE8E99
15: FAC6AB8267C4E86917111C26A0F4AC6D
16: F4E050290E133AF04F6738E2DE072186
17: C21EC6D64D24E1F4E6C2C0C39684FF32
18: 1DD883F28421077EC104706AF0A19C8B
19: 362762240DFBB8AB8F23C3E3FBC64551
20: 61BCBB5E7AD28BF7639E34523194D886
21: FB033E6D2C3889DCBFC8C1A56B22EDD2
22: E548BD72650272DB7190E0AF423CCA6B
23: 590E55E4F78FA503A0139A0A7197086B
24: F6EF0C277329C94B04C6083712E12E28
25: 6D09C97F3FD331E5E010EC0239A6A701
26: EEEAA8881DD36342D614054FC74BF97F
27: 30F84E0E94898C3898065A1B4935C183
28: 73D68BCD84986788AF945A03CD186B01
29: 8B7A7DE1F289245E8F0E41D61B98C246
30: 5509778C82C66012D90F6B0C801835D0
31: 09D6855B8081BF8D6F5E9736A5A0D4DA
32: FE18CE0DCDC76D00452F1568A2F6D0D9

View file

@ -0,0 +1,11 @@
default: regen
clean:
rm -f *.c
regen:
python rt.py pss-vect.txt pss > pss-vect.c
python rt.py oaep-vect.txt oaep > oaep-vect.c
python rt.py pkcs1v15sign-vectors.txt emsa > pkcs1v15sign-vectors.c
python rt.py pkcs1v15crypt-vectors.txt eme > pkcs1v15crypt-vectors.c

View file

@ -0,0 +1,369 @@
# =================================
# WORKED-OUT EXAMPLE FOR RSAES-OAEP
# =================================
#
# This file gives an example of the process of
# encrypting and decrypting a message with
# RSAES-OAEP as specified in PKCS #1 v2.1.
#
# The message is a bit string of length 128,
# while the size of the modulus in the public
# key is 1024 bits. The second representation
# of the private key is used, which means that
# CRT is applied in the decryption process.
#
# The underlying hash function is SHA-1; the
# mask generation function is MGF1 with SHA-1
# as specified in PKCS #1 v2.1.
#
# This file also contains a demonstration of
# the RSADP decryption primitive with CRT.
# Finally, DER encodings of the RSA keys are
# given at the end of the file.
#
#
# Integers are represented by strings of octets
# with the leftmost octet being the most
# significant octet. For example,
#
# 9,202,000 = (0x)8c 69 50.
#
# =============================================
# ------------------------------
# Components of the RSA Key Pair
# ------------------------------
# RSA modulus n:
bb f8 2f 09 06 82 ce 9c 23 38 ac 2b 9d a8 71 f7
36 8d 07 ee d4 10 43 a4 40 d6 b6 f0 74 54 f5 1f
b8 df ba af 03 5c 02 ab 61 ea 48 ce eb 6f cd 48
76 ed 52 0d 60 e1 ec 46 19 71 9d 8a 5b 8b 80 7f
af b8 e0 a3 df c7 37 72 3e e6 b4 b7 d9 3a 25 84
ee 6a 64 9d 06 09 53 74 88 34 b2 45 45 98 39 4e
e0 aa b1 2d 7b 61 a5 1f 52 7a 9a 41 f6 c1 68 7f
e2 53 72 98 ca 2a 8f 59 46 f8 e5 fd 09 1d bd cb
# RSA public exponent e:
(0x)11
# Prime p:
ee cf ae 81 b1 b9 b3 c9 08 81 0b 10 a1 b5 60 01
99 eb 9f 44 ae f4 fd a4 93 b8 1a 9e 3d 84 f6 32
12 4e f0 23 6e 5d 1e 3b 7e 28 fa e7 aa 04 0a 2d
5b 25 21 76 45 9d 1f 39 75 41 ba 2a 58 fb 65 99
# Prime q:
c9 7f b1 f0 27 f4 53 f6 34 12 33 ea aa d1 d9 35
3f 6c 42 d0 88 66 b1 d0 5a 0f 20 35 02 8b 9d 86
98 40 b4 16 66 b4 2e 92 ea 0d a3 b4 32 04 b5 cf
ce 33 52 52 4d 04 16 a5 a4 41 e7 00 af 46 15 03
# p's CRT exponent dP:
54 49 4c a6 3e ba 03 37 e4 e2 40 23 fc d6 9a 5a
eb 07 dd dc 01 83 a4 d0 ac 9b 54 b0 51 f2 b1 3e
d9 49 09 75 ea b7 74 14 ff 59 c1 f7 69 2e 9a 2e
20 2b 38 fc 91 0a 47 41 74 ad c9 3c 1f 67 c9 81
# q's CRT exponent dQ:
47 1e 02 90 ff 0a f0 75 03 51 b7 f8 78 86 4c a9
61 ad bd 3a 8a 7e 99 1c 5c 05 56 a9 4c 31 46 a7
f9 80 3f 8f 6f 8a e3 42 e9 31 fd 8a e4 7a 22 0d
1b 99 a4 95 84 98 07 fe 39 f9 24 5a 98 36 da 3d
# CRT coefficient qInv:
b0 6c 4f da bb 63 01 19 8d 26 5b db ae 94 23 b3
80 f2 71 f7 34 53 88 50 93 07 7f cd 39 e2 11 9f
c9 86 32 15 4f 58 83 b1 67 a9 67 bf 40 2b 4e 9e
2e 0f 96 56 e6 98 ea 36 66 ed fb 25 79 80 39 f7
# ----------------------------------
# Step-by-step RSAES-OAEP Encryption
# ----------------------------------
# Message M to be encrypted:
d4 36 e9 95 69 fd 32 a7 c8 a0 5b bc 90 d3 2c 49
# Label L:
(the empty string)
# lHash = Hash(L)
# DB = lHash || Padding || M
# seed = random string of octets
# dbMask = MGF(seed, length(DB))
# maskedDB = DB xor dbMask
# seedMask = MGF(maskedDB, length(seed))
# maskedSeed = seed xor seedMask
# EM = 0x00 || maskedSeed || maskedDB
# lHash:
da 39 a3 ee 5e 6b 4b 0d 32 55 bf ef 95 60 18 90
af d8 07 09
# DB:
da 39 a3 ee 5e 6b 4b 0d 32 55 bf ef 95 60 18 90
af d8 07 09 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 01 d4 36 e9 95 69
fd 32 a7 c8 a0 5b bc 90 d3 2c 49
# seed:
aa fd 12 f6 59 ca e6 34 89 b4 79 e5 07 6d de c2
f0 6c b5 8f
# dbMask:
06 e1 de b2 36 9a a5 a5 c7 07 d8 2c 8e 4e 93 24
8a c7 83 de e0 b2 c0 46 26 f5 af f9 3e dc fb 25
c9 c2 b3 ff 8a e1 0e 83 9a 2d db 4c dc fe 4f f4
77 28 b4 a1 b7 c1 36 2b aa d2 9a b4 8d 28 69 d5
02 41 21 43 58 11 59 1b e3 92 f9 82 fb 3e 87 d0
95 ae b4 04 48 db 97 2f 3a c1 4e af f4 9c 8c 3b
7c fc 95 1a 51 ec d1 dd e6 12 64
# maskedDB:
dc d8 7d 5c 68 f1 ee a8 f5 52 67 c3 1b 2e 8b b4
25 1f 84 d7 e0 b2 c0 46 26 f5 af f9 3e dc fb 25
c9 c2 b3 ff 8a e1 0e 83 9a 2d db 4c dc fe 4f f4
77 28 b4 a1 b7 c1 36 2b aa d2 9a b4 8d 28 69 d5
02 41 21 43 58 11 59 1b e3 92 f9 82 fb 3e 87 d0
95 ae b4 04 48 db 97 2f 3a c1 4f 7b c2 75 19 52
81 ce 32 d2 f1 b7 6d 4d 35 3e 2d
# seedMask:
41 87 0b 5a b0 29 e6 57 d9 57 50 b5 4c 28 3c 08
72 5d be a9
# maskedSeed:
eb 7a 19 ac e9 e3 00 63 50 e3 29 50 4b 45 e2 ca
82 31 0b 26
# EM = 00 || maskedSeed || maskedDB:
00 eb 7a 19 ac e9 e3 00 63 50 e3 29 50 4b 45 e2
ca 82 31 0b 26 dc d8 7d 5c 68 f1 ee a8 f5 52 67
c3 1b 2e 8b b4 25 1f 84 d7 e0 b2 c0 46 26 f5 af
f9 3e dc fb 25 c9 c2 b3 ff 8a e1 0e 83 9a 2d db
4c dc fe 4f f4 77 28 b4 a1 b7 c1 36 2b aa d2 9a
b4 8d 28 69 d5 02 41 21 43 58 11 59 1b e3 92 f9
82 fb 3e 87 d0 95 ae b4 04 48 db 97 2f 3a c1 4f
7b c2 75 19 52 81 ce 32 d2 f1 b7 6d 4d 35 3e 2d
# Ciphertext, the RSA encryption of EM:
12 53 e0 4d c0 a5 39 7b b4 4a 7a b8 7e 9b f2 a0
39 a3 3d 1e 99 6f c8 2a 94 cc d3 00 74 c9 5d f7
63 72 20 17 06 9e 52 68 da 5d 1c 0b 4f 87 2c f6
53 c1 1d f8 23 14 a6 79 68 df ea e2 8d ef 04 bb
6d 84 b1 c3 1d 65 4a 19 70 e5 78 3b d6 eb 96 a0
24 c2 ca 2f 4a 90 fe 9f 2e f5 c9 c1 40 e5 bb 48
da 95 36 ad 87 00 c8 4f c9 13 0a de a7 4e 55 8d
51 a7 4d df 85 d8 b5 0d e9 68 38 d6 06 3e 09 55
# --------------------------------------------
# Step-by-step RSAES-OAEP Decryption Using CRT
# --------------------------------------------
# c = the integer value of C above
# m1 = c^dP mod p = (c mod p)^dP mod p
# m2 = c^dQ mod q = (c mod q)^dQ mod q
# h = (m1-m2)*qInv mod p
# m = m2 + q*h = the integer value of EM above
# c mod p:
de 63 d4 72 35 66 fa a7 59 bf e4 08 82 1d d5 25
72 ec 92 85 4d df 87 a2 b6 64 d4 4d aa 37 ca 34
6a 05 20 3d 82 ff 2d e8 e3 6c ec 1d 34 f9 8e b6
05 e2 a7 d2 6d e7 af 36 9c e4 ec ae 14 e3 56 33
# c mod q:
a2 d9 24 de d9 c3 6d 62 3e d9 a6 5b 5d 86 2c fb
ec 8b 19 9c 64 27 9c 54 14 e6 41 19 6e f1 c9 3c
50 7a 9b 52 13 88 1a ad 05 b4 cc fa 02 8a c1 ec
61 42 09 74 bf 16 25 83 6b 0b 7d 05 fb b7 53 36
# m1:
89 6c a2 6c d7 e4 87 1c 7f c9 68 a8 ed ea 11 e2
71 82 4f 0e 03 65 52 17 94 f1 e9 e9 43 b4 a4 4b
57 c9 e3 95 a1 46 74 78 f5 26 49 6b 4b b9 1f 1c
ba ea 90 0f fc 60 2c f0 c6 63 6e ba 84 fc 9f f7
# m2:
4e bb 22 75 85 f0 c1 31 2d ca 19 e0 b5 41 db 14
99 fb f1 4e 27 0e 69 8e 23 9a 8c 27 a9 6c da 9a
74 09 74 de 93 7b 5c 9c 93 ea d9 46 2c 65 75 02
1a 23 d4 64 99 dc 9f 6b 35 89 75 59 60 8f 19 be
# h:
01 2b 2b 24 15 0e 76 e1 59 bd 8d db 42 76 e0 7b
fa c1 88 e0 8d 60 47 cf 0e fb 8a e2 ae bd f2 51
c4 0e bc 23 dc fd 4a 34 42 43 94 ad a9 2c fc be
1b 2e ff bb 60 fd fb 03 35 9a 95 36 8d 98 09 25
# m:
00 eb 7a 19 ac e9 e3 00 63 50 e3 29 50 4b 45 e2
ca 82 31 0b 26 dc d8 7d 5c 68 f1 ee a8 f5 52 67
c3 1b 2e 8b b4 25 1f 84 d7 e0 b2 c0 46 26 f5 af
f9 3e dc fb 25 c9 c2 b3 ff 8a e1 0e 83 9a 2d db
4c dc fe 4f f4 77 28 b4 a1 b7 c1 36 2b aa d2 9a
b4 8d 28 69 d5 02 41 21 43 58 11 59 1b e3 92 f9
82 fb 3e 87 d0 95 ae b4 04 48 db 97 2f 3a c1 4f
7b c2 75 19 52 81 ce 32 d2 f1 b7 6d 4d 35 3e 2d
# The intermediate values in the remaining
# decryption process are the same as during
# RSAES-OAEP encryption of M.
# =============================================
# ========================
# DER Encoding of RSA Keys
# ========================
# ------------
# RSAPublicKey
# ------------
30 81 87
# modulus
02 81 81
00 bb f8 2f 09 06 82 ce
9c 23 38 ac 2b 9d a8 71
f7 36 8d 07 ee d4 10 43
a4 40 d6 b6 f0 74 54 f5
1f b8 df ba af 03 5c 02
ab 61 ea 48 ce eb 6f cd
48 76 ed 52 0d 60 e1 ec
46 19 71 9d 8a 5b 8b 80
7f af b8 e0 a3 df c7 37
72 3e e6 b4 b7 d9 3a 25
84 ee 6a 64 9d 06 09 53
74 88 34 b2 45 45 98 39
4e e0 aa b1 2d 7b 61 a5
1f 52 7a 9a 41 f6 c1 68
7f e2 53 72 98 ca 2a 8f
59 46 f8 e5 fd 09 1d bd
cb
# publicExponent
02 01
11
# -------------
# RSAPrivateKey
# -------------
30 82 02 5b
# version
02 01
00
# modulus
02 81 81
00 bb f8 2f 09 06 82 ce
9c 23 38 ac 2b 9d a8 71
f7 36 8d 07 ee d4 10 43
a4 40 d6 b6 f0 74 54 f5
1f b8 df ba af 03 5c 02
ab 61 ea 48 ce eb 6f cd
48 76 ed 52 0d 60 e1 ec
46 19 71 9d 8a 5b 8b 80
7f af b8 e0 a3 df c7 37
72 3e e6 b4 b7 d9 3a 25
84 ee 6a 64 9d 06 09 53
74 88 34 b2 45 45 98 39
4e e0 aa b1 2d 7b 61 a5
1f 52 7a 9a 41 f6 c1 68
7f e2 53 72 98 ca 2a 8f
59 46 f8 e5 fd 09 1d bd
cb
# publicExponent
02 01
11
# privateExponent
02 81 81
00 a5 da fc 53 41 fa f2
89 c4 b9 88 db 30 c1 cd
f8 3f 31 25 1e 06 68 b4
27 84 81 38 01 57 96 41
b2 94 10 b3 c7 99 8d 6b
c4 65 74 5e 5c 39 26 69
d6 87 0d a2 c0 82 a9 39
e3 7f dc b8 2e c9 3e da
c9 7f f3 ad 59 50 ac cf
bc 11 1c 76 f1 a9 52 94
44 e5 6a af 68 c5 6c 09
2c d3 8d c3 be f5 d2 0a
93 99 26 ed 4f 74 a1 3e
dd fb e1 a1 ce cc 48 94
af 94 28 c2 b7 b8 88 3f
e4 46 3a 4b c8 5b 1c b3
c1
# prime1
02 41
00 ee cf ae 81 b1 b9 b3
c9 08 81 0b 10 a1 b5 60
01 99 eb 9f 44 ae f4 fd
a4 93 b8 1a 9e 3d 84 f6
32 12 4e f0 23 6e 5d 1e
3b 7e 28 fa e7 aa 04 0a
2d 5b 25 21 76 45 9d 1f
39 75 41 ba 2a 58 fb 65
99
# prime2
02 41
00 c9 7f b1 f0 27 f4 53
f6 34 12 33 ea aa d1 d9
35 3f 6c 42 d0 88 66 b1
d0 5a 0f 20 35 02 8b 9d
86 98 40 b4 16 66 b4 2e
92 ea 0d a3 b4 32 04 b5
cf ce 33 52 52 4d 04 16
a5 a4 41 e7 00 af 46 15
03
# exponent1
02 40
54 49 4c a6 3e ba 03 37
e4 e2 40 23 fc d6 9a 5a
eb 07 dd dc 01 83 a4 d0
ac 9b 54 b0 51 f2 b1 3e
d9 49 09 75 ea b7 74 14
ff 59 c1 f7 69 2e 9a 2e
20 2b 38 fc 91 0a 47 41
74 ad c9 3c 1f 67 c9 81
# exponent2
02 40
47 1e 02 90 ff 0a f0 75
03 51 b7 f8 78 86 4c a9
61 ad bd 3a 8a 7e 99 1c
5c 05 56 a9 4c 31 46 a7
f9 80 3f 8f 6f 8a e3 42
e9 31 fd 8a e4 7a 22 0d
1b 99 a4 95 84 98 07 fe
39 f9 24 5a 98 36 da 3d
# coefficient
02 41
00 b0 6c 4f da bb 63 01
19 8d 26 5b db ae 94 23
b3 80 f2 71 f7 34 53 88
50 93 07 7f cd 39 e2 11
9f c9 86 32 15 4f 58 83
b1 67 a9 67 bf 40 2b 4e
9e 2e 0f 96 56 e6 98 ea
36 66 ed fb 25 79 80 39
f7
# ------------------------
# PrivateKeyInfo (PKCS #8)
# ------------------------
30 82 02 75
# version
02 01
00
# privateKeyAlgorithmIdentifier
30 0d
06 09
2a 86 48 86 f7 0d 01 01 01
# parameters
05 00
# privateKey = RSAPrivateKey encoding
04 82 02 5f
# DER encoding of RSAPrivateKey structure
30 82 02 5b ... 79 80 39 f7
# =============================================

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,162 @@
# =================================
# WORKED-OUT EXAMPLE FOR RSASSA-PSS
# =================================
#
# This file gives an example of the process of
# signing a message with RSASSA-PSS as
# specified in PKCS #1 v2.1.
#
# The message is an octet string of length 114,
# while the size of the modulus in the public
# key is 1024 bits. The message is signed via a
# random salt of length 20 octets
#
# The underlying hash function in the EMSA-PSS
# encoding method is SHA-1; the mask generation
# function is MGF1 with SHA-1 as specified in
# PKCS #1 v2.1.
#
# Integers are represented by strings of octets
# with the leftmost octet being the most
# significant octet. For example,
#
# 9,202,000 = (0x)8c 69 50.
#
# =============================================
# ------------------------------
# Components of the RSA Key Pair
# ------------------------------
# RSA modulus n:
a2 ba 40 ee 07 e3 b2 bd 2f 02 ce 22 7f 36 a1 95
02 44 86 e4 9c 19 cb 41 bb bd fb ba 98 b2 2b 0e
57 7c 2e ea ff a2 0d 88 3a 76 e6 5e 39 4c 69 d4
b3 c0 5a 1e 8f ad da 27 ed b2 a4 2b c0 00 fe 88
8b 9b 32 c2 2d 15 ad d0 cd 76 b3 e7 93 6e 19 95
5b 22 0d d1 7d 4e a9 04 b1 ec 10 2b 2e 4d e7 75
12 22 aa 99 15 10 24 c7 cb 41 cc 5e a2 1d 00 ee
b4 1f 7c 80 08 34 d2 c6 e0 6b ce 3b ce 7e a9 a5
# RSA public exponent e:
01 00 01
# Prime p:
d1 7f 65 5b f2 7c 8b 16 d3 54 62 c9 05 cc 04 a2
6f 37 e2 a6 7f a9 c0 ce 0d ce d4 72 39 4a 0d f7
43 fe 7f 92 9e 37 8e fd b3 68 ed df f4 53 cf 00
7a f6 d9 48 e0 ad e7 57 37 1f 8a 71 1e 27 8f 6b
# Prime q:
c6 d9 2b 6f ee 74 14 d1 35 8c e1 54 6f b6 29 87
53 0b 90 bd 15 e0 f1 49 63 a5 e2 63 5a db 69 34
7e c0 c0 1b 2a b1 76 3f d8 ac 1a 59 2f b2 27 57
46 3a 98 24 25 bb 97 a3 a4 37 c5 bf 86 d0 3f 2f
# p's CRT exponent dP:
9d 0d bf 83 e5 ce 9e 4b 17 54 dc d5 cd 05 bc b7
b5 5f 15 08 33 0e a4 9f 14 d4 e8 89 55 0f 82 56
cb 5f 80 6d ff 34 b1 7a da 44 20 88 53 57 7d 08
e4 26 28 90 ac f7 52 46 1c ea 05 54 76 01 bc 4f
# q's CRT exponent dQ:
12 91 a5 24 c6 b7 c0 59 e9 0e 46 dc 83 b2 17 1e
b3 fa 98 81 8f d1 79 b6 c8 bf 6c ec aa 47 63 03
ab f2 83 fe 05 76 9c fc 49 57 88 fe 5b 1d df de
9e 88 4a 3c d5 e9 36 b7 e9 55 eb f9 7e b5 63 b1
# CRT coefficient qInv:
a6 3f 1d a3 8b 95 0c 9a d1 c6 7c e0 d6 77 ec 29
14 cd 7d 40 06 2d f4 2a 67 eb 19 8a 17 6f 97 42
aa c7 c5 fe a1 4f 22 97 66 2b 84 81 2c 4d ef c4
9a 80 25 ab 43 82 28 6b e4 c0 37 88 dd 01 d6 9f
# ---------------------------------
# Step-by-step RSASSA-PSS Signature
# ---------------------------------
# Message M to be signed:
85 9e ef 2f d7 8a ca 00 30 8b dc 47 11 93 bf 55
bf 9d 78 db 8f 8a 67 2b 48 46 34 f3 c9 c2 6e 64
78 ae 10 26 0f e0 dd 8c 08 2e 53 a5 29 3a f2 17
3c d5 0c 6d 5d 35 4f eb f7 8b 26 02 1c 25 c0 27
12 e7 8c d4 69 4c 9f 46 97 77 e4 51 e7 f8 e9 e0
4c d3 73 9c 6b bf ed ae 48 7f b5 56 44 e9 ca 74
ff 77 a5 3c b7 29 80 2f 6e d4 a5 ff a8 ba 15 98
90 fc
# mHash = Hash(M)
# salt = random string of octets
# M' = Padding || mHash || salt
# H = Hash(M')
# DB = Padding || salt
# dbMask = MGF(H, length(DB))
# maskedDB = DB xor dbMask (leftmost bit set to
# zero)
# EM = maskedDB || H || 0xbc
# mHash:
37 b6 6a e0 44 58 43 35 3d 47 ec b0 b4 fd 14 c1
10 e6 2d 6a
# salt:
e3 b5 d5 d0 02 c1 bc e5 0c 2b 65 ef 88 a1 88 d8
3b ce 7e 61
# M':
00 00 00 00 00 00 00 00 37 b6 6a e0 44 58 43 35
3d 47 ec b0 b4 fd 14 c1 10 e6 2d 6a e3 b5 d5 d0
02 c1 bc e5 0c 2b 65 ef 88 a1 88 d8 3b ce 7e 61
# H:
df 1a 89 6f 9d 8b c8 16 d9 7c d7 a2 c4 3b ad 54
6f be 8c fe
# DB:
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 01 e3 b5 d5 d0 02 c1 bc e5 0c
2b 65 ef 88 a1 88 d8 3b ce 7e 61
# dbMask:
66 e4 67 2e 83 6a d1 21 ba 24 4b ed 65 76 b8 67
d9 a4 47 c2 8a 6e 66 a5 b8 7d ee 7f bc 7e 65 af
50 57 f8 6f ae 89 84 d9 ba 7f 96 9a d6 fe 02 a4
d7 5f 74 45 fe fd d8 5b 6d 3a 47 7c 28 d2 4b a1
e3 75 6f 79 2d d1 dc e8 ca 94 44 0e cb 52 79 ec
d3 18 3a 31 1f c8 97 39 a9 66 43 13 6e 8b 0f 46
5e 87 a4 53 5c d4 c5 9b 10 02 8d
# maskedDB:
66 e4 67 2e 83 6a d1 21 ba 24 4b ed 65 76 b8 67
d9 a4 47 c2 8a 6e 66 a5 b8 7d ee 7f bc 7e 65 af
50 57 f8 6f ae 89 84 d9 ba 7f 96 9a d6 fe 02 a4
d7 5f 74 45 fe fd d8 5b 6d 3a 47 7c 28 d2 4b a1
e3 75 6f 79 2d d1 dc e8 ca 94 44 0e cb 52 79 ec
d3 18 3a 31 1f c8 96 da 1c b3 93 11 af 37 ea 4a
75 e2 4b db fd 5c 1d a0 de 7c ec
# Encoded message EM:
66 e4 67 2e 83 6a d1 21 ba 24 4b ed 65 76 b8 67
d9 a4 47 c2 8a 6e 66 a5 b8 7d ee 7f bc 7e 65 af
50 57 f8 6f ae 89 84 d9 ba 7f 96 9a d6 fe 02 a4
d7 5f 74 45 fe fd d8 5b 6d 3a 47 7c 28 d2 4b a1
e3 75 6f 79 2d d1 dc e8 ca 94 44 0e cb 52 79 ec
d3 18 3a 31 1f c8 96 da 1c b3 93 11 af 37 ea 4a
75 e2 4b db fd 5c 1d a0 de 7c ec df 1a 89 6f 9d
8b c8 16 d9 7c d7 a2 c4 3b ad 54 6f be 8c fe bc
# Signature S, the RSA decryption of EM:
8d aa 62 7d 3d e7 59 5d 63 05 6c 7e c6 59 e5 44
06 f1 06 10 12 8b aa e8 21 c8 b2 a0 f3 93 6d 54
dc 3b dc e4 66 89 f6 b7 95 1b b1 8e 84 05 42 76
97 18 d5 71 5d 21 0d 85 ef bb 59 61 92 03 2c 42
be 4c 29 97 2c 85 62 75 eb 6d 5a 45 f0 5f 51 87
6f c6 74 3d ed dd 28 ca ec 9b b3 0e a9 9e 02 c3
48 82 69 60 4f e4 97 f7 4c cd 7c 7f ca 16 71 89
71 23 cb d3 0d ef 5d 54 a2 b5 53 6a d9 0a 74 7e
# =============================================

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more