summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2021-02-18Update copyright yearMatt Caswell
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14235)
2021-02-18Fix external symbols related to provider related security checks forShane Lontis
keys and digests. Partial fix for #12964 This adds ossl_ names for the following symbols: digest_get_approved_nid, digest_get_approved_nid_with_sha1 digest_is_allowed, digest_md_to_nid, digest_rsa_sign_get_md_nid, securitycheck_enabled, dh_check_key, dsa_check_key, ec_check_key, Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14211)
2021-02-18Fix external symbols in the provider digest implementations.Shane Lontis
Partial fix for #12964 This adds ossl_ names for the following symbols: blake2b512_init,blake2b_final,blake2b_init,blake2b_init_key, blake2b_param_init,blake2b_param_set_digest_length,blake2b_param_set_key_length, blake2b_param_set_personal,blake2b_param_set_salt,blake2b_update, blake2s256_init,blake2s_final,blake2s_init,blake2s_init_key, blake2s_param_init,blake2s_param_set_digest_length,blake2s_param_set_key_length, blake2s_param_set_personal,blake2s_param_set_salt,blake2s_update, digest_default_get_params,digest_default_gettable_params Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14211)
2021-02-18Add deep copy of propq field in mac_dupctx to avoid double freezekeevans-mf
mac_dupctx() should make a copy of the propq field. Currently it does a shallow copy which can result in a double free and crash. The double free occurs when using a provider property string. For example, passing in "fips=no" to SSL_CTX_new_ex() causes the propq field to get set to that value. When mac_dupctx() and mac_freectx() is called (ie: in SSL_write()) it ends up freeing the reference of the original object instead of a copy. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13926)
2021-02-18DH: Make DH_bits(), DH_size(), and DH_security_bits() check that there are ↵Sahana Prasad
key parameters Fixes #13569 Signed-off-by: Sahana Prasad <sahana@redhat.com> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/13955)
2021-02-18chain_build(): Call verify_cb_cert() if a preliminary error has become finalDr. David von Oheimb
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14157)
2021-02-18dsa_check: Perform simple parameter check if seed is not availableTomas Mraz
Added primality check on p and q in the ossl_ffc_params_simple_validate(). Checking for p and q sizes in the default provider is made more lenient. Added two testcases for invalid parameters. Fixes #13950 Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14148)
2021-02-18DSA parameter check using pkeyparamDmitry Belyavskiy
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14148)
2021-02-18Fix external symbols in the provider cipher implementations.Shane Lontis
Partial fix for #12964 This add ossl_ names for the following symbols. chacha20_dinit, chacha20_einit, chacha20_initctx, ccm_cipher, ccm_dinit, ccm_einit, ccm_generic_auth_decrypt, ccm_generic_auth_encrypt, ccm_generic_gettag, ccm_generic_setaad, ccm_generic_setiv, ccm_get_ctx_params, ccm_initctx, ccm_set_ctx_params, ccm_stream_final, ccm_stream_update gcm_aad_update, gcm_cipher, gcm_cipher_final, gcm_cipher_update gcm_dinit, gcm_einit, gcm_get_ctx_params, gcm_initctx, gcm_one_shot gcm_set_ctx_params, gcm_setiv, gcm_stream_final, gcm_stream_update tdes_dinit, tdes_dupctx, tdes_einit, tdes_freectx tdes_get_ctx_params, tdes_gettable_ctx_params, tdes_newctx PROV_CIPHER_HW_des_*, padblock, unpadblock, tlsunpadblock, fillblock, trailingdata Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14209)
2021-02-17x509_vfy: fix mem leaks in chain_build() on malloc error Coverify CID 1473068Dr. David von Oheimb
Fixes: Variable "sk_untrusted" going out of scope leaks the storage it points to. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14187)
2021-02-17apps/cmp.c: Improve initialization of ext_ctx structure w.r.t. CSRDr. David von Oheimb
Also improve doc how the -reqexts option affects the CSR given with the -csr option. Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/14181)
2021-02-17apps/ca.c: Make sure ext_ctx structure gets initializedDr. David von Oheimb
Fixes #14175 Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/14181)
2021-02-17Rename OSSL_ENCODER_CTX_new_by_EVP_PKEY and OSSL_DECODER_CTX_new_by_EVP_PKEYTomas Mraz
Additional renames done in encoder and decoder implementation to follow the style. Fixes #13622 Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14155)
2021-02-17Fix backward incompatibility revolving around OSSL_HTTP_REQ_CTX_sendreq_d2i()Richard Levitte
The OSSL_HTTP_REQ_CTX API has a few changes compared to the older OCSP_REQ_CTX API which are not quite obvious at first sight. The old OCSP_REQ_CTX_nbio_d2i() took three arguments, of which one is an output argument, and return an int, while the newer OSSL_HTTP_REQ_CTX_sendreq_d2i() returns the value directly and thereby takes one less argument. The mapping from the old to the new wasn't quite right, this corrects it, along with a couple of X509 macros that needed the same kind of fix. 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/14196)
2021-02-17[doc/man3][OSSL_ENCODER] Move NOTES to the bottomNicola Tuveri
For consistency with `OSSL_DECODER.pod`, and `man-pages(7)`, the `NOTES` section is moved at the end of the file. According to `man-pages(7)` the recommended section order is: > NAME > SYNOPSIS > CONFIGURATION [Normally only in Section 4] > DESCRIPTION > OPTIONS [Normally only in Sections 1, 8] > EXIT STATUS [Normally only in Sections 1, 8] > RETURN VALUE [Normally only in Sections 2, 3] > ERRORS [Typically only in Sections 2, 3] > ENVIRONMENT > FILES > VERSIONS [Normally only in Sections 2, 3] > CONFORMING TO > NOTES > BUGS > EXAMPLE > SEE ALSO This commit does not attempt to fix the order in all pages but focuses only on `OSSL_ENCODER` which has a "twin" man page in `OSSL_DECODER`, making the inconsistent section order quite jarring. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13932)
2021-02-17[doc/man3] Fix typo in DESCRIPTION of OSSL_ENCODER_propertiesNicola Tuveri
This commit fixes the DECSCRIPTION section of doc/man3/OSSL_ENCODER.pod, where `OSSL_ENCODER_properties` was incorrectly referred to as `OSSL_ENCODER_provider`. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13932)
2021-02-17doc: document the two new RAND functionsPauli
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14162)
2021-02-17rand: update DRBGs to use the get_entropy call for seedingPauli
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14162)
2021-02-17core: add get_entropy and clear_entropy calls to RANDPauli
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14162)
2021-02-17RNG test: add get_entropy hook for testing.Pauli
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14162)
2021-02-17RNG seed: add get_entropy hook for seeding.Pauli
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14162)
2021-02-17err: generated error filesPauli
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14162)
2021-02-17test: DRBG test with long seed.Pauli
Fixes: #14101 Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14162)
2021-02-17Replace SSL_CTX_new by SSL_CTX_new_ex in apps/s_server + s_clientPetr Gotthard
The `openssl s_server` and `openssl s_client` currently ignore the `-propquery` parameter. Fix patch fixes this. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14195)
2021-02-17Fix propquery handling in EVP_DigestSignInit_exPetr Gotthard
Fixes #14183. Fix the condition to detect legacy engines, so the `props` are considered even when libctx == NULL. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14188)
2021-02-16TEST: Add missing initializationRichard Levitte
Compiler complained. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14204)
2021-02-16Update CHANGES and NEWS for new releaseMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2021-02-16Don't overflow the output length in EVP_CipherUpdate callsMatt Caswell
CVE-2021-23840 Reviewed-by: Paul Dale <pauli@openssl.org>
2021-02-16Fix rsa_test to properly test RSA_SSLV23_PADDINGMatt Caswell
We test all three cases: - An SSLv2 only client talking to a TLS capable server - A TLS capable client talking to an SSLv2 only server - A TLS capable client talking to a TLS capable server (should fail due to detecting a rollback attack) Reviewed-by: Paul Dale <pauli@openssl.org>
2021-02-16Fix the RSA_SSLV23_PADDING padding typeMatt Caswell
This also fixes the public function RSA_padding_check_SSLv23. Commit 6555a89 changed the padding check logic in RSA_padding_check_SSLv23 so that padding is rejected if the nul delimiter byte is not immediately preceded by at least 8 bytes containing 0x03. Prior to that commit the padding is rejected if it *is* preceded by at least 8 bytes containing 0x03. Presumably this change was made to be consistent with what it says in appendix E.3 of RFC 5246. Unfortunately that RFC is in error, and the original behaviour was correct. This is fixed in later errata issued for that RFC. This has no impact on libssl for modern versions of OpenSSL because there is no protocol support for SSLv2 in these versions. However applications that call RSA_paddin_check_SSLv23 directly, or use the RSA_SSLV23_PADDING mode may still be impacted. The effect of the original error is that an RSA message encrypted by an SSLv2 only client will fail to be decrypted properly by a TLS capable server, or a message encrypted by a TLS capable client will fail to decrypt on an SSLv2 only server. Most significantly an RSA message encrypted by a TLS capable client will be successfully decrypted by a TLS capable server. This last case should fail due to a rollback being detected. Thanks to D. Katz and Joel Luellwitz (both from Trustwave) for reporting this issue. CVE-2021-23839 Reviewed-by: Paul Dale <pauli@openssl.org>
2021-02-16Refactor rsa_testMatt Caswell
Reduce code copying by factoring out common code into a separate function. Reviewed-by: Paul Dale <pauli@openssl.org>
2021-02-16Test that X509_issuer_and_serial_hash doesn't crashMatt Caswell
Provide a certificate with a bad issuer and check that X509_issuer_and_serial_hash doesn't crash. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org>
2021-02-16Fix Null pointer deref in X509_issuer_and_serial_hash()Matt Caswell
The OpenSSL public API function X509_issuer_and_serial_hash() attempts to create a unique hash value based on the issuer and serial number data contained within an X509 certificate. However it fails to correctly handle any errors that may occur while parsing the issuer field (which might occur if the issuer field is maliciously constructed). This may subsequently result in a NULL pointer deref and a crash leading to a potential denial of service attack. The function X509_issuer_and_serial_hash() is never directly called by OpenSSL itself so applications are only vulnerable if they use this function directly and they use it on certificates that may have been obtained from untrusted sources. CVE-2021-23841 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org>
2021-02-16Do not match RFC 5114 groups without q as it is significantTomas Mraz
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14189)
2021-02-15README-ENGINES: fix the link to the provider API READMEBeat Bolli
Signed-off-by: Beat Bolli <dev@drbeat.li> Reviewed-by: Paul Yang <kaishen.yy@antfin.com> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/14173)
2021-02-15Document the newly added function EVP_PKEY_param_check_quick()Matt Caswell
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14146)
2021-02-15Fix the dhparam_check testMatt Caswell
genpkey can sometimes create files that fail "openssl dhparam -check". See issue #14145. We had some instances of such invalid files in the dhparam_check test. Now that "openssl dhparam -check" has been fixed to work the same way as it did in 1.1.1 these tests were failing. We move the invalid files inot the "invalid" directory. A future PR will have to fix genpkey to not generate invalid files. We also remove a "SKIP" block that was skipping tests in a no deprecated build unnecessarily. Nothing being tested is deprecated. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14146)
2021-02-15Implement EVP_PKEY_param_check_quick() and use it in libsslMatt Caswell
The low level DH API has two functions for checking parameters: DH_check_ex() and DH_check_params_ex(). The former does a "full" check, while the latter does a "quick" check. Most importantly it skips the check for a safe prime. We're ok without using safe primes here because we're doing ephemeral DH. Now that libssl is fully using the EVP API, we need a way to specify that we want a quick check instead of a full check. Therefore we introduce EVP_PKEY_param_check_quick() and use it. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14146)
2021-02-15Run DH_check_ex() not DH_check_params_ex() when checking paramsMatt Caswell
Both DH_check_ex() and DH_check_params_ex() check the parameters. DH_check_ex() performs a more complete check, while DH_check_params_ex() performs a lightweight check. In 1.1.1 EVP_PKEY_param_check() would call DH_check_ex() for DH keys. For backwards compatibility we should continue with that behaviour. Fixes #13501 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14146)
2021-02-15RSA: avoid dereferencing possibly-NULL parameter in initializersBenjamin Kaduk
Fix CID 1472835: the explicit NULL check for prsactx is useless when we have already dereferenced it in the initializers. Move the actual initialization to the function body to get the logic sequenced properly. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14160)
2021-02-15x509_vfy: remove redundant stack allocationBenjamin Kaduk
Fix CID 1472833 by removing a codepath that attempts to allocate a stack if not already allocated, when the stack was already allocated unconditionally a few lines previously. Interestingly enough, this additional allocation path (and the comment describing the need for it) were added in commit 69664d6af0cdd7738f55d10fbbe46cdf15f72e0e, also prompted by Coverity(!). It seems that the intervening (and much more recent) commit d53b437f9992f974c1623e9b9b9bdf053aefbcc3 that allowed sk_X509_dup() to accept a NULL argument allowed the earlier initialization path to unconditionally allocate a stack, rendering this later allocation fully redundant. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14161)
2021-02-15Add docs for ASN1_item_sign and ASN1_item_verify functionsShane Lontis
This is to address part of issue #13192. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13373)
2021-02-14Remove an unnecessary free call.Pauli
https://github.com/openssl/openssl/commit/64954e2f34b8839ca7ad1e9576a6efaf3e49e17c#r47045920 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14165)
2021-02-14Remove dead code in rsa_pkey_ctrl.Shane Lontis
Fixes CID #1472393 Previously this switch handled CMS & PCKS7 controls (e.g ANS1_PKEY_CTRL_PKCS7_SIGN) which fell thru to the dead code to set the X509_ALG. Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14163)
2021-02-13passwd.c: use the actual ROUNDS_DEFAULT macroDisconnect3d
Before this commit, the `ROUNDS_DEFAULT` macro was not used at all, while defined in the source code. Instead, a `unsigned int rounds = 5000;` was set, which uses the same value. This commit changes the `5000` to `ROUNDS_DEFAULT`. CLA: trivial Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14156)
2021-02-12NOTES-WINDOWS: fix typoJay Satiro
CLA: trivial (cherry picked from commit fb97b8e8a52b853b2b2209d5aeee36eaa08bb9ad) Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/14042)
2021-02-12Add a skeleton README-PROVIDERS fileDr. Matthias St. Pierre
The current content of this README file are just meant to be a starting point and an incentive to add more. Most of the text was borrowed from the [OpenSSL 3.0 Wiki], which is the reason why a added Matt as co-author. To be continued... [OpenSSL 3.0 Wiki]: https://wiki.openssl.org/index.php/OpenSSL_3.0 Co-authored-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14042)
2021-02-12Add deprecation note to the README-ENGINES fileDr. Matthias St. Pierre
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14042)
2021-02-12Unify the markdown links to the NOTES and README filesDr. Matthias St. Pierre
In many locations, the files have been converted to markdown syntactically, but don't utilize the power of markdown yet. Here, instead of just repeating the file name, the markdown link now shows the title of the document. Additionally, the notes are now reference in the same order in both the README and the INSTALL file. Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14042)
2021-02-12Reformat some NOTES and README filesDr. Matthias St. Pierre
Formatting is still very mixed in the NOTES and README files. This commit tries to make formatting more consistent with the one introduced in pull request #10545. Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14042)