Skip to content

examples/usercertinmem: avoid stripping const#18908

Closed
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:ossl-example
Closed

examples/usercertinmem: avoid stripping const#18908
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:ossl-example

Conversation

@vszakats
Copy link
Copy Markdown
Member

@vszakats vszakats commented Oct 7, 2025

This API started accepting a const somewhere between OpenSSL 1.0.2b and
1.0.2t. It means this example, like the other similar one now works best
with those versions or newer:

docs/examples/usercertinmem.c:100:33: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual]
  100 |   bio = BIO_new_mem_buf((char *)mypem, -1);
      |                                 ^
docs/examples/usercertinmem.c:121:34: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual]
  121 |   kbio = BIO_new_mem_buf((char *)mykey, -1);
      |                                  ^

This API started accepting a const somewhere between OpenSSL 1.0.2b and
1.0.2t. It means this example, like the other similar one now works best
with those versions.

```
docs/examples/usercertinmem.c:100:33: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual]
  100 |   bio = BIO_new_mem_buf((char *)mypem, -1);
      |                                 ^
docs/examples/usercertinmem.c:121:34: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual]
  121 |   kbio = BIO_new_mem_buf((char *)mykey, -1);
      |                                  ^
```
@vszakats vszakats changed the title examples/usercertinmem: avoid const stripping examples/usercertinmem: avoid stripping const Oct 7, 2025
@vszakats vszakats closed this in 4a6bdd5 Oct 7, 2025
@vszakats vszakats deleted the ossl-example branch October 7, 2025 11:12
vszakats added a commit that referenced this pull request Oct 7, 2025
- cacertinmem: build cleanly with BoringSSL/AWS-LC.
- cacertinmem: silence `-Wcast-function-type-strict`.
- multi-uv: fix callback prototypes.
- multithread, threaded-ssl: do not pass const as thread arg.
- sessioninfo: fix suppressing deprecated feature warning.
- usercertinmem: sync formatting with cacertinmem.

Follow-up to 4a6bdd5 #18908
Cherry-picked from #18909
Closes #18914
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants