feat(libSceLibreSsl): implement X509_STORE_new, X509_STORE_free and X509_STORE_set_flags #11089
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11089"
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:24:38Z.
What
Implements
X509_STORE_new,X509_STORE_freeandX509_STORE_set_flagsin libSceLibreSsl, which threw and were declared without parameters.The module is LibreSSL 2.5.4 (firmware 13.40 measurements in #8981). Signatures, layouts and results follow that release's
x509_vfy.h,vpm_int.h,x509_lu.candx509_vpm.candstack.c, checked withstatic_asserts on LP64:X509_STORE* X509_STORE_new(void)mallocs the 136-byte store;cache1,references1, callbacks and ex_data null; the object cache is an empty 32-byte stack (4 null slots) with a comparator, the lookup methods an empty stack without one; the 64-byteX509_VERIFY_PARAMand its 56-byteX509_VERIFY_PARAM_IDarecalloced withdepth-1. A failed parameter allocation frees what was allocated and returns null, asx509_lu.cdoesvoid X509_STORE_free(X509_STORE*)int X509_STORE_set_flags(X509_STORE*, unsigned long)X509_V_FLAG_POLICY_CHECK(0x80) when any policy flag (mask 0x780) is set, returns 1Every block comes from the guest
malloc,callocandfree, as the module would through libc.No export of this module adds a certificate, CRL, lookup method or policy object yet, so
X509_STORE_freethrows when the object cache holds a non-null entry, a lookup method is listed or the verify parameters hold a policy object, instead of freeing objects there is no model for; the object cache's comparator throws for the same reason. A null store or verify parameters inX509_STORE_set_flags, a null parameter identity and a null element array behind a positive count throw where LibreSSL faults. These limits are indocs/dev/debt/libSceLibreSsl.md, and the pending-export count there drops from 345 to 342.The 32-byte stack layout is declared privately in
X509Store.cpp, so this does not depend on #10373, which declares the same layout inApi.hppforsk_num,sk_value,sk_popandsk_pop_free; whichever merges second can share that declaration.Tested
Debian trixie container, GCC 14.2, full Release build.
ctest -R 'libressl|crypto_memcmp': 13 of 13 pass, including the newguest_libressl_x509_store(every initial field, flag accumulation and the policy check, all 64 flag bits, shared references, freeing host names, peer name, email, IP and ex_data, and the throwing cases) andguest_libressl_x509_store_allocator(5mallocs and 2callocs per store, 7frees, and both failedcallocs releasing everything).tools/check_test_registration.py buildandpython3 tools/check_conventions.py --base upstream/mainpass. Not tested on Windows, on a title or on a console.tools/pr_overlap.pywas not run (no authenticatedgh); instead this branch was merged withgit merge-treeagainst the 48 open LibreSSL pull requests. Code only conflicts with #9571 and #9535 (Api.hpp), which already conflict withmain; the rest conflict only on the pending-export count in the debt file.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:29:44Z.
Review: APPROVED
Reviewed the added ABI layouts and allocator paths against LibreSSL 2.5.4 at the cited source revision.
X509_STORE_newinitializes the fields and four-slot stacks assk_newdoes, the policy flag mask matchesX509_V_FLAG_POLICY_MASK, and reference decrement/cleanup followX509_STORE_free. The unsupported nonempty certificate/CRL, lookup-method and policy paths throw before freeing data the project does not model, as the debt entry says.The PR reports a focused Debian trixie/GCC 14.2 run with 13/13 relevant CTests, including allocation-failure cleanup and the new store tests. Exact-head eligibility, conventions, intake, labels and report checks pass; hosted product jobs are skipped by path policy. Approved.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T18:26:21Z.
Review: APPROVED
Reviewed exact head
a2d4d38a1584e6b12e750ebd90df3393cb829661. The pinned LibreSSL 2.5.4 source confirms theX509_STOREinitialization fields, verify-parameter defaults (depth = -1), reference decrement/free path, and policy-flag propagation. The implementation preserves the source’s unsupported-object boundaries by throwing for populated stacks without a model. I compiledX509Store.cppand its test with GCC 12.2 (-std=c++20 -Icore/libs -fsyntax-only); conventions andgit diff --check upstream/main...HEADpass. The author reports a full Release build and 13/13 focused CTests on Debian trixie; hosted product jobs are skipped by path policy, and I did not rerun that full suite here. I also confirmed #10373 has no code conflict with this PR; the shared debt file needs coordinated resolution as noted in my comment.