You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0b95179
Browse filesBrowse the repository at this point in the historyBrowse files
Six fixes for the granular allowlist back-end, in response to the
GitHub Copilot pull-request review and the os-check.yml CI matrix
failure on the initial PR (wolfSSL#10541).
1. src/crypto_policy_granular.c top includes.
The file was using the standalone `#include <config.h>` +
`#include <wolfssl/wolfcrypt/settings.h>` pattern, which trips
the include-order assertion in settings.h whenever the build
defines TEST_LIBWOLFSSL_SOURCES_INCLUSION_SEQUENCE — that is,
on the upstream `make check linux` matrix (75 jobs failed,
first observed on CPPFLAGS=-DNO_VERIFY_OID). When the
module's content is gated behind WOLFSSL_SYS_CRYPTO_POLICY
and the macro is undefined, the same configuration also hit
ISO C's empty-translation-unit rule with -Werror=pedantic.
Switch to `#include <wolfssl/wolfcrypt/libwolfssl_sources.h>`
(the canonical pattern used by src/ssl.c, src/internal.c,
src/tls.c) which both establishes the correct include order
and pulls in types.h / error-crypt.h / logging.h so the TU is
never empty. The downstream includes of logging.h and types.h
become redundant and are removed.
2. DTLS-only allowlist no longer derives an empty cipher list
(Copilot review, src/crypto_policy_granular.c:432).
The previous derivation matched a suite's `version` field
(e.g. "TLS1.2") byte-for-byte against the policy's enabled
protocol tokens. A DTLS-only file (enabled-version = DTLS1.2)
therefore produced zero cipher rows even though the IANA
suite identifiers used by TLS 1.x and DTLS 1.x at the same
minor version are identical. The new helper
`wcp_protocol_family_enabled()` treats "TLS1.x" and "DTLS1.x"
as suite-equivalent at the same minor version, in both
directions.
3. min_version is now scoped to the CTX's protocol family
(Copilot review, src/crypto_policy_granular.c:545).
`wolfSSL_crypto_policy_min_version()` used to pick the
numerically smallest enabled version across both families.
On a DTLS CTX, that would feed a TLS constant (e.g.
WOLFSSL_TLSV1_2 = 3) into `wolfSSL_CTX_SetMinVersion()`,
which rejects it for the DTLS major version and the floor
was silently dropped. The function now takes an `is_dtls`
argument and only considers tokens of that family;
apply_granular() derives `is_dtls` from
`ctx->method->version.major == DTLS_MAJOR`.
4. Empty derived cipher list is now a hard failure
(Copilot review, src/crypto_policy_granular.c:559).
apply_granular() used to skip `wolfSSL_CTX_set_cipher_list()`
when the derived list was empty and still return success,
leaving the CTX's default cipher list in place — i.e. an
allowlist that didn't constrain anything. It now returns
WOLFSSL_FAILURE in that case, which tears the CTX down in
the WOLFSSL_CTX_new_ex granular-apply branch of src/ssl.c.
5. wolfSSL_crypto_policy_get_ciphers() reflects the granular
derivation (Copilot review, src/ssl.c:5473 and :5535).
Both enable paths mirror the derived cipher list into
`crypto_policy.str` after a successful granular parse, so
the public getter no longer returns an empty string while
`crypto_policy.enabled == 1`. The cipher set is identical
for the TLS and DTLS families at a given minor version, so
one derivation feeds both CTX families. Truncation is safe:
the string is informational; the authoritative apply happens
per CTX.
6. Cipher-count test helper uses the public stack accessor
(Copilot review, tests/api.c:30068).
`crypto_policy_cipher_count()` is replaced by a single call
to `wolfSSL_sk_SSL_CIPHER_num()`. The manual loop relied on
out-of-range behavior of `wolfSSL_sk_SSL_CIPHER_value()`.
The DTLS section of test_wolfSSL_crypto_policy_granular() is
extended to assert (a) the global policy cipher list is
non-empty for a DTLS-only fixture (regression guard for fixwolfSSL#2),
(b) the DTLS CTX survives apply_granular (regression guard for
fixeswolfSSL#3 and wolfSSL#4), (c) the derived list round-trips through
`wolfSSL_CTX_set_cipher_list()` on a fresh DTLS CTX. The test
explicitly does not assert on `wolfSSL_get_ciphers_compat()` for
a DTLS SSL: its `sslCipherMinMaxCheck()` compares TLS minor
numbers with DTLS minor numbers, a pre-existing TLS-vs-DTLS
quirk unrelated to the granular back-end.
Verified against five local build configurations on Ubuntu
24.04 + gcc 13: (1) `CPPFLAGS=-DNO_VERIFY_OID` (the original
failing CI config) — clean; (2) `--enable-all --enable-dtls
--enable-dtls13 --with-sys-crypto-policy=...` — make check
17/17 pass; (3) default `./configure` — make check 5/5 pass;
(4) `--enable-all` + `-pedantic -Werror -fsanitize=undefined
-O1` — build clean (a pre-existing UBSan finding in
src/ssl_crypto.c DES code is unrelated); (5) `--enable-dtls
--enable-dtls13` + DTLS-only policy — our test passes.
Co-Authored-By: Dominik Blain <[email protected]>
0 commit comments