Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0531c947 authored by Jim Blackler's avatar Jim Blackler Committed by Gerrit Code Review
Browse files

Merge "Revert "Delete KM1""

parents 13274fa2 a08ea2d2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ LOCAL_SRC_FILES := \

LOCAL_SHARED_LIBRARIES := \
    liblog \
    libpuresoftkeymasterdevice \
    libsoftkeymasterdevice \
    libcrypto \
    libkeymaster_portable \
    libpuresoftkeymasterdevice \
+20 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <log/log.h>

#include <AndroidKeymaster3Device.h>
#include <hardware/keymaster1.h>
#include <hardware/keymaster2.h>
#include <hardware/keymaster_defs.h>

@@ -31,6 +32,18 @@ namespace keymaster {
namespace V3_0 {
namespace implementation {

static int get_keymaster1_dev(keymaster1_device_t** dev, const hw_module_t* mod) {
    int rc = keymaster1_open(mod, dev);
    if (rc) {
        ALOGE("Error %d opening keystore keymaster1 device", rc);
        if (*dev) {
            (*dev)->common.close(&(*dev)->common);
            *dev = nullptr;
        }
    }
    return rc;
}

static int get_keymaster2_dev(keymaster2_device_t** dev, const hw_module_t* mod) {
    int rc = keymaster2_open(mod, dev);
    if (rc) {
@@ -50,8 +63,14 @@ static IKeymasterDevice* createKeymaster3Device() {
        return ::keymaster::ng::CreateKeymasterDevice();
    }

    if (mod->module_api_version < KEYMASTER_MODULE_API_VERSION_2_0) {
    if (mod->module_api_version < KEYMASTER_MODULE_API_VERSION_1_0) {
        return nullptr;
    } else if (mod->module_api_version == KEYMASTER_MODULE_API_VERSION_1_0) {
        keymaster1_device_t* dev = nullptr;
        if (get_keymaster1_dev(&dev, mod)) {
            return nullptr;
        }
        return ::keymaster::ng::CreateKeymasterDevice(dev);
    } else {
        keymaster2_device_t* dev = nullptr;
        if (get_keymaster2_dev(&dev, mod)) {
+2 −5
Original line number Diff line number Diff line
@@ -36,10 +36,7 @@ cc_test {
    static_libs: [
        "android.hardware.keymaster@3.0",
        "libcrypto_static",
        "libpuresoftkeymasterdevice",
    ],
    test_suites: [
        "general-tests",
        "vts",
        "libsoftkeymasterdevice",
    ],
    test_suites: ["general-tests", "vts"],
}
+2 −2
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ cc_benchmark {
    static_libs: [
        "android.hardware.keymaster@4.0",
        "libkeymaster4support",
        "libpuresoftkeymasterdevice",
        "libchrome",
        "libsoftkeymasterdevice",
        "libchrome"
    ],
}