Chromium Code Reviews| 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 "crypto/ec_private_key.h" | 5 #include "crypto/ec_private_key.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 if (!key) | 39 if (!key) |
| 40 return false; | 40 return false; |
| 41 | 41 |
| 42 bssl::UniquePtr<BIO> bio(BIO_new(BIO_s_mem())); | 42 bssl::UniquePtr<BIO> bio(BIO_new(BIO_s_mem())); |
| 43 if (!bio) | 43 if (!bio) |
| 44 return false; | 44 return false; |
| 45 | 45 |
| 46 if (!export_fn(bio.get(), key)) | 46 if (!export_fn(bio.get(), key)) |
| 47 return false; | 47 return false; |
| 48 | 48 |
| 49 char* data = nullptr; | 49 const uint8_t* data; |
| 50 long len = BIO_get_mem_data(bio.get(), &data); | 50 size_t len; |
| 51 if (!data || len < 0) | 51 if (!BIO_mem_contents(bio.get(), &data, &len)) |
|
davidben
2017/02/02 22:54:33
cpplint doesn't like long, which is actually the r
| |
| 52 return false; | 52 return false; |
| 53 | 53 |
| 54 output->assign(data, data + len); | 54 output->assign(data, data + len); |
| 55 return true; | 55 return true; |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace | 58 } // namespace |
| 59 | 59 |
| 60 ECPrivateKey::~ECPrivateKey() {} | 60 ECPrivateKey::~ECPrivateKey() {} |
| 61 | 61 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 return false; | 215 return false; |
| 216 } | 216 } |
| 217 | 217 |
| 218 output->assign(reinterpret_cast<const char*>(buf), sizeof(buf)); | 218 output->assign(reinterpret_cast<const char*>(buf), sizeof(buf)); |
| 219 return true; | 219 return true; |
| 220 } | 220 } |
| 221 | 221 |
| 222 ECPrivateKey::ECPrivateKey() {} | 222 ECPrivateKey::ECPrivateKey() {} |
| 223 | 223 |
| 224 } // namespace crypto | 224 } // namespace crypto |
| OLD | NEW |