Commit Graph
31 Commits
Author SHA1 Message Date
JaceTheBlu 918b7792b9 Merge feat/libressl-verify-param-ip into feat/libressl-x509-lookup
# Conflicts:
#	core/libs/prx/libSceLibreSsl/include/Api.hpp
#	docs/dev/debt/libSceLibreSsl.md
2026-10-28 08:51:21 +00:00
JaceTheBlu 6886f61ade Merge feat/libressl-x509-store into feat/libressl-verify-param-ip
# Conflicts:
#	docs/dev/debt/libSceLibreSsl.md
2026-10-28 08:32:48 +00:00
JaceTheBlu 3b43b785e4 Merge upstream/main into feat/libressl-x509-store
# Conflicts:
#	core/libs/prx/libSceLibreSsl/CMakeLists.txt
#	core/libs/prx/libSceLibreSsl/include/Api.hpp
#	docs/dev/debt/libSceLibreSsl.md
2026-10-28 08:32:47 +00:00
JaceTheBluandClaude Opus 5.5 983eea3d71 test(libSceLibreSsl): stop asserting that guest lookup callbacks throw
Drop the duplicated older X509_STORE debt entry left by a merge.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 08:32:23 +00:00
Adrià 771d8b5bf7 Merge pull request #11340 from harisibrar1/feat/libressl-ex-data-indices
feat(libSceLibreSsl): implement the SSL and SSL_CTX ex_data index registry as LibreSSL 2.5.4 does
2026-10-27 21:34:00 +01:00
Adrià 9de9c6efd0 Merge pull request #11261 from JaceTheBlu/feat/libressl-object-text
feat(libSceLibreSsl): add the LibreSSL object table and implement i2t_ASN1_OBJECT
2026-10-27 14:07:27 +01:00
JaceTheBlu 07de66a1a3 Merge feat/libressl-x509-store into feat/libressl-x509-lookup
# Conflicts:
#	docs/dev/debt/libSceLibreSsl.md
2026-10-27 08:48:03 +00:00
JaceTheBlu 884dbd5f45 Merge feat/libressl-x509-store into feat/libressl-verify-param-ip
# Conflicts:
#	docs/dev/debt/libSceLibreSsl.md
2026-10-27 08:48:02 +00:00
JaceTheBlu b9ec709d47 Merge upstream/main into feat/libressl-x509-store
# Conflicts:
#	core/libs/prx/libSceLibreSsl/CMakeLists.txt
#	docs/dev/debt/libSceLibreSsl.md
2026-10-27 08:48:01 +00:00
JaceTheBluandClaude Opus 5.5 397b8d6a1b test(libSceLibreSsl): prime the unwinder before counting object text blocks
On Linux the first exception the allocation test throws goes through
libc's unwinder, which caches two frame descriptions with operator new
for the rest of the process. The test counted them as blocks leaked by
i2t_ASN1_OBJECT and failed every fault case. A first failing conversion
now runs before the counted cases, and the blocks it leaves are not
tracked. Against the head before the allocation fix the test still
reports the escaped exceptions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 08:30:25 +01:00
thepoppfish 17693e0e00 fix(libSceLibreSsl): handle object text allocation failures 2026-10-27 08:30:25 +01:00
JaceTheBluandClaude Opus 5.5 c6522d4bce feat(libSceLibreSsl): add the LibreSSL object table and implement i2t_ASN1_OBJECT
i2t_ASN1_OBJECT threw and was declared without parameters. It now
prints an object's long name, or its short name, or its dotted OID, as
OBJ_obj2txt does in LibreSSL 2.5.4, the version string the module
holds: the NID is the object's own or found by the same binary search
over the same order, an unassigned NID reports OBJ_R_UNKNOWN_NID for
each name lookup, a truncated subidentifier returns 0 after the parts
already written, and arcs past 64 bits are printed exactly.

