]> git.saurik.com Git - apple/security.git/blob - utilities/src/comparison.c
Security-55471.tar.gz
[apple/security.git] / utilities / src / comparison.c
1 //
2 // comparison.c
3 // utilities
4 //
5 // Created by Keith Henrickson on 7/1/12.
6 // Copyright (c) 2012 Apple Inc. All rights reserved.
7 //
8
9 #include <stdio.h>
10 #include <stdint.h>
11 #include "comparison.h"
12
13 uint64_t constant_memcmp(const uint8_t *first, const uint8_t *second, size_t count) {
14 uint64_t error_counter = 0;
15 for (size_t counter = 0; counter < count; counter++) {
16 error_counter |= first[counter] ^ second[counter];
17 }
18 return error_counter;
19 }