sk_TYPE_find*() on built-in stack types still requires a non-const STACK_OF
I maintainer di solito rispondono entro 2 giorni
@bob-beck ci sta già lavorando.
Dal 13/11/2026.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- api, build-system
Direzione di ricerca
Le macro find sono generate da util/perl/OpenSSL/stackhash.pm; confronta come emette sk_TYPE_find* con i casi sk_TYPE_num e sk_TYPE_value, che usano già ossl_check_const_TYPE_sk_type(). Passa le tre macro find a quell'helper, poi esegui make build_generated e ricompila il reproducer dell'issue. È completato quando compila senza l'avviso di const-discard sia con gcc sia con clang.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
#20135 and #28532 made it so that OPENSSL_sk_find(), OPENSSL_sk_find_ex(), and OPENSSL_sk_find_all() take a const OPENSSL_STACK * and documented as such.
However, stack types declared with generate_stack_macros() / generate_const_stack_macros() get their sk_TYPE_find* macros from util/perl/OpenSSL/stackhash.pm, which still passes the stack through the non-const ossl_check_TYPE_sk_type(), so for these types the functions must take a non-const STACK_OF(TYPE) *, contrary to the documentation.
Version: openssl-4.1.0, headers generated from a source checkout (./Configure && make build_generated).
Reproducer:
#include <openssl/ssl.h>
int find_cipher(const STACK_OF(SSL_CIPHER) *sk, const SSL_CIPHER *c) {
return sk_SSL_CIPHER_find(sk, c);
}
$ gcc -c -Wall -I include /tmp/openssl_repro.c
In file included from /tmp/openssl_repro.c:1:
/tmp/openssl_repro.c: In function ‘find_cipher’:
/tmp/openssl_repro.c:4:31: warning: passing argument 1 of ‘ossl_check_SSL_CIPHER_sk_type’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
4 | return sk_SSL_CIPHER_find(sk, c);
| ^~
include/openssl/ssl.h:1109:83: note: in definition of macro ‘sk_SSL_CIPHER_find’
1109 | #define sk_SSL_CIPHER_find(sk, ptr) OPENSSL_sk_find(ossl_check_SSL_CIPHER_sk_type(sk), ossl_check_SSL_CIPHER_type(ptr))
| ^~
In file included from include/openssl/crypto.h:36,
from include/openssl/comp.h:25,
from include/openssl/ssl.h:31:
include/openssl/safestack.h:67:91: note: expected ‘struct stack_st_SSL_CIPHER *’ but argument is of type ‘const struct stack_st_SSL_CIPHER *’
67 | static ossl_unused ossl_inline OPENSSL_STACK *ossl_check_##t1##_sk_type(STACK_OF(t1) *sk) \
| ^
include/openssl/ssl.h:1070:1: note: in expansion of macro ‘SKM_DEFINE_STACK_OF_INTERNAL’
1070 | SKM_DEFINE_STACK_OF_INTERNAL(SSL_CIPHER, const SSL_CIPHER, SSL_CIPHER)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ clang -c -Wall -I include /tmp/openssl_repro.c
/tmp/openssl_repro.c:4:31: warning: passing 'const struct stack_st_SSL_CIPHER *' to parameter of type 'struct stack_st_SSL_CIPHER *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
4 | return sk_SSL_CIPHER_find(sk, c);
| ^~
include/openssl/ssl.h:1070:1: note: passing argument to parameter 'sk' here
1070 | SKM_DEFINE_STACK_OF_INTERNAL(SSL_CIPHER, const SSL_CIPHER, SSL_CIPHER)
| ^
include/openssl/safestack.h:67:91: note: expanded from macro 'SKM_DEFINE_STACK_OF_INTERNAL'
67 | static ossl_unused ossl_inline OPENSSL_STACK *ossl_check_##t1##_sk_type(STACK_OF(t1) *sk) \
| ^
1 warning generated.
(gcc 15.2.0, clang 21.1.8)
Expected: compiles cleanly
Suggested fix: use the existing ossl_check_const_TYPE_sk_type() for the three find macros in stackhash.pm, as is already done for sk_TYPE_num, sk_TYPE_value and sk_TYPE_is_sorted:
Context: this came up while preparing various callers for BoringSSL's change to make SSL_get_ciphers() return a const pointer (https://crbug.com/550501994), where in cpython there's a neighboring SSL_get_client_ciphers() result passed to sk_SSL_CIPHER_find() that surprisingly can't be made const due to this.
- Lingua principale
- C
- Stelle
- 31.4k
- Fork
- 11.6k
- Merge medio
- 20m
- PR unite (30g)
- 2
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di openssl/openssl
-
issue: bug report
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 2 giorni
-
issue: bug report
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 74/100
I maintainer di solito rispondono entro 2 giorni
-
`EVP_PKEY_get_utf8_string_param()` size query returns 0 for an empty value such as `mandatory-digest` of EdDSA/ML-DSA keysForse già presa @Regex0000 l’ha presa oggi. Apertabranch: 3.5 branch: 4.0 branch: 4.1 branch: master good first issue help wanted triaged: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
openssl/openssl#33698 · 3 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
s_server -unix exits on macOS while reporting the listener addressForse già presa @gustafn l’ha presa 1 giorno fa. Apertabranch: 3.5 branch: 4.0 branch: 4.1 branch: master good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
openssl/openssl#33660 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
`SSL_get_conn_close_info()` returns `-1` instead of the documented `0` on unsupported objectsApertabranch: 3.5 branch: 4.0 branch: 4.1 branch: master help wanted triaged: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
openssl/openssl#33637 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di openssl/openssl
Issue simili
-
Status: Opened
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
FriendsofECCE/ECCE#1018 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
immortalwrt/immortalwrt#2522 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
severity: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
luainkernel/lunatik#2530 ·
I maintainer di solito rispondono entro 1 giorno