]> pd.if.org Git - zpackage/blob - libtomcrypt/src/encauth/gcm/gcm_reset.c
commit files needed for zpm-fetchurl
[zpackage] / libtomcrypt / src / encauth / gcm / gcm_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
10 /**
11    @file gcm_reset.c
12    GCM implementation, reset a used state so it can accept IV data, by Tom St Denis
13 */
14 #include "tomcrypt.h"
15
16 #ifdef LTC_GCM_MODE
17
18 /**
19   Reset a GCM state to as if you just called gcm_init().  This saves the initialization time.
20   @param gcm   The GCM state to reset
21   @return CRYPT_OK on success
22 */
23 int gcm_reset(gcm_state *gcm)
24 {
25    LTC_ARGCHK(gcm != NULL);
26
27    zeromem(gcm->buf, sizeof(gcm->buf));
28    zeromem(gcm->X,   sizeof(gcm->X));
29    gcm->mode     = LTC_GCM_MODE_IV;
30    gcm->ivmode   = 0;
31    gcm->buflen   = 0;
32    gcm->totlen   = 0;
33    gcm->pttotlen = 0;
34
35    return CRYPT_OK;
36 }
37
38 #endif
39
40 /* ref:         $Format:%D$ */
41 /* git commit:  $Format:%H$ */
42 /* commit time: $Format:%ai$ */