feat(libSceLibreSsl): implement the RSA public-key calls on the RSA object #10915

Merged
EagleBearerYS merged 24 commits from upstream-pr/10915 into main 2026-11-05 18:40:45 +00:00
EagleBearerYS commented 2026-10-25 09:48:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-25T09:48:50Z.


What

Implements six libSceLibreSsl RSA public-key exports on the RSA object of #10449, following LibreSSL 2.5.4 (rsa_lib.c, rsa_eay.c, rsa_crpt.c, rsa_pk1.c, rsa_oaep.c, rsa_none.c, rsa_sign.c, x_pubkey.c, rsa_ameth.c, tasn_dec.c), the version the module's debt entries name:

  • RSA_new, RSA_free: the key from the guest heap with the default "Eric Young's PKCS#1 RSA" method, reference counting, finish, and BN_clear_free of each BIGNUM.
  • d2i_RSA_PUBKEY: decodes a SubjectPublicKeyInfo with LibreSSL's DER/BER rules onto a new key.
  • RSA_public_encrypt, RSA_public_decrypt: dispatch through the key method; the default method's checks, PKCS#1 v1.5, OAEP (SHA-1) and no padding, with the arithmetic on mbedtls.
  • RSA_verify: the method's rsa_verify under RSA_FLAG_SIGN_VER, otherwise PKCS#1 v1.5 decryption, the NID_md5_sha1 case and the X509_SIG checks, with the NIDs of the 15 digest objects of LibreSSL 2.5.4's table.

RSA_verify_PKCS1_PSS and RSA_padding_add_PKCS1_PSS keep throwing: they need an EVP_MD, which #9448 adds. BER forms LibreSSL also accepts, SSLv23 and X9.31 padding, moduli over 8192 bits, a custom bn_mod_exp, negative BIGNUMs and a digest type and object both outside the table throw. Four new entries in docs/dev/debt/libSceLibreSsl.md record these and the error queue these calls don't fill.

On main: #10449 merged as c8809e82e4, so this PR's six commits now sit on main 895ead67f7, which carries alvaroelpob's three. The fifth sets the debt file's pending-exports count to the exports Export.cpp still leaves throwing, and each merge of main recounts it: 190 at this head (the line on main says 196, which matches its Export.cpp).

Related: #9446 (BIGNUM), #9448 (EVP_MD, for the PSS calls), #10570, #10418, #10398 (EVP_PKEY).

