19131 Commits

Author SHA1 Message Date
Daniel Pouzzner
a945017a88 wolfcrypt/test/test.c: around ecc_ctx_kdf_salt_test(): fix fips gating, fix length handling for "message", fix memory leaks;
in crypto_ecc_verify(), crypto_ecc_sign(), ecc_test_nonblock_dhe(), and ecc_test_nonblock_ecdsa(), add codepoint-specific retvals.
2023-02-13 14:21:50 -06:00
David Garske
405b98aaa4
Merge pull request #6078 from SparkiDev/rsapss_openssl_compat
X509 RSA PSS: fixes for OpenSSL compat layer
2023-02-13 08:43:10 -08:00
Daniel Pouzzner
295da3232a
Merge pull request #6082 from SparkiDev/asn_dsa_mp_int_leak
ASN template, DSA: Clear the mp_int before re-reading data
2023-02-12 22:28:11 -06:00
Sean Parkinson
0a8753d2b2 ASN template, DSA: Clear the mp_int before re-reading data
Make sure the mp_int is cleared so that any exisiting bigint is freed.
Tidy up api.c code.
2023-02-13 11:08:18 +10:00
tmael
55a7e24cfe
Support pthread_rwlock (#5952)
* Support rwlock

* Fix typo, ENABLE_SESSION_CACHE_ROW_LOCK with TITAN_SESSION_CACHE

* Implement read lock

- Use read lock for the SessionCache
- Don't copy the

* TLS 1.3: Don't push ticket to cache if we don't retrieve from it

* Detect rwlock support with PTHREAD_RWLOCK_INITIALIZER

* Implement explicit rwlocks

- Mutex's still necessary for signals. Implement explicit rwlocks and we can migrate critical mutexs to rwlocks when necessary.

* Remove WOLFSSL_USE_RWLOCK guard around mutex condLock

* condLock not necessary after all

* Use configure.ac to check for pthread_rwlock_destroy support

* Can't include config.h in wc_port.h as that breaks make distcheck

* Check for pthread_rwlock_t to determine if rwlock is available

* Code review

---------

Co-authored-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
2023-02-10 10:42:38 -08:00
John Bland
338d8db274
Ecc ctx state fix (#6077)
* set the client state correctly when wc_ecc_ctx_set_kdf_salt is called
* add test that covers wc_ecc_ctx_set_kdf_salt
* use shared key and smallstack to reduce test stack usage
2023-02-10 10:05:52 -08:00
philljj
5b8fda1ac6
Fix overflow in fp_to_unsigned_bin_len length check. (#6075)
* Fix overflow in fp_to_unsigned_bin_len length check.
* Add a second check when i == a->used - 1.
2023-02-10 08:46:37 -08:00
Daniel Pouzzner
c2384674d8
Merge pull request #6079 from SparkiDev/aes-ecb-len-aesni
AES ECB/CTR/XTS: enable AES-NI usage
2023-02-09 21:17:50 -06:00
Sean Parkinson
b359dd27e4 AES ECB/CTR/XTS: enable AES-NI usage
Perform multiple blocks of encryption/decryption in assembly call with
ECB.
This improves performance of ECB, CTR and XTS on Intel x64.
2023-02-10 11:14:06 +10:00
Sean Parkinson
9750fc4485 X509 RSA PSS: fixes for OpenSSL compat layer
Add NIDs for RSA-PSS to OpenSSL compat layer.
Have wc_RsaPublicKeyDecode call wc_RsaPublicKeyDecode_ex where logic for
RSA-PSS handling is already done.
2023-02-10 10:25:49 +10:00
Hideki Miyazaki
d336e22b85
Allow reading ENC EC PRIVATE KEY as well via wolfSSL_PEM_read_bio_ECPrivateKey (#6055)
* fix qt qsslkey unit test
2023-02-09 14:48:52 -08:00
Sean Parkinson
7a6f7ff6b7
Merge pull request #6076 from dgarske/fix_async
Fix for possible uses of NULL with heap hint in pk.c
2023-02-10 08:26:44 +10:00
David Garske
8929b31b84 Fix for possible uses of NULL in heap hint. The api.c has expected "bad" test cases where the key is passed in as NULL and the XFREE tries to use it. Tested with: ./configure --enable-asynccrypt --with-intelqa=../QAT1.8 --enable-all && make && sudo ./tests/unit.test 2023-02-09 10:18:37 -08:00
David Garske
05f8abd524
Merge pull request #6064 from embhorn/gh6063
Add WOLFSSL_IP_ALT_NAME to --enable-curl; fix unused error in FindPsk
2023-02-09 08:38:38 -08:00
Sean Parkinson
644d92f28c
Merge pull request #6074 from douzzer/20230208-fixes
20230208-fixes
2023-02-09 16:18:35 +10:00
Daniel Pouzzner
9dd23fca25 wolfcrypt/src/pwdbased.c: refactor copy in scryptSalsa() as a memcpy(), for efficiency and to work around a bug in clang-17; also fix scratch buffer x in scryptBlockMix() to have correct alignment. 2023-02-08 21:31:56 -06:00
Daniel Pouzzner
63fdc4e843 src/ssl.c: fix PK object on stack in wolfSSL_i2d_PublicKey(). 2023-02-08 21:30:50 -06:00
Daniel Pouzzner
ef0eda4091 cleaner fix for bugprone-signed-char-misuse first addressed in 38c057a084. 2023-02-08 21:28:34 -06:00
Sean Parkinson
49a500c2af
Merge pull request #6070 from bandi13/coverityFixes
Coverity fixes
2023-02-09 10:21:12 +10:00
Sean Parkinson
008d2962d7
Merge pull request #6072 from bandi13/dsaNoInit
Fix for calling 'mp_clear(tmp)' without having called 'mp_init(tmp)'
2023-02-09 10:18:51 +10:00
John Bland
e9aeb1a857
Add nuttx integration (#6043) 2023-02-08 16:04:53 -08:00
David Garske
619a587a7b
Merge pull request #6071 from bandi13/extraPackagesForDocker
Add in a few more utilities that we need
2023-02-08 14:53:20 -08:00
David Garske
7f9b764eb5
Merge pull request #6054 from anhu/d2i_publickey_fix
Ensure that i2d APIs for public keys gives appropriate data.
2023-02-08 14:44:29 -08:00
David Garske
1da392c297
Merge pull request #6069 from philljj/spelling_cleanup
Spelling cleanup: configure.ac, ssl.c, ssl.h
2023-02-08 14:40:03 -08:00
Sean Parkinson
7a30617b26
Merge pull request #6073 from dgarske/shake_bench
Fix for benchmarking shake with custom block size
2023-02-09 08:06:24 +10:00
Andras Fekete
767c282c1d Addressing PR comments 2023-02-08 16:35:03 -05:00
Daniel Pouzzner
6a24cdaa42
Merge pull request #6067 from SparkiDev/sp_int_fixup_5
SP int: tidy up ifdef
2023-02-08 13:50:50 -06:00
David Garske
cefd55eb74 Fix for benchmarking shake with custom block size. Using ./benchmark -shake 1024 caused seg fault. 2023-02-08 11:25:53 -08:00
Andras Fekete
08c63d55dc Addressing PR comments 2023-02-08 13:18:13 -05:00
Andras Fekete
38f2f43705 Fix for calling 'mp_clear(tmp)' without having called 'mp_init(tmp)' 2023-02-08 13:08:12 -05:00
Andras Fekete
06d6f2d4b6 One more app for debugging 2023-02-08 11:25:11 -05:00
Andras Fekete
94c01d9f4e Add in a few more utilities that we need 2023-02-08 10:52:00 -05:00
Anthony Hu
7a6ed68f2d Ensure that i2d APIs for public keys gives appropriate data. 2023-02-08 09:54:28 -05:00
jordan
cc791a7a53 Spelling cleanup: configure.ac, ssl.c, ssl.h 2023-02-07 21:45:06 -06:00
Sean Parkinson
3e82abd002 SP int: tidy up ifdef 2023-02-08 10:45:00 +10:00
Andras Fekete
62cfd8725a Disable latest OpenWrt test 2023-02-07 18:17:39 -05:00
Sean Parkinson
1912aaf91b EC OpenSSL compat: validate point after setting
wolfSSL_EC_POINT_set_affine_coordinates_GFp wasn't checking the point is
valid for the curve. Added call to check point when setting.
Made check available for opensslextra.
Fixed test to have valid ordinates to set.
2023-02-07 18:17:39 -05:00
Sean Parkinson
3e445b5ba0 SP int: sp_invmod_mont_ct check err before setting
Two places in sp_invmod_mont_ct were not checking err is set before
performing a new operation and setting err. Change to check error before
performing operation.
2023-02-07 18:17:39 -05:00
David Garske
ee12a5f0c6
Merge pull request #6048 from SparkiDev/asn1_template_def
ASN: make template default for configure
2023-02-07 14:15:57 -08:00
David Garske
299bee96d2
Merge pull request #6060 from SparkiDev/sp_int_fixes_4
SP int: fix sp_div_2 to use signed integer
2023-02-07 14:13:02 -08:00
David Garske
9f5ffe6bd7
Merge pull request #6066 from SparkiDev/int_fast_mont_red_oob
integer.c: fast mod reduce fix
2023-02-07 14:12:13 -08:00
Eric Blankenhorn
2539ba3f3d Add WOLFSSL_IP_ALT_NAME to --enable-curl; fix unused error in FindPsk 2023-02-07 15:51:09 -06:00
David Garske
3ae8bac3b2
Merge pull request #6065 from SparkiDev/ec_point_cmp_jacobian
wolfSSL_EC_POINT_cmp: handle Jacobian ordinates
2023-02-07 10:04:37 -08:00
Sean Parkinson
20ae076b80 integer.c: fast mod reduce fix
When using small stack, not enough memory uas being allocated in
fast_mp_montgomery_reduce().
Allocate the required space and memset all used memory.
2023-02-07 11:29:53 +10:00
Sean Parkinson
92065b61b3 wolfSSL_EC_POINT_cmp: handle Jacobian ordinates
API support doesn't allow for a point to be in Jacobian ordinates.
wolfSSL_EC_POINT_add() has ordinates in Montgomery form.
When needed, compile with WOLFSSL_EC_POINT_CMP_JACOBIAN.
2023-02-07 11:02:50 +10:00
Sean Parkinson
ca0731616f SP int: fix sp_div_2 to use signed integer
sp_div_2 no longer handled a->used of 0 and 1.
Rework to have have internal APIs that don't return errors and use them
where no error is expected.
2023-02-07 08:51:15 +10:00
Sean Parkinson
bd155389e2 ASN: make template default for configure
When loading DH private key, create the public key if not found.
Failures fixed.
2023-02-07 08:49:46 +10:00
David Garske
2448adf68b
Merge pull request #6051 from philljj/zd15531
Fix wolfSSL_ASN1_INTEGER_to_BN for negative values
2023-02-06 12:46:21 -08:00
David Garske
cc037447dd
Merge pull request #6062 from bandi13/disableOpenWrtSnapshot
Disable latest OpenWrt test
2023-02-06 08:06:31 -08:00
Andras Fekete
dc08ecf287 Disable latest OpenWrt test 2023-02-06 11:03:41 -05:00