summaryrefslogtreecommitdiff
path: root/src/regress/lib/libcrypto (unfollow)
Commit message (Collapse)AuthorFilesLines
3 dayspkcs7test: fix thinko in fatal()tb1-2/+2
3 dayspkcs7test: missing articletb1-2/+2
3 dayspkcs7test: add an empty linetb1-1/+2
3 daysspelling; ok tb@jsg4-10/+10
4 daysPKCS7_stream: avoid out of bounds accesstb1-1/+5
The inner content of SignedData is represented by a PKCS7 object, which PKCS7_stream() assumes to be a plain data object and will thus access its content via an ASN1_OCTET_STRING. This need not be the case after parsing. In fact, the inner content type is essentially arbitrary. If the inner content isn't one of the explicitly supported content types, the fallback (via p7default_tt) will populate the union's d.other with an ASN1_ANY which unravels to ASN1_TYPE_new() deep in the guts of tasn_dec, allocating a 16-byte object on LP64 architectures. In that case, the 16-byte object is interpreted as an 24-byte ASN1_OCTET_STRING and if it isn't NULL, the read+write to os->flags (a long at offset 16) is out of bounds: os->flags | ASN1_STRING_FLAG_NDEF; Add a check that the content is actually id-data before accessing the d.data union member. From Acts1631
4 daysAdd test case causing an OOB access in PKCS7_streamtb1-1/+61
Test case originally from openssl/openssl#31681, exercised via a direct call to PKCS7_stream() as in a report from Acts1631. To be fixed in pk7_lib.c r1.33
4 daysPKCS7_stream: don't crash on omitted contenttb1-1/+15
Do not access the PKCS7 content union without checking that it's actually populated. Add NULL checks and fail. Whether that's the correct thing to do is dubious, but since this has been broken since the "code" was written a quarter century ago, clearly nobody ever wanted to do that. Match OpenSSL behavior which also means more NULL checks than strictly make sense. CMS_stream() has very similar code, but it's not problematic in this particular way because the content isn't OPTIONAL. Part of a diff from Acts1631
4 days"Stream" valid PKCS7 objects with omitted contenttb1-4/+104
The PKCS#7 standard marks the content element of the ContentInfo OPTIONAL. Accordingly, a PKCS#7 object only containing a Content Type OID is valid: SEQUENCE { OBJECT_IDENTIFIER { 1.2.840.113549.1.7.4 } } Deserializing such an object works and therefore streaming should at least have the decency of not segfaulting. Of course there's nothing decent about PKCS#7 be it the standard or its OpenSSL "implementation". Exercises a problem reported by Acts1361 and currently crashes. To be fixed in pk7_lib.c r1.32.
4 daysNID_communityDefinition, not NID_id_ad_communityDefinitiontb1-1/+1
4 dayslibssl: avoid narrowing return value in dtls1_ctrlkenjiro1-2/+2
dtls1_ctrl() and ssl3_ctrl() return long, but the intermediate return value was stored in an int. Use long to avoid truncating values returned by ssl3_ctrl(). CID 497395 From Yuji Hashimoto ok tb jsing
4 daysMake CRYPTO_cleanup_all_ex_data() a compatibility no-opkenjiro14-47/+93
The ex_data callback registry is process-wide, but this API could free it while other threads were still using libcrypto, resulting in a use-after-free. Retain the public symbol as a compatibility no-op and mark it deprecated. Move the actual cleanup to an internal function called by OPENSSL_cleanup(). Replace the in-tree callers with OPENSSL_cleanup() at final shutdown to preserve cleanup behavior and coverage. Document both APIs and the requirement that OPENSSL_cleanup() only be called after all threads and components have stopped using libcrypto. ok tb
5 dayslibssl: fix API misuse in legacy finished handlingtb2-4/+6
This looks like a potential out of bounds read or allowing trailing garbage in peer_finished. It's harmless because CBS_len() is compared against the s->s3->hs.peer_finished_len a few lines up, thus it is only cosmetic. discussed with jsing ok kenjiro
5 daysX509_STORE_CTX_get_error.3: zap extraneous iftb1-2/+2
5 daysX509_STORE_CTX_get_error: validate chain -> validated chain (of certificates)tb1-4/+4
5 dayslibssl: ensure server selected ALPN was advertisedtb1-6/+20
Per RFC 7301, section 3.2, "In the event that the server supports no protocols that the client advertises, then the server SHALL respond with a fatal "no_application_protocol" alert. If a server does not do that and chooses a protocol that we have not advertised, we should abort the handshake. The RFC does not specify an alert for this case. BoringSSL chose illegal_parameter and OpenSSL decode_error. I slightly prefer illegal_parameter, so went with that. Reported by Acts1631 with a similar diff. ok jsing kenjiro
5 daystlsext: check we reject unadvertised selected protocoltb1-1/+24
This test currently fails and will be fixed in ssl_tlsect.c r1.168
5 daystlsext_alpn_client_process(): rename list and prototb1-8/+8
Use server_list and selected instead of list and proto to reduce noise in the next commit. ok jsing kenjiro
7 daysrsa_eay: Replace handrolled BN_bn2binpad with the real thingtb1-19/+7
Just a tiny little bit of lipstick on this entelodont. This is simpler and does not change behavior as BN_bn2binpad() returns -1 on failure and num on success. jsing points out that BN_bn2binpad() is constant time. ok jsing kenjiro PS: henning, you owe me a significant amount of quality beverages for making me look at this particular tire fire (and corresponding XS files).
7 dayslibcrypto: harden cms_kek_cipher() a bittb1-3/+8
When AES key unwrap with padding is in use, the EVP interface breaks its contract and writes more than the outlen it initially reports to the output buffer. This is an old, sneaky trap that the muppet set eons ago and many victims walked right into it, including the muppet himself. If inlen is larger than outlen, allocate inlen bytes to unwrap with padding to avoid a buffer overwrite. This is a variant of OpenSSL's fix. Since we do not support AES keywrap with padding no actual bufer overwrite occurs here at the moment, but if we ever chose to do so (unlikely) this trap would be avoided. There's plenty more traps that the next round of scas will surely find in this absolute trashfire of CMS support code. ok kenjiro
8 daysDon't drop X509_V_ERR_HOSTNAME_MISMATCH when verify callback returns 1beck1-2/+5
While not the advised way of using the verify callback (either by OpenSSL or by us) in production, sometimes folks like to return 1 from everything in the callback and then check the error return and make decicions about things. This fix ensures that such callbacks will see the hostname mismatch and be able to act upon them. Reported by Alexander Aleksandrovic Klimov ok tb@
8 daysfix a double word; ok tb@jsg1-3/+3
9 daysICBB -> ICDBjsg1-3/+3
9 daysgrammar; a -> anjsg8-24/+24
ok schwarze@ sthen@ krw@
11 daysMake deprecation of ASN1_STRING_data(3) more prominenttb1-19/+22
The function has been deprecated for a long time: OpenSSL did so when adding ASN1_STRING_get0_data in 1.1.0. beck removed it from OpenSSL 4. The reason is that it returns a modifiable "string" and you should not be modifying an ASN1_STRING this way. You should be using one of the clumsy, inconvenient accessors. schwarze merged the deprecation when adding documentation for ASN1_STRING_get0_data() in 2018. Make this a bit more obvious: move function to the end of the documented functions in this page, and mark it deprecated in the SYNOPSIS, too. I'm aware that deprecation does not work. I was hopeful to be able to remove the function in the last cycle, but that did not happen and it might not happen in this cycle either. It will happen at some point, though. Prompted by a question by brad
11 daysgrammar; an program -> a programjsg1-3/+3
12 daysdocument MALLOC_OPTIONS=D output; OK otto@schwarze1-2/+72
13 daysRFC 8446 -> 9846tb1-2/+2
pointed out by kenjiro
13 daysChange RFC references from 8446 to 9846 and adjust section numberstb19-99/+97
with/ok kenjiro
13 daysSSL_get_finished: remove comment about TLSv1.0 and TLSv1.1tb1-4/+2
ok kenjiro
13 daysSimplify handling of remaining record content on switch to legacy stack.jsing1-35/+13
Now that the legacy stack uses struct tls_content, store any remaining record content directly, rather than fudging up a record that the legacy stack will process on the next read. ok kenjiro@ tb@
13 daysAllocate TLS 1.3 receive buffers lazilykenjiro1-14/+7
The receive buffer is not used for records created for sending. Avoid allocating a maximum-sized buffer in tls13_record_new() and instead allocate a header-sized buffer when tls13_record_recv() is first called. The buffer will grow as needed once the record length is known. This avoids an unnecessary allocation for outgoing records and reduces the initial allocation size for incoming records. ok tb jsing
14 daysupdate cert.pem based on newer mozilla ca root store, ok tb@sthen1-198/+192
2026-08-18s2i_ASN1_INTEGER.3: mark up second use of usr_data for consistencytb1-3/+5
2026-08-18libssl: use correct alert for key_share without supported_groupstb1-2/+2
Processing the key_share extension requires a supported_groups extension. RFC 9846, section 9.2 explicitly mandates a missing_extension alert in this situation, so use that instead of illegal_parameter. We do have code in tls13_client_hello_required_extensions() implementing the requirements on extensions of the relevant paragraph of that section with the corrrect alerts. The error in the extension processing happens before hitting these checks in this particular case. Reported by Tom Gouville of the tlspuffin team as part of https://github.com/libressl/portable/issues/1279 ok jsing kenjiro
2026-08-14SSL_CTX_new(): fix spelling of NULLtb1-3/+3
2026-08-11wycheproof: recognize Cobblestone-{128,256}tb1-1/+3
2026-08-10hdestroy(3): stop freeing key valuesdaniel2-46/+3
POSIX leaves ownership of ENTRY.key with the caller. Our current behaviour came from NetBSD when this code was imported in 2004. NetBSD and FreeBSD both stopped freeing key values in July 2014. NetBSD in commit fe0a1a6 and FreeBSD in commit e19f362. Remove the call to free(3) to align ourselves with NetBSD, FreeBSD and POSIX. Also adjust rsync for the change in semantics. Flagged by Sortix os-test. ok millert@, deraadt@
2026-08-10Check HMAC() return value to avoid a later use of uninitialized datakenjiro1-3/+7
CID 25423 ok tb@
2026-08-08switch aarch64 CPU feature detection to elf_aux_info()naddy1-63/+19
ok kettenis@ tb@ Restore commit; install media build error is not reproducible (deraadt@) or was operator error (naddy@)
2026-08-07Restore the OCSP no-check extension methodkenjiro2-2/+5
The conversion of X509V3_EXT_get_nid() from a table to a switch omitted the OCSP no-check extension method. Add the missing accessor declaration and switch case. ok tb@
2026-08-07revert switch to elf_aux_info(); it breaks the install medianaddy1-19/+63
2026-08-05OBJ_create: OBJ_add_objects -> OBJ_create_objectstb1-2/+2
2026-08-05Remove documentation of OBJ_add_object(3)tb1-39/+14
This API was removed a long time ago but I forgot to update the manpage (probably because doing so is slightly non-trivial). There's still a lot of API here that should be removed. OBJ_add_objects() seems now unused while OBJ_new_nid() is used by the one consumer that is single-handedly responsible for at least two dozen APIs that could otherwise be removed from libcrypto with significant simplifications: security/xca. It would appear the author is on a quest to figure out how to make use of whatever undocumented garbage they can find in the openssl headers. That's of course a hobby project you can pursue for decades.
2026-08-05Add missing Dv macro for NI_NUMERICSERV and NI_DGRAMclaudio1-4/+4
OK tb@
2026-08-04switch aarch64 CPU feature detection to elf_aux_info()naddy1-63/+19
ok kettenis@ tb@
2026-07-31callbackfailures: allow specifying the root certificate filekenjiro1-10/+11
Accept an optional roots file argument while retaining /etc/ssl/cert.pem as the default. This allows portable regress users to provide a CA bundle when the default path is unavailable. ok tb
2026-07-31Make file-local functions statickenjiro9-27/+27
These functions are only used within their implementation files and do not need external linkage. Mark them static. ok tb
2026-07-31Remove unused BUF_reverse()kenjiro1-22/+1
BUF_reverse() has no callers and is not part of the public API. Remove the unused function, which also eliminates its -Wmissing-prototypes warning. ok tb beck
2026-07-31Add missing internal header includeskenjiro25-25/+60
Include the relevant internal headers in implementation files that define internal functions. Also make asn1_local.h and pkcs12_local.h self-contained by including their corresponding public headers. ok tb beck
2026-07-29ocspcheck: make validate_response() static, it's only used in this filetb1-3/+2