1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
2 /* SPDX-License-Identifier: Unlicense */
3 #include "tomcrypt_private.h"
4 
5 /**
6    @file pmac_shift_xor.c
7    PMAC implementation, internal function, by Tom St Denis
8 */
9 
10 #ifdef LTC_PMAC
11 
12 /**
13   Internal function.  Performs the state update (adding correct multiple)
14   @param pmac   The PMAC state.
15 */
pmac_shift_xor(pmac_state * pmac)16 void pmac_shift_xor(pmac_state *pmac)
17 {
18    int x, y;
19    y = pmac_ntz(pmac->block_index++);
20 #ifdef LTC_FAST
21    for (x = 0; x < pmac->block_len; x += sizeof(LTC_FAST_TYPE)) {
22        *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)pmac->Li + x)) ^=
23        *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)pmac->Ls[y] + x));
24    }
25 #else
26    for (x = 0; x < pmac->block_len; x++) {
27        pmac->Li[x] ^= pmac->Ls[y][x];
28    }
29 #endif
30 }
31 
32 #endif
33