Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AES-GCM to meet "gold standard" requirements #78

Closed
10 tasks done
marsella opened this issue Jun 21, 2024 · 1 comment · Fixed by #84
Closed
10 tasks done

Update AES-GCM to meet "gold standard" requirements #78

marsella opened this issue Jun 21, 2024 · 1 comment · Fixed by #84

Comments

@marsella
Copy link
Contributor

marsella commented Jun 21, 2024

The GCM spec and AES instantiation of it needs a bit of work to meet our "gold standard" for specs. This was initially flagged in discussion on #75; see that PR for more details.

Some things to review:

  • There's a duplicated version (AES_256_GCM.cry and AES_GCM.cry). Determine whether we can remove this duplication or improve documentation to explain why we need two versions (maybe blocked on Refactor AES spec to meet "gold standard" requirements #77) Based on discussion, this will now be handled in Distinguish between spec-conformant and SAW-optimized Cryptol #86
    • Consider rewriting GCM.cry in terms of Cipher so that the instantiation is simpler and it can be reused for other (non-AES) block ciphers
    • Consider making separate modules for different key sizes (AES256_GCM and AES128_GCM)
  • Review parameter choices to make sure they are as tight as the NIST spec requires
  • Check for properties defined in the NIST spec and make sure they are explicit in the cryptol spec
    • GCTR: if X is empty, the return value should be the empty string
  • Convert into a literate spec This will be handled in Convert GCM mode to a Literate spec #87
  • Add warnings in the spec and readme about failure modes that Cryptol cannot prevent (IV reuse)
  • Switch to using options instead of record return
  • Note any additional proposed changes in this issue
@marsella
Copy link
Contributor Author

marsella commented Jun 21, 2024

Here are my notes on the parameter requirements in the NIST spec:

  • P17: t may be any one of the following five values: 128, 120, 112, 104, or 96
  • P15: the block size shall be 128 bits
  • P15: the key size shall be at least 128 bits
  • P16: len(P) $\le 2^{39}-256$; len(P) is a multiple of 8
  • P16: len(A) $\le 2^{64}-1$; len(A) is a multiple of 8
  • P16: $1 \le \text{len(IV)} \le 2^{64}-1$; len(IV) is a multiple of 8
  • encrypt and decrypt have to support the same len(C, A, IV)s.

marsella added a commit that referenced this issue Jul 2, 2024
marsella added a commit that referenced this issue Jul 2, 2024
- modifies the GCM mode implementation to use the interface
- replaces AES_GCM with separate instantiations of the GCM functor for
  our AES's of interest, and an independent test file
-
marsella added a commit that referenced this issue Jul 3, 2024
- Adds missing type constraints on IV, AAD, tag, plaintext, block size,
  and key lengths
- Update some names in the implementations
- Add notes on deviations / unsupported requirements from the spec
marsella added a commit that referenced this issue Jul 3, 2024
- Adds missing type constraints on IV, AAD, tag, plaintext, block size,
  and key lengths
- Update some names in the implementations
- Add notes on deviations / unsupported requirements from the spec
marsella added a commit that referenced this issue Jul 3, 2024
I read through the spec and added warnings about failure modes that
Cryptol can't catch. Also put in a tiny and fairly obvious property.
marsella added a commit that referenced this issue Jul 3, 2024
marsella added a commit that referenced this issue Jul 3, 2024
- modifies the GCM mode implementation to use the interface
- replaces AES_GCM with separate instantiations of the GCM functor for
  our AES's of interest, and an independent test file
-
marsella added a commit that referenced this issue Jul 3, 2024
- Adds missing type constraints on IV, AAD, tag, plaintext, block size,
  and key lengths
- Update some names in the implementations
- Add notes on deviations / unsupported requirements from the spec
marsella added a commit that referenced this issue Jul 3, 2024
I read through the spec and added warnings about failure modes that
Cryptol can't catch. Also put in a tiny and fairly obvious property.
@marsella marsella linked a pull request Jul 5, 2024 that will close this issue
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 a pull request may close this issue.

1 participant