tomcrypt/src/encauth/ocb/ocb_shift_xor.c

40 lines
890 B
C
Raw Normal View History

2004-01-25 17:40:34 +00:00
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
2004-05-12 20:42:16 +00:00
* guarantee it works.
2004-01-25 17:40:34 +00:00
*
2007-07-20 17:48:02 +00:00
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
2004-01-25 17:40:34 +00:00
*/
2004-05-12 20:42:16 +00:00
2015-12-20 17:05:58 +01:00
/**
2004-12-30 23:55:53 +00:00
@file ocb_shift_xor.c
OCB implementation, internal function, by Tom St Denis
*/
#include "tomcrypt.h"
2003-03-03 00:59:24 +00:00
2007-07-20 17:48:02 +00:00
#ifdef LTC_OCB_MODE
2003-03-03 00:59:24 +00:00
2004-12-30 23:55:53 +00:00
/**
Compute the shift/xor for OCB (internal function)
2015-12-20 17:05:58 +01:00
@param ocb The OCB state
2004-12-30 23:55:53 +00:00
@param Z The destination of the shift
*/
2004-05-12 20:42:16 +00:00
void ocb_shift_xor(ocb_state *ocb, unsigned char *Z)
2003-03-03 00:59:24 +00:00
{
2004-05-12 20:42:16 +00:00
int x, y;
y = ocb_ntz(ocb->block_index++);
for (x = 0; x < ocb->block_len; x++) {
ocb->Li[x] ^= ocb->Ls[y][x];
Z[x] = ocb->Li[x] ^ ocb->R[x];
}
2003-03-03 00:59:24 +00:00
}
2004-05-12 20:42:16 +00:00
#endif
2005-06-09 00:08:13 +00:00
/* $Source$ */
/* $Revision$ */
/* $Date$ */