Mercurial > dropbear
diff libtomcrypt/src/encauth/gcm/gcm_done.c @ 1511:5916af64acd4 fuzz
merge from main
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 17 Feb 2018 19:29:51 +0800 |
parents | 6dba84798cd5 |
children |
line wrap: on
line diff
--- a/libtomcrypt/src/encauth/gcm/gcm_done.c Tue Jan 23 23:27:40 2018 +0800 +++ b/libtomcrypt/src/encauth/gcm/gcm_done.c Sat Feb 17 19:29:51 2018 +0800 @@ -5,8 +5,6 @@ * * The library is free for all purposes without any express * guarantee it works. - * - * Tom St Denis, [email protected], http://libtom.org */ /** @@ -24,7 +22,7 @@ @param taglen [in/out] The length of the MAC tag @return CRYPT_OK on success */ -int gcm_done(gcm_state *gcm, +int gcm_done(gcm_state *gcm, unsigned char *tag, unsigned long *taglen) { unsigned long x; @@ -42,6 +40,15 @@ return err; } + if (gcm->mode == LTC_GCM_MODE_IV) { + /* let's process the IV */ + if ((err = gcm_add_aad(gcm, NULL, 0)) != CRYPT_OK) return err; + } + + if (gcm->mode == LTC_GCM_MODE_AAD) { + /* let's process the AAD */ + if ((err = gcm_process(gcm, NULL, 0, NULL, 0)) != CRYPT_OK) return err; + } if (gcm->mode != LTC_GCM_MODE_TEXT) { return CRYPT_INVALID_ARG; @@ -78,6 +85,6 @@ #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */