summaryrefslogtreecommitdiffstats
path: root/crypto/ec_private_key_openssl.cc
diff options
context:
space:
mode:
authoravi <avi@chromium.org>2015-12-21 13:34:43 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-21 21:35:49 +0000
commitdd373b8b7d7501cf7f3bbfe861f58dce67578a69 (patch)
tree037d2922a3dc5079e1eff59e9a3eb5fe3c605fa0 /crypto/ec_private_key_openssl.cc
parent64114156487081d877b793d3a501a8658743141d (diff)
downloadchromium_src-dd373b8b7d7501cf7f3bbfe861f58dce67578a69.zip
chromium_src-dd373b8b7d7501cf7f3bbfe861f58dce67578a69.tar.gz
chromium_src-dd373b8b7d7501cf7f3bbfe861f58dce67578a69.tar.bz2
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}
Diffstat (limited to 'crypto/ec_private_key_openssl.cc')
-rw-r--r--crypto/ec_private_key_openssl.cc27
1 files changed, 14 insertions, 13 deletions
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 <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(),