WebAssembly / wasi-crypto

WASI Cryptography API Proposal
162 stars 25 forks source link

Support more feature. #52

Closed sonder-joker closed 1 year ago

sonder-joker commented 2 years ago

I have tried to port wasi-crypto to RustCrypto/traits. Compare with RustCrypto target wasm32-wasi, it have Ssgnificant speed increase. However, I meet some feature we don't have. I will record them here.

sonder-joker commented 2 years ago

Support symmetric_state_reset. Instead of recreate a new state, just reset it consider more efficient. May a optional feature.

sonder-joker commented 2 years ago

Support symmetric_state_copy. A deep copy of state return a new handle. I believe it will be easy for people want to copy. Besides, RustCrypto/Traits require state can copy.

sonder-joker commented 2 years ago

My preliminary implementation here. After support RustCrypto/traits, we can also use RustCrypto test for #52.

jedisct1 commented 2 years ago

I'm not too fan of symmetric_state_reset.

Some ciphers and keyed hash functions using a rolling state have a really useful property: if a state is leaked, the initial state or the key cannot be recovered.

Supporting a reset operation defeats this, and requiers keeping a copy of the secret key or the initial state forever. Even if reset is never called.

sonder-joker commented 2 years ago

I'm not too fan of symmetric_state_reset.

Some ciphers and keyed hash functions using a rolling state have a really useful property: if a state is leaked, the initial state or the key cannot be recovered.

Supporting a reset operation defeats this, and requiers keeping a copy of the secret key or the initial state forever. Even if reset is never called.

Thanks for your advice. Supporting reset is inappropriate.