summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/objects (unfollow)
Commit message (Collapse)AuthorFilesLines
2026-05-04wycheproof.go: simplfiy for looptb1-2/+2
2026-05-04wycheproof: go fmttb1-5/+5
2026-05-04certs/README: fix previous: 14b should fail to verifytb1-1/+1
2026-05-04verifier: re-enable the callback override for depthtb1-5/+3
kirill reported that his nginx reverse proxy setup stopped working with x509_verify.c r1.74 and r1.75. It turns out that nginx relies on a verify callback that always returns 1. In revision 1.74 we removed the possibility of the verify_cb() to override X509_V_ERR_CERT_CHAIN_TOO_LONG, which is what breaks the config in kirill's setup since it used to use the nginx default of setting the depth to 1. Re-enable this to make the new scenario "2a with depth 1 and depth callback" pass. As shown by the other new test scenario "14b with yolo calback" with a "just say yes" cb, the guard added in r1.74 still prevents the overwrite. This makes kirill's reproducer work as verified by kirill and myself. It was also tested by kirill in the real life setup. discussed with beck ok jsing kenjiro
2026-05-04libcrypto: extend verify and callback regresstb2-4/+105
Add three more test variants for scenario 2a: 1) verify that a chain of length 3 validates with depth 2. 2) verify that a chain of length 3 fails to validate with depth 1. 3) verify that a chain of length 3 validates with depth 1 if we allow the callback to override the depth. Variant 3) fails in -current and reproduces a scenario reported by kirill. Also add two test variants for the scenarios in 14: 4): run the chain of length 32 with a yolo callback returning 1 5): run the chain of length 33 with a yolo callback returning 1 Test 5) fails because we currently bail out at the wrong depth. The verify callback should allow overriding the failure and will then hit the bounds check added in x509_verify.c r1.74 to avoid an overwrite. Reuse the existing test cases 2a and 14a/14b for this and add an optional vct->desc that uniquely identifies the test case. incorporates various feedback from jsing
2026-05-04verify regress: allow setting verify depth and callbacktb2-13/+38
This is pretty ugly and probably the the vct should be handed down to the verify_cert*() functions, but this works and doesn't make these tests any uglier than they already are. The callback regress was modified with a least effort approach.
2026-05-03cert regress: update README for tests 14a and 14b.tb1-0/+6
2026-04-30Refactor dtls1_do_write_handshake_message().jsing1-43/+44
If the call to dtls1_write_bytes() fails, handle the potential MTU update and return/continue, which allows for the remainder to be moved out of an else statement. ok kenjiro@ tb@
2026-04-29Split dtls1_do_write() into handshake message and CCS handling.jsing1-33/+59
dtls1_do_write() is currently a single function that handles both handshake messages and CCS. This is a strange mix that only serves to complicate the code - handshake messages have their own headers and may need to be fragmented, while CCS must be sent verbatim (and only contain a single byte). Pull the CCS part out into a separate function, simplifying the code. By definition, when sending a CCS message the MTU will already be set appropriately. ok kenjiro@ tb@
2026-04-29Avoid unnecessary lookups in dtls1_retransmit_message().jsing1-37/+6
dtls1_retransmit_buffered_messages() is iterating over the sent_messages pqueue, only to pass dtls1_retransmit_message() a sequence number that it turns back into a priority, to then do a lookup on the sent_messages pqueue. This is pointless given that we already have the message that we need to retransmit - just pass that to dtls1_retransmit_message() directly. ok kenjiro@ tb@
2026-04-29Remove unused frag_off argument from dtls1_retransmit_message().jsing1-4/+3
ok kenjiro@ tb@
2026-04-29Make dtls1_retransmit_message() static.jsing2-78/+76
This function is only called from dtls1_retransmit_buffered_messages(). Make it static and move it above the caller. ok kenjiro@ tb@
2026-04-29Inline dtls1_fix_message_header().jsing1-16/+5
This is only used in one place and it makes no sense to have it as a separate function. Furthermore, pull up an assertion so that we check before assigning frag_len. ok kenjiro@ tb@
2026-04-29Convert DTLS code to ssl_msg_callback().jsing1-14/+7
ok kenjiro@ tb@
2026-04-26make_addressRange: unused bits in max must be zerotb1-6/+23
X509v3_addr_add_range() requires that min and max of an address range have network encoding. In the RFC 3779 encoding of an actual address range (as opposed to a prefix) as a SEQUENCE OF two ASN.1 BIT STRINGs, the trailing one bits of the maximum become unused bits and therefore must be DER encoded as zeroes. The DER encoder will clear them via i2d but these trailing ones are annoying. Make a copy in which the unused bits are cleared. ok kenjiro
2026-04-26Fix PKCS7_set_{un,}signed_attributes()tb1-28/+35
In both these functions, if the X509_ATTRIBUTE_dup() fails, the remainder of the sk stack is shared with p7si->{un,}auth_attr and the caller will likely end up freeing it twice. Fix this by writing another sk_deep_copy() patterned after the existing ones in x509_lu.c and x509_vpm.c. PKCS7_set_{un,}signed_attributes() become trivial wrappers of that. ok jsing kenjiro
2026-04-25Add DTLS wire tests.jsing2-4/+386
Add tests that ensure the wire bytes for DTLS are what we expect for both CCS and fragmented handshake messages.
2026-04-25pkcs7: drop silly use of i in PKCS7_dataVerify()tb1-4/+3
ok jsing kenjiro
2026-04-25pkcs7: don't use i, j for NIDs in PKCS7_dataFinal()tb1-9/+7
Use nid for NIDs and use i only for for loops. ok jsing kenjiro
2026-04-25pkcs7: don't use i and j for NIDs in PKCS7_dataDecode()tb1-6/+4
There's no need to assign to i before the switch and j is a terrible name for a NID. Inline the latter and switch directly over the return value of OBJ_obj2nid(). ok jsing kenjiro
2026-04-25pkcs7: avoid assignment to i in PKCS7_dataInit()tb1-3/+2
We can switch over the return value of OBJ_obj2nid() rather than using i for an indirection. ok jsing kenjiro
2026-04-25pkcs7: Simplify PKCS7_type_is_other()tb1-12/+4
Remove unnecessary isOther and nid variables and use direct returns. The function should probably be removed... ok jsing kenjiro
2026-04-25Add FIPS 180-4 references for SHA-256 constants.jsing1-1/+6
2026-04-24Simplify PKCS7_get_issuer_and_serial()tb1-9/+6
The i variable is unused. Likewise for the first assignment to ri. Instead of an incomplete check that idx is in range, which still results in a NULL deref if idx < 0, check if ri is not NULL before accessing, as sk_value() checks the index correctly. ok jsing kenjiro
2026-04-21wycheproof: skip BLS test vectors to prepare for updatetb1-1/+3
2026-04-21pkcs7test: factor main into a helper so we can add some unit tests easilytb1-3/+13
2026-04-20mlkem: use <openssl/mlkem.h> instead of "mlkem.h"tb1-2/+3
patch from portable
2026-04-20tls_keypair: add missing <limits.h>tb1-1/+3
from bcook kenjiro
2026-04-20ec_pmeth: fix 20yo comment: *outlen -> *keylentb1-2/+2
2026-04-16libtls: consistently handle allocation failureslibressl-v4.3.1libressl-v4.3.0tb2-6/+6
Use tls_set_errorx() or tls_error_setx() rather than the versions without x for TLS_ERROR_OUT_OF_MEMORY. ENOMEM adds no further info. From Michael Forney ok bcook
2026-04-16libtls: use TLS_ERROR_OUT_OF_MEMORY after malloc failuretb1-2/+2
tls_config_load_file() hat a spot that used TLS_ERROR_UNKNOWN, so switch that to the usual error code. Use tls_error_setx() since strerror(ENOMEM) adds nothing. From Michael Forney ok bcook
2026-04-16libtls: use tls_error_setx() after BIO_new_mem_buf()tb1-2/+2
This is the only place where tls_error_set() was used. While the new length check now guarantees that the failure is due to ENOMEM, this info does not add value. From Michael Forney ok bcook
2026-04-16libtls: prefer x version of error settingtb5-17/+17
If a check fails and errno is not necessarily set by the previous API call use tls_set_errorx() or tls_error_setx() since turning an unrelated errno into an error string is unhelpful. From Michael Forney ok bcook
2026-04-16libtls: add missing length checks before BIO_new_mem_buf()tb2-2/+17
Like all proper libcrypto APIs, BIO_new_mem_buf() takes an int as a length argument. Check the size_t passed in to be at most INT_MAX to avoid issues with truncation and overflow like it's done everywhere else. After release this should probably be clamped down further since legitimate files (certs and keys) are nowhere near this large. Prompted by a diff by Michael Forney ok jsing
2026-04-15keypairtest: zero out tls_error before running teststb1-2/+2
Otherwise tls_error_clear() (called e.g. via tls_error_vset()) will free the bad error->msg pointer. From Michael Forney
2026-04-13Prior to this we substring matched and allowed a leading .beck3-7/+75
on a SAN DNSname constraint. This is not correct, as with a DNSname constraint, it may exacly match or match zero or more additional components on the front of the candidte to match. Spotted by Haruto Kimura <hkimura2026@gmail.com> ok tb@ kenjiro@
2026-04-08Bump LibreSSL version for the releasetb1-3/+3
ok deraadt
2026-04-07Rename labellen to label_lentb2-24/+24
Requested by jsing, ok beck
2026-04-07Fix NULL deref for malformed OAEP parameters in CMS decryptiontb2-11/+22
This converts rsa_cms_decrypt() to use X509_ALGOR_get0() and fixes a NULL deref when a parameter is (invalidly) omitted similar to the fix in ec/ec_ameth.c r1.66 from a couple years back. There is currently an XXX annotating a hairy leak due to trying to be smart and stealing the parameters from the oaep object. Instead, just make a copy of the label string and free it in the exit path. The diff adds an error for labellen == 0 since that is an invalid encoding of pSpecifiedEmpty (see RFC 8017) -- per the DER the default must be omitted. This way we avoid a malloc(0) implementation-defined behavior. This minor issue was assigned CVE-2026-28390 by OpenSSL and was reported by too many to list. The fix is my own. It is similar to OpenSSL's fix only because I rewiewed theirs and suggested an improvement or two. This is the last of the "security fixes" in today's OpenSSL release that "affect" LibreSSL. All the other bugs were already fixed a few years back or we didn't have the code/bugs in the first place. ok beck jsing
2026-04-07Refactor and fix ocsp_find_signer_sk()tb1-12/+17
Instead of reaching deep inside the OCSP_BASICRESP and ignoring its semantics and then try to untangle things in ocsp_find_signer_sk(), pass the OCSP_BASICRESP and use OCSP_resp_get0_id() which has the logic built in. Avoids a crash if you call OCSP_basic_verify() after OCSP_BASICRESP_new() without OCSP_basic_sign(). This cannot happen on a deserialized OCSP object. Prompted by a report by Kamil Frankowicz, Jan Kaminski, Bartosz Michalowski. ok jsing
2026-04-07Add a few to-do items to the crl_cb()tb1-1/+6
Prompted by the "fix" fighting symptoms of misdesign in Delta CRL processing rather than addressing the root cause. Probably the best fix is to remove support for Indirect CRLs and Delta CRLs outright. ok jsing
2026-04-07Stop Delta CRL processing if a CRL number is misssingtb1-4/+8
A malformed Delta CRL could cause a crash. Funnily enough the deserializer recognizes this and marks such a CRL as invalid, but nothing ever checks the EXFLAG_INVALID for CRLs. For certificates this would usually result in verification failure due to x509v3_cache_extensions() failing. This is only reachable if the X509_V_FLAG_USE_DELTAS is used, which only a handful of ports do, plus openssl(1) does if you use the undocumented -use_deltas flag. Reported by Igor Morgenstern to OpenSSL who then sat on this since Jan 8 and assigned CVE-2026-28388. ok jsing
2026-04-06x509v3.h: remove pointless #ifdef HEADER_CONF_Htb1-3/+1
x509v3.h has included conf.h since June 20, 1999, OpenSSL commit ba404b5e, so HEADER_CONF_H has been defined since then. Also since then, CONF_VALUE (only available via conf.h) has been used outside of HEADER_CONF_H, making that #ifdef doubly pointless. ok bcook jsing kenjiro
2026-04-06cms_local.h: remove #ifdef X509V3_HEADER_Htb1-4/+3
All thirteen files including cms_local.h do that after including cms.h, which already includes x509v3.h, so this is always defined. While here make the cms_local.h a bit more selfstanding by including asn1.h and x509v3.h ok bcook jsing (who had the same diff) kenjiro
2026-04-03Remove lib/libssl/test.jsing53-4409/+0
This is all unhelpful historical cruft. Discussed with tb@
2026-04-03Remove workaround for SSL 3.0/TLS 1.0 CBC vulnerability.jsing5-80/+8
We no longer support TLSv1.0 and definitely do not support SSLv3 - remove the empty fragments workaround for the CBC vulnerability in these protocols. ok kenjiro@ tb@
2026-04-03Ensure that we cannot negotiate TLSv1.1 or lower.jsing3-13/+21
TLS versions prior to TLSv1.2 were disabled a while ago, however this was done in the version handling code. Remove TLSv1.1 and earlier from ssl_get_method() and add an explicit min version check in the legacy client and server, to provide a stronger guarantee. ok kenjiro@ tb@
2026-04-03Fix min vs max in failure output.jsing1-3/+3
2026-04-03Use DTLS_client_method() instead of DTLSv1_client_method().jsing1-3/+3
2026-04-03Remove ssl_server_legacy_first_packet()jsing3-97/+2
This has not been reachable since we made the TLSv1.3 stack the default entry point - tls13_record_layer_read_record() will send a protocol version alert and raise an error, which means we never transition into the legacy stack. ok kenjiro@