1
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
3
* LibTomCrypt is a library that provides various cryptographic
4
* algorithms in a highly modular and flexible manner.
6
* The library is free for all purposes without any express
9
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
12
/* OCB Implementation by Tom St Denis */
17
int ocb_done_decrypt(ocb_state *ocb,
18
const unsigned char *ct, unsigned long ctlen,
20
const unsigned char *tag, unsigned long taglen, int *res)
23
unsigned char *tagbuf;
24
unsigned long tagbuflen;
32
/* default to failed */
36
tagbuf = XMALLOC(MAXBLOCKSIZE);
41
tagbuflen = MAXBLOCKSIZE;
42
if ((err = __ocb_done(ocb, ct, ctlen, pt, tagbuf, &tagbuflen, 1)) != CRYPT_OK) {
46
if (taglen <= tagbuflen && memcmp(tagbuf, tag, taglen) == 0) {
53
zeromem(tagbuf, MAXBLOCKSIZE);