summaryrefslogtreecommitdiffstats
path: root/test
AgeCommit message (Collapse)Author
2021-07-02Fix memory leak in i2d_ASN1_bio_streamOliver Mihatsch
When creating a signed S/MIME message using SMIME_write_CMS() if the reading from the bio fails, the state is therefore still ASN1_STATE_START when BIO_flush() is called by i2d_ASN1_bio_stream(). This results in calling asn1_bio_flush_ex cleanup but will only reset retry flags as the state is not ASN1_STATE_POST_COPY. Therefore 48 bytes (Linux x86_64) leaked since the ndef_prefix_free / ndef_suffix_free callbacks are not executed and the ndef_aux structure is not freed. By always calling free function callback in asn1_bio_free() the memory leak is fixed. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14844)
2021-07-02test_pem_reading: Test loading a key from a file with multiple PEM dataTomas Mraz
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15949)
2021-07-02load_pkey_pem: Check for spurious errors when loadingTomas Mraz
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15949)
2021-07-02Fix compile errors when building with --api=1.1.0 no-deprecated.Shane Lontis
Fixes #15963 INSTALL.md uses these exact options as an example so it should work. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15965)
2021-07-01afalg: add some memory initialisation calls to pacify memory sanitisation.Pauli
The engine is modifying memory without the sanitiser realising. By pre- initialising this memory, the sanitiser now thinks that read accesses are okay. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/15952)
2021-07-01Fix use of uninitialized memory in test_rsa_oaepDavid Benjamin
48f1739600f33c92387debce2002acec6e365f1d did not convert the RSA OAEP tests correctly. The corrupted ciphertext and truncation tests were really decrypting uninitialized memory, rather than the sample ciphertext. This results in an error in tools like MSan. The test is somewhat roundabout. In the original version, before the conversion, ctext_ex was an OAEP test vector from key1(), etc., functions. The test would: 1. Encrypt ptext_ex as ctext. 2. Decrypt ctext and check it gives ptext_ex. 3. Decrypt ctext_ex and check it gives ptext_ex. 4. Try corrupted and truncated versions of ctext. 48f1739600f33c92387debce2002acec6e365f1d then moved steps 1 and 2 into test_rsa_simple, which meant ctext is no longer available for step 4. It then mistakenly left the variable around, but uninitialized, so the test wasn't testing anything. (Confusingly, test_rsa_simple outputs ctext_ex to the caller, but doesn't do anything with it. The ctext_ex output is also only usable for OAEP, not PKCS#1 v1.5.) It doesn't really matter whether we use ctext or ctext_ex for step 4, so this PR fixes it by using ctext_ex instead. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15950)
2021-06-30cmp_mock_srv.c: Add missing OldCertID check for 'kur' cert update requestsDr. David von Oheimb
Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15790)
2021-06-30CMP: Add missing getter functions to CRMF API and CMP APIDr. David von Oheimb
Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15790)
2021-06-30test: fix test ordering in threads testPauli
Fixes #15953 Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15954)
2021-06-30dh_test: fix coverity 1473239 Argument cannot be negative (NEGATIVE_RETURNS)Pauli
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15943)
2021-06-30test: fix coverity 1469427 Improper use of negative value (NEGATIVE_RETURNS)Pauli
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15943)
2021-06-29coverity #1486532: fix potential NULL dereference in test_mk_file_path()Tomas Mraz
Reviewed-by: Ben Kaduk <kaduk@mit.edu> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15942)
2021-06-27evp_test: use correct size in memory clearPauli
Fixes #15917 Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15920)
2021-06-26test/recipes/90-test_includes_data/vms-includes.cnf: correct the directoryRichard Levitte
... to mimic includes.cnf Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15823)
2021-06-26test/recipes/80-test_ca.t: Don't force quotes around the config file in $cnfRichard Levitte
However, when passing it through the OPENSSL_CONFIG environment variable, we still need the quotes, just to make sure. Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15823)
2021-06-26test/recipes/66-test_ossl_store.t: ensure native pathsRichard Levitte
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15823)
2021-06-26testutil: teach test_mk_file_path() how to merge VMS file specsRichard Levitte
This isn't a full solution, it only handles current use cases. Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15823)
2021-06-26test/ossl_store_test.c: Adapt the use of datadir for VMS pathsRichard Levitte
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15823)
2021-06-26UTF-8 not easily supported on VMS command line yetRichard Levitte
Some tests are designed to test UTF-8 on the command line. We simply disable those on VMS. Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15823)
2021-06-26Fix test_errstr for VMSRichard Levitte
Occasionally, we get an error code on VMS that doesn't translate into POSIX, and the error string reflects that Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15823)
2021-06-26test: check for NULL returns betterPauli
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/15910)
2021-06-26test: avoid memory leaks on errorsPauli
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/15910)
2021-06-26evp_test: address NULL pointer dereference and return failure betterPauli
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/15910)
2021-06-25CMP: Improve reporting of error codes and related strings via 'error' msgDr. David von Oheimb
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15879)
2021-06-25test: add EVP_Q_mac tests to evp_testPauli
Fixes #15837 Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com> (Merged from https://github.com/openssl/openssl/pull/15888)
2021-06-25test: add EVP_Q_digest tests to evp_testPauli
Fixes #15837 Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com> (Merged from https://github.com/openssl/openssl/pull/15888)
2021-06-25BIO_new_from_core_bio: Fix heap-use-after-free after attachPetr Gotthard
The providers have to call up_ref to keep the cbio pointer, just like the internal bio_prov.c does. OSSL_STORE_attach passes a cbio pointer to the provider and then calls ossl_core_bio_free(cbio). If up_ref is not called, the cbio gets freed way too early. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15163)
2021-06-24Add a test to check that RAND_bytes_ex() works with a child lib ctxMatt Caswell
Previously, when locks were held while calling a provider init function, then RAND_bytes_ex() would fail if called from the init function and used in conjunction with a child lib ctx. We add an explicit test of that. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15854)
2021-06-24Merge ossl_provider_activate() and ossl_provider_activate_child()Matt Caswell
These 2 functions have become so close to each other that they may as well be just one function. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15854)
2021-06-24Set use_fallbacks to zero when we add a provider to the storeMatt Caswell
Update use_fallbacks to zero when we add a provider to the store rather than when we activate it. Its only at the point that we add it to the store that it is actually usable and visible to other threads. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15854)
2021-06-24simpledynamic: Add missing include for AIX buildsTomas Mraz
Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15874)
2021-06-24TEST: Modify simpledynamic.[ch] to allow use on VMS as wellRichard Levitte
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15872)
2021-06-24test/recipes/90-test_shlibload.t: Modify to work with known file namesRichard Levitte
Using File::Temp::tempfile() is admirable, but isn't necessary for the sort of thing we use it for. Furthermore, since tempfile() returns an opened file handle for reading for the file in question, it may have effect that the file becomes unwritable. This is the default on VMS, and since tempfile() doesn't seem to have any option to affect this, it means that test/shlibloadtest.c can't write the magic line to that file. Also, if we consider forensics, to be able to see what a test produced to determine what went wrong, it's better to use specific and known file names. Therefore, this test is modified to use well known file names, and to open them for reading after the shlibloadtest program has been run instead of before. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15872)
2021-06-23TEST: check 'loadereng' to determine if loader_attic should be testedRichard Levitte
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15858)
2021-06-22test/recipes/81-test_cmp_cli.t: use app() rather than cmd()Richard Levitte
Fixes #15833 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15846)
2021-06-22test/recipes/80-test_cmp_http.t: use app() rather than cmd()Richard Levitte
OpenSSL::Test::cmd() should be used with caution, as it is for special cases only. It's preferable to use OpenSSL::Test::app() or OpenSSL::Test::test(). Fixes #15833 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15846)
2021-06-22APPS & TEST: Use ossl_[u]intmax_t rather than [u]intmax_tRichard Levitte
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15825)
2021-06-22testutil: preserve app_malloc()'s failure behaviourPauli
app_malloc() terminates execution if the allocation fails. The tests implement their own app_malloc() in an attempt to reduce the amount of code pulled in. This version also needs to terminate on failed allocation. The alternative would be adding failed allocation checks pervasively throughout the apps's commands. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15836)
2021-06-22Change self test for AES_CGM to perform both an encrypt and decrypt.Shane Lontis
This is a request from the lab that changes the AES_GCM test back to perform both a encrypt and decrypt. (This makes no logical sense since this is not an inverse cipher). I have left the AES_ECB decrypt test in (although it may not be needed) since it is actually testing the inverse cipher case. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15844)
2021-06-22test: put the new DHE auto test in the correct placePauli
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/15840)
2021-06-21Add a test for a custom rand providerMatt Caswell
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15810)
2021-06-21Add tests for KTLS with Chacha20-Poly1035.John Baldwin
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15814)
2021-06-21Refactor KTLS tests to better support TLS 1.3.John Baldwin
- Use SSL_set_ciphersuites for TLS 1.3 tests instead of using SSL_set_cipher_list. - Don't bother passing a sequence number size to KTLS test functions. These functions always test TLS (and not DTLS) for which the sequence size is always the same. In addition, even for DTLS the check in question (verifying that the sequence number fields in SSL do not change) should still pass when doing a before/after comparison of the field. - Define a helper structure to hold the TLS version and cipher name for a single KTLS test. - Define an array of such structures with valid KTLS ciphers and move #ifdef's for TLS versions and supported ciphers out of test functions and instead use them to define the valid members of this array. This also permits using TLS 1.3 cipher suite names for TLS 1.3 tests. - Use separate tests per cipher for test_ktls to give more fine-grained pass/fail results as is already done for test_ktls_sendfile. - While here, rename test_ktls_sendfile to execute_test_ktls_sendfile and test_ktls_sendfile_anytls to test_ktls_sendfile. This is more consistent with the naming used for test_ktls as well as other tests in this file. - Close the file descriptors used for temporary sockets in ktls tests. - Don't assume that KTLS is supported for all compile-time supported cipher suites at runtime. If the kernel fails to offload a given cipher suite, skip the test rather than failing it. FreeBSD kernels may not offload all of the cipher suites supported by its KTLS if a suitable driver or KTLS backend is not present. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15814)
2021-06-21sm3: fix function names after the big ossl_ prefix addition.Pauli
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/15843)
2021-06-21test: add sm3 low level test case to test suite.杨明君
Reviewed-by: Paul Yang <kaishen.yy@antfin.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14271)
2021-06-20TESTS: drop explicit quotes from empty command line argumentsRichard Levitte
Depending on circumstances, something like this: ok(run(app(['openssl', 'whatever', '-config', '""', ...]))) might end up with a command like this: ./util/wrap.pl apps/openssl whatever -config '""' Simply use an empty string (i.e. '' instead of '""') and let the command line fixup functions do their job. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15822)
2021-06-20evp_test: Support testing of stitched TLS ciphersTomas Mraz
Add a few testcases. Fixes #15749 Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15827)
2021-06-19test: fix indentationPauli
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15824)
2021-06-19test: replace tabs with spaces in test recipesPauli
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15824)
2021-06-19test: add test for auto DH security level meets the minimumPauli
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15818)