From dd373b8b7d7501cf7f3bbfe861f58dce67578a69 Mon Sep 17 00:00:00 2001 From: avi Date: Mon, 21 Dec 2015 13:34:43 -0800 Subject: Switch to standard integer types in crypto/. BUG=138542 TBR=rsleevi@chromium.org NOPRESUBMIT=true Review URL: https://codereview.chromium.org/1539353003 Cr-Commit-Position: refs/heads/master@{#366460} --- crypto/ec_private_key_openssl.cc | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'crypto/ec_private_key_openssl.cc') diff --git a/crypto/ec_private_key_openssl.cc b/crypto/ec_private_key_openssl.cc index 9836fa6..d896203 100644 --- a/crypto/ec_private_key_openssl.cc +++ b/crypto/ec_private_key_openssl.cc @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include "base/logging.h" #include "base/memory/scoped_ptr.h" @@ -32,7 +34,7 @@ using ScopedX509_SIG = ScopedOpenSSL; // Helper to export |key| into |output| via the specified ExportBioFunction. bool ExportKeyWithBio(const void* key, ExportBioFunction export_fn, - std::vector* output) { + std::vector* 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* output) { + std::vector* output) { if (!key) return false; @@ -112,8 +114,8 @@ ECPrivateKey* ECPrivateKey::Create() { // static ECPrivateKey* ECPrivateKey::CreateFromEncryptedPrivateKeyInfo( const std::string& password, - const std::vector& encrypted_private_key_info, - const std::vector& subject_public_key_info) { + const std::vector& encrypted_private_key_info, + const std::vector& 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* output) { +bool ECPrivateKey::ExportEncryptedPrivateKey(const std::string& password, + int iterations, + std::vector* 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* output) { +bool ECPrivateKey::ExportPublicKey(std::vector* output) { OpenSSLErrStackTracer err_tracer(FROM_HERE); return ExportKeyWithBio( key_, reinterpret_cast(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* output) { +bool ECPrivateKey::ExportValue(std::vector* 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* output) { output); } -bool ECPrivateKey::ExportECParams(std::vector* output) { +bool ECPrivateKey::ExportECParams(std::vector* output) { OpenSSLErrStackTracer err_tracer(FROM_HERE); ScopedEC_KEY ec_key(EVP_PKEY_get1_EC_KEY(key_)); return ExportKey(ec_key.get(), -- cgit v1.1