Skip to content

Commit

Permalink
Remove TODO for #43 (closed)
Browse files Browse the repository at this point in the history
  • Loading branch information
fjarri committed Apr 22, 2021
1 parent c59d24f commit 9b8adcf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions umbral-pre/src/dem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ pub(crate) struct DEM {
}

impl DEM {
pub fn new(key_seed: &[u8], salt: Option<&[u8]>, info: Option<&[u8]>) -> Self {
pub fn new(key_seed: &[u8]) -> Self {
type KeySize = <XChaCha20Poly1305 as NewAead>::KeySize;
let key_bytes = kdf::<KeySize>(&key_seed, salt, info);
let key_bytes = kdf::<KeySize>(&key_seed, None, None);
let key = Key::from_slice(&key_bytes);
let cipher = XChaCha20Poly1305::new(key);
Self { cipher }
Expand Down
9 changes: 3 additions & 6 deletions umbral-pre/src/pre.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ use alloc::boxed::Box;
/// Returns the KEM [`Capsule`] and the ciphertext.
pub fn encrypt(pk: &PublicKey, plaintext: &[u8]) -> Option<(Capsule, Box<[u8]>)> {
let (capsule, key_seed) = Capsule::from_public_key(pk);
// TODO (#43): add salt and info here?
let dem = DEM::new(&key_seed.to_array(), None, None);
let dem = DEM::new(&key_seed.to_array());
let capsule_bytes = capsule.to_array();
let ciphertext = dem.encrypt(plaintext, &capsule_bytes)?;
Some((capsule, ciphertext))
Expand All @@ -29,8 +28,7 @@ pub fn decrypt_original(
ciphertext: impl AsRef<[u8]>,
) -> Option<Box<[u8]>> {
let key_seed = capsule.open_original(decrypting_sk);
// TODO (#43): add salt and info here?
let dem = DEM::new(&key_seed.to_array(), None, None);
let dem = DEM::new(&key_seed.to_array());
dem.decrypt(ciphertext, &capsule.to_array())
}

Expand Down Expand Up @@ -62,8 +60,7 @@ pub fn decrypt_reencrypted(
ciphertext: impl AsRef<[u8]>,
) -> Option<Box<[u8]>> {
let key_seed = capsule.open_reencrypted(decrypting_sk, delegating_pk, cfrags)?;
// TODO (#43): add salt and info here?
let dem = DEM::new(&key_seed.to_array(), None, None);
let dem = DEM::new(&key_seed.to_array());
dem.decrypt(&ciphertext, &capsule.to_array())
}

Expand Down

0 comments on commit 9b8adcf

Please sign in to comment.