Repository navigation
feat(libSceLibreSsl): implement X509_NAME_get_entry and X509_NAME_ENTRY_get_data - #10477
alvaroelpob wants to merge 5 commits into
Conversation
Progress report (d23df92 → 6bf0609)📈 System libraries: 26.7% (+0.01%, +2 implemented functions) ✅ 2 implemented
Changed libraries (implemented exports)
|
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
ad8911f to
448392a
Compare
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed both X509_NAME accessors against the cited LibreSSL 2.5.4 layouts and stack behavior. The entry-count/data-array checks preserve the null/out-of-range behavior described, and the data getter returns only the entry's value field; the focused tests cover boundary and null-slot cases. The current head merges cleanly with upstream main; conventions and diff checks pass. I compiled and ran GuestLibreSslX509Name.cpp with X509Name.cpp directly using GCC 12.2.0; it passed. The broader Linux suite is author-reported; hosted product jobs are skipped.
448392a to
73b11e7
Compare
|
Rebased on |
ahmadmuj
left a comment
There was a problem hiding this comment.
Reviewed head d63afe313c, merged locally onto main 7a25f87620. Linux, GCC 13.3, Release.
What I ran:
guest_libressl_x509_nameon the merged tree: pass.- Mutation controls, one at a time on
X509Name.cpp: main's stub bodies,num < locinstead ofnum <= loc, noloc < 0check, andentry->objectinstead ofentry->value. The test fails on each. - Layout probe against LibreSSL 2.5.4 built from the release tarball (sha256
107a5b52..., matches the published SHA256): every field ofX509_NAME,X509_NAME_ENTRYand_STACKhas the same offset and size asLibreSslX509Name,LibreSslX509NameEntryandLibreSslStack(40/24/32 bytes).OPENSSL_NO_BUFFERonly switchesbytesbetween two pointer types. - Differential: I dlopened the merged
libSceLibreSsl.prxand passed real 2.5.4X509_NAME*values straight to both exports. I compared them with 2.5.4's own calls forlocinINT_MIN, -2, -1, 0..count+1, INT_MAX, andget_dataon every entry. The names were a null name, an empty name, API-built names (multi-valued RDNs, 40 entries, 38 after deletes) and subjects/issuers parsed from DER certs with 1, 3, 6 (multi-valued) and 11 entries. 363 comparisons, 0 mismatches. num > 0with a nulldataarray: 2.5.4 segfaults forloc0..num-1 and returns NULL outside that range. This PR throws for the samelocvalues and returns NULL for the rest. That matches the debt entry.
Sources: 2.5.4 x509name.c X509_NAME_get_entry / X509_NAME_ENTRY_get_data, stack.c sk_num / sk_value, x509.h, stack.h.
LGTM. One heads-up: the branch now conflicts with main in docs/dev/debt/libSceLibreSsl.md only. Main reworded the MD4..SHA512 entry next to your count line, so CI needs a merge first.
Not checked: the console, and whether the module really is 2.5.4. I relied on the #8981 measurement for that, as the debt entry does.
d63afe3 to
b976726
Compare
63a6ee7 to
1fe82b5
Compare
1fe82b5 to
856f9fd
Compare
856f9fd to
886b309
Compare
886b309 to
2417a2f
Compare
|
Rebased onto main 4f41f4c and recomputed the debt counter. Build, |
2417a2f to
d0ebffd
Compare
d0ebffd to
4da8e01
Compare
|
@MarcZX10 Rebased on |
|
Hi @alvaroelpob, thanks for this. Your three commits ( |
What
Implements
X509_NAME_get_entryandX509_NAME_ENTRY_get_datain 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.h,x509name.candstack.c:X509_NAME_ENTRY* X509_NAME_get_entry(X509_NAME*, int loc)loc, a null entry stack (sk_numis -1) orloc >= num; otherwiseentries->data[loc]ASN1_STRING* X509_NAME_ENTRY_get_data(X509_NAME_ENTRY*)valueThe layouts are 40 bytes for
X509_NAME(entriesat 0), 24 forX509_NAME_ENTRY(object,value,set,size) and 32 for_STACK(num,data,sorted,num_alloc,comp). They were checked withstatic_asserts and againstoffsetoffrom the 2.5.4 headers compiled on x86-64. A positive entry count with a null entry array, which LibreSSL dereferences, throws. No export of this module creates a name yet, so for now only names built by the caller reach these functions.The 2.5.4
_STACKlayout ismain'sLibreSslStackfrom #10373. This PR reads it through that struct and changes none of thesk_*exports.The debt entry records the source and what is unverified, and the pending-export count drops from 357 to 355.
Tested
Ubuntu 26.04 (WSL2, kernel 6.18), GCC 15.2.0, Release, full build with
BUILD_TESTING=ONonmaindb6af9e. There is one commit per function, and each adds that function with its test block and debt update. Each was built and itsguest_libressl_x509_nametest andcheck_conventions.pyrun on its own.guest_libressl_x509_nametest.X509_NAME_get_entryreturns null for a null name, a null entry stack, indexes -1,INT_MIN,INT_MAXandnum, and an empty stack. It returns the first and second entries of a two-entry stack, and a null slot as null. A null entry array throws, unless the index is out of range.X509_NAME_ENTRY_get_datareturns null for a null entry or a null value, and otherwise the value, whateverobjectandsethold.ctest -j16at the last commit: 2005/2006 pass.agc_driver_multisample_retirementfails the same way onmainon this machine.main1e740a2 (after feat(libSceLibreSsl): implement the low-level AES functions #9033), head 448392a: the conflicts were only theadd_librarysource list, the end of the test block, the pending-export count and the last debt entry; both sides are kept and the count is 357 minus this PR's exports. Full build andctest -j16: 2043/2044 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.maine7e3e9c, head 73b11e7, to resolve the conflict from feat(libSceLibreSsl): implement the per-thread error queue #9529 on the sharedCMakeLists.txtand debt-file lines; both sides are kept and the count is 353 minus this PR's exports. 73b11e7 (refactor(libSceLibreSsl): declare the X509_NAME exports in the public header) puts the real signatures and their structs inlibSceLibreSsl/include/Api.hppand drops the test's redeclarations, whichpublic_headersrequires since refactor(libs): add full export headers for libs #10706. Full build andctest -j16: 2202/2203 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.mainae7d592 (after feat(libSceLibreSsl): implement the OCSP status and reason strings #9949), head aa4fd17, to resolve the conflicts withmainon the sharedCMakeLists.txtand debt-file lines; both sides are kept and the count is 342 minus this PR's exports. Full build andctest -j16: 2275/2276 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.main88795ed (after feat(libSceLibreSsl): implement the CRYPTO locking and thread id callbacks #10248; head 06e8626) to resolve the conflicts on the shared debt-file lines; both sides are kept and the count is 335 minus this PR's exports. Full build andctest -j16: 2383/2384 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.mainc7b4878 (after feat(libSceLibreSsl): implement sk_num, sk_value, sk_pop and sk_pop_free #10373, feat(libSceLibreSsl): implement UI_METHOD creation and its opener, writer, reader and closer accessors #10376 and feat(libSceLibreSsl): implement RSA_flags and RSA_size #10449), head 0d079a6, to resolve the conflicts withmainon the sharedCMakeLists.txt,Api.hppand debt-file lines; both sides are kept and the count is 319 minus this PR's exports. The rebase drops this PR's copy ofLibreSslStackfromApi.hpp, and its twostatic_asserts inX509Name.cpp, sincemainnow declares the same struct (withcomptyped asStackCompare) and asserts its layout inStack.cpp. Full build andctest -j16: 2394/2395 pass;agc_driver_multisample_retirementfails the same way on thatmain, andguest_pthread_starttimed out once at 20 s while another full suite shared the machine; run alone with--repeat until-fail:3it passes 3/3 in about 2 s.check_conventions.py --base upstream/mainpasses.main474030e (after feat(libSceLibreSsl): implement OBJ_create and free added objects in OBJ_cleanup #13562), head 63a6ee7, to resolve the conflict on the pending-export count in the debt file; the count is 292 minus this PR's exports. Full build andctest -j16: 3062/3062 pass.check_conventions.py --base upstream/mainpasses.maincf79276 (after fix(libSceLibreSsl): preserve SHA-512 initialization buffers #13820), head 1fe82b5, to resolve the conflict on the pending-export count in the debt file.mainstill says 292 although fix(libSceLibreSsl): preserve SHA-512 initialization buffers #13820 removed two stubs, leaving 290, so the count is now set to the 288 stubs left inExport.cpp. It also restores the PS5 3.20 export table link,b2a77c09cd71c01f34c790cfbe98c751a13262ad, which the previous rebase had written without its zeros. Full build andctest -j16: 3107/3107 pass (log_filefailed once on feat(libSceLibreSsl): implement UI_get0_user_data, UI_get_string_type and UI_get_input_flags #10486 and passed on five reruns and a second full run).check_conventions.py --base upstream/mainpasses.main4939814 (after feat(libressl3): report OpenSSL version strings #9970, feat(libressl): implement X509 extension getters #10078 and feat(libSceLibreSsl): implement EVP_CIPHER_CTX_init, EVP_CIPHER_CTX_new and EVP_CIPHER_CTX_set_padding #10488), head 886b309, to resolve the conflicts on the sharedCMakeLists.txt,Export.cpp,Api.hppand debt-file lines; both sides are kept. The count is set to the 259 stubs left inExport.cpp. Full build andctest -j16: 3538/3538 pass.check_conventions.py --base upstream/mainpasses.main4f41f4c, head 2417a2f, to resolve the conflicts on the sharedCMakeLists.txt,Export.cppand debt-file lines; both sides are kept and the debt count is recomputed fromExport.cpp. Full build andctest -j16: 3796/3800 pass;guest_sce_net,guest_poll,guest_select_waitandguest_memoryfailed under that load, pass when run alone, andmain4f41f4c passes all 3799 with-j16on the same machine.check_conventions.py --base upstream/mainpasses.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)