Skip to content

openssl: x509: allow build with OpenSSL 4.x#3560

Open
heitbaum wants to merge 38 commits intowarmcat:mainfrom
heitbaum:openssl
Open

openssl: x509: allow build with OpenSSL 4.x#3560
heitbaum wants to merge 38 commits intowarmcat:mainfrom
heitbaum:openssl

Conversation

@heitbaum
Copy link
Copy Markdown
Contributor

ASN1_STRING are now opaque types — the internal data and length fields are no longer directly accessible. Use the accessor API instead. Accessors have been available since OpenSSL 1.1.0

Signatures of numerous API functions, including those that are related to X509 processing, are changed to include const qualifiers for argument and return types, where suitable. Add const qualifer to variables.

fixes:

../lib/tls/openssl/openssl-x509.c: In function 'lws_tls_openssl_asn1time_to_unix':
../lib/tls/openssl/openssl-x509.c:42:41: error: invalid use of incomplete typedef 'ASN1_TIME' {aka 'struct asn1_string_st'}
   42 |         const char *p = (const char *)as->data;
      |                                         ^~
../lib/tls/openssl/openssl-x509.c: In function 'lws_tls_openssl_cert_info':
../lib/tls/openssl/openssl-x509.c:129:20: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  129 |                 xn = X509_get_subject_name(x509);
      |                    ^
../lib/tls/openssl/openssl-x509.c:148:20: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  148 |                 xn = X509_get_issuer_name(x509);
      |                    ^
../lib/tls/openssl/openssl-x509.c:218:21: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  218 |                 ext = X509_get_ext(x509, (int)loc);
      |                     ^
../lib/tls/openssl/openssl-x509.c:229:48: error: invalid use of incomplete typedef 'ASN1_OCTET_STRING' {aka 'struct asn1_string_st'}
  229 |                 dp = (const unsigned char *)val->data;
      |                                                ^~
../lib/tls/openssl/openssl-x509.c:230:27: error: invalid use of incomplete typedef 'ASN1_OCTET_STRING' {aka 'struct asn1_string_st'}
  230 |                 xlen = val->length;
      |                           ^~
../lib/tls/openssl/openssl-x509.c:246:21: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  246 |                 ext = X509_get_ext(x509, (int)loc);
      |                     ^
../lib/tls/openssl/openssl-x509.c:303:21: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  303 |                 ext = X509_get_ext(x509, (int)loc);
      |                     ^
../lib/tls/openssl/openssl-x509.c:329:21: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  329 |                 ext = X509_get_ext(x509, (int)loc);
      |                     ^
../lib/tls/openssl/openssl-x509.c:333:21: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  333 |                 val = X509_EXTENSION_get_data(ext);
      |                     ^
../lib/tls/openssl/openssl-x509.c:340:48: error: invalid use of incomplete typedef 'ASN1_OCTET_STRING' {aka 'struct asn1_string_st'}
  340 |                 dp = (const unsigned char *)val->data;
      |                                                ^~
../lib/tls/openssl/openssl-x509.c:343:55: error: invalid use of incomplete typedef 'ASN1_OCTET_STRING' {aka 'struct asn1_string_st'}
  343 |                                     &tag, &xclass, val->length) & 0x80)
      |                                                       ^~
../lib/tls/openssl/openssl-x509.c: In function 'lws_x509_verify':
../lib/tls/openssl/openssl-x509.c:459:33: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  459 |                 X509_NAME *xn = X509_get_subject_name(x509->cert);
      |                                 ^~~~~~~~~~~~~~~~~~~~~

lws-team added 30 commits March 14, 2026 18:01
Add a generic DTLS wrapper to lws that is able to work using any of the
supported tls libraries as the backed: openssl (and variants), mbedtls,
gnutls, schannel

Note that schannel is not able to work with webrtc due to schannel api's
own limitations.  You must use openssl or mbedtls for windows if you want
to use dtls for webrtc.
This adds support for webrtc serving along with ALSA, OPUS, V4L2, TRANSCODE
and other critical pieces
Having added a member to lws_plugin_protocol, it's a good time to change
the old struct initializer format to C9, since we'll have to visit them all
anyway.

Also modernize the event lib struct while we're at it.
Various things that Sai identified needed fixing
ASN1_STRING are now opaque types — the internal data and length fields are
no longer directly accessible. Use the accessor API instead. Accessors
have been available since OpenSSL 1.1.0

Signatures of numerous API functions, including those that are related
to X509 processing, are changed to include const qualifiers for argument
and return types, where suitable. Add const qualifer to variables.

Co-authored-by: Andy Green <andy@warmcat.com>
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
@heitbaum
Copy link
Copy Markdown
Contributor Author

Force pushed updated commit.

@lws-team lws-team force-pushed the main branch 3 times, most recently from 6790fe8 to 609de65 Compare March 27, 2026 14:43
@lws-team lws-team force-pushed the main branch 10 times, most recently from 250ebbd to c9cf315 Compare April 7, 2026 05:16
@lws-team lws-team force-pushed the main branch 2 times, most recently from a831f9e to e34f0f9 Compare April 13, 2026 11:21
@lws-team lws-team force-pushed the main branch 12 times, most recently from 9c8546e to 940d6c8 Compare April 28, 2026 06:01
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