Repository navigation
feat(libSceLibreSsl): implement EVP_CIPHER_CTX_init, EVP_CIPHER_CTX_new and EVP_CIPHER_CTX_set_padding - #10488
alvaroelpob wants to merge 4 commits into
Conversation
Progress report (aaccd0b → 10f8980)📈 System libraries: 45.98% (+0.02%, +3 implemented functions) ✅ 3 implemented
Changed libraries (implemented exports)
|
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed head 03cb3efab33b5daf4b3f51e8f4348750967a049f.
I checked the context size/field offsets and the three behaviors against the pinned LibreSSL 2.5.4 declarations and implementation: initialization clears the complete context, creation uses the guest calloc, and set_padding changes only EVP_CIPH_NO_PADDING while returning 1. The overlap with #9571 is in shared files; this diff leaves its CMAC exports untouched. I found no blocking correctness issue in the reviewed code.
The PR reports focused context tests and a 2005/2006 full CTest run, with the remaining failure also present on main; I did not reproduce those runs locally. Current convention, labels, eligibility, and report checks pass. Linux, Windows, register-context, relinker, write-watch, and ASan jobs are skipped.
03cb3ef to
4f073fa
Compare
|
@alvaroelpob a heads-up: we've stacked the rest of the EVP cipher calls on your three commits, as draft #10834. It adds the Cipher/Encrypt/Decrypt Since #9529 merged, this branch conflicts with
Take it, or resolve it your own way; that's entirely up to you. |
4f073fa to
6b1e364
Compare
|
Rebased on |
|
@alvaroelpob Thanks for the rebase and the header commit; #10834 will rebase onto 6b1e364 and follow the same pattern for its exports. |
b188b78 to
3b0f1cd
Compare
|
Rebased on |
3b0f1cd to
9a3cb4e
Compare
|
@alvaroelpob firmware 13.42's
|
f9a8c85 to
9420353
Compare
9420353 to
4ec014c
Compare
4ec014c to
9cc28a3
Compare
|
Rebased on |
|
@alvaroelpob this no longer merges cleanly with current main (e52fd83): core/libs/prx/libSceLibreSsl/CMakeLists.txt, include/Api.hpp and docs/dev/debt/libSceLibreSsl.md conflict with #10447, #11340 and #11261, which landed since. The conflicts are in shared lists only, so keeping both sides should do. Could you rebase or merge main and push? Nothing else changes from the earlier review. |
9cc28a3 to
834bb1f
Compare
|
Rebased on |
834bb1f to
10f8980
Compare
|
Rebased on |
MarcZX10
left a comment
There was a problem hiding this comment.
What
Implements
EVP_CIPHER_CTX_init,EVP_CIPHER_CTX_newandEVP_CIPHER_CTX_set_paddingin libSceLibreSsl, which threw and were declared without parameters.The module is LibreSSL 2.5.4 (firmware 13.40 measurements in #8981). Signatures, layout and results follow that release's
evp.handevp_enc.c:void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX*)EVP_CIPHER_CTX* EVP_CIPHER_CTX_new(void)calloc(1, 168), through the guestcallocas the module would through libcint EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX*, int pad)EVP_CIPH_NO_PADDING(0x100) in the 64-bitflagsat 112 whenpadis nonzero, sets it otherwise, and returns 1The 168-byte size is the one measured for
EVP_CIPHER_CTX_initin #8981. The layout (numat 88,flagsat 112,finalat 136) was checked withstatic_asserts and againstoffsetoffrom the 2.5.4 headers compiled on x86-64. LibreSSL dereferences a null context ininitandset_paddingwithout checking it, so that throws.#9571 forward-declares its own cipher context type for CMAC. This PR uses its own file and struct name, and changes none of its exports.
The debt entry records the source and what is unverified, and the pending-export count drops from 357 to 354.
Tested
Ubuntu 26.04 (WSL2, kernel 6.18), GCC 15.2.0, Release, full build with
BUILD_TESTING=ONonmain379b1dc. There is one commit per function, and each adds that function with its test block and debt update. Each was built and itsguest_libressl_evp_cipher_ctxtest andcheck_conventions.pyrun on its own.guest_libressl_evp_cipher_ctxtest.EVP_CIPHER_CTX_initzeroes exactly 168 bytes of a 0xAA buffer and leaves the next 16 alone.EVP_CIPHER_CTX_newreturns four zeroed 168-byte guest heap blocks that are written and freed again.EVP_CIPHER_CTX_set_paddingsets 0x100 for 0 (twice) and clears it for 1 and -5, keeps the other flag bits0xFFFFFFFF000000FF, returns 1, and touches no byte outsideflags. A null context throws ininitandset_padding.ctest -j16at the last commit: 2005/2006 pass.agc_driver_multisample_retirementfails the same way onmainon this machine.main1e740a2 (after feat(libSceLibreSsl): implement the low-level AES functions #9033), head 4f073fa: the conflicts were only theadd_librarysource list, the end of the test block, the pending-export count and the last debt entry; both sides are kept and the count is 357 minus this PR's exports. Full build andctest -j16: 2043/2044 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.maine7e3e9c, head 6b1e364, to resolve the conflict from feat(libSceLibreSsl): implement the per-thread error queue #9529 on the sharedCMakeLists.txtand debt-file lines; both sides are kept and the count is 353 minus this PR's exports. 6b1e364 (refactor(libSceLibreSsl): declare the EVP_CIPHER_CTX exports in the public header) puts the real signatures and their structs inlibSceLibreSsl/include/Api.hppand drops the test's redeclarations, whichpublic_headersrequires since refactor(libs): add full export headers for libs #10706. Full build andctest -j16: 2202/2203 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.mainae7d592 (after feat(libSceLibreSsl): implement the OCSP status and reason strings #9949), head 9a3cb4e, to resolve the conflicts withmainon the sharedCMakeLists.txtand debt-file lines; both sides are kept and the count is 342 minus this PR's exports. Full build andctest -j16: 2275/2276 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.main2dbe9b9 (after feat(libSceLibreSsl): return the measured version from SSLeay #9745, feat(libSceLibreSsl): implement TLS alert descriptions #9870 and fix(libSceLibreSsl): reject null strings in the ASN.1 accessors as invalid arguments #11111), head f9a8c85, to resolve the conflicts withmainon the sharedCMakeLists.txtand debt-file lines; both sides are kept and the count is 340 minus this PR's exports. Full build andctest -j16: 2370/2371 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.main88795ed (after feat(libSceLibreSsl): implement the CRYPTO locking and thread id callbacks #10248; head 9420353) to resolve the conflicts on the shared debt-file lines; both sides are kept and the count is 335 minus this PR's exports. Full build andctest -j16: 2383/2384 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.mainc7b4878 (after feat(libSceLibreSsl): implement sk_num, sk_value, sk_pop and sk_pop_free #10373, feat(libSceLibreSsl): implement UI_METHOD creation and its opener, writer, reader and closer accessors #10376 and feat(libSceLibreSsl): implement RSA_flags and RSA_size #10449), head 4ec014c, to resolve the conflicts withmainon the sharedCMakeLists.txt,Api.hppand debt-file lines; both sides are kept and the count is 319 minus this PR's exports. Full build andctest -j16: 2394/2395 pass;agc_driver_multisample_retirementfails the same way on thatmain.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)