@@ -9,11 +9,11 @@ use std::marker::PhantomData;
9
9
use std:: slice;
10
10
11
11
/// Parameters for AES-GCM.
12
- #[ derive( Debug , Clone , Copy ) ]
12
+ #[ derive( Debug ) ]
13
13
#[ repr( transparent) ]
14
14
pub struct GcmParams < ' a > {
15
15
inner : CK_GCM_PARAMS ,
16
- _marker : PhantomData < & ' a [ u8 ] > ,
16
+ _marker : PhantomData < & ' a mut [ u8 ] > ,
17
17
}
18
18
19
19
impl < ' a > GcmParams < ' a > {
@@ -36,7 +36,7 @@ impl<'a> GcmParams<'a> {
36
36
///
37
37
/// This function panics if the length of `iv` or `aad` does not
38
38
/// 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 {
40
40
// The ulIvBits parameter seems to be missing from the 2.40 spec,
41
41
// although it is included in the header file. In [1], OASIS clarified
42
42
// that the header file is normative. In 3.0, they added the parameter
@@ -55,7 +55,7 @@ impl<'a> GcmParams<'a> {
55
55
// [1]: https://www.oasis-open.org/committees/document.php?document_id=58032&wg_abbrev=pkcs11
56
56
GcmParams {
57
57
inner : CK_GCM_PARAMS {
58
- pIv : iv. as_ptr ( ) as * mut _ ,
58
+ pIv : iv. as_mut_ptr ( ) ,
59
59
ulIvLen : iv
60
60
. len ( )
61
61
. try_into ( )
@@ -73,9 +73,9 @@ impl<'a> GcmParams<'a> {
73
73
}
74
74
75
75
/// 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 _ ) }
79
79
}
80
80
81
81
/// The additional authenticated data.
0 commit comments