feat(libSceLibreSsl3): implement ASN.1 value mutation and octet lifetime #14889

Merged
Noxy-HNR merged 14 commits from upstream-pr/14889 into main 2026-11-07 12:41:40 +00:00
Noxy-HNR commented 2026-11-01 22:46:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Noxy-HNR on 2026-11-01T22:46:57Z.


What

Four newly named LibreSSL3 exports currently throw: ASN1_STRING_set, ASN1_INTEGER_set, ASN1_OCTET_STRING_cmp and ASN1_OCTET_STRING_free. Implement binary/NUL-terminated string replacement, full signed 64-bit integer magnitudes, octet comparison and owned/borrowed buffer destruction through the application heap.

Contracts come from LibreSSL 4.0.0 a_string.c, a_int.c and a_octet.c, using the existing 24-byte guest Asn1String. Owned data is erased before release; NDEF string buffers remain borrowed. Invalid native dereference/overflow/alias cases throw. Console ABI and behavior are unverified; the debt entry also records the integer allocator's difference from LibreSSL's CBB allocation chain. No title unblock is claimed.

Tested

Current head e971edaa96 is a maintainer merge of main 9ade3ed806 into 23f56dae04. The ASN.1 implementation and regression test are byte-for-byte unchanged; the maintainer commit and its identity are preserved. The current-head Windows job now passed. Its log identifies e971edaa9696 and shows ASN.1 value, ASN.1 decoder, ASN.1 string and session-metadata runtime tests passing. It reports zero failures among 3,436 selected CTest entries, including skipped entries; this is not a separate full Linux run. Local results below retain their original head and scope.

Historical local verification (23f56dae04): merged main 6beaeef052 without force-pushing; the only manual conflict resolution was the debt inventory. The ASN.1 implementation and regression test are unchanged. Windows 11 x86-64, WinLibs GCC 15.2.0/Ninja, Release, -j 18: rebuilt the real modules and all four focused ASN.1 targets; guest_libressl3_asn1_values, guest_libressl3_asn1, guest_libressl3_asn1_string and guest_libressl3_asn1_object all passed in each of three runs. Conventions and whitespace checks pass. Current-head hosted checks are pending.

Historical hosted verification (973e270f90): the Windows changed-test job passed; guest_libressl3_asn1_values, both ASN.1 decoders and the allocator regression passed. The job reports zero failures among 3,337 selected CTest entries, including skipped entries. Its log identifies this exact PR head. This is not a fresh full Linux run; earlier local and Linux results below retain their stated commits and scope.

Latest rebase verification on November 2 (47fe0f6392, based on main at f6232fcfda): resolved the debt inventory conflict while preserving main's new entries. The ASN.1 implementation and its test source are byte-for-byte unchanged from 710ff5eed5, including both owned-terminator alias fixes. Windows 11 x86-64, WinLibs GCC 15.2.0, Release: rebuilt the value, decoder, allocator and newly landed time-test targets; 5/5 focused tests passed (guest_libressl_asn1, guest_libressl_asn1_allocator, guest_libressl3_asn1_values, guest_libressl3_time, guest_libressl3_asn1). The public-header audit passes for 405 libraries / 27,952 exports; current conventions, whitespace and the current-main merge preview pass. The automatic Windows job subsequently passed on this head: 2,074 tests executed and passed, 959 skipped, zero failures across 3,033 selected CTest entries. The value-mutation, decoder and allocator tests all ran and passed. This is a changed-test workflow, not the separate full build requested in the follow-up. Older results below retain their tested heads.

Prior follow-up verification (710ff5eed5): the overlap guard also covers an owned empty string, whose data pointer is its terminator. The new regression checks that alias rejection preserves the pointer and zero length. Windows Release: the same four focused ASN.1 tests passed (4/4), and conventions and whitespace checks passed. The prior nonempty terminator fix in 155b280226 is preserved. Linux was not rerun for this follow-up.

Windows 11 x86-64, WinLibs MinGW GCC 15.2.0, Release, configured from upstream 0580e5c951 with BUILD_TESTING=ON.

  • Built guest_libressl3_asn1_values_tests, guest_libressl3_asn1_tests and guest_libressl_asn1_tests through CMake.
  • ctest --test-dir <build> -R '^guest_libressl(3_asn1_values|3_asn1|_asn1|_asn1_allocator)$' --output-on-failure: 4/4 passed.
  • Recording application allocator checks binary data, null-data zero fill, terminators, replacement/borrowed ownership, erasure before free, allocation failures, invalid lengths, comparison order and 18 signed integer boundary values including INT64_MIN/MAX.
  • python core/libs/tests/test_public_headers.py --audit-only: 399 libraries / 26,743 exports passed.
  • python tools/check_conventions.py --base origin/main and git diff --check: passed.
  • Built nid_patcher and successfully patched a copy of the resulting PRX with the libc export-preservation option.

The prior head was rebased onto 198e13c75e. The current rebase onto f6232fcfda includes newer upstream library and build inputs; the focused rebuild and tests above cover that integration.

No Linux, console or retail-title runtime test was performed. The full project build/test suite was not run.

tools/pr_overlap.py --repo boykopovar/AnyPS5 --base main --branch HEAD was rerun against 1,777 open PRs. It returned exit 2 because several other heads conflict with main, so this is not an automatic overlap pass. Shared declarations, build registrations and debt diffs were inspected manually for #10461, #10631, #10960, #11146, #12754, #13486, #14212, #14483, #14499, #14612, #14992, #15031, #15045 and #15119, along with the adjacent-edit findings. No other implementation of these four exports was found; the report also compares this local rebase against this PR's own previous head. Other PRs still touch shared debt/build/declaration files, so integration may require another rebase as those land.

