| 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 "chrome/browser/protector/protector_utils.h" | 5 #include "chrome/browser/protector/protector_utils.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 bool IsSettingValid(const std::string& value, const std::string& signature) { | 34 bool IsSettingValid(const std::string& value, const std::string& signature) { |
| 35 crypto::HMAC hmac(crypto::HMAC::SHA256); | 35 crypto::HMAC hmac(crypto::HMAC::SHA256); |
| 36 if (!hmac.Init(kProtectorSigningKey)) { | 36 if (!hmac.Init(kProtectorSigningKey)) { |
| 37 LOG(WARNING) << "Failed to initialize HMAC algorithm for verification."; | 37 LOG(WARNING) << "Failed to initialize HMAC algorithm for verification."; |
| 38 return false; | 38 return false; |
| 39 } | 39 } |
| 40 return hmac.Verify(value, signature); | 40 return hmac.Verify(value, signature); |
| 41 } | 41 } |
| 42 | 42 |
| 43 bool IsEnabled() { | 43 bool IsEnabled() { |
| 44 return !CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoProtector); | 44 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kProtector); |
| 45 } | 45 } |
| 46 | 46 |
| 47 } // namespace protector | 47 } // namespace protector |
| OLD | NEW |