Skip to content

Commit

Permalink
chore: update aes to 0.8 (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
nc7s authored Jul 13, 2024
1 parent 131c07d commit 7ba2ae8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ default = [
"v4_local",
"v4_public",
]
aes = ["dep:aes", "dep:ctr"]

[lib]
doctest = true
Expand All @@ -59,7 +60,8 @@ serde_json = { version = "^1.0.68", optional = true }
thiserror = "1.0.29"
iso8601 = "0.6.1"
erased-serde = { version = "0.4.5", optional = true }
aes = { version = "0.7.5", features = ["ctr"], optional = true }
aes = { version = "0.8.4", optional = true }
ctr = { version = "0.9.2", optional = true }
hmac = { version = "0.12.1", optional = true }
sha2 = { version = "0.10.2", optional = true }
zeroize = { version = "1.4.3", features = ["zeroize_derive"] }
Expand Down
7 changes: 4 additions & 3 deletions src/core/common/cipher_text_impl/v1_local.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#![cfg(feature = "v1_local")]
use std::marker::PhantomData;
use aes::Aes256Ctr;
use aes::cipher::generic_array::GenericArray;
use aes::cipher::{NewCipher, StreamCipher};
use aes::cipher::{KeyIvInit, StreamCipher};
use crate::core::common::cipher_text::CipherText;
use crate::core::{Local, V1};
use crate::core::common::EncryptionKey;

type Aes256Ctr = ctr::Ctr64BE<aes::Aes256>;

impl CipherText<V1, Local> {
pub(crate) fn from(payload: &[u8], encryption_key: &EncryptionKey<V1, Local>) -> Self {
let key = GenericArray::from_slice(encryption_key.as_ref());
Expand All @@ -24,4 +25,4 @@ impl CipherText<V1, Local> {
purpose: PhantomData,
}
}
}
}
6 changes: 4 additions & 2 deletions src/core/common/cipher_text_impl/v3_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
use std::marker::PhantomData;
use aes::Aes256Ctr;

Check failure on line 3 in src/core/common/cipher_text_impl/v3_local.rs

View workflow job for this annotation

GitHub Actions / Clippy (v3_local)

unresolved import `aes::Aes256Ctr`

Check failure on line 3 in src/core/common/cipher_text_impl/v3_local.rs

View workflow job for this annotation

GitHub Actions / Test Suite (v3_local)

unresolved import `aes::Aes256Ctr`
use aes::cipher::generic_array::GenericArray;
use aes::cipher::{NewCipher, StreamCipher};
use aes::cipher::{KeyIvInit, StreamCipher};
use crate::core::common::{CipherText, EncryptionKey};
use crate::core::{Local, V3};

type Aes256Ctr = ctr::Ctr64BE<aes::Aes256>;

impl CipherText<V3, Local> {
pub(crate) fn from(payload: &[u8], encryption_key: &EncryptionKey<V3, Local>) -> Self {
let key = GenericArray::from_slice(encryption_key.as_ref());
Expand All @@ -23,4 +25,4 @@ impl CipherText<V3, Local> {
purpose: PhantomData,
}
}
}
}

0 comments on commit 7ba2ae8

Please sign in to comment.