Companion PR #14890 changes adjacent placeholder declarations in the same shared files. A local git merge-tree check reports conflicts if the two branches are combined. Merge this ASN.1 contribution first; the BIO PR declares this merge-order dependency and will need a rebase afterward.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5112343552 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14889). Originally posted by [Noxy-HNR](https://github.com/Noxy-HNR) on 2026-11-01T22:46:57Z. --- ### What Four newly named LibreSSL3 exports currently throw: `ASN1_STRING_set`, `ASN1_INTEGER_set`, `ASN1_OCTET_STRING_cmp` and `ASN1_OCTET_STRING_free`. Implement binary/NUL-terminated string replacement, full signed 64-bit integer magnitudes, octet comparison and owned/borrowed buffer destruction through the application heap. Contracts come from LibreSSL 4.0.0 [a_string.c](https://github.com/libressl/openbsd/blob/ce488b78e0bd994780569df718596b9776ff681a/src/lib/libcrypto/asn1/a_string.c), [a_int.c](https://github.com/libressl/openbsd/blob/ce488b78e0bd994780569df718596b9776ff681a/src/lib/libcrypto/asn1/a_int.c) and [a_octet.c](https://github.com/libressl/openbsd/blob/ce488b78e0bd994780569df718596b9776ff681a/src/lib/libcrypto/asn1/a_octet.c), using the existing 24-byte guest `Asn1String`. Owned data is erased before release; NDEF string buffers remain borrowed. Invalid native dereference/overflow/alias cases throw. Console ABI and behavior are unverified; the debt entry also records the integer allocator's difference from LibreSSL's CBB allocation chain. No title unblock is claimed. ### Tested Current head `e971edaa96` is a maintainer merge of main `9ade3ed806` into `23f56dae04`. The ASN.1 implementation and regression test are byte-for-byte unchanged; the maintainer commit and its identity are preserved. The [current-head Windows job](https://github.com/boykopovar/AnyPS5/actions/runs/42317796514/job/128235878105) now passed. Its log identifies `e971edaa9696` and shows ASN.1 value, ASN.1 decoder, ASN.1 string and session-metadata runtime tests passing. It reports zero failures among 3,436 selected CTest entries, including skipped entries; this is not a separate full Linux run. Local results below retain their original head and scope. Historical local verification (`23f56dae04`): merged main `6beaeef052` without force-pushing; the only manual conflict resolution was the debt inventory. The ASN.1 implementation and regression test are unchanged. Windows 11 x86-64, WinLibs GCC 15.2.0/Ninja, Release, `-j 18`: rebuilt the real modules and all four focused ASN.1 targets; `guest_libressl3_asn1_values`, `guest_libressl3_asn1`, `guest_libressl3_asn1_string` and `guest_libressl3_asn1_object` all passed in each of three runs. Conventions and whitespace checks pass. Current-head hosted checks are pending. Historical hosted verification (`973e270f90`): the [Windows changed-test job](https://github.com/boykopovar/AnyPS5/actions/runs/42146929370/job/127660584164) passed; `guest_libressl3_asn1_values`, both ASN.1 decoders and the allocator regression passed. The job reports zero failures among 3,337 selected CTest entries, including skipped entries. Its log identifies this exact PR head. This is not a fresh full Linux run; earlier local and Linux results below retain their stated commits and scope. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Latest rebase verification on November 2 (`47fe0f6392`, based on `main` at `f6232fcfda`): resolved the debt inventory conflict while preserving main's new entries. The ASN.1 implementation and its test source are byte-for-byte unchanged from `710ff5eed5`, including both owned-terminator alias fixes. Windows 11 x86-64, WinLibs GCC 15.2.0, Release: rebuilt the value, decoder, allocator and newly landed time-test targets; **5/5 focused tests passed** (`guest_libressl_asn1`, `guest_libressl_asn1_allocator`, `guest_libressl3_asn1_values`, `guest_libressl3_time`, `guest_libressl3_asn1`). The public-header audit passes for **405 libraries / 27,952 exports**; current conventions, whitespace and the current-main merge preview pass. The [automatic Windows job](https://github.com/boykopovar/AnyPS5/actions/runs/41581671213/job/125737735653) subsequently passed on this head: **2,074 tests executed and passed, 959 skipped, zero failures** across 3,033 selected CTest entries. The value-mutation, decoder and allocator tests all ran and passed. This is a changed-test workflow, not the separate full build requested in the follow-up. Older results below retain their tested heads. Prior follow-up verification (`710ff5eed5`): the overlap guard also covers an owned empty string, whose data pointer is its terminator. The new regression checks that alias rejection preserves the pointer and zero length. Windows Release: the same four focused ASN.1 tests passed (4/4), and conventions and whitespace checks passed. The prior nonempty terminator fix in `155b280226` is preserved. Linux was not rerun for this follow-up. Windows 11 x86-64, WinLibs MinGW GCC 15.2.0, Release, configured from upstream `0580e5c951` with `BUILD_TESTING=ON`. - Built `guest_libressl3_asn1_values_tests`, `guest_libressl3_asn1_tests` and `guest_libressl_asn1_tests` through CMake. - `ctest --test-dir <build> -R '^guest_libressl(3_asn1_values|3_asn1|_asn1|_asn1_allocator)$' --output-on-failure`: **4/4 passed**. - Recording application allocator checks binary data, null-data zero fill, terminators, replacement/borrowed ownership, erasure before free, allocation failures, invalid lengths, comparison order and 18 signed integer boundary values including INT64_MIN/MAX. - `python core/libs/tests/test_public_headers.py --audit-only`: **399 libraries / 26,743 exports passed**. - `python tools/check_conventions.py --base origin/main` and `git diff --check`: passed. - Built `nid_patcher` and successfully patched a copy of the resulting PRX with the libc export-preservation option. The prior head was rebased onto `198e13c75e`. The current rebase onto `f6232fcfda` includes newer upstream library and build inputs; the focused rebuild and tests above cover that integration. No Linux, console or retail-title runtime test was performed. The full project build/test suite was not run. `tools/pr_overlap.py --repo boykopovar/AnyPS5 --base main --branch HEAD` was rerun against 1,777 open PRs. It returned exit 2 because several other heads conflict with main, so this is not an automatic overlap pass. Shared declarations, build registrations and debt diffs were inspected manually for #10461, #10631, #10960, #11146, #12754, #13486, #14212, #14483, #14499, #14612, #14992, #15031, #15045 and #15119, along with the adjacent-edit findings. No other implementation of these four exports was found; the report also compares this local rebase against this PR's own previous head. Other PRs still touch shared debt/build/declaration files, so integration may require another rebase as those land. Companion PR #14890 changes adjacent placeholder declarations in the same shared files. A local `git merge-tree` check reports conflicts if the two branches are combined. Merge this ASN.1 contribution first; the BIO PR declares this merge-order dependency and will need a rebase afterward. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!14889
No description provided.