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

Commit a4b40020 authored by Jocelyn Bohr's avatar Jocelyn Bohr Committed by Gerrit Code Review
Browse files

Merge changes from topic 'trusty_km2_hal'

* changes:
  trusty: keymaster: update device tests to use 2.0 API
  trusty: keymaster: Implement abort
  trusty: keymaster: Implement finish
  trusty: keymaster: Implement update
  trusty: keymaster: Implement begin
  trusty: keymaster: Implement upgrade_key
  trusty: keymaster: Implement attest_key
  trusty: keymaster: Implement export_key
  trusty: keymaster: Implement import_key
  trusty: keymaster: Implement get_key_characteristics
  trusty: keymaster: Implement generate_key
  trusty: keymaster: Implement add_rng_entropy
  trusty: keymaster: Implement configure
  trusty: keymaster: Begin update from Keymaster 0.3 to 2.0
parents b37312a7 50206031
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE := trusty_keymaster_tipc
LOCAL_SRC_FILES := \
	trusty_keymaster_device.cpp \
	trusty_keymaster_ipc.c \
	trusty_keymaster_ipc.cpp \
	trusty_keymaster_main.cpp
LOCAL_SHARED_LIBRARIES := \
	libcrypto \
@@ -40,6 +40,7 @@ LOCAL_SHARED_LIBRARIES := \
	libkeymaster1 \
	libtrusty \
	libkeymaster_messages \
	libsoftkeymasterdevice \
	liblog

include $(BUILD_EXECUTABLE)
@@ -53,7 +54,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE := keystore.trusty
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SRC_FILES := module.cpp \
	trusty_keymaster_ipc.c \
	trusty_keymaster_ipc.cpp \
	trusty_keymaster_device.cpp
LOCAL_CLFAGS = -fvisibility=hidden -Wall -Werror
LOCAL_SHARED_LIBRARIES := \
+10 −5
Original line number Diff line number Diff line
@@ -16,11 +16,13 @@

#pragma once

// clang-format off

#define KEYMASTER_PORT "com.android.trusty.keymaster"
#define KEYMASTER_MAX_BUFFER_LENGTH 4096

// Commands
enum keymaster_command {
enum keymaster_command : uint32_t {
    KEYMASTER_RESP_BIT              = 1,
    KEYMASTER_REQ_SHIFT             = 1,

@@ -40,6 +42,9 @@ enum keymaster_command {
    KM_GET_SUPPORTED_IMPORT_FORMATS = (13 << KEYMASTER_REQ_SHIFT),
    KM_GET_SUPPORTED_EXPORT_FORMATS = (14 << KEYMASTER_REQ_SHIFT),
    KM_GET_KEY_CHARACTERISTICS      = (15 << KEYMASTER_REQ_SHIFT),
    KM_ATTEST_KEY                   = (16 << KEYMASTER_REQ_SHIFT),
    KM_UPGRADE_KEY                  = (17 << KEYMASTER_REQ_SHIFT),
    KM_CONFIGURE                    = (18 << KEYMASTER_REQ_SHIFT),
};

#ifdef __ANDROID__
+14 −13
Original line number Diff line number Diff line
@@ -26,14 +26,15 @@ using keymaster::TrustyKeymasterDevice;
/*
 * Generic device handling
 */
static int trusty_keymaster_open(const hw_module_t* module, const char* name,
                                 hw_device_t** device) {
    if (strcmp(name, KEYSTORE_KEYMASTER) != 0)
static int trusty_keymaster_open(const hw_module_t* module, const char* name, hw_device_t** device) {
    if (strcmp(name, KEYSTORE_KEYMASTER) != 0) {
        return -EINVAL;
    }

    TrustyKeymasterDevice* dev = new TrustyKeymasterDevice(module);
    if (dev == NULL)
    if (dev == NULL) {
        return -ENOMEM;
    }
    *device = dev->hw_device();
    // Do not delete dev; it will get cleaned up when the caller calls device->close(), and must
    // exist until then.
@@ -48,7 +49,7 @@ struct keystore_module HAL_MODULE_INFO_SYM __attribute__((visibility("default"))
    .common =
        {
            .tag = HARDWARE_MODULE_TAG,
         .module_api_version = KEYMASTER_MODULE_API_VERSION_0_3,
            .module_api_version = KEYMASTER_MODULE_API_VERSION_2_0,
            .hal_api_version = HARDWARE_HAL_API_VERSION,
            .id = KEYSTORE_HARDWARE_MODULE_ID,
            .name = "Trusty Keymaster HAL",
Loading