Skip to contentSkip to conversation

firmware: arm_firme: introduce FIRME support for host attestation

RFC PATCH New Yeoreum Yun 1 participant 7 messages Nov 27

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover firmware: arm_firme: introduce FIRME support for host attestation

The Arm Confidential Compute Architecture (CCA) introduces the Realm Management Extension (FEAT_RME), which enables the creation and management of dynamically allocated, attestable trusted execution environments known as Realms.

Realm management relies on EL3 firmware to provide services for Realm construction, resource allocation and isolation, and attestation of the initial Realm state.

The Firmware Interface for Realm Management Extensions (FIRME) [0] specification defines standard interfaces through which EL3 firmware provides these services. FIRME defines the following service groups:

- Granule Protection Table (GPT) management
- IDE key management for PCIe and CXL Root Ports
- Memory Encryption Context management
- Attestation Token management
- Integrated Device management

FIRME also defines a Base service that provides common functionality, including service discovery and feature discovery.

Although FIRME primarily supports Arm CCA, its interfaces can also be used on systems without FEAT_RME to provide firmware-based attestation and other security services.

This RFC patch series introduces the arm_firme, which provides the common APIs used to firme service driver implementation. each firme service driver would be implmented based on the smccc-bus with common APIs and add firme attestation provider with smccc driver.

This patch based on arm64/for-next/smccc-bus and attestation branch [1-3].

To: [email protected]
To: [email protected]
Cc: Lorenzo Pieralisi <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Suzuki Poulose <[email protected]>
Cc: Steven Price <[email protected]>
Cc: Sami Mujawar <[email protected]>
Cc: "Aneesh Kumar K.V" <[email protected]>
Cc: Jiri Pirko <[email protected]>
Cc: GONG Ruiqi <[email protected]>
Cc: Jason Gunthorpe <[email protected]>
Cc: Mark Brown <[email protected]>

---
Changes in RFCv2:
- rebase on the attestation infrastructure.
- librarise arm_firme.c from firme driver.
- add firme attestation provider.
- Link to RFCv1: https://lore.kernel.org/r/[email protected]

---
Yeoreum Yun (6):
firmware: arm-smccc: introduce match function
firmware: arm_firme: introduce arm_firme Documentation/ctlv: introduce ctlv-attestation-firme family
ctlv: add auto-generated files for ctlv-attestation-firme
attestation: providers: introduce FIRME attestation provider
selftest: attestation: add firme_attestation_test selftest

 Documentation/ctlv/abi/ctlv-attestation-firme.yaml |   19 +
 Documentation/ctlv/abi/families.registry.yaml      |    1 +
 Documentation/ctlv/families.yaml                   |    1 +
 Documentation/ctlv/generated-files.yaml            |   11 +
 .../ctlv/specs/ctlv-attestation-firme.yaml         |   20 +
 drivers/attestation/Kconfig                        |    9 +
 drivers/attestation/Makefile                       |    5 +
 .../generated/ctlv_attestation_firme_gen.c         |   64 +
 .../generated/ctlv_attestation_firme_gen.h         |   40 +
 drivers/attestation/providers/firme.c              |  292 ++++
 drivers/firmware/Kconfig                           |   36 +
 drivers/firmware/Makefile                          |    1 +
 drivers/firmware/arm_firme.c                       |  275 ++++
 drivers/firmware/smccc/bus.c                       |   24 +-
 drivers/firmware/smccc/smccc.c                     |    3 +-
 include/linux/arm-smccc-bus.h                      |    5 +-
 include/linux/arm-smccc.h                          |    1 +
 include/linux/arm_firme.h                          |  261 ++++
 include/uapi/ctlv/ctlv_attestation_firme_gen.h     |   34 +
 include/uapi/ctlv/ctlv_families_gen.h              |    1 +
 tools/testing/selftests/attestation/.gitignore     |    1 +
 tools/testing/selftests/attestation/Makefile       |   10 +-
 .../attestation/ctlv_attestation_firme_user_gen.c  | 1547 ++++++++++++++++++++
 .../attestation/ctlv_attestation_firme_user_gen.h  |   47 +
 .../selftests/attestation/firme_attestation_test.c |  232 +++
 25 files changed, 2928 insertions(+), 12 deletions(-)

---
base-commit: 7ff5e548abbc2312431d4eea9ad283347963a6e2
change-id: 20260729-firme_interface-75616c45a203

Best regards,

Signature · 2 lines
Sincerely,
Yeoreum Yun
#1 lore raw

RFC PATCH v2 1/6 firmware: arm-smccc: introduce match function

Somce of protocol based on the smc is not enough to match smccc-device and smccc-driver with func_id only.

For example, firme interface will create smccc-device per service and this requires to chech whether firme smccc-device is for each service.

To resolve this, add match function and match parameter for device which is set at the time of smccc-device creation so that smccc-driver could match proper smccc-device with match parameter and driver specific match function.

This match parameter is defined under smc func-id. IOW, devices which share the func-id should have the same type for module parameter so that each driver under the same func-id can check extra one with match parameter type.

---
 drivers/firmware/smccc/bus.c   | 24 ++++++++++++++++--------
 drivers/firmware/smccc/smccc.c |  3 ++-
 include/linux/arm-smccc-bus.h  |  5 ++++-
 3 files changed, 22 insertions(+), 10 deletions(-)
drivers/firmware/smccc/bus.c +16 -8
index 0357a7c48af0b..4a1182153bef8 100644
@@ -11,15 +11,20 @@ static int arm_smccc_bus_match(struct device *dev,
 {
 	const struct arm_smccc_device_id *id_table;
 	const struct arm_smccc_device *smccc_dev = to_arm_smccc_device(dev);
+	const struct arm_smccc_driver *smccc_drv = to_arm_smccc_driver(drv);
 
-	id_table = to_arm_smccc_driver(drv)->id_table;
+	id_table = smccc_drv->id_table;
 	if (!id_table)
 		return 0;
 
-	while (id_table->func_id) {
-		if (smccc_dev->func_id == id_table->func_id)
-			return 1;
-		id_table++;
+	for (; id_table->func_id; id_table++) {
+		if (smccc_dev->func_id != id_table->func_id)
+			continue;
+		if (!!smccc_dev->match_params != !!smccc_drv->match)
+			continue;
+		if (smccc_drv->match && !smccc_drv->match(smccc_dev))
+			continue;
+		return 1;
 	}
 
 	return 0;
@@ -103,7 +108,7 @@ static void arm_smccc_release_device(struct device *dev)
 	kfree(smccc_dev);
 }
 
-static struct device *arm_smccc_device_alloc(u32 func_id)
+static struct device *arm_smccc_device_alloc(u32 func_id, void *match_params)
 {
 	struct arm_smccc_device *smccc_dev;
 
@@ -112,6 +117,7 @@ static struct device *arm_smccc_device_alloc(u32 func_id)
 		return NULL;
 
 	smccc_dev->func_id = func_id;
+	smccc_dev->match_params = match_params;
 	smccc_dev->dev.bus = &arm_smccc_bus_type;
 	smccc_dev->dev.release = arm_smccc_release_device;
 	device_initialize(&smccc_dev->dev);
@@ -119,14 +125,16 @@ static struct device *arm_smccc_device_alloc(u32 func_id)
 	return &smccc_dev->dev;
 }
 
-struct arm_smccc_device *arm_smccc_device_register(const char *name, u32 func_id)
+struct arm_smccc_device *arm_smccc_device_register(const char *name, u32 func_id,
+						   void *match_params)
 {
 	int ret;
 
 	if (!name)
 		return ERR_PTR(-EINVAL);
 
-	struct device *dev __free(put_device) = arm_smccc_device_alloc(func_id);
+	struct device *dev __free(put_device) = arm_smccc_device_alloc(func_id,
+								       match_params);
 	if (!dev)
 		return ERR_PTR(-ENOMEM);
 
drivers/firmware/smccc/smccc.c +2 -1
index 5dc768ac4143a..93658120114d3 100644
@@ -136,7 +136,8 @@ static int __init smccc_devices_init(void)
 		if (!smccc_probe_smccc_device(smccc_dev))
 			continue;
 
-		sdev = arm_smccc_device_register(smccc_dev->device_name, smccc_dev->func_id);
+		sdev = arm_smccc_device_register(smccc_dev->device_name,
+						 smccc_dev->func_id, NULL);
 		if (IS_ERR(sdev))
 			pr_err("%s: could not register device: %pe\n",
 			       smccc_dev->device_name, sdev);
include/linux/arm-smccc-bus.h +4 -1
index 05c0c850510e0..b7b44c9b67ec3 100644
@@ -12,6 +12,7 @@
 struct arm_smccc_device {
 	struct device dev;
 	u32 func_id;
+	void *match_params;
 };
 
 #define to_arm_smccc_device(d) container_of_const(d, struct arm_smccc_device, dev)
@@ -22,6 +23,7 @@ struct arm_smccc_driver {
 	const char *name;
 	int (*probe)(struct arm_smccc_device *sdev);
 	void (*remove)(struct arm_smccc_device *sdev);
+	bool (*match)(const struct arm_smccc_device *sdev);
 	const struct arm_smccc_device_id *id_table;
 };
 
@@ -31,7 +33,8 @@ struct arm_smccc_driver {
 int arm_smccc_driver_register(struct arm_smccc_driver *driver,
 		struct module *owner, const char *mod_name);
 void arm_smccc_driver_unregister(struct arm_smccc_driver *driver);
-struct arm_smccc_device *arm_smccc_device_register(const char *name, u32 func_id);
+struct arm_smccc_device *arm_smccc_device_register(const char *name, u32 func_id,
+						   void *match_param);
 void arm_smccc_device_unregister(struct arm_smccc_device *smcc_dev);
 
 #define arm_smccc_register(driver) \
Signature · 1 line
2.43.0
#2 lore raw

RFC PATCH v2 2/6 firmware: arm_firme: introduce arm_firme

In reply to Yeoreum Yun

The Realm Management Extension (FEAT_RME) is part of Arm Confidential Compute Architecture (CCA) and enables support for dynamic, attestable trusted execution environments ("Realms") on Arm systems.

Realm management flows depend on EL3 firmware for operations such as Realm construction, resource allocation and isolation, and attestation of initial Realm state.

The FIRME defines standard interfaces provided by EL3 firmware to satisfy these dependencies. These interfaces include:

- Granule Protection Table management
- IDE key management for PCIe and CXL Root Ports
- Memory Encryption Context management
- Attestation token management
- Integrated device management

Each group of interfaces forms a FIRME service. A base FIRME service is also defined to provide common concepts, service discovery, and feature discovery across services.

FIRME interfaces are implemented at the EL3 boundary between the Non-secure, Realm, and Secure states. They may also be used on systems without FEAT_RME, for example to provide firmware-based attestation or security services.

arm_firme.c provides the common APIs to be used for FIRME device/driver to support for FIRME services

---
 drivers/firmware/Kconfig     |  36 ++++++
 drivers/firmware/Makefile    |   1 +
 drivers/firmware/arm_firme.c | 275 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/arm-smccc.h    |   1 +
 include/linux/arm_firme.h    | 261 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 574 insertions(+)
drivers/firmware/Kconfig +36 -0
index 43e2e2a645945..d031c36c44dcc 100644
@@ -60,6 +60,42 @@ config ARM_SDEI_NMI
 
 	  If unsure, say N.
 
+config ARM_FIRME
+	bool "Arm Firmware Interfaces for Realm Management Extension (FIRME)"
+	depends on ARM64 && HAVE_ARM_SMCCC_DISCOVERY
+	default n
+	help
+	  The Realm Management Extension (FEAT_RME) is part of Arm Confidential
+	  Compute Architecture (CCA) and enables support for dynamic, attestable
+	  trusted execution environments ("Realms") on Arm systems.
+
+	  Realm management flows depend on EL3 firmware for operations such as
+	  Realm construction, resource allocation and isolation, and attestation
+	  of initial Realm state.
+
+	  The FIRME defines standard interfaces provided by EL3 firmware to
+	  satisfy these dependencies. These interfaces include:
+
+	    - Granule Protection Table management
+	    - IDE key management for PCIe and CXL Root Ports
+	    - Memory Encryption Context management
+	    - Attestation token management
+	    - Integrated device management
+
+	  Each group of interfaces forms a FIRME service. A base FIRME service
+	  is also defined to provide common concepts, service discovery, and
+	  feature discovery across services.
+
+	  FIRME interfaces are implemented at the EL3 boundary between the
+	  Non-secure, Realm, and Secure states. They may also be used on
+	  systems without FEAT_RME, for example to provide firmware-based
+	  attestation or security services.
+
+	  This opions provides the common APIs used for FIRME service
+	  implementation driver.
+
+	  If unsure, say N.
+
 config EDD
 	tristate "BIOS Enhanced Disk Drive calls determine boot disk"
 	depends on X86
drivers/firmware/Makefile +1 -0
index 50b3383131522..2e217c6b80f26 100644
@@ -2,6 +2,7 @@
 #
 # Makefile for the linux kernel.
 #
+obj-$(CONFIG_ARM_FIRME)		+= arm_firme.o
 obj-$(CONFIG_ARM_SCPI_PROTOCOL)	+= arm_scpi.o
 obj-$(CONFIG_ARM_SDE_INTERFACE)	+= arm_sdei.o
 obj-$(CONFIG_ARM_SDEI_NMI)	+= arm_sdei_nmi.o
drivers/firmware/arm_firme.c new file +275 -0

275 lines not on this page · raw message

include/linux/arm-smccc.h +1 -0
index 4de81848fe2ee..ad6efb6d223a9 100644
@@ -70,6 +70,7 @@
 #define ARM_SMCCC_VERSION_1_1		0x10001
 #define ARM_SMCCC_VERSION_1_2		0x10002
 #define ARM_SMCCC_VERSION_1_3		0x10003
+#define ARM_SMCCC_VERSION_1_4		0x10004
 
 #define ARM_SMCCC_1_3_SVE_HINT		0x10000
 #define ARM_SMCCC_CALL_HINTS		ARM_SMCCC_1_3_SVE_HINT
include/linux/arm_firme.h new file +261 -0

261 lines not on this page · raw message

Signature · 1 line
2.43.0
#3 lore raw

RFC PATCH v2 3/6 Documentation/ctlv: introduce ctlv-attestation-firme family

In reply to Yeoreum Yun

Introduce ctlv-attestation-firme family and auto-generated abi files via make -C tools/ctlv regen.

---
 Documentation/ctlv/abi/ctlv-attestation-firme.yaml   | 19 +++++++++++++++++++
 Documentation/ctlv/abi/families.registry.yaml        |  1 +
 Documentation/ctlv/families.yaml                     |  1 +
 Documentation/ctlv/generated-files.yaml              | 11 +++++++++++
 Documentation/ctlv/specs/ctlv-attestation-firme.yaml | 20 ++++++++++++++++++++
 include/uapi/ctlv/ctlv_families_gen.h                |  1 +
 6 files changed, 53 insertions(+)
Documentation/ctlv/abi/ctlv-attestation-firme.yaml new file +19 -0
new file mode 100644
index 0000000000000..68acbd17b9341
@@ -0,0 +1,19 @@
+# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
+%YAML 1.2
+---
+# Checked-in ABI snapshot of the ctlv-attestation-firme family, from
+# Documentation/ctlv/specs/ctlv-attestation-firme.yaml, written by
+# "make -C tools/ctlv regen".
+#
+# Updating the file is how a UAPI change gets reviewed; an update that
+# removes or renumbers anything, narrows a bound, or makes a member required
+# is an ABI break, whatever the file says afterwards.
+family: {name: ctlv-attestation-firme, id: 6, inherits: ctlv-attestation}
+enums:
+  evidence-vendor-format: {platform-attestation-token: 1}
+records:
+  device-info:
+    id: 0x00010000
+    fields:
+      version: {number: 1, type: uint, max: s32-max}
+fills: {device-info: device-info}
Documentation/ctlv/abi/families.registry.yaml +1 -0
index 2146877a4f325..0784747a3ac87 100644
@@ -10,3 +10,4 @@ families:
   - ctlv-test
   - ctlv-test-child
   - ctlv-attestation-sim
+  - ctlv-attestation-firme
Documentation/ctlv/families.yaml +1 -0
index 1fd60280cf037..49121305e3282 100644
@@ -20,3 +20,4 @@ families:
   - ctlv-test
   - ctlv-test-child
   - ctlv-attestation-sim
+  - ctlv-attestation-firme
Documentation/ctlv/generated-files.yaml +11 -0
index 2621d9fbb8327..b286e28c2b5b7 100644
@@ -67,3 +67,14 @@ families:
         tools/testing/selftests/attestation/ctlv_attestation_sim_user_gen.h
       user-source: >-
         tools/testing/selftests/attestation/ctlv_attestation_sim_user_gen.c
+
+  - name: ctlv-attestation-firme
+    source: Documentation/ctlv/specs/ctlv-attestation-firme.yaml
+    outputs:
+      uapi-header: include/uapi/ctlv/ctlv_attestation_firme_gen.h
+      kernel-header: drivers/attestation/generated/ctlv_attestation_firme_gen.h
+      kernel-source: drivers/attestation/generated/ctlv_attestation_firme_gen.c
+      user-header: >-
+        tools/testing/selftests/attestation/ctlv_attestation_firme_user_gen.h
+      user-source: >-
+        tools/testing/selftests/attestation/ctlv_attestation_firme_user_gen.c
Documentation/ctlv/specs/ctlv-attestation-firme.yaml new file +20 -0
new file mode 100644
index 0000000000000..fdc8022851a43
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
+%YAML 1.2
+---
+#
+# The attestation device of FIRME for host: platform attestation token (PAT)
+#
+family: ctlv-attestation-firme
+inherits: ctlv-attestation
+
+enums:
+  # Fills ctlv-attestation's evidence-vendor-format.
+  evidence-vendor-format:
+    # platform attestation token.
+    - platform-attestation-token
+
+records:
+  # Fills ctlv-attestation's device-info.
+  device-info:
+    # FIRME attestation service version.
+    version: uint(..s32-max)
include/uapi/ctlv/ctlv_families_gen.h +1 -0
index c90f98173c706..e4c0b06a6d7eb 100644
@@ -17,6 +17,7 @@ enum _ctlv_family {
 	CTLV_FAMILY_TEST = 3,
 	CTLV_FAMILY_TEST_CHILD = 4,
 	CTLV_FAMILY_ATTESTATION_SIM = 5,
+	CTLV_FAMILY_ATTESTATION_FIRME = 6,
 };
 
 #endif /* _UAPI_CTLV_CTLV_FAMILIES_GEN_H */
Signature · 1 line
2.43.0
#4 lore raw

RFC PATCH v2 4/6 ctlv: add auto-generated files for ctlv-attestation-firme

In reply to Yeoreum Yun

Add auto-generated files for ctlv-attestation-firme via tools/ctlv/ctlv-regen.sh.

---
 .../generated/ctlv_attestation_firme_gen.c         |   64 +
 .../generated/ctlv_attestation_firme_gen.h         |   40 +
 include/uapi/ctlv/ctlv_attestation_firme_gen.h     |   34 +
 .../attestation/ctlv_attestation_firme_user_gen.c  | 1547 ++++++++++++++++++++
 .../attestation/ctlv_attestation_firme_user_gen.h  |   47 +
 5 files changed, 1732 insertions(+)
drivers/attestation/generated/ctlv_attestation_firme_gen.c new file +64 -0
new file mode 100644
index 0000000000000..9d3d7fc34f113
@@ -0,0 +1,64 @@
+// SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
+/*
+ * Generated from Documentation/ctlv/specs/ctlv-attestation-firme.yaml by
+ * tools/ctlv/ctlv-regen.sh. Do not edit.
+ */
+/* CTLV-GEN kernel source */
+
+#define _CTLV_GENERATED_METADATA_ONLY
+#include <linux/array_size.h>
+#include <linux/build_bug.h>
+#include <linux/ctlv_family.h>
+#include <linux/export.h>
+#include <linux/limits.h>
+
+#include <uapi/ctlv/ctlv_gen.h>
+#include <uapi/ctlv/ctlv_attestation_firme_gen.h>
+
+#include "ctlv_attestation_firme_gen.h"
+
+static const struct ctlv_node_schema device_info_fill_node_schemas[] = {
+	CTLV_NODE_SCHEMA_ROOT(1, 1, 1),
+	CTLV_NODE_SCHEMA_UINT(CTLV_ATTESTATION_FIRME_T_DEVICE_INFO_VERSION, 1, 0, S32_MAX),
+};
+
+/* The extension points this family fills. */
+static const struct ctlv_ext_fill_schema ctlv_attestation_firme_ext_fill_schemas[] = {
+	CTLV_EXT_FILL_SCHEMA(CTLV_FAMILY_ATTESTATION, CTLV_ATTESTATION_EXT_DEVICE_INFO,
+			     device_info),
+};
+
+/* The enum extension points this family fills. */
+static const struct ctlv_enum_fill_schema ctlv_attestation_firme_enum_fill_schemas[] = {
+	CTLV_ENUM_FILL_SCHEMA(CTLV_FAMILY_ATTESTATION,
+			      CTLV_ATTESTATION_ENUM_EXT_EVIDENCE_VENDOR_FORMAT, 1),
+};
+
+/* The family ID is its position in the central registry. */
+const struct ctlv_family_schema ctlv_attestation_firme_schema = {
+	.name = "ctlv-attestation-firme",
+	.family_id = 6,
+	.ext_fill_schemas = ctlv_attestation_firme_ext_fill_schemas,
+	.ext_fill_schemas_count = ARRAY_SIZE(ctlv_attestation_firme_ext_fill_schemas),
+	.enum_fill_schemas = ctlv_attestation_firme_enum_fill_schemas,
+	.enum_fill_schemas_count = ARRAY_SIZE(ctlv_attestation_firme_enum_fill_schemas),
+};
+
+/* Maximum uevent cost for this family chain. */
+static_assert(154 <= CTLV_UEVENT_MAX_LEN);
+static_assert(5 <= CTLV_UEVENT_MAX_VARS);
+
+/* Extension-point callbacks. */
+static const struct ctlv_ext_ops ctlv_attestation_firme_ext_ops[] = {
+	CTLV_EXT_OPS(CTLV_FAMILY_ATTESTATION, CTLV_ATTESTATION_EXT_DEVICE_INFO,
+		     ctlv_attestation_firme_device_info),
+};
+
+/* Family descriptor used by ctlv_init(). */
+const struct ctlv_family ctlv_attestation_firme_family = {
+	.schema = &ctlv_attestation_firme_schema,
+	.parent = &ctlv_attestation_family,
+	.ext_ops = ctlv_attestation_firme_ext_ops,
+	.ext_ops_count = ARRAY_SIZE(ctlv_attestation_firme_ext_ops),
+};
+EXPORT_SYMBOL_NS_GPL(ctlv_attestation_firme_family, "CTLV");
drivers/attestation/generated/ctlv_attestation_firme_gen.h new file +40 -0
new file mode 100644
index 0000000000000..fc2f57cae368e
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
+/*
+ * Generated from Documentation/ctlv/specs/ctlv-attestation-firme.yaml by
+ * tools/ctlv/ctlv-regen.sh. Do not edit.
+ */
+/* CTLV-GEN kernel header */
+
+/* Kernel metadata and family API of the ctlv-attestation-firme CTLV family. */
+
+#ifndef _LINUX_CTLV_ATTESTATION_FIRME_GEN_H
+#define _LINUX_CTLV_ATTESTATION_FIRME_GEN_H
+
+#include <linux/ctlv_family.h>
+#include <linux/err.h>
+#include <linux/errno.h>
+
+#include <uapi/ctlv/ctlv_attestation_firme_gen.h>
+
+#include "ctlv_attestation_gen.h"
+
+extern const struct ctlv_family_schema ctlv_attestation_firme_schema;
+
+/* device-info of ctlv-attestation: fill and read callbacks. */
+int ctlv_attestation_firme_device_info_fill(struct ctlv *ctlv, struct ctlv_op_ctx *ctx,
+					    const struct ctlv_cursor *request,
+					    struct ctlv_cursor *record);
+void ctlv_attestation_firme_device_info_read(struct ctlv *ctlv, struct ctlv_op_ctx *ctx,
+					     const struct ctlv_cursor *record);
+
+extern const struct ctlv_family ctlv_attestation_firme_family;
+
+#ifndef _CTLV_GENERATED_METADATA_ONLY
+
+/* Writing a reply. An append is atomic; a record ends with ctlv_record_end(). */
+/* FIRME attestation service version. */
+CTLV_PUT_U64(ctlv_attestation_firme_device_info_version,
+	     CTLV_ATTESTATION_FIRME_T_DEVICE_INFO_VERSION, CTLV_SCHEMA_UINT)
+#endif /* _CTLV_GENERATED_METADATA_ONLY */
+
+#endif /* _LINUX_CTLV_ATTESTATION_FIRME_GEN_H */
include/uapi/ctlv/ctlv_attestation_firme_gen.h new file +34 -0
new file mode 100644
index 0000000000000..d030733e0c5e6
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
+/*
+ * Generated from Documentation/ctlv/specs/ctlv-attestation-firme.yaml by
+ * tools/ctlv/ctlv-regen.sh. Do not edit.
+ */
+/* CTLV-GEN uapi header */
+
+/*
+ * Constants of the ctlv-attestation-firme CTLV family. Types and op IDs are complete; the message
+ * format carrying them is in <ctlv/ctlv.h>.
+ *
+ * The inherited ctlv-attestation header is included here, so one include covers the whole effective
+ * schema.
+ */
+
+#ifndef _UAPI_CTLV_CTLV_ATTESTATION_FIRME_GEN_H
+#define _UAPI_CTLV_CTLV_ATTESTATION_FIRME_GEN_H
+
+#include <ctlv/ctlv.h>
+#include <ctlv/ctlv_attestation_gen.h>
+#include <ctlv/ctlv_families_gen.h>
+
+/* enum evidence-vendor-format, an extension point of ctlv-attestation */
+enum _ctlv_attestation_firme_evidence_vendor_format {
+	/* platform attestation token. */
+	CTLV_ATTESTATION_FIRME_EVIDENCE_VENDOR_FORMAT_PLATFORM_ATTESTATION_TOKEN = 1,
+};
+
+/* device-info */
+/* FIRME attestation service version. */
+#define CTLV_ATTESTATION_FIRME_T_DEVICE_INFO_VERSION \
+	CTLV_TYPE(CTLV_FAMILY_ATTESTATION_FIRME, 0x00010000, 1)
+
+#endif /* _UAPI_CTLV_CTLV_ATTESTATION_FIRME_GEN_H */
tools/testing/selftests/attestation/ctlv_attestation_firme_user_gen.c new file +1547 -0

1,547 lines not on this page · raw message

tools/testing/selftests/attestation/ctlv_attestation_firme_user_gen.h new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
2.43.0
#5 lore raw

RFC PATCH v2 5/6 attestation: providers: introduce FIRME attestation provider

In reply to Yeoreum Yun

Introduce FIRME attestation provider for retrieving an attestation token for host.

When a evidence-get is requested, firme attestation provider invokes the appropriate FIRME interfaces to query an attestation token.

The steps to retrieve an attestation token are as follows:

---
 drivers/attestation/Kconfig           |   9 ++
 drivers/attestation/Makefile          |   5 +
 drivers/attestation/providers/firme.c | 292 ++++++++++++++++++++++++++++++++++
 3 files changed, 306 insertions(+)
drivers/attestation/Kconfig +9 -0
index e9c1d7865f2a0..e2391ef4aee2d 100644
@@ -43,4 +43,13 @@ config ATTESTATION_SIM
 
 	  If you are unsure, say N.
 
+config ATTESTATION_FIRME
+	tristate "FIRME attestation provider"
+	depends on ARM_FIRME
+	help
+	  Exposes FIRME platform token get (PAT) operations through the common
+	  attestation CTLV family.
+
+	  If you are unsure, say N.
+
 endif # ATTESTATION
drivers/attestation/Makefile +5 -0
index 448fe4a3856d4..2c7a1a09daaed 100644
@@ -12,3 +12,8 @@ obj-$(CONFIG_ATTESTATION_SIM) += attestation-sim.o
 
 attestation-sim-y := providers/sim.o \
 		     generated/ctlv_attestation_sim_gen.o
+
+obj-$(CONFIG_ATTESTATION_FIRME) += attestation-firme.o
+
+attestation-firme-y := providers/firme.o \
+		       generated/ctlv_attestation_firme_gen.o
drivers/attestation/providers/firme.c new file +292 -0

292 lines not on this page · raw message

Signature · 1 line
2.43.0
#6 lore raw

RFC PATCH v2 6/6 selftest: attestation: add firme_attestation_test selftest

In reply to Yeoreum Yun

Add firme attestation selftest to test evidence-get interface for getting platform attestation token.

---
 tools/testing/selftests/attestation/.gitignore     |   1 +
 tools/testing/selftests/attestation/Makefile       |  10 +-
 .../selftests/attestation/firme_attestation_test.c | 232 +++++++++++++++++++++
 3 files changed, 241 insertions(+), 2 deletions(-)
tools/testing/selftests/attestation/.gitignore +1 -0
index 8f2cf420b7c19..e10d0c9e4723c 100644
@@ -2,3 +2,4 @@
 attestation_test
 ima_attestation_test
 tdx_attestation_test
+firme_attestation_test
tools/testing/selftests/attestation/Makefile +8 -2
index eb35544afef6f..d4875652b4a14 100644
@@ -3,12 +3,14 @@ CFLAGS += -Wall -O2 $(KHDR_INCLUDES)
 CFLAGS += -I../../../ctlv/libctlv
 LDLIBS += -lpthread
 
-TEST_GEN_PROGS := attestation_test ima_attestation_test tdx_attestation_test
+TEST_GEN_PROGS := attestation_test ima_attestation_test tdx_attestation_test \
+		  firme_attestation_test
 
 LIBCTLV_DIR := ../../../ctlv/libctlv
 BINDINGS := ctlv_attestation_user_gen.c \
 	    ctlv_attestation_sim_user_gen.c \
-	    ctlv_attestation_tdx_user_gen.c
+	    ctlv_attestation_tdx_user_gen.c \
+	    ctlv_attestation_firme_user_gen.c
 
 EXTRA_CLEAN = $(OUTPUT)/libctlv
 
@@ -25,6 +27,9 @@ $(OUTPUT)/ima_attestation_test: ima_attestation_test.c $(BINDINGS) $(LIBCTLV)
 $(OUTPUT)/tdx_attestation_test: tdx_attestation_test.c $(BINDINGS) $(LIBCTLV)
 	$(CC) $(CFLAGS) $(CPPFLAGS) $^ $(LDLIBS) -o $@
 
+$(OUTPUT)/firme_attestation_test: firme_attestation_test.c $(BINDINGS) $(LIBCTLV)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $^ $(LDLIBS) -o $@
+
 $(LIBCTLV): FORCE
 	$(Q)mkdir -p $(OUTPUT)/libctlv
 	$(Q)$(MAKE) -C $(LIBCTLV_DIR) CC="$(CC)" OUTPUT=$(OUTPUT)/libctlv/ \
@@ -33,3 +38,4 @@ $(LIBCTLV): FORCE
 FORCE:
 
 .PHONY: FORCE
+
tools/testing/selftests/attestation/firme_attestation_test.c new file +232 -0

232 lines not on this page · raw message

Signature · 1 line
2.43.0