OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "crypto/hmac.h" | 5 #include "crypto/hmac.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> |
10 | 11 |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
13 #include "crypto/openssl_util.h" | 14 #include "crypto/openssl_util.h" |
14 #include "crypto/secure_util.h" | 15 #include "crypto/secure_util.h" |
15 #include "crypto/symmetric_key.h" | 16 #include "crypto/symmetric_key.h" |
16 #include "third_party/boringssl/src/include/openssl/hmac.h" | 17 #include "third_party/boringssl/src/include/openssl/hmac.h" |
17 | 18 |
18 namespace crypto { | 19 namespace crypto { |
19 | 20 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 std::unique_ptr<unsigned char[]> computed_digest( | 85 std::unique_ptr<unsigned char[]> computed_digest( |
85 new unsigned char[digest_length]); | 86 new unsigned char[digest_length]); |
86 if (!Sign(data, computed_digest.get(), digest_length)) | 87 if (!Sign(data, computed_digest.get(), digest_length)) |
87 return false; | 88 return false; |
88 | 89 |
89 return SecureMemEqual(digest.data(), computed_digest.get(), | 90 return SecureMemEqual(digest.data(), computed_digest.get(), |
90 std::min(digest.size(), digest_length)); | 91 std::min(digest.size(), digest_length)); |
91 } | 92 } |
92 | 93 |
93 } // namespace crypto | 94 } // namespace crypto |
OLD | NEW |