| 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 "chromeos/cryptohome/system_salt_getter.h" | 5 #include "chromeos/cryptohome/system_salt_getter.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 // static | 110 // static |
| 111 void SystemSaltGetter::Shutdown() { | 111 void SystemSaltGetter::Shutdown() { |
| 112 CHECK(g_system_salt_getter); | 112 CHECK(g_system_salt_getter); |
| 113 delete g_system_salt_getter; | 113 delete g_system_salt_getter; |
| 114 g_system_salt_getter = NULL; | 114 g_system_salt_getter = NULL; |
| 115 } | 115 } |
| 116 | 116 |
| 117 // static | 117 // static |
| 118 SystemSaltGetter* SystemSaltGetter::Get() { | 118 SystemSaltGetter* SystemSaltGetter::Get() { |
| 119 CHECK(g_system_salt_getter) | 119 // SystemSaltGetter::Get() called before Initialize() |
| 120 << "SystemSaltGetter::Get() called before Initialize()"; | 120 CHECK(g_system_salt_getter); |
| 121 return g_system_salt_getter; | 121 return g_system_salt_getter; |
| 122 } | 122 } |
| 123 | 123 |
| 124 // static | 124 // static |
| 125 std::string SystemSaltGetter::ConvertRawSaltToHexString( | 125 std::string SystemSaltGetter::ConvertRawSaltToHexString( |
| 126 const std::vector<uint8_t>& salt) { | 126 const std::vector<uint8_t>& salt) { |
| 127 return base::ToLowerASCII( | 127 return base::ToLowerASCII( |
| 128 base::HexEncode(reinterpret_cast<const void*>(salt.data()), salt.size())); | 128 base::HexEncode(reinterpret_cast<const void*>(salt.data()), salt.size())); |
| 129 } | 129 } |
| 130 | 130 |
| 131 } // namespace chromeos | 131 } // namespace chromeos |
| OLD | NEW |