Skip to content

Use runtime checks in Wycheproof client#1226

Closed
fegge wants to merge 1 commit into
pq-code-package:mainfrom
trailofbits:fix/wycheproof-asserts-optimized-python
Closed

Use runtime checks in Wycheproof client#1226
fegge wants to merge 1 commit into
pq-code-package:mainfrom
trailofbits:fix/wycheproof-asserts-optimized-python

Conversation

@fegge

@fegge fegge commented Jun 26, 2026

Copy link
Copy Markdown

Summary

  • Replace verdict-bearing Wycheproof client assert statements with runtime checks.
  • Ensure invalid, valid, and unsupported-result cases still fail when Python optimization disables assertions.

Validation

  • ruff format test/wycheproof/wycheproof_client.py: passed
  • ruff check test/wycheproof/wycheproof_client.py: passed
  • python3 -m py_compile test/wycheproof/wycheproof_client.py: passed
  • git diff --check -- test/wycheproof/wycheproof_client.py: passed
  • rg -n '\bassert\b' test/wycheproof/wycheproof_client.py: no matches
  • make wycheproof -j4: passed
  • python3 test/wycheproof/wycheproof_client.py --data-dir <fresh-temp-dir>: passed
  • PYTHONOPTIMIZE=1 python3 test/wycheproof/wycheproof_client.py --data-dir <fresh-temp-dir>: passed
  • Tampered signing vector under PYTHONOPTIMIZE=1: failed as expected with signature mismatch tcId=1
  • Not run: ./scripts/format because nixpkgs-fmt is not installed in this local environment
  • Not run: ./scripts/lint because shfmt is not installed in this local environment

Fixes #1218


This work was completed by Trail of Bits as part of the Patch The Planet project in collaboration with OpenAI. The issue was identified primarily by the Codex coding agent, and manually reviewed before submission.

@fegge

fegge commented Jun 26, 2026

Copy link
Copy Markdown
Author

Reopened from an upstream repository branch with DCO-signed commits so full CI can run: #1234

@fegge fegge closed this Jun 26, 2026
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.

Wycheproof verdict checks can be disabled by optimized Python

1 participant