summaryrefslogtreecommitdiffstats
path: root/test
AgeCommit message (Collapse)Author
2022-12-22Fix SMIME_crlf_copy() to properly report an errorMatt Caswell
If the BIO unexpectedly fails to flush then SMIME_crlf_copy() was not correctly reporting the error. We modify it to properly propagate the error condition. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19919) (cherry picked from commit 6259cf34eab1abdcfde12b7b3892b4780844091b)
2022-12-22Honor OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT as set and default to ↵Nicola Tuveri
UNCOMPRESSED Originally the code to im/export the EC pubkey was meant to be consumed only by the im/export functions when crossing the provider boundary. Having our providers exporting to a COMPRESSED format octet string made sense to avoid memory waste, as it wasn't exposed outside the provider API, and providers had all tools available to convert across the three formats. Later on, with #13139 deprecating the `EC_KEY_*` functions, more state was added among the params imported/exported on an EC provider-native key (including `OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT`, although it did not affect the format used to export `OSSL_PKEY_PARAM_PUB_KEY`). Finally, in #14800, `EVP_PKEY_todata()` was introduced and prominently exposed directly to users outside the provider API, and the choice of COMPRESSED over UNCOMPRESSED as the default became less sensible in light of usability, given the latter is more often needed by applications and protocols. This commit fixes it, by using `EC_KEY_get_conv_form()` to get the point format from the internal state (an `EC_KEY` under the hood) of the provider-side object, and using it on `EVP_PKEY_export()`/`EVP_PKEY_todata()` to format `OSSL_PKEY_PARAM_PUB_KEY`. The default for an `EC_KEY` was already UNCOMPRESSED, and it is altered if the user sets `OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT` via `EVP_PKEY_fromdata()`, `EVP_PKEY_set_params()`, or one of the more specialized methods. For symmetry, this commit also alters `ec_pkey_export_to()` in `crypto/ec/ec_ameth.c`, part of the `EVP_PKEY_ASN1_METHOD` for legacy EC keys: it exclusively used COMPRESSED format, and now it honors the conversion format specified in the EC_KEY object being exported to a provider when this function is called. Expand documentation about `OSSL_PKEY_PARAM_PUB_KEY` and mention the change in behavior for our providers. Fixes #16595 (cherry picked from commit 926db476bc669fdcc4c4d2f1cb547060bdbfa153) Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19901)
2022-12-21Fix a logic flaw in test_mod_exp_zeroBernd Edlinger
Due to the logic flaw, possible test failures in this test case might be ignored. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19929) (cherry picked from commit 42061268ee8f9ae0555d522870740fc91b744f4f)
2022-12-20Raise the KMAC limits for key and custom size to 512 bytesTomas Mraz
This is necessary to pass new ACVP tests and to fix the CI failure in FIPS provider compat CI Partial cherry pick of 211c47ca1b1ac129dcee59d383cae44e36532bb9 Original-author: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/19937)
2022-12-16Fix FIPS Provider compat CI of 3.0 libcrypto with 3.2 FIPS providerTomas Mraz
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19904)
2022-12-09Obtain PSS salt length from providerClemens Lang
Rather than computing the PSS salt length again in core using ossl_rsa_ctx_to_pss_string, which calls rsa_ctx_to_pss and computes the salt length, obtain it from the provider using the OSSL_SIGNATURE_PARAM_ALGORITHM_ID param to handle the case where the interpretation of the magic constants in the provider differs from that of OpenSSL core. Add tests that verify that the rsa_pss_saltlen:max, rsa_pss_saltlen:<integer> and rsa_pss_saltlen:digest options work and put the computed digest length into the CMS_ContentInfo struct when using CMS. Do not add a test for the salt length generated by a provider when no specific rsa_pss_saltlen option is defined, since that number could change between providers and provider versions, and we want to preserve compatibility with older providers. Signed-off-by: Clemens Lang <cllang@redhat.com> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (cherry picked from commit 5a3bbe1712435d577bbc5ec046906979e8471d8b) (Merged from https://github.com/openssl/openssl/pull/19863)
2022-12-08Fix `no-ec enable-ktls` buildTodd Short
The KTLS test uses a TLSv1.2 cipher that uses ECDHE Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19841) (cherry picked from commit 2dded44a4911250acb989a535d2bad0bcf0ccc78)
2022-12-08test: add test case for deadlock reported in #19643Pauli
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19652) (cherry picked from commit 61203c2c59df5d0022e316a4fe614e5d18907715)
2022-12-08cmp_vfy_test.c: fix name OSSL_CMP_CTX_set0_trusted{,Store}Dr. David von Oheimb
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19859)
2022-12-08OSSL_CMP_validate_msg(): make sure to reject protection type mismatchDr. David von Oheimb
Do not accept password-based if expected signature-based and no secret is available and do not accept signature-based if expected password-based and no trust anchors available. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/19729) (cherry picked from commit fc93335760686ad7cf3633d457caf18b0ac83ea2)
2022-12-07Replace "a RSA" with "an RSA"Daniel Fiala
Fixes openssl#19771 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19787) (cherry picked from commit a63fa5f711f1f97e623348656b42717d6904ee3e) (cherry picked from commit f3e9308fe1b692c424feaa256fbecce958cef1f4)
2022-12-05Fix the check of EVP_PKEY_decrypt_initPeiwei Hu
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19819) (cherry picked from commit b794476df71441a6d30740ab9fadcc0f6d18d3d6)
2022-11-30cmp_client_test.c: add tests for OSSL_CMP_CTX_get_statusDr. David von Oheimb
This is a follow-up of #19205, adding test cases as requested. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/19760) (cherry picked from commit 6ea44d07a7d0acb4af9eab15d9b4a76227f55f4e)
2022-11-29Fix occasional assertion failure when storing propertiesTomas Mraz
Fixes #18631 The store lock does not prevent concurrent access to the property cache, because there are multiple stores. We drop the newly created entry and use the exisiting one if there is one already. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19762) (cherry picked from commit 92a25e24e6ec9735dea9ec645502cb075a5f8d24)
2022-11-28Drop incorrect skipping of some evp_test testcases with no-gostTomas Mraz
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19739) (cherry picked from commit d5e1fe9c04c7eb28e21070e3dfe0d2242504a9bc)
2022-11-25Add test for EVP_PKEY_Q_keygenTomas Mraz
Test for #19736 Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19761) (cherry picked from commit 667a8501f0b6e5705fd611d5bb3ca24848b07154)
2022-11-25OSSL_CMP_CTX_reinit(): fix missing reset of ctx->genm_ITAVsDr. David von Oheimb
Otherwise, further OSSL_CMP_exec_GENM_ses() calls will go wrong. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/19216) (cherry picked from commit 1c04866c671db4a6db0a1784399b351ea061bc16)
2022-11-21Fix coverity issues in X509v3_addrslontis
CID 1516955 : Null pointer deref (REVERSE_INULL) CID 1516954 : Null pointer deref (REVERSE_INULL) CID 1516953 : RESOURCE_LEAK of child Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19700) (cherry picked from commit 26cfa4cd85f6b26dd7a48c2ff06bfa4a2cea4764)
2022-11-18evp_extra_test2: Test DH param checks with non-NULL libctxTomas Mraz
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19656) (cherry picked from commit 5e38e0acf4e1681ae32fa1b164adbc08719bd613)
2022-11-16Add test to confirm IPAddressFamily_check_len catches invalid lenGraham Woodward
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19273) (cherry picked from commit 7489ada9f3fd902c5bc3c58cc03a90de2800d0ab)
2022-11-16Drop explicit check for engines in opt_legacy_okaySimo Sorce
The providers indication should always indicate that this is not a legacy request. This makes a check for engines redundant as the default return is that legacy is ok if there are no explicit providers. Fixes #19662 Signed-off-by: Simo Sorce <simo@redhat.com> 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/19671) (cherry picked from commit 2fea56832780248af2aba2e4433ece2d18428515)
2022-11-15Add test for EVP_PKEY_eqSimo Sorce
This tests that the comparison work even if a provider can only return a public key. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19648) (cherry picked from commit e5202fbd461cb6c067874987998e91c6093e5267)
2022-11-15fipsinstall test: skip PCT DSA signature test for new providersPauli
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19665)
2022-11-15test: add two comparision options to fips version test utility codePauli
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19665)
2022-11-12Resign test/certs/rootCA.pem to expire in 100 yearsBernd Edlinger
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19654) (cherry picked from commit 43086b1bd48958ce95fadba8459ad88675da4fdf)
2022-11-12Update the validity period of ed25519 cerificatesBernd Edlinger
Note: The private key is test/certs/root-ed25519.privkey.pem Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19654) (cherry picked from commit 42f917432999b34ad8618ae03a5f199738a2b5ba)
2022-11-11Add test for generating safeprime DH parametersTomas Mraz
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19635) (cherry picked from commit 10119e7475bb198e13b1722b186303b8a7528dfe)
2022-11-10pem: avoid segfault if PKEY is NULL in PEM_write_bio_PrivateKeyMilan Broz
Make the code more robust and correctly handle EVP_PKEY set to NULL instead of dereferencing null pointer. Signed-off-by: Milan Broz <gmazyland@gmail.com> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19536) (cherry picked from commit 373d90128042cb0409e347827d80b50a99d3965a)
2022-11-10Limit size of modulus for BN_mod_exp_mont_consttime()Tomas Mraz
Otherwise the powerbufLen can overflow. Issue reported by Jiayi Lin. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/19632) (cherry picked from commit 4378e3cd2a4d73a97a2349efaa143059d8ed05e8)
2022-11-10Add a test case for the engine crash with AES-256-CTRBernd Edlinger
Implement the AES-256-CTR cipher in the dasync engine. Use that to reproduce the reported problems with the devcrypto engine in our normal test environment. See #17995 and #17532 for details. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19390)
2022-11-07Fix PACKET_equal test with BUF_LEN+1 on -Wstringop-overreadReinhard Urban
Either suppress the error, or better make smbuf longer. Detected with -Werror. CLA: trivial Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19528) (cherry picked from commit 91b7520e2385a513ad879dfa8fe8e45466315a27)
2022-11-07Test that signatures using hash name commands work properlyTomas Mraz
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Todd Short <todd.short@me.com> (Merged from https://github.com/openssl/openssl/pull/19606) (cherry picked from commit e9e6827445528caf1d9d6647953fbe67a0c78716)
2022-11-04Check for private key existence before calling eddsa sign functionsWangchong Zhou
Fixes #19524 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19525) (cherry picked from commit f5a10d5cc19215ab22be55b4a2ee1e41bd38fb14)
2022-11-03Coverity 1516624: Fix overrun memory access.Pauli
Not possible to hit but good to address. Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19576) (cherry picked from commit ce0a7cadadb973216399e70d3a69f352b0843deb)
2022-11-02Potential null pointer referenceyangyangtiantianlonglong
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19429) (cherry picked from commit 15c8df81083f31dd35aedbe2d58ec702d0c0dc65)
2022-11-01Update copyright yearTomas Mraz
Reviewed-by: Richard Levitte <levitte@openssl.org> Release: yes
2022-11-01punycode: add unit testsPauli
These tests verify basic functionality and specifically test for CVE-2022-3602. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org>
2022-10-27tests: clear error queue before executing a testcaseTomas Mraz
There can be errors in the queue from previous tests and we look at it to verify we do not add spurious errors in some testcases. Fixes #19477 Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19483)
2022-10-27test: driver: fix -Wunused-but-set-variableSam James
The value of 'num_failed_inner' isn't ever used. Fixes this error with Clang 15: ``` test/testutil/driver.c:341:17: error: variable 'num_failed_inner' set but not used [-Werror,-Wunused-but-set-variable] int num_failed_inner = 0; ^ 1 error generated. ``` Signed-off-by: Sam James <sam@gentoo.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (cherry picked from commit 6a94c5849ea7d1f08d4fcaa9a6fc0a947e19da66) Signed-off-by: Sam James <sam@gentoo.org> (Merged from https://github.com/openssl/openssl/pull/19500)
2022-10-24Workaround egd rand source deficienciesTomas Mraz
With egd as the rand source the reseed after fork confuses the egd. Fixes #19396 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19454)
2022-10-21stack: Do not add error if pop/shift/value accesses outside of the stackTomas Mraz
This partially reverts commit 30eba7f35983a917f1007bce45040c0af3442e42. This is legitimate use of the stack functions and no error should be reported apart from the NULL return value. Fixes #19389 Reviewed-by: Todd Short <todd.short@me.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19400) (cherry picked from commit a8086e6bfc37355626393751a94bc5c92df7e9d3)
2022-10-21link the pyca tests against the correct opensslPaul Kehrer
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19439) (cherry picked from commit 097752da99d9c27702e9e9d51609efedd3a4d0cf)
2022-10-19default provider: include RIPEMD160Pauli
Including RIPEMD160 in both the default and legacy providers shouldn't break anyone and makes the algorithm available more readily. Fixes #17722 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19375) (cherry picked from commit ecd831469919215b0a45693b00ec0fd7d42d5d61)
2022-10-19Add a test for TLSv1.3 only client sending a correct key_shareMatt Caswell
Make sure that a TLSv1.3 only client does not send a TLSv1.3 key_share. 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/19404)
2022-10-19Add a test for where a client sends a non-TLSv1.3 key shareMatt Caswell
This should not happen but we should tolerate and send an HRR 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/19404)
2022-10-17Add missing include for DH_get0_priv_key()Tomas Mraz
Fixes #19410 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Kurt Roeckx <kurt@roeckx.be> (Merged from https://github.com/openssl/openssl/pull/19411) (cherry picked from commit bbaa24b7c5ca4d712ad539d4c5ed16af0dd908f4)
2022-10-11Update copyright yearMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org> Release: yes (Merged from https://github.com/openssl/openssl/pull/19382)
2022-10-07set MGF1 digest correctlyJames Muir
Fixes #19290 update rsa_set_ctx_params() so that the digest function used in the MGF1 construction is set correctly. Add a test for this to evp_extra_test.c based on the code scaro-axway provided in #19290. Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19342) (cherry picked from commit e5a7536eaeaacd18d1aea59edeb295fb4eb2dfca)
2022-10-04Disable printf format checking on MinGWDaniel Fiala
Fixes openssl#19185 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19292) (cherry picked from commit a1de5eb88479515535e5de090ded800455c3d4a7)
2022-10-03Test usage of a custom EVP_CIPHERMatt Caswell
Test that a custom EVP_CIPHER gets used in EVP_CipherInit_ex() calls. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19300) (cherry picked from commit 8c7d847e2e6ac6bfded210c19fd8461254bb2be3)