Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/libs/tomcrypt/src/encauth/gcm/gcm_reset.c
8796 views
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