xref: /optee_os/core/lib/libtomcrypt/src/modes/cfb/cfb_done.c (revision 8411e6ad673d20c4742ed30c785e3f5cdea54dfa)
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
2 /* SPDX-License-Identifier: Unlicense */
3 #include "tomcrypt_private.h"
4 
5 /**
6    @file cfb_done.c
7    CFB implementation, finish chain, Tom St Denis
8 */
9 
10 #ifdef LTC_CFB_MODE
11 
12 /** Terminate the chain
13   @param cfb    The CFB chain to terminate
14   @return CRYPT_OK on success
15 */
cfb_done(symmetric_CFB * cfb)16 int cfb_done(symmetric_CFB *cfb)
17 {
18    int err;
19    LTC_ARGCHK(cfb != NULL);
20 
21    if ((err = cipher_is_valid(cfb->cipher)) != CRYPT_OK) {
22       return err;
23    }
24    cipher_descriptor[cfb->cipher]->done(&cfb->key);
25    return CRYPT_OK;
26 }
27 
28 
29 
30 #endif
31