summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-10-03 08:00:36 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-10-03 08:00:36 +0000
commit8c513f24f271d37ff40bc4241a6230415b5b3068 (patch)
treeec3fe1ab3ada335c10e6ed994aafab3f12598550
parentab05afe79746d9ad904315a6085238a37be60863 (diff)
parent67af5301c1c47a84e405713652a2dc5f5a59ecd6 (diff)
downloadkeymaster-8c513f24f271d37ff40bc4241a6230415b5b3068.tar.gz
Snap for 4373608 from 67af5301c1c47a84e405713652a2dc5f5a59ecd6 to pi-release
Change-Id: I84935c3b3a5a3a09f99fedf578ba81c7d116a141
-rw-r--r--keymaster_qcom.cpp18
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);