Skip to content

tls/openssl: build with the constified X509 name accessors in OpenSSL 4 - #3647

Open
heitbaum wants to merge 3 commits into
warmcat:mainfrom
heitbaum:openssl4
Open

tls/openssl: build with the constified X509 name accessors in OpenSSL 4#3647
heitbaum wants to merge 3 commits into
warmcat:mainfrom
heitbaum:openssl4

Conversation

@heitbaum

@heitbaum heitbaum commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

With libwebsockets-5.0.0

OpenSSL 4.0 changed X509_get_subject_name() and X509_get_issuer_name() to return a const X509_NAME *, so assigning the result to a plain X509_NAME * fails the -Wignored-qualifiers -Werror build:

openssl-x509.c:140:20: error: assignment discards 'const' qualifier
  from pointer target type [-Werror=discarded-qualifiers]

Make the read-only users const, and cast at the two sites that fill in the subject name of a cert that has not been signed yet. All of this also compiles against OpenSSL 3, where the accessors return non-const.

lws-team and others added 3 commits July 26, 2026 08:53
OpenSSL 4.0 changed X509_get_subject_name() and X509_get_issuer_name() to
return a const X509_NAME *, so assigning the result to a plain
X509_NAME * fails the -Wignored-qualifiers -Werror build:

  openssl-x509.c:140:20: error: assignment discards 'const' qualifier
    from pointer target type [-Werror=discarded-qualifiers]

Make the read-only users const, and cast at the two sites that fill in
the subject name of a cert that has not been signed yet. All of this
also compiles against OpenSSL 3, where the accessors return non-const.

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
E Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@lws-team
lws-team force-pushed the main branch 6 times, most recently from 558a432 to 4e59faf Compare July 27, 2026 20:02
@lws-team
lws-team force-pushed the main branch 2 times, most recently from feb2be6 to b1c687c Compare August 5, 2026 14:27
@lws-team
lws-team force-pushed the main branch 10 times, most recently from 591ce34 to bc69b6b Compare August 31, 2026 10:48
@lws-team
lws-team force-pushed the main branch 2 times, most recently from 106d542 to d7e586c Compare September 6, 2026 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants