WebAssembly / WebAssembly/wasi-crypto

Symmetric crypto: add the ability to reset the state

Open
#83 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Makefile
Stars
180
Forks
25
PR merge metrics
No merged PRs in 30d

Description

The Intel folks noticed that in order to encrypt/decrypt a new message, a new symmetric state had to be created.

However, with AES-GCM, setting up a new key is slow, because it requires doing some precomputations.

If the same key is used multiple times, we could reuse these precomputations for a slight speedup.

One way to address this would be to introduce a symmetric_state_reset(<state handle>, <key handle>) hostcall.

If the key handle is the same as the previous one, it doesn't do anything except clear the nonce (or create a new one if it can be randomized).
If the key is different, it's equivalent to creating a new state, but without creating a new handle.

If the key doesn't change, this allows implementations to reuse the precomputations. This is optional (just a performance enhancement) and only for AES-GCM, or possibly future ciphers that have a slow key setup.

What do you think @sonder-joker ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the proposed symmetric_state_reset(, ) hostcall and the behavior described for reused and changed keys. No files or tests are named; the issue needs a settled API decision and clear completion criteria before implementation can begin.

Written by the indexing model from the issue text.

Assessment

Domain
cryptography
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.