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 ocb3_int_xor_blocks.c
13    OCB implementation, INTERNAL ONLY helper, by Karel Miko
14 */
15 #include "tomcrypt_private.h"
16 
17 #ifdef LTC_OCB3_MODE
18 
19 /**
20    Compute xor for two blocks of bytes 'out = block_a XOR block_b' (internal function)
21    @param out        The block of bytes (output)
22    @param block_a    The block of bytes (input)
23    @param block_b    The block of bytes (input)
24    @param block_len  The size of block_a, block_b, out
25 */
ocb3_int_xor_blocks(unsigned char * out,const unsigned char * block_a,const unsigned char * block_b,unsigned long block_len)26 void ocb3_int_xor_blocks(unsigned char *out, const unsigned char *block_a, const unsigned char *block_b, unsigned long block_len)
27 {
28    int x;
29    if (out == block_a) {
30      for (x = 0; x < (int)block_len; x++) out[x] ^= block_b[x];
31    }
32    else {
33      for (x = 0; x < (int)block_len; x++) out[x] = block_a[x] ^ block_b[x];
34    }
35 }
36 
37 #endif
38 
39 /* ref:         $Format:%D$ */
40 /* git commit:  $Format:%H$ */
41 /* commit time: $Format:%ai$ */
42