Commit graph

54 commits

Author SHA1 Message Date
Karel Miko
bc95a1fd2d hardening ecc_shared_secret against small-subgroup attacks 2026-05-25 16:18:14 +02:00
Karel Miko
afb09869f7 failing test for issue #764 - small-subgroup attack regression test 2026-05-25 13:56:48 +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
811b1a6c14 Introduce LTC_NOP_TEST()
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-05-03 11:11:39 +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
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
Karel Miko
1d55aca785 failing wycheproof tests 2026-04-27 14:19:59 +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
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
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
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
fe32e7ea9d Add LTC_ARRAY_SIZE() macro
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
46fa363f2c Finish up RFC6979 ECDSA keygen
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
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
ecb5fdd997 Add testcase for Ethereum signatures.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
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
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
1d07689581 Remove unnecessary casts in the tests
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-11-08 17:15:39 +01: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
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
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
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
6120c82618 Add Testcase for #630
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2023-08-07 11:05:09 +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
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
5bc034ff55 re-factor some tests 2021-04-10 13:02:39 +02: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
5ed32b73e6 improve ecc_test() output 2019-04-10 11:26:32 +02:00
Karel Miko
ae2ab2083b ecc_test cleanup 2018-11-07 09:25:08 +01:00
Karel Miko
c2cdaaab4d make LTC_ECCSIG_RFC7518 strict (again) 2018-10-13 18:48:49 +02: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
Karel Miko
bf04bf18a4 add ecc_import_pkcs8 2018-10-06 23:04:51 +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
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
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
Karel Miko
4fb0562a3b fix -Wmissing-declarations -Wmissing-prototypes -Wmissing-noreturn 2018-07-07 19:54:08 +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
fc056a645d fix "make test" built with no math provider or multiple providers 2018-07-03 00:12:08 +02:00
Karel Miko
05d397d634 ECC improved import/export 2018-06-11 10:00:37 +02:00
Karel Miko
24c0eb84f9 ECC curves y^2 = x^3 + ax + b 2018-05-22 23:02:44 +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
a65cfb8dbe make it possible to 'make all' w/o an MPI provider 2017-08-07 21:11:42 +02:00