1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
2 /* SPDX-License-Identifier: Unlicense */
3 
4 /**
5    @file ocb3_int_xor_blocks.c
6    OCB implementation, INTERNAL ONLY helper, by Karel Miko
7 */
8 #include "tomcrypt_private.h"
9 
10 #ifdef LTC_OCB3_MODE
11 
12 /**
13    Compute xor for two blocks of bytes 'out = block_a XOR block_b' (internal function)
14    @param out        The block of bytes (output)
15    @param block_a    The block of bytes (input)
16    @param block_b    The block of bytes (input)
17    @param block_len  The size of block_a, block_b, out
18 */
ocb3_int_xor_blocks(unsigned char * out,const unsigned char * block_a,const unsigned char * block_b,unsigned long block_len)19 void ocb3_int_xor_blocks(unsigned char *out, const unsigned char *block_a, const unsigned char *block_b, unsigned long block_len)
20 {
21    int x;
22    if (out == block_a) {
23      for (x = 0; x < (int)block_len; x++) out[x] ^= block_b[x];
24    }
25    else {
26      for (x = 0; x < (int)block_len; x++) out[x] = block_a[x] ^ block_b[x];
27    }
28 }
29 
30 #endif
31