feat(libSceLibreSsl): implement X509_VERIFY_PARAM_set_hostflags and X509_VERIFY_PARAM_set1_ip_asc #11100
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11100"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by JaceTheBlu on 2026-10-25T17:33:10Z.
What
Implements
X509_VERIFY_PARAM_set_hostflagsandX509_VERIFY_PARAM_set1_ip_ascin libSceLibreSsl, which threw and were declared without parameters. Builds on the verify parameter layout from #11089, whose commit is the first one on this branch.void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM*, unsigned int)hostflags, replacing the previous valueint X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM*, const char*)a2i_ipadddoes: IPv6 when it holds a:, with::compression and a trailing dotted IPv4 part, otherwise IPv4 throughsscanf("%d.%d.%d.%d")with each part 0-255; copies the 4 or 16 bytes into amallocblock that replaces the previous address and its length, returns 1; returns 0 and keeps the previous address for text the parser rejects or a failed allocationBoth follow LibreSSL 2.5.4
x509_vpm.cand thea2i_ipadd,ipv4_from_asc,ipv6_from_asc,ipv6_cbandipv6_hexofv3_utl.cwithCONF_parse_listfromconf_mod.c. These functions and the parameter layouts are unchanged in LibreSSL 2.7 (OPENBSD_6_3), the first release whose symbols includeX509_VERIFY_PARAM_set1_hostandSSL_get0_param, which the module also exports (as #9448 notes). 2.8 appends apoisonedfield to the parameter identity; the debt entry records it. IPv4 parts are read with the guestsscanf, as the module would through libc, so its whitespace, sign and trailing-text handling carries over (" 1. 2.3.4"and"+1.2.3.4x"are accepted, as in LibreSSL).A null address text, and null verify parameters or identity once an address is accepted, throw where LibreSSL faults; a rejected address returns 0 before reading the parameters, as LibreSSL does. The pending-export count in
docs/dev/debt/libSceLibreSsl.mddrops from 342 to 340.Tested
Debian trixie container, GCC 14.2, full Release build.
ctest -R 'libressl|crypto_memcmp': 15 of 15 pass, including the newguest_libressl_x509_verify_param(host flags replaced, not ORed; IPv4 and IPv6 forms accepted and rejected with their exact bytes; a rejected address keeps the previous one; the throwing cases) andguest_libressl_x509_verify_param_allocator(onemallocper address, the previous one freed, a failedmallocreturning 0 and keeping the old address).tools/check_test_registration.py buildandpython3 tools/check_conventions.py --base upstream/mainpass. Not tested on Windows, on a title or on a console.Outside the repository, the address parser was compared with LibreSSL 2.5.4's own C code compiled next to it, both using the same
sscanf: 4,000,026 inputs (random strings over hex digits,:,., signs and spaces, generated IPv6 and IPv4 forms, and the edge cases above), 87,444 of them accepted, with no difference in result or bytes.tools/pr_overlap.pywas not run (no authenticatedgh).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T17:36:06Z.
Review: APPROVED
Reviewed exact head
887c9b6d5182b618a4d93a2c550c4f36b858deac. The new parameter/store layouts, flag propagation, and IPv4/IPv6 parsing follow the cited LibreSSL 2.5.4 sources; the address update allocates before replacing the previous value, and the reported allocator tests cover that failure path. The PR reports 15/15 focused CTests and a 4,000,026-input comparison against the pinned parser.git diff --check upstream/mainis clean. I could not independently configure the full local build because SDL2 development configuration (SDL2Config.cmake) is unavailable here; hosted product jobs are path-skipped, so the functional results are the author-reported focused run. The declared dependency on #11089 is appropriate.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T17:44:46Z.
Review: APPROVED
Re-reviewed exact head
2bafc417cc2630e51ffc89a7469a22f4505331a7. Compared with my prior reviewed head887c9b6d5182b618a4d93a2c550c4f36b858deac, all four changed source/test files have identical contents; the only delta is normalization of their executable file mode to regular files. The previously reviewed implementation and evidence therefore still apply. Current eligibility, conventions, labels, and report checks pass; product jobs are path-skipped. Approved at this exact head.