| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/symmetric_key.h" | 5 #include "crypto/symmetric_key.h" |
| 6 | 6 |
| 7 #include <openssl/evp.h> | |
| 8 #include <openssl/rand.h> | |
| 9 #include <stddef.h> | 7 #include <stddef.h> |
| 10 #include <stdint.h> | 8 #include <stdint.h> |
| 11 | 9 |
| 12 #include <algorithm> | 10 #include <algorithm> |
| 13 #include <utility> | 11 #include <utility> |
| 14 | 12 |
| 15 #include "base/logging.h" | 13 #include "base/logging.h" |
| 16 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 17 #include "crypto/openssl_util.h" | 15 #include "crypto/openssl_util.h" |
| 16 #include "third_party/boringssl/src/include/openssl/evp.h" |
| 17 #include "third_party/boringssl/src/include/openssl/rand.h" |
| 18 | 18 |
| 19 namespace crypto { | 19 namespace crypto { |
| 20 | 20 |
| 21 SymmetricKey::~SymmetricKey() { | 21 SymmetricKey::~SymmetricKey() { |
| 22 std::fill(key_.begin(), key_.end(), '\0'); // Zero out the confidential key. | 22 std::fill(key_.begin(), key_.end(), '\0'); // Zero out the confidential key. |
| 23 } | 23 } |
| 24 | 24 |
| 25 // static | 25 // static |
| 26 std::unique_ptr<SymmetricKey> SymmetricKey::GenerateRandomKey( | 26 std::unique_ptr<SymmetricKey> SymmetricKey::GenerateRandomKey( |
| 27 Algorithm algorithm, | 27 Algorithm algorithm, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 101 } |
| 102 | 102 |
| 103 bool SymmetricKey::GetRawKey(std::string* raw_key) { | 103 bool SymmetricKey::GetRawKey(std::string* raw_key) { |
| 104 *raw_key = key_; | 104 *raw_key = key_; |
| 105 return true; | 105 return true; |
| 106 } | 106 } |
| 107 | 107 |
| 108 SymmetricKey::SymmetricKey() = default; | 108 SymmetricKey::SymmetricKey() = default; |
| 109 | 109 |
| 110 } // namespace crypto | 110 } // namespace crypto |
| OLD | NEW |