feat(libSceLibreSsl): implement X509_NAME_oneline #11359
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11359"
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-26T08:16:29Z.
What
Implements
X509_NAME_onelinein libSceLibreSsl, which threw and was declared without parameters. It is the second step towardsd2i_X509, whose decode callback storesX509_NAME_oneline(subject, NULL, 0)inx509_st.name.This branch is stacked on two open PRs and merges both, together with current
main:X509_NAME_get_entry,X509_NAME_ENTRY_get_data,X509_NAME_get_index_by_NID,X509_NAME_get_text_by_NID, on #10477's name structures), merged at its current heade0af928fe;i2t_ASN1_OBJECT), now merged intomain.Merge #11129 first; this PR's own diff is then only
X509_NAME_oneline, its test and its debt entry.X509_NAME_onelineis added at the end of #11129'ssrc/X509Name.cpp, uses theLibreSslStack,LibreSslX509NameEntryandLibreSslX509Nametypes fromApi.hpp, and reads each entry through #11129'sX509_NAME_get_entry. Its tests areguest_libressl_x509_name_onelineandguest_libressl_x509_name_oneline_allocator(tests/X509NameOneline.cpp), so they do not collide with #11129'sguest_libressl_x509_name.char* X509_NAME_oneline(X509_NAME* a, char* buf, int len)follows LibreSSL 2.5.4x509_obj.c:/SN=value: the short name comes from the object table (OBJ_obj2nidthenOBJ_nid2sn), and an unknown or unassigned NID falls back toi2t_ASN1_OBJECTinto an 80-byte scratch buffer, so an unassigned NID reportsOBJ_R_UNKNOWN_NIDfrom each lookup as in LibreSSL;' '..'~'are written as\xHH; aGeneralStringwhose length is a multiple of four and whose non-zero bytes all sit at offset 3 of each group keeps only those bytes, any other value keeps every byte;len - 1bytes are kept and the first that does not fit ends the text; a null name gives"NO X509_NAME"truncated asstrlcpydoes, and no entry gives""(even forlen0);BUF_MEMexactly as 2.5.4buffer.c((len + 3) / 3 * 4) andrecallocarraydo, starting at 200 bytes; the returned block is the guest's to free. A failed allocation returns null after theBUFand then theX509malloc errors, and frees what it allocated.A null entry, an entry without a value, and a value without data behind a positive length throw where LibreSSL faults. The debt entry records this, and the pending-export count is recounted from
Export.cpp.Tested
Debian trixie container, GCC 14.2, full Release build of head
157f00e75(currentmain801d5b9bc, #11129 and #11261 merged).ctest -R 'libressl|crypto_memcmp': 28 of 28 pass, including #11129'sguest_libressl_x509_name, #11261'sguest_libressl_object_textandguest_libressl_object_allocation, and this PR'sguest_libressl_x509_name_oneline(null names, empty and missing entry stacks, short names, every truncation point of a caller buffer,len0, escapes, theGeneralStringfilter and its non-cases, unknown and unassigned OIDs with their error-queue entries, a null object, text past the first 200 bytes, the throwing cases) andguest_libressl_x509_name_oneline_allocator(the 24-byte header, 268 bytes for the first 200 and 612 for the grown text, the frees, and each of the three allocations failing).tools/check_test_registration.py buildandpython3 tools/check_conventions.py --base upstream/mainpass. Not tested on Windows by me (see the Windows run in the comments for the earlier head), on a title or on a console.Outside the repository, this function was compared with 2.5.4's own
X509_NAME_oneline,BUF_MEM_new/grow/freeandrecallocarray, compiled next to it with 2.5.4's object functions: 300,000 random names (0 to 6 entries; table, random, unassigned, null and empty objects; eight string types; zero, high and printable bytes up to 120 long; missing entry stacks and null names; caller buffers of -3 to 316 bytes or none), comparing the returned pointer, every byte of the caller buffer or the allocated text, and the number of errors reported. No difference, rerun on this head.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T08:43:17Z.
Review: CHANGES_REQUESTED
I reviewed exact head
0cffc3c5a049b1eebadf32235364d3de05e4ca08. The implementation and test report are substantial, but the current overlap state needs an explicit integration plan before this can be approved.#11129 is open and implements the sibling
X509_NAME_*operations in the same newly addedsrc/X509Name.cpp, with shared changes toExport.cpp,Api.hpp, CMake and the LibreSSL debt file. A pairwisegit merge-treeof the current #11129 and #11359 heads conflicts inExport.cpp,Api.hpp,src/X509Name.cpp(add/add), anddocs/dev/debt/libSceLibreSsl.md. #11359's checklist currently says no other open PR implements the same functions and lists only #11261 as a dependency; that does not capture this shared-file integration requirement. Please coordinate an order with #11129's author, update the dependency/overlap details, and rebase or split the oneline implementation so both implementations and tests are retained. #11261 is still open and is the stated dependency; #11261 and #11129 merge-preview clean in code, with only a debt-file conflict.The current head is 4 commits ahead and 302 behind
main204c6747d0a1cbaf932def3dea0778810cc3935e. After the agreed stack is assembled on current main, rerun the LibreSSL X509 name and allocation tests, conventions, and overlap checks on the resulting exact head. Existing hosted policy checks pass; product/build jobs are path-skipped. I have not independently run the reported 300,000-case LibreSSL differential harness.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T10:04:12Z.
Review: CHANGES_REQUESTED
Re-checked — new head, changes requested
The earlier integration fix uses an older #11129 head; merging the two current PR heads still conflicts in four shared files.
What I ran
Re-checked #11359 at head
35f4b078afdcbb2b68d3f33f8ab22e01877c0ab4, against its recorded basec3c45d73abd34dca81da6bad87cb6d36ea437a66. Currentmainwas45f4f82449a72e31aa9fd3120bd82820211dea41; both PRs preview cleanly against it individually. The current #11129 dependency head ise0af928fe934ca43d5b35aa8ac548e7e67eab4d1, and #11359 does not include that head. Environment: Linux, Python 3.11.2; no C/C++ compiler or build was run.Results
45f4f82449a72e31aa9fd3120bd82820211dea41.e0af928fe934ca43d5b35aa8ac548e7e67eab4d1is not included in #11359 head35f4b078afdcbb2b68d3f33f8ab22e01877c0ab4; #11261 is already merged.core/libs/prx/libSceLibreSsl/CMakeLists.txt,Export.cpp,include/Api.hpp, anddocs/dev/debt/libSceLibreSsl.md.Relevant raw output
Findings
Blocking
The branch includes #11129's earlier head
6fb16fdc1, but the live #11129 head has since added X509 name accessors and changed the same build, export, public-header and debt files. A merge preview of the exact current heads reports content conflicts in four files, so the declared integration order is not currently usable as posted. Please merge the live #11129 heade0af928fe934ca43d5b35aa8ac548e7e67eab4d1into this branch and resolve the shared files while retaining both PRs' implementations and tests. Since #11261 is merged, update the dependency checklist to reflect the remaining open dependency. I will rerun the same checks on the resulting head.Non-blocking
The author reports a full Release build, 28/28 selected CTest cases, registration and convention checks, and a 300,000-case LibreSSL differential comparison on this head; I did not independently run those checks.
Sources
Not verified
No local build or CTest was run. Windows CI was still in progress at the final refresh; Linux and specialized CI jobs were skipped. The author's reported differential and test results were read from the PR discussion, not independently reproduced.
To get this to a good state
Integrate the current #11129 head, resolve the four shared-file conflicts while preserving both changes, and update the dependency line because #11261 is merged. I will rerun these checks on the updated head.