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

Side by Side Diff: crypto/secure_util.h

Issue 10695140: Remove #pragma once from crypto (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « crypto/secure_hash.h ('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 #ifndef CRYPTO_SECURE_UTIL_H_ 5 #ifndef CRYPTO_SECURE_UTIL_H_
6 #define CRYPTO_SECURE_UTIL_H_ 6 #define CRYPTO_SECURE_UTIL_H_
7 #pragma once
8 7
9 #include <stddef.h> 8 #include <stddef.h>
10 9
11 #include "crypto/crypto_export.h" 10 #include "crypto/crypto_export.h"
12 11
13 namespace crypto { 12 namespace crypto {
14 13
15 // Performs a constant-time comparison of two strings, returning true if the 14 // Performs a constant-time comparison of two strings, returning true if the
16 // strings are equal. 15 // strings are equal.
17 // 16 //
18 // For cryptographic operations, comparison functions such as memcmp() may 17 // For cryptographic operations, comparison functions such as memcmp() may
19 // expose side-channel information about input, allowing an attacker to 18 // expose side-channel information about input, allowing an attacker to
20 // perform timing analysis to determine what the expected bits should be. In 19 // perform timing analysis to determine what the expected bits should be. In
21 // order to avoid such attacks, the comparison must execute in constant time, 20 // order to avoid such attacks, the comparison must execute in constant time,
22 // so as to not to reveal to the attacker where the difference(s) are. 21 // so as to not to reveal to the attacker where the difference(s) are.
23 // For an example attack, see 22 // For an example attack, see
24 // http://groups.google.com/group/keyczar-discuss/browse_thread/thread/5571eca09 48b2a13 23 // http://groups.google.com/group/keyczar-discuss/browse_thread/thread/5571eca09 48b2a13
25 CRYPTO_EXPORT bool SecureMemEqual(const void* s1, const void* s2, size_t n); 24 CRYPTO_EXPORT bool SecureMemEqual(const void* s1, const void* s2, size_t n);
26 25
27 } // namespace crypto 26 } // namespace crypto
28 27
29 #endif // CRYPTO_SECURE_UTIL_H_ 28 #endif // CRYPTO_SECURE_UTIL_H_
30 29
OLDNEW
« no previous file with comments | « crypto/secure_hash.h ('k') | crypto/sha2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698