Skip to content

Commit ef92114

Browse files
Rust wrapper: cmac: consume CMAC in finalize()
1 parent bfa04ca commit ef92114

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • wrapper/rust/wolfssl/src/wolfcrypt

wrapper/rust/wolfssl/src/wolfcrypt/cmac.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ impl CMAC {
203203

204204
/// Generate the final Cipher-based Message Authentication Code result.
205205
///
206+
/// This function consumes the `CMAC` object since no further operations
207+
/// can be performed with it.
208+
///
206209
/// # Parameters
207210
///
208211
/// * `dout`: Output buffer where CMAC is written.
@@ -229,7 +232,7 @@ impl CMAC {
229232
/// let mut finalize_out = [0u8; 16];
230233
/// cmac.finalize(&mut finalize_out).expect("Error with finalize()");
231234
/// ```
232-
pub fn finalize(&mut self, dout: &mut [u8]) -> Result<(), i32> {
235+
pub fn finalize(mut self, dout: &mut [u8]) -> Result<(), i32> {
233236
let mut dout_size = dout.len() as u32;
234237
let rc = unsafe {
235238
ws::wc_CmacFinalNoFree(&mut self.ws_cmac,

0 commit comments

Comments
 (0)