diff options
-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); |