The 956 objects (short and long names, NID, OID) and their search order
are generated from 2.5.4's objects.txt and obj_mac.num with its own
objects.pl and obj_dat.pl, so d2i code can later hand out the same
static objects LibreSSL does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 08:30:25 +01:00
harisibrar1 c51456ab71 Merge remote-tracking branch 'origin/main' into feat/libressl-asn1-string-to-utf8
# Conflicts:
#	docs/dev/debt/libSceLibreSsl.md
2026-10-26 09:53:00 -04:00
harisibrar1andClaude Opus 5.5 a0b14febf9 fix(libSceLibreSsl): declare the ex_data callbacks as LibreSSL's function pointer types
SSL_get_ex_new_index and SSL_CTX_get_ex_new_index took the new, dup and
free callbacks as void*, which a caller passing real callbacks can't
convert to. They now take LibreSslExNew, LibreSslExDup and
LibreSslExFree, the guest-ABI forms of CRYPTO_EX_new, CRYPTO_EX_dup and
CRYPTO_EX_free from LibreSSL 2.5.4's ossl_typ.h. Reported by @MarcZX10.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 09:50:54 -04:00
harisibrar1 a6a5834b05 Merge remote-tracking branch 'origin/main' into feat/libressl-ex-data-indices 2026-10-26 09:50:11 -04:00
JaceTheBlu fb1b33078d Merge feat/libressl-verify-param-ip into feat/libressl-x509-lookup
# Conflicts:
#	core/libs/prx/libSceLibreSsl/CMakeLists.txt
#	docs/dev/debt/libSceLibreSsl.md
2026-10-26 07:58:53 +00:00
JaceTheBlu f1b8f59388 Merge feat/libressl-x509-store into feat/libressl-verify-param-ip 2026-10-26 07:58:07 +00:00
JaceTheBluandClaude Opus 5.5 323a528c52 test(libSceLibreSsl): stop asserting that valid X509_STORE states throw
The store test asserted that comparing two cached objects and freeing a
store that holds certificates, lookup methods or policy objects throw.
Those states are valid on the console and the throws are placeholders
until the objects are modelled, so the assertions would fail once they
are. The null store, missing verify parameters and null element array
cases stay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 07:57:38 +00:00
harisibrar1andClaude Opus 5.5 d77777a94b feat(libSceLibreSsl): implement the SSL and SSL_CTX ex_data index registry as LibreSSL 2.5.4 does
SSL_get_ex_new_index and SSL_CTX_get_ex_new_index number their indices
per class from 0, SSL_get_ex_data_X509_STORE_CTX_idx allocates its
class-5 index once, and CRYPTO_cleanup_all_ex_data releases every class.
An allocation failure returns -1 with ERR_R_MALLOC_FAILURE queued.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 00:24:32 -04:00
harisibrar1andClaude Opus 5.5 d2bb979ffc fix(libSceLibreSsl): convert ASN1_STRING_to_UTF8 in two passes
Validate the string and count its UTF-8 size first, then make the one
guest allocation and write into it, so no std::vector can throw
std::bad_alloc past the guest. Approach from @thepoppfish's review.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 19:33:36 -04:00
JaceTheBluandClaude Opus 5.5 36c5e3126b fix(libSceLibreSsl): refuse unsupported lookup methods before allocating
X509_STORE_add_lookup allocated the lookup before it threw for a null
method or a guest new_item callback, so each caught refusal left one
guest heap block behind. Both checks now run before the allocation, and
the allocator test checks that a refused method allocates nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 21:12:16 +00:00
mantavisualandClaude Opus 5.5 d003153f53 fix(libSceLibreSsl): reject null strings in the ASN.1 accessors as invalid arguments
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 19:52:58 +02:00
JaceTheBluandClaude Opus 5.5 e8d6c3fb47 feat(libSceLibreSsl): implement X509_LOOKUP_file and X509_STORE_add_lookup
Both exports threw and were declared without parameters. They follow
LibreSSL 2.5.4, unchanged in 2.7: X509_LOOKUP_file returns the static
80-byte file method, and X509_STORE_add_lookup returns the store's
lookup for a method, or mallocs a 32-byte lookup owned by the store and
pushes it on the store's methods, growing the stack the way sk_insert
does. X509_STORE_free now frees the store's lookups.

The file method's ctrl, which loads PEM files, throws: there is no
certificate model yet. Callbacks of guest-supplied methods throw
instead of being called.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 17:37:22 +00:00
JaceTheBluandClaude Opus 5.5 2bafc417cc feat(libSceLibreSsl): implement X509_VERIFY_PARAM_set_hostflags and X509_VERIFY_PARAM_set1_ip_asc
Both exports threw and were declared without parameters. They follow
LibreSSL 2.5.4, unchanged in 2.7: set_hostflags stores the host
matching flags in the verify parameters' identity, and set1_ip_asc
parses an IPv4 or IPv6 address the way a2i_ipadd does, copies the 4 or
16 bytes into a guest malloc block that replaces the previous address,
and returns 0 without touching it for text the parser rejects. IPv4
parts are read with the guest sscanf, as the module would.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 17:37:05 +00:00
JaceTheBluandClaude Opus 5.5 a2d4d38a15 feat(libSceLibreSsl): implement X509_STORE_new, X509_STORE_free and X509_STORE_set_flags
The three exports threw and were declared without parameters. They now
follow LibreSSL 2.5.4, the version the firmware 13.40 measurements
identify: X509_STORE_new allocates the 136-byte store with an empty
object cache, an empty lookup method stack and 64-byte verify
parameters at depth -1, X509_STORE_free drops a reference and frees the
store with its stacks, verify parameters and their host names, peer
name, email and IP, and X509_STORE_set_flags ORs the flags into the
verify parameters and adds the policy check for any policy flag.

No export adds certificates, CRLs or lookup methods yet, so freeing a
store that holds them, or verify parameters holding policy objects,
throws instead of freeing objects with no model.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 17:37:05 +00:00
harisibrar1andClaude Opus 5.5 42a02f54f0 feat(libSceLibreSsl): report ASN1_STRING_to_UTF8 errors through the ASN.1 error queue as LibreSSL 2.5.4 does
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 10:58:50 -04:00
AZLisme 6098cf2e64 fix(libSceLibreSsl): share public ASN.1 declarations 2026-10-25 10:19:22 +08:00
AZLisme 931efc838c fix(libSceLibreSsl): handle minimum signed ASN.1 integer 2026-10-25 10:19:22 +08:00
AZLisme 2174031ae5 test(libSceLibreSsl): avoid pinning unfinished error reporting 2026-10-25 10:19:15 +08:00
AZLisme caa81ac8e7 test(libSceLibreSsl): pin legacy integer length behavior 2026-10-25 10:19:15 +08:00
AZLisme abd16e771d feat(libSceLibreSsl): implement ASN.1 integer and string helpers 2026-10-25 10:19:06 +08:00