diff options
author | Andreas Gampe <agampe@google.com> | 2017-10-02 21:28:41 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-10-02 21:28:41 +0000 |
commit | 59e71787118b18065f95a01d182f95470f6f828b (patch) | |
tree | ec3fe1ab3ada335c10e6ed994aafab3f12598550 | |
parent | 86167196711365710befb5b3989c141d463802f8 (diff) | |
parent | 1594c64b696692a647a46960b755da5ace26483d (diff) | |
download | keymaster-59e71787118b18065f95a01d182f95470f6f828b.tar.gz |
Merge "Keymaster: Move test to std::unique_ptr" am: 4428c1f0c0
am: 1594c64b69
Change-Id: Ieb0c3cc05263583c1b17f4971252501c5d8e7e33
-rw-r--r-- | keymaster_qcom.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/keymaster_qcom.cpp b/keymaster_qcom.cpp index 0ad3330..e779cbc 100644 --- a/keymaster_qcom.cpp +++ b/keymaster_qcom.cpp @@ -18,6 +18,8 @@ #include <string.h> #include <stdint.h> +#include <memory> + #include <hardware/hardware.h> #include <hardware/keymaster0.h> @@ -42,8 +44,6 @@ #include <sys/stat.h> #include <dlfcn.h> -#include <nativehelper/UniquePtr.h> - #include "QSEEComAPI.h" #include "keymaster_qcom.h" @@ -80,16 +80,16 @@ struct EVP_PKEY_Delete { EVP_PKEY_free(p); } }; -typedef UniquePtr<EVP_PKEY, EVP_PKEY_Delete> Unique_EVP_PKEY; +typedef std::unique_ptr<EVP_PKEY, EVP_PKEY_Delete> Unique_EVP_PKEY; struct RSA_Delete { void operator()(RSA* p) const { RSA_free(p); } }; -typedef UniquePtr<RSA, RSA_Delete> Unique_RSA; +typedef std::unique_ptr<RSA, RSA_Delete> Unique_RSA; -typedef UniquePtr<keymaster0_device_t> Unique_keymaster_device_t; +typedef std::unique_ptr<keymaster0_device_t> Unique_keymaster_device_t; /** * Many OpenSSL APIs take ownership of an argument on success but don't free the argument @@ -172,7 +172,7 @@ static int qcom_km_get_keypair_public(const keymaster0_device_t* dev, return -1; } - UniquePtr<unsigned char[]> key(new unsigned char[len]); + std::unique_ptr<unsigned char[]> key(new unsigned char[len]); if (key.get() == NULL) { ALOGE("Could not allocate memory for public key data"); return -1; @@ -368,7 +368,7 @@ static int qcom_km_generate_keypair(const keymaster0_device_t* dev, ALOGE("Generate key command failed resp->status = %d ret =%d", resp->status, ret); return -1; } else { - UniquePtr<unsigned char[]> keydata(new unsigned char[resp->key_blob_len]); + std::unique_ptr<unsigned char[]> keydata(new unsigned char[resp->key_blob_len]); if (keydata.get() == NULL) { ALOGE("could not allocate memory for key blob"); return -1; @@ -451,7 +451,7 @@ static int qcom_km_import_keypair(const keymaster0_device_t* dev, qcom_km_ion_dealloc(&ihandle); return -1; } else { - UniquePtr<unsigned char[]> keydata(new unsigned char[resp->key_blob_len]); + std::unique_ptr<unsigned char[]> keydata(new unsigned char[resp->key_blob_len]); if (keydata.get() == NULL) { ALOGE("could not allocate memory for key blob"); return -1; @@ -551,7 +551,7 @@ static int qcom_km_sign_data(const keymaster0_device_t* dev, qcom_km_ion_dealloc(&ihandle); return -1; } else { - UniquePtr<uint8_t> signedDataPtr(reinterpret_cast<uint8_t*>(malloc(resp->sig_len))); + std::unique_ptr<uint8_t> signedDataPtr(reinterpret_cast<uint8_t*>(malloc(resp->sig_len))); if (signedDataPtr.get() == NULL) { ALOGE("Sign data memory allocation failed"); qcom_km_ion_dealloc(&ihandle); |