@@ -63,7 +63,7 @@ impl StreamingEncryptingKey {
63
63
context : EncryptionContext ,
64
64
) -> Result < Self , Unspecified > {
65
65
let algorithm = key. algorithm ( ) ;
66
- let cipher_ctx = LcPtr :: new ( unsafe { EVP_CIPHER_CTX_new ( ) } ) ?;
66
+ let mut cipher_ctx = LcPtr :: new ( unsafe { EVP_CIPHER_CTX_new ( ) } ) ?;
67
67
let cipher = mode. evp_cipher ( key. algorithm ) ;
68
68
let key_bytes = key. key_bytes . as_ref ( ) ;
69
69
debug_assert_eq ! (
@@ -100,11 +100,11 @@ impl StreamingEncryptingKey {
100
100
/// potentially writing bytes of ciphertext to `output`.
101
101
///
102
102
/// The number of bytes written to `output` can be up to `input.len()`
103
- /// plus the block length of the algorithm (e.g., 16 bytes for AES ).
103
+ /// plus the block length of the algorithm (e.g., [`Algorithm::block_len`] ).
104
104
///
105
105
/// # Errors
106
106
/// * May return an error if the `output` buffer is smaller than the length of
107
- /// the `input` plus the algorithm's block length. Certain cipher modes
107
+ /// the `input` plus the algorithm's block length (e.g. [`Algorithm::block_len`]) . Certain cipher modes
108
108
/// (such as CTR) may allow the output buffer to be as small as the size
109
109
/// of the input in certain circumstances.
110
110
/// * Returns an error if the length of either `input` or `output` is larger
@@ -135,15 +135,15 @@ impl StreamingEncryptingKey {
135
135
/// `output`.
136
136
///
137
137
/// The number of bytes written to `output` can be up to the block length of
138
- /// the algorithm (e.g., 16 bytes for AES) .
138
+ /// [`Algorithm::block_len`] .
139
139
///
140
140
/// # Errors
141
141
/// * May return an error if the `output` buffer is smaller than the algorithm's
142
142
/// block length. Certain cipher mode (such as CTR) may allow the output
143
143
/// buffer to only be large enough to fit the remainder of the ciphertext.
144
144
/// * Returns an error if the length of `output` is larger than `i32::MAX`.
145
145
pub fn finish (
146
- self ,
146
+ mut self ,
147
147
output : & mut [ u8 ] ,
148
148
) -> Result < ( DecryptionContext , BufferUpdate ) , Unspecified > {
149
149
let mut outlen: i32 = output. len ( ) . try_into ( ) ?;
@@ -240,7 +240,7 @@ impl StreamingDecryptingKey {
240
240
mode : OperatingMode ,
241
241
context : DecryptionContext ,
242
242
) -> Result < Self , Unspecified > {
243
- let cipher_ctx = LcPtr :: new ( unsafe { EVP_CIPHER_CTX_new ( ) } ) ?;
243
+ let mut cipher_ctx = LcPtr :: new ( unsafe { EVP_CIPHER_CTX_new ( ) } ) ?;
244
244
let algorithm = key. algorithm ( ) ;
245
245
let cipher = mode. evp_cipher ( key. algorithm ) ;
246
246
let key_bytes = key. key_bytes . as_ref ( ) ;
@@ -276,7 +276,7 @@ impl StreamingDecryptingKey {
276
276
/// Updates the internal state of the key with the provided ciphertext `input`,
277
277
/// potentially also writing bytes of plaintext to `output`.
278
278
/// The number of bytes written to `output` can be up to `input.len()`
279
- /// plus the block length of the cipher algorithm (e.g., 16 bytes for AES ).
279
+ /// plus the block length of the cipher algorithm (e.g., [`Algorithm::block_len`] ).
280
280
///
281
281
/// # Errors
282
282
/// * May return an error if the `output` buffer is smaller than the length of
@@ -310,7 +310,7 @@ impl StreamingDecryptingKey {
310
310
/// Finishes the decryption operation, writing the remaining plaintext to
311
311
/// `output`.
312
312
/// The number of bytes written to `output` can be up to the block length of
313
- /// the cipher algorithm (e.g., 16 bytes for AES ).
313
+ /// the cipher algorithm (e.g., [`Algorithm::block_len`] ).
314
314
///
315
315
/// # Errors
316
316
/// * May return an error if the `output` buffer is smaller than the algorithm's
0 commit comments