feat(libSceLibreSsl): verify RSA signatures through EVP_DigestVerify #16719
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16719"
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 MarrasFederico on 2026-11-07T13:30:36Z.
Supersedes #16389, which GitHub closed when the head fork was deleted.
What
This PR now verifies RSA signatures through
EVP_DigestVerifyInitandEVP_DigestVerifyFinal, the path a title uses. Before, it only rejected an uninitialized context.EVP_DigestVerifyInitwith an RSA key:EVP_PKEY_CTXand stores it in the digest context;pctxif the caller asks for it;typeis null (SHA-1, as 2.5.4 does);EVP_DigestVerifyFinalfinalises a copy of the context and verifies PKCS#1 v1.5 through the existingRSA_verify.RSA_verifyandRSA_public_decryptnow queue the RSA reason codes 2.5.4 queues on failure. Before, they failed silently.ENGINE, non-RSA keys, key contexts this module didn't create, and PSS and X9.31 padding. No export of this module can reach any of them:EVP_PKEY_CTX_new,_dup,_freeand_ctrlare not in the PS5 export table, so they exist here only as internal helpers.The 208-byte
EVP_PKEY_METHOD, 80-byteEVP_PKEY_CTXand 64-byteRSA_PKEY_CTXlayouts and all results follow pinned LibreSSL 2.5.4:m_sigver.c,pmeth_lib.c,pmeth_fn.c,rsa_pmeth.candrsa_eay.c. The debt entries list what is not console-verified.Overlap:
src/Evp.cppin three places this PR also edits: the include block, the failed allocation inDigestInit, andCopyContext. Whichever lands second will merge the other. If #16079 lands first,CopyContextqueues EVP error 111 itself, soEVP_DigestVerifyFinalmust stop queueing it a second time.RSA_signinsrc/Rsa.cpp, a different function, and merges cleanly with this branch.The old
guest_libressl_digest_verify_finaltest is folded into the newguest_libressl_digest_verifytest.Tested
Linux, GCC 15.2, Release. No console or title was run.
guest_libressl_digest_verify: a 1024-bit RSA key with fixed signatures generated by LibreSSL 2.5.4. It covers MD5, SHA-256, SHA-384 and SHA-512, plus the SHA-1 default, rejected signatures with their codes,pctx, context copy and cleanup, and the key reference count.guest_libressl_digest_verify_allocator: every failed guest allocation returns what 2.5.4 returns and leaks nothing.AES_set_encrypt_keyandAES_set_decrypt_key, which are onmaintoo.guest_libressl*,guest_libre_ssl*andguest_digest*tests pass.tools/check_conventions.py,test_public_headers.py --audit-onlyandgit diff --checkpass.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)