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