Commit graph

234 commits

Author SHA1 Message Date
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
Karel Miko
9e2984aa7e SHA-512 accelerated by x86 (alternative) 2026-08-01 11:17:36 +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
Karel Miko
074a354151 fix build failures with -std=c99 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
e00b22d939 CCM nonce is 7..13 bytes 2026-07-21 10:53:25 +02:00
Karel Miko
42489a16cb fix basename(..) in demos 2026-05-04 10:44:57 +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
1f28017b10 Fix typo
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-29 10:53:40 +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
098e0e3030 Explicitly use padding type.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 10:30:32 +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
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
Karel Miko
7ab625c090 RSA: fix demos/timing.c 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
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
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
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
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
a58de2e03d Fix some scan-build warnings
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2025-09-13 12:04:38 +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
3c42b6a668 fix timing demo 2025-09-05 17:38:30 +02: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
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
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
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
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
Richard Levitte
1e31c38e61 Remove unnecessary casts in the demos 2024-11-08 17:15:39 +01: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
ba132eb4a7 With CMake, build demos/tv_gen as well 2024-08-20 14:35:58 +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
02cb0c4957 Revert "Move password buffer into the library"
This reverts commit d840323bc1d3bc35bc72271e55ffa644f02b4582
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
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
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
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
024d8a1340 Add LTC_ALIGN_BUF()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-10-05 11:14:46 +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
Adrian Antonana
a9a010d5fc introduce initial cmake support 2022-09-13 12:29:55 +02:00