Skip to content

Add conversion and traceability for third-party test vectors#2839

Merged
sgmenda merged 20 commits intoaws:mainfrom
sgmenda:sync-vectors-convert
Nov 21, 2025
Merged

Add conversion and traceability for third-party test vectors#2839
sgmenda merged 20 commits intoaws:mainfrom
sgmenda:sync-vectors-convert

Conversation

@sgmenda
Copy link
Copy Markdown
Contributor

@sgmenda sgmenda commented Nov 17, 2025

Issues:

Addresses the need to convert third-party test vectors to AWS-LC's file_test.h format and track which vectors are tested. Currently, test vectors are manually converted and there's no systematic way to verify that all vectors in third_party/ are actually used in tests.

Description of changes:

Extends the test vector infrastructure from #2811 with two new phases (each can be skipped independently):

  • Convert: Transforms Wycheproof JSON test vectors to file_test.h format via convert_vector.py (inspired by the existing Go converter)
  • Spec: Generates vectors_spec.md with MUST requirements and uses duvet to verify that test files contain corresponding annotations

Converts and integrates aes_gcm_test from the latest upstream Wycheproof as a proof of concept, the test and duvet verification pass.

Call-outs:

  • Conversion is Python-based (not Go) to keep tooling unified within the vectors system
  • The existing Go converter at util/convert_wycheproof/ will be removed once all test vectors are migrated to the new system
  • Also removes now-outdated aes_gcm_test vector in third_party/wycheproof_testvectors/
  • Duvet verifies annotation presence but doesn't verify test coverage

Testing:

  • Unit tests in convert_vector.py verify JSON to file_test.h conversion
  • Tested full sync workflow and various skip flag combinations
  • Verified error handling (invalid sources, missing files)
  • Confirmed duvet correctly tracks annotation in crypto/cipher_extra/aead_test.cc

Run the full workflow with cd third_party/vectors && ./sync.py.

Run the migrated test with cd build && ./crypto/crypto_test --gtest_filter="AEADTest.WycheproofAESGCM"

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

@sgmenda sgmenda self-assigned this Nov 17, 2025
@sgmenda sgmenda requested a review from a team as a code owner November 17, 2025 21:07
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Nov 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.42%. Comparing base (8009085) to head (977e313).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2839      +/-   ##
==========================================
+ Coverage   78.24%   78.42%   +0.17%     
==========================================
  Files         683      683              
  Lines      117346   117347       +1     
  Branches    16488    16492       +4     
==========================================
+ Hits        91821    92032     +211     
+ Misses      24641    24428     -213     
- Partials      884      887       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@torben-hansen torben-hansen requested review from skmcgrail and removed request for justsmth November 21, 2025 18:11
@sgmenda sgmenda merged commit 2929213 into aws:main Nov 21, 2025
389 of 391 checks passed
@sgmenda sgmenda deleted the sync-vectors-convert branch November 21, 2025 23:25
sgmenda added a commit that referenced this pull request Jan 7, 2026
…2887)

### Issues:

Migrating Wycheproof test vectors to the new `third_party/vectors/`
system introduced in #2811 and extended in #2839, enabling systematic
tracking and traceability.

### Description of changes: 

Migrates 30 test vector files to the new vector system:
- 10 ECDSA test files (secp224r1, secp256r1, secp384r1, secp521r1,
secp256k1 with SHA-224, SHA-256, SHA-384, SHA-512)
- 4 DSA test files (2048-bit and 3072-bit keys with SHA-224, SHA-256)
- 1 EdDSA test file (Ed25519)
- 12 RSA PKCS#1 signature verification test files (2048, 3072, 4096,
8192-bit keys with SHA-224, SHA-256, SHA-384, SHA-512)
- 5 RSA PKCS#1 signature generation test files (1024, 1536, 2048, 3072,
4096-bit keys including weak key sizes)
- 3 RSA PKCS#1 v1.5 decryption test files (2048, 3072, 4096-bit keys)

Each migration adds upstream JSON vectors and converted txt files to
`third_party/vectors/`, updates test files with new paths and duvet
annotations for traceability, and removes old files from
`third_party/wycheproof_testvectors/`.

### Call-outs:

- Previous `rsa_signature_test.txt` superseded by
`rsa_signature_*_sha*_test.txt` files with explicit key sizes
- Previous `rsa_sig_gen_misc_test.txt` superseded by
`rsa_pkcs1_*_sig_gen_test.txt` files with explicit key sizes
- Remaining test vectors will be migrated in follow-up PRs

### Testing:

All migrated tests pass and duvet verification succeeds:
```bash
cd build && ./crypto/crypto_test
cd third_party/vectors && python3 sync.py
```

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and the ISC license.
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