OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS 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 "update_engine/omaha_hash_calculator.h" | 5 #include "update_engine/omaha_hash_calculator.h" |
6 | 6 |
7 #include <openssl/bio.h> | 7 #include <openssl/bio.h> |
8 #include <openssl/buffer.h> | 8 #include <openssl/buffer.h> |
9 #include <openssl/evp.h> | 9 #include <openssl/evp.h> |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 | 91 |
92 string OmahaHashCalculator::OmahaHashOfString(const string& str) { | 92 string OmahaHashCalculator::OmahaHashOfString(const string& str) { |
93 return OmahaHashOfBytes(str.data(), str.size()); | 93 return OmahaHashOfBytes(str.data(), str.size()); |
94 } | 94 } |
95 | 95 |
96 string OmahaHashCalculator::OmahaHashOfData(const vector<char>& data) { | 96 string OmahaHashCalculator::OmahaHashOfData(const vector<char>& data) { |
97 return OmahaHashOfBytes(&data[0], data.size()); | 97 return OmahaHashOfBytes(&data[0], data.size()); |
98 } | 98 } |
99 | 99 |
| 100 string OmahaHashCalculator::GetContext() const { |
| 101 return string(reinterpret_cast<const char*>(&ctx_), sizeof(ctx_)); |
| 102 } |
| 103 |
| 104 bool OmahaHashCalculator::SetContext(const std::string& context) { |
| 105 TEST_AND_RETURN_FALSE(context.size() == sizeof(ctx_)); |
| 106 memcpy(&ctx_, context.data(), sizeof(ctx_)); |
| 107 return true; |
| 108 } |
| 109 |
100 } // namespace chromeos_update_engine | 110 } // namespace chromeos_update_engine |
OLD | NEW |