Commit graph

218 commits

Author SHA1 Message Date
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
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
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
c5d7bfb2cc manually fix the remaining leading _'s 2020-07-16 10:38:33 +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
50584ac7ec do timing on actual RSA key sizes 2019-10-17 22:27:54 +02:00
Steffen Jaeckel
2a63adc1ab add XSTRLEN 2019-10-17 10:29:27 +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
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
d58103d54f oops, NORETURN isn't only used in crypt_argchk() 2019-01-02 22:22:34 +01:00
Steffen Jaeckel
ac5192cf56 update CCM tv's and tv generation 2018-10-27 10:50:27 +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