Skip to content

Conversation

@stevedoyle
Copy link
Contributor

This is a WIP PR to get feedback on an approach to add a test suite for wasi-crypto (issue#44).

It is based on using the wycheproof test vecors to test wasi-crypto implementations for the algorithm set that is covered by the wycheproof test vectors. To get some initial feedback, Rust "integration tests" have been added for AES-128-GCM, AES-256, CHACHA20-POLY1305, HMAC/SHA-256, HMAC/SHA-512 and HKDF with SHA-256 and SHA-2512.

To run the tests:
cargo wasi test --test test_symmetric

These have been tested with WasmEdge.

Using [wycheproof test vecors](https://github.com/google/wycheproof) to test
wasi-crypto implementations.
@stevedoyle stevedoyle mentioned this pull request Mar 24, 2023
@stevedoyle stevedoyle marked this pull request as draft March 24, 2023 23:26
@jedisct1
Copy link
Member

jedisct1 commented Apr 1, 2023

Hi Steve!

And sorry for the delay, I'm still in Tokyo for HACS.

Running the Wycheproof test vectors is good.

However this is testing the underlying crypto libraries (which should hopefully already include these vectors in their own test suite), not the wasi-crypto API.

We need tests specific to the API to check for interoperability between runtimes, even if they use the same crypto library under the hood.

For example:

  • Passing invalid handles
  • Not setting a nonce for an AEAD that requires one
  • Invalid keys, invalid encodings
  • Closing handles twice
  • Invalid operation sequences
  • Invalid algorithm names, or names from one category of algorithmes used with a function for a different category
  • ...

@jedisct1
Copy link
Member

Implementations are not part of this repository any more.

@jedisct1 jedisct1 closed this Jan 11, 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.

2 participants