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

Use const generics #7

Merged
merged 18 commits into from
Oct 4, 2022
Merged

Use const generics #7

merged 18 commits into from
Oct 4, 2022

Conversation

tbrezot
Copy link
Collaborator

@tbrezot tbrezot commented Sep 2, 2022

  • use constant generics instead of generic arrays:
    • KEY_LENGTH had to be added to the Dem trait to be able to use { Aes256GcmCrypto::KEY_LENGTH } as a constant generic
  • remove SymmetricCrypto trait -> Dem becomes the default trait for symmetric encryption
  • add DhKeyPair trait, which represent an asymmetric key pair based on a space where the computational Diffie-Helman is intractable
  • remove block.rs: checking the plaintext/ciphertext size to prevent nonce reuse should be done in the DEM implementation as it is specific to nonce-based symmetric ciphers; block structure is pushed up onto the call stack through the use of associated data
  • implement NonceTrait::increment() without BigInt dependency and remove big-int from the crate dependencies
    • is this method really needed since we will most likely let the symmetric cipher crate manage incrementing the nonce ?
  • remove std where core can be used
    • the only place where std is needed is in aes_256_gcm_pure.rs
    • as a future work, we could try to use aes-gcm with the no-alloc feature

Edit: there still is a std dependency as a rand_core feature

Edit: after discussion with @bgrieder I removed increment() from the nonce trait

@tbrezot tbrezot force-pushed the use_const_generics branch 2 times, most recently from c17ca93 to 17d590f Compare September 6, 2022 12:24
@tbrezot tbrezot marked this pull request as draft September 6, 2022 13:43
@tbrezot tbrezot marked this pull request as ready for review September 19, 2022 12:05
src/kdf.rs Outdated Show resolved Hide resolved
src/symmetric_crypto/aes_256_gcm_pure/mod.rs Show resolved Hide resolved
src/symmetric_crypto/mod.rs Outdated Show resolved Hide resolved
@tbrezot tbrezot force-pushed the use_const_generics branch 2 times, most recently from afaee4c to 3e92015 Compare September 20, 2022 11:36
BREAKING CHANGE: implementations should use a SHA algorithm
(preferentially SHA-3 since Intel processors will include dedicated NI
in the long run) if the input has enough entropy, Argon2 or a PBKDF
otherwise (see ANSSI specification about this).
Fix typos, increase homogeneity and add inline proc macros when
possible.
@tbrezot tbrezot merged commit be3b903 into main Oct 4, 2022
@tbrezot tbrezot deleted the use_const_generics branch October 4, 2022 13:06
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