feat(libSceLibreSsl): implement CMAC with AES-CBC methods #9571
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9571"
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 Felipebmaitan on 2026-10-22T02:46:52Z.
What
CMAC with AES-CBC methods on the memory BIO stack. Refreshed published history onto fetched main
b28bb772177768f99874ca38f6252cd0139acf2a. #9535 is merged; its numeric ERR behavior, shared queue and test-only generator/Python/submodule setup remain unchanged. No replacement PR, force push or unrelated branch changes.Resolved the pending-export debt conflict by independently recounting the merged
Export.cpp: 231 literalNotImplemented_nid_no_patch(__func__)calls, matching direct exported stub bodies. Published runtime implementations and supported fixtures are byte-identical to the previous head; the removed BIO ex-data throw/reference assertion remains absent and production refusal stays intact. Main'sEvp.cpp/EvpCipherCtx.cppregistrations and the existingBignum.cppregistration are all retained exactly once. The full published BN/CMAC ancestry is preserved. Supported RFC/differential/lifecycle/callback/wiping coverage remains; ENGINE refusal is not asserted by the CMAC fixture.#9446 remains an external prerequisite for CMAC: still open at
5c3dc05f0555b066beab1184f666829d3f4af780, with its author yet to answer the order request. Its branch was not edited, its independent BN firmware/rebase feedback is not claimed resolved, and no agreement is inferred.Tested
Exact head
4b6e1f0c71835899f5d6947c931c9519de88405f, integrated mainb28bb772177768f99874ca38f6252cd0139acf2a. Ubuntu amd64 Docker on Apple Silicon; GCC 13.3.0, CMake 3.28.3, Ninja, Python 3.12.3, Release. Native below means unpatched symbols, not execution on native Linux hardware.44af6828fdc064ca16f94aeb07ac913651d2bfce0f5ecbeee6b9b476e6be24e3; three lifecycle cases pass again. Runtime graphs exclude the generator and compile the shared queue once.python3 tools/check_conventions.py --base origin/mainand whitespace pass in isolated Git contexts pinningorigin/mainto the integrated SHA above, without changing shared tracking refs.Docker denies userfaultfd, so libc uses its existing comparison fallback. No new local Windows/macOS runtime, sanitizer, commercial-title or physical-console run; Hosted CI on
4b6e1f0c71835899f5d6947c931c9519de88405f:windows,conventions,library-portability,eligibility,labelsandreportsucceeded.linux,relinker,relinker-asan,register-context,write-watchandedge-watchwere skipped; earlier conventions attempts were cancelled. GitHub reports CLEAN / MERGEABLE; skipped jobs are not claimed as executed. Current-head maintainer re-review remains pending. #9446 is still open/conflicting at5c3dc05f0555b066beab1184f666829d3f4af780, with no author reply confirming the proposed order. Previous hosted results and bounded growth-wipe/no-Python fragment controls remain historical. Firmware-module comparison evidence remains attributed PC execution with stand-in imports, not console evidence. No success is claimed for skipped or pending jobs.Formal re-review requests to GitHub returned HTTP 404 for this PR; no reviewer request was registered. The validation reply explicitly asks @MarcZX10 to re-review. This API failure is separate from the validated code fixes and completed hosted CI.
Readiness: the stale
needs rebaselabel has cleared. Formal re-review requests returned HTTP 404 and no reviewer request is registered. MarcZX10 was explicitly asked in the validation reply; the latest approval applies to an older head. #9446 order confirmation remains an external prerequisite.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 jotitadev on 2026-10-22T03:45:56Z.
Review: COMMENTED
Linux run of the CMAC change, since the description lists only Windows 11 x86-64.
Machine: Linux x86_64, i7-8700 (6 cores / 12 threads), Ubuntu 26.04, GCC 15.2, Release,
BUILD_TESTING=ON. Headd14f1143merged--no-commitontomain6ef5a1c4c(clean), thengit submodule update --initpulled the new3rdparty/libressl-openbsd(078b3d1, LibreSSL 3.4.1). The branch carries #9535/#9529, so the merge also brings the ERR pieces.guest_libressl_cmacandguest_libressl_cmac_patchedboth pass: RFC 4493 vectors through every split, AES-128/192/256 differential checks against Mbed TLS, staged init/restart/repeated finalization, key-size changes, guest-defined methods, etc.CMAC_Final(output[i] = lastBlock[i]instead oflastBlock[i] ^ subkey[i]) and keeping the test aborts both tests at the first vector —RFC vector 0 split 0: f6c71eedc3d99bb183cb5b8d1568e606/failed: RFC 4493 tag. So the K1/K2 subkey step is actually exercised and the test guards it.Patching NIDs for libSceLibreSslstep succeeds,patched_librariespasses,guest_libressl_cmac_patched(which runs against the patched.prxviaguest_libressl_cmac_patch) passes, andpython tools/check_conventions.py --base origin/mainreports no errors.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T03:56:05Z.
Review: CHANGES_REQUESTED
I reviewed the CMAC and AES-CBC implementation against the pinned LibreSSL 3.4.1 contracts and the supplied tests. RFC 4493 vectors, streaming splits, staged/replacement/restart paths, custom method callbacks, AES differential checks and the explicit console-layout caveat provide strong evidence. The currently declared #9535 dependency (and its #9529 prerequisite) is valid.
I am requesting changes for an unresolved live overlap. Open PR #9536 also depends on #9535 and edits the same
core/libs/CMakeLists.txtinsertion area anddocs/dev/debt/libSceLibreSsl.mdfunctional section. Its CMake change adds the ErrorQueue and MemoryBio includes; this PR adds Cmac at that same include block, and both add debt entries in the same section. The description notes that #9536 shares the ERR prerequisite but does not record coordination with its author or an agreed order. Please agree which branch lands first with the #9536 author and declare it inDepends onif sequencing is required. Keep the separate CMake includes and all debt entries when resolving the shared insertions.The hosted eligibility, intake, labels, report and conventions checks pass. Linux, Windows and relinker product jobs are skipped. The author-reported focused Windows tests are detailed; I did not treat skipped hosted jobs as executed. Manual inspection of older CMake/submodule overlap warnings found no competing CMAC implementation; the concrete unresolved shared insertion is #9536.
Imported from boykopovar/AnyPS5. Originally posted by Felipebmaitan on 2026-10-22T04:05:54Z.
Addressed in
80516b407f.Both #9536 and #9571 are authored by my account, Felipebmaitan. I have set and recorded the order in both descriptions: #9529 -> #9535 -> #9536 -> #9571. This PR now declares Depends on: #9536; the BIO PR retains #9535 as its dependency.
I integrated #9536's actual head (
0b6880e4d0) into this branch and resolved the shared insertions by keeping all three separate includes, in order:ErrorQueue.cmakeMemoryBio.cmakeCmac.cmakeThe ERR string/teardown paragraph, both memory BIO debt entries, and the CMAC debt entry are preserved. Error publication now names both BIO and CMAC consumers, and the remaining-export count accounts for both implementations. CMAC source, headers, its registration file and tests are unchanged from the reviewed
d14f114325.Rebuilt the six focused targets on the combined Windows Release branch.
ctest --test-dir build -R "^(guest_libressl_.*|patched_libraries)$" --output-on-failurepasses 9/9, including native and patched-NID BIO/CMAC, ERR lifecycle, and patched-library loading. Conventions report zero errors (the existing 1,038-character ERR debt entry still warns);git diff --checkpasses. The refreshed local overlap scan no longer lists #9536; remaining unrelated debt/export overlap warnings are retained in the PR description.Please re-review the sequencing change. The full product suite and PS5 equivalence are not claimed by this follow-up.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T04:12:49Z.
Review: APPROVED
The previous sequencing concern is resolved in the current head: the author integrated #9536, declared the direct dependency, and documented the #9529 → #9535 → #9536 → #9571 order. The follow-up reports the three separate CMake registrations and ERR/BIO/CMAC debt entries preserved, and the CMAC sources/tests unchanged from the prior reviewed head. The new independent Linux report adds focused native and patched-NID runs plus a red/green RFC 4493 subkey control; the author reports the combined Windows focused suite at 9/9. Hosted policy checks pass; product Linux/Windows and relinker jobs are skipped, and full suite/PS5 behavior are explicitly not claimed. I reviewed the implementation and current dependency state; I did not run local tests. No remaining blocking issue found in this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T11:00:54Z.
Follow-up on the current approved head: I checked the remaining open LibreSSL overlaps and found a concrete one with #9446. A three-way merge simulation of #9571 and #9446 against their common base conflicts in
core/libs/prx/libSceLibreSsl/Export.cpp: #9446 removes the BN stub block while #9571 replaces the adjacent CMAC stubs. Theirdocs/dev/debt/libSceLibreSsl.mdadditions also need to be retained together. The current #9571 dependency chain covers #9536 → #9535 → #9529, but not #9446.Please coordinate a merge order with the #9446 author and list #9446 under
Depends onif it must land first (or document the agreed reverse order and preserve both export/debt changes when rebasing). I have not found a competing CMAC implementation. This is a merge-order request, not a new CMAC code finding. The automated overlap helper cannot run in this checkout because its expectedupstream/mainbranch ref does not exist; the merge simulation above is direct evidence of the conflict.The exact current head remains the one covered by my approval. Current-base sync is 9 ahead / 98 behind and cleanly mergeable; conventions reports zero errors and one inherited debt-length warning. The large open queue still exceeds the #5239 intake hold, and the PR remains generic without title-specific evidence; please keep the intake direction in mind when deciding whether to proceed.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T14:17:15Z.
Correction to my earlier follow-up: the paragraph referring to the large open queue and #5239 intake hold was not relevant and should not have been included. I withdraw that as a reason to delay this PR. The current intake direction does not bar this contribution. I refreshed the merge check against upstream/main at
329efe1bfd: #9571 merges cleanly with main (9 commits ahead, 143 behind), while a direct merge simulation with the still-open #9446 conflicts in Export.cpp and docs/dev/debt/libSceLibreSsl.md. Please coordinate and record the order as required by CONTRIBUTING; there is no main-branch conflict. The reviewed head remains80516b407f, and the reported focused Windows and independent Linux suites cover the current CMAC sources. I did not run those runtime tests locally in this session.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T08:45:04Z.
Review: APPROVED
Re-reviewed exact head
463e6902ad8b9614e660410c8cb43bdcddf558c6after its main merge. The current-main merge preview is clean; the effective PR delta remains the previously reviewed LibreSSL implementation and tests, with the debt count refreshed to include the merged exports. The exact-head Windows workflow passes, while Linux/product jobs are skipped. I did not rerun the LibreSSL CTest targets locally; this approval relies on the prior source/test review plus the author’s report that the merge added no other changes.