feat(libSceLibreSsl3): implement AES_wrap_key #17124
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17124"
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 fishingpvalues on 2026-11-08T10:46:05Z.
What
Follow-up to #14612, which implements
AES_unwrap_keyonly; this adds the opposite direction. ImplementsAES_wrap_key(GjO5Ap3E-t4), previously exported only asUnknown_GjO5Ap3E_minus_t4, following RFC 3394:A6A6A6A6A6A6A6A6whenivis null, six rounds and the 64-bit counter XORed into the A block, matching OpenSSL'sAES_wrap_key;AES_encrypt, so no AES implementation is duplicated;inlen + 8and writesA | R[1..n];The
Unknown_*stub and itsAPS5_EXPORTalias leaveAdditionalExports.cpp; the real signature is declared once ininclude/Api.hpp; the code is in newsrc/AesWrap.cppwith newtests/AesWrap.cppregistered asguest_libressl3_aes_wrap.docs/dev/debt/libSceLibreSsl3.mdloses the NID-only row (125 to 124 callable exports, 116 named and 9 to 8 NID-only) and gains one Functional entry for the unverified PS5 ABI, custom-IV handling and console behaviour. The branch was rebased onto currentmain4ab649f4d8; the inventory counts were recalculated on that base. #15854 was closed as a presumed duplicate of #14612, but #14612 only definesAES_unwrap_key_nid_postfix; this PR keeps the wrap NID.Tested
Linux x86-64 (CachyOS, GCC 16.2.1), Release,
BUILD_TESTING=ON, basemain828e44310e:guest_libressl3_aes_wrapchecks the RFC 3394 128-bit known-answer vector (1FA68B0A…71D2CFE5), first verifies the parent AES-128 ECB vector (69C4E0D8…70B4C55A), and covers the short and non-multiple-of-8 rejections and the null-output throw.ctest --test-dir build -R '^guest_libressl3_aes_wrap$' --output-on-failure: 1/1 passed.python3 tools/check_conventions.py --base origin/main: passed.python3 tools/pr_overlap.py --branch pr-15854 --jobs 4: exit 2 only because it cannot confirm sharedAdditionalExports.cpp/Api.hpp/debt files from conflicting PR heads; it reports no same exports.Checklist
main; no other open PR implements this exportNotImplemented_nid_no_patch).mdfiles or images added to the repositoryAdditionalExports.cpp, so whichever merges second rebases)Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T12:02:13Z.
Review: COMMENTED
Windows run of head
e5cfa65c4f(it already containsmain4f988389f5). Setup: Windows 11, WinLibs GCC 15.2 (x86_64-ucrt-posix-seh), Release,BUILD_TESTING=ON.guest_libressl3_aes_wrappasses as pushed.inlen + 8). Each vector also gives the same output with an explicitA6A6A6A6A6A6A6A6IV, with the output overlapping the input asout = in - 8, and without == in. The last two work because the input is copied torbefore anything is written.The loop matches LibreSSL's own
AES_wrap_key. That's the library this module is:t = n * j + ibig-endian XORed intoA, and-1for an input under 16 bytes or not a multiple of 8. The description says "as OpenSSL does". OpenSSL 1.1 and later return 0 fromCRYPTO_128_wrapthere, so LibreSSL is the reference that gives this-1. Only the wording is off; the code is right.