@@ -9,11 +9,11 @@ use std::marker::PhantomData;
99use std:: slice;
1010
1111/// Parameters for AES-GCM.
12- #[ derive( Debug , Clone , Copy ) ]
12+ #[ derive( Debug ) ]
1313#[ repr( transparent) ]
1414pub struct GcmParams < ' a > {
1515 inner : CK_GCM_PARAMS ,
16- _marker : PhantomData < & ' a [ u8 ] > ,
16+ _marker : PhantomData < & ' a mut [ u8 ] > ,
1717}
1818
1919impl < ' a > GcmParams < ' a > {
@@ -36,7 +36,7 @@ impl<'a> GcmParams<'a> {
3636 ///
3737 /// This function panics if the length of `iv` or `aad` does not
3838 /// fit into an [Ulong].
39- pub fn new ( iv : & ' a [ u8 ] , aad : & ' a [ u8 ] , tag_bits : Ulong ) -> Self {
39+ pub fn new ( iv : & ' a mut [ u8 ] , aad : & ' a [ u8 ] , tag_bits : Ulong ) -> Self {
4040 // The ulIvBits parameter seems to be missing from the 2.40 spec,
4141 // although it is included in the header file. In [1], OASIS clarified
4242 // that the header file is normative. In 3.0, they added the parameter
@@ -55,7 +55,7 @@ impl<'a> GcmParams<'a> {
5555 // [1]: https://www.oasis-open.org/committees/document.php?document_id=58032&wg_abbrev=pkcs11
5656 GcmParams {
5757 inner : CK_GCM_PARAMS {
58- pIv : iv. as_ptr ( ) as * mut _ ,
58+ pIv : iv. as_mut_ptr ( ) ,
5959 ulIvLen : iv
6060 . len ( )
6161 . try_into ( )
@@ -73,9 +73,9 @@ impl<'a> GcmParams<'a> {
7373 }
7474
7575 /// The initialization vector.
76- pub fn iv ( & self ) -> & ' a [ u8 ] {
77- // SAFETY: In the constructor, the IV always comes from a &'a [u8]
78- unsafe { slice:: from_raw_parts ( self . inner . pIv , self . inner . ulIvLen as _ ) }
76+ pub fn iv ( & mut self ) -> & mut [ u8 ] {
77+ // SAFETY: In the constructor, the IV always comes from a &'a mut [u8]
78+ unsafe { slice:: from_raw_parts_mut ( self . inner . pIv , self . inner . ulIvLen as _ ) }
7979 }
8080
8181 /// The additional authenticated data.
0 commit comments