Commit Graph

6450 Commits (b87b255d5280604f93bacb2d6170bb7c30169af3)

Author SHA1 Message Date
JacobBarthelmeh c0d7f3b2e6 add support for i.MX8 with QNX CAAM 2022-04-27 02:27:05 -07:00
gojimmypi 7233732159 move ESP8266-specific to separate section 2022-04-26 17:58:14 -07:00
David Garske 25e8bd6b45
Merge pull request #5044 from SparkiDev/sp_read_radix_10_oob
SP Math
2022-04-26 16:21:11 -07:00
Chris Conlon a6d019ecf9
Merge pull request #5073 from JacobBarthelmeh/PKCS7 2022-04-26 14:41:13 -06:00
David Garske cbc27f7de4
Merge pull request #5085 from douzzer/20220426-multi-test
20220426 multi-test fixups
2022-04-26 11:15:59 -07:00
John Safranek 7436a41bc7
Merge pull request #5046 from SparkiDev/cppcheck_fixes_8
cppcheck: fixes
2022-04-26 10:37:42 -07:00
David Garske 67a3326e6d
Merge pull request #5082 from SparkiDev/sp_c++
CPP protection for extern references to asm code
2022-04-26 08:33:15 -07:00
Daniel Pouzzner 4e02d7e404 fix clang-tidy-Customer-CFG-7 readability-redundant-preprocessor. 2022-04-26 10:20:26 -05:00
David Garske 704a18d103
Merge pull request #5079 from tmael/rsa_vfg
Fix no malloc RSA  test
2022-04-26 08:11:44 -07:00
Daniel Pouzzner 5e1a358dff wolfcrypt/src/evp.c wolfSSL_EVP_PKEY_free(): fix clang-diagnostic-implicit-fallthrough. 2022-04-26 09:57:54 -05:00
Sean Parkinson 0be79a8629 CPP protection for extern references to asm code 2022-04-26 10:17:25 +10:00
Sean Parkinson 8737d46bb1
Merge pull request #5018 from haydenroche5/libspdm
Make changes to compatibility layer to support libspdm.
2022-04-26 09:55:22 +10:00
Sean Parkinson 20e5e654a3 cppcheck: fixes
CBIORecv/Send are only assigned once.
IOCB_ReadCtx/WriteCtx only assigned once.
BuildMessage checks output and input wiht sizeOnly every call - state
machine doesn't cache these.
Renamed alias_tbl variables to something unique.
Other cppcheck fixes.
Also reworked pem_read_bio_key().
2022-04-26 09:26:41 +10:00
JacobBarthelmeh 1181081c38
Merge pull request #5075 from dgarske/cryptocb
Fix for PKCS7 with Crypto Callbacks
2022-04-25 17:23:28 -06:00
Masashi Honma 3ab5ccd04f
Add support for EVP_PKEY_sign/verify functionality (#5056)
* Fix wolfSSL_RSA_public_decrypt() return value to match Openssl
* Add support for EVP_PKEY_verify_init() and EVP_PKEY_verify()
* wpa_supplicant SAE public key functionality requires this function.
* Add DSA support for EVP_PKEY_sign/verify()
* Add ECDSA support for EVP_PKEY_sign/verify()
* Add tests for EVP_PKEY_sign_verify()
* Fix "siglen = keySz" at error cases
* Fix wolfSSL_DSA_do_sign() usage
1. Check wolfSSL_BN_num_bytes() return value
2. Check siglen size
3. Double the siglen
* Check return code of wolfSSL_i2d_ECDSA_SIG() in wolfSSL_EVP_DigestSignFinal()
* Add size calculations to `wolfSSL_EVP_PKEY_sign`
* Add size checks to wolfSSL_EVP_PKEY_sign before writing out signature
* Use wc_ecc_sig_size() to calculate ECC signature size
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Co-authored-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
2022-04-25 14:19:56 -07:00
Jacob Barthelmeh 9bf4a94796 with WOLFSSL_NO_DH186 restriction allow odd DH param size generations 2022-04-25 15:13:24 -06:00
Tesfa Mael 85ef91ce6d Move up local variable at the beginning 2022-04-25 12:40:31 -07:00
David Garske 34d541109d Additional scan-build warning fixes. 2022-04-25 09:55:36 -07:00
Tesfa Mael 18a6a7c4a7 Fix RSA nomalloc test 2022-04-25 09:50:50 -07:00
Juliusz Sosinowicz 4013f83e4f Add some missing logs and implement WOLFSSL_MSG_EX()
WOLFSSL_MSG_EX() uses XVSNPRINTF to allow for formatted strings to be printed. It uses a 100 byte internal stack buffer to format the log message.
2022-04-25 15:59:07 +02:00
gojimmypi 15a48e411d Add WOLFSSL_ESP8266 for ESP-IDF 2022-04-23 12:30:34 -07:00
David Garske 74cd2fd910 Fix for integer.c possible uses of mp_int input with DP NULL. 2022-04-22 16:02:54 -07:00
David Garske 84a33183a6 Various scan-build fixes. 2022-04-22 16:02:54 -07:00
David Garske a6a89d3316 Fix for integer.c `s_mp_add` output to make sure it grows if not set. 2022-04-22 16:02:53 -07:00
David Garske 293d7e1241 Fix for report of `Use of memory after it is freed`. Force the `dataIsAlloc` set to 0. 2022-04-22 16:02:53 -07:00
David Garske 8fb1bb8781
Merge pull request #5074 from embhorn/zd14105
Fix for mingw builds
2022-04-22 15:27:58 -07:00
David Garske 9cbf92df01 Fix for PKCS7 sign to allow providing a public key only if using crypto callback w/devId. ZD13949. 2022-04-22 14:29:43 -07:00
Jacob Barthelmeh d96bd30398 fix for sanity check on PKCS7 indef read 2022-04-22 15:28:03 -06:00
Eric Blankenhorn b543aa0148 Fix for mingw builds 2022-04-22 14:35:46 -05:00
John Safranek bf16696d8c
Merge pull request #5036 from dgarske/sniffer
Fixes for minor sniffer and async issues
2022-04-22 12:24:33 -07:00
David Garske ed58cfdc0f Add `DEBUG_CRYPTOCB` and `wc_CryptoCb_InfoString` to help with debugging crypto callbacks. 2022-04-22 12:20:55 -07:00
Jacob Barthelmeh d5927a58dd add store of PKCS7 cert used for verify 2022-04-22 11:26:34 -06:00
Jacob Barthelmeh 8ea953f8c0 add support for importing private only EC key to a WOLFSSL_EVP_PKEY struct 2022-04-22 10:20:42 -06:00
David Garske 2fa1e19fe7 Fix for `./configure --enable-sniffer --enable-session-ticket --disable-ecc && make`. 2022-04-21 13:28:38 -07:00
elms 29392ac6b3 spell fix: OSCP -> OCSP 2022-04-19 15:11:08 -07:00
David Garske 659d33fdaf Fixes for minor sniffer and async issues:
* Sniffer: Remove old restrictions for max strength, encrypt-then-mac and forcing openssl-extra.
* Fix bound warning with strncpy in sniffer.c.
* Fix for async DH issue.
* Fix for SP math all not initializing raw big int.
* Fix for array bounds warning with "-O3" on SetEccPublicKey.
* Fix a sniffer async edge case with TLS v1.2 static RSA and extended master.
* Improved the sniffer test script detection of features.
* Disable ECC custom curve test with Intel QuickAssist.
2022-04-18 11:46:40 -07:00
John Safranek e89b4cce4c
Merge pull request #5045 from SparkiDev/wycheproof_armasm
Wycheproof testing of Aarch64 ASM
2022-04-15 11:23:45 -07:00
John Safranek 8eed940e3a
Merge pull request #5040 from SparkiDev/wycheproof_intelasm
Wycheproof fixes
2022-04-15 11:19:57 -07:00
John Safranek 3ab87ba2ed
Merge pull request #5039 from SparkiDev/ecc_pub_api
ECC: make public APIS for add and double points
2022-04-15 11:09:37 -07:00
Daniel Pouzzner 607a24b499 fixes for clang-tidy and sanitizer hygiene with --disable-fastmath. 2022-04-14 21:06:04 -05:00
Daniel Pouzzner 096889927d wolfcrypt/src/port/devcrypto/devcrypto_aes.c: remove redundant "int ret" in wc_AesCtrEncrypt() (supersedes #5052). 2022-04-14 20:23:31 -05:00
kaleb-himes d706e2be32 Change void cast(s) to be non-conditional and consolidate condition logic 2022-04-13 10:25:43 -06:00
Chris Conlon 947c72937f
Merge pull request #5049 from miyazakh/unused_param 2022-04-13 09:02:26 -06:00
Sean Parkinson 824b7a3f3f ECC: fix import failure return
Passing in x=0 and y=0 meant to return ECC_INF_E.
Passing in x=0, y=not 0 or x=not 0, y=0 now checks whether the point is
valid and forces a return of BAD_FUNC_ARG when IS_POINT_E is returned
from check.
2022-04-13 14:03:13 +10:00
Hideki Miyazaki c5056f408f
fix unused parameter when using CRYPTO_CB_ONLY_RSA 2022-04-13 07:48:18 +09:00
Sean Parkinson 55e13d40b3 SP Math
sp_read_radix_10: check _sp_add_d doesn't error due to overflow
_sp_add_d: Don't change value of used for result until it is known to be
valid.
2022-04-13 08:33:30 +10:00
Sean Parkinson 6cc91c8f9b Wycheproof testing of Aarch64 ASM
Fix which bytes are incremented for AES-GCM - only 4 bytes are counter.
Fix Curve25519 to reduce to below modulus at end.
2022-04-12 11:45:14 +10:00
Hayden Roche 0ef7435580 Make changes to compatibility layer to support libspdm.
- Add support for ASN1_TIME_compare, DH_new_by_nid, OBJ_length, OBJ_get0_data,
and ChaCha20-Poly1305 and HKDF in the EVP layer.
- Map EC_POINT_get_affine_coordinates to
wolfSSL_EC_POINT_get_affine_coordinates_GFp and EC_POINT_set_affine_coordinates
to wolfSSL_EC_POINT_set_affine_coordinates_GFp.
- Add kdf.h compatibility header.
2022-04-11 15:07:27 -07:00
Sean Parkinson 2995c96f11 Wycheproof fixes
Curve25519: reduce to less than mod at end of curve25519, optimize to
not use imulq when andq can be used instead.
x86_64 Karatsuba Mul: Don't put add carry into overflow and then
continue adding zero. Overflow is lost.
2022-04-11 15:09:40 +10:00
Sean Parkinson b6db087a62 ECC: make public APIS for add and double points
Use internal API internally.
2022-04-11 09:19:23 +10:00
Jacob Barthelmeh 83ad0b7010 fix for function rename 2022-04-08 15:05:08 -06:00
David Garske c84c465fc6
Merge pull request #5035 from douzzer/20220408-fuzz-6262033210802176
oss-fuzz 6262033210802176
2022-04-08 08:34:16 -07:00
David Garske 6a21a90f41
Merge pull request #5034 from SparkiDev/sp_wycheproof_fixes
SP fixes from Whycheproof tests
2022-04-08 08:20:56 -07:00
Daniel Pouzzner 1c570fae3b wolfcrypt/src/asn.c GetLength_ex(): test for overlong length spec before using length as shift operand. 2022-04-08 08:15:02 -05:00
Sean Parkinson ed7e1f9770 SP fixes from Whycheproof tests
EC point add is a double if affine ordinates are the same.
Fix AVX2 implementation of mod inv to do conversion from 26 bits in
32-bit registers to 64 bits in 64-bit registers. Also handle negative
value.
RSA OAEP: loop down to last byte. Must have a separator.
Div for x86_64: fix to have all 1s when high word equals divisor.
2022-04-08 15:01:06 +10:00
Daniel Pouzzner 28cefb0d1a fix clang-analyzer-core.NonNullParamChecker. 2022-04-07 08:01:00 -05:00
Daniel Pouzzner 4efd06fdc1 fix readability-inconsistent-declaration-parameter-name. 2022-04-07 07:59:59 -05:00
Sean Parkinson 284ebacc57
Merge pull request #4916 from JacobBarthelmeh/hsm
Add SECO use and expand cryptodev
2022-04-07 10:21:32 +10:00
Sean Parkinson 87dc197284
Merge pull request #5028 from douzzer/20220406-cppcheck
fixes to mollify cppcheck (sizeofDivisionMemfunc, zerodivcond, shiftTooManyBits, signConversionCond)
2022-04-07 08:45:24 +10:00
Jacob Barthelmeh e9aae8b571 use hash grow function with cmac 2022-04-06 15:08:19 -06:00
Daniel Pouzzner 9b2d927de7
Merge pull request #5026 from danielinux/fix_unititialized_var
Fixed unused variable in asn.c
2022-04-06 13:03:47 -05:00
David Garske 1b5af2fdd9
Merge pull request #5022 from SparkiDev/wycheproof_fixes
Wycheproof fixes/changes
2022-04-06 10:29:17 -07:00
JacobBarthelmeh 2a0b726c15 add AES init functions to ECB test case 2022-04-06 09:42:38 -07:00
Daniel Pouzzner 4e8c180290 fixes to mollify cppcheck (sizeofDivisionMemfunc, zerodivcond, shiftTooManyBits, signConversionCond). 2022-04-06 11:36:01 -05:00
JacobBarthelmeh 91d883d99f macro guard on ECB test case and use realloc for hash 2022-04-06 07:04:17 -07:00
Daniele Lacamera 3d9a1647d4 Fixed unused variable in asn.c 2022-04-06 15:35:28 +02:00
Sean Parkinson e9187f5f00 Wycheproof fixes/changes
Allow Chachac20-Poly1305 to take an empty msg.
Allow AES-SIV to have an empty nonce.
Don't allow the length to be malleable. Must use the smallest number of
bytes to represent value.
ECDSA and DSA signature values are positive.
Add Sha512-224 and Sha512-256 OIDs.
ASN template - ensure the ECDSA/DSA signature uses all data.
Curve25519/Curve448 - WOLFSSL_ECDHX_SHARED_NOT_ZERO means shared secret
can't be 0.
Curve25519/Curve448 - check public value is less than order.
ECC - x or y may be zero but not both.
Ed25519/Ed448 - check S is less than order.
Ed448 - ge_p3_dbl can be simplified for ASM.
Prime check (integer.c/tfm.c/sp_int.c): Don't allow negative values and
make sure random candidate doesn't have bits higher than those in a set
when bits not a multiple of 8.
RSA: support Sha512-224 and Sha512-256.
RSA: Fix check for invalid in decryption. Affects plaintexts 256 bytes
and longer.
RSA: Don't allow base be larger than modulus.
RSA: Check small ciphertext (1 or 0) on decrypt when not using OAEP.
RSA: WOLFSSL_RSA_DECRYPT_TO_0_LEN allows decrypted value to be 0.
SP math all: fix div to handle large a and d when checking size of
remainder.
SP math all: set sign of result in sp_mod_2d()
2022-04-06 15:35:01 +10:00
JacobBarthelmeh a338b4c933 refactor SHA grew function, revert benchmark devid, increase SHA_CTX size, add AES ECB cryptocb test 2022-04-05 14:45:18 -07:00
David Garske 4f5aa81031
Merge pull request #5000 from ejohnstown/tls13-wctest
Add TLSv1.3 KDF to wolfCrypt Test
2022-04-05 10:45:35 -07:00
David Garske 6a3f98627e
Merge pull request #5013 from anhu/wc_CheckCertSigPubKey
Add new public API wc_CheckCertSigPubKey()
2022-04-05 09:48:08 -07:00
John Safranek eefc0f2f57
Add TLSv1.3 KDF to wolfCrypt Test
Added a test for the TLSv1.3 KDF to the wolfcrypt test. It uses 6
different test cases from the CAVP tests. A set of 8 session keys are
generated using multiple exporters.
2022-04-05 08:56:15 -07:00
Daniel Pouzzner b2a2a8af4a fix whitespace. 2022-04-05 08:09:48 -05:00
Sean Parkinson df9335ee0a
Merge pull request #4988 from tmael/sp_loop
Fixes for Diab C89 and armclang
2022-04-05 08:20:47 +10:00
Sean Parkinson 8dd07bbb73
Merge pull request #5011 from dgarske/ecc_key_decode
Fix to check if `wc_EccPublicKeyToDer` has enough output buffer space
2022-04-05 08:03:03 +10:00
Sean Parkinson c3a9520eb5
Merge pull request #5016 from dgarske/async_fixes
Fixes for async in wolfCrypt test
2022-04-05 07:56:08 +10:00
Hayden Roche f39bd5e02b
Merge pull request #5014 from dgarske/kcapi_ecc_import 2022-04-04 14:08:29 -07:00
David Garske 9b5ad6f218
Merge pull request #4968 from miyazakh/cryptonly
add WOLF_CRYPTO_CB_ONLY_RSA and WOLF_CRYPTO_CB_ONLY_ECC
2022-04-04 08:31:41 -07:00
David Garske 757c93c6d5
Merge pull request #4945 from kaleb-himes/ZD13795
Fix for ZD13795 and also remove all-caps parameter
2022-04-04 08:25:10 -07:00
Hideki Miyazaki 8e4abb0011
addressed code review comment 2022-04-02 09:18:28 +09:00
Daniel Pouzzner ae3996fd0e fix codebase for -Wvla -Wdeclaration-after-statement; fix some whitespace. 2022-04-01 14:44:10 -05:00
David Garske bd0e222fec
Merge pull request #5012 from julek-wolfssl/evp-enc-dec-block
Implement `EVP_EncodeBlock` and `EVP_DecodeBlock`
2022-04-01 12:24:23 -07:00
David Garske 6ec0c22a28 Fixes for async in wolfCrypt test. 2022-04-01 12:04:31 -07:00
David Garske ded168f238 Add check for buffer space in `wc_EccPublicKeyToDer`. Refactor `SetEccPublicKey` to put public key directly into output buffer and eliminate small stack. Fixes ZD 13904. 2022-04-01 11:46:27 -07:00
David Garske 9c572efa40 Disable the public key check in import private key for KCAPI. Fix type warning in KCAPI AES. 2022-04-01 11:27:17 -07:00
Anthony Hu edea6428d9 Add new public API wc_CheckCertSigPubKey() 2022-04-01 11:40:25 -04:00
Juliusz Sosinowicz 6dffa8a13d Implement `EVP_EncodeBlock` and `EVP_DecodeBlock` 2022-04-01 13:29:40 +02:00
Tesfa Mael 4db45cea4e Fixes to build with diab and armclang 2022-03-31 20:48:28 -07:00
David Garske 99af84f1e2
Whitespace cleanups. 2022-04-01 09:36:53 +09:00
Hideki Miyazaki d3a379adac
add WOLF_CRYPTO_CB_ONLY_RSA and WOLF_CRYPTO_CB_ONLY_ECC 2022-04-01 09:36:52 +09:00
Chris Conlon b45cd921b6
Merge pull request #5005 from dgarske/renesas_spell 2022-03-31 17:44:04 -06:00
Sean Parkinson 7b21cd8cf0
Merge pull request #5001 from dgarske/kcapi_ecc
KCAPI ECC/AES optimizations to further reduce page memory use
2022-04-01 08:36:23 +10:00
Sean Parkinson 79444fdb56
Merge pull request #4997 from dgarske/qat_eckg
Support for Intel QuickAssist ECC KeyGen acceleration
2022-04-01 08:32:21 +10:00
David Garske 61f6b5e29c Peer review feedback. 2022-03-31 10:04:23 -07:00
David Garske 064888bb2a Add KCAPI ECC support for using a private key id. 2022-03-31 09:05:03 -07:00
David Garske f8007b2d8f Further KCAPI AES/ECC memory optimizations. Adds `KCAPI_USE_XMALLOC` option for AES and ECC to reduce page memory use in certain KCAPI cases that allow it. 2022-03-31 08:58:22 -07:00
David Garske 1993851274 Renesas spelling, code formatting and whitespace fixes. 2022-03-31 08:02:00 -07:00
David Garske 1de5165dcc KCAPI ECC optimization to further reduce page memory use. 2022-03-30 15:01:01 -07:00
David Garske c905c613e9 Support for Intel QuickAssist ECC KeyGen acceleration. 2022-03-30 13:07:47 -07:00
Sean Parkinson d9df00cdfb
Merge pull request #4994 from dgarske/kcapi
KCAPI ECC memory optimizations and KCAPI AES build fix
2022-03-30 11:50:39 +10:00
David Garske d10e72bc98 Fix for KCAPI AES with `WOLFSSL_NO_KCAPI_AES_CBC`. 2022-03-29 12:50:28 -07:00
Daniel Pouzzner 8edf237f75
Merge pull request #4993 from SparkiDev/sakke_gen_table_tmp_size_fix
SP: fix number of temps alloced in sp_ecc_gen_table
2022-03-28 21:32:35 -05:00
Sean Parkinson 194138f0b8
Merge pull request #4990 from dgarske/async_fix
Fixes for async ECC
2022-03-29 10:30:38 +10:00
Sean Parkinson f50514b228 SP: fix number of temps alloced in sp_ecc_gen_table
Ony affects SAKKE and as a result of point add changes.
2022-03-29 09:11:45 +10:00
David Garske 1abcd4b035 Reduce KCAPI ECC page memory allocation sizes. 2022-03-28 15:40:07 -07:00
David Garske 05f377011b Fix for building with KCAPI AES enabled. 2022-03-28 15:05:58 -07:00
David Garske 12349f39e6
Merge pull request #4974 from kareem-wolfssl/iotsafe
IOTSafe workarounds
2022-03-28 13:49:44 -07:00
David Garske 5b0735cdb4 Fixes for async ECC broke in PR #4982. 2022-03-28 11:29:33 -07:00
Kareem be938ed197 IoTSafe Workarounds: Address code review feedback. 2022-03-25 16:17:53 -07:00
JacobBarthelmeh 25d5a624d2
Merge pull request #4975 from cconlon/smallStack
smallstack cleanup for OpenSSL Compatibility Functions
2022-03-25 17:06:59 -06:00
John Safranek 0ee01f08bc
Merge pull request #4984 from douzzer/20220325-multi-test-cleanup
20220325 multi-test fixes
2022-03-25 15:06:34 -07:00
David Garske 3af3274dcd
Merge pull request #4982 from SparkiDev/sp_x64_improvements
SP ASM improvements
2022-03-25 13:04:01 -07:00
David Garske 07f9ca60ac Fix for async without threading. `./configure --enable-asynccrypt --enable-all CFLAGS="-DWC_NO_ASYNC_THREADING"`. 2022-03-25 12:43:04 -07:00
Daniel Pouzzner 008c8509c6 multi-test fixes: whitespace in wolfcrypt/src/random.c and wolfcrypt/test/test.c, bugprone-macro-parentheses and -Wenum-compare in WS_RETURN_CODE() (wolfssl/ssl.h), and clang-analyzer-deadcode.DeadStores in api.c. 2022-03-25 13:26:41 -05:00
Sean Parkinson 7eb95674ee
Merge pull request #4966 from dgarske/kcapi
Fixes for KCAPI AES GCM and ECC
2022-03-25 10:18:16 +10:00
Sean Parkinson fd66f6bcec SP ASM improvements
Change Karatsuba implementations for x86_64.
Fix ECC code to better handle corner cases.
Add 'lower' versions of functions wehn an input is known to be less than m.
Add mont_add/dbl/tpl/sub for P384.
Change ECC point add to be cache-attack resistant.
Change mod_exp to be cache-attack resistant.
2022-03-25 10:04:25 +10:00
John Safranek 14522f25ff
Merge pull request #4904 from kaleb-himes/OE22_NS9210_FIX
Fix up random.h conflicts with cert 3389 releases and some NETOS issues
2022-03-24 16:07:23 -07:00
Sean Parkinson feb58a8455
Merge pull request #4956 from julek-wolfssl/bind-9.18.0
bind 9.18.0 fixes
2022-03-25 08:27:34 +10:00
Anthony Hu ceae169a34
Merge pull request #4969 from dgarske/pk_pubkey 2022-03-24 12:40:03 -04:00
Juliusz Sosinowicz 29c0c9bf48 Rebase fixes 2022-03-24 13:41:50 +01:00
Juliusz Sosinowicz ae9b01c5b8 bind 9.18.0 fixes
- return `1` from `wolfSSL_BIO_set_mem_eof_return` instead of `0` for success
- bind requires ALPN
- `OPENSSL_COMPATIBLE_DEFAULT` defined for bind
- `WOLFSSL_ERROR_CODE_OPENSSL` defined when using compatibility layer
- return `bio->eof` on no pending data to read in memory BIO (defaults to `WOLFSSL_BIO_ERROR`)
- `flags` is no longer an input parameter in `wolfSSL_ERR_get_error_line_data`
- allow lazy parameter loading in `wolfSSL_DH_set0_key`
- implement reference counter in `WOLFSSL_EC_KEY`
- load serial number from `x509->serialNumber` if `x509->serial` is empty
2022-03-24 12:16:59 +01:00
David Garske 6e550c8d75 Fix for KCAPI ECC KeyGen. Disable ECC consistency checks with KCAPI. Allow public `AddSignature` (used to be public). Fix KCAPI ECC SharedSecret output size. 2022-03-23 09:37:50 -07:00
David Garske 8bafa7f601 Fix for KCAPI ECC sign (was not returning the signature, since ret always 0). 2022-03-23 09:37:50 -07:00
David Garske c9e3094cb0 Fixes for KCAPI ECC verify. Cleanup of the `pubkey_raw`. Fix KCAPI AES possible used uninitialized. 2022-03-23 09:37:50 -07:00
David Garske 8d695f97c9 Fix for KCAPI `KcapiEcc_LoadKey` parameter to `kcapi_kpp_keygen`. Added option to release handle on load. Fixes for KCAPI sign output length. Added additional argument checking. 2022-03-23 09:37:50 -07:00
David Garske 318350f63b Fix for `ecc_check_privkey_gen` with KCAPI. Fix KCAPI ECDSA to ensure we don't leak handle for multiple sign/verify calls. 2022-03-23 09:37:50 -07:00
David Garske 9f2dc408a0 Fixes for KCAPI AES GCM. Add guards for algorithm macros on KCAPI. 2022-03-23 09:37:50 -07:00
David Garske 1b0e5f4806 Allow disabling DRBG with KCAPI. Add KCAPI `/dev/hwrng` support. 2022-03-23 09:37:50 -07:00
David Garske 5fe6f1c875 For KCAPI do not force enable ECC curves, set K or seed callback, disable AES GCM tests with non standard IV. 2022-03-23 09:37:50 -07:00
Chris Conlon 210eb6283c smallstack reduction for wc_ecc_import_x963_ex, mp_jacobi 2022-03-21 14:43:43 -06:00
Chris Conlon 851ff9e661 smallstack reduction for PrintPubKeyRSA, PrintPubKeyDSA, PrintPubKeyDH 2022-03-21 14:43:43 -06:00
Chris Conlon 339e44bd87 smallstack reduction for wc_ecc_import_point_der_ex() 2022-03-21 14:43:43 -06:00
David Garske 59665a44b5 Fixes for allowing server to have a public key set when using external key with PK callbacks. 2022-03-21 13:14:24 -07:00
David Garske 29c120356e Sniffer asynchronous support.
* Adds stateful handling of DH shared secret computation in `SetupKeys`.
* Improved the decrypt handling to use internal functions and avoid generating alerts on failures.
* Fix for sniffer resume due to missing `sessionIDSz` broken in #4807.
* Fix sniffer test cases to split resume (session_ticket) tests.
* Add `snifftest` list of build features so test script can gate running resume test.
2022-03-21 12:05:08 -07:00
Kareem af70edb99d Strip trailing zeroes from cert buffer when using IOTSAFE_NO_GETDATA. 2022-03-21 10:53:36 -07:00
David Garske c213c725d7
Merge pull request #4971 from SparkiDev/fp_div2_mod_ct_oob
TFM fp_div_2_ct: rework to avoid overflow
2022-03-21 09:11:41 -07:00
David Garske 08d6474878
Merge pull request #4954 from SparkiDev/rsa_fermat
RSA: check for small difference between p and q
2022-03-21 09:09:38 -07:00
David Garske b90df0a6aa
Merge pull request #4951 from ejohnstown/wolfrand
wolfRand for AMD
2022-03-21 09:09:19 -07:00
Juliusz Sosinowicz 9763030675
Merge pull request #4845 from cconlon/pkcs7compat 2022-03-21 15:26:37 +01:00
Sean Parkinson 8dbd8b0ad6 RSA: check for small difference between p and q 2022-03-21 10:58:14 +10:00
Sean Parkinson aa14607a6f TFM fp_div_2_ct: rework to avoid overflow
Don't set the overflow word. Instead integrate the div by 2 into the
function so that the overflow word doesn't need to be stored.
2022-03-21 10:43:06 +10:00
Sean Parkinson 2f52d3cd20
Merge pull request #4965 from dgarske/aes_win_clang
Fixes for Windows AESNI with clang
2022-03-21 08:24:21 +10:00
Hayden Roche dcaa218ed8
Merge pull request #4927 from cconlon/upRef 2022-03-18 18:10:36 -07:00
Chris Conlon c491a6c829 EVP_PKEY_copy_parameters: correctly mark inner struct owned 2022-03-18 16:37:45 -06:00
Chris Conlon 582f0d82e4 address review feedback for PKCS7 compat additions 2022-03-18 12:07:44 -06:00
JacobBarthelmeh bfee3dffc6
Merge pull request #4967 from dgarske/pubkey_size
Fix for `wc_EccPublicKeyToDer` incorrectly requiring too much buffer
2022-03-18 09:22:52 -06:00
David Garske bb27fa4555 Fix for `wc_EccPublicKeyToDer` incorrectly requiring too much buffer. Merge error included old ASN code and incorrectly excluded ASN template. ZD13904. 2022-03-17 18:51:37 -07:00
Sean Parkinson ef66a12a24
Merge pull request #4961 from dgarske/cust_fixups
Various portability improvements (Time, DTLS epoch size, IV alloc)
2022-03-18 11:38:57 +10:00
David Garske b546b2a5ec Improve logic around private key id/label. Adds `WOLF_PRIVATE_KEY_ID`. 2022-03-17 14:48:30 -07:00
David Garske f954aef973 Fixes for Windows AESNI with clang. Improve 32-bit support. 2022-03-17 14:05:24 -07:00
David Garske 3fba5d17c3 Various portability improvements:
* Change DTLS epoch size word16.
* Allow override of the `RECORD_SIZE` and `STATIC_BUFFER_LEN`.
* Remove endianness force from game build.
* Add `gmtime_s` option.
* Fix for macro conflict with `MAX_KEY_SIZE`.
* Expose functions `wolfSSL_X509_notBefore`, `wolfSSL_X509_notAfter`, `wolfSSL_X509_version` without `OPENSSL_EXTRA`.
2022-03-17 14:00:55 -07:00
JacobBarthelmeh 54477d1bea improvements around keystore key update 2022-03-17 12:04:52 -06:00
Jacob Barthelmeh 40c79b1134 add macro guards to handle build with QNX CAAM 2022-03-17 12:04:52 -06:00
Jacob Barthelmeh 9bf2962852 default to strict NVM operations with key generation 2022-03-17 12:04:52 -06:00
Jacob Barthelmeh 090932b65c FIPS benchmark of cmac and ecb 2022-03-17 12:04:52 -06:00
JacobBarthelmeh 55b42dd85a Add SECO use and expand cryptodev 2022-03-17 12:04:52 -06:00
David Garske aa8e5a29d4
Merge pull request #4947 from cconlon/compatSmallStack
Stack/smallstack cleanup for OpenSSL compatibility functions
2022-03-15 16:47:23 -07:00
Chris Conlon a52539c489
Merge pull request #4958 from TakayukiMatsuo/example 2022-03-15 17:39:07 -06:00
John Safranek f80faebfe5
wolfRand for AMD
1. Add configure option to enable AMD's RDSEED.
2. Add seed parameters when building specifically for AMD using RDSEED.
3. Update the wolfCrypt test to play nice with the larger seed size.
2022-03-15 15:20:08 -07:00
Anthony Hu fbfb1fee91 Add Post-quantum KEM benchmark for STM32 2022-03-15 14:49:40 -04:00
TakayukiMatsuo 365a4de154 Fix settings and removed warnings 2022-03-16 02:12:45 +09:00
Chris Conlon ce514e6fc5 add PKCS7_sign, PKCS7_final, SMIME_write_PKCS7. add signer cert verify support to PKCS7_verify, support for PKCS7_TEXT, PKCS7_DETACHED, PKCS7_STREAM 2022-03-15 10:21:22 -06:00
David Garske 2febed01a5
Merge pull request #4949 from SparkiDev/ssl_move_conf
ssl.c: move TXT and CONF APIs out into conf.c
2022-03-15 09:02:42 -07:00
Chris Conlon 062003916c stack/smallstack reduction for wolfssl_x509_make_der(), d2iGenericKey(), PrintPubKeyEC(), wolfSSL_EC_POINT_add() 2022-03-15 09:40:48 -06:00
Sean Parkinson 343e8bccdd ssl.c: move TXT and CONF APIs out into conf.c 2022-03-15 12:09:24 +10:00
David Garske 4ec49d2189
Merge pull request #4943 from SparkiDev/sp_arm64_perf_1
SP ASM performance improvements
2022-03-14 18:40:51 -07:00
Sean Parkinson eeb7f72a07 AES-GCM: stack alignment issues
Don't expect stack to be aligned.
vmovdqu is no longer slower than vmovdqa.
2022-03-15 08:49:43 +10:00
Sean Parkinson 2c1ecacbfc TLS 1.3 script test: wait for server to write file
Also fixes for:
./configure --enable-psk --disable-rsa --disable-ecc --disable-dh
C_EXTRA_FLAGS=-DWOLFSSL_STATIC_PSK
./configure --disable-shared --enable-curve448 --enable-ed448
--disable-rsa --disable-dh --enable-tls13 --disable-ecc --enable-certgen
--enable-keygen
2022-03-14 14:42:47 +10:00
Daniel Pouzzner 4966eb7897
Merge pull request #4944 from douzzer/20220310-asn-template-EncodeExtensions-overrun
wolfcrypt/src/asn.c: fix buffer underrun in EncodeExtensions() and leak in ParseCRL_Extensions()
2022-03-13 21:21:07 -05:00
Sean Parkinson 20562b3f78 DecodeNameConstraints (ASN Template): free ASNGetData 2022-03-14 09:14:19 +10:00
David Garske a816f329cc
Merge pull request #4856 from anhu/stm32u5
Enable support for STM32U585 and PQC for STM32
2022-03-11 14:49:46 -08:00
Chris Conlon 9fff321e3e address PR review feedback on EVP_PKEY changes 2022-03-11 10:11:02 -07:00
Daniel Pouzzner 385ece92d8 ECCSI and SAKKE: fix smallstackcache memory leaks in library, and blue-moon undefined behavior bugs in test.c eccsi_test(() and sakke_test(). 2022-03-11 10:06:18 -06:00
kaleb-himes fc92584bd2 Address the one that was missed 2022-03-11 08:36:36 -07:00
Sean Parkinson c3eab0dcdd Fixes from sanitizer build
Fix OID index in SetNameRdnItems for multi attributes.
Stop warning about strncpy to small.
Fix casting in ASN1_SIMPLE to use consistent type.
2022-03-11 14:27:50 +10:00
David Garske cf030de48a
Merge pull request #4930 from SparkiDev/tfm_alloc_fails
TFM: handle more alloc failure cases gracefully
2022-03-10 15:42:21 -08:00
Sean Parkinson 3ea5e56c26 SP ASM performance improvements
Mostly improving Aarch64 assembly.
Change Karatsuba implementations.
Specialised code for exponentiating to 0x10001 for RSA.
2022-03-11 08:42:46 +10:00
David Garske 570daa6a7f Enable support for STM32U585 and PQ on M4 2022-03-10 14:19:01 -05:00
kaleb-himes 0eef90f951 Fix for ZD13795 and also remove all-caps parameter 2022-03-10 11:40:32 -07:00
Daniel Pouzzner 227804f034 wolfcrypt/src/asn.c: in ParseCRL_Extensions(), add missing FREE_ASNGETDATA(). 2022-03-10 11:45:37 -06:00
Daniel Pouzzner 170b125b39 wolfcrypt/src/asn.c: fix buffer underrun in EncodeExtensions(), due to faulty iteration limit calculation, when smallstack build. 2022-03-10 09:38:19 -06:00
Sean Parkinson 6b7f0d4ee7
Merge pull request #4905 from anhu/custom_ext_parse
Injection and parsing of custom extensions in X.509 certificates.
2022-03-10 10:39:05 +10:00
Anthony Hu 98f733767b Use MAX_OID_SZ 2022-03-09 17:20:50 -05:00
Chris Conlon e1da313b91 EVP_PKEY_copy_parameters: add support for EVP_PKEY_DH 2022-03-09 14:34:09 -07:00
Anthony Hu b043225dbd Fixes inspired by review by SparkiDev. 2022-03-09 13:39:53 -05:00
Anthony Hu 2cbe28fcf9 Sequences are constructed 2022-03-07 18:50:38 -05:00
Chris Conlon f49983b3b3 EVP_PKEY_keygen: add DH keygen support, fixes to EVP_PKEY_set1/get1_DH 2022-03-07 16:32:23 -07:00
Chris Conlon 939ce713df EVP_PKEY_derive: set internal DH key if needed 2022-03-07 16:32:22 -07:00
Chris Conlon f3f0d49fce EVP_PKEY_CTX_new: set curve NID from pkey if available 2022-03-07 16:32:22 -07:00
Chris Conlon 8e0f5f9289 EVP_PKEY_get1/set1_EC_KEY: modify for EC_KEY_up_ref support 2022-03-07 16:31:09 -07:00
Hayden Roche a9cc1ca877
Merge pull request #4924 from dgarske/coexist_fixes 2022-03-07 13:00:22 -08:00
Anthony Hu d77d9b93dc This fixes a make check error.
The flags activated code that didn't account for the new oid encoding. This
code fixes that.
2022-03-07 15:47:47 -05:00
John Safranek 0e0ac14bbf
Merge pull request #4901 from SparkiDev/kcapi_ecdh_fixes
Fixes for KCAPI ECDH/DH and page alignment
2022-03-07 11:01:16 -08:00
David Garske e7041d2315
Merge pull request #4929 from SparkiDev/siphash_clang
SipHash: Replace gcc specific ASM instruction with generic
2022-03-07 10:34:13 -08:00
Sean Parkinson 3b4ba669d4
Merge pull request #4922 from dgarske/async_disable_fixes
Fixes for async disables around the DevCopy calls
2022-03-07 13:51:09 +10:00
Sean Parkinson 1ca35f6cca TFM: handle more alloc failure cases gracefully 2022-03-07 13:20:39 +10:00
Sean Parkinson d5989dc15e SipHash: Replace gcc specific ASM instruction with generic
clang would not compile movxzb.
Replaced with movzbq.
2022-03-07 08:49:28 +10:00
Sean Parkinson 7006efe97f
Merge pull request #4861 from JacobBarthelmeh/ECC
Deterministic ECDSA: fix for larger curve sizes
2022-03-07 08:26:35 +10:00
Chris Conlon 2fc47fedee
Merge pull request #4900 from miyazakh/esp_waituntil
Fix wait-until-done in rsa hw primitive acceleration of ESP-IDF port
2022-03-04 17:32:06 -07:00
David Garske 0c3b9c733f Fixes for KCAPI ECDH/DH and page alignment. ZD 13763 2022-03-04 15:06:16 -08:00
Kareem e6189a638c IOTSafe workarounds: Allow reading files with no GetSize command available, allow sign command response with no padding. 2022-03-04 14:03:47 -07:00
David Garske 3839b0e675 Fixes for building wolfSSL along side openssl. 2022-03-04 12:06:24 -08:00
Chris Conlon e1829e614d
Merge pull request #4820 from haydenroche5/evp_pkey_paramgen
Add wolfSSL_EVP_PKEY_paramgen to the compatibility layer.
2022-03-04 11:49:21 -07:00
Jacob Barthelmeh a4a4bdc20f fix typo, add macro guard, remove dead code path 2022-03-04 10:49:11 -07:00
David Garske e91f0f173b Fixes for async disables around the DevCopy calls. ZD13824 2022-03-03 16:33:18 -08:00
Anthony Hu 3ad94c63f5 Pass the tests! 2022-03-03 17:02:26 -05:00
Anthony Hu 7ec61dfe05 Make jenkins happy 2022-03-03 15:44:00 -05:00
Jacob Barthelmeh d1212f9247 add P521 test case and fix for k generation 2022-03-03 10:44:24 -07:00
David Garske 2567cd5e5a
Merge pull request #4912 from julek-wolfssl/ZD13742
Check `input` size in `DecodeNsCertType`
2022-03-03 08:22:49 -08:00
Anthony Hu 949f8b5be1 Revert back to word16 API. 2022-03-03 10:41:05 -05:00
Jacob Barthelmeh 56de8cd622 add check on hash size passed in 2022-03-02 16:52:04 -07:00
Anthony Hu a54045113a fixes from review by dgarske 2022-03-02 17:39:15 -05:00
Anthony Hu 0053bd3af1 Now we can inject as wellgit checkout custom_ext_parse 2022-03-02 15:16:39 -05:00
Juliusz Sosinowicz f846aceee2 Check `input` size in `DecodeNsCertType` 2022-03-02 17:17:17 +01:00
Sean Parkinson 8b24be04e8 ASN PemToDer: remove padding when AES_CBC encrypted 2022-03-02 11:33:44 +10:00
Hideki Miyazaki c3e7ff0e61
addressed code review 2022-03-02 07:09:33 +09:00
David Garske b21036947c
Merge pull request #4894 from SparkiDev/sp_p521_hashlen_fix
SP P521: hash len needs special attention when 521 bits
2022-03-01 12:04:51 -08:00
Sean Parkinson 605d701113 SP P521: hash len needs special attention when 521 bits
Need to right shift number down when hash is more than 521 bits.
Previously handled at a byte level and now at bit level.
Always return err from sp_*_ecc_mulmod_add_only_*().
When ECC add and double points are public and only have SP
implementation, check that the point ordinates are the right size.
2022-03-01 09:56:22 +10:00
Sean Parkinson 1aff4399d1
Merge pull request #4899 from dgarske/kcapi
Improvements to KCAPI support
2022-03-01 08:52:55 +10:00
Anthony Hu cb95aed41b Parsing of custom extensions in X.509 certificates. 2022-02-28 16:35:19 -05:00
David Garske 9644a04db2 Peer review fix. 2022-02-28 11:32:12 -08:00
kaleb-himes ac7bd0aae8 Fix up random.h conflicts with cert 3389 releases and some NETOS issues 2022-02-28 12:09:50 -07:00
David Garske 1cb7342f61
Merge pull request #4895 from SparkiDev/benchmark_threaded
Benchmark: support multi-threaded testing
2022-02-27 21:41:07 -08:00
Hideki Miyazaki 4f4a509e8c
fix wait until in rsa primitive 2022-02-26 09:52:14 +09:00
David Garske 9bdef1577b Fixes for hmac. 2022-02-25 15:19:52 -08:00
David Garske cc2eb0ab71 KCAPI Testing fixes. 2022-02-25 15:16:55 -08:00
David Garske ce6b6951d2 Fix issue with missing OID's for ASN template. 2022-02-25 14:23:01 -08:00
David Garske ae1072afad Cleanup mess of `ASN_NAME_MAX`. 2022-02-25 14:23:01 -08:00
David Garske a2381ba954 Adds CSR userId support in subject name. Minor build fixes for ASN template. 2022-02-25 14:22:59 -08:00
David Garske 08d1e5cb60
Merge pull request #4897 from anhu/bad_macro
Correct bad macros
2022-02-25 14:18:57 -08:00
David Garske 3fdb6f0a4a Only use pthreads if supported in config. 2022-02-25 13:05:04 -08:00
Anthony Hu 1a9faa1f7e fix suggested by dgarske 2022-02-25 14:00:07 -05:00
David Garske e3e1426b91 Improve benchmark threading macros and text output. Thread protections on variables. Fixes for testing with async. 2022-02-25 10:51:19 -08:00
Anthony Hu 997a3aabc6 Correct bad macros 2022-02-25 13:19:35 -05:00
Sean Parkinson 56adf831a3 Benchmark: support multi-threaded testing 2022-02-25 14:12:03 +10:00
Anthony Hu 07fdca1d62
Merge pull request #4885 from SparkiDev/asn_templ_bad_name 2022-02-24 12:44:27 -05:00
David Garske 86e08525cb
Merge pull request #4852 from elms/fix/more_oot
automake: fix fips touch and cleanup
2022-02-24 09:04:05 -08:00
Sean Parkinson 3d5b933f3c SP math all: IAR doesn't accept comment lines in assembly
Replace assembly comment lines with C comment lines.
2022-02-24 16:06:31 +10:00
Sean Parkinson bb50777f1a ASN template: handle short OIDs
cert_asn1_test was constructing a BER encoding of a certificate that
didn't have all the components. It was trying to test putting in a bad
OID in the certificate name.
The original ASN.1 parsing code stopped at the bad name. ASN.1 template
code does the whole structure and then digs into the name.
A complete certificate should have always been used.
2022-02-24 15:36:56 +10:00
elms d1895e5679 automake: fix fips touch and cleanup
This fixes an issue with yocto that only occurs when using `devtool`
which builds out of tree.
2022-02-23 14:11:31 -08:00
Hayden Roche 51d66877f7 Add wolfSSL_EVP_PKEY_paramgen to the compatibility layer.
Currently, it only supports ECC, which is all we need it for for the OpenSplice
port we're working on. In the ECC case, all it needs to do is set the group
appropriately. The logic is very similar to `wolfSSL_EVP_PKEY_keygen`, minus
the final step of actually generating the key.
2022-02-23 13:59:15 -08:00
David Garske 0824a64c92
Merge pull request #4807 from julek-wolfssl/stunnel-5.61
stunnel 5.61 support
2022-02-23 09:41:51 -08:00
David Garske 0afc5e2cf1
Merge pull request #4881 from SparkiDev/sp_asm_shift_fix
SP asm: fix for modexp corner case
2022-02-23 09:37:25 -08:00
Juliusz Sosinowicz afca455cda stunnel 5.61 support
- New/Implemented API
  - `SSL_has_pending`
  - `wolfSSL_CertManagerLoadCRLFile`
  - `wolfSSL_LoadCRLFile`
  - `wolfSSL_CTX_LoadCRLFile`
  - `wolfSSL_CTX_add_session`
- Calling chain certificate API (for example `wolfSSL_CTX_use_certificate_chain_file`) no longer requires an actual chain certificate PEM file to be passed in as input. `ProcessUserChain` error in `ProcessBuffer` is ignored if it returns that it didn't find a chain.
- Add `WOLFSSL_TICKET_HAVE_ID` macro. When defined tickets will include the original session ID that can be used to lookup the session in internal cache. This is useful for fetching information about the peer that doesn't get sent in a resumption (such as the peer's certificate chain).
  - Add `ssl->ticketSessionID` field because `ssl->session.sessionID` is used to return the "bogus" session ID sent by the client in TLS 1.3
- `OPENSSL_COMPATIBLE_DEFAULTS` changes
  - Define `WOLFSSL_TRUST_PEER_CERT` and certificates added as CA's will also be loaded as trusted peer certificates
  - Define `WOLFSSL_TLS13_MIDDLEBOX_COMPAT`
- Seperate `internalCacheOff` and `internalCacheLookupOff` options to govern session addition and lookup
- `VerifyServerSuite` now determines if RSA is available by checking for it directly and not assuming it as the default if static ECC is not available
- `WOLFSSL_SESSION` changes
  - `ssl->extSession` added to return a dynamic session when internalCacheOff is set
  - `ssl->session.refPtr` made dynamic and gets free'd in `SSL_ResourceFree`
- If `SSL_MODE_AUTO_RETRY` is set then retry should only occur during a handshake
- `WOLFSSL_TRUST_PEER_CERT` code now always uses `cert->subjectHash` for the `cm->tpTable` table row selection
- Change some error message names to line up with OpenSSL equivalents
- Run `MatchSuite` again if certificate setup callback installed and successful
- Refactor clearing `ASN_NO_PEM_HEADER` off the error queue into a macro
- `wolfSSL_get_peer_certificate` now returns a duplicated object meaning that the caller needs to free the returned object
- Allign `wolfSSL_CRYPTO_set_mem_functions` callbacks with OpenSSL API
- `wolfSSL_d2i_PKCS12_bio` now consumes the input BIO. It now supports all supported BIO's instead of only memory BIO.
- stunnel specific
  - Always return a session object even if we don't have a session in cache. This allows stunnel to save information in the session external data that will be transfered to new connections if the session is reused
  - When allocating a dynamic session, always do `wolfSSL_SESSION_set_ex_data(session, 0, (void *)(-1)`. This is to mimic the new index callback set in `SSL_SESSION_get_ex_new_index`.
- Fix comment in `wolfSSL_AES_cbc_encrypt`
- Trusted peer certificate suite tests need to have CRL disabled since we don't have the issuer certificate in the CA store if the certificates are only added as trusted peer certificates.
tested
2022-02-23 09:47:34 +01:00
Sean Parkinson 2eb044dc60 SP: Add support for P521 2022-02-23 14:51:47 +10:00
Sean Parkinson 5b6130889e SP asm: fix for modexp corner case
When exponent bit length is a multiple of the window size and the top
word has only window bits in it, then n is shifted down by an undefined
value (size of a word). The n value is not used after this.
Check for this condition and don't attempt to shift n.
2022-02-23 09:17:08 +10:00
David Garske e8c9a413ca
Merge pull request #4878 from SparkiDev/sp_x64_oob_write_fix_1
ECC with SP math: OOB write
2022-02-22 09:53:32 -08:00
Sean Parkinson d10900e124 ECC with SP math: OOB write
Don't let input points ordinates be greater than modulus in length.
2022-02-22 17:00:23 +10:00
Sean Parkinson 78f116b27f SP asm: fix map function to use p not point 2022-02-22 16:33:24 +10:00
David Garske 250a06f759
Merge pull request #4865 from SparkiDev/sp_int_mont_red
SP int: Montgomery Reduction
2022-02-21 16:20:17 -08:00
John Safranek 041d300b2b
Fix Small Memory Leaks
Found with the configuration running the unit test through valgrind.

    % ./configure CFLAGS=-DNO_WOLFSSL_CIPHER_SUITE_TEST \
      --enable-all --disable-fastmath --enable-debug --disable-shared

1. ssl.c: In wolfSSL_DSA_generate_key(), we initialize (and allocate)
   all the parameters in the key (p, q, g, x, y), and then we generate a
   key, initializes (and allocates) x and y, again. mp_clear them
   first.
2. evp.c: When printing public keys, the temporary mp_int wasn't getting
   correctly freed.
3. evp.c: When printing public keys, modified the utility functions to
   return once with a do-while-0 loop.
2022-02-18 10:01:49 -08:00