@@ -524,9 +524,9 @@ impl AeadCore for Aes128Ccm {
524524#[ cfg( all( aes_ccm, feature = "aead" ) ) ]
525525impl KeyInit for Aes128Ccm {
526526 fn new ( key : & aead:: Key < Self > ) -> Self {
527- let mut k = [ 0u8 ; 16 ] ;
528- k . copy_from_slice ( key. as_ref ( ) ) ;
529- Aes128Ccm { key : k }
527+ let mut out = Aes128Ccm { key : [ 0u8 ; 16 ] } ;
528+ out . key . copy_from_slice ( key. as_ref ( ) ) ;
529+ out
530530 }
531531}
532532
@@ -576,9 +576,9 @@ impl AeadCore for Aes192Ccm {
576576#[ cfg( all( aes_ccm, feature = "aead" ) ) ]
577577impl KeyInit for Aes192Ccm {
578578 fn new ( key : & aead:: Key < Self > ) -> Self {
579- let mut k = [ 0u8 ; 24 ] ;
580- k . copy_from_slice ( key. as_ref ( ) ) ;
581- Aes192Ccm { key : k }
579+ let mut out = Aes192Ccm { key : [ 0u8 ; 24 ] } ;
580+ out . key . copy_from_slice ( key. as_ref ( ) ) ;
581+ out
582582 }
583583}
584584
@@ -628,9 +628,9 @@ impl AeadCore for Aes256Ccm {
628628#[ cfg( all( aes_ccm, feature = "aead" ) ) ]
629629impl KeyInit for Aes256Ccm {
630630 fn new ( key : & aead:: Key < Self > ) -> Self {
631- let mut k = [ 0u8 ; 32 ] ;
632- k . copy_from_slice ( key. as_ref ( ) ) ;
633- Aes256Ccm { key : k }
631+ let mut out = Aes256Ccm { key : [ 0u8 ; 32 ] } ;
632+ out . key . copy_from_slice ( key. as_ref ( ) ) ;
633+ out
634634 }
635635}
636636
@@ -1740,9 +1740,9 @@ impl AeadCore for Aes128Gcm {
17401740#[ cfg( all( aes_gcm, feature = "aead" ) ) ]
17411741impl KeyInit for Aes128Gcm {
17421742 fn new ( key : & aead:: Key < Self > ) -> Self {
1743- let mut k = [ 0u8 ; 16 ] ;
1744- k . copy_from_slice ( key. as_ref ( ) ) ;
1745- Aes128Gcm { key : k }
1743+ let mut out = Aes128Gcm { key : [ 0u8 ; 16 ] } ;
1744+ out . key . copy_from_slice ( key. as_ref ( ) ) ;
1745+ out
17461746 }
17471747}
17481748
@@ -1792,9 +1792,9 @@ impl AeadCore for Aes192Gcm {
17921792#[ cfg( all( aes_gcm, feature = "aead" ) ) ]
17931793impl KeyInit for Aes192Gcm {
17941794 fn new ( key : & aead:: Key < Self > ) -> Self {
1795- let mut k = [ 0u8 ; 24 ] ;
1796- k . copy_from_slice ( key. as_ref ( ) ) ;
1797- Aes192Gcm { key : k }
1795+ let mut out = Aes192Gcm { key : [ 0u8 ; 24 ] } ;
1796+ out . key . copy_from_slice ( key. as_ref ( ) ) ;
1797+ out
17981798 }
17991799}
18001800
@@ -1844,9 +1844,9 @@ impl AeadCore for Aes256Gcm {
18441844#[ cfg( all( aes_gcm, feature = "aead" ) ) ]
18451845impl KeyInit for Aes256Gcm {
18461846 fn new ( key : & aead:: Key < Self > ) -> Self {
1847- let mut k = [ 0u8 ; 32 ] ;
1848- k . copy_from_slice ( key. as_ref ( ) ) ;
1849- Aes256Gcm { key : k }
1847+ let mut out = Aes256Gcm { key : [ 0u8 ; 32 ] } ;
1848+ out . key . copy_from_slice ( key. as_ref ( ) ) ;
1849+ out
18501850 }
18511851}
18521852
0 commit comments