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

Unified Diff: crypto/ec_private_key_openssl.cc

Issue 1539353003: Switch to standard integer types in crypto/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « crypto/ec_private_key_nss.cc ('k') | crypto/ec_private_key_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/ec_private_key_openssl.cc
diff --git a/crypto/ec_private_key_openssl.cc b/crypto/ec_private_key_openssl.cc
index 9836fa69c5d38f79dbdd91d36f9ea035edc2b5f9..d8962031a860dc63777533969ef8ec746d219cd6 100644
--- a/crypto/ec_private_key_openssl.cc
+++ b/crypto/ec_private_key_openssl.cc
@@ -8,6 +8,8 @@
#include <openssl/evp.h>
#include <openssl/pkcs12.h>
#include <openssl/x509.h>
+#include <stddef.h>
+#include <stdint.h>
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
@@ -32,7 +34,7 @@ using ScopedX509_SIG = ScopedOpenSSL<X509_SIG, X509_SIG_free>;
// Helper to export |key| into |output| via the specified ExportBioFunction.
bool ExportKeyWithBio(const void* key,
ExportBioFunction export_fn,
- std::vector<uint8>* output) {
+ std::vector<uint8_t>* output) {
if (!key)
return false;
@@ -62,7 +64,7 @@ typedef int (*ExportDataFunction)(const void* key, unsigned char** data);
// Helper to export |key| into |output| via the specified export function.
bool ExportKey(const void* key,
ExportDataFunction export_fn,
- std::vector<uint8>* output) {
+ std::vector<uint8_t>* output) {
if (!key)
return false;
@@ -112,8 +114,8 @@ ECPrivateKey* ECPrivateKey::Create() {
// static
ECPrivateKey* ECPrivateKey::CreateFromEncryptedPrivateKeyInfo(
const std::string& password,
- const std::vector<uint8>& encrypted_private_key_info,
- const std::vector<uint8>& subject_public_key_info) {
+ const std::vector<uint8_t>& encrypted_private_key_info,
+ const std::vector<uint8_t>& subject_public_key_info) {
// NOTE: The |subject_public_key_info| can be ignored here, it is only
// useful for the NSS implementation (which uses the public key's SHA1
// as a lookup key when storing the private one in its store).
@@ -157,10 +159,9 @@ ECPrivateKey* ECPrivateKey::CreateFromEncryptedPrivateKeyInfo(
return result.release();
}
-bool ECPrivateKey::ExportEncryptedPrivateKey(
- const std::string& password,
- int iterations,
- std::vector<uint8>* output) {
+bool ECPrivateKey::ExportEncryptedPrivateKey(const std::string& password,
+ int iterations,
+ std::vector<uint8_t>* output) {
OpenSSLErrStackTracer err_tracer(FROM_HERE);
// Convert into a PKCS#8 object.
ScopedPKCS8_PRIV_KEY_INFO pkcs8(EVP_PKEY2PKCS8(key_));
@@ -189,7 +190,7 @@ bool ECPrivateKey::ExportEncryptedPrivateKey(
output);
}
-bool ECPrivateKey::ExportPublicKey(std::vector<uint8>* output) {
+bool ECPrivateKey::ExportPublicKey(std::vector<uint8_t>* output) {
OpenSSLErrStackTracer err_tracer(FROM_HERE);
return ExportKeyWithBio(
key_, reinterpret_cast<ExportBioFunction>(i2d_PUBKEY_bio), output);
@@ -205,8 +206,8 @@ bool ECPrivateKey::ExportRawPublicKey(std::string* output) {
if (len != kExpectedKeyLength)
return false;
- uint8 buf[kExpectedKeyLength];
- uint8* derp = buf;
+ uint8_t buf[kExpectedKeyLength];
+ uint8_t* derp = buf;
len = i2d_PublicKey(key_, &derp);
if (len != kExpectedKeyLength)
return false;
@@ -215,7 +216,7 @@ bool ECPrivateKey::ExportRawPublicKey(std::string* output) {
return true;
}
-bool ECPrivateKey::ExportValue(std::vector<uint8>* output) {
+bool ECPrivateKey::ExportValue(std::vector<uint8_t>* output) {
OpenSSLErrStackTracer err_tracer(FROM_HERE);
ScopedEC_KEY ec_key(EVP_PKEY_get1_EC_KEY(key_));
return ExportKey(ec_key.get(),
@@ -223,7 +224,7 @@ bool ECPrivateKey::ExportValue(std::vector<uint8>* output) {
output);
}
-bool ECPrivateKey::ExportECParams(std::vector<uint8>* output) {
+bool ECPrivateKey::ExportECParams(std::vector<uint8_t>* output) {
OpenSSLErrStackTracer err_tracer(FROM_HERE);
ScopedEC_KEY ec_key(EVP_PKEY_get1_EC_KEY(key_));
return ExportKey(ec_key.get(),
« no previous file with comments | « crypto/ec_private_key_nss.cc ('k') | crypto/ec_private_key_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698