@@ -35,11 +35,9 @@ impl AeadInOut for Aegis128X2<16> {
3535 & self ,
3636 nonce : & Nonce < Self > ,
3737 associated_data : & [ u8 ] ,
38- mut buffer : InOutBuf < ' _ , ' _ , u8 > ,
38+ buffer : InOutBuf < ' _ , ' _ , u8 > ,
3939 ) -> Result < Tag < Self > > {
40- let input = buffer. get_in ( ) . to_vec ( ) ;
41- let output = buffer. get_out ( ) ;
42- output. copy_from_slice ( & input) ;
40+ let output = buffer. into_out_with_copied_in ( ) ;
4341 let state = aegis128x2:: Aegis128X2 :: < 16 > :: new ( self . key . as_ref ( ) , nonce. as_ref ( ) ) ;
4442 let tag = state. encrypt_in_place ( output, associated_data) ;
4543 Ok ( tag. into ( ) )
@@ -49,12 +47,10 @@ impl AeadInOut for Aegis128X2<16> {
4947 & self ,
5048 nonce : & Nonce < Self > ,
5149 associated_data : & [ u8 ] ,
52- mut buffer : InOutBuf < ' _ , ' _ , u8 > ,
50+ buffer : InOutBuf < ' _ , ' _ , u8 > ,
5351 tag : & Tag < Self > ,
5452 ) -> Result < ( ) > {
55- let input = buffer. get_in ( ) . to_vec ( ) ;
56- let output = buffer. get_out ( ) ;
57- output. copy_from_slice ( & input) ;
53+ let output = buffer. into_out_with_copied_in ( ) ;
5854 let state = aegis128x2:: Aegis128X2 :: < 16 > :: new ( self . key . as_ref ( ) , nonce. as_ref ( ) ) ;
5955 state
6056 . decrypt_in_place ( output, tag. as_ref ( ) , associated_data)
@@ -67,11 +63,9 @@ impl AeadInOut for Aegis128X2<32> {
6763 & self ,
6864 nonce : & Nonce < Self > ,
6965 associated_data : & [ u8 ] ,
70- mut buffer : InOutBuf < ' _ , ' _ , u8 > ,
66+ buffer : InOutBuf < ' _ , ' _ , u8 > ,
7167 ) -> Result < Tag < Self > > {
72- let input = buffer. get_in ( ) . to_vec ( ) ;
73- let output = buffer. get_out ( ) ;
74- output. copy_from_slice ( & input) ;
68+ let output = buffer. into_out_with_copied_in ( ) ;
7569 let state = aegis128x2:: Aegis128X2 :: < 32 > :: new ( self . key . as_ref ( ) , nonce. as_ref ( ) ) ;
7670 let tag = state. encrypt_in_place ( output, associated_data) ;
7771 Ok ( tag. into ( ) )
@@ -81,12 +75,10 @@ impl AeadInOut for Aegis128X2<32> {
8175 & self ,
8276 nonce : & Nonce < Self > ,
8377 associated_data : & [ u8 ] ,
84- mut buffer : InOutBuf < ' _ , ' _ , u8 > ,
78+ buffer : InOutBuf < ' _ , ' _ , u8 > ,
8579 tag : & Tag < Self > ,
8680 ) -> Result < ( ) > {
87- let input = buffer. get_in ( ) . to_vec ( ) ;
88- let output = buffer. get_out ( ) ;
89- output. copy_from_slice ( & input) ;
81+ let output = buffer. into_out_with_copied_in ( ) ;
9082 let state = aegis128x2:: Aegis128X2 :: < 32 > :: new ( self . key . as_ref ( ) , nonce. as_ref ( ) ) ;
9183 state
9284 . decrypt_in_place ( output, tag. as_ref ( ) , associated_data)
0 commit comments