Skip to content

Commit b776cfc

Browse files
committed
chacha20poly1305: Migrate to universal-hash 0.5
1 parent 2482bcb commit b776cfc

File tree

3 files changed

+38
-10
lines changed

3 files changed

+38
-10
lines changed

Cargo.lock

Lines changed: 34 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chacha20poly1305/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ categories = ["cryptography", "no-std"]
2121
aead = { version = "0.4", default-features = false }
2222
chacha20 = { version = "0.9", features = ["zeroize"] }
2323
cipher = "0.4"
24-
poly1305 = "0.7"
24+
poly1305 = { git = "https://github.com/str4d/universal-hashes", rev = "88eca39b494585b34d4021cefd588a9d59279357" }
2525
zeroize = { version = "1", default-features = false }
2626

2727
[dev-dependencies]

chacha20poly1305/src/cipher.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use aead::generic_array::GenericArray;
55
use aead::Error;
66
use core::convert::TryInto;
77
use poly1305::{
8-
universal_hash::{NewUniversalHash, UniversalHash},
8+
universal_hash::{KeyInit, UniversalHash},
99
Poly1305,
1010
};
1111
use zeroize::Zeroize;
@@ -64,7 +64,7 @@ where
6464
self.mac.update_padded(buffer);
6565

6666
self.authenticate_lengths(associated_data, buffer)?;
67-
Ok(self.mac.finalize().into_bytes())
67+
Ok(self.mac.finalize())
6868
}
6969

7070
/// Decrypt the given message, first authenticating ciphertext integrity
@@ -102,7 +102,7 @@ where
102102
let mut block = GenericArray::default();
103103
block[..8].copy_from_slice(&associated_data_len.to_le_bytes());
104104
block[8..].copy_from_slice(&buffer_len.to_le_bytes());
105-
self.mac.update(&block);
105+
self.mac.update(&[block]);
106106

107107
Ok(())
108108
}

0 commit comments

Comments
 (0)