Commit Graph

1890 Commits (b543aa01483f8b5dcdaafab5f8a7c148879fefda)

Author SHA1 Message Date
Eric Blankenhorn b543aa0148 Fix for mingw builds 2022-04-22 14:35:46 -05:00
Daniel Pouzzner 4a4b019e30 tests/api.c: in test_wc_ecc_verify_hash_ex(), check that passing zero r and/or s to wc_ecc_verify_hash_ex() returns MP_ZERO_E. 2022-04-21 07:21:42 +02:00
Hayden Roche cfab451328
Merge pull request #5024 from dgarske/zd13538 2022-04-20 13:08:13 -07:00
David Garske 49f510544a
Merge pull request #5057 from haydenroche5/pem_write_ec_rsa_pub
Add wolfSSL_PEM_write_RSAPublicKey and wolfSSL_PEM_write_EC_PUBKEY.
2022-04-19 16:19:38 -07:00
Hayden Roche d7085069d6 Add wolfSSL_PEM_write_RSAPublicKey and wolfSSL_PEM_write_EC_PUBKEY.
These were compatibility layer stubs before.
2022-04-19 09:42:10 -07:00
Juliusz Sosinowicz a6319fc2a9 Add missing XFCLOSE() 2022-04-15 16:26:31 +02:00
David Garske 80766566fc Fixes for `X509_add_ext` and new test case. 2022-04-06 16:35:53 -07:00
David Garske 1b5af2fdd9
Merge pull request #5022 from SparkiDev/wycheproof_fixes
Wycheproof fixes/changes
2022-04-06 10:29:17 -07: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
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
Daniel Pouzzner 328de3ed63 remove -Wno-strict-aliasing from AX_HARDEN_CC_COMPILER_FLAGS and AX_HARDEN_CXX_COMPILER_FLAGS in m4/ax_harden_compiler_flags.m4, and fix strict aliasing infractions in api.c. 2022-04-05 08:10:16 -05:00
Sean Parkinson 77485d987e
Merge pull request #5010 from haydenroche5/asn1_time_diff_2038
Fix year 2038 problem in wolfSSL_ASN1_TIME_diff.
2022-04-05 07:58:36 +10:00
Anthony Hu fc6e10ff42 Another test fixup. 2022-04-04 17:42:25 -04:00
Hayden Roche 9c1e2a83d1 Fix year 2038 problem in wolfSSL_ASN1_TIME_diff.
Prior to this commit, this function used XMKTIME (mktime) to convert the
passed in WOLFSSL_ASN1_TIMEs to Unix timestamps. On platforms where time_t is
32 bits long, times after the year 2038 can't be represented with this type. To
fix this, we need to not use XMKTIME. With this commit, the static function
time2epoch is added to ssl.c, which uses the date time information to compute
seconds since the Unix epoch without the use of mktime. It returns the seconds
as a long long. This is sufficient to make the function work for years > 2038 on
the platform of the user who discovered this problem in the first place (Yocto
Linux on ARMv7).
2022-04-04 11:01:21 -07:00
Anthony Hu 400c7238ef Test fixup. 2022-04-04 13:43:06 -04:00
Anthony Hu ae9926cc42 Missing flag in unit test. 2022-04-04 12:39:10 -04:00
Daniel Pouzzner 0d6c283f7a fixes for -Werror=declaration-after-statement in debug builds. 2022-04-04 09:29:26 -05:00
Sean Parkinson 0fba16a394
Merge pull request #4998 from haydenroche5/get_conv_form
Add wolfSSL_EC_KEY_get_conv_form to compatibility layer.
2022-04-04 08:47:14 +10:00
Hayden Roche 880afe0d89 Add wolfSSL_EC_KEY_get_conv_form to compatibility layer. 2022-04-02 13:57:33 -07:00
Anthony Hu c522baa75e Unit tests. 2022-04-01 18:34:21 -04: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
Juliusz Sosinowicz 6dffa8a13d Implement `EVP_EncodeBlock` and `EVP_DecodeBlock` 2022-04-01 13:29:40 +02: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
Sean Parkinson 1add8703e2
Merge pull request #4996 from haydenroche5/bn_rand
Improve wolfSSL_BN_rand.
2022-04-01 08:12:22 +10:00
David Garske 61f6b5e29c Peer review feedback. 2022-03-31 10:04:23 -07:00
David Garske c905c613e9 Support for Intel QuickAssist ECC KeyGen acceleration. 2022-03-30 13:07:47 -07:00
Hayden Roche 2077690bf0 Improve wolfSSL_BN_rand.
- Previously, this function would round up the requested bits to the next
multiple of 8. With this commit, the function returns a number of exactly the
number of bits requested, which is the same behavior as OpenSSL. This problem
was discovered by a user using the compatibility layer with OpenSSH's ssh-keygen
utility.
- This function now respects the top and bottom parameters.
- Improved unit testing.
2022-03-29 18:08:21 -07:00
Jacob Barthelmeh f7f94cede0 support creating new mem bio of length 0 2022-03-28 15:52:42 -06: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
Juliusz Sosinowicz 88d5059c36 Jenkins fixes
`WS_RETURN_CODE` was not functioning properly in master
2022-03-24 12:16:59 +01:00
Juliusz Sosinowicz 98bc8402db Refactor memory BIO
- use the `WOLFSSL_BUF_MEM` struct to resize the internal memory buffer
- add a `WOLFSSL_BIO_RESIZE_THRESHOLD` define that will be used to determine how often to shrink the internal buffer. This should cut down on the number of free/malloc calls made significantly. This should help with our inefficient 1 byte reads in `loadX509orX509REQFromPemBio`.
- implement `wolfSSL_BUF_MEM_resize` which allows bi-directional buffer size manipulation
2022-03-24 12:16:59 +01:00
Juliusz Sosinowicz 9763030675
Merge pull request #4845 from cconlon/pkcs7compat 2022-03-21 15:26:37 +01:00
Hayden Roche dcaa218ed8
Merge pull request #4927 from cconlon/upRef 2022-03-18 18:10:36 -07:00
Hayden Roche 2637e5e361
Merge pull request #4926 from cconlon/namePrintRFC5523 2022-03-18 15:53:07 -07:00
David Garske a79daa5ea8
Merge pull request #4959 from haydenroche5/asn1_time_diff_bug
Fix bug in wolfSSL_ASN1_TIME_diff.
2022-03-18 14:28:23 -07:00
Chris Conlon 582f0d82e4 address review feedback for PKCS7 compat additions 2022-03-18 12:07:44 -06:00
Juliusz Sosinowicz 1fd090d094 Update `wolfSSL_get_session` docs
Recommend using `wolfSSL_get1_session` and `NO_SESSION_CACHE_REF` for session resumption purposes. `wolfSSL_get_session` should not be used unless to inspect the current session object.
2022-03-17 12:56:28 +01:00
Hayden Roche 6e6aa5b0c1 Fix bug in wolfSSL_ASN1_TIME_diff.
This function should not error out if one of the passed in times is the Unix
epoch. This amounts to erroring out when the XMKTIME returns < 0, rather than
<= 0.
2022-03-15 10:52:05 -07:00
Chris Conlon 6762cd90da add tests for PKCS7_sign(), PKCS7_final(), SMIME_write_PKCS7() 2022-03-15 10:21:22 -06:00
Chris Conlon a7d5e6400d add support for PKCS7_TEXT flag to PKCS7_verify() 2022-03-15 10:21:22 -06: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 cdb45b12c5
Merge pull request #4884 from haydenroche5/i2d_x509_name_fix
Improve wolfSSL_i2d_X509_name.
2022-03-14 11:57:07 +10:00
Daniel Pouzzner 82ab7bf32c ssl.c: fix hash state memory leaks in wolfSSL_clear() and wolfSSL_TicketKeyCb(). 2022-03-11 13:40:01 -06:00
Chris Conlon 9fff321e3e address PR review feedback on EVP_PKEY changes 2022-03-11 10:11:02 -07:00
Sean Parkinson 47895fe78d
Merge pull request #4942 from dgarske/sp_math_opensslextra
Fixes to support building opensslextra with SP math
2022-03-10 08:53:21 +10:00
Chris Conlon e1da313b91 EVP_PKEY_copy_parameters: add support for EVP_PKEY_DH 2022-03-09 14:34:09 -07:00
David Garske 3a62857dbd Fixes to support building opensslextra with SP math. Disables some of the compatibility layer BN and ECC point handling. 2022-03-09 11:53:56 -08:00
Daniel Pouzzner 67cc8ed482 tests/api.c: fix test_wolfSSL_BIO_Qt_usecase() "function declaration isn’t a prototype". 2022-03-09 12:27:19 -06:00
Chris Conlon 70857f7b3c
Merge pull request #4923 from miyazakh/set_bio
Set bio read/write flag obviously
2022-03-08 13:08:33 -07:00