summaryrefslogtreecommitdiff
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Split a new page X509_load_cert_file(3) with three functionsschwarze2021-11-097-112/+157
| | | | | | | | | | | | | | | out of X509_LOOKUP_hash_dir(3) because both groups of functions differ substantially in purpose and structure. Rewrite the complete text of X509_load_cert_file(3) from scratch for correctness and clarity. This fixes several documentation errors: 1. The names of the constants were wrong, lacking the "X509_" prefix. 2. None of these functions support X509_FILETYPE_DEFAULT, neither in OpenSSL nor in LibreSSL. 3. The memory cache does not contain X509_STORE objects; instead, the X509_STORE object *is* the memory cache.
* Add ASPA OIDjob2021-11-092-0/+2
| | | | | | draft-ietf-sidrops-aspa-profile OK tb@
* Replace <sys/limits.h> with <limits.h>bcook2021-11-081-2/+2
| | | | ok tb@
* Document X509_gmtime_adj(3).schwarze2021-11-081-23/+67
| | | | | While here, improve some argument names, improve ordering of the material, and mention the meaning of negative and of large arguments,
* In X509_STORE_CTX, rename the X509_STORE store rather than ctx.tb2021-11-073-15/+15
| | | | ok gnezdo jsing
* In X509_STORE_CTX rename the misnamed last_untrusted to num_untrustedtb2021-11-073-17/+17
| | | | ok jsing
* new manual pagesschwarze2021-11-076-5/+288
| | | | ASN1_item_digest(3), ASN1_item_sign(3), and ASN1_item_verify(3)
* Improve formatting. The line breaks in the lists of methods were very ugly.schwarze2021-11-061-116/+76
| | | | | While here, put descriptions right after the prototypes they describe. No content change.
* Start cleaning up X509_STORE_get1_issuer()tb2021-11-061-15/+37
| | | | | | | | | | | | | | Get rid of the last X509_OBJECT_free_contents() call by moving the object from the stack to the heap. I deliberately kept the obj variable to keep obj and pobj separate. Rename the out parameter from issuer to out_issuer to ensure that we only assign it when we have acquired a reference that we can return. Add a new X509 *issuer. In the first part of the function, acquire an extra reference before check_issuer/check_time. In the second part of the function, acquire a reference inside the lock to avoid a race. Deal with ret only in one place. ok jsing
* In X509_STORE_get1_issuer() do not call the verify callback fromtb2021-11-061-3/+3
| | | | | | x509_check_cert_time(). Matches a change made in OpenSSL 70dd3c65. ok jsing
* Fix indent.jsing2021-11-061-8/+7
|
* Refactor X509_STORE_get1_certs()tb2021-11-061-27/+30
| | | | | | | | Split the retrieval of the certs in the store's cache that match the desired subject into a separate function. This greatly simplifies locking, error handling and the flow of the function. with/ok jsing
* typo: a static objects -> a static objecttb2021-11-051-3/+3
|
* First pass of streamlining X509_STORE_get1_{certs,crls}()tb2021-11-051-66/+77
| | | | | | | | | | | | | | These functions are quite messy. On top of the tricky logic querying the cache, then refreshing the cache (unconditionally or not), then querying again, then extracting a list of certs/crls and bumping their refcounts, things are intermixed with locking and needlessly early allocations that then need to be cleaned up again. Use X509_STORE_CTX_get_obj_by_subject() to avoid using an object on the stack and defer allocation of the returned stack of certs to later. Flatten the logic a bit and prepare for further refactoring. ok jsing
* Trade an abort() neutered by a comment for a blank line elsewhere.tb2021-11-051-2/+2
|
* Clean up X509_STORE_add_{cert,crl}().tb2021-11-051-69/+41
| | | | | | | | | | | | | | | | | | | | Add a X509_STORE_add_object() function that adds an X509 object to the store and takes care of locking and cleaning up. This way we can set up an X509_OBJECT for both the cert and CRL case and hand over to the new function. There is one intentional change of behavior: if there is an attempt to add an object which is already present in the store, succeed instead of throwing an error. This makes sense and is also the OpenSSL behavior. As pointed out by jsing, this is a partial fix for the long standing GH issue #100 on libtls where connections would fail if the store contains duplicate certificates. Also: remove the internal X509_OBJECT_dec_ref_count(), which is no longer used. ok jsing
* Unify variable names in X509_STORE_{free,up_ref,add_lookup}().tb2021-11-051-29/+26
| | | | | | simplify the flow of X509_add_lookup(). ok jsing
* Rename the ret variable in X509_OBJECT_new() to obj..tb2021-11-051-5/+5
| | | | ok jsing
* Garbage collect the unused skip member of X509_LOOKUP andtb2021-11-052-5/+1
| | | | | | the unused cache member of X509_STORE. ok jsing
* Use calloc() to remove the need of silly zeroing of most members.tb2021-11-051-28/+18
| | | | | | | Check for allocation failures and if one happens push an error on the stack and clean up using X509_STORE_free(). ok jsing
* Streamline and shorten x509_object_cmp() a bit.tb2021-11-051-11/+6
| | | | ok jsing
* Drop a bunch of unnecesary parentheses and unify the order in whichtb2021-11-051-17/+13
| | | | | | callbacks are called. ok jsing
* Cleanup X509_LOOKUP_new()tb2021-11-051-12/+11
| | | | | | | Switch from malloc() to calloc() and drop a bunch of initializations to 0. Call the returned object lu instead of the generic ret. ok jsing
* Garbage collect xobj->data.{ptr,pkey}tb2021-11-052-8/+6
| | | | | | | | | Both these are essentially unused. Remove the last use of data.ptr by initializing and copying the X509_OBJECT using memset() and struct assignment in X509_STORE_CTX_get_subject_by_name() and add a missing error check for X509_OBJECT_up_ref_count() while there. ok beck
* Cache sha512 hash and parsed not_before and not_after with X509 cert.beck2021-11-049-135/+149
| | | | | | | | | | | Replace sha1 hash use with sha512 for certificate comparisons internal to the library. use the cached sha512 for the validator's verification cache. Reduces our recomputation of hashes, and heavy use of time1 time conversion functions noticed bu claudio@ in rpki client. ok jsing@ tb@
* document d2i_X509_ALGORS(3) and i2d_X509_ALGORS(3)schwarze2021-11-031-5/+36
|
* Fix five bugs in X509_REQ_to_X509(3):schwarze2021-11-031-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | * memory leak in X509_set_subject_name(ret, X509_NAME_dup(xn)); * memory leak in X509_set_issuer_name(ret, X509_NAME_dup(xn)); * memory leak in X509_set_pubkey(ret, X509_REQ_get_pubkey(r)); * missing return value check of X509_REQ_get_pubkey(r); * missing return value check of X509_set_pubkey(...); Some of these bugs have survived for twenty-five years. I noticed the first two bugs while documenting the function, then found that a commit in the OpenSSL 1.1.1 branch, which is still under a free license, fixed all of them in 2016. In the function X509_REQ_to_X509(3), merge everything worth merging from OpenSSL 1.1.1, in particular the relevant parts of: * 222561fe Apr 30 17:33:59 2015 -0400 (err: label cleanup) * 0517538d Mar 17 00:15:48 2016 +0100 (the bugfix) * c5137473 Apr 3 23:37:32 2016 +0200 (code simplification) While here, delete some commented out code that is wrong in multiple ways and untouched since the SSLeay era. One code tweak for readability by tb@, and OK tb@.
* Fix ASN1_TIME_diff() with NULL timestb2021-11-031-3/+18
| | | | | | | | | | | The ASN1_TIME_diff() API accepts NULL ASN1_TIMEs and interprets them as "now". This is used in sysutils/monit, as found by semarie with a crash after update. Implement this behavior by porting a version of ASN1_TIME_to_tm() to LibreSSL and using it in ASN1_TIME_diff(). Tested by semarie ok beck jsing semarie
* Some cleanup in X509_REQ_get_extensions(3), no functional change.schwarze2021-11-031-10/+6
| | | | | | | | | | | | | | In this function, merge everything that is worth merging from the OpenSSL 1.1.1 branch, which is still under a free license, mostly the relevant part of commit 9b0a4531 Mar 14 23:48:47 2015 +0000 to use X509_ATTRIBUTE_get0_type(3) rather than re-implementing it. While here, * use d2i_X509_EXTENSIONS(3) rather than ASN1_item_d2i(3); * test pointers explicitly against NULL, not with '!', as suggested by tb@; * drop some useless parentheses as suggested by tb@. OK tb@
* Test adding extensions to certification requests.schwarze2021-11-032-2/+167
| | | | | Related to the bugfixes in x509_req.c rev. 1.25. OK tb@.
* Fix two bugs in X509_REQ_add_extensions_nid(3)schwarze2021-11-031-32/+13
| | | | | | | | | | | | | | | | | | that i noticed while documneting the function: * missing return value check for ASN1_item_i2d(3) and * missing return value check for OBJ_nid2obj(3). In the function X509_REQ_add_extensions_nid(3), merge everything that is worth merging from the OpenSSL 1.1.1 branch, which is still under a free license; that's mostly parts of the commit 9b0a4531 Mar 14 23:48:47 2015 +0000 (containing the bugfix, even though the OpenSSL commit message did not mention the bugs) and some minor stylistic changes from 0f113f3e and 26a7d938. While here, use i2d_X509_EXTENSIONS(3) instead of the layer-violating call to ASN1_item_i2d(3), and include a few stylistic tweaks from tb@. OK tb@, and jsing@ agreed on the general direction.
* Add regress that calls SSL_set_tlsext_host_name() with a NULL host name.jsing2021-11-021-1/+15
|
* Do not take the strlen() of a NULL name. Defer the CBS_init() to later.tb2021-11-021-3/+3
| | | | | | Found the hard way by sthen. ok sthen
* Move the now internal X.509-related structs into x509_lcl.h.tb2021-11-0172-451/+521
| | | | | | | | Garbage collect the now unused LIBRESSL_CRYPTO_INTERNAL and LIBRESSL_OPAQUE_X509. Include "x509_lcl.h" where needed and fix a couple of unnecessary reacharounds. ok jsing
* In X509_STORE_CTX_get_obj_from_subject() rename X509_OBJECT fromtb2021-11-011-6/+6
| | | | | | the generic 'ret' to obj' in X509. Requested by jsing
* Ensure SSL_set_tlsext_host_name() is given a valid hostname.jsing2021-11-011-3/+8
| | | | ok inoguchi@ tb@
* Rework SNI hostname regress to be table driven.jsing2021-11-011-62/+147
| | | | | | | Also adjust for the changes to tlsext_sni_is_valid_hostname() and include tests for IPv4 and IPv6 literals. ok beck@
* Improve SNI hostname validation.jsing2021-11-012-9/+54
| | | | | | | | | | | | | | For some time now we've validated the hostname provided to the server in the SNI extension. Per RFC 6066, an IP literal is invalid as a hostname - the current code rejects IPv6 literals, but allows IPv4 literals through. Improve this check to explicitly detect both IPv4 and IPv6 literals. Some software has been historically known to include IP literals in SNI, so rather than rejecting this outright (and failing with a decode error), pretend that the SNI extension does not exist (such that we do not break some older clients). ok inoguchi@ tb@
* Rework x509attribute regress test in such a way that it doesn't needtb2021-11-011-11/+7
| | | | to reach into opaque structs.
* Unifdef LIBRESSL_NEW_API. Now that the library is bumped, this istb2021-11-0111-60/+10
| | | | | | no longer needed. ok jsing
* Enable RFC 3779 code.tb2021-10-311-1/+1
| | | | From job. Discussed at length with beck, claudio, job during h2k21
* Make this test compile again after the damage done in libcryptotb2021-10-311-19/+20
|
* Hide struct internals under LIBRESSL_CRYPTO_INTERNAL so that othertb2021-10-313-19/+19
| | | | | | parts of LibreSSL can no longer reach into them. discussed with beck, jsing
* Various minor adjustments to make openssl(1) compile with opaquetb2021-10-313-12/+23
| | | | structs in X509.
* Bump majors after struct visibility changes, symbol removal and symboltb2021-10-313-3/+3
| | | | addition.
* Simplify some code by using X509_STORE_CTX_get_obj_by_subject()tb2021-10-311-8/+8
| | | | ok beck jsing
* Update Symbols.list to include API additionstb2021-10-311-0/+10
|
* libssl: stop reaching into the X509 struct and simplify some code bytb2021-10-312-24/+6
| | | | | | using X509_get_key_usage(). ok beck jsing
* Update Symbols.list for new API and API removal/renamingtb2021-10-311-10/+33
|
* Expose new API in headers and make X509 structs opaque.tb2021-10-311-0/+3
|