Skip to content

Commit 7d2b407

Browse files
max-qlabDominik Blain
andcommitted
crypto-policies: keep granular sources ASCII-only
Address the check-source-text failure on PR wolfSSL#10541, commit 0b95179: the 8-bit scan in pre-commit/check-source-text.sh flagged ten non-ASCII bytes (em-dash U+2014 and intersection U+2229) that had crept into commentary in src/crypto_policy_granular.c and tests/api.c. Replace each em-dash with " -- " and the lone "intersect" glyph with the word "intersect". Comments-only change; no code, no fixtures, no test logic touched. Diff is 10 insertions / 10 deletions across the two files. Verified post-fix: grep -rP '[^\x00-\x7F]' src/crypto_policy_granular.c tests/api.c -> no matches. Co-Authored-By: Dominik Blain <[email protected]>
1 parent 0b95179 commit 7d2b407

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎src/crypto_policy_granular.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
* Reentrancy / threading: the helpers in this file are pure (no global
1515
* state). The applier calls back into the wolfSSL public API and
1616
* temporarily lifts the `wolfSSL_CTX_SetMinVersion` policy guard via
17-
* the `crypto_policy_applying` flag in src/ssl.c — that is the only
17+
* the `crypto_policy_applying` flag in src/ssl.c -- that is the only
1818
* coupling. Like the legacy crypto-policy parser, the apply step is
1919
* documented as init-time only and is not thread-safe.
2020
*
2121
* Forward compatibility: unknown vocabulary tokens are tolerated
2222
* silently so a wolfSSL build can consume a newer Fedora file without
23-
* upgrading; the intersection of "policy-enabled ∩ build-supported"
23+
* upgrading; the intersection of "policy-enabled intersect build-supported"
2424
* is what actually reaches a WOLFSSL_CTX. The file *format* version
2525
* (`version = 1`) is conversely strict: a higher version is rejected
2626
* outright because it may redefine the meaning of existing keys.
@@ -256,7 +256,7 @@ int wolfSSL_crypto_policy_parse_granular(const char *buf,
256256
return WOLF_CP_ERR_NOT_ALLOWLIST;
257257
}
258258
/* `version = 1` is the only format this parser knows. A newer file
259-
* may add directives that change the *meaning* of existing keys —
259+
* may add directives that change the *meaning* of existing keys --
260260
* silently consuming them would be unsafe, so we refuse the file
261261
* outright. Forward compatibility is the file-format author's job
262262
* (bump the version) and ours (ship a parser that handles it). */
@@ -407,7 +407,7 @@ static const char *wcp_lookup_str(const struct wcp_kv_str *m, const char *cp)
407407
* version are identical (the DTLS variant is encoded as an alias of the
408408
* TLS code-point). The suite table tags each row with its TLS label, so
409409
* a DTLS-only allowlist (e.g. enabled-version = DTLS1.2) must still
410-
* enable every TLS 1.2 row that survives the other constraints — and
410+
* enable every TLS 1.2 row that survives the other constraints -- and
411411
* vice versa. Treat the protocol token as "TLS 1.x family" rather than
412412
* exact string match. */
413413
static int wcp_protocol_family_enabled(const WolfCPList *protocols,
@@ -546,7 +546,7 @@ int wolfSSL_crypto_policy_min_version(const WolfGranularPolicy *p,
546546
* TLSV1_1=2 < TLSV1_2=3 < TLSV1_3=4, and DTLSV1=5 <
547547
* DTLSV1_2=6 < DTLSV1_3=7. We've already filtered by family
548548
* above, so the smallest value is the oldest version in that
549-
* family — the right floor. */
549+
* family -- the right floor. */
550550
if (v < best_pri) {
551551
best_pri = v;
552552
best = v;
@@ -579,7 +579,7 @@ int wolfSSL_crypto_policy_apply_granular(WOLFSSL_CTX *ctx,
579579

580580
/* 1. Protocol min version. Best-effort: a TLS 1.0 floor against a
581581
* build that lacks WOLFSSL_ALLOW_TLSV10 must not tear down the CTX
582-
* — we keep the wolfSSL-default downgrade floor and let the cipher
582+
* -- we keep the wolfSSL-default downgrade floor and let the cipher
583583
* list + key-size floors carry the policy. The caller will still
584584
* negotiate within the build's supported version range.
585585
*
@@ -606,7 +606,7 @@ int wolfSSL_crypto_policy_apply_granular(WOLFSSL_CTX *ctx,
606606
return WOLFSSL_FAILURE;
607607
}
608608
if (buf[0] == '\0') {
609-
WOLFSSL_MSG("granular policy: derived cipher list is empty — "
609+
WOLFSSL_MSG("granular policy: derived cipher list is empty -- "
610610
"policy enables no suites this build can serve");
611611
return WOLFSSL_FAILURE;
612612
}

‎tests/api.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30064,7 +30064,7 @@ static int crypto_policy_cipher_count(const WOLFSSL * ssl)
3006430064
*
3006530065
* Drives the new granular code path: wolfSSL_crypto_policy_enable() must
3006630066
* detect the allowlist header, parse the sectioned file, and the CTX
30067-
* created afterwards must reflect the policy's primitives — cipher
30067+
* created afterwards must reflect the policy's primitives -- cipher
3006830068
* count, suite membership, security level, and DTLS support.
3006930069
* */
3007030070
static int test_wolfSSL_crypto_policy_granular(void)
@@ -30155,15 +30155,15 @@ static int test_wolfSSL_crypto_policy_granular(void)
3015530155
* list reflects the policy. A previous version of the granular
3015630156
* back-end only matched the exact "TLS1.x" token against suites,
3015730157
* so a DTLS-only policy derived an empty cipher list and the
30158-
* applier silently kept the CTX's default suites — i.e. the
30158+
* applier silently kept the CTX's default suites -- i.e. the
3015930159
* allowlist did not constrain anything.
3016030160
*
3016130161
* We assert:
3016230162
* (a) get_ciphers() returns a non-empty derived list, proving
3016330163
* DTLS1.2 protocol tokens enable their TLS1.2 cipher peers
3016430164
* in the derivation (fix for the DTLS suite-match gap);
3016530165
* (b) the DTLS CTX is created, proving apply_granular ran to
30166-
* success — empty derive now returns WOLFSSL_FAILURE and
30166+
* success -- empty derive now returns WOLFSSL_FAILURE and
3016730167
* the CTX would be torn down before reaching this point;
3016830168
* (c) the derived list round-trips through set_cipher_list on
3016930169
* a fresh DTLS CTX (the CTX-level cipher store accepts the

0 commit comments

Comments
 (0)