summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-15 04:45:16 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-15 04:45:16 +0000
commit9dd6a2d196178500ddb27ee0d8e836fc7b76d2cf (patch)
tree539048269ab16db8ae93a543011473c691559063 /crypto
parentcf99f3b5cdc644528028cd472dc80fe1e3de33f7 (diff)
downloadchromium_src-9dd6a2d196178500ddb27ee0d8e836fc7b76d2cf.zip
chromium_src-9dd6a2d196178500ddb27ee0d8e836fc7b76d2cf.tar.gz
chromium_src-9dd6a2d196178500ddb27ee0d8e836fc7b76d2cf.tar.bz2
RSAPrivateKey vector push_back cleanups.
BUG=none TEST=unittests Review URL: http://codereview.chromium.org/8533028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110043 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto')
-rw-r--r--crypto/rsa_private_key.cc14
-rw-r--r--crypto/rsa_private_key_nss.cc4
-rw-r--r--crypto/rsa_private_key_win.cc4
3 files changed, 6 insertions, 16 deletions
diff --git a/crypto/rsa_private_key.cc b/crypto/rsa_private_key.cc
index 8290d16..2d849cd 100644
--- a/crypto/rsa_private_key.cc
+++ b/crypto/rsa_private_key.cc
@@ -81,8 +81,7 @@ bool PrivateKeyInfoCodec::Export(std::vector<uint8>* output) {
// Copy everying into the output.
output->reserve(content.size());
- for (std::list<uint8>::iterator i = content.begin(); i != content.end(); ++i)
- output->push_back(*i);
+ output->assign(content.begin(), content.end());
return true;
}
@@ -107,8 +106,7 @@ bool PrivateKeyInfoCodec::ExportPublicKeyInfo(std::vector<uint8>* output) {
// Copy everything into the output.
output->reserve(content.size());
- for (std::list<uint8>::iterator i = content.begin(); i != content.end(); ++i)
- output->push_back(*i);
+ output->assign(content.begin(), content.end());
return true;
}
@@ -124,8 +122,7 @@ bool PrivateKeyInfoCodec::ExportPublicKey(std::vector<uint8>* output) {
// Copy everything into the output.
output->reserve(content.size());
- for (std::list<uint8>::iterator i = content.begin(); i != content.end(); ++i)
- output->push_back(*i);
+ output->assign(content.begin(), content.end());
return true;
}
@@ -238,10 +235,7 @@ bool PrivateKeyInfoCodec::ReadIntegerWithExpectedSize(uint8** pos,
READ_ASSERT(out->size() <= expected_size);
}
- while (pad) {
- out->push_back(0x00);
- pad--;
- }
+ out->insert(out->end(), pad, 0x00);
out->insert(out->end(), temp.begin(), temp.end());
// Reverse output if little-endian.
diff --git a/crypto/rsa_private_key_nss.cc b/crypto/rsa_private_key_nss.cc
index 0d79dbe..cd1f920 100644
--- a/crypto/rsa_private_key_nss.cc
+++ b/crypto/rsa_private_key_nss.cc
@@ -168,9 +168,7 @@ bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) {
return false;
}
- for (size_t i = 0; i < der_pubkey->len; ++i)
- output->push_back(der_pubkey->data[i]);
-
+ output->assign(der_pubkey->data, der_pubkey->data + der_pubkey->len);
return true;
}
diff --git a/crypto/rsa_private_key_win.cc b/crypto/rsa_private_key_win.cc
index f0e6477..f736342 100644
--- a/crypto/rsa_private_key_win.cc
+++ b/crypto/rsa_private_key_win.cc
@@ -222,9 +222,7 @@ bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) {
return false;
}
- for (size_t i = 0; i < encoded_length; ++i)
- output->push_back(encoded[i]);
-
+ output->assign(encoded.get(), encoded.get() + encoded_length);
return true;
}