summaryrefslogtreecommitdiffhomepage
path: root/libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.c')
-rw-r--r--libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.c b/libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.c
index 7956142..8c6540f 100644
--- a/libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.c
+++ b/libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.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
*/
/**
@@ -57,6 +55,9 @@ int eax_decrypt_verify_memory(int cipher,
/* default to zero */
*stat = 0;
+ /* limit taglen */
+ taglen = MIN(taglen, MAXBLOCKSIZE);
+
/* allocate ram */
buf = XMALLOC(taglen);
eax = XMALLOC(sizeof(*eax));
@@ -77,17 +78,17 @@ int eax_decrypt_verify_memory(int cipher,
if ((err = eax_decrypt(eax, ct, pt, ctlen)) != CRYPT_OK) {
goto LBL_ERR;
}
-
+
buflen = taglen;
if ((err = eax_done(eax, buf, &buflen)) != CRYPT_OK) {
goto LBL_ERR;
}
/* compare tags */
- if (buflen >= taglen && XMEMCMP(buf, tag, taglen) == 0) {
+ if (buflen >= taglen && XMEM_NEQ(buf, tag, taglen) == 0) {
*stat = 1;
}
-
+
err = CRYPT_OK;
LBL_ERR:
#ifdef LTC_CLEAN_STACK
@@ -103,6 +104,6 @@ LBL_ERR:
#endif
-/* $Source$ */
-/* $Revision$ */
-/* $Date$ */
+/* ref: $Format:%D$ */
+/* git commit: $Format:%H$ */
+/* commit time: $Format:%ai$ */