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 #include "tomcrypt_private.h" 11 12 /** 13 @file pmac_shift_xor.c 14 PMAC implementation, internal function, by Tom St Denis 15 */ 16 17 #ifdef LTC_PMAC 18 19 /** 20 Internal function. Performs the state update (adding correct multiple) 21 @param pmac The PMAC state. 22 */ pmac_shift_xor(pmac_state * pmac)23void pmac_shift_xor(pmac_state *pmac) 24 { 25 int x, y; 26 y = pmac_ntz(pmac->block_index++); 27 #ifdef LTC_FAST 28 for (x = 0; x < pmac->block_len; x += sizeof(LTC_FAST_TYPE)) { 29 *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)pmac->Li + x)) ^= 30 *(LTC_FAST_TYPE_PTR_CAST((unsigned char *)pmac->Ls[y] + x)); 31 } 32 #else 33 for (x = 0; x < pmac->block_len; x++) { 34 pmac->Li[x] ^= pmac->Ls[y][x]; 35 } 36 #endif 37 } 38 39 #endif 40 41 /* ref: $Format:%D$ */ 42 /* git commit: $Format:%H$ */ 43 /* commit time: $Format:%ai$ */ 44