summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2017-10-02 22:04:03 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-10-02 22:04:03 +0000
commit67af5301c1c47a84e405713652a2dc5f5a59ecd6 (patch)
treeec3fe1ab3ada335c10e6ed994aafab3f12598550
parent9e989ab695ffbc9bb4f5a41ebc13cfd61524f987 (diff)
parent8203a3f918022fa055084724df4b14d63d4c8937 (diff)
downloadkeymaster-67af5301c1c47a84e405713652a2dc5f5a59ecd6.tar.gz
Merge "Keymaster: Move test to std::unique_ptr" am: 4428c1f0c0 am: 1594c64b69 am: 59e7178711
am: 8203a3f918 Change-Id: If562bb465d0dcb585899c0f2aaee70e57cb54005
-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);