1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
2 /* SPDX-License-Identifier: Unlicense */
3 #include "tomcrypt_private.h"
4 
5 /**
6    @file lrw_done.c
7    LRW_MODE implementation, Free resources, Tom St Denis
8 */
9 
10 #ifdef LTC_LRW_MODE
11 
12 /**
13   Terminate a LRW state
14   @param lrw   The state to terminate
15   @return CRYPT_OK if successful
16 */
lrw_done(symmetric_LRW * lrw)17 int lrw_done(symmetric_LRW *lrw)
18 {
19    int err;
20 
21    LTC_ARGCHK(lrw != NULL);
22 
23    if ((err = cipher_is_valid(lrw->cipher)) != CRYPT_OK) {
24       return err;
25    }
26    cipher_descriptor[lrw->cipher]->done(&lrw->key);
27 
28    return CRYPT_OK;
29 }
30 
31 #endif
32