1 // SPDX-License-Identifier: BSD-2-Clause
2 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
3  *
4  * LibTomCrypt is a library that provides various cryptographic
5  * algorithms in a highly modular and flexible manner.
6  *
7  * The library is free for all purposes without any express
8  * guarantee it works.
9  */
10 
11 /**
12    @file ocb_shift_xor.c
13    OCB implementation, internal function, by Tom St Denis
14 */
15 #include "tomcrypt_private.h"
16 
17 #ifdef LTC_OCB_MODE
18 
19 /**
20    Compute the shift/xor for OCB (internal function)
21    @param ocb  The OCB state
22    @param Z    The destination of the shift
23 */
ocb_shift_xor(ocb_state * ocb,unsigned char * Z)24 void ocb_shift_xor(ocb_state *ocb, unsigned char *Z)
25 {
26    int x, y;
27    y = ocb_ntz(ocb->block_index++);
28    for (x = 0; x < ocb->block_len; x++) {
29        ocb->Li[x] ^= ocb->Ls[y][x];
30        Z[x]        = ocb->Li[x] ^ ocb->R[x];
31    }
32 }
33 
34 #endif
35 
36 /* ref:         $Format:%D$ */
37 /* git commit:  $Format:%H$ */
38 /* commit time: $Format:%ai$ */
39