Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-lj committed Oct 24, 2024
1 parent 16f3420 commit e789702
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fastcrypto/src/aes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ pub type Aes256Gcm<NonceSize> = AesGcm<U32, aes::Aes256, NonceSize>;
pub struct Aes256GcmSiv(aes_gcm_siv::Aes256GcmSiv);

impl Aes256GcmSiv {
fn new(key: AesKey<U32>) -> Self {
pub fn new(key: AesKey<U32>) -> Self {
Aes256GcmSiv(aes_gcm_siv::Aes256GcmSiv::new(&key.bytes))
}
}
Expand Down
7 changes: 6 additions & 1 deletion fastcrypto/src/tests/aes_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use crate::aes::{AuthenticatedCipher, Cipher};
use crate::aes::{Aes256GcmSiv, AuthenticatedCipher, Cipher};
use crate::{
aes::{
Aes128CbcPkcs7, Aes128Ctr, Aes128Gcm, Aes192Ctr, Aes256CbcPkcs7, Aes256Ctr, Aes256Gcm,
Expand Down Expand Up @@ -69,6 +69,11 @@ fn test_aes256gcm_encrypt_and_decrypt() {
test_cipher::<U32, U12, _, _>(Aes256Gcm::<U12>::new);
}

#[test]
fn test_aes256gcm_siv_encrypt_and_decrypt() {
test_cipher::<U32, U12, _, _>(Aes256GcmSiv::new);
}

fn test_cipher<
KeySize: ArrayLength<u8> + Debug,
IvSize: ArrayLength<u8> + Debug,
Expand Down

0 comments on commit e789702

Please sign in to comment.