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

Unified Diff: crypto/rsa_private_key_openssl.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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/rsa_private_key_nss.cc ('k') | crypto/rsa_private_key_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/rsa_private_key_openssl.cc
diff --git a/crypto/rsa_private_key_openssl.cc b/crypto/rsa_private_key_openssl.cc
index 0df173093ad9237faac9b94e30369fbd054e5ffe..3dcce675a010b8ae837e74e8f4bdfc57917e7fc1 100644
--- a/crypto/rsa_private_key_openssl.cc
+++ b/crypto/rsa_private_key_openssl.cc
@@ -83,13 +83,10 @@ RSAPrivateKey* RSAPrivateKey::CreateFromPrivateKeyInfo(
// Importing is a little more involved than exporting, as we must first
// PKCS#8 decode the input, and then import the EVP_PKEY from Private Key
// Info structure returned.
- //
- // TODO(davidben): This should check that |ptr| advanced to the end of |input|
- // to ensure there is no trailing data.
const uint8_t* ptr = &input[0];
ScopedPKCS8_PRIV_KEY_INFO p8inf(
d2i_PKCS8_PRIV_KEY_INFO(nullptr, &ptr, input.size()));
- if (!p8inf.get())
+ if (!p8inf.get() || ptr != &input[0] + input.size())
return NULL;
scoped_ptr<RSAPrivateKey> result(new RSAPrivateKey);
« no previous file with comments | « crypto/rsa_private_key_nss.cc ('k') | crypto/rsa_private_key_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698