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