summaryrefslogtreecommitdiffstats
path: root/test
AgeCommit message (Collapse)Author
2024-04-08Extend the multi_resume test for simultaneous resumptionsMatt Caswell
Test what happens if the same session gets resumed multiple times at the same time - and one of them gets marked as not_resumable. Related to CVE-2024-2511 Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/24044)
2024-04-05Add a test for session cache handlingMatt Caswell
Repeatedly create sessions to be added to the cache and ensure we never exceed the expected size. Related to CVE-2024-2511 Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/24044)
2024-04-02Fix handling of NULL sig parameter in ECDSA_sign and similarBernd Edlinger
The problem is, that it almost works to pass sig=NULL to the ECDSA_sign, ECDSA_sign_ex and DSA_sign, to compute the necessary space for the resulting signature. But since the ECDSA signature is non-deterministic (except when ECDSA_sign_setup/ECDSA_sign_ex are used) the resulting length may be different when the API is called again. This can easily cause random memory corruption. Several internal APIs had the same issue, but since they are never called with sig=NULL, it is better to make them return an error in that case, instead of making the code more complex. Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23529) (cherry picked from commit 1fa2bf9b1885d2e87524421fea5041d40149cffa)
2024-04-02Fix openssl req with -addext subjectAltName=dirNameBernd Edlinger
The syntax check of the -addext fails because the X509V3_CTX is used to lookup the referenced section, but the wrong configuration file is used, where only a default section with all passed in -addext lines is available. Thus it was not possible to use the subjectAltName=dirName:section as an -addext parameter. Probably other extensions as well. This change affects only the syntax check, the real extension was already created with correct parameters. Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23669) (cherry picked from commit 387418893e45e588d1cbd4222549b5113437c9ab)
2024-03-25Add NULL check before accessing PKCS7 encrypted algorithmViliam Lejčík
Printing content of an invalid test certificate causes application crash, because of NULL dereference: user@user:~/openssl$ openssl pkcs12 -in test/recipes/80-test_pkcs12_data/bad2.p12 -passin pass: -info MAC: sha256, Iteration 2048 MAC length: 32, salt length: 8 PKCS7 Encrypted data: Segmentation fault (core dumped) Added test cases for pkcs12 bad certificates Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23632) (cherry picked from commit a4cbffcd8998180b98bb9f7ce6065ed37d079d8b)
2024-03-07Try to fix intermittent CI failures in sslapitestBernd Edlinger
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> (Merged from https://github.com/openssl/openssl/pull/23774)
2024-02-22SSL_set1_groups_list(): Fix memory corruption with 40 groups and moreMichael Baentsch
Fixes #23624 The calculation of the size for gid_arr reallocation was wrong. A multiplication by gid_arr array item size was missing. Testcase is added. Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> (Merged from https://github.com/openssl/openssl/pull/23659)
2024-02-22Minor wording fixes related to no-atexitTomas Mraz
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/23642) (cherry picked from commit 66e6f72c3e4221580a7f456ddeaa5027f0bbb8b7)
2024-02-22Add atexit configuration option to using atexit() in libcrypto at build-time.Randall S. Becker
This fixes an issue with a mix of atexit() usage in DLL and statically linked libcrypto that came out in the test suite on NonStop, which has slightly different DLL unload processing semantics compared to Linux. The change allows a build configuration to select whether to register OPENSSL_cleanup() with atexit() or not, so avoid situations where atexit() registration causes SIGSEGV. INSTALL.md and CHANGES.md have been modified to include and describe this option. Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca> Signed-off-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23642) (cherry picked from commit 0e1989d4c7435809b60f614c23ba8c9a7c0373e8)
2024-02-07Fix testcases to run on duplicated keysTomas Mraz
The existing loop pattern did not really run the expected tests on the duplicated keys. Fixes #23129 Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23292) (cherry picked from commit 387b93e14907cd8203d6f2c9d78e49df01cb6e1f)
2024-01-30fix missing null check in kdf_test_ctrlNeil Horman
Coverity issue 1453632 noted a missing null check in kdf_test_ctrl recently. If a malformed value is passed in from the test file that does not contain a ':' character, the p variable will be NULL, leading to a NULL derefence prepare_from_text Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> (Merged from https://github.com/openssl/openssl/pull/23398) (cherry picked from commit 6ca1d3ee81b61bc973e4e1079ec68ac73331c159)
2024-01-30Copyright year updatesMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org> Release: yes
2024-01-25Have OSSL_PARAM_allocate_from_text() fail on odd number of hex digitsRichard Levitte
The failure would be caught later on, so this went unnoticed, until someone tried with just one hex digit, which was simply ignored. Fixes #23373 Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23374) (cherry picked from commit ea6268cfceaba24328d66bd14bfc97c4fac14a58)
2024-01-25Add some tests for various PKCS12 files with NULL ContentInfoMatt Caswell
PKCS7 ContentInfo fields held within a PKCS12 file can be NULL, even if the type has been set to a valid value. CVE-2024-0727 is a result of OpenSSL attempting to dereference the NULL pointer as a result of this. We add test for various instances of this problem. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Neil Horman <nhorman@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23362)
2024-01-23tlsfuzzer.sh: Use python3Tomas Mraz
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> (Merged from https://github.com/openssl/openssl/pull/23342) (cherry picked from commit 15f479e25f9591a2749fabb436dcdfb9304c5c7b)
2024-01-23tlsfuzzer.sh: Make it more informative on errorsTomas Mraz
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> (Merged from https://github.com/openssl/openssl/pull/23342) (cherry picked from commit 825b7cb16e0624d81421441949e843e9876c81f9)
2024-01-23tlsfuzzer.sh: Run openssl version on the built app and not system oneTomas Mraz
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> (Merged from https://github.com/openssl/openssl/pull/23342) (cherry picked from commit 150b3b18dfde317621a6bf26acfe0d06193e52fd)
2024-01-23gost_engine.sh: Set OPENSSL_ENGINES_DIRTomas Mraz
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> (Merged from https://github.com/openssl/openssl/pull/23342) (cherry picked from commit 017c7cf2bb5f5461071d9e992eb3206c34a69c2c)
2024-01-19Uninitialized array variableshashankmca80
array"key" is uninitialized and it is being read directly in function SipHash_Init() as per the below statements making a way for the garbage values : uint64_t k0 = U8TO64_LE(k); uint64_t k1 = U8TO64_LE(k + 8); CLA: trivial Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23298) (cherry picked from commit a0826b184eed2dccc56cdf80e3e0bc061cc89ddc)
2024-01-16Check whether the pubkey exists in ossl_ecx_key_duplan1120
Signed-off-by: lan1120 <lanming@huawei.com> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22984) (cherry picked from commit aac531e5daa2edec5d47e702a7f115cf77fe07f9)
2024-01-15Limit the execution time of RSA public key checkTomas Mraz
Fixes CVE-2023-6237 If a large and incorrect RSA public key is checked with EVP_PKEY_public_check() the computation could take very long time due to no limit being applied to the RSA public key size and unnecessarily high number of Miller-Rabin algorithm rounds used for non-primality check of the modulus. Now the keys larger than 16384 bits (OPENSSL_RSA_MAX_MODULUS_BITS) will fail the check with RSA_R_MODULUS_TOO_LARGE error reason. Also the number of Miller-Rabin rounds was set to 5. Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23243) (cherry picked from commit e09fc1d746a4fd15bb5c3d7bbbab950aadd005db)
2024-01-12Add test/recipes/15-test_gensm2.t, to test SM2 key generation resultsRichard Levitte
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22529) (cherry picked from commit d4d9b57530b2ecdca6b4263b5841b42c820e5275)
2024-01-12Fix NULL pointer deref when parsing the stable sectionNeil Horman
When parsing the stable section of a config such as this: openssl_conf = openssl_init [openssl_init] stbl_section = mstbl [mstbl] id-tc26 = min Can lead to a SIGSEGV, as the parsing code doesnt recognize min as a proper section name without a trailing colon to associate it with a value. As a result the stack of configuration values has an entry with a null value in it, which leads to the SIGSEGV in do_tcreate when we attempt to pass NULL to strtoul. Fix it by skipping any entry in the config name/value list that has a null value, prior to passing it to stroul Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22988) (cherry picked from commit 0981c20f8efa68bf9d68d7715280f83812c19a7e)
2024-01-12Add tests for re-using cipher contextsHolger Dengler
Add test case for re-using a cipher context with the same key, iv and cipher. It detects, if the hardware-specific cipher context is reset correctly, like reported in issue #23175. This test has encrypt and decrypt iterations for cfb128 and ofb128. All iteations use the same key, iv and plaintext. Signed-off-by: Holger Dengler <dengler@linux.ibm.com> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23201) (cherry picked from commit 3cb1b51dddf4deaf5e3886b827f3245d81670bc7)
2024-01-10Fix a similar memory leak in SXNET_add_id_INTEGERBernd Edlinger
Even in the good case there was memory leak here. Add a simple test case to have at least some test coverage. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23234) (cherry picked from commit 398011848468c7e8e481b295f7904afc30934217)
2024-01-05Validate config options during x509 extension creationNeil Horman
There are several points during x509 extension creation which rely on configuration options which may have been incorrectly parsed due to invalid settings. Preform a value check for null in those locations to avoid various crashes/undefined behaviors Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23183) (cherry picked from commit bac7e687d71b124b09ad6ad3e15be9b38c08a1ba)
2024-01-05make inability to dup/clone ciphers an errorNeil Horman
There should be no reason that a cipher can't be duplicated Fixes #21887 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23102) (cherry picked from commit 58a6aa0c9fe6abad996f45c6b452983035db7105)
2024-01-03validate requested key length in kdf_pbkdf1_do_deriveNeil Horman
When using pbkdf1 key deriviation, it is possible to request a key length larger than the maximum digest size a given digest can produce, leading to a read of random stack memory. fix it by returning an error if the requested key size n is larger than the EVP_MD_size of the digest Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23174) (cherry picked from commit 8d89050f0f676b429043fd5445e5a570d54ad225)
2024-01-01gate calling of evp_method_id on having a non-zero name idNeil Horman
If a name is passed to EVP_<OBJ>_fetch of the form: name1:name2:name3 The names are parsed on the separator ':' and added to the store, but during the lookup in inner_evp_generic_fetch, the subsequent search of the store uses the full name1:name2:name3 string, which fails lookup, and causes subsequent assertion failures in evp_method_id. instead catch the failure in inner_evp_generic_fetch and return an error code if the name_id against a colon separated list of names fails. This provides a graceful error return path without asserts, and leaves room for a future feature in which such formatted names can be parsed and searched for iteratively Add a simple test to verify that providing a colon separated name results in an error indicating an invalid lookup. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Todd Short <todd.short@me.com> (Merged from https://github.com/openssl/openssl/pull/23110) (cherry picked from commit 94be985cbcc1f0a5cf4f172d4a8d06c5c623122b)
2023-12-22Detect and prevent recursive config parsingNeil Horman
If a malformed config file is provided such as the following: openssl_conf = openssl_init [openssl_init] providers = provider_sect [provider_sect] = provider_sect The config parsing library will crash overflowing the stack, as it recursively parses the same provider_sect ad nauseum. Prevent this by maintaing a list of visited nodes as we recurse through referenced sections, and erroring out in the event we visit any given section node more than once. Note, adding the test for this revealed that our diagnostic code inadvertently pops recorded errors off the error stack because provider_conf_load returns success even in the event that a configuration parse failed. The call path to provider_conf_load has been updated in this commit to address that shortcoming, allowing recorded errors to be visibile to calling applications. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22898) (cherry picked from commit 682fd21afb5428b5716e62eaefb09a7419f9cfd7)
2023-12-19Fix provider compatibility check crash in evp_testTomas Mraz
EVP_MAC_CTX_get_mac_size() cannot be called on older unfixed versions before EVP_MAC_init(). Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/23008)
2023-12-19Fix no-des failure in test_cmsBernd Edlinger
The newly introduced test case do not work when configured with no-des, fix that by choosing -aes128 as cipher. Fixes ffed597882ba ("cms: avoid intermittent test failure") Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23086) (cherry picked from commit 5b4f4474b2562c4422193e1719461a0ef5cbc3e5)
2023-12-19Test that incorrect entry in the ssl section is not fatalTomas Mraz
The following entries should be still applied. Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/23048) (cherry picked from commit 17b4277d9ac6665e9b53a6270949418154cab2dc)
2023-12-18cms: avoid intermittent test failureJames Muir
If you decrypt a random input using RSAES-PKCS-v1_5, then there is a non-negligible chance that the result will look like a valid plaintext (that is why RSAES-PKCS-v1_5 shouldn't be used anymore). This was the cause of an intermittent failure in a test that did a cms-encrypt operation targetting multiple recipients. The failure happened during key-only decrypt. The recipient decrypts every RSA ciphertext -- only one is supposed to decrypt successfully, which would reveal the right content-key. Occassionally, more than one decrypted successfully. Update the test by specifying the recipient cert in the decrypt op (this avoids looping over all RSA ciphertexts). Add a new test to get coverage for key-only decrypt, but use RSA-OAEP during the encrypt op. Fixes https://github.com/openssl/project/issues/380 Testing: $ make TESTS='test_cms' test Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23055) (cherry picked from commit ffed597882baf2f07274e7eaa8f3c4fa9fa74ac1)
2023-12-18Fix instructions for running tests on WindowsDmitry Kobets
In the command `nmake TEST='foo' test`, on Windows the runner will look for test `'foo'` and complain about the test not being found (due to the extraneous single quotes), whereas with `nmake TEST="foo" test`, the test `foo` will be correctly found. CLA: trivial Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23059) (cherry picked from commit cf424d1da05b3cd928c97596af08e260429b308c)
2023-12-15Harden asn1 oid loader to invalid inputsNeil Horman
In the event that a config file contains this sequence: ======= openssl_conf = openssl_init config_diagnostics = 1 [openssl_init] oid_section = oids [oids] testoid1 = 1.2.3.4.1 testoid2 = A Very Long OID Name, 1.2.3.4.2 testoid3 = ,1.2.3.4.3 ====== The leading comma in testoid3 can cause a heap buffer overflow, as the parsing code will move the string pointer back 1 character, thereby pointing to an invalid memory space correct the parser to detect this condition and handle it by treating it as if the comma doesn't exist (i.e. an empty long oid name) (cherry picked from commit a552c23c6502592c1b3c67d93dd7e5ffbe958aa4) Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23034) (cherry picked from commit d802bfbf80bab00123a4a6209f255852b3a10207)
2023-12-12Add a test for late loading of an ENGINE in TLSMatt Caswell
Confirm that using an ENGINE works as expected with TLS even if it is loaded late (after construction of the SSL_CTX). (cherry picked from commit a9c97da4910648790387d035afb12963158778fb) Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Todd Short <todd.short@me.com> (Merged from https://github.com/openssl/openssl/pull/22865)
2023-12-12Add a test case for OSSL_HTTP_parse_urlMatt Caswell
Ensure we test the case where the port value is empty in the URL. Reviewed-by: Todd Short <todd.short@me.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/22961) (cherry picked from commit a36d10dfb7e77614c8d3da602ff3800a2e9f4989)
2023-12-12Extend the test of BN_GF2m_mod_invMatt Caswell
Test that input value of 1 for p is treated as an error Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Todd Short <todd.short@me.com> (Merged from https://github.com/openssl/openssl/pull/22960) (cherry picked from commit b83c719ecb884f609ade7ad7f52bd5e09737585b)
2023-12-12Fix a possible memory leak in do_othernameBernd Edlinger
Since the gen->type will not be set in a2i_GENERAL_NAME the gen->d.otherName will not be automatically cleaned up by GENERAL_NAME_free. Also fixed a similar leak in a2i_GENERAL_NAME, where ASN1_STRING_set may fail but gen->d.ia5 will not be automatically cleaned up. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22996) (cherry picked from commit 1c078212f1548d7f647a1f0f12ed6df257c85cc3)
2023-12-08test/recipes/01-test_symbol_presence.t: Treat common symbols speciallyRichard Levitte
Common symbols (type 'C' in the 'nm' output) are allowed to be defined more than once. This makes test/recipes/01-test_symbol_presence.t reflect that. (backport of commit 4ff5137ff5fb896e0273d274110517e3c7adb8cf) Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Neil Horman <nhorman@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22929)
2023-12-08test/recipes/01-test_symbol_presence.t: Ignore symbols starting with '__'Richard Levitte
On some platforms, the compiler may add symbols that aren't ours and that we should ignore. They are generally expected to start with a double underscore, and thereby easy to detect. (backport of commit 6c63b7e861819db439551b52ea5594faec04b65c) Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Neil Horman <nhorman@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22929)
2023-12-07Add overflow checks to parse_number/parse_hex/parse_octNeil Horman
Test the next arithmetic operation to safely determine if adding the next digit in the passed property string will overflow Also, noted a bug in the parse_hex code. When parsing non-digit characters (i.e. a-f and A-F), we do a tolower conversion (which is fine), and then subtract 'a' to get the hex value from the ascii (which is definately wrong). We should subtract 'W' to convert tolower converted hex digits in the range a-f to their hex value counterparts Add tests to test_property_parse_error to ensure overflow checks work Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> (Merged from https://github.com/openssl/openssl/pull/22874) (cherry picked from commit 986c48c4eb26861f25bc68ea252d8f2aad592735)
2023-12-06Statically link legacy provider to evp_extra_testNeil Horman
Like in #17345, evp_extra_test links libcrypto statically, but also has a dynamic/shared load via the legacy provider, which leads to ambiguous behavior in evp_extra_test on some platforms, usually a crash (SIGSEGV) on exit via the atexit handlers. Statically link the legacy provider to avoid this. Fixes #22819 Helped-by: Neil Horman <nhorman@openssl.org> Helped-by: Tomas Mraz <tomas@openssl.org> Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22904) (cherry picked from commit 426d34fc1302eb0d2f5a6152621c105ea2d198b6)
2023-12-04Add a minimal test providerRichard Levitte
We test its validity by trying to load it. Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Todd Short <todd.short@me.com> (Merged from https://github.com/openssl/openssl/pull/22866) (cherry picked from commit 31c2c12f2dada75c334f6a9aa60c8424cf4fd040)
2023-12-01Don't free aliased pointers in ctx cmp_ctx testsNeil Horman
Coverity recorded issues 1551739 and 1551737, a potential double free in the tests. It occurs when the DUP operation fails in such a way val3_read is returned as the same pointer as val2_read. Ideally it should never happen, but resetting val3_read to 0 should satisfy coverity that there is no issue here Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Todd Short <todd.short@me.com> (Merged from https://github.com/openssl/openssl/pull/22800) (cherry picked from commit c8ca810da9c47d8cb6988fd14e1cb4e20b0877e8)
2023-12-01evp-cmac: do not seg-fault when getting mac-size before initJames Muir
Add null check to cmac_size(). This avoids a seg-fault encountered with cmac when EVP_MAC_CTX_get_mac_size() is called before init. Extend mac testing in evp_test.c to check that the sizes returned by EVP_MAC_CTX_get_mac_size() before and after init make sense (this also ensures that we no longer seg-fault). Fixes #22842 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22858) (cherry picked from commit ff181969e28c1503b077b47a9ded3683524b3fd8)
2023-11-29Add last missing TLSA usage/selector/mtype test caseViktor Dukhovni
There were no PKIX-TA(0) SPKI(1) Full(0) (i.e. "0 1 0") test cases in "danetest.in". There is now at least a success case, which will exercise freeing the public key after it is sanity checked, since with PKIX-TA(0) there's nothing we can do with just the raw public key, a full chain to a local trust anchor is in any case required. The failure (to match) code path is already well oiled, but failure to decode while adding malfored TLSA records could still use some additional tests... Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22821) (cherry picked from commit c8fe4b5948486e792016208f7c8ccea9c380f354)
2023-11-29Fix freshly introduced double-free.Viktor Dukhovni
We don't need the decoded X.509 Full(0) certificate for the EE usages 1 and 3, because the leaf certificate is always part of the presented chain, so the certificate is only validated as well-formed, and then discarded, but the TLSA record is of course still used after the validation step. Added DANE test cases for: 3 0 0, 3 1 0, 1 0 0, and 1 1 0 Reported by Claus Assmann. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22821) (cherry picked from commit f636e7e6bd8e06c6d84e42729b4131b4f5df488f)
2023-11-23Add negative test for key length changeTomas Mraz
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 1aa08644ecd4005c0f55276b2e8dabd8a2a758f0) Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/22613)