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 new prerelease dependencies; fix hybrid-array deprecations #617

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 40 additions & 37 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,3 @@ members = [
"ocb3",
]
resolver = "2"

[patch.crates-io]
# https://github.com/RustCrypto/MACs/pull/158
cmac = { git = "https://github.com/RustCrypto/MACs.git" }
pmac = { git = "https://github.com/RustCrypto/MACs.git" }

# https://github.com/RustCrypto/stream-ciphers/pull/345
chacha20 = { git = "https://github.com/RustCrypto/stream-ciphers.git" }
12 changes: 6 additions & 6 deletions aes-gcm-siv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ categories = ["cryptography", "no-std"]
rust-version = "1.65"

[dependencies]
aead = { version = "=0.6.0-pre.0", default-features = false }
aes = { version = "=0.9.0-pre", optional = true }
cipher = "=0.5.0-pre.4"
ctr = "=0.10.0-pre.0"
polyval = { version = "=0.7.0-pre.0", default-features = false }
aead = { version = "0.6.0-rc.0", default-features = false }
aes = { version = "=0.9.0-pre.1", optional = true }
cipher = "=0.5.0-pre.6"
ctr = "=0.10.0-pre.1"
polyval = { version = "0.7.0-rc.0", default-features = false }
subtle = { version = "2", default-features = false }
zeroize = { version = "1", default-features = false }

[dev-dependencies]
aead = { version = "=0.6.0-pre.0", features = ["dev"], default-features = false }
aead = { version = "0.6.0-rc.0", features = ["dev"], default-features = false }

[features]
default = ["aes", "alloc", "getrandom"]
Expand Down
24 changes: 12 additions & 12 deletions aes-gcm-siv/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ macro_rules! tests {
#[test]
fn encrypt() {
for vector in $vectors {
let key = Array::from_slice(vector.key);
let nonce = Array::from_slice(vector.nonce);
let key = Array(*vector.key);
let nonce = Array(*vector.nonce);
let payload = Payload {
msg: vector.plaintext,
aad: vector.aad,
};

let cipher = <$aead>::new(key);
let ciphertext = cipher.encrypt(nonce, payload).unwrap();
let cipher = <$aead>::new(&key);
let ciphertext = cipher.encrypt(&nonce, payload).unwrap();

assert_eq!(vector.ciphertext, ciphertext.as_slice());
}
Expand All @@ -33,16 +33,16 @@ macro_rules! tests {
#[test]
fn decrypt() {
for vector in $vectors {
let key = Array::from_slice(vector.key);
let nonce = Array::from_slice(vector.nonce);
let key = Array(*vector.key);
let nonce = Array(*vector.nonce);

let payload = Payload {
msg: vector.ciphertext,
aad: vector.aad,
};

let cipher = <$aead>::new(key);
let plaintext = cipher.decrypt(nonce, payload).unwrap();
let cipher = <$aead>::new(&key);
let plaintext = cipher.decrypt(&nonce, payload).unwrap();

assert_eq!(vector.plaintext, plaintext.as_slice());
}
Expand All @@ -51,8 +51,8 @@ macro_rules! tests {
#[test]
fn decrypt_modified() {
let vector = &$vectors[1];
let key = Array::from_slice(vector.key);
let nonce = Array::from_slice(vector.nonce);
let key = Array(*vector.key);
let nonce = Array(*vector.nonce);

let mut ciphertext = Vec::from(vector.ciphertext);

Expand All @@ -64,8 +64,8 @@ macro_rules! tests {
aad: vector.aad,
};

let cipher = <$aead>::new(key);
assert!(cipher.decrypt(nonce, payload).is_err());
let cipher = <$aead>::new(&key);
assert!(cipher.decrypt(&nonce, payload).is_err());

// TODO(tarcieri): test ciphertext is unmodified in in-place API
}
Expand Down
12 changes: 6 additions & 6 deletions aes-gcm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ categories = ["cryptography", "no-std"]
rust-version = "1.65"

[dependencies]
aead = { version = "=0.6.0-pre.0", default-features = false }
aes = { version = "=0.9.0-pre", optional = true }
cipher = "=0.5.0-pre.4"
ctr = "=0.10.0-pre.0"
ghash = { version = "=0.6.0-pre.0", default-features = false }
aead = { version = "0.6.0-rc.0", default-features = false }
aes = { version = "=0.9.0-pre.1", optional = true }
cipher = "=0.5.0-pre.6"
ctr = "=0.10.0-pre.1"
ghash = { version = "0.6.0-rc.0", default-features = false }
subtle = { version = "2", default-features = false }
zeroize = { version = "1", optional = true, default-features = false }

[dev-dependencies]
aead = { version = "=0.6.0-pre.0", features = ["dev"], default-features = false }
aead = { version = "0.6.0-rc.0", features = ["dev"], default-features = false }
hex-literal = "0.4"

[features]
Expand Down
2 changes: 1 addition & 1 deletion aes-gcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ where
ctr.apply_keystream_partial(buffer.into());

let full_tag = self.compute_tag(mask, associated_data, buffer);
Ok(Tag::clone_from_slice(&full_tag[..TagSize::to_usize()]))
Ok(Tag::try_from(&full_tag[..TagSize::to_usize()]).expect("tag size mismatch"))
}

fn decrypt_in_place_detached(
Expand Down
Loading
Loading