| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/user_prefs/tracked/pref_hash_calculator.h" | 5 #include "components/user_prefs/tracked/pref_hash_calculator.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/json/json_string_value_serializer.h" | 12 #include "base/json/json_string_value_serializer.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 16 #include "base/values.h" | 17 #include "base/values.h" |
| 17 #include "crypto/hmac.h" | 18 #include "crypto/hmac.h" |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 // Calculates an HMAC of |message| using |key|, encoded as a hexadecimal string. | 22 // Calculates an HMAC of |message| using |key|, encoded as a hexadecimal string. |
| 22 std::string GetDigestString(const std::string& key, | 23 std::string GetDigestString(const std::string& key, |
| 23 const std::string& message) { | 24 const std::string& message) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 digest_string)) { | 119 digest_string)) { |
| 119 return VALID; | 120 return VALID; |
| 120 } | 121 } |
| 121 if (VerifyDigestString(seed_, | 122 if (VerifyDigestString(seed_, |
| 122 GetMessage(legacy_device_id_, path, value_as_string), | 123 GetMessage(legacy_device_id_, path, value_as_string), |
| 123 digest_string)) { | 124 digest_string)) { |
| 124 return VALID_SECURE_LEGACY; | 125 return VALID_SECURE_LEGACY; |
| 125 } | 126 } |
| 126 return INVALID; | 127 return INVALID; |
| 127 } | 128 } |
| OLD | NEW |