7133 Commits

Author SHA1 Message Date
Anthony Hu
1fcff5b30d Changes that make kyber work on STM32
(wolfcrypttest and benchmark)
2023-02-24 04:08:07 -05:00
JacobBarthelmeh
da04e0fb4c
Merge pull request #6115 from SKlimaRA/SKlimaRA/fix-decompress-dynamic
fixed heap corruption
2023-02-21 11:58:11 -07:00
Anthony Hu
a6114afb84
Merge pull request #6114 from dgarske/stm32_hash
Fix for STM32 hashing hardware
2023-02-21 18:37:03 +00:00
gojimmypi
821120e31c
Add SHA512/224 and SHA512/256 benchmarks (#6113) 2023-02-21 09:27:03 -08:00
Stanislav Klima
208056b2da fixed heaap corruptions 2023-02-21 11:01:50 +01:00
Daniel Pouzzner
e0abb0e306
Merge pull request #6097 from gojimmypi/New_SHA512_Tests
Add new SHA-512/224 and SHA-512/256 tests
2023-02-21 01:39:38 -06:00
gojimmypi
136267d29c Add new SHA-512/224 and SHA-512/256 tests 2023-02-20 16:55:38 -08:00
David Garske
39e72630ce Proper fix for STM32 hashing. FIFO is always 32 bytes. The original U5/H7 proper fix is to make sure the hash is "done" before saving state. 2023-02-20 15:14:44 -08:00
Sean Parkinson
9a7cd7367a SP: fix point_add_qz1
Better detection of when add won't work and double needed.
Minor reorg of point operations.
2023-02-20 21:53:52 +10:00
Chris Conlon
588b694c7d
Merge pull request #5709 from TakayukiMatsuo/ccv 2023-02-17 17:02:04 -07:00
David Garske
c476dd6e28
Merge pull request #6103 from SparkiDev/sp_ecdsa_sig_r0
SP ECC sign: reject random k when r is 0
2023-02-17 13:58:53 -08:00
Sean Parkinson
26b7052b3f SP ECC sign: reject random k when r is 0
SP ECC signing code was generating signatures with r of 0.
This is not allowed by the algorithm description.
Retry sig gen when r is 0 like when s is 0.
2023-02-17 08:55:59 +10:00
tim-weller-wolfssl
dea123f88e Minimal changes to avoid Out-of-Bounds write in ASN.1 parsing logic. Add unit tests for ParseCert() API passing badly formed ASN data (should error out gracefully). 2023-02-16 07:49:08 -06:00
Sean Parkinson
195ca1a20a AES GCM benchmark: separate aes-gcm streaming runs
Always to AES-GCM one-shot benchmark.
When WOLFSSL_AESGCM_STREAM, always perform AES-GCM streaming benchmark.
2023-02-16 09:37:00 +10:00
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
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
TakayukiMatsuo
0c771a93dc Improve TLS1.2 client authentication to use TSIP 2023-02-10 16:16:25 +09: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
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
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
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
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
Sean Parkinson
3e82abd002 SP int: tidy up ifdef 2023-02-08 10:45:00 +10: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
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
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
a8c2a9aeab
Merge pull request #6040 from SparkiDev/sp_invmod_mont_ct_err
SP int: sp_invmod_mont_ct check err before setting
2023-02-05 14:17:51 -08:00
David Garske
c6018b837d
Merge pull request #6050 from JacobBarthelmeh/time
fix warning if ltime is unsigned
2023-02-03 11:06:17 -08:00
David Garske
29c884eafd
Merge pull request #6045 from JacobBarthelmeh/PKCS7
add sequence around algo parameters with authenvelop
2023-02-03 10:29:19 -08:00
David Garske
1027c0667a
Merge pull request #6049 from SparkiDev/sp_int_used_size
SP int: make used and size fields unsigned
2023-02-03 09:38:40 -08:00
Jacob Barthelmeh
d184a17644 fix warning if ltime is unsigned 2023-02-03 07:43:08 -07:00
Sean Parkinson
3455e726f9 SP int: make used and size fields unsigned
used and size have no reason to be negative - change type.
Change code to match unsigned change. Mostly change variables to be
unsigned where possible.
integer.c: Only have mp_rand_prime available when needed and
mp_prime_is_prime_ex is available.
Fixes from regression testing.
2023-02-03 17:09:56 +10:00
Sean Parkinson
f6da3a26ac Ref counting: rework for static analysers
When always reference counting APIs always return 0 don't check return
value for error.
Reference decrement set isZero to false on error.
2023-02-03 10:13:32 +10:00
JacobBarthelmeh
9e9315f480 add sequence around algo parameters with authenvelop 2023-02-02 10:54:38 -08:00
David Garske
a4f55b01d6
Merge pull request #6041 from JacobBarthelmeh/seco
Fix to mask the argument for enc/dec flag used with GCM/CCM in CAAM+SECO build
2023-02-02 08:32:48 -08:00
Sean Parkinson
447991a9c2
Merge pull request #5949 from JacobBarthelmeh/Testing
add pragram around sanity check for vcpkg build warning
2023-02-02 10:34:14 +10:00
Sean Parkinson
55d43a46b8 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-02 08:45:45 +10:00
JacobBarthelmeh
d76195c52a add fix GCM use with CAAM SECO 2023-02-01 14:42:39 -08:00