summaryrefslogtreecommitdiffstats
path: root/test
AgeCommit message (Collapse)Author
2022-04-12SSL_conf_cmd: Allow DH Parameters at any position.Daniel Fiala
Fixes openssl#17326. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18041) (cherry picked from commit b2b8d1883a3b7e64006b0b4ada0cbcf3eb6dba1a)
2022-04-11Fix -no-tls1_2 in testsTodd Short
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/18019) (cherry picked from commit 40fb5a4ce3e90c9e8702aad0fcf43eb9f6edf419)
2022-04-11Add test for openssl ecparam with fips and base providersTomas Mraz
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17981) (cherry picked from commit 269c349a7688daae48d95e582e62ff181888c854)
2022-04-11Add test for resetting SM2 dist IDTomas Mraz
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18052) (cherry picked from commit 707d4e06eba71fb8a8b2faa77a2072511189544d)
2022-04-07test_fipsinstall: Fallback to config(FIPSKEY) for the FIPSKEYTomas Mraz
Reviewed-by: Todd Short <todd.short@me.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18048) (cherry picked from commit ffc22e038e92d5dd956362fa48babd03cff202d1)
2022-03-30Test processing of a duplicated HRRTomas Mraz
Reviewed-by: Todd Short <todd.short@me.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17936) (cherry picked from commit db44b55aaa42141921217183667800425227b658)
2022-03-25ticket_lifetime_hint may exceed 1 week in TLSv1.3Todd Short
For TLSv1.3, limit ticket lifetime hint to 1 week per RFC8446 Fixes #17948 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17952) (cherry picked from commit 0089cc7f9d42f6e39872161199fb8b6a99da2492)
2022-03-23Fix Coverity 1498613: resource leakPauli
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17891) (cherry picked from commit 6889ebff01fa8cd7e5905f3f242edfed55fca443)
2022-03-22Make `openssl check -rsa ...` to work for both RSA and RSA-PSS.Daniel Fiala
Fixes openssl#17167 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17920)
2022-03-15Update copyright yearMatt Caswell
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2022-03-15Add a negative testcase for BN_mod_sqrtTomas Mraz
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 3469282ed2faee747868150089e07a187891b5ee)
2022-03-15Fix signed integer overflow in evp_encHugo Landau
Fixes #17869. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17870) (cherry picked from commit 1832bb0f02e519a48f06a10467c7ce5f7f3feeeb)
2022-03-14evp_test: Add testcases for DH KEX with X9.42 KDFTomas Mraz
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/17859) (cherry picked from commit 4413fe3520da3ad42c417828b1785eeedcde50d3)
2022-03-14Replace handling of negative verification result with SSL_set_retry_verify()Tomas Mraz
Provide a different mechanism to indicate that the application wants to retry the verification. The negative result of the callback function now indicates an error again. Instead the SSL_set_retry_verify() can be called from the callback to indicate that the handshake should be suspended. Fixes #17568 Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> Reviewed-by: Viktor Dukhovni <viktor@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17825) (cherry picked from commit dfb39f73132edf56daaad189e6791d1bdb57c4db)
2022-03-12Make ossltest engine use in test/recipes/20-test_dgst.t platform agnosticRichard Levitte
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17861) (cherry picked from commit abdb2278d2b65ae87bee3121be83322e4219b396)
2022-03-09Fix test failure when testing with Test::HarnessHugo Landau
Fixes an issue where, when the test suite was being run with the older Test::Harness package, the test suite would not complete correctly due to evaluation of $harness->runtests()->has_errors, which is only available for the newer TAP::Parser::Aggregator code path. Fixes #17818. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17823) (cherry picked from commit fe537f89cd6b75c10e717a0eb159f33710729b67)
2022-03-04Enable openssl req -x509 to create certificates from CSRsHugo Landau
`openssl req -x509` has code allowing it to generate certificates from CSRs as a replacement for `openssl x509`, but a bug prevents it from working properly. -CA and -CAkey can now be passed to generate a CA-signed certificate as documented in openssl-req(1). Regression testing has been added to `openssl req`. Backport of #17782 to 3.0. Fixes #17736. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17805)
2022-03-03Fix NULL pointer dereference for BN_mod_exp2_montHugo Landau
This fixes a bug whereby BN_mod_exp2_mont can dereference a NULL pointer if BIGNUM argument m represents zero. Regression test added. Fixes #17648. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17783) (cherry picked from commit 43135a5d2274c24e97f50e16ce492c22eb717ab2)
2022-03-02[ssl] Add tests for Perfect Forward Secrecy criteria on SECLEVEL >= 3Nicola Tuveri
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17763) (cherry picked from commit d71151ae704847f4ac3f4a5f394ea64f1d229815)
2022-02-24test/crltest.c: Add check for glue2bioJiasheng Jiang
As the glue2bio() could return NULL pointer if fails, it should be better to check the return value in order to avoid the use of NULL pointer. Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17718) (cherry picked from commit 18cb1740cc0fd11940836fa2fcaf6d3634c00e90)
2022-02-24bio_enc.c: add check for BIO_new_mem_bufJiasheng Jiang
Since the memory allocation may fail, the BIO_new_mem_buf() may return NULL pointer. Therefore, it should be better to check it and return error if fails. Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17730) (cherry picked from commit cf21d1c62dcd92be624ea0fb8a86d91e4fbeed93)
2022-02-23Fix a failure in sslapitestMatt Caswell
The SNI test in test_cert_cb_int() was always failing because it used SSL_CTX_new() instead of SSL_CTX_new_ex() and was therefore not using the correct libctx. PR #17739 amended the test to check the return value from SSL_CTX_new() which made the failure obvious. Fixes #17757 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/17758) (cherry picked from commit 7e1eda483ec9ead36c05066b45ecad618475544c)
2022-02-23check *libctx which is allocated by OSSL_LIB_CTX_new()xkernel
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17740) (cherry picked from commit 8d215738a05350baa583c47a2c52371d9cff3197)
2022-02-23test/sslapitest.c: Add check for SSL_CTX_newJiasheng Jiang
As the potential failure of the memory allocation, it should be better to check the return value of SSL_CTX_new() and return error if fails, like SSL_CTX_new_ex(). Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17739) (cherry picked from commit b0317df2311769e02d9ceb4e7afe19521f8ffbf1)
2022-02-17Prefix output to avoid random ok to confuse test parserArmin Fuerst
Prefix output of generated dh parameters to avoid misinterpretation of lines beginning with ok[^a-zA-Z0-9] as a testresult. Also corrected indent and removed useless comma after last item. Fixes #17480 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17689) (cherry picked from commit b089d546242bbc073aefb6f6471586e484118863)
2022-02-14Apply the correct Apache v2 licenseTomas Mraz
There were still a few files mentioning the old OpenSSL license. Fixes #17684 Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17686) (cherry picked from commit 7585073892af9cffd28b7b5872c2b102b99af807)
2022-02-12Cleanup record length checks for KTLSBernd Edlinger
In some corner cases the check for packets which exceed the allowed record length was missing when KTLS is initially enabled, when some unprocessed packets are still pending. Add at least some tests for KTLS, since we have currently not very much test coverage for KTLS. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17504) (cherry picked from commit 8fff986d52606e1a33f9404504535e2e2aee3e8b)
2022-02-09Add the check after calling OPENSSL_strdupJiasheng Jiang
Since the potential failure of the memory allocation, the OPENSSL_strdup() could return NULL pointer. Therefore, it should be better to check it in order to guarantee the success of the configuration, same as the check for SSL_CTX_set_srp_username(). Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17643) (cherry picked from commit 09030ee73693411c19b596cb0e0f43eb512ac0e6)
2022-02-09Fix an enginetest failure when compiled with no-deprecated --api=1.1.1Matt Caswell
Fixes #17649 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17652) (cherry picked from commit 29af9fba64fd3e4e086808f2360501b463627ea2)
2022-02-07Add testcases for EVP_PKEY_set1_encoded_public_key()Tomas Mraz
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17630) (cherry picked from commit eafd3e9d07e99583a1439bb027e4d6af43e2df27)
2022-02-07evp_test: Add the missing check after calling OPENSSL_strdup and ↵Jiasheng Jiang
sk_OPENSSL_STRING_new_null Since the memory allocation may fail, the 'mac_name' and 'controls' could be NULL. And the 'mac_name' will be printed in mac_test_run_mac() without check. Also the result of 'params_n + sk_OPENSSL_STRING_num(expected->controls)' in mac_test_run_mac() will be 'params_n - 1' if allocation fails , which does not make sense. Therefore, it should be better to check them in order to guarantee the complete success of initiation. If fails, we also need to free the 'mdat' to avoid the memory leak. Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17628) (cherry picked from commit b2f90e93a07d992515782511a5770aa7cf7dc28f)
2022-02-03Fix copyrightsTodd Short
Add copyright to files that were missing it. Update license from OpenSSL to Apache as needed. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17606) (cherry picked from commit 9d987de3aabe54e65a55649a61953966f33b070b)
2022-02-03Fix EVP todata and fromdata when used with selection of EVP_PKEY_PUBLIC_KEY.slontis
The private key for rsa, dsa, dh and ecx was being included when the selector was just the public key. (ec was working correctly). This matches the documented behaviour. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17200) (cherry picked from commit 944f822aadc88b2e25f7695366810c73a53a00c8)
2022-02-02Add a test for X509_STORE_CTX_set_purpose()Matt Caswell
This function was previously incorrectly failing if it is called with X509_PURPOSE_ANY. Add a test to catch this. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Ben Kaduk <kaduk@mit.edu> (Merged from https://github.com/openssl/openssl/pull/17603)
2022-01-27Fix IV length of DES EDE ECB implementationsTomas Mraz
Fixes #17587 Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17591) (cherry picked from commit d450eb84c802b2f78971f905b251a0fb89ebb7d1)
2022-01-26Allow empty passphrase in PEM_write_bio_PKCS8PrivateKey_nid()Darshan Sen
Signed-off-by: Darshan Sen <raisinten@gmail.com> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17507) (cherry picked from commit 1d28ada1c39997c10fe5392f4235bbd2bc44b40f)
2022-01-26Fix invalid malloc failures in PEM_write_bio_PKCS8PrivateKey()Darshan Sen
When `PEM_write_bio_PKCS8PrivateKey()` was passed an empty passphrase string, `OPENSSL_memdup()` was incorrectly getting used for 0 bytes size allocation, which resulted in malloc failures. Fixes: https://github.com/openssl/openssl/issues/17506 Signed-off-by: Darshan Sen <raisinten@gmail.com> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17507) (cherry picked from commit 59ccb72cd5cec3b4e312853621e12a68dacdbc7e)
2022-01-25test/ct_test.c: Add the missing check after calling sk_SCT_new_nullJiasheng Jiang
As the potential failure of the allocation, the sk_SCT_new_null() could return NULL pointer if fails. And then sk_SCT_push() uses the 'fixture->sct_list' and returns -1 if fails. But the return value of the sk_SCT_push() is not checked. I think it is better to check it just after the allocation. CLA: trivial Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17571) (cherry picked from commit 7625d70ad9e7be0588dd9453e89892c2b24b8175)
2022-01-25evp_test: Add the missing check after calling OPENSSL_mallocJiasheng Jiang
The OPENSSL_zalloc() could return NULL pointer if fails. Add the check for it does make sense, like how digest_test_init() deals with. CLA: trivial Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17571) (cherry picked from commit 2208ba56ebefe4cf7d924e2ac7044ccd3307250b)
2022-01-17dhtest: Add testcase for EVP_PKEY_CTX_set_dh_nidTomas Mraz
And a negative testcase for EVP_PKEY_CTX_set_dhx_rfc5114 Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17498) (cherry picked from commit 59d3fd1cc8c938daa6384783a7e5847d6f5201f7)
2022-01-13test_gendhparam: Drop expected error outputTomas Mraz
Otherwise it sometimes confuses the TAP parser. Fixes #17480 Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/17481) (cherry picked from commit 3bfb7239daf3d6a89476e163dc925c641d356729)
2022-01-13threadstest: add write check to lock checkingPauli
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/17479)
2022-01-12Ensure we test fetching encoder/decoder/store loader with a query stringMatt Caswell
Although we had a test for fetching an encoder/decoder/store loader it did not use a query string. The issue highlighted by #17456 only occurs if a query string is used. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17459)
2022-01-11Fix: some patches related to error exitingPeiwei Hu
Signed-off-by: Peiwei Hu <jlu.hpw@foxmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17443)
2022-01-10Add a test for a custom digest created via EVP_MD_meth_new()Matt Caswell
We check that the init and cleanup functions for the custom method are called as expected. Based on an original reproducer by Dmitry Belyavsky from issue #17149. Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/17255) (cherry picked from commit fbbe7202eba9fba243c18513f4f0316dafb3496d)
2022-01-08Add a test case for the short passwordBernd Edlinger
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17441) (cherry picked from commit 21095479c016f2ceaca0f71078fd27f0e9ba9375)
2022-01-07Test importing EC key parameters with a bad curveTomas Mraz
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17411) (cherry picked from commit d4d8f163db1d32c98d8f956e6966263a7a22fac1)
2022-01-04Revert "test: add some unit tests for the property to string functions"Pauli
This reverts commit e1436d54b9de5012d1716212c7329e46cf21a24a. Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17403)
2022-01-03Test that PEM_BUFSIZE is passed into pem_password_cbTomas Mraz
When pem_password_cb is used from SSL_CTX, its size parameter should be equal to PEM_BUFSIZE. Reviewed-by: Ben Kaduk <kaduk@mit.edu> (Merged from https://github.com/openssl/openssl/pull/17320) (cherry picked from commit c7debe811123951a60cdfe73716184ca8fdd79d2)
2022-01-01test: add some unit tests for the property to string functionsPauli
That is: ossl_property_name_str and ossl_property_value_str. These only have high level tests during the creation of child library contexts. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17325) (cherry picked from commit 9f6841e9d8964943cf5f616543750cee85c4911c)