Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Side by Side Diff: crypto/secure_util.cc

Issue 1539353003: Switch to standard integer types in crypto/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « crypto/secure_hash_unittest.cc ('k') | crypto/sha2.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h>
6
5 #include "crypto/secure_util.h" 7 #include "crypto/secure_util.h"
6 8
7 namespace crypto { 9 namespace crypto {
8 10
9 bool SecureMemEqual(const void* s1, const void* s2, size_t n) { 11 bool SecureMemEqual(const void* s1, const void* s2, size_t n) {
10 const unsigned char* s1_ptr = reinterpret_cast<const unsigned char*>(s1); 12 const unsigned char* s1_ptr = reinterpret_cast<const unsigned char*>(s1);
11 const unsigned char* s2_ptr = reinterpret_cast<const unsigned char*>(s2); 13 const unsigned char* s2_ptr = reinterpret_cast<const unsigned char*>(s2);
12 unsigned char tmp = 0; 14 unsigned char tmp = 0;
13 for (size_t i = 0; i < n; ++i, ++s1_ptr, ++s2_ptr) 15 for (size_t i = 0; i < n; ++i, ++s1_ptr, ++s2_ptr)
14 tmp |= *s1_ptr ^ *s2_ptr; 16 tmp |= *s1_ptr ^ *s2_ptr;
15 return (tmp == 0); 17 return (tmp == 0);
16 } 18 }
17 19
18 } // namespace crypto 20 } // namespace crypto
19 21
OLDNEW
« no previous file with comments | « crypto/secure_hash_unittest.cc ('k') | crypto/sha2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698