feat(libSceLibreSsl3): implement EVP_CIPHER_key_length and EVP_CIPHER_iv_length #13659
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13659"
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 alvaroelpob on 2026-10-30T22:04:03Z.
What
Implements
EVP_CIPHER_key_lengthandEVP_CIPHER_iv_lengthin libSceLibreSsl3. Both are additional exports (13.60 table) that threw and were declared without parameters.Signatures and results follow LibreSSL 4.0.0
evp_cipher.c:int EVP_CIPHER_key_length(const EVP_CIPHER*)returnskey_lenandint EVP_CIPHER_iv_length(const EVP_CIPHER*)returnsiv_len, as stored. The 80-byte 4.0.0EVP_CIPHERfromevp_local.h(nid,block_size,key_lenat 8,iv_lenat 12,flags,init,do_cipher,cleanup,ctx_sizeat 48, the two ASN.1 pointers andctrl) isLibreSsl3EvpCipher, checked withstatic_asserts. Its first four fields are at the same offsets as in the 2.5.4 layout of the ciphers that the forwarded libSceLibreSsl exports handle. LibreSSL dereferences the cipher without checking it, so a null cipher throws.The debt entry records the source and what is unverified. The additional-export inventory loses both rows and its count drops from 180 to 178.
Tested
Ubuntu 26.04 (WSL2, kernel 6.18), GCC 15.2.0, Release, full build with
BUILD_TESTING=ONonmaind4de5943f6(3028/3028 pass).guest_libressl3_ciphertest: on a cipher filled with 0xA5,EVP_CIPHER_key_lengthandEVP_CIPHER_iv_lengthreturn the value stored inkey_lenandiv_lenfor 0, 1, 8, 12, 16, 24, 32, 64, -1,INT32_MAXandINT32_MINand leave the cipher unchanged. An AES-256-CBC-shaped cipher returns 32 and 16. A null cipher throwsstd::invalid_argument.ctest -j16on head e08ec905d3: 3029/3029 pass.check_conventions.py --base upstream/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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T22:24:30Z.
Review: APPROVED
Reviewed — looks good
The two accessors read the matching
key_lenandiv_lenfields, and the declarations, NIDs, layout assertions, and focused tests are consistent with the cited LibreSSL versions.What I ran
Reviewed head
e08ec905d34e0f8ab184333c53bf5cba82e4fffdagainst base9605300f293b88295e223a27ff8cfecf24d7ab2a; the exact-head merge preview was clean. Environment: Debian Linux x86-64, Python 3.11.2; GCC 12.2.0 available but not invoked. No local build or C++ test was run.I also read the pinned LibreSSL 4.0.0 and 2.5.4 source through the upstream repository API to verify the field behavior and layouts.
Results
4ryyfC3TknUandqAG7o03bkkM.LibreSsl3EvpCipherasserts 80 bytes,keyLengthoffset 8,ivLengthoffset 12; exact-head audit passed for 389 libraries and 24,477 exports.guest_libressl3_ciphertest. The heuristic warned that the source may be unregistered because it does not match the generated path literally; manual inspection confirmed registration.ctest -j16passed 3029/3029 on exact heade08ec905d34e0f8ab184333c53bf5cba82e4fffd. I did not independently reproduce that build or test run.Unedited outputs from checks
git diff --checkproduced no output and exited 0.Findings
Blocking
None found in the reviewed source, ABI audit, or test review.
Non-blocking
The bundled-console layout and runtime behavior remain unverified. The author reports an exact-head full test run; I did not reproduce it locally, and the hosted Windows job had not completed at the final check.
Sources
Not verified
No local compilation or C++ test was run. Windows hosted CI was still running; Linux and specialized jobs were skipped. No console or game behavior was tested.