feat(libSceLibreSsl3): implement HMAC_CTX_new and HMAC_CTX_free #15514
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15514"
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 Jawschamp on 2026-11-03T17:09:58Z.
What
Implements
HMAC_CTX_newandHMAC_CTX_free(libSceLibreSsl3 NIDsLcxutSyn11oandYAxGqtnKQFY), which threwNotImplemented_nid_no_patchas parameterless placeholders. Their declarations ininclude/Api.hppbecomevoid* HMAC_CTX_new()andvoid HMAC_CTX_free(void* context), and the placeholders leaveAdditionalExports.cpp;docs/dev/debt/libSceLibreSsl3.mdgoes from 175 to 173 additional exports (165 to 163 named) and loses their two table rows.HMAC_CTX_newreturns a zeroed block ofsizeof(HmacContext)(288 bytes) from the guest heap and initialises it withHMAC_CTX_init, or returns null if the allocation fails.HmacContextis the layout that main's libSceLibreSslHMAC_CTX_init,HMAC_CTX_cleanup,HMAC_Init_ex,HMAC_UpdateandHMAC_Final(forwarded by libSceLibreSsl3) operate on.HMAC_CTX_free(NULL)returns. Any other context goes throughHMAC_CTX_cleanup, which releases the digest contexts and clears the block, and the block is then released with the guestfree.HMAC_CTXsize and itsHMAC_CTX_newallocation are not measured; the debt file entry says so. The context is only valid as an opaque pointer passed to the HMAC exports.PKCS5_PBKDF2_HMAC,EVP_MD_block_sizeandEVP_sha512_256stay throwing placeholders, to keep one topic per PR.New guest test
guest_libressl3_hmac_context(registered in the library'sCMakeLists.txt) checks thatHMAC_CTX_newcalls the guestcalloconce withsizeof(HmacContext)and returns a distinct non-null block, that a failed allocation returns null, thatHMAC_CTX_free(NULL)releases nothing, thatHMAC_CTX_new,HMAC_Init_ex(HMAC-SHA256, 20-byte key0x0b), chunkedHMAC_Update,HMAC_FinalandHMAC_CTX_freereproduce the RFC 4231 test case 1 digest, again after re-initialising with a null key and digest, and that freeing a keyed, partly updated context releases every guest-heap block.Tested
Linux x86_64, GCC 14.2 (g++ extracted from Debian trixie packages),
-DBUILD_TESTING=ON, full configure with all submodules. Hardware and titles: not tested.libSceLibreSsl3and the LibreSSL and LibreSSL3 test executables.ctest -R "libressl|crypto_memcmp"passes all 53 tests,guest_libressl3_hmac_contextin under 0.01 s.core/libs/tests/test_public_headers.py --audit-onlypasses (one declaration per export).tools/check_conventions.py --base origin/mainandtools/check_test_registration.pypass.tools/pr_overlap.py --branch fix/libressl3-hmac-ctx-v2finds no open PR with the same exports or new files. It reports textual overlap in the count line ofdocs/dev/debt/libSceLibreSsl3.mdwith #14465, #14889, #14890, #14992, #15031, #15045, #15119, #15289, #15303, #15406, #15449 and #15472 (alsoCMakeLists.txtline 7 for #14890, andAdditionalExports.cppandCMakeLists.txthunks for #15472), and could not compare #10461, #10631, #11146, #12754, #12928, #13486, #14212, #14483, #14499 and #14612 because they conflict withmain; their diffs do not addHMAC_CTX_neworHMAC_CTX_free.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)