Skip to content

Drop redundant certificate and key checks from the standard handshake - #76

Merged
dgarske merged 1 commit into
wolfSSL:mainfrom
aidangarske:faster-standard-handshake
Nov 11, 2026
Merged

dgarske merged 1 commit into
wolfSSL:mainfrom
aidangarske:faster-standard-handshake

Conversation

@aidangarske

Copy link
Copy Markdown
Member

Duplicate chain validation, commit aidangarske@d4f553a - wolfSPDM_ConnectStandard validated the certificate chain after GET_CERTIFICATE and again inside wolfSPDM_KeyExchange, doubling the ECDSA verifies. Connect now calls an internal key exchange that skips the second pass, while the public wolfSPDM_KeyExchange still revalidates, so the F-14806 protection for direct callers is unchanged. Set B library and crypto CPU per handshake went from 1.86 ms to 0.99 ms on x86_64 together with the changes below.

Trust anchor self-signature - when the chain's root is byte-identical to the configured trusted CA, its own signature is no longer verified, since the anchor is trusted by configuration and RootHash already matches it. A root copy that differs from the anchor is still verified, and a new test passes only with this change.

Public key validation - wc_ecc_check_key did a full n*Q scalar multiplication on the ECDHE and responder keys. P-384 has cofactor 1, so the range and on-curve check from wc_ecc_point_is_on_curve is sufficient. wolfSSL builds before v5.9.1 without USE_ECC_B_PARAM fall back to wc_ecc_check_key.

Certificate reads - GET_CERTIFICATE asked for a fixed 1 KB per message and used a stack buffer. Each request now asks for up to the negotiated transfer size, and the reply is received directly into the chain buffer, so there is no stack buffer and the context grows by 8 bytes. The 16.8 KB ML-DSA-65 chain went from 26 messages to 19, and SPDM 1.4 PQ total CPU went from 3.20 ms to 2.36 ms.

@aidangarske aidangarske self-assigned this Nov 11, 2026
@aidangarske
aidangarske requested review from wolfSSL-Fenrir-bot and a balanced review from Copilot November 11, 2026 20:44

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #76

Scan targets checked: wolfspdm-src, wolfspdm-bugs
Not reviewed (no scan target covers them): test/unit_test.c
Coverage: 4 of 4 in-scope changed file(s) opened by the reviewer

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Max

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@dgarske
dgarske merged commit 984bb4f into wolfSSL:main Nov 11, 2026
72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants