OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/gcm_driver/crypto/p256_key_util.h" | 5 #include "components/gcm_driver/crypto/p256_key_util.h" |
6 | 6 |
7 #include <openssl/ec.h> | |
8 #include <openssl/ecdh.h> | |
9 #include <openssl/evp.h> | |
10 #include <stddef.h> | 7 #include <stddef.h> |
11 #include <stdint.h> | 8 #include <stdint.h> |
12 | 9 |
13 #include <memory> | 10 #include <memory> |
14 #include <vector> | 11 #include <vector> |
15 | 12 |
16 #include "base/logging.h" | 13 #include "base/logging.h" |
17 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
18 #include "crypto/ec_private_key.h" | 15 #include "crypto/ec_private_key.h" |
| 16 #include "third_party/boringssl/src/include/openssl/ec.h" |
| 17 #include "third_party/boringssl/src/include/openssl/ecdh.h" |
| 18 #include "third_party/boringssl/src/include/openssl/evp.h" |
19 | 19 |
20 namespace gcm { | 20 namespace gcm { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 // The first byte in an uncompressed P-256 point per SEC1 2.3.3. | 24 // The first byte in an uncompressed P-256 point per SEC1 2.3.3. |
25 const char kUncompressedPointForm = 0x04; | 25 const char kUncompressedPointForm = 0x04; |
26 | 26 |
27 // A P-256 field element consists of 32 bytes. | 27 // A P-256 field element consists of 32 bytes. |
28 const size_t kFieldBytes = 32; | 28 const size_t kFieldBytes = 32; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 nullptr) != sizeof(result)) { | 135 nullptr) != sizeof(result)) { |
136 DLOG(ERROR) << "Unable to compute the ECDH shared secret."; | 136 DLOG(ERROR) << "Unable to compute the ECDH shared secret."; |
137 return false; | 137 return false; |
138 } | 138 } |
139 | 139 |
140 out_shared_secret->assign(reinterpret_cast<char*>(result), sizeof(result)); | 140 out_shared_secret->assign(reinterpret_cast<char*>(result), sizeof(result)); |
141 return true; | 141 return true; |
142 } | 142 } |
143 | 143 |
144 } // namespace gcm | 144 } // namespace gcm |
OLD | NEW |