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 #ifdef LTC_CCM_MODE
13 
14 /**
15   Reset a CCM state to as if you just called ccm_init().  This saves the initialization time.
16   @param ccm   The CCM state to reset
17   @return CRYPT_OK on success
18 */
ccm_reset(ccm_state * ccm)19 int ccm_reset(ccm_state *ccm)
20 {
21    LTC_ARGCHK(ccm != NULL);
22    zeromem(ccm->PAD, sizeof(ccm->PAD));
23    zeromem(ccm->ctr, sizeof(ccm->ctr));
24    zeromem(ccm->CTRPAD, sizeof(ccm->CTRPAD));
25    ccm->CTRlen = 0;
26    ccm->current_ptlen = 0;
27    ccm->current_aadlen = 0;
28 
29    return CRYPT_OK;
30 }
31 
32 #endif
33 
34 /* ref:         $Format:%D$ */
35 /* git commit:  $Format:%H$ */
36 /* commit time: $Format:%ai$ */
37