1919//!
2020//! use dndk_gcm::{
2121//! aead::{Aead, AeadCore, Key, KeyInit},
22- //! DndkGcm24, Nonce24
22+ //! DndkGcm, Nonce
2323//! };
2424//!
25- //! let key = Key::<DndkGcm24 >::from_slice(&[0u8; 32]);
26- //! let cipher = DndkGcm24 ::new(key);
27- //! let nonce = Nonce24 ::from_slice(&[0u8; 24]); // 192-bits; MUST be unique per message
25+ //! let key = Key::<DndkGcm >::from_slice(&[0u8; 32]);
26+ //! let cipher = DndkGcm ::new(key);
27+ //! let nonce = Nonce ::from_slice(&[0u8; 24]); // 192-bits; MUST be unique per message
2828//! let ciphertext = cipher.encrypt(nonce, b"plaintext message".as_ref())?;
2929//! let plaintext = cipher.decrypt(nonce, ciphertext.as_ref())?;
3030//! assert_eq!(&plaintext, b"plaintext message");
@@ -46,14 +46,14 @@ use cipher::{BlockCipherEncrypt, BlockSizeUser, consts::U12};
4646
4747/// DNDK-GCM with a 24-byte nonce (KC_Choice = 0).
4848#[ derive( Clone ) ]
49- pub struct DndkGcm24 {
49+ pub struct DndkGcm {
5050 aes : Aes256 ,
5151}
5252
5353type KeySize = <Aes256Gcm as KeySizeUser >:: KeySize ;
5454
5555/// DNDK-GCM nonce (24 bytes).
56- pub type Nonce24 = aes_gcm:: Nonce < cipher:: consts:: U24 > ;
56+ pub type Nonce = aes_gcm:: Nonce < cipher:: consts:: U24 > ;
5757
5858/// DNDK-GCM key.
5959pub type Key < B = Aes256 > = aes_gcm:: Key < B > ;
@@ -70,26 +70,26 @@ pub const A_MAX: u64 = (1 << 61) - 1;
7070/// Maximum length of ciphertext.
7171pub const C_MAX : u64 = ( 1 << 36 ) - 32 ;
7272
73- impl AeadCore for DndkGcm24 {
73+ impl AeadCore for DndkGcm {
7474 type NonceSize = cipher:: consts:: U24 ;
7575 type TagSize = <Aes256Gcm as AeadCore >:: TagSize ;
7676 const TAG_POSITION : TagPosition = TagPosition :: Postfix ;
7777}
7878
79- impl KeySizeUser for DndkGcm24 {
79+ impl KeySizeUser for DndkGcm {
8080 type KeySize = KeySize ;
8181}
8282
83- impl KeyInit for DndkGcm24 {
83+ impl KeyInit for DndkGcm {
8484 fn new ( key : & Key ) -> Self {
8585 Self { aes : Aes256 :: new ( key) }
8686 }
8787}
8888
89- impl AeadInOut for DndkGcm24 {
89+ impl AeadInOut for DndkGcm {
9090 fn encrypt_inout_detached (
9191 & self ,
92- nonce : & Nonce24 ,
92+ nonce : & Nonce ,
9393 associated_data : & [ u8 ] ,
9494 buffer : InOutBuf < ' _ , ' _ , u8 > ,
9595 ) -> Result < Tag , Error > {
@@ -103,7 +103,7 @@ impl AeadInOut for DndkGcm24 {
103103
104104 fn decrypt_inout_detached (
105105 & self ,
106- nonce : & Nonce24 ,
106+ nonce : & Nonce ,
107107 associated_data : & [ u8 ] ,
108108 buffer : InOutBuf < ' _ , ' _ , u8 > ,
109109 tag : & Tag ,
0 commit comments