1 // SPDX-License-Identifier: BSD-2-Clause
2 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
3  *
4  * LibTomCrypt is a library that provides various cryptographic
5  * algorithms in a highly modular and flexible manner.
6  *
7  * The library is free for all purposes without any express
8  * guarantee it works.
9  */
10 #include "tomcrypt_private.h"
11 
12 /**
13    @file lrw_done.c
14    LRW_MODE implementation, Free resources, Tom St Denis
15 */
16 
17 #ifdef LTC_LRW_MODE
18 
19 /**
20   Terminate a LRW state
21   @param lrw   The state to terminate
22   @return CRYPT_OK if successful
23 */
lrw_done(symmetric_LRW * lrw)24 int lrw_done(symmetric_LRW *lrw)
25 {
26    int err;
27 
28    LTC_ARGCHK(lrw != NULL);
29 
30    if ((err = cipher_is_valid(lrw->cipher)) != CRYPT_OK) {
31       return err;
32    }
33    cipher_descriptor[lrw->cipher]->done(&lrw->key);
34 
35    return CRYPT_OK;
36 }
37 
38 #endif
39 /* ref:         $Format:%D$ */
40 /* git commit:  $Format:%H$ */
41 /* commit time: $Format:%ai$ */
42