Path: blob/master/libs/tomcrypt/src/encauth/gcm/gcm_reset.c
8796 views
/* LibTomCrypt, modular cryptographic library -- Tom St Denis1*2* LibTomCrypt is a library that provides various cryptographic3* algorithms in a highly modular and flexible manner.4*5* The library is free for all purposes without any express6* guarantee it works.7*/89/**10@file gcm_reset.c11GCM implementation, reset a used state so it can accept IV data, by Tom St Denis12*/13#include "tomcrypt.h"1415#ifdef LTC_GCM_MODE1617/**18Reset a GCM state to as if you just called gcm_init(). This saves the initialization time.19@param gcm The GCM state to reset20@return CRYPT_OK on success21*/22int gcm_reset(gcm_state *gcm)23{24LTC_ARGCHK(gcm != NULL);2526zeromem(gcm->buf, sizeof(gcm->buf));27zeromem(gcm->X, sizeof(gcm->X));28gcm->mode = LTC_GCM_MODE_IV;29gcm->ivmode = 0;30gcm->buflen = 0;31gcm->totlen = 0;32gcm->pttotlen = 0;3334return CRYPT_OK;35}3637#endif383940