Repository navigation
fix(libSceLibreSsl3): report mismatched key types through the error queue - #16655
Merged
adriadam10 merged 5 commits intoNov 11, 2026
Merged
adriadam10 merged 5 commits into
adriadam10 merged 5 commits into
Conversation
…ueue Publish an EVP library error code with function 0xfff and reasons EVP_R_EXPECTING_AN_RSA_KEY (127), EVP_R_EXPECTING_A_DSA_KEY (129) or EVP_R_EXPECTING_A_DH_KEY (128) through the shared parent error queue when EVP_PKEY_get0_RSA, EVP_PKEY_get0_DSA or EVP_PKEY_get0_DH receives a mismatched key type, returning null as in LibreSSL 4.0.0's p_lib.c. Preserve existing null-key handling and leave matching keys and references unaltered.
# Conflicts: # docs/dev/debt/libSceLibreSsl3.md
|
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.
|
Contributor
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.
AI-assisted: yes. |
# Conflicts: # core/libs/prx/libSceLibreSsl3/tests/PkeyGetters.cpp
…etter-type-errors
…d EVP_PKEY_new EVP_PKEY_get0_EC_KEY returned NULL for a key of another type without queueing EVP_R_EXPECTING_A_EC_KEY, and EVP_PKEY_new returned NULL on allocation failure without queueing ERR_R_MALLOC_FAILURE, both of which LibreSSL's p_lib.c queue. They now report through the libSceLibreSsl queue like the RSA, DSA and DH getters.
12 tasks done
Collaborator
|
Checked the mismatch paths against LibreSSL 4.0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #15601, which GitHub closed when the head fork was deleted. The commits are unchanged; earlier review comments and Windows checks are on #15601.
What
A mismatched key type previously threw
std::runtime_error. LibreSSL 4.0.0 instead returns null and queues an EVP error: RSA, DSA, and DH. The adapted accessor implementation now appends that error to the calling thread's existing parent-library queue.RSA accepts types 6 and 912, DSA accepts 116, and DH accepts 28. Other types return null and queue library 6, function
0xfff, and reasons 127, 129, or 128 respectively. Matching keys return their borrowed inner pointer, including null, without changing references or clearing existing errors. The source file retains the original notices and pinned provenance.invalid_argumentexception; upstream dereferences it.The second commit applies the same treatment to the two neighbouring
p_lib.cpaths that dropped their error. Both now queue through the same parent-library queue:EVP_PKEY_get0_EC_KEYalready returned null for a key of another type, but it did not queueEVP_R_EXPECTING_A_EC_KEY(142);EVP_PKEY_newreturned null on allocation failure withoutERR_R_MALLOC_FAILURE(65).Neither path was measured on a console.
Tested
Ubuntu 26.04.1, kernel 7.0.0-42-generic, GCC 15, Release, BUILD_TESTING=ON, on main
04a9eb4fa2, then again after merging main4741457fed. Windows and macOS were not compiled here. No title was run.guest_libressl3_pkey_getters_testsseparately for every control. The test covers recognized and unknown key types, the mismatch cross-product, empty matching keys, borrowed pointers, reference and field preservation, errno, and thread isolation. Ordered queue draining checks that older errors survive subsequent mismatches and successful calls.ctest --test-dir build -R 'libressl3|crypto_memcmp|libressl_errors|public_headers' -j6 --output-on-failure: 77/77 passed, including all 65 public-header tests.4741457fed: all 13 LibreSSL3 tests pass, includingguest_libressl3_pkey_getters. The only conflict was in the debt file: main's newer entries are kept, and this PR's getter entry replaces the old one.python3 tools/check_conventions.py --base origin/mainandgit diff --check origin/mainpassed after rebase. Repeated open/closed PR searches for all three symbols andPkeyGetters.cpp; the closed accessor implementations are already represented in main, and the open component accessors do not implement this mismatch fix.pr_overlap.pyexamined 1775 open PRs and exited 2. It reported debt-line overlaps with feat(libSceLibreSsl): implement EC groups and keys for named curves #10395 (EC keys), feat(libSceLibreSsl3): implement EVP digest contexts and SHA methods #10960 (digest operations), feat(libSceLibreSsl3): implement BIO_up_ref #12945 (BIO/SSL retains), and feat(libSceLibreSsl3): implement RSA_get0_factors and RSA_get0_crt_params #14366 (RSA component getters). I compared their diffs: their debt edits require reconciliation, but none changes these three mismatch paths.Each comparison the tool could not complete was inspected manually:
ASN1_OBJECT_freeand its test registration; shared CMake/debt edits need reconciliation.OBJ_cmpand its test registration; shared CMake/debt edits need reconciliation.SSL_CIPHER_get_id; its shared debt entry concerns a separate export.EVP_PKEY_get0_EC_KEYinsrc/Key.cppand EC assertions intests/PkeyGetters.cpp. Its test/debt edits must be combined with this PR; it does not change RSA/DSA/DH mismatch errors.AES_unwrap_keyand its test registration; its CMake/debt edits concern a separate export.These are shared-file conflicts, not dependencies on unmerged implementations.
Second commit (
get0_EC_KEYandEVP_PKEY_new), tested on Ubuntu 26.04.1 with GCC 15.2.0, Release, on headfdc5484054merged withmainb53b6c9f7d:ctest -R libressl3: 43/43 passed.guest_libressl3_pkey_gettersadds the EC cross-product with the same checks as the other getters (errno, references, fields, queue order).guest_libressl3_pkey_lifecyclechecks that a failedEVP_PKEY_newqueues0x06fff041, read back through the module's forwardedERR_get_error.BIO_up_ref) touchesKey.cpp, and it merges cleanly with this branch. Its only conflict is withmainitself, inApi.hpp.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)