Repository navigation
feat(libSceLibreSsl): implement RSA_private_encrypt, RSA_private_decrypt and RSA_sign - #11151
45 commits merged into
Conversation
…RSA calls The pending-exports line kept the 351 of the branch this one builds on; with the RSA_new, RSA_free, d2i_RSA_PUBKEY, RSA_public_encrypt, RSA_public_decrypt and RSA_verify implementations, Export.cpp has 345 calls left that throw.
# Conflicts: # docs/dev/debt/libSceLibreSsl.md
…rivate # Conflicts: # core/libs/prx/libSceLibreSsl/CMakeLists.txt # docs/dev/debt/libSceLibreSsl.md
Progress report (151a2cb → 944b114)📈 System libraries: 27.07% (+0.0053%, +2 implemented functions) ✅ 2 implemented
Changed libraries (implemented exports)
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed exact head 9343653, focusing on private RSA padding, blinding, CRT fallback, method-slot dispatch, DigestInfo construction, and the associated tests and debt notes. Local checks passed: check_conventions.py --base upstream/main, git diff --check upstream/main...HEAD, the public-header audit (368 libraries / 12,196 exports), and a C++20 syntax compile of Rsa.cpp against the pinned Mbed TLS headers. The PR reports a LibreSSL 2.5.4 differential run and 13/13 libressl CTest cases; I could not independently rerun those runtime tests here because this checkout has no configured project build. Product CI jobs are skipped under the repository PR policy. I found no blocking issue in the source review.
|
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.
|
…RSA calls The pending-exports line kept the 351 of the branch this one builds on; with the RSA_new, RSA_free, d2i_RSA_PUBKEY, RSA_public_encrypt, RSA_public_decrypt and RSA_verify implementations, Export.cpp has 345 calls left that throw.
|
A Windows run of this head, since the description doesn't cover Windows: Windows 11 Home 10.0.26200, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release.
AI-assisted: yes (Claude Code) |
There was a problem hiding this comment.
Correction (2026-11-01): this review's claim that maintainers close PRs without a title ID is wrong. CONTRIBUTING allows Unblocks: none; a title is only required when the PR fixes a title. The technical points below are unaffected.
No title ID and no log line. The description says Unblocks: none and states the exports "matter once #9446 or a PEM reader lands", because guests cannot build a private key through this module while BN_new and BN_bin2bn are stubs. So no title can reach RSA_private_encrypt, RSA_private_decrypt or RSA_sign on main today, and the 2,400-line diff (Rsa.cpp plus two test files) is unreachable code until another PR lands.
- Order. This sits on #10915 (carried commits) and cannot be exercised before #9446. I would hold it until #9446 is merged and a title or a test build of the module can actually produce a private key, so the exports are reviewed against a real caller.
- Evidence of reach. Once a title imports one of these, please add its ID and the log line from
mainshowing the import being hit. Without it this is export-only work, which is what maintainers have been closing. - Blinding. The description says the blinding factor is fresh host entropy per call and not stored in
rsa->blinding, and that this differs from 2.5.4. Please state in the debt entry what a guest that readsrsa->blindingafterwards observes.
✅ AMD GPU test: passedPR head
Unstable on main (4, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (9, not counted against this PR)Validation IDs already present on main (8 IDs in 731 tests)Skipped (9)ReproduceAutomated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
The local alignment now states that Publication still waits on the shared dynamic-OID correction: this branch, #11128 and #11175 modify #10915's verification and decoding functions. Those guards must have one agreed owner before the stack is ready. The local source build, 58 ordinary LibreSSL tests and 65 header tests pass. These results do not remove the dependency gate. |
ed41d86
What
Implements
RSA_private_encrypt,RSA_private_decryptandRSA_signon theRSAobject from #10915, following LibreSSL 2.5.4 rsa_eay.c, the padding files next to it, rsa_sign.c and bn_blind.c.#10915 and #10449 are merged. The original implementation is 823aab9 and 6aa3fd5 (test-only). Current-main integration also guards RSA verification against registered OIDs and makes signing throw for unsupported dynamic identifiers. It does not add dynamic digest support.
RSA_eay_*: blinding (unlessRSA_FLAG_NO_BLINDING), the CRT path with itseverify anddfallback, and plaindwhen CRT fields are missing. Same order as 2.5.4, mbedtls for the math (reuses feat(libSceLibreSsl): implement the RSA public-key calls on the RSA object #10915'sModExp).RSA_signbuilds the DERDigestInfofrom feat(libSceLibreSsl): implement the RSA public-key calls on the RSA object #10915's 15-entry digest table, or signs the raw 36 bytes forNID_md5_sha1. A guest method'srsa_signslot gets called whenRSA_FLAG_SIGN_VERis set.rsa->blinding) and the Montgomery contexts. Outputs are the same for a consistent key. The differences are in the debt entry.rsa_mod_exp/bn_mod_exp, numbers over the 8192-bit mbedtls limit, non-normalised BIGNUMs, n == 1 with blinding, and anRSA_signNID that's in range but not a digest. The full list is in the debt file.BN_newandBN_bin2bnare now implemented on main.RSA_generate_key_exstays outside this PR. The PSS pair is in #11175.Current alignment
Head
944b114d0ea56a8868473c81165ffa86ff598f4fmerges main08e73174f230de4f475c04299170d8c14d6e3425, including #10915. Published history is preserved. The merged count-free debt wording is preserved.The registered-OID guards remain in RSA verification and public-key decoding. Their tests accept the correct result or an unsupported-path refusal. The unsupported custom-method and non-digest signing throw assertions are removed. The other private RSA checks remain.
The final main merge changes only debt wording. Fresh checks: focused RSA, private RSA and error tests pass (3/3). Public headers pass (65/65). Conventions and whitespace pass. Prior differential and mutation results below were not repeated. Windows CI remains external. The final test-only correction also passes the focused private-RSA test on #11151; dependent branches inherit that exact test.
Tested
The following feature checks predate this alignment. Fresh checks appear above.
Ubuntu 24.04 on WSL2, GCC 13.3, Release, on
main+ #10915.libcrypto.a: a host generator recorded 2124 cases on 6 keys (512 to 4096 bits, e = 3 and 65537) in about 20 shapes each: missingd,e, CRT fields, a baddmp1, evenn, n = 1, the flag combos. Output buffers are prefilled and compared in full, so extra writes count. A guest harness (not committed) got 1904/1904 byte-exact, 54/54 matches on the return value only (cases where the output bytes aren't comparable), and 166/166 deliberate throws.guest_libressl_rsa_private: exact 2.5.4 vectors on a 512-bit key for each padding, the key shapes,RSA_signwith SHA-256 and MD5-SHA1, empty and longest digests, and the refused types, and method-slot dispatch with recording callbacks.RSA_eay_private_encrypt not implemented(and the decrypt/sign variants). Mutations that each fail the test: skip blinding, drop the CRT fallback, always outputretfor X9.31, writesiglenon a failed sign, wrongDigestInfoNULL parameter.ctest -R libressl: 15/15 pass onmain9857eee + feat(libSceLibreSsl): implement the RSA public-key calls on the RSA object #10915 939a194, including feat(libSceLibreSsl): implement the RSA public-key calls on the RSA object #10915'sguest_libressl_rsa.check_conventions.py --base origin/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)