]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/corecrypto/cc/src/cc_cmp_safe.c
b06c8a724232ee222ebc0c1268c508cf50b7b678
5 * Created on 04/22/2014
7 * Copyright (c) 2014,2015 Apple Inc. All rights reserved.
11 #include <corecrypto/cc_priv.h>
13 int cc_cmp_safe (size_t num
, const void * ptr1
, const void * ptr2
)
16 const uint8_t *s
=(const uint8_t *)ptr1
;
17 const uint8_t *t
=(const uint8_t *)ptr2
;
18 uint8_t flag
=((num
<=0)?1:0); // If 0 return an error
23 HEAVISIDE_STEP_UINT8(flag
,flag
); // flag=(flag==0)?0:1;
24 return flag
; // 0 iff all bytes were equal, 1 if there is any difference