ReactOS 0.4.17-dev-1005-g171e1de
equal.c File Reference
#include "precomp.h"
Include dependency graph for equal.c:

Go to the source code of this file.

Functions

BOOLEAN SYMCRYPT_CALL SymCryptEqual (_In_reads_(cbBytes) PCBYTE pbSrc1, _In_reads_(cbBytes) PCBYTE pbSrc2, SIZE_T cbBytes)
 

Function Documentation

◆ SymCryptEqual()

BOOLEAN SYMCRYPT_CALL SymCryptEqual ( _In_reads_(cbBytes) PCBYTE  pbSrc1,
_In_reads_(cbBytes) PCBYTE  pbSrc2,
SIZE_T  cbBytes 
)

Definition at line 11 of file equal.c.

14{
15 UINT32 neq = 0;
16 BYTE b;
17 volatile BYTE * p1 = (volatile BYTE *) pbSrc1;
18 volatile BYTE * p2 = (volatile BYTE *) pbSrc2;
19
20 //
21 // We use forced-access memory reads to ensure that the compiler doesn't get
22 // smart and implement an early-out solution.
23 //
24
25 while( cbBytes >= 4 )
26 {
27 neq |= SYMCRYPT_FORCE_READ32( (volatile UINT32 *) p1 ) ^ SYMCRYPT_FORCE_READ32( (volatile UINT32 *) p2 );
28 p1 += 4;
29 p2 += 4;
30 cbBytes -= 4;
31 }
32
33 // We have to deal with the remaining bytes using a separate accumulator to work around an issue in the ARM64 compiler.
34 if( cbBytes > 0 )
35 {
36 b = 0;
37 while( cbBytes > 0 )
38 {
40 p1++;
41 p2++;
42 cbBytes--;
43 }
44 neq |= b;
45 }
46
47 return neq == 0;
48}
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define b
Definition: ke_i.h:79
#define SYMCRYPT_FORCE_READ8( _p)
Definition: symcrypt.h:416
#define SYMCRYPT_FORCE_READ32(_p)
Definition: symcrypt.h:418
uint32_t UINT32
Definition: typedefs.h:59
unsigned char BYTE
Definition: xxhash.c:193

Referenced by SymCryptCcmDecryptFinal(), SymCryptChaCha20Poly1305Decrypt(), SymCryptGcmDecrypt(), SymCryptGcmDecryptFinal(), SymCryptLmskeyVerifyRoot(), SymCryptLmsVerifyInternal(), SymCryptMlDsaVerifyEx(), SymCryptMlKemDecapsulate(), SymCryptMlKemkeyGenerate(), SymCryptMlKemkeySetValue(), SymCryptRsaOaepRemoveEncryptionPadding(), SymCryptRsaPkcs1CheckSignaturePadding(), SymCryptRsaPssVerifySignaturePadding(), SymCryptXmsskeyVerifyRoot(), SymCryptXmssVerifyInternal(), and SymCryptXtsAesExpandKeyEx().