diff options
author | Adam Langley <agl@chromium.org> | 2016-02-23 12:55:03 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-02-23 12:55:03 +0000 |
commit | ca117558d31d698c7588a3690ade755afee78fe2 (patch) | |
tree | 1120d6cff64e89bc3c3f592d12b999219f3f60ed | |
parent | cf7d9a88dd2039851562d8af5f51bdf25a79a78d (diff) | |
parent | 4263b591c4cc33d16cdbfb8b11d9cf5373ec89ba (diff) | |
download | keymaster-ca117558d31d698c7588a3690ade755afee78fe2.tar.gz |
system/keymaster: don\'t pass a structure into |d2i_PrivateKey|.
am: 4263b591c4
* commit '4263b591c4cc33d16cdbfb8b11d9cf5373ec89ba':
system/keymaster: don't pass a structure into |d2i_PrivateKey|.
-rw-r--r-- | soft_keymaster_context.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/soft_keymaster_context.cpp b/soft_keymaster_context.cpp index ab68760..a143245 100644 --- a/soft_keymaster_context.cpp +++ b/soft_keymaster_context.cpp @@ -496,13 +496,9 @@ keymaster_error_t SoftKeymasterContext::ParseOldSoftkeymasterBlob( // Just to be sure, make sure that the ASN.1 structure parses correctly. We don't actually use // the EVP_PKEY here. - unique_ptr<EVP_PKEY, EVP_PKEY_Delete> pkey(EVP_PKEY_new()); - if (pkey.get() == nullptr) - return KM_ERROR_MEMORY_ALLOCATION_FAILED; - - EVP_PKEY* tmp = pkey.get(); const uint8_t* key_start = p; - if (d2i_PrivateKey(type, &tmp, &p, privateLen) == NULL) { + unique_ptr<EVP_PKEY, EVP_PKEY_Delete> pkey(d2i_PrivateKey(type, nullptr, &p, privateLen)); + if (pkey.get() == nullptr) { LOG_W("Failed to parse PKCS#8 key material (if old SW key)", 0); return KM_ERROR_INVALID_KEY_BLOB; } |