Chromium Code Reviews| 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/rsa_private_key.h" | 5 #include "crypto/rsa_private_key.h" | 
| 6 | 6 | 
| 7 #include <list> | 7 #include <list> | 
| 8 | 8 | 
| 9 #include "base/logging.h" | 9 #include "base/logging.h" | 
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" | 
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" | 
| 12 | 12 | 
| 13 #pragma comment(lib, "crypt32.lib") | 13 #pragma comment(lib, "crypt32.lib") | 
| 14 | 14 | 
| 15 namespace { | 15 namespace { | 
| 16 // Helper for error handling during key import. | 16 // Helper for error handling during key import. | 
| 17 #define READ_ASSERT(truth) \ | 17 #define READ_ASSERT(truth) \ | 
| 18 if (!(truth)) { \ | 18 if (!(truth)) { \ | 
| 19 NOTREACHED(); \ | 19 NOTREACHED(); \ | 
| 20 return false; \ | 20 return NULL; \ | 
| 
 
Ryan Sleevi
2012/05/02 18:11:30
Given there is only one instance of this macro, ca
 
Nico
2012/05/02 18:14:20
Done.
 
 | |
| 21 } | 21 } | 
| 22 } // namespace | 22 } // namespace | 
| 23 | 23 | 
| 24 namespace crypto { | 24 namespace crypto { | 
| 25 | 25 | 
| 26 // static | 26 // static | 
| 27 RSAPrivateKey* RSAPrivateKey::Create(uint16 num_bits) { | 27 RSAPrivateKey* RSAPrivateKey::Create(uint16 num_bits) { | 
| 28 scoped_ptr<RSAPrivateKey> result(new RSAPrivateKey); | 28 scoped_ptr<RSAPrivateKey> result(new RSAPrivateKey); | 
| 29 if (!result->InitProvider()) | 29 if (!result->InitProvider()) | 
| 30 return NULL; | 30 return NULL; | 
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 &encoded_length)) { | 232 &encoded_length)) { | 
| 233 NOTREACHED(); | 233 NOTREACHED(); | 
| 234 return false; | 234 return false; | 
| 235 } | 235 } | 
| 236 | 236 | 
| 237 output->assign(encoded.get(), encoded.get() + encoded_length); | 237 output->assign(encoded.get(), encoded.get() + encoded_length); | 
| 238 return true; | 238 return true; | 
| 239 } | 239 } | 
| 240 | 240 | 
| 241 } // namespace crypto | 241 } // namespace crypto | 
| OLD | NEW |