diff options
author | Matt Johnston <matt@ucc.asn.au> | 2018-02-17 19:29:51 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2018-02-17 19:29:51 +0800 |
commit | 7e8094d53a1c01ac671156ff2e67157b64d01a3a (patch) | |
tree | c88345f5bdd118eb9414dff5ab5c307bb1806c57 /libtomcrypt/src/encauth/gcm/gcm_add_iv.c | |
parent | f7a664f127d3dfde0e7c7a9ca74b1d14f9a2f983 (diff) | |
parent | f042eb41ab0d31f8ba0c5ccc9c848ad01f08f986 (diff) |
merge from main
--HG--
branch : fuzz
Diffstat (limited to 'libtomcrypt/src/encauth/gcm/gcm_add_iv.c')
-rw-r--r-- | libtomcrypt/src/encauth/gcm/gcm_add_iv.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/libtomcrypt/src/encauth/gcm/gcm_add_iv.c b/libtomcrypt/src/encauth/gcm/gcm_add_iv.c index 0ac79b6..3fd3861 100644 --- a/libtomcrypt/src/encauth/gcm/gcm_add_iv.c +++ b/libtomcrypt/src/encauth/gcm/gcm_add_iv.c @@ -5,8 +5,6 @@ * * The library is free for all purposes without any express * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -24,7 +22,7 @@ @param IVlen The length of the IV @return CRYPT_OK on success */ -int gcm_add_iv(gcm_state *gcm, +int gcm_add_iv(gcm_state *gcm, const unsigned char *IV, unsigned long IVlen) { unsigned long x, y; @@ -39,7 +37,7 @@ int gcm_add_iv(gcm_state *gcm, if (gcm->mode != LTC_GCM_MODE_IV) { return CRYPT_INVALID_ARG; } - + if (gcm->buflen >= 16 || gcm->buflen < 0) { return CRYPT_INVALID_ARG; } @@ -59,7 +57,7 @@ int gcm_add_iv(gcm_state *gcm, if (gcm->buflen == 0) { for (x = 0; x < (IVlen & ~15); x += 16) { for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) { - *((LTC_FAST_TYPE*)(&gcm->X[y])) ^= *((LTC_FAST_TYPE*)(&IV[x + y])); + *(LTC_FAST_TYPE_PTR_CAST(&gcm->X[y])) ^= *(LTC_FAST_TYPE_PTR_CAST(&IV[x + y])); } gcm_mult_h(gcm, gcm->X); gcm->totlen += 128; @@ -72,7 +70,7 @@ int gcm_add_iv(gcm_state *gcm, for (; x < IVlen; x++) { gcm->buf[gcm->buflen++] = *IV++; - if (gcm->buflen == 16) { + if (gcm->buflen == 16) { /* GF mult it */ for (y = 0; y < 16; y++) { gcm->X[y] ^= gcm->buf[y]; @@ -87,8 +85,8 @@ int gcm_add_iv(gcm_state *gcm, } #endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ + +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ |