aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
Commit message (Collapse)AuthorAgeFilesLines
* rand: allow seed-src to be missingPauli2020-12-091-1/+4
| | | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13640)
* Fix error clash in buildPauli2020-12-091-1/+1
| | | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13640)
* rand: add a provider side seed source.Pauli2020-12-092-2/+53
| | | | | | | | | This allows the operating system sources that OpenSSL supports to be used directly as RNGs. It also allows DRBG seeding to be explicitly specified rather than being left to a fall back case. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13455)
* EVP: Add EVP_PKEY_get_group_name() to extract the group name of a pkeyRichard Levitte2020-12-083-43/+57
| | | | | | | | This replaces the internal evp_pkey_get_EC_KEY_curve_nid() Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13436)
* EVP: constify the EVP_PKEY_get_*_param() argument |pkey|Richard Levitte2020-12-081-6/+9
| | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13436)
* Add MAP_CONCEAL from OpenBSD which has similar purpose but on mmapDavid Carlier2020-12-081-1/+4
| | | | | | | | | call level. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13394)
* CRYPTO_secure_malloc_init: Add FreeBSD support for secure-malloc ↵David Carlier2020-12-081-0/+3
| | | | | | | | | dont-dump-region. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13394)
* STORE: clear err after ossl_store_get0_loader_intDaniel Bevenius2020-12-081-1/+14
| | | | | | | | | | | | | | | This commit clears the error that might have been set when ossl_store_get0_loader_int has been called as it will try to retrieve a loader for the scheme on an empty store, which will cause the error OSSL_STORE_R_UNREGISTERED_SCHEME to be set. The motivation for this after returning from ossl_store_get0_loader_int, OSSL_STORE_attach will continue and try to fetch a OSSL_STORE_LOADER from the provider. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/12901)
* Fix no-errMatt Caswell2020-12-081-53/+58
| | | | | | | | | | | | The ERR_load_*_strings() functions were not being defined in a no-err build. This is an API break since in 1.1.1 they were still present in a no-err build, but were no-ops. This was also causing a failure in test_symbol_presence. We revert to the way things were done in 1.1.1, i.e. in a no-err build the functions are still present but are no-ops. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13598)
* Complain if we are attempting to encode with an invalid ASN.1 templateMatt Caswell2020-12-081-0/+16
| | | | | | | | | | It never makes sense for multi-string or CHOICE types to have implicit tagging. If we have a template that uses the in this way then we should immediately fail. Thanks to David Benjamin from Google for reporting this issue. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
* Check that multi-strings/CHOICE types don't use implicit taggingMatt Caswell2020-12-083-0/+21
| | | | | | | | | | It never makes sense for multi-string or CHOICE types to use implicit tagging since the content would be ambiguous. It is an error in the template if this ever happens. If we detect it we should stop parsing. Thanks to David Benjamin from Google for reporting this issue. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
* Correctly compare EdiPartyName in GENERAL_NAME_cmp()Matt Caswell2020-12-081-3/+42
| | | | | | | | | | | | If a GENERAL_NAME field contained EdiPartyName data then it was incorrectly being handled as type "other". This could lead to a segmentation fault. Many thanks to David Benjamin from Google for reporting this issue. CVE-2020-1971 Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
* DirectoryString is a CHOICE type and therefore uses explicit taggingMatt Caswell2020-12-081-2/+3
| | | | | | | | | | | | | | | EDIPartyName has 2 fields that use a DirectoryString. However they were marked as implicit tagging - which is not correct for a CHOICE type. Additionally the partyName field was marked as Optional when, according to RFC5280 it is not. Many thanks to github user @filipnavara for reporting this issue. Also to David Benjamin from Google who independently identified and reported it. Fixes #6859 Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
* Deprecate EC_POINT_bn2point and EC_POINT_point2bn.Shane Lontis2020-12-074-92/+127
| | | | | | | | | | | | | Fixes #10366 The one place that actually used was in the legacy printing of ecparams. This has been replaced by the pointtobuf variant. The ecparam app was using one of these functions - this line has just been removed as another PR will remove all the code generated lines.. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13294)
* Change OPENSSL_hexstr2buf_ex() & OPENSSL_buf2hexstr_ex() to pass the separatorShane Lontis2020-12-072-5/+6
| | | | | Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13294)
* PEM: Add a more generic way to implement PEM _ex functions for libctxRichard Levitte2020-12-052-14/+38
| | | | | | | | | | | | This also adds the following functions, for completeness: PEM_write_PrivateKey_ex(), PEM_write_bio_PrivateKey_ex(), PEM_write_PUBKEY_ex, PEM_write_bio_PUBKEY_ex Fixes #13542 Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13547)
* EVP: Adjust EVP_PKEY_size(), EVP_PKEY_bits() and EVP_PKEY_security_bits()Richard Levitte2020-12-051-13/+15
| | | | | | | | | | These functions are documented to return 0 if the size they are supposed to return 0 if the size isn't available. They needed a bit of adjustment to actually do so, since the backend functions they call might return negative numbers in that case. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13611)
* DSA: Make DSA_bits() and DSA_size() check that there are key parametersRichard Levitte2020-12-052-6/+10
| | | | | | | | | | | | | | | | Without these check, a DSA structure without key parameters will cause these functions to crash. This is also the case in pre-3.0 OpenSSL, but since we now extract these data early, to cache them in the EVP_PKEY structure, the same crash happens earlier and much more internally. The added checks are of the same kind as DSA_security_bits() already does. Fixes #13610 Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13611)
* x509_vfy.c: Improve comments (correcting typos etc.)Dr. David von Oheimb2020-12-041-13/+13
| | | | | Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13606)
* Fix EVP_PKEY_CTX propq so that it uses a copyShane Lontis2020-12-041-3/+16
| | | | | | Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12700)
* fix x509_PUBKEY propq so that it uses a copyShane Lontis2020-12-041-3/+25
| | | | | | Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12700)
* Fix x509_crl propq so that it uses a copyShane Lontis2020-12-041-1/+16
| | | | | | Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12700)
* Fix X509 propq so it does not use referencesShane Lontis2020-12-041-6/+14
| | | | | | | | Fixes #13486 Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12700)
* x509_vfy.c: Restore rejection of expired trusted (root) certificateDr. David von Oheimb2020-12-032-22/+22
| | | | | | | | | | | | | | | | | | | | The certificate path validation procedure specified in RFC 5280 does not include checking the validity period of the trusted (root) certificate. Still it is common good practice to perform this check. Also OpenSSL did this until commit 0e7b1383e, which accidentally killed it. The current commit restores the previous behavior. It also removes the cause of that bug, namely counter-intuitive design of the internal function check_issued(), which was complicated by checks that actually belong to some other internal function, namely find_issuer(). Moreover, this commit adds a regression check and proper documentation of the root cert validity period check feature, which had been missing so far. Fixes #13427 Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13590)
* remove unused initialisationsPauli2020-12-032-4/+1
| | | | | Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13577)
* remove unused assignmentsPauli2020-12-038-18/+6
| | | | | Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13577)
* remove unused return value assignmentsPauli2020-12-032-2/+2
| | | | | | | Fixes: #13555 Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13577)
* Adapt everything else to the updated OSSL_ENCODER_CTX_new_by_EVP_PKEY()Richard Levitte2020-12-026-33/+23
| | | | | Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13545)
* ENCODER: Don't pass libctx to OSSL_ENCODER_CTX_new_by_EVP_PKEY()Richard Levitte2020-12-021-4/+26
| | | | | | | | | | | | | | | | | The passed 'pkey' already contains a library context, and the encoder implementations should be found within the same context, so passing an explicit library context seems unnecessary, and potentially dangerous. It should be noted that it's possible to pass an EVP_PKEY with a legacy internal key. The condition there is that it doesn't have a library context assigned to it, so the NULL library context is used automatically, thus requiring that appropriate encoders are available through that context. Fixes #13544 Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13545)
* cmp_client.c: Fix indentation and remove empty lineAnkita Shetty2020-12-021-4/+3
| | | | | | Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13488)
* cmp_client.c: Remove dead code of variable 'txt' in cert_response()Ankita Shetty2020-12-021-6/+1
| | | | | | Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13488)
* Don't Overflow when printing Thawte Strong Extranet VersionMatt Caswell2020-12-021-3/+15
| | | | | | | | | | | When printing human readable info on the Thawte Strong Extranet extension the version number could overflow if the version number == LONG_MAX. This is undefined behaviour. Issue found by OSSFuzz. Reviewed-by: Ben Kaduk <kaduk@mit.edu> (Merged from https://github.com/openssl/openssl/pull/13452)
* Add EVP_KDF-X942 to the fips moduleShane Lontis2020-12-023-4/+6
| | | | | | | | | | | | | | | | | The X942 KDF had been modified so that it supports all optional fields - not just the fields used by CMS. As there are 2 types of KDF for X942 - this has been made a bit clearer by adding an X942KDF-ASN1 alias. X942KDF-CONCAT has also been added as an alias of X963KDF. This work was instigated as a result of the ACVP tests optionally being able to use keybits for the supp_pubinfo field. Setting the parameter OSSL_KDF_PARAM_X942_USE_KEYBITS to 0 allows this to be disabled. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13418)
* RSA: correct digestinfo_ripemd160_der[]Richard Levitte2020-11-301-4/+4
| | | | | | | | | A couple of numbers were incorrect. Fixes #13559 Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13562)
* aes/asm/aesv8-armx.pl: avoid 32-bit lane assignment in CTR modeArd Biesheuvel2020-11-301-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | ARM Cortex-A57 and Cortex-A72 cores running in 32-bit mode are affected by silicon errata #1742098 [0] and #1655431 [1], respectively, where the second instruction of a AES instruction pair may execute twice if an interrupt is taken right after the first instruction consumes an input register of which a single 32-bit lane has been updated the last time it was modified. This is not such a rare occurrence as it may seem: in counter mode, only the least significant 32-bit word is incremented in the absence of a carry, which makes our counter mode implementation susceptible to these errata. So let's shuffle the counter assignments around a bit so that the most recent updates when the AES instruction pair executes are 128-bit wide. [0] ARM-EPM-049219 v23 Cortex-A57 MPCore Software Developers Errata Notice [1] ARM-EPM-012079 v11.0 Cortex-A72 MPCore Software Developers Errata Notice Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13504)
* Fix instances of pointer addition with the NULL pointerMatt Caswell2020-11-303-13/+22
| | | | | | | | | | Addition using the NULL pointer (even when adding 0) is undefined behaviour. Recent versions of ubsan are now complaining about this, so we fix various instances. Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13513)
* ERR: drop err_delete_thread_state() TODO markerRichard Levitte2020-11-281-2/+1
| | | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13466)
* ERR: Drop or deprecate dangerous or overly confusing functionsRichard Levitte2020-11-281-15/+5
| | | | | | | | | | | | | | | ERR_get_error_line() is deprecated, and ERR_get_error_func() and ERR_get_error_data() are removed in favor of ERR_get_error_all(), since they pop the error record, leaving the caller with only partial error record data and no way to get the rest if the wish. If it's desirable to retrieve data piecemeal, the caller should consider using the diverse ERR_peek functions and finish off with ERR_get_error(). Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13466)
* X509_dup: fix copying of libctx and propq using new ASN1_OP_DUP_POST cb ↵Dr. David von Oheimb2020-11-272-2/+34
| | | | | | | | | operation Fixes #12680 Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/12687)
* EVP_PKEY & DSA: Make DSA EVP_PKEY_CTX parameter ctrls / setters more availableRichard Levitte2020-11-273-144/+161
| | | | | | | | | | | | | EVP_PKEY_CTX_set_dsa_ functions were only available when DSA was enabled ('no-dsa' not configured). However, that makes it impossible to use these functions with an engine or a provider that happens to implement DSA. This change solves that problem by shuffling these functions to more appropriate places. Fixes #13529 Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13530)
* Update bio_ok.cihsinme2020-11-271-1/+1
| | | | | | | | | CLA: trivial Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13515)
* Deprecate more DH functionsMatt Caswell2020-11-271-0/+6
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13138)
* Deprecate EVP_PKEY_assign_DH and other similar macrosMatt Caswell2020-11-271-1/+1
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13138)
* Deprecate DH_new as well as i2d_DHparams and d2i_DHparamsMatt Caswell2020-11-271-1/+2
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13138)
* ERR: Restore the similarity of ERR_print_error_cb() and ERR_error_string_n()Richard Levitte2020-11-273-32/+25
| | | | | Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13510)
* Fix EVP_CIPHER_CTX_set_padding for legacy pathShane Lontis2020-11-271-0/+2
| | | | | | | | | | | | | Fixes #13057 When using an engine, there is no cipher->prov so a call to EVP_CIPHER_CTX_set_padding() returns an error when evp_do_ciph_ctx_setparams() is called. For the legacy path it needs to avoid doing the call and just return 1. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Ben Kaduk <kaduk@mit.edu> (Merged from https://github.com/openssl/openssl/pull/13437)
* EVP: don't touch the lock for evp_pkey_downgradeDaniel Bevenius2020-11-261-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit tries to address a locking issue in evp_pkey_reset_unlocked which can occur when it is called from evp_pkey_downgrade. evp_pkey_downgrade will acquire a lock for pk->lock and if successful then call evp_pkey_reset_unlocked. evp_pkey_reset_unlocked will call memset on pk, and then create a new lock and set pk->lock to point to that new lock. I believe there are two problems with this. The first is that after the call to memset, another thread would try to acquire a lock for NULL as that is what the value of pk->lock would be at that point. The second issue is that after the new lock has been assigned to pk->lock, that lock is different from the one currently locked so another thread trying to acquire the lock will succeed which can lead to strange behaviour. More details and a reproducer can be found in the Refs link below. This changes the evp_pkey_reset_unlocked to not touch the lock and the creation of a new lock is done in EVP_PKEY_new. Refs: https://github.com/danbev/learning-libcrypto/blob/master/notes/issues.md#openssl-investigationtroubleshooting https://github.com/nodejs/node/issues/29817 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13374)
* Fix regression in EVP_DigestInit_ex: crash when called with NULL typeTomas Mraz2020-11-261-7/+8
| | | | | | Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13402)
* EVP_DigestFinalXOF must not reset the EVP_MD_CTXTomas Mraz2020-11-261-1/+1
| | | | | | | | It does not do it in legacy path and 1.1.1 so that must not change. Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13402)
* Update copyright yearMatt Caswell2020-11-2668-68/+68
| | | | | Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13533)