1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
2 /* SPDX-License-Identifier: Unlicense */
3 
4 /**
5    @file ocb_shift_xor.c
6    OCB implementation, internal function, by Tom St Denis
7 */
8 #include "tomcrypt_private.h"
9 
10 #ifdef LTC_OCB_MODE
11 
12 /**
13    Compute the shift/xor for OCB (internal function)
14    @param ocb  The OCB state
15    @param Z    The destination of the shift
16 */
ocb_shift_xor(ocb_state * ocb,unsigned char * Z)17 void ocb_shift_xor(ocb_state *ocb, unsigned char *Z)
18 {
19    int x, y;
20    y = ocb_ntz(ocb->block_index++);
21    for (x = 0; x < ocb->block_len; x++) {
22        ocb->Li[x] ^= ocb->Ls[y][x];
23        Z[x]        = ocb->Li[x] ^ ocb->R[x];
24    }
25 }
26 
27 #endif
28