]> pd.if.org Git - zpackage/blob - libtomcrypt/src/encauth/ccm/ccm_reset.c
commit files needed for zpm-fetchurl
[zpackage] / libtomcrypt / src / encauth / ccm / ccm_reset.c
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
2  *
3  * LibTomCrypt is a library that provides various cryptographic
4  * algorithms in a highly modular and flexible manner.
5  *
6  * The library is free for all purposes without any express
7  * guarantee it works.
8  */
9 #include "tomcrypt.h"
10
11 #ifdef LTC_CCM_MODE
12
13 /**
14   Reset a CCM state to as if you just called ccm_init().  This saves the initialization time.
15   @param ccm   The CCM state to reset
16   @return CRYPT_OK on success
17 */
18 int ccm_reset(ccm_state *ccm)
19 {
20    LTC_ARGCHK(ccm != NULL);
21    zeromem(ccm->PAD, sizeof(ccm->PAD));
22    zeromem(ccm->ctr, sizeof(ccm->ctr));
23    zeromem(ccm->CTRPAD, sizeof(ccm->CTRPAD));
24    ccm->CTRlen = 0;
25    ccm->current_ptlen = 0;
26    ccm->current_aadlen = 0;
27
28    return CRYPT_OK;
29 }
30
31 #endif
32
33 /* ref:         $Format:%D$ */
34 /* git commit:  $Format:%H$ */
35 /* commit time: $Format:%ai$ */