Repository navigation
[Backport][main to 0.9] | test(net): build test certificates where the subject name comes back const (#1723) - #1724
Merged
lihuiba merged 2 commits intoNov 2, 2026
Conversation
…const (#1723) * test(net): take a writable subject name when building test certificates The macOS arm image's X509_get_subject_name() returns a const X509_NAME*, while X509_NAME_add_entry_by_txt() and X509_set_issuer_name() take a mutable one, so client_function_test stopped compiling there -- the intel image's OpenSSL returns the mutable pointer and was fine. The certificates are ours and writable, so the five call sites go through one helper that takes the writable view back. * test(net): say why one const_cast covers both OpenSSL signatures The getter's return qualifier follows whichever headers are installed, so the fix must not key off a version: removing no qualifier is a no-op, which is what lets the single helper compile unchanged against the mutable and the const signature.
Drop the TestCertChain / generate_ca_signed_cert block that the cherry-pick pulled in as conflict context: those helpers come from a main-only change and nothing on release/0.9 uses them. What remains is the actual fix of #1723 -- test_subject_name() and its one call site in generate_different_self_signed_cert().
lihuiba
approved these changes
Nov 2, 2026
lihuiba
marked this pull request as ready for review
November 2, 2026 14:59
photonlibos
deleted the
backport-pr-28d396e173b196c6b983d44db9e8b32ce1962385-0.9
branch
November 2, 2026 15:04
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.
The macOS arm image's X509_get_subject_name() returns a const X509_NAME*, while
X509_NAME_add_entry_by_txt() and X509_set_issuer_name() take a mutable one, so
client_function_test stopped compiling there -- the intel image's OpenSSL returns
the mutable pointer and was fine. The certificates are ours and writable, so the
five call sites go through one helper that takes the writable view back.
The getter's return qualifier follows whichever headers are installed, so the fix
must not key off a version: removing no qualifier is a no-op, which is what lets
the single helper compile unchanged against the mutable and the const signature.
Generated by Backport Auto PR, by cherry-pick related commits.
Please review and decide whether to merge or close this backport PR.
Conflicts (resolved)
Cherry-pick of 28d396e conflicted in
net/security-context/test/test_cert_utils.h. Resolved in f0dba63:TestCertChain/generate_ca_signed_cert()block (withtest_generate_rsa_key,test_pem_of_cert,test_pem_of_key,test_set_cert_name). Those helpers come from a main-only change and nothing on release/0.9 uses them, so the release/0.9 side was kept and the block dropped.test_subject_name()helper and its one applicable call site ingenerate_different_self_signed_cert(). The other four call sites in test(net): build test certificates where the subject name comes back const #1723 live inside the dropped helpers.Verified locally (aarch64, GCC 15, Debug):
test-tlsandclient_tls_testbuild;test-tlspasses 15/15, includingca_cert.verify_fail_wrong_ca, which exercises the changed code.client_tls_testaborts identically on unmodified release/0.9 in this environment (localhostresolves to::1while the server binds127.0.0.1), so it is unrelated to this backport; CI is relied on for it.