feat(libSceLibreSsl3): implement BIO_up_ref #12945
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12945"
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 EagleBearerYS on 2026-10-29T15:42:31Z.
What
BIO_up_refinlibSceLibreSsl3was a bare stub. It now does what LibreSSL 4.0.0 does (bio_lib.cL198-L202): it raises the BIO'sreferencesby one and returns 1 when the new count is above 1, asCRYPTO_add(&bio->references, 1, CRYPTO_LOCK_BIO) > 1does.Retain_nid_no_patchininclude/Reference.hppas it is.LibreSsl3Bio, withreferencesat offset 80, from LibreSSL 4.0.0'sbio_local.h(struct bio_st, LP64).static_asserts hold the size and the offset.INT32_MAX, throw without changing memory, where LibreSSL dereferences or overflows.BIO_up_refdoesn't appear in an issue or discussion.Overlap: #12580 and #12582 (PrivacyOnion), which also appended their retains and test cases after
SSL_CTX_up_ref, were closed unmerged on 2026-10-31.ASN1_STRING_get0_dataits signature inExport.cppandApi.hpp, on the line next to this PR'sBIO_up_ref. The clash was textual only, and the merge ofmain1ee57e1953keeps both.main. #12315 is still open.Tested
guest_libressl3_key_referencegains abiocase. It sits with theCheckKeycases (EVP_PKEY,EC_KEY,SSL_CTX) inGuestLibreSsl3KeyReference.cpp, sinceBIO_up_refsits with their retains insrc/Key.cpp; #12754'sCheckRetaincases are inGuestLibreSsl3Ssl.cpp. It covers:INT32_MAX - 1, with the result;No case asserts a throw.
Red: with the body put back to
main'sNotImplemented_nid_no_patch(the signature kept), thebiocase aborts withBIO_up_ref_nid_postfix not implemented. The other cases still pass.Green, Linux (Ubuntu 24.04, GCC 13.3, Release, CI's flags):
ctest -R "libressl3|crypto_memcmp" --repeat until-fail:10: 5 tests, 10 of 10 each, 0 skipped;ctest -R "libressl|crypto_memcmp"once: 34 tests, 34 passed, 0 skipped.Checks:
check_conventions.pyandcheck_test_registration.pypass. MinGW-w64-fsyntax-only -Wall -Wextra: no errors or warnings.GitHub, ×10 on both runners (run 40895956237), compared against #12754's head:
guest_libressl3_key_referencepassed 10 of 10 on Linux and on Windows, 0 skipped.APS5_SKIP_TIMING_TESTS=1, pass: 171 and 291 tests on Linux, 199 and 314 on Windows.82c0aa626f: this PR's one commit on #12754's34728c573e, because #12754 was rewritten ontomain474030e584. The commit is 219770ad1e cherry-picked, with the same message and author.docs/dev/debt/libSceLibreSsl3.mdnow says 71, against #12754's 72. That's #12754's new line withBIO_up_refadded to the list, and it already names main'sRSA_up_ref.APS5_VABIdefinitions inExport.cppwhose body still callsNotImplemented_nid_no_patch.34728c573eand 71 here.BIO_up_refbullet is unchanged.BIO_up_refput back as a pending stub, only thebiocase ofguest_libressl3_key_referencefails, withBIO_up_ref_nid_postfix not implemented.^guest_libressl3test:APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.272efa5452, a merge ofmaina043b048db, which brings gazaret's #13897 (EVP_PKEY_get0_RSA,_DSAand_DH) (run).docs/dev/debt/libSceLibreSsl3.md, and both keep both sides: #13897'sEVP_PKEY_get0entry, then this branch's entries, #12754's and this PR's.NotImplemented_nid_no_patchcalls left in the mergedExport.cpp: 80 at the base, lessmain's 3 and the stack's 9. Its list names both sides' implemented exports,main's first.main, which is in the same file, on this branch. #12754 itself is unchanged.^guest_libressl3test. Linux: 9 run, 9 pass, 0 skip, 0 fail. Windows: 9 run, 9 pass, 0 skip, 0 fail. The libc and libkernel suites run 206 and 308 tests on Linux and 233 and 330 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.main5c9837bfe7, where the count is still 68.e44bf06eab, a merge ofmainb28bb77217(run), which brings Froraut's #9970 (OpenSSL_version) and Felipebmaitan's #9535 (numericERRformatting, withERR_load_crypto_stringsandERR_peek_last_errorin this module).CMakeLists.txt: #9970'sguest_libressl3_versionjoins this PR'sguest_libressl3_sslon theset_tests_propertiesline;docs/dev/debt/libSceLibreSsl3.md: the pending-exports line lists #9970'sOpenSSL_versionamong the exclusions, with this PR's.NotImplemented_nid_no_patchcalls left in the mergedExport.cpp.main's line reads 76, 2 more than the 74 calls left in its ownExport.cpp, since #9535'sERR_load_crypto_stringsandERR_peek_last_errorare no longer stubs.mainare the same, and it merges cleanly withmaina4eca2a056.^guest_libressltests, #9970'sguest_libressl3_versionamong them, withguest_crypto_memcmp,guest_libressl3_key_reference,guest_libressl3_sslandpublic_headers. Linux: 48 run, 48 pass, 0 skip, 0 fail. Windows: 48 run, 48 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (217 and 319) and on Windows (244 and 340). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.1a23809f08, a merge ofmainacf7ac208a, which brings MarcZX10's #10557 (X509_PUBKEY_get0_param) (×10).X509_PUBKEY_get0_paramand this PR, through #12754, implements theSSL_CTX,SSLandSSL_SESSIONretains, theSSL_CTXversion bounds andSSL_get_client_random. Both sides stay:Export.cpp: both sides' stubs go;include/Api.hpp: this PR's six declarations and #10557'sX509_PUBKEY_get0_paramone;CMakeLists.txt: #10557'sguest_libressl3_x509_pubkey_paramjoins this PR'sguest_libressl3_sslon the Windowsset_tests_propertiesline;docs/dev/debt/libSceLibreSsl3.md: the pending-exports line adds #10557'sX509_PUBKEY_get0_paramto its exclusions.NotImplemented_nid_no_patchcalls left in the mergedExport.cpp: this PR's 65, less #10557'sX509_PUBKEY_get0_param.mainare the same.guest_crypto_memcmpand every test matching^guest_libressl3, #10557'sguest_libressl3_x509_pubkey_paramamong them. Linux: 13 run, 13 pass, 0 skip, 0 fail. Windows: 13 run, 13 pass, 0 skip, 0 fail. The libc and libkernel suites run 301 and 325 tests on Linux and 331 and 343 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.80bce94f35, oneandonlydean's merge ofmaince676cb37d, which brings AZLisme's #10960 (EVP digest contexts and SHA methods) and MatteoSid's #10395 (EC groups and keys for named curves) (×10).core/libs/prx/libSceLibreSsl3/CMakeLists.txt: #10960'sguest_libressl3_evpjoins this PR'sguest_libressl3_sslon the Windowsset_tests_propertiesline;docs/dev/debt/libSceLibreSsl3.md: the pending-exports line adds #10960'sEVP_MD_CTX_new,EVP_MD_CTX_free,EVP_DigestInit,EVP_sha1andEVP_sha224to its exclusions, and the Functional entries keep this PR's, then #10960's.NotImplemented_nid_no_patchcalls left in the mergedExport.cpp:main's 68, less this stack's 9.GuestLibreSsl3KeyReference.cpp, next to this PR'sbiocase, merge without a conflict. This PR's other changed lines overmainare the same, and it merges cleanly withmain7ad9749ed0.main, in four files, are resolved on this branch.check_conventions.py: 0 errors. Its one warning is the pending-exports line's length, 1,046 characters against the 1,000 guide, since the line names each implemented export.guest_crypto_memcmpand every test matching^guest_libressl3, #10960'sguest_libressl3_evpandguest_libressl3_mixed_evp(Linux only) among them. Linux: 15 run, 15 pass, 0 skip, 0 fail. Windows: 14 run, 14 pass, 0 skip, 0 fail. The libc and libkernel suites run 310 and 329 tests on Linux and 341 and 360 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.maine772fb2, Mesa 25.2.8. 2,482 passed, 11 failed (none new: 8 also fail onmain, 3 unstable onmain), 17 skipped, with no new validation IDs (1,076 tests on the GPU).agc_graphics_profile_drawtimed out in the parallel run and passed on its retry.ded4b34174, a merge ofmain04cdd52760, which brings MarcZX10's #10631 (OBJ_cmp) and AlexWhitehouse's #14366 (RSA_get0_factorsandRSA_get0_crt_params) (×10).core/libs/prx/libSceLibreSsl3/include/Key.hpp: #14366'sLibreSsl3Rsafieldstatic_asserts, then this branch'sLibreSsl3SslCtx(#12754) andLibreSsl3Bioones;core/libs/prx/libSceLibreSsl3/src/Key.cpp: #14366's two RSA getters, then this branch'sSSL_CTX_up_ref(#12754) andBIO_up_ref;docs/dev/debt/libSceLibreSsl3.md: the pending-exports line adds #10631'sOBJ_cmpto its exclusions.NotImplemented_nid_no_patchcalls left in the mergedExport.cpp:main's 67, less this stack's 9.mainare the same, and it merges cleanly withmain151a2cb6e2.check_conventions.py: 0 errors. Its one warning is still the pending-exports line's length, now 1,057 characters against the 1,000 guide.guest_crypto_memcmpand every test matching^guest_libressl3, #10631'sguest_libressl3_obj_cmpand #14366'sguest_libressl3_rsa_gettersamong them. Linux: 17 run, 17 pass, 0 skip, 0 fail. Windows: 16 run, 16 pass, 0 skip, 0 fail. The libc and libkernel suites run 322 and 334 tests on Linux and 353 and 365 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.1ee57e1953, a merge ofmaine647fe16fd, which brings alvaroelpob's #10493 (X509_get0_extensions,X509_get_ext_countandX509_get_ext) and #10452 (ASN1_STRING_get0_dataandASN1_INTEGER_free) (×10).core/libs/prx/libSceLibreSsl3/Export.cpp: the stubs go forASN1_STRING_get0_data,X509_get_extandX509_get_ext_count, whichmainimplements, and forBIO_up_refandX509_get_version, which this branch implements;core/libs/prx/libSceLibreSsl3/include/Api.hpp:main's signatures forASN1_STRING_get0_data,X509_get_extandX509_get_ext_count, and this branch's forBIO_up_refandX509_get_version(#12754);docs/dev/debt/libSceLibreSsl3.md: the pending-exports line adds #10452's and #10493's five exports to its exclusions.NotImplemented_nid_no_patchcalls left in the mergedExport.cpp:main's 62, less this stack's 9.mainare the same.check_conventions.py: 0 errors. Its one warning is still the pending-exports line's length, now 1,165 characters against the 1,000 guide.guest_crypto_memcmpand every test matching^guest_libressl3, #10493'sguest_libressl3_x509_extensionsand #10452'sguest_libressl3_asn1_stringamong them. Linux: 19 run, 19 pass, 0 skip, 0 fail. Windows: 18 run, 18 pass, 0 skip, 0 fail. The libc and libkernel suites run 322 and 334 tests on Linux and 353 and 365 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.273540e752, a merge ofmain3a2cd3df9e, which brings atharvjairath's #15031 (the key size, security and comparison queries,EVP_PKEY_sizeamong them) (×10).docs/dev/debt/libSceLibreSsl3.md. The merge keeps both sides: the exclusions add #15031'sEVP_PKEY_size, and the count is 52, theNotImplemented_nid_no_patchcalls left in the mergedExport.cpp:main's 61, less this stack's 9.mainare the same.check_conventions.py: 0 errors. Its one warning is still the pending-exports line's length, now 1,182 characters against the 1,000 guide.guest_crypto_memcmpand every test matching^guest_libressl3, #15031'sguest_libressl3_pkey_queriesamong them. Linux: 20 run, 20 pass, 0 skip, 0 fail. Windows: 19 run, 19 pass, 0 skip, 0 fail. The libc and libkernel suites run 323 and 338 tests on Linux and 354 and 365 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.a427257694, a merge ofmain018cfcbbc4, after #12754 merged on 11-06 at 07:12Z (×10).3a2cd3df9e: alvaroelpob's #10491 and #10490, MarcZX10's #10461, atharvjairath's #14992 and jagrat04's #14483.main's version, the one #12754 merged with, in place of this branch's copy of them. Of this PR, only 82c0aa626f's change stays:BIO_up_refinExport.cpp,include/Api.hpp,include/Key.hppandsrc/Key.cpp;biotest case;git diff 018cfcbbc4 a427257694gives those 6 files, +32/-7, the same as 82c0aa626f's own diff. The one difference is the pending-exports line: it reads 45,main's 46 lessBIO_up_ref, withBIO_up_refadded to the exclusions.check_conventions.py: 0 errors. Its one warning is still the pending-exports line's length, now 1,393 characters against the 1,000 guide.guest_crypto_memcmpand every test matching^guest_libressl3, with this PR'sbiocase inguest_libressl3_key_reference.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.main: one hunk indocs/dev/debt/libSceLibreSsl3.md. ahmadmuj's #11128 adds two entries directly above the pending-exports line this PR changes. Keeping both sides resolves it: #11128's two entries, then this PR's line. Its count stays 45, theNotImplemented_nid_no_patchcalls in theExport.cppof a merge withmaine509b29247.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)LibreSsl3Biofrominclude/Key.hpp)Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:54:16Z.
Review: COMMENTED
The diff is +621/-75 across 13 files for one export; please say what else it carries.