PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
timingsafe_bcmp.c File Reference
#include "c.h"
Include dependency graph for timingsafe_bcmp.c:

Go to the source code of this file.

Functions

int timingsafe_bcmp (const void *b1, const void *b2, size_t n)
 

Function Documentation

◆ timingsafe_bcmp()

int timingsafe_bcmp ( const void *  b1,
const void *  b2,
size_t  n 
)

Definition at line 30 of file timingsafe_bcmp.c.

31{
32#ifdef USE_SSL
33 return CRYPTO_memcmp(b1, b2, n);
34#else
35 const unsigned char *p1 = b1,
36 *p2 = b2;
37 int ret = 0;
38
39 for (; n > 0; n--)
40 ret |= *p1++ ^ *p2++;
41 return (ret != 0);
42#endif
43}

Referenced by SendCancelRequest().