Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: net/base/openssl_private_key_store_android.cc

Issue 1158923005: Use the exact-width integer types defined in <stdint.h> rather than (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak comments. Exclude mime_sniffer*. Rebase. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "net/base/openssl_private_key_store.h" 5 #include "net/base/openssl_private_key_store.h"
6 6
7 #include <openssl/evp.h> 7 #include <openssl/evp.h>
8 #include <openssl/mem.h> 8 #include <openssl/mem.h>
9 #include <openssl/x509.h> 9 #include <openssl/x509.h>
10 10
(...skipping 20 matching lines...) Expand all
31 // in a format that is incompatible with what the platform expects. 31 // in a format that is incompatible with what the platform expects.
32 unsigned char* private_key = NULL; 32 unsigned char* private_key = NULL;
33 int private_len = 0; 33 int private_len = 0;
34 ScopedPKCS8_PRIV_KEY_INFO pkcs8(EVP_PKEY2PKCS8(pkey)); 34 ScopedPKCS8_PRIV_KEY_INFO pkcs8(EVP_PKEY2PKCS8(pkey));
35 if (!pkcs8) { 35 if (!pkcs8) {
36 private_len = i2d_PKCS8_PRIV_KEY_INFO(pkcs8.get(), &private_key); 36 private_len = i2d_PKCS8_PRIV_KEY_INFO(pkcs8.get(), &private_key);
37 } 37 }
38 bool ret = false; 38 bool ret = false;
39 if (public_len > 0 && private_len > 0) { 39 if (public_len > 0 && private_len > 0) {
40 ret = android::StoreKeyPair( 40 ret = android::StoreKeyPair(
41 static_cast<const uint8*>(public_key), public_len, 41 static_cast<const uint8_t*>(public_key), public_len,
42 static_cast<const uint8*>(private_key), private_len); 42 static_cast<const uint8_t*>(private_key), private_len);
43 } 43 }
44 LOG_IF(ERROR, !ret) << "StoreKeyPair failed. pub len = " << public_len 44 LOG_IF(ERROR, !ret) << "StoreKeyPair failed. pub len = " << public_len
45 << " priv len = " << private_len; 45 << " priv len = " << private_len;
46 OPENSSL_free(public_key); 46 OPENSSL_free(public_key);
47 OPENSSL_free(private_key); 47 OPENSSL_free(private_key);
48 return ret; 48 return ret;
49 } 49 }
50 50
51 } // namespace net 51 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698