feat(libSceLibreSsl3): implement d2i_ASN1_SEQUENCE_ANY #18284
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18284"
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 getuliobr on 2026-11-11T03:09:40Z.
What
Implements
d2i_ASN1_SEQUENCE_ANY(NIDvR0po3nBkBs) in libSceLibreSsl3, which decodes a DER/BERSEQUENCE OF ANYinto a stack ofASN1_TYPEvalues. It follows the LibreSSL 4.0.0 template decoder (tasn_dec.c,asn1_lib.c,asn1_types.c,a_object.c,a_int.c,a_enum.c,a_bitstr.c,a_string.c,a_time_tm.c), the revision the rest of this library follows:ASN1_STRING,ASN1_OBJECT, booleans and NULL; SEQUENCE, SET and non-universal classes kept in encoded form as upstream does (V_ASN1_OTHERfor the latter);ERR_R_MALLOC_FAILUREfrom item-created strings.The stub is removed from
AdditionalExports.cpp, the declaration gets the real signature, and the gaps are recorded indocs/dev/debt/libSceLibreSsl3.md.Tested
guest_libressl3_*tests pass, including the newguest_libressl3_asn1_sequence_any, which covers decoded values, indefinite lengths, 36 rejected encodings with their error codes, argument handling and every allocation failure.d2i_ASN1_SEQUENCE_ANY, built on macOS (x86-64 through Rosetta) from commitce488b78of the3rdparty/libressl-openbsdrepository, and this implementation returned identical values, consumed lengths and error-queue codes for 1,200,000 generated encodings (valid, malformed, truncated and mutated). Allocation failures were not part of that comparison.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)docs/dev/debt/libSceLibreSsl3.mdand adjacentCMakeLists.txtlines; this PR rebases after them)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-11T16:27:52Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
b50f3a3e7e:tools/check_conventions.pypassed;git diff --checkclean.guest_libressl3_asn1_sequence_any_testsbuilt cleanly.guest_libressl3_asn1_sequence_any):core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Generated withfooter from the description; the AI-assisted checkbox can stay.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T01:57:16Z.
Review: DISMISSED
Reviewed — changes requested
Changes are required before merge: fix the output stack cleanup so a failed decode does not free the caller’s existing stack.
What I ran
Reviewed head
177c94f91f7681c1fee61ad17ccc239cb75a05ba. No commands or tests were run. The author reports Linux tests and a differential check; those results were not independently run. No merged preview was checked.Results
Findings
Blocking
core/libs/prx/libSceLibreSsl3/src/Asn1SequenceAny.cpp:578callsFreeStack(value)and clears the caller’s output before validating or decoding the new input. If parsing or allocation then fails, the function returns null with the old stack already freed and*outputset to null. This violates the usuald2ireplacement behavior: failed decoding must leave the supplied object intact. Decode into a temporary stack and replace/free the old stack only after success.Non-blocking
None.
Not verified
AdditionalExports.cpp,CMakeLists.txt,include/Api.hpp,src/Asn1SequenceAny.cpp,tests/Asn1SequenceAny.cpp, anddocs/dev/debt/libSceLibreSsl3.md. No changed files were excluded in the manifest.To get this to a good state
Decode into a temporary stack, preserving the supplied output on failure; rerun the relevant tests on the updated head.