Tested

  • GitHub's runners: run 40172479816: guest_libressl_rsa and guest_libressl_runtime pass 10 of 10 on Linux and on Windows, 0 skipped.
  • GitHub's runners, 5576345be4 (run): the count commit, docs only. guest_libressl_rsa and guest_libressl_runtime pass 10 of 10. Linux: 2 run, 2 pass, 0 skip, 0 fail. Windows: 2 run, 2 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (144 and 207) and on Windows (171 and 223). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • Linux x86-64 (Ubuntu 24.04, gcc 13.3.0), no title. guest_libressl_rsa gains eight cases on the NIST CAVP FIPS 186-3 SigGen15 2048-bit key:
    • RSA_new/RSA_free fields, references, finish and BIGNUM freeing;
    • d2i_RSA_PUBKEY on that key's SubjectPublicKeyInfo, a truncated encoding refused, and 53 encoding variants;
    • RSA_public_decrypt and RSA_verify with the CAVP PKCS#1 v1.5 signature, and a tampered one failing;
    • RSA_public_encrypt with OAEP and v1.5: 256-byte output, two encryptions differ, and each decrypts with the private exponent to a valid block;
    • the key limits, method dispatch, X509_SIG variants and each digest object.
  • Each commit's new cases fail against its parent and pass with it.
  • A differential run against a LibreSSL 2.5.4 build over 6,033 generated cases gave no differing result; the cases where these exports throw are the gaps listed above.
  • CI-configured build, then ctest as an unprivileged user: 2,213 tests, 2,118 passed, 90 skipped and 5 failed. The five need IPv6, which that machine lacks: guest_net_buffer_validation, guest_socket_options, guest_socket_stream_options, guest_socket_address_length and guest_tcp.
  • dc07fde9eb, this PR's five commits rebased onto #10449's e44f645642 (run), after alvaroelpob rebased #10449 onto current main. The code is unchanged: the debt entries keep their place after #10449's RSA entry, now followed by main's Functional section, and the count commit sets 334, the NotImplemented exports left in Export.cpp. guest_libressl_rsa, guest_libressl_runtime and public_headers pass 10 runs in a row. Linux: 3 run, 3 pass, 0 skip, 0 fail. Windows: 3 run, 3 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (144 and 208) and on Windows (171 and 224). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • Firmware 13.42's RSA_flags, by @BunnyFl (comment): the 13.42 libSceLibreSsl.sprx code, run in an emulator on structures whose every 4-byte word holds its own offset (two identical runs), reads the method pointer at +0x10 of the RSA and returns the int at +0x48 of the method, and gives 0 for a null RSA. That matches this PR's static_asserts for meth and LibreSslRsaMethod::flags; the other fields aren't read by that call.
  • 4df79a235e, a merge of main 4e38e23882 (run). main's 9a848d0b99 implements the TLS alert descriptions and lowers the pending-export count in docs/dev/debt/libSceLibreSsl.md from 342 to 341, on the line this PR's count commit sets. The merge keeps main's change and sets the count to 333, the NotImplemented_nid_no_patch exports left in the merged Export.cpp. Nothing else conflicted, and this PR's other changed lines are the same. The 13 guest_libressl tests pass 10 runs in a row. Linux: 13 run, 13 pass, 0 skip, 0 fail. Windows: 13 run, 13 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (145 and 210) and on Windows (174 and 231). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • ac22fabb9d and 939a194466, after oneandonlydean's review and a merge of main 84e91df418 (run). ac22fabb9d drops the RSA test's checks that pinned unimplemented features as throwing, as oneandonlydean asked: RSA_free with an ENGINE, ex_data, blinding or Montgomery context set, the BER forms in d2i_RSA_PUBKEY and in a signature's DigestInfo, X9.31 decryption, SSLv23 encryption, moduli over 8192 bits, a custom bn_mod_exp (with its OtherModExp fixture), and digest types with no object. The production refusals and their debt entries stay, and so do the null-pointer, malformed-input and invalid-length checks. 939a194466 merges main, whose #9745 (SSLeay) lowers the pending-export count in docs/dev/debt/libSceLibreSsl.md to 340, on the line this PR sets; the merge keeps it and sets 332, the NotImplemented_nid_no_patch exports left in the merged Export.cpp. Nothing else conflicted. guest_libressl_rsa, the other guest_libressl tests and the tests for the files the merge changes, 24 of them, pass 10 runs in a row. Linux: 24 run, 24 pass, 0 skip, 0 fail. Windows: 24 run, 24 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (145 and 211) and on Windows (174 and 232). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 7cfe819145, a merge of main 18ef6be0cd (run). alvaroelpob's #10373 (sk_*) and #10376 (UI_create_method) add their sources and tests next to this PR's in core/libs/prx/libSceLibreSsl/CMakeLists.txt and their structs next to this PR's LibreSslRsaMethod and LibreSslRsa in include/Api.hpp; #10373's debt entry sits next to this PR's in docs/dev/debt/libSceLibreSsl.md, and the two lower the pending-export count to 321, on the line this PR sets. The merge keeps both sides in each and sets 313, the NotImplemented_nid_no_patch exports left in the merged Export.cpp. This PR's other changed lines are the same. The guest_libressl tests with the tests for the files the merge changes pass 10 runs in a row. Linux: 92 run, 92 pass, 0 skip, 0 fail. Windows: 90 run, 90 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (145 and 212) and on Windows (174 and 233). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 7cf76af1d5, this PR's six commits on main 895ead67f7 (run), after #10449 merged. The branch now holds only this PR's commits, moved onto main with a force-push. Each commit's changed lines are the same as before, and only their context moved: the add_library line now lists main's newer sources, and Api.hpp and the debt file sit on main's versions. The count commit sets 301, what Export.cpp leaves with this PR's six exports. guest_libressl_rsa and guest_libressl_runtime pass 10 runs in a row. Linux: 2 run, 2 pass, 0 skip, 0 fail. Windows: 2 run, 2 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (166 and 264). On Windows libc passes (194), and libkernel passes 283 of 286: exec_arguments, guest_timed_join_import_libkernel_sys and guest_timed_join_import_libkernel_web fail at their setup in the verify's Windows build (FileNotFoundError starting the title, or copying the libraries they load), and pass in main's own Windows job at 1829def9bf (job). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 4ad9203124, a merge of main 04fefebe90 (run). The one conflict was the pending-exports count in docs/dev/debt/libSceLibreSsl.md: main reads 300 after JaceTheBlu's #11105 (X509 lookups), and with this PR's implementations the merged Export.cpp has 294 calls left that go through NotImplemented_nid_no_patch, so the entry now says 294. This PR's other changed lines are the same. guest_libressl_rsa and guest_libressl_runtime ran 10 times with no failure. Linux: 2 run, 2 pass, 0 skip, 0 fail. Windows: 2 run, 2 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (171 and 289). On Windows libc passes (199), and libkernel passes 309 of 312: exec_arguments, guest_timed_join_import_libkernel_sys and guest_timed_join_import_libkernel_web fail at their setup in the verify's Windows build (FileNotFoundError starting the title, or copying the libraries they load), with main's code too, and pass in main's own Windows job at 1829def9bf (job). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 7be988fd70, a merge of main 58b2753d74 (run). The one conflict was the pending-exports count in docs/dev/debt/libSceLibreSsl.md: main reads 299 after JaceTheBlu's #11189 (X509_VERIFY_PARAM_set1_host), and with this PR's implementations the merged Export.cpp has 293 calls left that go through NotImplemented_nid_no_patch, so the entry now says 293. This PR's other changed lines are the same. ^guest_libressl and public_headers ran 10 times with no failure. Linux: 33 run, 33 pass, 0 skip, 0 fail. Windows: 33 run, 33 pass, 0 skip, 0 fail. The libc and libkernel suites run 193 and 292 tests on Linux and 223 and 315 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 77af176ffa, a merge of main c12e7e61a1 (run), which brings JaceTheBlu's #13562 (OBJ_create and OBJ_cleanup). The one conflict was the pending-exports count in docs/dev/debt/libSceLibreSsl.md: main reads 292 after #13562, and with this PR's implementations the merged Export.cpp has 286 calls left that go through NotImplemented_nid_no_patch, so the entry now says 286. CMakeLists.txt, Export.cpp and Api.hpp merged without conflicts, and this PR's other changed lines are the same. ^guest_libressl and public_headers ran 10 times with no failure. Linux: 34 run, 34 pass, 0 skip, 0 fail. Windows: 34 run, 34 pass, 0 skip, 0 fail. The libc and libkernel suites run 199 and 308 tests on Linux and 226 and 330 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • fa25361695, a merge of main 0a148be963 (run), which brings Ninot1Quyi's #13820 (SHA-512 initialization buffers) and hyvvs's #13760 (GENERAL_NAME_free and GENERAL_NAMES_free).
    • The one conflict was the pending-exports count in docs/dev/debt/libSceLibreSsl.md, next to main's new and changed entries. The merge keeps those entries, and every other line comes from the side that changed it.
    • The count is the merged tree's Export.cpp total, 284 NotImplemented_nid_no_patch exports; main's line was 2 above its own total.
    • This PR's other changed lines are the same.
    • ×10: ^guest_libressl and public_headers. Linux: 38 run, 38 pass, 0 skip, 0 fail. Windows: 38 run, 38 pass, 0 skip, 0 fail. The libc and libkernel suites run 199 and 308 tests on Linux and 226 and 330 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 67a8e941dd: merges of main 88e804b0a7 (e6b8a1727b) and 3c3b3cda73 (2eb2e4e3c0), each followed by a recount of the pending exports (39753d71a9, 67a8e941dd) (run, on 67a8e941dd).
    • e6b8a1727b brings Felipebmaitan's #9535 (error queues) and atharvjairath's #10078 (X509_EXTENSION getters). The one conflict was the pending-exports count line in docs/dev/debt/libSceLibreSsl.md.
    • 2eb2e4e3c0 brings alvaroelpob's #10488 (EVP_CIPHER_CTX), without conflicts.
    • The count is the NotImplemented_nid_no_patch calls left in each merged Export.cpp: 278 after the first merge (#9535 and #10078 implement three each) and 275 after the second (#10488 implements three).
    • This PR's diff over main is otherwise unchanged. The ^guest_libressl tests, with guest_libressl_rsa and public_headers, pass 10 runs in a row. Linux: 44 run, 44 pass, 0 skip, 0 fail. Windows: 44 run, 44 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (214 and 316) and on Windows (241 and 337). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 55ff0cdc99, a merge of main b28bb77217 (run), which brings HQasper's #9448 (the EVP message digest and HMAC functions).
    • The one conflict was docs/dev/debt/libSceLibreSsl.md, where the merge keeps #9448's new entry with this PR's.
    • The count is 255, the NotImplemented_nid_no_patch calls left in the merged Export.cpp: main's 261, which its line now matches, less the 6 this PR implements.
    • This PR's other changed lines over main are the same, and it merges cleanly with main a4eca2a056.
    • ×10: the ^guest_libressl tests, with guest_libressl_rsa and public_headers. Linux: 46 run, 46 pass, 0 skip, 0 fail. Windows: 46 run, 46 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (217 and 319) and on Windows (244 and 340). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 7482bd278c, a merge of main 4f41f4c375 (run), which brings Felipebmaitan's #9571 (CMAC with the AES-CBC ciphers).
    • The conflict: the pending-exports count in docs/dev/debt/libSceLibreSsl.md, which both sides changed. The merged Export.cpp has 225 NotImplemented exports, so the entry now says 225 (this PR said 255, main 231). No function is in both PRs, and this PR's other lines are unchanged.
    • ×10: every ^guest_libressl test. Linux: 51 run, 51 pass, 0 skip, 0 fail. Windows: 51 run, 51 pass, 0 skip, 0 fail. The libc and libkernel suites run 300 and 322 tests on Linux and 327 and 342 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
    • AMD: TechLevelZero's AMD bot ran this head merged onto main 4f41f4c: AMD Radeon RX 6300 (RADV NAVI24, Mesa 25.2.8; report): 1,147 passed, 6 failed, none new (4 also fail on main, 2 unstable on main), 6 skipped, with no new validation IDs (551 tests on the GPU).
  • 13c396c3c4, the type 1 padding minimum and a debt sentence, for points 1 and 2 of XairRrR's review.
    • The test: TestPublicDecrypt now recovers two type 1 blocks through RSA_public_decrypt with PKCS#1 padding. One has seven 0xFF bytes and must be refused (-1); the other has eight and must give its 245-byte payload.
    • Red: 36b6296408 lowers RSA_padding_check_PKCS1_type_1's minimum from 8 to 1 (index < 1). guest_libressl_rsa then fails at the seven-byte case, "LibreSSL RSA check failed at line 503", on GitHub's Linux and Windows runners (run).
    • The debt file: the RSA_flags, RSA_size entry drops "No export of this module creates a key yet, so only keys the caller builds reach them", since RSA_new and d2i_RSA_PUBKEY now do.
    • ×10 (run): every ^guest_libressl test. Linux: 51 run, 51 pass, 0 skip, 0 fail. Windows: 51 run, 51 pass, 0 skip, 0 fail. The libc and libkernel suites run 300 and 322 tests on Linux and 327 and 342 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 7ecf157d95, a merge of main 9ab6a281ea (run), which brings MatteoSid's #10395 (EC groups and keys).
    • The conflict: the pending-exports count in docs/dev/debt/libSceLibreSsl.md, which both sides changed. The merged Export.cpp has 216 NotImplemented exports, so the entry now says 216 (this PR said 225, main 222). No function is in both PRs, and this PR's other lines are unchanged.
    • ×10: every ^guest_libressl test, with public_headers. Linux: 54 run, 54 pass, 0 skip, 0 fail. Windows: 54 run, 54 pass, 0 skip, 0 fail. The libc and libkernel suites run 303 and 327 tests on Linux and 335 and 354 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 354e5c8351, a merge of main b611e634f7 (run), which brings LordVersA's #11662 (SSL_library_init).
    • The conflict: the pending-exports count in docs/dev/debt/libSceLibreSsl.md, which both sides changed. The merged Export.cpp had 215 NotImplemented exports, so the entry said 215 (this PR said 216, main 221). No function is in both PRs, and this PR's other lines are unchanged.
    • ×10: every ^guest_libressl test, with public_headers. Linux: 54 run, 54 pass, 0 skip, 0 fail. Windows: 54 run, 54 pass, 0 skip, 0 fail. The libc and libkernel suites run 303 and 329 tests on Linux and 335 and 360 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 4c7c65a244, a merge of main d63781e9ce (run), which brings alvaroelpob's #10450 (EVP_CIPHER_block_size).
    • The conflict: the pending-exports count in docs/dev/debt/libSceLibreSsl.md: the merged Export.cpp had 214 NotImplemented exports, so the entry said 214 (this PR said 215, main 220). No function is in both PRs, and this PR's other lines are unchanged.
    • ×10: every ^guest_libressl test (now including #10450's guest_libressl_evp_cipher) and public_headers. Linux: 55 run, 55 pass, 0 skip, 0 fail. Windows: 55 run, 55 pass, 0 skip, 0 fail. The libc and libkernel suites run 303 and 329 tests on Linux and 335 and 360 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 05387ced6d, a merge of main 9f9e420709 (run), which brings alvaroelpob's #10448 (OCSP_response_status, OCSP_single_get0_status).
    • The conflict: the pending-exports count in docs/dev/debt/libSceLibreSsl.md. The merged Export.cpp has 212 NotImplemented exports, so the pending-exports entry now says 212 (this PR said 214, main 218).
    • No function is in both PRs, and this PR's other lines are unchanged.
    • ×10: every ^guest_libressl test (now including #10448's guest_libressl_ocsp_response) and public_headers. Linux: 56 run, 56 pass, 0 skip, 0 fail. Windows: 56 run, 56 pass, 0 skip, 0 fail. The libc and libkernel suites run 303 and 329 tests on Linux and 335 and 360 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • TechLevelZero's AMD GPU test at 354e5c8351 (report), with VK_LAYER_KHRONOS_validation: AMD Radeon RX 6300 (RADV NAVI24, Mesa 25.2.8), this head merged onto main b611e63, 1,133 of 3,946 tests selected. 1,125 passed, 3 failed (none new: all 3 also fail on main), 5 skipped. No new validation IDs over 575 GPU tests. guest_libressl_rsa wasn't in the selection.
  • 984cae2063, a merge of main e772fb25cc (run), which brings our #10834 (the EVP cipher calls on the cipher context), StoneDC's #12774, #12775 and #14283 (tests of error-queue interleavings, DES ECB known answers, and SHA padding and digest extents) and rooklz's #14717 (the documented exception for faulting lookup and verify-parameter arguments).
    • The conflict: the pending-exports count in docs/dev/debt/libSceLibreSsl.md. The merged Export.cpp has 190 NotImplemented exports, so the pending-exports entry now says 190 (this PR said 212, main 196).
    • No function is in both PRs, and this PR's other lines are unchanged.
    • ×10: every ^guest_libressl test and public_headers. Linux: 58 run, 58 pass, 0 skip, 0 fail. Windows: 57 run, 57 pass, 0 skip, 0 fail; guest_libressl3_mixed_evp is registered only on Linux. The libc and libkernel suites run 322 and 331 tests on Linux and 353 and 362 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.

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; #10449, which this PR built on, has merged (c8809e82e4). Our #10834, which set the same pending-exports count line in docs/dev/debt/libSceLibreSsl.md, has merged (5a273d9f3b), and this head's count includes it. Any order with our #10878, which sets that line too: whichever merges later recounts it in a main merge. Any order with alvaroelpob's #10490 (libSceLibreSsl3): the overlap table's RSA_new and d2i_RSA_PUBKEY are its placeholder entries there, and the two share no file
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5003639142 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10915). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-25T09:48:50Z. --- ### What Implements six libSceLibreSsl RSA public-key exports on the `RSA` object of #10449, following LibreSSL 2.5.4 (`rsa_lib.c`, `rsa_eay.c`, `rsa_crpt.c`, `rsa_pk1.c`, `rsa_oaep.c`, `rsa_none.c`, `rsa_sign.c`, `x_pubkey.c`, `rsa_ameth.c`, `tasn_dec.c`), the version the module's debt entries name: - `RSA_new`, `RSA_free`: the key from the guest heap with the default `"Eric Young's PKCS#1 RSA"` method, reference counting, `finish`, and `BN_clear_free` of each `BIGNUM`. - `d2i_RSA_PUBKEY`: decodes a SubjectPublicKeyInfo with LibreSSL's DER/BER rules onto a new key. - `RSA_public_encrypt`, `RSA_public_decrypt`: dispatch through the key method; the default method's checks, PKCS#1 v1.5, OAEP (SHA-1) and no padding, with the arithmetic on mbedtls. - `RSA_verify`: the method's `rsa_verify` under `RSA_FLAG_SIGN_VER`, otherwise PKCS#1 v1.5 decryption, the `NID_md5_sha1` case and the `X509_SIG` checks, with the NIDs of the 15 digest objects of LibreSSL 2.5.4's table. `RSA_verify_PKCS1_PSS` and `RSA_padding_add_PKCS1_PSS` keep throwing: they need an `EVP_MD`, which #9448 adds. BER forms LibreSSL also accepts, SSLv23 and X9.31 padding, moduli over 8192 bits, a custom `bn_mod_exp`, negative `BIGNUM`s and a digest type and object both outside the table throw. Four new entries in `docs/dev/debt/libSceLibreSsl.md` record these and the error queue these calls don't fill. **On `main`:** #10449 merged as c8809e82e4, so this PR's six commits now sit on `main` 895ead67f7, which carries alvaroelpob's three. The fifth sets the debt file's pending-exports count to the exports `Export.cpp` still leaves throwing, and each merge of `main` recounts it: 190 at this head (the line on `main` says 196, which matches its `Export.cpp`). Related: #9446 (`BIGNUM`), #9448 (`EVP_MD`, for the PSS calls), #10570, #10418, #10398 (`EVP_PKEY`). ### Tested - **GitHub's runners:** [run 40172479816](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40172479816): `guest_libressl_rsa` and `guest_libressl_runtime` pass 10 of 10 on Linux and on Windows, 0 skipped. - **GitHub's runners, 5576345be4** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40184950002)): the count commit, docs only. `guest_libressl_rsa` and `guest_libressl_runtime` pass 10 of 10. Linux: 2 run, 2 pass, 0 skip, 0 fail. Windows: 2 run, 2 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (144 and 207) and on Windows (171 and 223). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **Linux** x86-64 (Ubuntu 24.04, gcc 13.3.0), no title. `guest_libressl_rsa` gains eight cases on the NIST CAVP FIPS 186-3 SigGen15 2048-bit key: - `RSA_new`/`RSA_free` fields, references, `finish` and `BIGNUM` freeing; - `d2i_RSA_PUBKEY` on that key's SubjectPublicKeyInfo, a truncated encoding refused, and 53 encoding variants; - `RSA_public_decrypt` and `RSA_verify` with the CAVP PKCS#1 v1.5 signature, and a tampered one failing; - `RSA_public_encrypt` with OAEP and v1.5: 256-byte output, two encryptions differ, and each decrypts with the private exponent to a valid block; - the key limits, method dispatch, `X509_SIG` variants and each digest object. - Each commit's new cases fail against its parent and pass with it. - A differential run against a LibreSSL 2.5.4 build over 6,033 generated cases gave no differing result; the cases where these exports throw are the gaps listed above. - CI-configured build, then `ctest` as an unprivileged user: 2,213 tests, 2,118 passed, 90 skipped and 5 failed. The five need IPv6, which that machine lacks: `guest_net_buffer_validation`, `guest_socket_options`, `guest_socket_stream_options`, `guest_socket_address_length` and `guest_tcp`. - **dc07fde9eb, this PR's five commits rebased onto #10449's e44f645642** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40231118592)), after alvaroelpob rebased #10449 onto current `main`. The code is unchanged: the debt entries keep their place after #10449's RSA entry, now followed by `main`'s Functional section, and the count commit sets 334, the `NotImplemented` exports left in Export.cpp. `guest_libressl_rsa`, `guest_libressl_runtime` and `public_headers` pass 10 runs in a row. Linux: 3 run, 3 pass, 0 skip, 0 fail. Windows: 3 run, 3 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (144 and 208) and on Windows (171 and 224). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **Firmware 13.42's `RSA_flags`, by @BunnyFl** ([comment](https://github.com/boykopovar/AnyPS5/pull/10915#issuecomment-6402432767)): the 13.42 `libSceLibreSsl.sprx` code, run in an emulator on structures whose every 4-byte word holds its own offset (two identical runs), reads the method pointer at +0x10 of the `RSA` and returns the int at +0x48 of the method, and gives 0 for a null `RSA`. That matches this PR's `static_assert`s for `meth` and `LibreSslRsaMethod::flags`; the other fields aren't read by that call. - **4df79a235e, a merge of `main` 4e38e23882** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40320357659)). `main`'s 9a848d0b99 implements the TLS alert descriptions and lowers the pending-export count in `docs/dev/debt/libSceLibreSsl.md` from 342 to 341, on the line this PR's count commit sets. The merge keeps `main`'s change and sets the count to 333, the `NotImplemented_nid_no_patch` exports left in the merged `Export.cpp`. Nothing else conflicted, and this PR's other changed lines are the same. The 13 `guest_libressl` tests pass 10 runs in a row. Linux: 13 run, 13 pass, 0 skip, 0 fail. Windows: 13 run, 13 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (145 and 210) and on Windows (174 and 231). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **ac22fabb9d and 939a194466, after oneandonlydean's review and a merge of `main` 84e91df418** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40336778586)). ac22fabb9d drops the RSA test's checks that pinned unimplemented features as throwing, as oneandonlydean asked: `RSA_free` with an ENGINE, ex_data, blinding or Montgomery context set, the BER forms in `d2i_RSA_PUBKEY` and in a signature's DigestInfo, X9.31 decryption, SSLv23 encryption, moduli over 8192 bits, a custom `bn_mod_exp` (with its `OtherModExp` fixture), and digest types with no object. The production refusals and their debt entries stay, and so do the null-pointer, malformed-input and invalid-length checks. 939a194466 merges `main`, whose #9745 (`SSLeay`) lowers the pending-export count in `docs/dev/debt/libSceLibreSsl.md` to 340, on the line this PR sets; the merge keeps it and sets 332, the `NotImplemented_nid_no_patch` exports left in the merged `Export.cpp`. Nothing else conflicted. `guest_libressl_rsa`, the other `guest_libressl` tests and the tests for the files the merge changes, 24 of them, pass 10 runs in a row. Linux: 24 run, 24 pass, 0 skip, 0 fail. Windows: 24 run, 24 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (145 and 211) and on Windows (174 and 232). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **7cfe819145, a merge of `main` 18ef6be0cd** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40381179903)). alvaroelpob's #10373 (`sk_*`) and #10376 (`UI_create_method`) add their sources and tests next to this PR's in `core/libs/prx/libSceLibreSsl/CMakeLists.txt` and their structs next to this PR's `LibreSslRsaMethod` and `LibreSslRsa` in `include/Api.hpp`; #10373's debt entry sits next to this PR's in `docs/dev/debt/libSceLibreSsl.md`, and the two lower the pending-export count to 321, on the line this PR sets. The merge keeps both sides in each and sets 313, the `NotImplemented_nid_no_patch` exports left in the merged `Export.cpp`. This PR's other changed lines are the same. The `guest_libressl` tests with the tests for the files the merge changes pass 10 runs in a row. Linux: 92 run, 92 pass, 0 skip, 0 fail. Windows: 90 run, 90 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (145 and 212) and on Windows (174 and 233). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **7cf76af1d5, this PR's six commits on `main` 895ead67f7** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40639078953)), after #10449 merged. The branch now holds only this PR's commits, moved onto `main` with a force-push. Each commit's changed lines are the same as before, and only their context moved: the `add_library` line now lists `main`'s newer sources, and `Api.hpp` and the debt file sit on `main`'s versions. The count commit sets 301, what `Export.cpp` leaves with this PR's six exports. `guest_libressl_rsa` and `guest_libressl_runtime` pass 10 runs in a row. Linux: 2 run, 2 pass, 0 skip, 0 fail. Windows: 2 run, 2 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (166 and 264). On Windows libc passes (194), and libkernel passes 283 of 286: `exec_arguments`, `guest_timed_join_import_libkernel_sys` and `guest_timed_join_import_libkernel_web` fail at their setup in the verify's Windows build (`FileNotFoundError` starting the title, or copying the libraries they load), and pass in `main`'s own Windows job at 1829def9bf ([job](https://github.com/boykopovar/AnyPS5/actions/runs/40627345977/job/122615375186)). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **4ad9203124, a merge of `main` 04fefebe90** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40708717555)). The one conflict was the pending-exports count in `docs/dev/debt/libSceLibreSsl.md`: `main` reads 300 after JaceTheBlu's #11105 (X509 lookups), and with this PR's implementations the merged `Export.cpp` has 294 calls left that go through `NotImplemented_nid_no_patch`, so the entry now says 294. This PR's other changed lines are the same. `guest_libressl_rsa` and `guest_libressl_runtime` ran 10 times with no failure. Linux: 2 run, 2 pass, 0 skip, 0 fail. Windows: 2 run, 2 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (171 and 289). On Windows libc passes (199), and libkernel passes 309 of 312: `exec_arguments`, `guest_timed_join_import_libkernel_sys` and `guest_timed_join_import_libkernel_web` fail at their setup in the verify's Windows build (`FileNotFoundError` starting the title, or copying the libraries they load), with `main`'s code too, and pass in `main`'s own Windows job at 1829def9bf ([job](https://github.com/boykopovar/AnyPS5/actions/runs/40627345977/job/122615375186)). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **7be988fd70, a merge of `main` 58b2753d74** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/40940951092)). The one conflict was the pending-exports count in `docs/dev/debt/libSceLibreSsl.md`: `main` reads 299 after JaceTheBlu's #11189 (`X509_VERIFY_PARAM_set1_host`), and with this PR's implementations the merged `Export.cpp` has 293 calls left that go through `NotImplemented_nid_no_patch`, so the entry now says 293. This PR's other changed lines are the same. `^guest_libressl` and `public_headers` ran 10 times with no failure. Linux: 33 run, 33 pass, 0 skip, 0 fail. Windows: 33 run, 33 pass, 0 skip, 0 fail. The libc and libkernel suites run 193 and 292 tests on Linux and 223 and 315 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **77af176ffa, a merge of `main` c12e7e61a1** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41161936721)), which brings JaceTheBlu's #13562 (`OBJ_create` and `OBJ_cleanup`). The one conflict was the pending-exports count in `docs/dev/debt/libSceLibreSsl.md`: `main` reads 292 after #13562, and with this PR's implementations the merged `Export.cpp` has 286 calls left that go through `NotImplemented_nid_no_patch`, so the entry now says 286. `CMakeLists.txt`, `Export.cpp` and `Api.hpp` merged without conflicts, and this PR's other changed lines are the same. `^guest_libressl` and `public_headers` ran 10 times with no failure. Linux: 34 run, 34 pass, 0 skip, 0 fail. Windows: 34 run, 34 pass, 0 skip, 0 fail. The libc and libkernel suites run 199 and 308 tests on Linux and 226 and 330 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **fa25361695, a merge of `main` 0a148be963** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41264470544)), which brings Ninot1Quyi's #13820 (SHA-512 initialization buffers) and hyvvs's #13760 (`GENERAL_NAME_free` and `GENERAL_NAMES_free`). - **The one conflict** was the pending-exports count in `docs/dev/debt/libSceLibreSsl.md`, next to `main`'s new and changed entries. The merge keeps those entries, and every other line comes from the side that changed it. - **The count** is the merged tree's `Export.cpp` total, 284 `NotImplemented_nid_no_patch` exports; `main`'s line was 2 above its own total. - This PR's other changed lines are the same. - **×10:** `^guest_libressl` and `public_headers`. Linux: 38 run, 38 pass, 0 skip, 0 fail. Windows: 38 run, 38 pass, 0 skip, 0 fail. The libc and libkernel suites run 199 and 308 tests on Linux and 226 and 330 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **67a8e941dd: merges of `main` 88e804b0a7 (e6b8a1727b) and 3c3b3cda73 (2eb2e4e3c0), each followed by a recount of the pending exports (39753d71a9, 67a8e941dd)** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41433968742), on 67a8e941dd). - **e6b8a1727b** brings Felipebmaitan's #9535 (error queues) and atharvjairath's #10078 (`X509_EXTENSION` getters). The one conflict was the pending-exports count line in `docs/dev/debt/libSceLibreSsl.md`. - **2eb2e4e3c0** brings alvaroelpob's #10488 (`EVP_CIPHER_CTX`), without conflicts. - **The count** is the `NotImplemented_nid_no_patch` calls left in each merged `Export.cpp`: 278 after the first merge (#9535 and #10078 implement three each) and 275 after the second (#10488 implements three). - This PR's diff over `main` is otherwise unchanged. The `^guest_libressl` tests, with `guest_libressl_rsa` and `public_headers`, pass 10 runs in a row. Linux: 44 run, 44 pass, 0 skip, 0 fail. Windows: 44 run, 44 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (214 and 316) and on Windows (241 and 337). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **55ff0cdc99, a merge of `main` b28bb77217** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41483593254)), which brings HQasper's #9448 (the EVP message digest and HMAC functions). - **The one conflict** was `docs/dev/debt/libSceLibreSsl.md`, where the merge keeps #9448's new entry with this PR's. - **The count** is 255, the `NotImplemented_nid_no_patch` calls left in the merged `Export.cpp`: `main`'s 261, which its line now matches, less the 6 this PR implements. - This PR's other changed lines over `main` are the same, and it merges cleanly with `main` a4eca2a056. - **×10:** the `^guest_libressl` tests, with `guest_libressl_rsa` and `public_headers`. Linux: 46 run, 46 pass, 0 skip, 0 fail. Windows: 46 run, 46 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (217 and 319) and on Windows (244 and 340). The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **7482bd278c, a merge of `main` 4f41f4c375** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41612935334)), which brings Felipebmaitan's #9571 (CMAC with the AES-CBC ciphers). - **The conflict:** the pending-exports count in `docs/dev/debt/libSceLibreSsl.md`, which both sides changed. The merged `Export.cpp` has 225 `NotImplemented` exports, so the entry now says 225 (this PR said 255, `main` 231). No function is in both PRs, and this PR's other lines are unchanged. - **×10:** every `^guest_libressl` test. Linux: 51 run, 51 pass, 0 skip, 0 fail. Windows: 51 run, 51 pass, 0 skip, 0 fail. The libc and libkernel suites run 300 and 322 tests on Linux and 327 and 342 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **AMD:** TechLevelZero's AMD bot ran this head merged onto `main` 4f41f4c: AMD Radeon RX 6300 (RADV NAVI24, Mesa 25.2.8; [report](https://github.com/boykopovar/AnyPS5/pull/10915#issuecomment-6604719617)): 1,147 passed, 6 failed, none new (4 also fail on `main`, 2 unstable on `main`), 6 skipped, with no new validation IDs (551 tests on the GPU). - **13c396c3c4, the type 1 padding minimum and a debt sentence**, for points 1 and 2 of XairRrR's [review](https://github.com/boykopovar/AnyPS5/pull/10915#pullrequestreview-5752940890). - **The test:** `TestPublicDecrypt` now recovers two type 1 blocks through `RSA_public_decrypt` with PKCS#1 padding. One has seven 0xFF bytes and must be refused (-1); the other has eight and must give its 245-byte payload. - **Red:** 36b6296408 lowers `RSA_padding_check_PKCS1_type_1`'s minimum from 8 to 1 (`index < 1`). `guest_libressl_rsa` then fails at the seven-byte case, "LibreSSL RSA check failed at line 503", on GitHub's Linux and Windows runners ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41660218457)). - **The debt file:** the `RSA_flags, RSA_size` entry drops "No export of this module creates a key yet, so only keys the caller builds reach them", since `RSA_new` and `d2i_RSA_PUBKEY` now do. - **×10** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41660179072)): every `^guest_libressl` test. Linux: 51 run, 51 pass, 0 skip, 0 fail. Windows: 51 run, 51 pass, 0 skip, 0 fail. The libc and libkernel suites run 300 and 322 tests on Linux and 327 and 342 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **7ecf157d95, a merge of `main` 9ab6a281ea** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41881306199)), which brings MatteoSid's #10395 (EC groups and keys). - **The conflict:** the pending-exports count in `docs/dev/debt/libSceLibreSsl.md`, which both sides changed. The merged `Export.cpp` has 216 `NotImplemented` exports, so the entry now says 216 (this PR said 225, `main` 222). No function is in both PRs, and this PR's other lines are unchanged. - **×10:** every `^guest_libressl` test, with `public_headers`. Linux: 54 run, 54 pass, 0 skip, 0 fail. Windows: 54 run, 54 pass, 0 skip, 0 fail. The libc and libkernel suites run 303 and 327 tests on Linux and 335 and 354 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **354e5c8351, a merge of `main` b611e634f7** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41909334201)), which brings LordVersA's #11662 (`SSL_library_init`). - **The conflict:** the pending-exports count in `docs/dev/debt/libSceLibreSsl.md`, which both sides changed. The merged `Export.cpp` had 215 `NotImplemented` exports, so the entry said 215 (this PR said 216, `main` 221). No function is in both PRs, and this PR's other lines are unchanged. - **×10:** every `^guest_libressl` test, with `public_headers`. Linux: 54 run, 54 pass, 0 skip, 0 fail. Windows: 54 run, 54 pass, 0 skip, 0 fail. The libc and libkernel suites run 303 and 329 tests on Linux and 335 and 360 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **4c7c65a244, a merge of `main` d63781e9ce** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41928402076)), which brings alvaroelpob's #10450 (`EVP_CIPHER_block_size`). - **The conflict:** the pending-exports count in `docs/dev/debt/libSceLibreSsl.md`: the merged `Export.cpp` had 214 `NotImplemented` exports, so the entry said 214 (this PR said 215, `main` 220). No function is in both PRs, and this PR's other lines are unchanged. - **×10:** every `^guest_libressl` test (now including #10450's `guest_libressl_evp_cipher`) and `public_headers`. Linux: 55 run, 55 pass, 0 skip, 0 fail. Windows: 55 run, 55 pass, 0 skip, 0 fail. The libc and libkernel suites run 303 and 329 tests on Linux and 335 and 360 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **05387ced6d, a merge of `main` 9f9e420709** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/41937717597)), which brings alvaroelpob's #10448 (`OCSP_response_status`, `OCSP_single_get0_status`). - **The conflict:** the pending-exports count in `docs/dev/debt/libSceLibreSsl.md`. The merged `Export.cpp` has 212 `NotImplemented` exports, so the pending-exports entry now says 212 (this PR said 214, `main` 218). - No function is in both PRs, and this PR's other lines are unchanged. - **×10:** every `^guest_libressl` test (now including #10448's `guest_libressl_ocsp_response`) and `public_headers`. Linux: 56 run, 56 pass, 0 skip, 0 fail. Windows: 56 run, 56 pass, 0 skip, 0 fail. The libc and libkernel suites run 303 and 329 tests on Linux and 335 and 360 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. - **TechLevelZero's AMD GPU test at 354e5c8351** ([report](https://github.com/boykopovar/AnyPS5/pull/10915#issuecomment-6644337075)), with `VK_LAYER_KHRONOS_validation`: AMD Radeon RX 6300 (RADV NAVI24, Mesa 25.2.8), this head merged onto `main` b611e63, 1,133 of 3,946 tests selected. 1,125 passed, 3 failed (none new: all 3 also fail on `main`), 5 skipped. No new validation IDs over 575 GPU tests. `guest_libressl_rsa` wasn't in the selection. - **984cae2063, a merge of `main` e772fb25cc** ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/42019089198)), which brings our #10834 (the EVP cipher calls on the cipher context), StoneDC's #12774, #12775 and #14283 (tests of error-queue interleavings, DES ECB known answers, and SHA padding and digest extents) and rooklz's #14717 (the documented exception for faulting lookup and verify-parameter arguments). - **The conflict:** the pending-exports count in `docs/dev/debt/libSceLibreSsl.md`. The merged `Export.cpp` has 190 `NotImplemented` exports, so the pending-exports entry now says 190 (this PR said 212, `main` 196). - No function is in both PRs, and this PR's other lines are unchanged. - **×10:** every `^guest_libressl` test and `public_headers`. Linux: 58 run, 58 pass, 0 skip, 0 fail. Windows: 57 run, 57 pass, 0 skip, 0 fail; `guest_libressl3_mixed_evp` is registered only on Linux. The libc and libkernel suites run 322 and 331 tests on Linux and 353 and 362 on Windows, with 0 failed. The suites ran with `APS5_SKIP_TIMING_TESTS=1`, which relaxes `precise_wait`'s median bounds on GitHub's hosted runners. ### 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; #10449, which this PR built on, has merged (c8809e82e4). Our #10834, which set the same pending-exports count line in `docs/dev/debt/libSceLibreSsl.md`, has merged (5a273d9f3b), and this head's count includes it. Any order with our #10878, which sets that line too: whichever merges later recounts it in a `main` merge. Any order with alvaroelpob's #10490 (libSceLibreSsl3): the overlap table's `RSA_new` and `d2i_RSA_PUBKEY` are its placeholder entries there, and the two share no file - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-25 10:29:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T10:29:51Z.

Review: COMMENTED


I inspected the seven-commit diff and the RSA paths. The report in #8981 plus the cross-release layout evidence resolves my original version/structure concern. However, this PR is explicitly stacked on #10449, which is still open with mergeStateStatus: DIRTY; its CI on #10915 currently consists of policy checks, with product test/build paths skipped. The full Linux RSA test results in the description are author-reported, not independently rerun by me.

I am leaving this review as a comment rather than approving the dependent stack. Please coordinate the base PR's conflict resolution/landing and rerun the RSA target and conventions on the resulting exact head; then I can finish the review. This is an integration/test-status hold, not a finding that the reported crypto behavior is wrong.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5642747844 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10915#pullrequestreview-5642747844). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T10:29:51Z. **Review:** COMMENTED --- I inspected the seven-commit diff and the RSA paths. The report in #8981 plus the cross-release layout evidence resolves my original version/structure concern. However, this PR is explicitly stacked on #10449, which is still open with `mergeStateStatus: DIRTY`; its CI on #10915 currently consists of policy checks, with product test/build paths skipped. The full Linux RSA test results in the description are author-reported, not independently rerun by me. I am leaving this review as a comment rather than approving the dependent stack. Please coordinate the base PR's conflict resolution/landing and rerun the RSA target and conventions on the resulting exact head; then I can finish the review. This is an integration/test-status hold, not a finding that the reported crypto behavior is wrong.
ahmadmuj commented 2026-10-25 18:17:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-10-25T18:17:00Z.

Review: APPROVED


Reviewed head 5576345be456 merged locally onto main 7a25f87620a9 (merge 0fe667a97c45, not pushed). Linux x86-64, GCC 13.3, host only, no console.

What I ran:

  • Merge: only docs/dev/debt/libSceLibreSsl.md conflicts. I kept main's file, added your 5 RSA lines after the ERR entry, and set the pending count to 337. Main is already at 345, and the merged Export.cpp has 337 NotImplemented_nid_no_patch stubs. Everything else auto-merges, and the merged diff vs main matches this PR's own stat.
  • Built the 9 guest_libressl_* targets, then ctest -R guest_libressl: 11/11 pass, guest_libressl_rsa 4/4 runs. check_conventions.py --base origin/main passes. On plain main the new test doesn't compile (no LibreSslRsa), so it does guard the change.
  • Layout: sizeof/offsetof probe against the official LibreSSL 2.5.4 tarball headers (sha256 107a5b52..., matches OpenBSD's SHA256 file). rsa_st 152, rsa_meth_st 112, bignum_st 24, and every field offset equals LibreSslRsa, LibreSslRsaMethod and LibreSslBignum. The flag, padding, limit and NID constants and the 15 digest OIDs match too.
  • Differential against a static 2.5.4 libcrypto: 12 keys from 320 to 4096 bits (e=3 and 65537, including 1031 bits) plus synthetic 8193- and 16385-bit moduli, 2095 checks on the merged exports. It covers RSA_size; d2i_RSA_PUBKEY on 87 DER cases (accept/reject and consumed length); RSA_public_decrypt on 2.5.4 RSA_private_encrypt output plus malformed type-1 blocks; RSA_verify on 2.5.4 RSA_sign output for md5, sha1, sha2 and md5_sha1 plus tampered DigestInfo forms; and RSA_public_encrypt PKCS1/OAEP/none output decrypted by 2.5.4 RSA_private_decrypt (104/104). Zero mismatches. The 38 cases where this throws and 2.5.4 returns a value are all in your debt list: BER indefinite/constructed forms, SSLv23 encrypt, X931 decrypt, the 8193-bit modulus, and a digest type and object both outside the table.

Small things, none blocking:

  1. The RSA_flags/RSA_size debt line still says "No export of this module creates a key yet, so only keys the caller builds reach them." That came from the #10449 commit. With RSA_new and d2i_RSA_PUBKEY in this same PR it isn't true anymore, so I'd drop the sentence.
  2. DefaultPublicDecrypt runs the mod-exp before the padding switch. With an 8193-16384-bit key and an unknown padding (say 0) it throws on the mbedtls limit, while 2.5.4 returns -1 whatever the mod-exp gives (the default: case in RSA_eay_public_decrypt goes to err). Returning -1 for unknown paddings before PublicOperation would match.
  3. A few boundaries aren't pinned in GuestLibreSslRsa.cpp: exactly 8 vs 7 FF bytes in a type-1 block (i < 8 in rsa_pk1.c), a 3072-bit modulus with a 65-bit exponent (accepted), and exactly 16384 bits. The differential confirms the first two match 2.5.4, so this is only about catching a future off-by-one.

Not checked: anything on a console; RSA_new, RSA_free and RSA_flags beyond layout and constants; d2i_RSA_PUBKEY with a non-null out; the ERR queue (your debt says it stays empty).

Approving on the above. The rebase only needs the 337 count.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5644603883 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10915#pullrequestreview-5644603883). Originally posted by [ahmadmuj](https://github.com/ahmadmuj) on 2026-10-25T18:17:00Z. **Review:** APPROVED --- Reviewed head `5576345be456` merged locally onto main `7a25f87620a9` (merge `0fe667a97c45`, not pushed). Linux x86-64, GCC 13.3, host only, no console. What I ran: - Merge: only `docs/dev/debt/libSceLibreSsl.md` conflicts. I kept main's file, added your 5 RSA lines after the ERR entry, and set the pending count to 337. Main is already at 345, and the merged Export.cpp has 337 `NotImplemented_nid_no_patch` stubs. Everything else auto-merges, and the merged diff vs main matches this PR's own stat. - Built the 9 `guest_libressl_*` targets, then `ctest -R guest_libressl`: 11/11 pass, `guest_libressl_rsa` 4/4 runs. `check_conventions.py --base origin/main` passes. On plain main the new test doesn't compile (no `LibreSslRsa`), so it does guard the change. - Layout: sizeof/offsetof probe against the official LibreSSL 2.5.4 tarball headers (sha256 `107a5b52...`, matches OpenBSD's SHA256 file). `rsa_st` 152, `rsa_meth_st` 112, `bignum_st` 24, and every field offset equals `LibreSslRsa`, `LibreSslRsaMethod` and `LibreSslBignum`. The flag, padding, limit and NID constants and the 15 digest OIDs match too. - Differential against a static 2.5.4 libcrypto: 12 keys from 320 to 4096 bits (e=3 and 65537, including 1031 bits) plus synthetic 8193- and 16385-bit moduli, 2095 checks on the merged exports. It covers RSA_size; d2i_RSA_PUBKEY on 87 DER cases (accept/reject and consumed length); RSA_public_decrypt on 2.5.4 RSA_private_encrypt output plus malformed type-1 blocks; RSA_verify on 2.5.4 RSA_sign output for md5, sha1, sha2 and md5_sha1 plus tampered DigestInfo forms; and RSA_public_encrypt PKCS1/OAEP/none output decrypted by 2.5.4 RSA_private_decrypt (104/104). Zero mismatches. The 38 cases where this throws and 2.5.4 returns a value are all in your debt list: BER indefinite/constructed forms, SSLv23 encrypt, X931 decrypt, the 8193-bit modulus, and a digest type and object both outside the table. Small things, none blocking: 1. The RSA_flags/RSA_size debt line still says "No export of this module creates a key yet, so only keys the caller builds reach them." That came from the #10449 commit. With RSA_new and d2i_RSA_PUBKEY in this same PR it isn't true anymore, so I'd drop the sentence. 2. `DefaultPublicDecrypt` runs the mod-exp before the padding switch. With an 8193-16384-bit key and an unknown padding (say 0) it throws on the mbedtls limit, while 2.5.4 returns -1 whatever the mod-exp gives (the `default:` case in `RSA_eay_public_decrypt` goes to `err`). Returning -1 for unknown paddings before `PublicOperation` would match. 3. A few boundaries aren't pinned in GuestLibreSslRsa.cpp: exactly 8 vs 7 FF bytes in a type-1 block (`i < 8` in rsa_pk1.c), a 3072-bit modulus with a 65-bit exponent (accepted), and exactly 16384 bits. The differential confirms the first two match 2.5.4, so this is only about catching a future off-by-one. Not checked: anything on a console; RSA_new, RSA_free and RSA_flags beyond layout and constants; d2i_RSA_PUBKEY with a non-null `out`; the ERR queue (your debt says it stays empty). Approving on the above. The rebase only needs the 337 count.
XairRrR commented 2026-11-03 13:24:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T13:24:52Z.

Review: APPROVED


Reviewed — approved

RSA_new, RSA_free, d2i_RSA_PUBKEY, RSA_public_encrypt, RSA_public_decrypt and RSA_verify build and pass their tests on the merged tree. I compared them with LibreSSL 2.5.4's rsa_lib.c, rsa_eay.c, rsa_pk1.c, rsa_oaep.c, rsa_none.c, rsa_sign.c and x_bignum.c and found no behavioural mismatch. My findings are non-blocking.

What I ran

Head 7482bd278c6decb380bf521396bd3295dd4f8d78, merged with --no-ff into main 4f41f4c375f5abb487dbd184fbc150f31994d762 (merged tree c24b6dba35db8d602e65e6376a2399a13d3d67c8). Debian 13 VM, Intel Xeon Gold 6136, GCC 14.2.0, Release, Ninja.

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...7482bd278c6decb380bf521396bd3295dd4f8d78
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ctest --test-dir build -R "guest_libressl_rsa|public_headers" --output-on-failure
grep -c "NotImplemented_nid_no_patch(__func__)" core/libs/prx/libSceLibreSsl/Export.cpp   # merged tree and main
# negative control: Rsa.cpp, Api.hpp, Export.cpp restored from main
ninja -C build -j32 -l32 guest_libressl_rsa_tests
# mutation checks on Rsa.cpp (one at a time), then restore from the merged tree
ninja -C build -j32 -l32 guest_libressl_rsa_tests
ctest --test-dir build -R "^guest_libressl_rsa$" --output-on-failure
git status --porcelain

Results

Check Result
git diff --check clean
check_conventions.py "All conventions checks passed."
Build (script) configure, build and libs OK
Script test run (843 selected tests) 841 passed, 1 expected skip, 0 new failures. The one failure, unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group, also fails on main.
guest_libressl_rsa passed, 0.33 s
public_headers (65 tests) passed; with guest_libressl_rsa, 66/66 pass
Pending-export count in docs/dev/debt/libSceLibreSsl.md 225 matches the merged Export.cpp; main has 231
Vulkan validation not applicable: no AGC driver, shader or VideoOut file changed
Worktree after the controls git status --porcelain empty

Negative control

  • PR's production code reverted: with src/Rsa.cpp, include/Api.hpp and Export.cpp restored from main, guest_libressl_rsa_tests doesn't compile. For example, GuestLibreSslRsa.cpp:158: unable to deduce 'auto*' from 'RSA_new_nid_postfix()' and too many arguments to function 'int d2i_RSA_PUBKEY_nid_postfix()'. So the test depends on the change.
  • Behavioural mutations on the merged Rsa.cpp, one at a time:
    • Removing the DigestInfo parameter check (if (algorithm.parameter && !algorithm.nullParameter) return 0;): the test fails ("LibreSSL RSA check failed at line 688").
    • Lowering the PKCS#1 type-1 minimum padding from index < 8 to index < 1 (Rsa.cpp:433): the test still passes. See the first non-blocking finding.
  • Afterwards I restored the merged files and rebuilt. The test passes again and the worktree is clean.

Findings

Blocking

None.

Non-blocking

  1. The 8-byte minimum padding in RSA_padding_check_PKCS1_type_1 is not tested at all. At core/libs/prx/libSceLibreSsl/src/Rsa.cpp:433, index < 8 can be weakened to index < 1 and guest_libressl_rsa still passes. ahmadmuj's review noted that the exact 7-vs-8 boundary isn't pinned. The mutation above shows the check isn't exercised at all. It is a signature-validity check (fewer than 8 0xFF bytes must be refused), so a regression would go unnoticed.
    • Suggested fix: in TestPublicDecrypt or TestVerify, use the existing Recover helper to build two blocks: 00 01 + 7×FF + 00 + payload (expect -1 or 0) and 00 01 + 8×FF + 00 + payload (accepted).
  2. A debt sentence is no longer true (still open from ahmadmuj's review). docs/dev/debt/libSceLibreSsl.md:24, in the RSA_flags, RSA_size entry, still says "No export of this module creates a key yet, so only keys the caller builds reach them." RSA_new and d2i_RSA_PUBKEY in this PR now create keys. CONTRIBUTING asks a PR that closes a gap to cut the entry to what is still open.
    • Suggested fix: drop the sentence.
  3. Unknown paddings with a 8193–16384-bit key throw instead of returning -1 (still open from ahmadmuj's review). DefaultPublicDecrypt runs PublicOperation (Rsa.cpp:514) before it rejects unknown paddings. With such a key and padding 0, it throws on the mbedtls 8192-bit limit, where 2.5.4 returns -1.
    • Suggested fix: return -1 for paddings other than PKCS#1, none and X9.31 before the modular exponentiation.
  4. The progress report counts the method slots as exports. The Default* slot functions (Rsa.cpp:449-603) are APS5_VABI functions in the anonymous namespace. The progress report lists DefaultInit as implemented and the seven other Default* slots as "declared as stubs", which inflates libSceLibreSsl's numbers (164/420 → 168/428). Meanwhile RSA_free, RSA_verify and d2i_RSA_PUBKEY don't appear as implemented at all.
    • Suggested fix: CONTRIBUTING asks helper symbols that must not become NIDs to carry the _nid_no_patch suffix. Renaming them (DefaultInit_nid_no_patch, …) would keep them out of the tools' export lists.

What I checked against my reading of LibreSSL 2.5.4, with no difference found:

  • RSA_new_method: flags meth->flags & ~RSA_FLAG_NON_FIPS_ALLOW, then RSA_eay_init sets CACHE_PUBLIC | CACHE_PRIVATE.
  • RSA_free: reference drop, finish, BN_clear_free.
  • RSA_eay_public_encrypt and RSA_eay_public_decrypt: modulus, exponent and flen checks and output zero-fill.
  • RSA_padding_add_PKCS1_type_2, RSA_padding_add_PKCS1_OAEP (emlen = tlen - 1, SHA-1 MGF1), RSA_padding_add_none, RSA_padding_check_none, and the type-1 scan.
  • int_rsa_verify: signature length, the 36-byte NID_md5_sha1 case, the trailing-data, parameter and NID checks.
  • d2i_RSA_PUBKEY: *pp advanced only on success, and the previous *a freed.
  • bn_c2i/BN_bin2bn read the raw INTEGER content, so a 257-byte modulus gives dmax 33, as the test expects.

Not verified

  • Nothing ran on a console. The layout evidence is the #8981 measurement and BunnyFl's RSA_flags emulation, both from the discussion. I didn't reproduce either.
  • I didn't build LibreSSL 2.5.4, so the author's and ahmadmuj's differential runs are not reproduced here. In particular, I couldn't confirm from source whether 2.5.4's int_rsa_verify re-encodes the X509_SIG in DER and compares it with the decrypted block. If it does, the non-minimal NULL parameter that the test accepts (GuestLibreSslRsa.cpp:686, 05 81 00) would be refused there. Both differentials report no mismatch, so I'm not raising it as a finding.
  • I didn't build or test on Windows/MinGW.
  • I didn't check thread safety of concurrent RSA_free on a shared key beyond reading the std::atomic_ref decrement.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5752940890 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10915#pullrequestreview-5752940890). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T13:24:52Z. **Review:** APPROVED --- # Reviewed — approved `RSA_new`, `RSA_free`, `d2i_RSA_PUBKEY`, `RSA_public_encrypt`, `RSA_public_decrypt` and `RSA_verify` build and pass their tests on the merged tree. I compared them with LibreSSL 2.5.4's `rsa_lib.c`, `rsa_eay.c`, `rsa_pk1.c`, `rsa_oaep.c`, `rsa_none.c`, `rsa_sign.c` and `x_bignum.c` and found no behavioural mismatch. My findings are non-blocking. ## What I ran Head `7482bd278c6decb380bf521396bd3295dd4f8d78`, merged with `--no-ff` into `main` `4f41f4c375f5abb487dbd184fbc150f31994d762` (merged tree `c24b6dba35db8d602e65e6376a2399a13d3d67c8`). Debian 13 VM, Intel Xeon Gold 6136, GCC 14.2.0, Release, Ninja. ``` git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...7482bd278c6decb380bf521396bd3295dd4f8d78 python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ctest --test-dir build -R "guest_libressl_rsa|public_headers" --output-on-failure grep -c "NotImplemented_nid_no_patch(__func__)" core/libs/prx/libSceLibreSsl/Export.cpp # merged tree and main # negative control: Rsa.cpp, Api.hpp, Export.cpp restored from main ninja -C build -j32 -l32 guest_libressl_rsa_tests # mutation checks on Rsa.cpp (one at a time), then restore from the merged tree ninja -C build -j32 -l32 guest_libressl_rsa_tests ctest --test-dir build -R "^guest_libressl_rsa$" --output-on-failure git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | "All conventions checks passed." | | Build (script) | configure, build and `libs` OK | | Script test run (843 selected tests) | 841 passed, 1 expected skip, 0 new failures. The one failure, `unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group`, also fails on `main`. | | `guest_libressl_rsa` | passed, 0.33 s | | `public_headers` (65 tests) | passed; with `guest_libressl_rsa`, 66/66 pass | | Pending-export count in `docs/dev/debt/libSceLibreSsl.md` | 225 matches the merged `Export.cpp`; `main` has 231 | | Vulkan validation | not applicable: no AGC driver, shader or VideoOut file changed | | Worktree after the controls | `git status --porcelain` empty | ## Negative control - **PR's production code reverted:** with `src/Rsa.cpp`, `include/Api.hpp` and `Export.cpp` restored from `main`, `guest_libressl_rsa_tests` doesn't compile. For example, `GuestLibreSslRsa.cpp:158: unable to deduce 'auto*' from 'RSA_new_nid_postfix()'` and `too many arguments to function 'int d2i_RSA_PUBKEY_nid_postfix()'`. So the test depends on the change. - **Behavioural mutations** on the merged `Rsa.cpp`, one at a time: - Removing the DigestInfo parameter check (`if (algorithm.parameter && !algorithm.nullParameter) return 0;`): the test fails ("LibreSSL RSA check failed at line 688"). - Lowering the PKCS#1 type-1 minimum padding from `index < 8` to `index < 1` (`Rsa.cpp:433`): the test **still passes**. See the first non-blocking finding. - Afterwards I restored the merged files and rebuilt. The test passes again and the worktree is clean. ## Findings ### Blocking None. ### Non-blocking 1. **The 8-byte minimum padding in `RSA_padding_check_PKCS1_type_1` is not tested at all.** At `core/libs/prx/libSceLibreSsl/src/Rsa.cpp:433`, `index < 8` can be weakened to `index < 1` and `guest_libressl_rsa` still passes. ahmadmuj's review noted that the exact 7-vs-8 boundary isn't pinned. The mutation above shows the check isn't exercised at all. It is a signature-validity check (fewer than 8 `0xFF` bytes must be refused), so a regression would go unnoticed. - **Suggested fix:** in `TestPublicDecrypt` or `TestVerify`, use the existing `Recover` helper to build two blocks: `00 01` + 7×`FF` + `00` + payload (expect -1 or 0) and `00 01` + 8×`FF` + `00` + payload (accepted). 2. **A debt sentence is no longer true (still open from ahmadmuj's review).** `docs/dev/debt/libSceLibreSsl.md:24`, in the `RSA_flags, RSA_size` entry, still says "No export of this module creates a key yet, so only keys the caller builds reach them." `RSA_new` and `d2i_RSA_PUBKEY` in this PR now create keys. CONTRIBUTING asks a PR that closes a gap to cut the entry to what is still open. - **Suggested fix:** drop the sentence. 3. **Unknown paddings with a 8193–16384-bit key throw instead of returning -1 (still open from ahmadmuj's review).** `DefaultPublicDecrypt` runs `PublicOperation` (`Rsa.cpp:514`) before it rejects unknown paddings. With such a key and padding 0, it throws on the mbedtls 8192-bit limit, where 2.5.4 returns -1. - **Suggested fix:** return -1 for paddings other than PKCS#1, none and X9.31 before the modular exponentiation. 4. **The progress report counts the method slots as exports.** The `Default*` slot functions (`Rsa.cpp:449-603`) are `APS5_VABI` functions in the anonymous namespace. The progress report lists `DefaultInit` as implemented and the seven other `Default*` slots as "declared as stubs", which inflates libSceLibreSsl's numbers (164/420 → 168/428). Meanwhile `RSA_free`, `RSA_verify` and `d2i_RSA_PUBKEY` don't appear as implemented at all. - **Suggested fix:** CONTRIBUTING asks helper symbols that must not become NIDs to carry the `_nid_no_patch` suffix. Renaming them (`DefaultInit_nid_no_patch`, …) would keep them out of the tools' export lists. What I checked against my reading of LibreSSL 2.5.4, with no difference found: - `RSA_new_method`: flags `meth->flags & ~RSA_FLAG_NON_FIPS_ALLOW`, then `RSA_eay_init` sets `CACHE_PUBLIC | CACHE_PRIVATE`. - `RSA_free`: reference drop, `finish`, `BN_clear_free`. - `RSA_eay_public_encrypt` and `RSA_eay_public_decrypt`: modulus, exponent and `flen` checks and output zero-fill. - `RSA_padding_add_PKCS1_type_2`, `RSA_padding_add_PKCS1_OAEP` (`emlen = tlen - 1`, SHA-1 MGF1), `RSA_padding_add_none`, `RSA_padding_check_none`, and the type-1 scan. - `int_rsa_verify`: signature length, the 36-byte `NID_md5_sha1` case, the trailing-data, parameter and NID checks. - `d2i_RSA_PUBKEY`: `*pp` advanced only on success, and the previous `*a` freed. - `bn_c2i`/`BN_bin2bn` read the raw INTEGER content, so a 257-byte modulus gives `dmax` 33, as the test expects. ## Not verified - Nothing ran on a console. The layout evidence is the #8981 measurement and BunnyFl's `RSA_flags` emulation, both from the discussion. I didn't reproduce either. - I didn't build LibreSSL 2.5.4, so the author's and ahmadmuj's differential runs are not reproduced here. In particular, I couldn't confirm from source whether 2.5.4's `int_rsa_verify` re-encodes the `X509_SIG` in DER and compares it with the decrypted block. If it does, the non-minimal NULL parameter that the test accepts (`GuestLibreSslRsa.cpp:686`, `05 81 00`) would be refused there. Both differentials report no mismatch, so I'm not raising it as a finding. - I didn't build or test on Windows/MinGW. - I didn't check thread safety of concurrent `RSA_free` on a shared key beyond reading the `std::atomic_ref` decrement. <!-- anyps5-bots job=2104 head=7482bd278c6decb380bf521396bd3295dd4f8d78 -->
XairRrR commented 2026-11-03 17:26:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T17:26:42Z.

Review: APPROVED


Re-checked — approved

Commit 13c396c3c4 tests the 8-byte minimum of PKCS#1 type 1 padding and removes the outdated RSA_flags, RSA_size debt sentence. That resolves my previous findings 1 and 2. The author kept findings 3 and 4 as they are, and neither blocks.

What changed since my last review

  • The range-diff shows commits 1–8 unchanged. The one new commit, 13c396c3c4 (test plus docs), adds the following:
    • core/libs/tests/GuestLibreSslRsa.cpp:500-505: TestPublicDecrypt signs two type 1 blocks with the private exponent through Recover and decrypts them with RSA_public_decrypt and RSA_PKCS1_PADDING:
      • 00 01 + 7×FF + 00 + 246 bytes must return -1.
      • 00 01 + 8×FF + 00 + 245 bytes must return 245, with the payload intact.
      • Both blocks are 256 bytes, the modulus size.
    • docs/dev/debt/libSceLibreSsl.md:24 drops "No export of this module creates a key yet, so only keys the caller builds reach them."
  • The author replied on 2026-11-03 to my findings 3 and 4 and said they would leave both as they are.
  • The description adds a Tested entry for 13c396c3c4.

What I ran

Head 13c396c3c4eb5ddad2502a269bcae1509b286245, merged with --no-ff into main 1e658521a0a599872612bb91949311e2956b5283 (merged tree dcdbf451761b013aa1f8cc791b51b4d2506b3de8). Debian 13 VM, Intel Xeon Gold 6136, GCC 14.2.0, Release, Ninja.

git diff 7482bd278c6decb380bf521396bd3295dd4f8d78 13c396c3c4eb5ddad2502a269bcae1509b286245
git diff --check 1e658521a0a599872612bb91949311e2956b5283...13c396c3c4eb5ddad2502a269bcae1509b286245
python3 tools/check_conventions.py --base 1e658521a0a599872612bb91949311e2956b5283
# mutation: Rsa.cpp:433 `index < 8` -> `index < 7`
ninja -C build -j32 -l32 guest_libressl_rsa_tests
ctest --test-dir build -R "^guest_libressl_rsa$" --output-on-failure
# restore Rsa.cpp from the merged tree
ninja -C build -j32 -l32 guest_libressl_rsa_tests
ctest --test-dir build -R "^guest_libressl_rsa$|public_headers" --output-on-failure
grep -c "NotImplemented_nid_no_patch(__func__)" core/libs/prx/libSceLibreSsl/Export.cpp   # merged tree and main
git status --porcelain
Check Result
git diff --check clean
check_conventions.py "All conventions checks passed."
Build (script) configure, build and libs OK
Script test run (850 selected) 848 passed, 1 expected skip, 0 new failures. unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group fails on main too.
guest_libressl_rsa + public_headers 66/66 passed
Negative control (index < 7) guest_libressl_rsa fails: "LibreSSL RSA check failed at line 503"
Pending-export count 225 in the debt file matches the merged Export.cpp (225). main has 231.
Vulkan validation not applicable: no AGC driver, shader or VideoOut file changed
Worktree after the control git status --porcelain empty

Negative control

The production code change is the same as in my last review. Restoring it from main already made the test fail to compile. For the new test cases, I weakened core/libs/prx/libSceLibreSsl/src/Rsa.cpp:433 from index < 8 to index < 7. That is a tighter mutation than the index < 1 from my previous review, and it shows the exact boundary is now pinned. guest_libressl_rsa fails at the seven-byte case (GuestLibreSslRsa.cpp:503). After restoring the merged Rsa.cpp and rebuilding, it passes and the worktree is clean.

Previous findings

  1. Resolved. The 8-byte type 1 minimum is untested. The new cases at GuestLibreSslRsa.cpp:500-505 cover both sides of the boundary, and the index < 7 mutation above now fails.
  2. Resolved. The outdated debt sentence is gone from docs/dev/debt/libSceLibreSsl.md:24 on the merged tree.
  3. Still open (non-blocking). Unknown paddings with an 8193–16384-bit key throw instead of returning -1. DefaultPublicDecrypt still runs PublicOperation (Rsa.cpp:514) before the padding switch. The author agreed and chose to leave it as it is. It throws rather than returning a wrong result, and the RSA_public_encrypt, RSA_public_decrypt debt entry already says the mbedtls 8192-bit limit makes a larger modulus throw. So it is covered by the debt file, and I don't block on it.
  4. Still open (non-blocking). The Default* method slots (Rsa.cpp:449-603) are APS5_VABI without _nid_no_patch, so the progress report counts them as exports. The author left the names as they are. This affects the tools' statistics, not behaviour.

New findings

None.

Not verified

  • Nothing ran on a console, and I didn't reproduce the differential against LibreSSL 2.5.4.
  • I didn't build or test on Windows/MinGW. The author reports Windows runs.
  • The author's red run on GitHub (with index < 1) is author-reported. My local index < 7 mutation is the evidence I'm relying on.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5756711108 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10915#pullrequestreview-5756711108). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T17:26:42Z. **Review:** APPROVED --- # Re-checked — approved Commit 13c396c3c4 tests the 8-byte minimum of PKCS#1 type 1 padding and removes the outdated `RSA_flags, RSA_size` debt sentence. That resolves my previous findings 1 and 2. The author kept findings 3 and 4 as they are, and neither blocks. ## What changed since my last review - The range-diff shows commits 1–8 unchanged. The one new commit, `13c396c3c4` (test plus docs), adds the following: - `core/libs/tests/GuestLibreSslRsa.cpp:500-505`: `TestPublicDecrypt` signs two type 1 blocks with the private exponent through `Recover` and decrypts them with `RSA_public_decrypt` and `RSA_PKCS1_PADDING`: - `00 01` + 7×`FF` + `00` + 246 bytes must return -1. - `00 01` + 8×`FF` + `00` + 245 bytes must return 245, with the payload intact. - Both blocks are 256 bytes, the modulus size. - `docs/dev/debt/libSceLibreSsl.md:24` drops "No export of this module creates a key yet, so only keys the caller builds reach them." - The author replied on 2026-11-03 to my findings 3 and 4 and said they would leave both as they are. - The description adds a Tested entry for 13c396c3c4. ## What I ran Head `13c396c3c4eb5ddad2502a269bcae1509b286245`, merged with `--no-ff` into `main` `1e658521a0a599872612bb91949311e2956b5283` (merged tree `dcdbf451761b013aa1f8cc791b51b4d2506b3de8`). Debian 13 VM, Intel Xeon Gold 6136, GCC 14.2.0, Release, Ninja. ``` git diff 7482bd278c6decb380bf521396bd3295dd4f8d78 13c396c3c4eb5ddad2502a269bcae1509b286245 git diff --check 1e658521a0a599872612bb91949311e2956b5283...13c396c3c4eb5ddad2502a269bcae1509b286245 python3 tools/check_conventions.py --base 1e658521a0a599872612bb91949311e2956b5283 # mutation: Rsa.cpp:433 `index < 8` -> `index < 7` ninja -C build -j32 -l32 guest_libressl_rsa_tests ctest --test-dir build -R "^guest_libressl_rsa$" --output-on-failure # restore Rsa.cpp from the merged tree ninja -C build -j32 -l32 guest_libressl_rsa_tests ctest --test-dir build -R "^guest_libressl_rsa$|public_headers" --output-on-failure grep -c "NotImplemented_nid_no_patch(__func__)" core/libs/prx/libSceLibreSsl/Export.cpp # merged tree and main git status --porcelain ``` | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | "All conventions checks passed." | | Build (script) | configure, build and `libs` OK | | Script test run (850 selected) | 848 passed, 1 expected skip, 0 new failures. `unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group` fails on `main` too. | | `guest_libressl_rsa` + `public_headers` | 66/66 passed | | Negative control (`index < 7`) | `guest_libressl_rsa` fails: "LibreSSL RSA check failed at line 503" | | Pending-export count | 225 in the debt file matches the merged `Export.cpp` (225). `main` has 231. | | Vulkan validation | not applicable: no AGC driver, shader or VideoOut file changed | | Worktree after the control | `git status --porcelain` empty | ## Negative control The production code change is the same as in my last review. Restoring it from `main` already made the test fail to compile. For the new test cases, I weakened `core/libs/prx/libSceLibreSsl/src/Rsa.cpp:433` from `index < 8` to `index < 7`. That is a tighter mutation than the `index < 1` from my previous review, and it shows the exact boundary is now pinned. `guest_libressl_rsa` fails at the seven-byte case (`GuestLibreSslRsa.cpp:503`). After restoring the merged `Rsa.cpp` and rebuilding, it passes and the worktree is clean. ## Previous findings 1. **Resolved.** The 8-byte type 1 minimum is untested. The new cases at `GuestLibreSslRsa.cpp:500-505` cover both sides of the boundary, and the `index < 7` mutation above now fails. 2. **Resolved.** The outdated debt sentence is gone from `docs/dev/debt/libSceLibreSsl.md:24` on the merged tree. 3. **Still open (non-blocking).** Unknown paddings with an 8193–16384-bit key throw instead of returning -1. `DefaultPublicDecrypt` still runs `PublicOperation` (`Rsa.cpp:514`) before the padding switch. The author agreed and chose to leave it as it is. It throws rather than returning a wrong result, and the `RSA_public_encrypt, RSA_public_decrypt` debt entry already says the mbedtls 8192-bit limit makes a larger modulus throw. So it is covered by the debt file, and I don't block on it. 4. **Still open (non-blocking).** The `Default*` method slots (`Rsa.cpp:449-603`) are `APS5_VABI` without `_nid_no_patch`, so the progress report counts them as exports. The author left the names as they are. This affects the tools' statistics, not behaviour. ## New findings None. ## Not verified - Nothing ran on a console, and I didn't reproduce the differential against LibreSSL 2.5.4. - I didn't build or test on Windows/MinGW. The author reports Windows runs. - The author's red run on GitHub (with `index < 1`) is author-reported. My local `index < 7` mutation is the evidence I'm relying on. <!-- anyps5-bots job=3454 head=13c396c3c4eb5ddad2502a269bcae1509b286245 -->
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!10915
No description provided.