Commit graph

2498 commits

Author SHA1 Message Date
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