Merge "Update hash and VTS for the 2nd FD of dumpstate" into oc-dr1-dev
diff --git a/camera/common/1.0/default/Android.bp b/camera/common/1.0/default/Android.bp
index 03a71fa..6209cb8 100644
--- a/camera/common/1.0/default/Android.bp
+++ b/camera/common/1.0/default/Android.bp
@@ -1,10 +1,11 @@
cc_library_static {
name: "android.hardware.camera.common@1.0-helper",
- vendor: true,
+ vendor_available: true,
defaults: ["hidl_defaults"],
srcs: [
"CameraModule.cpp",
"CameraMetadata.cpp",
+ "CameraParameters.cpp",
"VendorTagDescriptor.cpp",
"HandleImporter.cpp"],
cflags: [
diff --git a/camera/provider/2.4/vts/functional/CameraParameters.cpp b/camera/common/1.0/default/CameraParameters.cpp
similarity index 98%
rename from camera/provider/2.4/vts/functional/CameraParameters.cpp
rename to camera/common/1.0/default/CameraParameters.cpp
index 97b263b..d224483 100644
--- a/camera/provider/2.4/vts/functional/CameraParameters.cpp
+++ b/camera/common/1.0/default/CameraParameters.cpp
@@ -24,6 +24,12 @@
#include <system/graphics.h>
namespace android {
+namespace hardware {
+namespace camera {
+namespace common {
+namespace V1_0 {
+namespace helper {
+
// Parameter keys to communicate between camera application and driver.
const char CameraParameters::KEY_PREVIEW_SIZE[] = "preview-size";
const char CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES[] = "preview-size-values";
@@ -534,4 +540,9 @@
return mMap.isEmpty();
}
+};
+};
+};
+};
+};
}; // namespace android
diff --git a/camera/provider/2.4/vts/functional/CameraParameters.h b/camera/common/1.0/default/include/CameraParameters.h
similarity index 99%
rename from camera/provider/2.4/vts/functional/CameraParameters.h
rename to camera/common/1.0/default/include/CameraParameters.h
index ba33ffe..e4ff6f2 100644
--- a/camera/provider/2.4/vts/functional/CameraParameters.h
+++ b/camera/common/1.0/default/include/CameraParameters.h
@@ -21,6 +21,11 @@
#include <utils/String8.h>
namespace android {
+namespace hardware {
+namespace camera {
+namespace common {
+namespace V1_0 {
+namespace helper {
struct Size {
int width;
@@ -694,6 +699,11 @@
DefaultKeyedVector<String8,String8> mMap;
};
-}; // namespace android
+};
+};
+};
+};
+};
+}; // namespace
#endif
diff --git a/camera/provider/2.4/vts/functional/Android.bp b/camera/provider/2.4/vts/functional/Android.bp
index 85312c1..eae58ef 100644
--- a/camera/provider/2.4/vts/functional/Android.bp
+++ b/camera/provider/2.4/vts/functional/Android.bp
@@ -17,8 +17,7 @@
cc_test {
name: "VtsHalCameraProviderV2_4TargetTest",
defaults: ["hidl_defaults"],
- srcs: ["VtsHalCameraProviderV2_4TargetTest.cpp",
- "CameraParameters.cpp" ],
+ srcs: ["VtsHalCameraProviderV2_4TargetTest.cpp"],
shared_libs: [
"liblog",
"libhidlbase",
@@ -33,7 +32,11 @@
"libgui",
"libui"
],
- static_libs: ["VtsHalHidlTargetTestBase", "libgrallocusage"],
+ static_libs: [
+ "VtsHalHidlTargetTestBase",
+ "libgrallocusage",
+ "android.hardware.camera.common@1.0-helper",
+ ],
cflags: [
"-O0",
"-g",
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 8695e4e..49281f5 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -36,7 +36,7 @@
#include <mutex>
#include <regex>
#include <unordered_map>
-#include "CameraParameters.h"
+#include <CameraParameters.h>
#include "system/camera_metadata.h"
using ::android::hardware::Return;
@@ -52,13 +52,14 @@
using ::android::BufferQueue;
using ::android::BufferItemConsumer;
using ::android::Surface;
-using ::android::CameraParameters;
using ::android::hardware::graphics::common::V1_0::BufferUsage;
using ::android::hardware::graphics::common::V1_0::PixelFormat;
using ::android::hardware::camera::common::V1_0::Status;
using ::android::hardware::camera::common::V1_0::CameraDeviceStatus;
using ::android::hardware::camera::common::V1_0::TorchMode;
using ::android::hardware::camera::common::V1_0::TorchModeStatus;
+using ::android::hardware::camera::common::V1_0::helper::CameraParameters;
+using ::android::hardware::camera::common::V1_0::helper::Size;
using ::android::hardware::camera::provider::V2_4::ICameraProvider;
using ::android::hardware::camera::provider::V2_4::ICameraProviderCallback;
using ::android::hardware::camera::device::V3_2::ICameraDevice;
@@ -564,7 +565,7 @@
const std::vector<AvailableStream> &streamSizes,
int32_t format, AvailableStream &result);
static Status isAutoFocusModeAvailable(
- ::android::CameraParameters &cameraParams, const char *mode) ;
+ CameraParameters &cameraParams, const char *mode) ;
protected:
std::mutex mLock; // Synchronize access to member variables
@@ -1333,7 +1334,7 @@
openCameraDevice(name, env, &device1 /*out*/);
ASSERT_NE(nullptr, device1.get());
- ::android::CameraParameters cameraParams;
+ CameraParameters cameraParams;
getParameters(device1, &cameraParams /*out*/);
if (Status::OK != isAutoFocusModeAvailable(cameraParams,
@@ -1395,7 +1396,7 @@
openCameraDevice(name, env, &device1 /*out*/);
ASSERT_NE(nullptr, device1.get());
- ::android::CameraParameters cameraParams;
+ CameraParameters cameraParams;
getParameters(device1, &cameraParams /*out*/);
if (Status::OK != isAutoFocusModeAvailable(cameraParams,
@@ -1443,7 +1444,7 @@
openCameraDevice(name, env, &device1 /*out*/);
ASSERT_NE(nullptr, device1.get());
- ::android::CameraParameters cameraParams;
+ CameraParameters cameraParams;
getParameters(device1, &cameraParams /*out*/);
int32_t hwFaces = cameraParams.getInt(
@@ -1506,7 +1507,7 @@
openCameraDevice(name, env, &device1 /*out*/);
ASSERT_NE(nullptr, device1.get());
- ::android::CameraParameters cameraParams;
+ CameraParameters cameraParams;
getParameters(device1, &cameraParams /*out*/);
const char *smoothZoomStr = cameraParams.get(
@@ -1557,7 +1558,7 @@
openCameraDevice(name, env, &device1 /*out*/);
ASSERT_NE(nullptr, device1.get());
- ::android::CameraParameters cameraParams;
+ CameraParameters cameraParams;
getParameters(device1, &cameraParams /*out*/);
int32_t width, height;
@@ -1587,10 +1588,10 @@
ASSERT_TRUE((nullptr == effect) || (strcmp(
CameraParameters::EFFECT_NONE, effect) == 0));
- ::android::Vector<::android::Size> previewSizes;
+ ::android::Vector<Size> previewSizes;
cameraParams.getSupportedPreviewSizes(previewSizes);
ASSERT_FALSE(previewSizes.empty());
- ::android::Vector<::android::Size> pictureSizes;
+ ::android::Vector<Size> pictureSizes;
cameraParams.getSupportedPictureSizes(pictureSizes);
ASSERT_FALSE(pictureSizes.empty());
const char *previewFormats = cameraParams.get(
@@ -3003,7 +3004,7 @@
// Check whether the camera device supports specific focus mode.
Status CameraHidlTest::isAutoFocusModeAvailable(
- ::android::CameraParameters &cameraParams,
+ CameraParameters &cameraParams,
const char *mode) {
::android::String8 focusModes(cameraParams.get(
CameraParameters::KEY_SUPPORTED_FOCUS_MODES));
diff --git a/drm/1.0/Android.bp b/drm/1.0/Android.bp
index 7829de7..731f58f 100644
--- a/drm/1.0/Android.bp
+++ b/drm/1.0/Android.bp
@@ -89,3 +89,5 @@
"libutils",
],
}
+
+subdirs = ["default"]
diff --git a/drm/1.0/default/Android.bp b/drm/1.0/default/Android.bp
new file mode 100644
index 0000000..ed6bcde
--- /dev/null
+++ b/drm/1.0/default/Android.bp
@@ -0,0 +1,23 @@
+cc_library_static {
+ name: "android.hardware.drm@1.0-helper",
+ vendor_available: true,
+ defaults: ["hidl_defaults"],
+ srcs: [
+ "SharedLibrary.cpp",
+ ],
+ cflags: [
+ "-Werror",
+ "-Wextra",
+ "-Wall",
+ ],
+ shared_libs: [
+ "liblog",
+ ],
+ header_libs: [
+ "libutils_headers",
+ ],
+ export_header_lib_headers: [
+ "libutils_headers",
+ ],
+ export_include_dirs : ["include"]
+}
diff --git a/drm/1.0/default/Android.mk b/drm/1.0/default/Android.mk
index 7084d1b..7916fba 100644
--- a/drm/1.0/default/Android.mk
+++ b/drm/1.0/default/Android.mk
@@ -36,6 +36,9 @@
libutils \
libbinder \
+LOCAL_STATIC_LIBRARIES := \
+ android.hardware.drm@1.0-helper \
+
LOCAL_C_INCLUDES := \
hardware/interfaces/drm
@@ -71,10 +74,12 @@
libhidlmemory \
libhidltransport \
liblog \
- libmediadrm \
libstagefright_foundation_vendor \
libutils \
+LOCAL_STATIC_LIBRARIES := \
+ android.hardware.drm@1.0-helper \
+
LOCAL_C_INCLUDES := \
frameworks/native/include \
frameworks/av/include
diff --git a/drm/1.0/default/CryptoFactory.h b/drm/1.0/default/CryptoFactory.h
index 412b557..6b1d1ff 100644
--- a/drm/1.0/default/CryptoFactory.h
+++ b/drm/1.0/default/CryptoFactory.h
@@ -19,7 +19,7 @@
#include <android/hardware/drm/1.0/ICryptoFactory.h>
#include <hidl/Status.h>
#include <media/hardware/CryptoAPI.h>
-#include <media/PluginLoader.h>
+#include <PluginLoader.h>
#include <media/SharedLibrary.h>
namespace android {
@@ -28,6 +28,7 @@
namespace V1_0 {
namespace implementation {
+using ::android::hardware::drm::V1_0::helper::PluginLoader;
using ::android::hardware::drm::V1_0::ICryptoFactory;
using ::android::hardware::drm::V1_0::ICryptoPlugin;
using ::android::hardware::hidl_array;
@@ -51,7 +52,7 @@
override;
private:
- android::PluginLoader<android::CryptoFactory> loader;
+ PluginLoader<android::CryptoFactory> loader;
CryptoFactory(const CryptoFactory &) = delete;
void operator=(const CryptoFactory &) = delete;
diff --git a/drm/1.0/default/DrmFactory.h b/drm/1.0/default/DrmFactory.h
index a008844..726bf97 100644
--- a/drm/1.0/default/DrmFactory.h
+++ b/drm/1.0/default/DrmFactory.h
@@ -19,7 +19,7 @@
#include <android/hardware/drm/1.0/IDrmFactory.h>
#include <hidl/Status.h>
#include <media/drm/DrmAPI.h>
-#include <media/PluginLoader.h>
+#include <PluginLoader.h>
#include <media/SharedLibrary.h>
namespace android {
@@ -28,6 +28,7 @@
namespace V1_0 {
namespace implementation {
+using ::android::hardware::drm::V1_0::helper::PluginLoader;
using ::android::hardware::drm::V1_0::IDrmFactory;
using ::android::hardware::drm::V1_0::IDrmPlugin;
using ::android::hardware::hidl_array;
@@ -53,7 +54,7 @@
const hidl_string& appPackageName, createPlugin_cb _hidl_cb) override;
private:
- android::PluginLoader<android::DrmFactory> loader;
+ PluginLoader<android::DrmFactory> loader;
DrmFactory(const DrmFactory &) = delete;
void operator=(const DrmFactory &) = delete;
diff --git a/drm/1.0/vts/functional/shared_library.cpp b/drm/1.0/default/SharedLibrary.cpp
similarity index 82%
rename from drm/1.0/vts/functional/shared_library.cpp
rename to drm/1.0/default/SharedLibrary.cpp
index 6658150..0a942cd 100644
--- a/drm/1.0/vts/functional/shared_library.cpp
+++ b/drm/1.0/default/SharedLibrary.cpp
@@ -14,17 +14,19 @@
* limitations under the License.
*/
-#define LOG_TAG "drm-vts-shared-library"
+
+#include "SharedLibrary.h"
#include <dlfcn.h>
-#include <shared_library.h>
-using std::string;
+namespace android {
+namespace hardware {
+namespace drm {
+namespace V1_0 {
+namespace helper {
-namespace drm_vts {
-
-SharedLibrary::SharedLibrary(const string& path) {
- mLibHandle = dlopen(path.c_str(), RTLD_NOW);
+SharedLibrary::SharedLibrary(const String8& path) {
+ mLibHandle = dlopen(path.string(), RTLD_NOW);
}
SharedLibrary::~SharedLibrary() {
@@ -53,4 +55,9 @@
const char* error = dlerror();
return error ? error : "No errors or unknown error";
}
-};
+
+}
+}
+}
+}
+} // namespace android
diff --git a/drm/1.0/default/include/PluginLoader.h b/drm/1.0/default/include/PluginLoader.h
new file mode 100644
index 0000000..f387b3c
--- /dev/null
+++ b/drm/1.0/default/include/PluginLoader.h
@@ -0,0 +1,107 @@
+/**
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef PLUGIN_LOADER_H_
+#define PLUGIN_LOADER_H_
+
+#include "SharedLibrary.h"
+#include <utils/Log.h>
+#include <utils/String8.h>
+#include <utils/Vector.h>
+
+namespace android {
+namespace hardware {
+namespace drm {
+namespace V1_0 {
+namespace helper {
+
+template <class T>
+class PluginLoader {
+
+ public:
+ PluginLoader(const char *dir, const char *entry) {
+ /**
+ * scan all plugins in the plugin directory and add them to the
+ * factories list.
+ */
+ String8 pluginDir(dir);
+
+ DIR* pDir = opendir(pluginDir.string());
+ if (pDir == NULL) {
+ ALOGE("Failed to find plugin directory %s", pluginDir.string());
+ } else {
+ struct dirent* pEntry;
+ while ((pEntry = readdir(pDir))) {
+ String8 file(pEntry->d_name);
+ if (file.getPathExtension() == ".so") {
+ String8 path = pluginDir + "/" + pEntry->d_name;
+ T *plugin = loadOne(path, entry);
+ if (plugin) {
+ factories.push(plugin);
+ }
+ }
+ }
+ closedir(pDir);
+ }
+ }
+
+ ~PluginLoader() {
+ for (size_t i = 0; i < factories.size(); i++) {
+ delete factories[i];
+ }
+ }
+
+ T *getFactory(size_t i) const {
+ return factories[i];
+ }
+
+ size_t factoryCount() const {return factories.size();}
+
+ private:
+ T* loadOne(const char *path, const char *entry) {
+ sp<SharedLibrary> library = new SharedLibrary(String8(path));
+ if (!library.get()) {
+ ALOGE("Failed to open plugin library %s: %s", path,
+ library->lastError());
+ } else {
+ typedef T *(*CreateFactoryFunc)();
+ CreateFactoryFunc createFactoryFunc =
+ (CreateFactoryFunc)library->lookup(entry);
+ if (createFactoryFunc) {
+ ALOGV("Found plugin factory entry %s in %s", entry, path);
+ libraries.push(library);
+ T* result = createFactoryFunc();
+ return result;
+ }
+ }
+ return NULL;
+ }
+
+ Vector<T *> factories;
+ Vector<sp<SharedLibrary> > libraries;
+
+ PluginLoader(const PluginLoader &) = delete;
+ void operator=(const PluginLoader &) = delete;
+};
+
+}
+}
+}
+}
+} // namespace android
+
+#endif // PLUGIN_LOADER_H_
+
diff --git a/drm/1.0/vts/functional/shared_library.h b/drm/1.0/default/include/SharedLibrary.h
similarity index 79%
rename from drm/1.0/vts/functional/shared_library.h
rename to drm/1.0/default/include/SharedLibrary.h
index 1f32243..8e174d0 100644
--- a/drm/1.0/vts/functional/shared_library.h
+++ b/drm/1.0/default/include/SharedLibrary.h
@@ -17,13 +17,18 @@
#ifndef SHARED_LIBRARY_H_
#define SHARED_LIBRARY_H_
-#include <string>
-#include <vector>
+#include <utils/RefBase.h>
+#include <utils/String8.h>
-namespace drm_vts {
-class SharedLibrary {
+namespace android {
+namespace hardware {
+namespace drm {
+namespace V1_0 {
+namespace helper {
+
+class SharedLibrary : public RefBase {
public:
- explicit SharedLibrary(const std::string& path);
+ explicit SharedLibrary(const String8& path);
~SharedLibrary();
bool operator!() const;
@@ -36,6 +41,11 @@
SharedLibrary(const SharedLibrary&) = delete;
void operator=(const SharedLibrary&) = delete;
};
-};
+
+}
+}
+}
+}
+}
#endif // SHARED_LIBRARY_H_
diff --git a/drm/1.0/vts/functional/Android.bp b/drm/1.0/vts/functional/Android.bp
index 43ea372..b45ce84 100644
--- a/drm/1.0/vts/functional/Android.bp
+++ b/drm/1.0/vts/functional/Android.bp
@@ -19,7 +19,6 @@
srcs: [
"drm_hal_clearkey_test.cpp",
"drm_hal_vendor_test.cpp",
- "shared_library.cpp",
"vendor_modules.cpp"
],
shared_libs: [
@@ -39,7 +38,8 @@
"libutils",
],
static_libs: [
- "VtsHalHidlTargetTestBase"
+ "VtsHalHidlTargetTestBase",
+ "android.hardware.drm@1.0-helper",
],
cflags: [
"-O0",
diff --git a/drm/1.0/vts/functional/vendor_modules.cpp b/drm/1.0/vts/functional/vendor_modules.cpp
index 2bf0b28..98430f5 100644
--- a/drm/1.0/vts/functional/vendor_modules.cpp
+++ b/drm/1.0/vts/functional/vendor_modules.cpp
@@ -20,13 +20,16 @@
#include <dlfcn.h>
#include <log/log.h>
#include <memory>
+#include <utils/String8.h>
+#include <SharedLibrary.h>
-#include "shared_library.h"
#include "vendor_modules.h"
using std::string;
using std::vector;
using std::unique_ptr;
+using ::android::String8;
+using ::android::hardware::drm::V1_0::helper::SharedLibrary;
namespace drm_vts {
void VendorModules::scanModules(const std::string &directory) {
@@ -48,7 +51,7 @@
DrmHalVTSVendorModule* VendorModules::getModule(const string& path) {
if (mOpenLibraries.find(path) == mOpenLibraries.end()) {
- auto library = std::make_unique<SharedLibrary>(path);
+ auto library = std::make_unique<SharedLibrary>(String8(path.c_str()));
if (!library) {
ALOGE("failed to map shared library %s", path.c_str());
return NULL;
diff --git a/drm/1.0/vts/functional/vendor_modules.h b/drm/1.0/vts/functional/vendor_modules.h
index ca538f6..8330b0a 100644
--- a/drm/1.0/vts/functional/vendor_modules.h
+++ b/drm/1.0/vts/functional/vendor_modules.h
@@ -18,8 +18,12 @@
#define VENDOR_MODULES_H
#include <map>
+#include <vector>
+#include <string>
-#include "shared_library.h"
+#include <SharedLibrary.h>
+
+using ::android::hardware::drm::V1_0::helper::SharedLibrary;
class DrmHalVTSVendorModule;
diff --git a/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp
index 570e33f..9854947 100644
--- a/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp
+++ b/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp
@@ -408,7 +408,7 @@
public:
void TearDown() override {
if (key_blob_.size()) {
- EXPECT_EQ(ErrorCode::OK, DeleteKey());
+ CheckedDeleteKey();
}
AbortIfNeeded();
}
@@ -540,6 +540,13 @@
return error;
}
+ void CheckedDeleteKey(HidlBuf* key_blob, bool keep_key_blob = false) {
+ auto rc = DeleteKey(key_blob, keep_key_blob);
+ EXPECT_TRUE(rc == ErrorCode::OK || rc == ErrorCode::UNIMPLEMENTED);
+ }
+
+ void CheckedDeleteKey() { CheckedDeleteKey(&key_blob_); }
+
ErrorCode GetCharacteristics(const HidlBuf& key_blob, const HidlBuf& client_id,
const HidlBuf& app_data, KeyCharacteristics* key_characteristics) {
ErrorCode error = ErrorCode::UNKNOWN_ERROR;
@@ -760,7 +767,7 @@
KeyFormat::RAW, key));
string signature = MacMessage(message, digest, expected_mac.size() * 8);
EXPECT_EQ(expected_mac, signature) << "Test vector didn't match for digest " << (int)digest;
- DeleteKey();
+ CheckedDeleteKey();
}
void CheckAesCtrTestVector(const string& key, const string& nonce, const string& message,
@@ -1107,7 +1114,7 @@
EXPECT_TRUE(crypto_params.Contains(TAG_KEY_SIZE, key_size));
EXPECT_TRUE(crypto_params.Contains(TAG_RSA_PUBLIC_EXPONENT, 3));
- EXPECT_EQ(ErrorCode::OK, DeleteKey(&key_blob));
+ CheckedDeleteKey(&key_blob);
}
}
@@ -1152,7 +1159,7 @@
EXPECT_TRUE(crypto_params.Contains(TAG_ALGORITHM, Algorithm::EC));
EXPECT_TRUE(crypto_params.Contains(TAG_KEY_SIZE, key_size));
- EXPECT_EQ(ErrorCode::OK, DeleteKey(&key_blob));
+ CheckedDeleteKey(&key_blob);
}
}
@@ -1201,7 +1208,7 @@
EXPECT_EQ(ErrorCode::OK,
GenerateKey(AuthorizationSetBuilder().EcdsaSigningKey(size).Digest(Digest::NONE)))
<< "Failed to generate size: " << size;
- DeleteKey();
+ CheckedDeleteKey();
}
}
@@ -1217,7 +1224,7 @@
ErrorCode::OK,
GenerateKey(AuthorizationSetBuilder().EcdsaSigningKey(curve).Digest(Digest::SHA_2_512)))
<< "Failed to generate key on curve: " << curve;
- DeleteKey();
+ CheckedDeleteKey();
}
}
@@ -1267,7 +1274,7 @@
EXPECT_TRUE(softwareEnforced.Contains(TAG_KEY_SIZE, key_size));
}
- EXPECT_EQ(ErrorCode::OK, DeleteKey(&key_blob));
+ CheckedDeleteKey(&key_blob);
}
}
@@ -1295,7 +1302,7 @@
.HmacKey(key_size)
.Digest(Digest::SHA_2_256)
.Authorization(TAG_MIN_MAC_LENGTH, 256)));
- DeleteKey();
+ CheckedDeleteKey();
}
}
}
@@ -1327,7 +1334,7 @@
.HmacKey(128)
.Digest(Digest::SHA_2_256)
.Authorization(TAG_MIN_MAC_LENGTH, min_mac_length)));
- DeleteKey();
+ CheckedDeleteKey();
}
}
}
@@ -1717,7 +1724,7 @@
string message(1024, 'a');
if (digest == Digest::NONE) message.resize(key_size / 8);
SignMessage(message, AuthorizationSetBuilder().Digest(digest));
- DeleteKey();
+ CheckedDeleteKey();
}
}
}
@@ -1738,7 +1745,7 @@
string message(1024, 'a');
SignMessage(message, AuthorizationSetBuilder().Digest(Digest::SHA_2_256));
- DeleteKey();
+ CheckedDeleteKey();
}
}
@@ -1799,7 +1806,7 @@
string signature = MacMessage(message, digest, 160);
EXPECT_EQ(160U / 8U, signature.size())
<< "Failed to sign with HMAC key with digest " << digest;
- DeleteKey();
+ CheckedDeleteKey();
}
}
@@ -2186,7 +2193,8 @@
<< curve << ' ' << digest;
}
- ASSERT_EQ(ErrorCode::OK, DeleteKey());
+ auto rc = DeleteKey();
+ ASSERT_TRUE(rc == ErrorCode::OK || rc == ErrorCode::UNIMPLEMENTED);
}
}
@@ -2232,8 +2240,8 @@
VerifyMessage(verification_key, message, signature,
AuthorizationSetBuilder().Digest(Digest::SHA1));
- EXPECT_EQ(ErrorCode::OK, DeleteKey(&signing_key));
- EXPECT_EQ(ErrorCode::OK, DeleteKey(&verification_key));
+ CheckedDeleteKey(&signing_key);
+ CheckedDeleteKey(&verification_key);
}
typedef KeymasterHidlTest ExportKeyTest;
@@ -3481,14 +3489,14 @@
string key = make_string(key_bytes);
ASSERT_EQ(ErrorCode::OK, ImportKey(import_params, KeyFormat::RAW, key));
string plaintext = DecryptMessage(ciphertext, params);
- EXPECT_EQ(ErrorCode::OK, DeleteKey());
+ CheckedDeleteKey();
// Corrupt key and attempt to decrypt
key[0] = 0;
ASSERT_EQ(ErrorCode::OK, ImportKey(import_params, KeyFormat::RAW, key));
EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
EXPECT_EQ(ErrorCode::VERIFICATION_FAILED, Finish(ciphertext, &plaintext));
- EXPECT_EQ(ErrorCode::OK, DeleteKey());
+ CheckedDeleteKey();
}
/*