-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactoring of CoverCrypt API #134
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid moving lines around: it makes diff really hard to follow. Otherwise great work.
Ok(res) | ||
} | ||
plaintext: &[u8], | ||
) -> Result<(Encapsulation, Vec<u8>), Error>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should already serialize the encapsulation: the current solution seems to be somewhere in-between returning a struct containing each parts (encapsulation, mac, none and ciphertext) and serializing and concatenating all parts.
I don't have any strong opinion on it but this solution is surprising.
Missing only implementation of theEncryptionHandler methods. Now they as trait's functions |
@tbrezot I think I've addressed all your comments. Maybe miscommunication, but idk if I have to do a new pull request or not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, good job 👍
src/core/api.rs
Outdated
String::from_str("SEED_LENGTH >= KEY_LENGTH").unwrap(), | ||
)); | ||
} | ||
let sym_key = SymmetricKey::<KEY_LENGTH>::try_from_slice(&seed[..KEY_LENGTH])?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to implement a key derivation from a secret:
impl<const KEY_LENGTH: usize> SymmetricKey<KEY_LENGTH> {
fn derive<const SEED_LENGTH: usize>(&mut impl CryptoRngCore, seed: &Seed<SEED_LENGTH>, info: &[u8]) -> Result<Self, Error> {
if SEED_LENGTH < KEY_LENGTH {
Err(...) // insufficient entropy
} else {
let mut key = Self::default();
kdf!(&mut key, seed, info);
Ok(key)
}
}
}```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has to be implemented in crypto_core, right? The type is not defined in Covercrypt. @tbrezot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, maybe you could push a commit to develop
?
No description provided.