Crypto layer: Add missing input validation#10819
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens wolfCrypt/wolfSSL by adding additional input validation and tightening default Diffie–Hellman parameter minimums to align with modern security guidance (2048-bit minimum by default, overridable for legacy use).
Changes:
- Introduces
DH_MIN_SIZE(default 2048 bits) and aligns TLS-layer DH minimums with the DH primitive’s minimum. - Adds/adjusts input validation to prevent overflow/wraparound and invalid arguments in KDF/PRF, ECC key import, RSA key generation, and DH operations.
- Updates an existing DH test to be conditionally compiled based on
DH_MIN_SIZE.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfssl/wolfcrypt/settings.h | Defines DH_MIN_SIZE with a secure default and legacy override mapping. |
| wolfssl/version.h | Updates library version macros (currently inconsistent with rest of repo). |
| wolfssl/internal.h | Aligns WOLFSSL_MIN_DHKEY_BITS default with DH_MIN_SIZE and enforces consistency. |
| wolfcrypt/src/rsa.c | Fixes heap usage in an OAEP error path and tightens RSA exponent validation under FIPS. |
| wolfcrypt/src/kdf.c | Adds null/length argument validation and prevents word32 wraparound in length checks. |
| wolfcrypt/src/ecc.c | Prevents potential word32 overflow when expanding compressed ECC point lengths. |
| wolfcrypt/src/dh.c | Rejects DH primes smaller than DH_MIN_SIZE and adds a null check in wc_DhCheckPubValue. |
| tests/api/test_dh.c | Gates a subgroup-check test on DH_MIN_SIZE (affects coverage in default builds). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
c66cde1 to
8961b60
Compare
|
Jenkins Retest this please |
cb5d209 to
69af8ed
Compare
|
@lealem47 PRB-master-job failures are legit. |
b465f15 to
7a1e0ca
Compare
|
Jenkins retest this please |
Frauschi
left a comment
There was a problem hiding this comment.
🐺 Skoll Code Review
Overall recommendation: APPROVE
Findings: 2 total — 2 posted, 0 skipped
Posted findings
- [Low] FIPS RSA exponent floor reuses WC_RSA_EXPONENT default macro —
wolfcrypt/src/rsa.c:5415-5419 - [Info] Non-conforming indentation in wc_PRF NULL-argument check —
wolfcrypt/src/kdf.c:92-94
Review generated by Skoll via Claude/Codex
7a1e0ca to
6c96a72
Compare
|
Jenkins retest this please. |
Frauschi
left a comment
There was a problem hiding this comment.
🐺 Skoll Code Review
Overall recommendation: APPROVE
Findings: 3 total — 2 posted, 2 skipped
Posted findings
- [Medium] WOLFSSL_MIN_AUTH_TAG_SZ clamp moved from kernel-only to all builds silently overrides explicit user values —
wolfssl/wolfcrypt/settings.h:3895-3919 (removed from 4275-4424 WOLFSSL_LINUXKM block) - [Info] Indentation of new wc_PRF NULL check does not match wolfSSL 4-space style —
wolfcrypt/src/kdf.c:92-94
Skipped findings
- [Low] CMAC minimum tag size raised 4->8 changes accepted tag range for existing callers
- [Medium] WOLFSSL_MIN_AUTH_TAG_SZ clamp moved from kernel-only to all builds silently overrides explicit user values
Review generated by Skoll via Claude/Codex
362a269 to
48794a1
Compare
48794a1 to
1a7a536
Compare
|
Jenkins Retest this please. |
1a7a536 to
8a51b31
Compare
|
Jenkins retest this please |
|
Jenkins Retest this please |
Description
WOLFSSL_MIN_AUTH_TAG_SZTesting
./configure --enable-all && make check
Checklist