summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2021-11-09Split a new page X509_load_cert_file(3) with three functionsIngo Schwarze
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.
2021-11-09Add ASPA OIDJob Snijders
draft-ietf-sidrops-aspa-profile OK tb@
2021-11-08Replace <sys/limits.h> with <limits.h>Brent Cook
ok tb@
2021-11-08Document X509_gmtime_adj(3).Ingo Schwarze
While here, improve some argument names, improve ordering of the material, and mention the meaning of negative and of large arguments,
2021-11-07Allow -current libsndio to connect to old sndiod serversAlexandre Ratchov
Recent sndio device naming change is missing the proper compatibility bits for this case. Found and fixed by bluhm@ and tweaks from me. ok bluhm
2021-11-07In X509_STORE_CTX, rename the X509_STORE store rather than ctx.Theo Buehler
ok gnezdo jsing
2021-11-07In X509_STORE_CTX rename the misnamed last_untrusted to num_untrustedTheo Buehler
ok jsing
2021-11-07new manual pagesIngo Schwarze
ASN1_item_digest(3), ASN1_item_sign(3), and ASN1_item_verify(3)
2021-11-06Improve formatting. The line breaks in the lists of methods were very ugly.Ingo Schwarze
While here, put descriptions right after the prototypes they describe. No content change.
2021-11-06Start cleaning up X509_STORE_get1_issuer()Theo Buehler
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
2021-11-06In X509_STORE_get1_issuer() do not call the verify callback fromTheo Buehler
x509_check_cert_time(). Matches a change made in OpenSSL 70dd3c65. ok jsing
2021-11-06Fix indent.Joel Sing
2021-11-06Refactor X509_STORE_get1_certs()Theo Buehler
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
2021-11-05typo: a static objects -> a static objectTheo Buehler
2021-11-05First pass of streamlining X509_STORE_get1_{certs,crls}()Theo Buehler
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
2021-11-05Trade an abort() neutered by a comment for a blank line elsewhere.Theo Buehler
2021-11-05Clean up X509_STORE_add_{cert,crl}().Theo Buehler
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
2021-11-05Unify variable names in X509_STORE_{free,up_ref,add_lookup}().Theo Buehler
simplify the flow of X509_add_lookup(). ok jsing
2021-11-05Rename the ret variable in X509_OBJECT_new() to obj..Theo Buehler
ok jsing
2021-11-05Garbage collect the unused skip member of X509_LOOKUP andTheo Buehler
the unused cache member of X509_STORE. ok jsing
2021-11-05Use calloc() to remove the need of silly zeroing of most members.Theo Buehler
Check for allocation failures and if one happens push an error on the stack and clean up using X509_STORE_free(). ok jsing
2021-11-05Streamline and shorten x509_object_cmp() a bit.Theo Buehler
ok jsing
2021-11-05Drop a bunch of unnecesary parentheses and unify the order in whichTheo Buehler
callbacks are called. ok jsing
2021-11-05Cleanup X509_LOOKUP_new()Theo Buehler
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
2021-11-05Zap unused variablesKlemens Nanni
OK martijn
2021-11-05Garbage collect xobj->data.{ptr,pkey}Theo Buehler
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
2021-11-04Cache sha512 hash and parsed not_before and not_after with X509 cert.Bob Beck
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@
2021-11-03document d2i_X509_ALGORS(3) and i2d_X509_ALGORS(3)Ingo Schwarze
2021-11-03Fix five bugs in X509_REQ_to_X509(3):Ingo Schwarze
* 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@.
2021-11-03Fix ASN1_TIME_diff() with NULL timesTheo Buehler
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
2021-11-03Some cleanup in X509_REQ_get_extensions(3), no functional change.Ingo Schwarze
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@
2021-11-03Fix two bugs in X509_REQ_add_extensions_nid(3)Ingo Schwarze
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.
2021-11-03mention hw.powerJonathan Gray
ok deraadt@
2021-11-02Do not take the strlen() of a NULL name. Defer the CBS_init() to later.Theo Buehler
Found the hard way by sthen. ok sthen
2021-11-01Move the now internal X.509-related structs into x509_lcl.h.Theo Buehler
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
2021-11-01In X509_STORE_CTX_get_obj_from_subject() rename X509_OBJECT fromTheo Buehler
the generic 'ret' to obj' in X509. Requested by jsing
2021-11-01Ensure SSL_set_tlsext_host_name() is given a valid hostname.Joel Sing
ok inoguchi@ tb@
2021-11-01Improve SNI hostname validation.Joel Sing
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@
2021-11-01Stop binding audio devices exposed by sndiod to physical devicesAlexandre Ratchov
This a shift towards a new model: clients connect to logical devices (created with -s option) then the server routes data to/from the underlying physical device (registered with -f option). The binding may be changed at run-time with the server.device control exposed by sndioctl(1). As audio devices exposed by sndiod(8) are not bound to fixed physical devices anymore, the physical audio device number component of sndio(7) descriptors was removed. fixes, help from and ok denis, edd
2021-11-01Unifdef LIBRESSL_NEW_API. Now that the library is bumped, this isTheo Buehler
no longer needed. ok jsing
2021-10-31Enable RFC 3779 code.Theo Buehler
From job. Discussed at length with beck, claudio, job during h2k21
2021-10-31document that fileno(3) returns -1 for some kinds of FILE * objects;Ingo Schwarze
triggerd by but simpler than a similar patch sent in by Simon Branch <simonmbranch at gmail dot com>; OK millert@ jmc@
2021-10-31Hide struct internals under LIBRESSL_CRYPTO_INTERNAL so that otherTheo Buehler
parts of LibreSSL can no longer reach into them. discussed with beck, jsing
2021-10-31bump major after struct size changeTheo Buehler
2021-10-31Bump BER_MAX_OID_LEN to 128Theo Buehler
From martijn, discussed with claudio, ok sthen
2021-10-31Bump majors after struct visibility changes, symbol removal and symbolTheo Buehler
addition.
2021-10-31Simplify some code by using X509_STORE_CTX_get_obj_by_subject()Theo Buehler
ok beck jsing
2021-10-31Update Symbols.list to include API additionsTheo Buehler
2021-10-31libssl: stop reaching into the X509 struct and simplify some code byTheo Buehler
using X509_get_key_usage(). ok beck jsing
2021-10-31Update Symbols.list for new API and API removal/renamingTheo Buehler