feat(libSceLibreSsl3): implement ASN1_STRING_get0_data and ASN1_INTEGER_free #10452
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10452"
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 alvaroelpob on 2026-10-24T01:07:33Z.
What
Implements
ASN1_STRING_get0_dataandASN1_INTEGER_freein libSceLibreSsl3, which threw and were declared without parameters.The module is LibreSSL 4.0.0 (
OpenSSL_version(0)and the image string in the firmware 13.40 measurements in #8981). Signatures, theASN1_STRINGlayout and the results follow that release'sasn1.h,a_string.c,a_int.candtasn_fre.c.asn1_string_stis still public there.const unsigned char* ASN1_STRING_get0_data(const ASN1_STRING*)datavoid ASN1_INTEGER_free(ASN1_INTEGER*)ASN1_item_freewithASN1_INTEGER_itreachesASN1_STRING_free, it zeroes and freesdata(freezero) unlessASN1_STRING_FLAG_NDEF(0x10) is set, then frees the stringThe layout is
main's 24-byteAsn1String(length,type,dataat 8,flagsat 16), which libSceLibreSsl declares and asserts and the libSceLibreSsl3 header includes since #10948. Memory is released through the guestfree, as the module would through libc. The item free path takes the type fromASN1_INTEGER_it, not from the object, so a string of any type is freed the same way.These throw:
ASN1_STRING_get0_data, which LibreSSL dereferences;lengthwith non-null data inASN1_INTEGER_free, whichfreezerowould take as a hugesize_t.No export of this module creates a string yet, so for now only strings built by the caller reach these functions.
The debt entry records the source and what is unverified. The pending-export count drops from 84 to 82, and both names join the list of exclusions.
Tested
Ubuntu 26.04 (WSL2, kernel 6.18), GCC 15.2.0, Release, full build with
BUILD_TESTING=ONonmaine2b9700a9. There is one commit per function, and each adds that function with its test block and debt update. Each was built and itsguest_libressl3_asn1test andcheck_conventions.pyrun on its own.guest_libressl3_asn1_stringtest.ASN1_STRING_get0_datareturns the stored pointer, including null data and the NDEF flag, and a null string throws.ASN1_INTEGER_freeis checked on null and on positive, negative, empty and other-typed strings from the guest heap. An NDEF string leaves its data intact, and that data can then be freed by the caller. A negative length with data throws and frees nothing, and the same string is freed once the length is corrected. A negative length with null data frees only the string. Onmainthe first call throws.ctest -j16at the last commit: 2003/2004 pass.agc_driver_multisample_retirementfails the same way onmainon this machine.maine7e3e9c198, head 75ed618a28. The branch still merged cleanly, but after #10706public_headersfails on the merge: the exports kept their(void)stubs ininclude/Api.hppand the test redeclared them. 75ed618a28 (refactor(libSceLibreSsl3): declare the ASN.1 string exports in the public header) puts the real signatures and their structs inlibSceLibreSsl3/include/Api.hppand drops the test's redeclarations. Full build andctest -j16: 2202/2203 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.main6e775f452a, head bf3ab34c2f, to resolve the conflicts withmainon the sharedCMakeLists.txtand debt-file lines; both sides are kept and the count is 84 minus this PR's exports. Full build andctest -j16: 2268/2269 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.main74acfad65b(after #10948), head cac850c954, to resolve the conflicts withmainon the sharedCMakeLists.txtand debt-file lines; both sides are kept and the count is 83 minus this PR's exports. #10948 added aguest_libressl3_asn1test of its own, so this PR's test is nowguest_libressl3_asn1_string, renamed in the commit that adds it. New commit cac850c954 dropsLibreSslAsn1Stringand usesmain'sAsn1String, which the libSceLibreSsl3 header now includes; the duplicatestatic_asserts inAsn1.cppgo with it. Full build andctest -j16: 2431/2432 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.mainf2d874c1fd(after #10948, #13267, #13831, #13897 and #14171), head 328cb79364, to resolve the conflicts on the pending-export line of the debt file: the count and the exclusion list keepmain's names and add this PR's, and the count, 75, matches the stubs inExport.cpp. Full build andctest -j16: 3157/3157 pass.check_conventions.py --base upstream/mainpasses.main4939814d79(after #9535 and #9970), head d774dc3341, to resolve the conflicts on the sharedExport.cpp,Api.hppand debt-file lines; both sides are kept.mainsays 76 pending exports with 74 stubs left, so the count is set to the 72 stubs left inExport.cpp. Full build andctest -j16: 3538/3538 pass.check_conventions.py --base upstream/mainpasses.mainb11c7bf84f(after #10557), head b5d72c34ea, to resolve the conflicts on the sharedCMakeLists.txtand debt-file lines; both sides are kept,X509_PUBKEY_get0_paramstays in the exclusion list, and the count is set to the 71 stubs left inExport.cpp. Full build andctest -j16: 3883/3883 pass.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)Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-24T01:07:42Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T01:16:00Z.
Review: APPROVED
Reviewed the exact head and its two commits. The claimed LibreSSL 4.0.0 layout is consistent with the cited public header, and returns the data member directly. The path follows the cited item-free/string-free sequence: preserve NDEF data, otherwise zero and free the payload, then free the object through the guest allocator. The 24-byte layout assertions and focused tests cover ordinary, empty, NDEF, other-type, null, and negative-length cases. The PR identifies #9970 as a dependency, which is relevant because both changes touch the LibreSSL3 export/build/debt files. Hosted eligibility, conventions, intake, labels and report checks pass. The author reports 2003/2004 full CTest cases passing with the same multisample failure on base; I did not independently run that suite, and hosted product builds are skipped here. No blocking issue found in this scope.