Skip to contentSkip to conversation

Extend "trusted" keys to support a new trust source named the PowerVM Key Wrapping Module (PKWM)

PATCH In review Srish Srinivasan 3 participants 11 messages Feb 1 – Feb 27

Subsystems (7)
lore
Share & tools
lore

Srish Srinivasan

author maintainer
#0 lore raw

v6 cover Extend "trusted" keys to support a new trust source named the PowerVM Key Wrapping Module (PKWM)

Power11 has introduced a feature called the PowerVM Key Wrapping Module (PKWM), where PowerVM in combination with Power LPAR Platform KeyStore (PLPKS) [1] supports a new feature called "Key Wrapping" [2] to protect user secrets by wrapping them using a hypervisor generated wrapping key. This wrapping key is an AES-GCM-256 symmetric key that is stored as an object in the PLPKS. It has policy based protections that prevents it from being read out or exposed to the user. This wrapping key can then be used by the OS to wrap or unwrap secrets via hypervisor calls.

This patchset intends to add the PKWM, which is a combination of IBM PowerVM and PLPKS, as a new trust source for trusted keys. The wrapping key does not exist by default and its generation is requested by the kernel at the time of PKWM initialization. This key is then persisted by the PKWM and is used for wrapping any kernel provided key, and is never exposed to the user. The kernel is aware of only the label to this wrapping key.

Along with the PKWM implementation, this patchset includes two preparatory
patches: one fixing the kernel-doc inconsistencies in the PLPKS code and another reorganizing PLPKS config variables in the sysfs.

Changelog:

v6:

* Patch 1 to Patch 3:
- Add Nayna's Tested-by tag
* Patch 4
- Fix build error reported by kernel test robot <[email protected]>
- Add Nayna's Tested-by tag
* Patch 5
- Add Nayna's Tested-by tag

v5:

* Patch 1 to Patch 3:
- Add Nayna's Reviewed-by tag
* Patch 4:
- Fix build error identified by [email protected]
- Add Nayna's Reviewed-by tag
* Patch 5:
- Add Reviewed-by tags from Nayna and Jarkko

v4:

* Patch 5:
- Add a per-backend private data pointer in trusted_key_options to store a pointer to the backend-specific options structure
- Minor clean-up

v3:

* Patch 2:
- Add Mimi's Reviewed-by tag
* Patch 4:
- Minor tweaks to some print statements
- Fix typos
* Patch 5:
- Fix typos
- Add Mimi's Reviewed-by tag
* Patch 6:
- Add Mimi's Reviewed-by tag

v2:

* Patch 2:
- Fix build warning detected by the kernel test bot
* Patch 5:
- Use pr_debug inside dump_options
- Replace policyhande with wrap_flags inside dump_options
- Provide meaningful error messages with error codes

Nayna Jain (1):
docs: trusted-encryped: add PKWM as a new trust source

Srish Srinivasan (5):
pseries/plpks: fix kernel-doc comment inconsistencies powerpc/pseries: move the PLPKS config inside its own sysfs directory pseries/plpks: expose PowerVM wrapping features via the sysfs pseries/plpks: add HCALLs for PowerVM Key Wrapping Module keys/trusted_keys: establish PKWM as a trusted source

 .../ABI/testing/sysfs-firmware-plpks          |  58 ++
 Documentation/ABI/testing/sysfs-secvar        |  65 --
 .../admin-guide/kernel-parameters.txt         |   1 +
 Documentation/arch/powerpc/papr_hcalls.rst    |  43 ++
 .../security/keys/trusted-encrypted.rst       |  50 ++
 MAINTAINERS                                   |   9 +
 arch/powerpc/include/asm/hvcall.h             |   4 +-
 arch/powerpc/include/asm/plpks.h              |  95 +--
 arch/powerpc/include/asm/secvar.h             |   1 -
 arch/powerpc/kernel/secvar-sysfs.c            |  21 +-
 arch/powerpc/platforms/pseries/Makefile       |   2 +-
 arch/powerpc/platforms/pseries/plpks-secvar.c |  29 -
 arch/powerpc/platforms/pseries/plpks-sysfs.c  |  96 +++
 arch/powerpc/platforms/pseries/plpks.c        | 688 +++++++++++++++++-
 include/keys/trusted-type.h                   |   7 +-
 include/keys/trusted_pkwm.h                   |  33 +
 security/keys/trusted-keys/Kconfig            |   8 +
 security/keys/trusted-keys/Makefile           |   2 +
 security/keys/trusted-keys/trusted_core.c     |   6 +-
 security/keys/trusted-keys/trusted_pkwm.c     | 190 +++++
 20 files changed, 1207 insertions(+), 201 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-firmware-plpks
 create mode 100644 arch/powerpc/platforms/pseries/plpks-sysfs.c
 create mode 100644 include/keys/trusted_pkwm.h
 create mode 100644 security/keys/trusted-keys/trusted_pkwm.c
Signature · 1 line
2.47.3
author maintainer
#3 lore raw

PATCH v6 3/6 pseries/plpks: expose PowerVM wrapping features via the sysfs

Starting with Power11, PowerVM supports a new feature called "Key Wrapping" that protects user secrets by wrapping them using a hypervisor generated wrapping key. The status of this feature can be read by the H_PKS_GET_CONFIG HCALL.

Expose the Power LPAR Platform KeyStore (PLPKS) wrapping features config via the sysfs file /sys/firmware/plpks/config/wrapping_features.

---
 .../ABI/testing/sysfs-firmware-plpks          |  8 ++++++++
 arch/powerpc/include/asm/hvcall.h             |  4 +++-
 arch/powerpc/include/asm/plpks.h              |  3 +++
 arch/powerpc/platforms/pseries/plpks-sysfs.c  |  2 ++
 arch/powerpc/platforms/pseries/plpks.c        | 20 +++++++++++++++++++
 5 files changed, 36 insertions(+), 1 deletion(-)
Documentation/ABI/testing/sysfs-firmware-plpks +8 -0
index af0353f34115..cba061e4eee2 100644
@@ -48,3 +48,11 @@ Description:	Bitmask of flags indicating which algorithms the hypervisor
 		supports for signed update of objects, represented as a 16 byte
 		hexadecimal ASCII string. Consult the hypervisor documentation
 		for what these flags mean.
+
+What:		/sys/firmware/plpks/config/wrapping_features
+Date:		November 2025
+Contact:	Srish Srinivasan <[email protected]>
+Description:	Bitmask of the wrapping features indicating the wrapping
+		algorithms that are supported for the H_PKS_WRAP_OBJECT requests
+		, represented as a 8 byte hexadecimal ASCII string. Consult the
+		hypervisor documentation for what these flags mean.
arch/powerpc/include/asm/hvcall.h +3 -1
index 9aef16149d92..dff90a7d7f70 100644
@@ -360,7 +360,9 @@
 #define H_GUEST_RUN_VCPU	0x480
 #define H_GUEST_COPY_MEMORY	0x484
 #define H_GUEST_DELETE		0x488
-#define MAX_HCALL_OPCODE	H_GUEST_DELETE
+#define H_PKS_WRAP_OBJECT	0x490
+#define H_PKS_UNWRAP_OBJECT	0x494
+#define MAX_HCALL_OPCODE	H_PKS_UNWRAP_OBJECT
 
 /* Scope args for H_SCM_UNBIND_ALL */
 #define H_UNBIND_SCOPE_ALL (0x1)
arch/powerpc/include/asm/plpks.h +3 -0
index 8829a13bfda0..8f034588fdf7 100644
@@ -23,6 +23,7 @@
 #define PLPKS_IMMUTABLE		PPC_BIT32(5) // Once written, object cannot be removed
 #define PLPKS_TRANSIENT		PPC_BIT32(6) // Object does not persist through reboot
 #define PLPKS_SIGNEDUPDATE	PPC_BIT32(7) // Object can only be modified by signed updates
+#define PLPKS_WRAPPINGKEY	PPC_BIT32(8) // Object contains a wrapping key
 #define PLPKS_HVPROVISIONED	PPC_BIT32(28) // Hypervisor has provisioned this object
 
 // Signature algorithm flags from signed_update_algorithms
@@ -103,6 +104,8 @@ u32 plpks_get_maxlargeobjectsize(void);
 
 u64 plpks_get_signedupdatealgorithms(void);
 
+u64 plpks_get_wrappingfeatures(void);
+
 u16 plpks_get_passwordlen(void);
 
 void plpks_early_init_devtree(void);
arch/powerpc/platforms/pseries/plpks-sysfs.c +2 -0
index 01d526185783..c2ebcbb41ae3 100644
@@ -30,6 +30,7 @@ PLPKS_CONFIG_ATTR(used_space, "%u\n", plpks_get_usedspace);
 PLPKS_CONFIG_ATTR(supported_policies, "%08x\n", plpks_get_supportedpolicies);
 PLPKS_CONFIG_ATTR(signed_update_algorithms, "%016llx\n",
 		  plpks_get_signedupdatealgorithms);
+PLPKS_CONFIG_ATTR(wrapping_features, "%016llx\n", plpks_get_wrappingfeatures);
 
 static const struct attribute *config_attrs[] = {
 	&attr_version.attr,
@@ -38,6 +39,7 @@ static const struct attribute *config_attrs[] = {
 	&attr_used_space.attr,
 	&attr_supported_policies.attr,
 	&attr_signed_update_algorithms.attr,
+	&attr_wrapping_features.attr,
 	NULL,
 };
 
arch/powerpc/platforms/pseries/plpks.c +20 -0
index 03722fabf9c3..4a08f51537c8 100644
@@ -38,6 +38,7 @@ static u32 usedspace;
 static u32 supportedpolicies;
 static u32 maxlargeobjectsize;
 static u64 signedupdatealgorithms;
+static u64 wrappingfeatures;
 
 struct plpks_auth {
 	u8 version;
@@ -248,6 +249,7 @@ static int _plpks_get_config(void)
 		__be32 supportedpolicies;
 		__be32 maxlargeobjectsize;
 		__be64 signedupdatealgorithms;
+		__be64 wrappingfeatures;
 		u8 rsvd1[476];
 	} __packed * config;
 	size_t size;
@@ -280,6 +282,7 @@ static int _plpks_get_config(void)
 	supportedpolicies = be32_to_cpu(config->supportedpolicies);
 	maxlargeobjectsize = be32_to_cpu(config->maxlargeobjectsize);
 	signedupdatealgorithms = be64_to_cpu(config->signedupdatealgorithms);
+	wrappingfeatures = be64_to_cpu(config->wrappingfeatures);
 
 	// Validate that the numbers we get back match the requirements of the spec
 	if (maxpwsize < 32) {
@@ -472,6 +475,23 @@ u64 plpks_get_signedupdatealgorithms(void)
 	return signedupdatealgorithms;
 }
 
+/**
+ * plpks_get_wrappingfeatures() - Returns a bitmask of the wrapping features
+ * supported by the hypervisor.
+ *
+ * Successful execution of the H_PKS_GET_CONFIG HCALL during initialization
+ * reads a bitmask of the wrapping features supported by the hypervisor into the
+ * file local static wrappingfeatures variable. This is valid only when the
+ * PLPKS config structure version >= 3.
+ *
+ * Return:
+ *	bitmask of the wrapping features supported by the hypervisor
+ */
+u64 plpks_get_wrappingfeatures(void)
+{
+	return wrappingfeatures;
+}
+
 /**
  * plpks_get_passwordlen() - Get the length of the PLPKS password in bytes.
  *
Signature · 1 line
2.47.3
author maintainer
#1 lore raw

PATCH v6 1/6 pseries/plpks: fix kernel-doc comment inconsistencies

In reply to Srish Srinivasan

Fix issues with comments for all the applicable functions to be consistent with kernel-doc format. Move them before the function definition as opposed to the function prototype.

---
 arch/powerpc/include/asm/plpks.h       |  77 ------
 arch/powerpc/platforms/pseries/plpks.c | 328 ++++++++++++++++++++++++-
 2 files changed, 318 insertions(+), 87 deletions(-)
arch/powerpc/include/asm/plpks.h +0 -77
index 7a84069759b0..f303922bf622 100644
@@ -67,122 +67,45 @@ struct plpks_var_name_list {
 	struct plpks_var_name varlist[];
 };
 
-/**
- * Updates the authenticated variable. It expects NULL as the component.
- */
 int plpks_signed_update_var(struct plpks_var *var, u64 flags);
 
-/**
- * Writes the specified var and its data to PKS.
- * Any caller of PKS driver should present a valid component type for
- * their variable.
- */
 int plpks_write_var(struct plpks_var var);
 
-/**
- * Removes the specified var and its data from PKS.
- */
 int plpks_remove_var(char *component, u8 varos,
 		     struct plpks_var_name vname);
 
-/**
- * Returns the data for the specified os variable.
- *
- * Caller must allocate a buffer in var->data with length in var->datalen.
- * If no buffer is provided, var->datalen will be populated with the object's
- * size.
- */
 int plpks_read_os_var(struct plpks_var *var);
 
-/**
- * Returns the data for the specified firmware variable.
- *
- * Caller must allocate a buffer in var->data with length in var->datalen.
- * If no buffer is provided, var->datalen will be populated with the object's
- * size.
- */
 int plpks_read_fw_var(struct plpks_var *var);
 
-/**
- * Returns the data for the specified bootloader variable.
- *
- * Caller must allocate a buffer in var->data with length in var->datalen.
- * If no buffer is provided, var->datalen will be populated with the object's
- * size.
- */
 int plpks_read_bootloader_var(struct plpks_var *var);
 
-/**
- * Returns if PKS is available on this LPAR.
- */
 bool plpks_is_available(void);
 
-/**
- * Returns version of the Platform KeyStore.
- */
 u8 plpks_get_version(void);
 
-/**
- * Returns hypervisor storage overhead per object, not including the size of
- * the object or label. Only valid for config version >= 2
- */
 u16 plpks_get_objoverhead(void);
 
-/**
- * Returns maximum password size. Must be >= 32 bytes
- */
 u16 plpks_get_maxpwsize(void);
 
-/**
- * Returns maximum object size supported by Platform KeyStore.
- */
 u16 plpks_get_maxobjectsize(void);
 
-/**
- * Returns maximum object label size supported by Platform KeyStore.
- */
 u16 plpks_get_maxobjectlabelsize(void);
 
-/**
- * Returns total size of the configured Platform KeyStore.
- */
 u32 plpks_get_totalsize(void);
 
-/**
- * Returns used space from the total size of the Platform KeyStore.
- */
 u32 plpks_get_usedspace(void);
 
-/**
- * Returns bitmask of policies supported by the hypervisor.
- */
 u32 plpks_get_supportedpolicies(void);
 
-/**
- * Returns maximum byte size of a single object supported by the hypervisor.
- * Only valid for config version >= 3
- */
 u32 plpks_get_maxlargeobjectsize(void);
 
-/**
- * Returns bitmask of signature algorithms supported for signed updates.
- * Only valid for config version >= 3
- */
 u64 plpks_get_signedupdatealgorithms(void);
 
-/**
- * Returns the length of the PLPKS password in bytes.
- */
 u16 plpks_get_passwordlen(void);
 
-/**
- * Called in early init to retrieve and clear the PLPKS password from the DT.
- */
 void plpks_early_init_devtree(void);
 
-/**
- * Populates the FDT with the PLPKS password to prepare for kexec.
- */
 int plpks_populate_fdt(void *fdt);
 #else // CONFIG_PSERIES_PLPKS
 static inline bool plpks_is_available(void) { return false; }
arch/powerpc/platforms/pseries/plpks.c +318 -10

437 lines not on this page · raw message

Signature · 1 line
2.47.3
author maintainer
#2 lore raw

PATCH v6 2/6 powerpc/pseries: move the PLPKS config inside its own sysfs directory

In reply to Srish Srinivasan

The /sys/firmware/secvar/config directory represents Power LPAR Platform KeyStore (PLPKS) configuration properties such as max_object_size, signed_ update_algorithms, supported_policies, total_size, used_space, and version. These attributes describe the PLPKS, and not the secure boot variables (secvars).

Create /sys/firmware/plpks directory and move the PLPKS config inside this directory. For backwards compatibility, create a soft link from the secvar sysfs directory to this config and emit a warning stating that the older sysfs path has been deprecated. Separate out the plpks specific documentation from secvar.

---
 .../ABI/testing/sysfs-firmware-plpks          | 50 ++++++++++
 Documentation/ABI/testing/sysfs-secvar        | 65 -------------
 arch/powerpc/include/asm/plpks.h              |  5 +
 arch/powerpc/include/asm/secvar.h             |  1 -
 arch/powerpc/kernel/secvar-sysfs.c            | 21 ++---
 arch/powerpc/platforms/pseries/Makefile       |  2 +-
 arch/powerpc/platforms/pseries/plpks-secvar.c | 29 ------
 arch/powerpc/platforms/pseries/plpks-sysfs.c  | 94 +++++++++++++++++++
 8 files changed, 156 insertions(+), 111 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-firmware-plpks
 create mode 100644 arch/powerpc/platforms/pseries/plpks-sysfs.c
Documentation/ABI/testing/sysfs-firmware-plpks new file +50 -0
new file mode 100644
index 000000000000..af0353f34115
@@ -0,0 +1,50 @@
+What:		/sys/firmware/plpks/config
+Date:		February 2023
+Contact:	Nayna Jain <[email protected]>
+Description:	This optional directory contains read-only config attributes as
+		defined by the PLPKS implementation. All data is in ASCII
+		format.
+
+What:		/sys/firmware/plpks/config/version
+Date:		February 2023
+Contact:	Nayna Jain <[email protected]>
+Description:	Config version as reported by the hypervisor in ASCII decimal
+		format.
+
+What:		/sys/firmware/plpks/config/max_object_size
+Date:		February 2023
+Contact:	Nayna Jain <[email protected]>
+Description:	Maximum allowed size of	objects in the keystore in bytes,
+		represented in ASCII decimal format.
+
+		This is not necessarily the same as the max size that can be
+		written to an update file as writes can contain more than
+		object data, you should use the size of the update file for
+		that purpose.
+
+What:		/sys/firmware/plpks/config/total_size
+Date:		February 2023
+Contact:	Nayna Jain <[email protected]>
+Description:	Total size of the PLPKS in bytes, represented in ASCII decimal
+		format.
+
+What:		/sys/firmware/plpks/config/used_space
+Date:		February 2023
+Contact:	Nayna Jain <[email protected]>
+Description:	Current space consumed by the key store, in bytes, represented
+		in ASCII decimal format.
+
+What:		/sys/firmware/plpks/config/supported_policies
+Date:		February 2023
+Contact:	Nayna Jain <[email protected]>
+Description:	Bitmask of supported policy flags by the hypervisor, represented
+		as an 8 byte hexadecimal ASCII string. Consult the hypervisor
+		documentation for what these flags are.
+
+What:		/sys/firmware/plpks/config/signed_update_algorithms
+Date:		February 2023
+Contact:	Nayna Jain <[email protected]>
+Description:	Bitmask of flags indicating which algorithms the hypervisor
+		supports for signed update of objects, represented as a 16 byte
+		hexadecimal ASCII string. Consult the hypervisor documentation
+		for what these flags mean.
Documentation/ABI/testing/sysfs-secvar +0 -65

68 lines not on this page · raw message

arch/powerpc/include/asm/plpks.h +5 -0
index f303922bf622..8829a13bfda0 100644
@@ -13,6 +13,7 @@
 
 #include <linux/types.h>
 #include <linux/list.h>
+#include <linux/kobject.h>
 
 // Object policy flags from supported_policies
 #define PLPKS_OSSECBOOTAUDIT	PPC_BIT32(1) // OS secure boot must be audit/enforce
@@ -107,11 +108,15 @@ u16 plpks_get_passwordlen(void);
 void plpks_early_init_devtree(void);
 
 int plpks_populate_fdt(void *fdt);
+
+int plpks_config_create_softlink(struct kobject *from);
 #else // CONFIG_PSERIES_PLPKS
 static inline bool plpks_is_available(void) { return false; }
 static inline u16 plpks_get_passwordlen(void) { BUILD_BUG(); }
 static inline void plpks_early_init_devtree(void) { }
 static inline int plpks_populate_fdt(void *fdt) { BUILD_BUG(); }
+static inline int plpks_config_create_softlink(struct kobject *from)
+						{ return 0; }
 #endif // CONFIG_PSERIES_PLPKS
 
 #endif // _ASM_POWERPC_PLPKS_H
arch/powerpc/include/asm/secvar.h +0 -1
index 4828e0ab7e3c..fd5006307f2a 100644
@@ -20,7 +20,6 @@ struct secvar_operations {
 	int (*set)(const char *key, u64 key_len, u8 *data, u64 data_size);
 	ssize_t (*format)(char *buf, size_t bufsize);
 	int (*max_size)(u64 *max_size);
-	const struct attribute **config_attrs;
 
 	// NULL-terminated array of fixed variable names
 	// Only used if get_next() isn't provided
arch/powerpc/kernel/secvar-sysfs.c +6 -15
index ec900bce0257..4111b21962eb 100644
@@ -12,6 +12,7 @@
 #include <linux/string.h>
 #include <linux/of.h>
 #include <asm/secvar.h>
+#include <asm/plpks.h>
 
 #define NAME_MAX_SIZE	   1024
 
@@ -145,19 +146,6 @@ static __init int update_kobj_size(void)
 	return 0;
 }
 
-static __init int secvar_sysfs_config(struct kobject *kobj)
-{
-	struct attribute_group config_group = {
-		.name = "config",
-		.attrs = (struct attribute **)secvar_ops->config_attrs,
-	};
-
-	if (secvar_ops->config_attrs)
-		return sysfs_create_group(kobj, &config_group);
-
-	return 0;
-}
-
 static __init int add_var(const char *name)
 {
 	struct kobject *kobj;
@@ -260,12 +248,15 @@ static __init int secvar_sysfs_init(void)
 		goto err;
 	}
 
-	rc = secvar_sysfs_config(secvar_kobj);
+	rc = plpks_config_create_softlink(secvar_kobj);
 	if (rc) {
-		pr_err("Failed to create config directory\n");
+		pr_err("Failed to create softlink to PLPKS config directory");
 		goto err;
 	}
 
+	pr_info("/sys/firmware/secvar/config is now deprecated.\n");
+	pr_info("Will be removed in future versions.\n");
+
 	if (secvar_ops->get_next)
 		rc = secvar_sysfs_load();
 	else
arch/powerpc/platforms/pseries/Makefile +1 -1
index 931ebaa474c8..3ced289a675b 100644
@@ -30,7 +30,7 @@ obj-$(CONFIG_PAPR_SCM)		+= papr_scm.o
 obj-$(CONFIG_PPC_SPLPAR)	+= vphn.o
 obj-$(CONFIG_PPC_SVM)		+= svm.o
 obj-$(CONFIG_FA_DUMP)		+= rtas-fadump.o
-obj-$(CONFIG_PSERIES_PLPKS)	+= plpks.o
+obj-$(CONFIG_PSERIES_PLPKS)	+= plpks.o plpks-sysfs.o
 obj-$(CONFIG_PPC_SECURE_BOOT)	+= plpks-secvar.o
 obj-$(CONFIG_PSERIES_PLPKS_SED)	+= plpks_sed_ops.o
 obj-$(CONFIG_SUSPEND)		+= suspend.o
arch/powerpc/platforms/pseries/plpks-secvar.c +0 -29
index f9e9cc40c9d0..a50ff6943d80 100644
@@ -20,33 +20,6 @@
 #include <asm/secvar.h>
 #include <asm/plpks.h>
 
-// Config attributes for sysfs
-#define PLPKS_CONFIG_ATTR(name, fmt, func)			\
-	static ssize_t name##_show(struct kobject *kobj,	\
-				   struct kobj_attribute *attr,	\
-				   char *buf)			\
-	{							\
-		return sysfs_emit(buf, fmt, func());		\
-	}							\
-	static struct kobj_attribute attr_##name = __ATTR_RO(name)
-
-PLPKS_CONFIG_ATTR(version, "%u\n", plpks_get_version);
-PLPKS_CONFIG_ATTR(max_object_size, "%u\n", plpks_get_maxobjectsize);
-PLPKS_CONFIG_ATTR(total_size, "%u\n", plpks_get_totalsize);
-PLPKS_CONFIG_ATTR(used_space, "%u\n", plpks_get_usedspace);
-PLPKS_CONFIG_ATTR(supported_policies, "%08x\n", plpks_get_supportedpolicies);
-PLPKS_CONFIG_ATTR(signed_update_algorithms, "%016llx\n", plpks_get_signedupdatealgorithms);
-
-static const struct attribute *config_attrs[] = {
-	&attr_version.attr,
-	&attr_max_object_size.attr,
-	&attr_total_size.attr,
-	&attr_used_space.attr,
-	&attr_supported_policies.attr,
-	&attr_signed_update_algorithms.attr,
-	NULL,
-};
-
 static u32 get_policy(const char *name)
 {
 	if ((strcmp(name, "db") == 0) ||
@@ -225,7 +198,6 @@ static const struct secvar_operations plpks_secvar_ops_static = {
 	.set = plpks_set_variable,
 	.format = plpks_secvar_format,
 	.max_size = plpks_max_size,
-	.config_attrs = config_attrs,
 	.var_names = plpks_var_names_static,
 };
 
@@ -234,7 +206,6 @@ static const struct secvar_operations plpks_secvar_ops_dynamic = {
 	.set = plpks_set_variable,
 	.format = plpks_secvar_format,
 	.max_size = plpks_max_size,
-	.config_attrs = config_attrs,
 	.var_names = plpks_var_names_dynamic,
 };
 
arch/powerpc/platforms/pseries/plpks-sysfs.c new file +94 -0

94 lines not on this page · raw message

Signature · 1 line
2.47.3
author maintainer
#5 lore raw

PATCH v6 5/6 keys/trusted_keys: establish PKWM as a trusted source

In reply to Srish Srinivasan

The wrapping key does not exist by default and is generated by the hypervisor as a part of PKWM initialization. This key is then persisted by the hypervisor and is used to wrap trusted keys. These are variable length symmetric keys, which in the case of PowerVM Key Wrapping Module (PKWM) are generated using the kernel RNG. PKWM can be used as a trust source through the following example keyctl commands:

keyctl add trusted my_trusted_key "new 32" @u

Use the wrap_flags command option to set the secure boot requirement for the wrapping request through the following keyctl commands

case1: no secure boot requirement. (default) keyctl usage: keyctl add trusted my_trusted_key "new 32" @u

	      OR
	      keyctl add trusted my_trusted_key "new 32 wrap_flags=0x00" @u

case2: secure boot required to in either audit or enforce mode. set bit 0 keyctl usage: keyctl add trusted my_trusted_key "new 32 wrap_flags=0x01" @u

case3: secure boot required to be in enforce mode. set bit 1 keyctl usage: keyctl add trusted my_trusted_key "new 32 wrap_flags=0x02" @u

NOTE:
-> Setting the secure boot requirement is NOT a must.
-> Only either of the secure boot requirement options should be set. Not both.
-> All the other bits are required to be not set.
-> Set the kernel parameter trusted.source=pkwm to choose PKWM as the backend for trusted keys implementation.
-> CONFIG_PSERIES_PLPKS must be enabled to build PKWM.

Add PKWM, which is a combination of IBM PowerVM and Power LPAR Platform KeyStore, as a new trust source for trusted keys.

---
 MAINTAINERS                               |   9 +
 include/keys/trusted-type.h               |   7 +-
 include/keys/trusted_pkwm.h               |  33 ++++
 security/keys/trusted-keys/Kconfig        |   8 +
 security/keys/trusted-keys/Makefile       |   2 +
 security/keys/trusted-keys/trusted_core.c |   6 +-
 security/keys/trusted-keys/trusted_pkwm.c | 190 ++++++++++++++++++++++
 7 files changed, 253 insertions(+), 2 deletions(-)
 create mode 100644 include/keys/trusted_pkwm.h
 create mode 100644 security/keys/trusted-keys/trusted_pkwm.c
MAINTAINERS +9 -0
index 0efa8cc6775b..b037648e66fc 100644
@@ -14013,6 +14013,15 @@ S:	Supported
 F:	include/keys/trusted_dcp.h
 F:	security/keys/trusted-keys/trusted_dcp.c
 
+KEYS-TRUSTED-PLPKS
+M:	Srish Srinivasan <[email protected]>
+M:	Nayna Jain <[email protected]>
+L:	[email protected]
+L:	[email protected]
+S:	Supported
+F:	include/keys/trusted_pkwm.h
+F:	security/keys/trusted-keys/trusted_pkwm.c
+
 KEYS-TRUSTED-TEE
 M:	Sumit Garg <[email protected]>
 L:	[email protected]
include/keys/trusted-type.h +6 -1
index 4eb64548a74f..03527162613f 100644
@@ -19,7 +19,11 @@
 
 #define MIN_KEY_SIZE			32
 #define MAX_KEY_SIZE			128
-#define MAX_BLOB_SIZE			512
+#if IS_ENABLED(CONFIG_TRUSTED_KEYS_PKWM)
+#define MAX_BLOB_SIZE			1152
+#else
+#define MAX_BLOB_SIZE                   512
+#endif
 #define MAX_PCRINFO_SIZE		64
 #define MAX_DIGEST_SIZE			64
 
@@ -46,6 +50,7 @@ struct trusted_key_options {
 	uint32_t policydigest_len;
 	unsigned char policydigest[MAX_DIGEST_SIZE];
 	uint32_t policyhandle;
+	void *private;
 };
 
 struct trusted_key_ops {
include/keys/trusted_pkwm.h new file +33 -0
new file mode 100644
index 000000000000..4035b9776394
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __PKWM_TRUSTED_KEY_H
+#define __PKWM_TRUSTED_KEY_H
+
+#include <keys/trusted-type.h>
+#include <linux/bitops.h>
+#include <linux/printk.h>
+
+extern struct trusted_key_ops pkwm_trusted_key_ops;
+
+struct trusted_pkwm_options {
+	u16 wrap_flags;
+};
+
+static inline void dump_options(struct trusted_key_options *o)
+{
+	const struct trusted_pkwm_options *pkwm;
+	bool sb_audit_or_enforce_bit;
+	bool sb_enforce_bit;
+
+	pkwm = o->private;
+	sb_audit_or_enforce_bit = pkwm->wrap_flags & BIT(0);
+	sb_enforce_bit = pkwm->wrap_flags & BIT(1);
+
+	if (sb_audit_or_enforce_bit)
+		pr_debug("secure boot mode required: audit or enforce");
+	else if (sb_enforce_bit)
+		pr_debug("secure boot mode required: enforce");
+	else
+		pr_debug("secure boot mode required: disabled");
+}
+
+#endif
security/keys/trusted-keys/Kconfig +8 -0
index 204a68c1429d..9e00482d886a 100644
@@ -46,6 +46,14 @@ config TRUSTED_KEYS_DCP
 	help
 	  Enable use of NXP's DCP (Data Co-Processor) as trusted key backend.
 
+config TRUSTED_KEYS_PKWM
+	bool "PKWM-based trusted keys"
+	depends on PSERIES_PLPKS >= TRUSTED_KEYS
+	default y
+	select HAVE_TRUSTED_KEYS
+	help
+	  Enable use of IBM PowerVM Key Wrapping Module (PKWM) as a trusted key backend.
+
 if !HAVE_TRUSTED_KEYS
 	comment "No trust source selected!"
 endif
security/keys/trusted-keys/Makefile +2 -0
index f0f3b27f688b..5fc053a21dad 100644
@@ -16,3 +16,5 @@ trusted-$(CONFIG_TRUSTED_KEYS_TEE) += trusted_tee.o
 trusted-$(CONFIG_TRUSTED_KEYS_CAAM) += trusted_caam.o
 
 trusted-$(CONFIG_TRUSTED_KEYS_DCP) += trusted_dcp.o
+
+trusted-$(CONFIG_TRUSTED_KEYS_PKWM) += trusted_pkwm.o
security/keys/trusted-keys/trusted_core.c +5 -1
index b1680ee53f86..2d328de170e8 100644
@@ -12,6 +12,7 @@
 #include <keys/trusted_caam.h>
 #include <keys/trusted_dcp.h>
 #include <keys/trusted_tpm.h>
+#include <keys/trusted_pkwm.h>
 #include <linux/capability.h>
 #include <linux/err.h>
 #include <linux/init.h>
@@ -31,7 +32,7 @@ MODULE_PARM_DESC(rng, "Select trusted key RNG");
 
 static char *trusted_key_source;
 module_param_named(source, trusted_key_source, charp, 0);
-MODULE_PARM_DESC(source, "Select trusted keys source (tpm, tee, caam or dcp)");
+MODULE_PARM_DESC(source, "Select trusted keys source (tpm, tee, caam, dcp or pkwm)");
 
 static const struct trusted_key_source trusted_key_sources[] = {
 #if defined(CONFIG_TRUSTED_KEYS_TPM)
@@ -46,6 +47,9 @@ static const struct trusted_key_source trusted_key_sources[] = {
 #if defined(CONFIG_TRUSTED_KEYS_DCP)
 	{ "dcp", &dcp_trusted_key_ops },
 #endif
+#if defined(CONFIG_TRUSTED_KEYS_PKWM)
+	{ "pkwm", &pkwm_trusted_key_ops },
+#endif
 };
 
 DEFINE_STATIC_CALL_NULL(trusted_key_seal, *trusted_key_sources[0].ops->seal);
security/keys/trusted-keys/trusted_pkwm.c new file +190 -0

190 lines not on this page · raw message

Signature · 1 line
2.47.3
author maintainer
#4 lore raw

PATCH v6 4/6 pseries/plpks: add HCALLs for PowerVM Key Wrapping Module

In reply to Srish Srinivasan

The hypervisor generated wrapping key is an AES-GCM-256 symmetric key which is stored in a non-volatile, secure, and encrypted storage called the Power LPAR Platform KeyStore. It has policy based protections that prevent it from being read out or exposed to the user.

Implement H_PKS_GEN_KEY, H_PKS_WRAP_OBJECT, and H_PKS_UNWRAP_OBJECT HCALLs to enable using the PowerVM Key Wrapping Module (PKWM) as a new trust source for trusted keys. Disallow H_PKS_READ_OBJECT, H_PKS_SIGNED_UPDATE, and H_PKS_WRITE_OBJECT for objects with the 'wrapping key' policy set. Capture the availability status for the H_PKS_WRAP_OBJECT interface.

---
 Documentation/arch/powerpc/papr_hcalls.rst |  43 +++
 arch/powerpc/include/asm/plpks.h           |  10 +
 arch/powerpc/platforms/pseries/plpks.c     | 344 ++++++++++++++++++++-
 3 files changed, 395 insertions(+), 2 deletions(-)
Documentation/arch/powerpc/papr_hcalls.rst +43 -0
index 805e1cb9bab9..14e39f095a1c 100644
@@ -300,6 +300,49 @@ H_HTM supports setup, configuration, control and dumping of Hardware Trace
 Macro (HTM) function and its data. HTM buffer stores tracing data for functions
 like core instruction, core LLAT and nest.
 
+**H_PKS_GEN_KEY**
+
+| Input: authorization, objectlabel, objectlabellen, policy, out, outlen
+| Out: *Hypervisor Generated Key, or None when the wrapping key policy is set*
+| Return Value: *H_SUCCESS, H_Function, H_State, H_R_State, H_Parameter, H_P2,
+                H_P3, H_P4, H_P5, H_P6, H_Authority, H_Nomem, H_Busy, H_Resource,
+                H_Aborted*
+
+H_PKS_GEN_KEY is used to have the hypervisor generate a new random key.
+This key is stored as an object in the Power LPAR Platform KeyStore with
+the provided object label. With the wrapping key policy set the key is only
+visible to the hypervisor, while the key's label would still be visible to
+the user. Generation of wrapping keys is supported only for a key size of
+32 bytes.
+
+**H_PKS_WRAP_OBJECT**
+
+| Input: authorization, wrapkeylabel, wrapkeylabellen, objectwrapflags, in,
+|        inlen, out, outlen, continue-token
+| Out: *continue-token, byte size of wrapped object, wrapped object*
+| Return Value: *H_SUCCESS, H_Function, H_State, H_R_State, H_Parameter, H_P2,
+                H_P3, H_P4, H_P5, H_P6, H_P7, H_P8, H_P9, H_Authority, H_Invalid_Key,
+                H_NOT_FOUND, H_Busy, H_LongBusy, H_Aborted*
+
+H_PKS_WRAP_OBJECT is used to wrap an object using a wrapping key stored in the
+Power LPAR Platform KeyStore and return the wrapped object to the caller. The
+caller provides a label to a wrapping key with the 'wrapping key' policy set,
+which must have been previously created with H_PKS_GEN_KEY. The provided object
+is then encrypted with the wrapping key and additional metadata and the result
+is returned to the caller.
+
+
+**H_PKS_UNWRAP_OBJECT**
+
+| Input: authorization, objectwrapflags, in, inlen, out, outlen, continue-token
+| Out: *continue-token, byte size of unwrapped object, unwrapped object*
+| Return Value: *H_SUCCESS, H_Function, H_State, H_R_State, H_Parameter, H_P2,
+                H_P3, H_P4, H_P5, H_P6, H_P7, H_Authority, H_Unsupported, H_Bad_Data,
+                H_NOT_FOUND, H_Invalid_Key, H_Busy, H_LongBusy, H_Aborted*
+
+H_PKS_UNWRAP_OBJECT is used to unwrap an object that was previously warapped with
+H_PKS_WRAP_OBJECT.
+
 References
 ==========
 .. [1] "Power Architecture Platform Reference"
arch/powerpc/include/asm/plpks.h +10 -0
index 8f034588fdf7..e87f90e40d4e 100644
@@ -113,6 +113,16 @@ void plpks_early_init_devtree(void);
 int plpks_populate_fdt(void *fdt);
 
 int plpks_config_create_softlink(struct kobject *from);
+
+bool plpks_wrapping_is_supported(void);
+
+int plpks_gen_wrapping_key(void);
+
+int plpks_wrap_object(u8 **input_buf, u32 input_len, u16 wrap_flags,
+		      u8 **output_buf, u32 *output_len);
+
+int plpks_unwrap_object(u8 **input_buf, u32 input_len,
+			u8 **output_buf, u32 *output_len);
 #else // CONFIG_PSERIES_PLPKS
 static inline bool plpks_is_available(void) { return false; }
 static inline u16 plpks_get_passwordlen(void) { BUILD_BUG(); }
arch/powerpc/platforms/pseries/plpks.c +342 -2

392 lines not on this page · raw message

Signature · 1 line
2.47.3
author maintainer
#6 lore raw

PATCH v6 6/6 docs: trusted-encryped: add PKWM as a new trust source

In reply to Srish Srinivasan

From: Nayna Jain <[email protected]>

Update Documentation/security/keys/trusted-encrypted.rst and Documentation/ admin-guide/kernel-parameters.txt with PowerVM Key Wrapping Module (PKWM) as a new trust source

---
 .../admin-guide/kernel-parameters.txt         |  1 +
 .../security/keys/trusted-encrypted.rst       | 50 +++++++++++++++++++
 2 files changed, 51 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +1 -0
index 1058f2a6d6a8..aac15079b33d 100644
@@ -7790,6 +7790,7 @@ Kernel parameters
 			- "tee"
 			- "caam"
 			- "dcp"
+			- "pkwm"
 			If not specified then it defaults to iterating through
 			the trust source list starting with TPM and assigns the
 			first trust source as a backend which is initialized
Documentation/security/keys/trusted-encrypted.rst +50 -0

86 lines not on this page · raw message

Signature · 1 line
2.47.3
author maintainer
#8 lore raw
In reply to Srish Srinivasan

Please ignore this series (v6).

thanks,
Srish.

Quoted 107 lines · Srish Srinivasan

Power11 has introduced a feature called the PowerVM Key Wrapping Module (PKWM), where PowerVM in combination with Power LPAR Platform KeyStore (PLPKS) [1] supports a new feature called "Key Wrapping" [2] to protect user secrets by wrapping them using a hypervisor generated wrapping key. This wrapping key is an AES-GCM-256 symmetric key that is stored as an object in the PLPKS. It has policy based protections that prevents it from being read out or exposed to the user. This wrapping key can then be used by the OS to wrap or unwrap secrets via hypervisor calls.

This patchset intends to add the PKWM, which is a combination of IBM PowerVM and PLPKS, as a new trust source for trusted keys. The wrapping key does not exist by default and its generation is requested by the kernel at the time of PKWM initialization. This key is then persisted by the PKWM and is used for wrapping any kernel provided key, and is never exposed to the user. The kernel is aware of only the label to this wrapping key.

Along with the PKWM implementation, this patchset includes two preparatory
patches: one fixing the kernel-doc inconsistencies in the PLPKS code and another reorganizing PLPKS config variables in the sysfs.

Changelog:

v6:

* Patch 1 to Patch 3:
- Add Nayna's Tested-by tag
* Patch 4
- Fix build error reported by kernel test robot <[email protected]>
- Add Nayna's Tested-by tag
* Patch 5
- Add Nayna's Tested-by tag

v5:

* Patch 1 to Patch 3:
- Add Nayna's Reviewed-by tag
* Patch 4:
- Fix build error identified by [email protected]
- Add Nayna's Reviewed-by tag
* Patch 5:
- Add Reviewed-by tags from Nayna and Jarkko

v4:

* Patch 5:
- Add a per-backend private data pointer in trusted_key_options to store a pointer to the backend-specific options structure
- Minor clean-up

v3:

* Patch 2:
- Add Mimi's Reviewed-by tag
* Patch 4:
- Minor tweaks to some print statements
- Fix typos
* Patch 5:
- Fix typos
- Add Mimi's Reviewed-by tag
* Patch 6:
- Add Mimi's Reviewed-by tag

v2:

* Patch 2:
- Fix build warning detected by the kernel test bot
* Patch 5:
- Use pr_debug inside dump_options
- Replace policyhande with wrap_flags inside dump_options
- Provide meaningful error messages with error codes

Nayna Jain (1):
docs: trusted-encryped: add PKWM as a new trust source

Srish Srinivasan (5):
pseries/plpks: fix kernel-doc comment inconsistencies powerpc/pseries: move the PLPKS config inside its own sysfs directory pseries/plpks: expose PowerVM wrapping features via the sysfs pseries/plpks: add HCALLs for PowerVM Key Wrapping Module keys/trusted_keys: establish PKWM as a trusted source

  .../ABI/testing/sysfs-firmware-plpks          |  58 ++
  Documentation/ABI/testing/sysfs-secvar        |  65 --
  .../admin-guide/kernel-parameters.txt         |   1 +
  Documentation/arch/powerpc/papr_hcalls.rst    |  43 ++
  .../security/keys/trusted-encrypted.rst       |  50 ++
  MAINTAINERS                                   |   9 +
  arch/powerpc/include/asm/hvcall.h             |   4 +-
  arch/powerpc/include/asm/plpks.h              |  95 +--
  arch/powerpc/include/asm/secvar.h             |   1 -
  arch/powerpc/kernel/secvar-sysfs.c            |  21 +-
  arch/powerpc/platforms/pseries/Makefile       |   2 +-
  arch/powerpc/platforms/pseries/plpks-secvar.c |  29 -
  arch/powerpc/platforms/pseries/plpks-sysfs.c  |  96 +++
  arch/powerpc/platforms/pseries/plpks.c        | 688 +++++++++++++++++-
  include/keys/trusted-type.h                   |   7 +-
  include/keys/trusted_pkwm.h                   |  33 +
  security/keys/trusted-keys/Kconfig            |   8 +
  security/keys/trusted-keys/Makefile           |   2 +
  security/keys/trusted-keys/trusted_core.c     |   6 +-
  security/keys/trusted-keys/trusted_pkwm.c     | 190 +++++
  20 files changed, 1207 insertions(+), 201 deletions(-)

create mode 100644 Documentation/ABI/testing/sysfs-firmware-plpks create mode 100644 arch/powerpc/platforms/pseries/plpks-sysfs.c create mode 100644 include/keys/trusted_pkwm.h
create mode 100644 security/keys/trusted-keys/trusted_pkwm.c

maintainer Reviewed-by on v6 6/6
#7 lore raw

Re: [PATCH v6 6/6] docs: trusted-encryped: add PKWM as a new trust source

In reply to Srish Srinivasan
Quoted 9 lines · Srish Srinivasan

From: Nayna Jain <[email protected]>

Update Documentation/security/keys/trusted-encrypted.rst and Documentation/ admin-guide/kernel-parameters.txt with PowerVM Key Wrapping Module (PKWM) as a new trust source

And you are free to take 5/6 and 6/6 to a pull request if you prefer that route.

Quoted 116 lines
---
 .../admin-guide/kernel-parameters.txt         |  1 +
 .../security/keys/trusted-encrypted.rst       | 50 +++++++++++++++++++
 2 files changed, 51 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +1 -0
index 1058f2a6d6a8..aac15079b33d 100644
@@ -7790,6 +7790,7 @@ Kernel parameters
 			- "tee"
 			- "caam"
 			- "dcp"
+			- "pkwm"
 			If not specified then it defaults to iterating through
 			the trust source list starting with TPM and assigns the
 			first trust source as a backend which is initialized
Documentation/security/keys/trusted-encrypted.rst +50 -0
index eae6a36b1c9a..ddff7c7c2582 100644
@@ -81,6 +81,14 @@ safe.
          and the UNIQUE key. Default is to use the UNIQUE key, but selecting
          the OTP key can be done via a module parameter (dcp_use_otp_key).
 
+     (5) PKWM (PowerVM Key Wrapping Module: IBM PowerVM + Platform KeyStore)
+
+         Rooted to a unique, per-LPAR key, which is derived from a system-wide,
+         randomly generated LPAR root key. Both the per-LPAR keys and the LPAR
+         root key are stored in hypervisor-owned secure memory at runtime,
+         and the LPAR root key is additionally persisted in secure locations
+         such as the processor SEEPROMs and encrypted NVRAM.
+
   *  Execution isolation
 
      (1) TPM
@@ -102,6 +110,14 @@ safe.
          environment. Only basic blob key encryption is executed there.
          The actual key sealing/unsealing is done on main processor/kernel space.
 
+     (5) PKWM (PowerVM Key Wrapping Module: IBM PowerVM + Platform KeyStore)
+
+         Fixed set of cryptographic operations done on on-chip hardware
+         cryptographic acceleration unit NX. Keys for wrapping and unwrapping
+         are managed by PowerVM Platform KeyStore, which stores keys in an
+         isolated in-memory copy in secure hypervisor memory, as well as in a
+         persistent copy in hypervisor-encrypted NVRAM.
+
   * Optional binding to platform integrity state
 
      (1) TPM
@@ -129,6 +145,11 @@ safe.
          Relies on Secure/Trusted boot process (called HAB by vendor) for
          platform integrity.
 
+     (5) PKWM (PowerVM Key Wrapping Module: IBM PowerVM + Platform KeyStore)
+
+         Relies on secure and trusted boot process of IBM Power systems for
+         platform integrity.
+
   *  Interfaces and APIs
 
      (1) TPM
@@ -149,6 +170,11 @@ safe.
          Vendor-specific API that is implemented as part of the DCP crypto driver in
          ``drivers/crypto/mxs-dcp.c``.
 
+     (5) PKWM (PowerVM Key Wrapping Module: IBM PowerVM + Platform KeyStore)
+
+         Platform Keystore has well documented interfaces in PAPR document.
+         Refer to ``Documentation/arch/powerpc/papr_hcalls.rst``
+
   *  Threat model
 
      The strength and appropriateness of a particular trust source for a given
@@ -191,6 +217,10 @@ selected trust source:
      a dedicated hardware RNG that is independent from DCP which can be enabled
      to back the kernel RNG.
 
+   * PKWM (PowerVM Key Wrapping Module: IBM PowerVM + Platform KeyStore)
+
+     The normal kernel random number generator is used to generate keys.
+
 Users may override this by specifying ``trusted.rng=kernel`` on the kernel
 command-line to override the used RNG with the kernel's random number pool.
 
@@ -321,6 +351,26 @@ Usage::
 specific to this DCP key-blob implementation.  The key length for new keys is
 always in bytes. Trusted Keys can be 32 - 128 bytes (256 - 1024 bits).
 
+Trusted Keys usage: PKWM
+------------------------
+
+Usage::
+
+    keyctl add trusted name "new keylen [options]" ring
+    keyctl add trusted name "load hex_blob" ring
+    keyctl print keyid
+
+    options:
+       wrap_flags=   ascii hex value of security policy requirement
+                       0x00: no secure boot requirement (default)
+                       0x01: require secure boot to be in either audit or
+                             enforced mode
+                       0x02: require secure boot to be in enforced mode
+
+"keyctl print" returns an ASCII hex copy of the sealed key, which is in format
+specific to PKWM key-blob implementation.  The key length for new keys is
+always in bytes. Trusted Keys can be 32 - 128 bytes (256 - 1024 bits).
+
 Encrypted Keys usage
 --------------------
 
Signature · 1 line
2.47.3

BR, Jarkko

#9 lore raw
In reply to Srish Srinivasan

Le 01/02/2026 à 14:59, Srish Srinivasan a écrit :

Quoted 16 lines

Power11 has introduced a feature called the PowerVM Key Wrapping Module (PKWM), where PowerVM in combination with Power LPAR Platform KeyStore (PLPKS) [1] supports a new feature called "Key Wrapping" [2] to protect user secrets by wrapping them using a hypervisor generated wrapping key. This wrapping key is an AES-GCM-256 symmetric key that is stored as an object in the PLPKS. It has policy based protections that prevents it from being read out or exposed to the user. This wrapping key can then be used by the OS to wrap or unwrap secrets via hypervisor calls.

This patchset intends to add the PKWM, which is a combination of IBM PowerVM and PLPKS, as a new trust source for trusted keys. The wrapping key does not exist by default and its generation is requested by the kernel at the time of PKWM initialization. This key is then persisted by the PKWM and is used for wrapping any kernel provided key, and is never exposed to the user. The kernel is aware of only the label to this wrapping key.

Quoted 7 lines

Along with the PKWM implementation, this patchset includes two preparatory
patches: one fixing the kernel-doc inconsistencies in the PLPKS code and another reorganizing PLPKS config variables in the sysfs.

Changelog:

v6:

Seems like v5 was applied, if needed can you send followup patch ?

Christophe

Quoted 84 lines

* Patch 1 to Patch 3:
- Add Nayna's Tested-by tag
* Patch 4
- Fix build error reported by kernel test robot <[email protected]>
- Add Nayna's Tested-by tag
* Patch 5
- Add Nayna's Tested-by tag

v5:

* Patch 1 to Patch 3:
- Add Nayna's Reviewed-by tag
* Patch 4:
- Fix build error identified by [email protected]
- Add Nayna's Reviewed-by tag
* Patch 5:
- Add Reviewed-by tags from Nayna and Jarkko

v4:

* Patch 5:
- Add a per-backend private data pointer in trusted_key_options to store a pointer to the backend-specific options structure
- Minor clean-up

v3:

* Patch 2:
- Add Mimi's Reviewed-by tag
* Patch 4:
- Minor tweaks to some print statements
- Fix typos
* Patch 5:
- Fix typos
- Add Mimi's Reviewed-by tag
* Patch 6:
- Add Mimi's Reviewed-by tag

v2:

* Patch 2:
- Fix build warning detected by the kernel test bot
* Patch 5:
- Use pr_debug inside dump_options
- Replace policyhande with wrap_flags inside dump_options
- Provide meaningful error messages with error codes

Nayna Jain (1):
docs: trusted-encryped: add PKWM as a new trust source

Srish Srinivasan (5):
pseries/plpks: fix kernel-doc comment inconsistencies powerpc/pseries: move the PLPKS config inside its own sysfs directory pseries/plpks: expose PowerVM wrapping features via the sysfs pseries/plpks: add HCALLs for PowerVM Key Wrapping Module keys/trusted_keys: establish PKWM as a trusted source

  .../ABI/testing/sysfs-firmware-plpks          |  58 ++
  Documentation/ABI/testing/sysfs-secvar        |  65 --
  .../admin-guide/kernel-parameters.txt         |   1 +
  Documentation/arch/powerpc/papr_hcalls.rst    |  43 ++
  .../security/keys/trusted-encrypted.rst       |  50 ++
  MAINTAINERS                                   |   9 +
  arch/powerpc/include/asm/hvcall.h             |   4 +-
  arch/powerpc/include/asm/plpks.h              |  95 +--
  arch/powerpc/include/asm/secvar.h             |   1 -
  arch/powerpc/kernel/secvar-sysfs.c            |  21 +-
  arch/powerpc/platforms/pseries/Makefile       |   2 +-
  arch/powerpc/platforms/pseries/plpks-secvar.c |  29 -
  arch/powerpc/platforms/pseries/plpks-sysfs.c  |  96 +++
  arch/powerpc/platforms/pseries/plpks.c        | 688 +++++++++++++++++-
  include/keys/trusted-type.h                   |   7 +-
  include/keys/trusted_pkwm.h                   |  33 +
  security/keys/trusted-keys/Kconfig            |   8 +
  security/keys/trusted-keys/Makefile           |   2 +
  security/keys/trusted-keys/trusted_core.c     |   6 +-
  security/keys/trusted-keys/trusted_pkwm.c     | 190 +++++
  20 files changed, 1207 insertions(+), 201 deletions(-)

create mode 100644 Documentation/ABI/testing/sysfs-firmware-plpks create mode 100644 arch/powerpc/platforms/pseries/plpks-sysfs.c create mode 100644 include/keys/trusted_pkwm.h
create mode 100644 security/keys/trusted-keys/trusted_pkwm.c

author maintainer
#10 lore raw

Hi Christophe,

Quoted 23 lines · Christophe Leroy (CS GROUP)

Le 01/02/2026 à 14:59, Srish Srinivasan a écrit :

Quoted 20 lines

Power11 has introduced a feature called the PowerVM Key Wrapping Module (PKWM), where PowerVM in combination with Power LPAR Platform KeyStore (PLPKS) [1] supports a new feature called "Key Wrapping" [2] to protect user secrets by wrapping them using a hypervisor generated wrapping key. This wrapping key is an AES-GCM-256 symmetric key that is stored as an object in the PLPKS. It has policy based protections that prevents it from being read out or exposed to the user. This wrapping key can then be used by the OS to wrap or unwrap secrets via hypervisor calls.

This patchset intends to add the PKWM, which is a combination of IBM PowerVM and PLPKS, as a new trust source for trusted keys. The wrapping key does not exist by default and its generation is requested by the kernel at the time of PKWM initialization. This key is then persisted by the PKWM and is used for wrapping any kernel provided key, and is never exposed to the user. The kernel is aware of only the label to this wrapping key.

Along with the PKWM implementation, this patchset includes two preparatory
patches: one fixing the kernel-doc inconsistencies in the PLPKS code and another reorganizing PLPKS config variables in the sysfs.

Quoted 7 lines
Quoted 3 lines

Changelog:

v6:

Seems like v5 was applied, if needed can you send followup patch ?

Christophe

I had sent out a patch on top of v5 to take care of this, and it has been applied.

thanks,
Srish.

Quoted 86 lines
Quoted 85 lines

* Patch 1 to Patch 3:
   - Add Nayna's Tested-by tag
* Patch 4
   - Fix build error reported by kernel test robot <[email protected]>
   - Add Nayna's Tested-by tag
* Patch 5
   - Add Nayna's Tested-by tag

v5:

* Patch 1 to Patch 3:
   - Add Nayna's Reviewed-by tag
* Patch 4:
   - Fix build error identified by [email protected]
   - Add Nayna's Reviewed-by tag
* Patch 5:
   - Add Reviewed-by tags from Nayna and Jarkko

v4:

* Patch 5:
   - Add a per-backend private data pointer in trusted_key_options to store a pointer to the backend-specific options structure
   - Minor clean-up

v3:

* Patch 2:
   - Add Mimi's Reviewed-by tag
* Patch 4:
   - Minor tweaks to some print statements
   - Fix typos
* Patch 5:
   - Fix typos
   - Add Mimi's Reviewed-by tag
* Patch 6:
   - Add Mimi's Reviewed-by tag

v2:

* Patch 2:
   - Fix build warning detected by the kernel test bot
* Patch 5:
   - Use pr_debug inside dump_options
   - Replace policyhande with wrap_flags inside dump_options
   - Provide meaningful error messages with error codes

Nayna Jain (1):
   docs: trusted-encryped: add PKWM as a new trust source

Srish Srinivasan (5):
   pseries/plpks: fix kernel-doc comment inconsistencies powerpc/pseries: move the PLPKS config inside its own sysfs directory pseries/plpks: expose PowerVM wrapping features via the sysfs pseries/plpks: add HCALLs for PowerVM Key Wrapping Module keys/trusted_keys: establish PKWM as a trusted source

  .../ABI/testing/sysfs-firmware-plpks          |  58 ++ Documentation/ABI/testing/sysfs-secvar        |  65 -- .../admin-guide/kernel-parameters.txt         |   1 + Documentation/arch/powerpc/papr_hcalls.rst    |  43 ++ .../security/keys/trusted-encrypted.rst       |  50 ++ MAINTAINERS                                   |   9 + arch/powerpc/include/asm/hvcall.h             |   4 +- arch/powerpc/include/asm/plpks.h              |  95 +-- arch/powerpc/include/asm/secvar.h             |   1 - arch/powerpc/kernel/secvar-sysfs.c            |  21 +- arch/powerpc/platforms/pseries/Makefile       |   2 +- arch/powerpc/platforms/pseries/plpks-secvar.c |  29 - arch/powerpc/platforms/pseries/plpks-sysfs.c  |  96 +++ arch/powerpc/platforms/pseries/plpks.c        | 688 +++++++++++++++++- include/keys/trusted-type.h                   |   7 +- include/keys/trusted_pkwm.h                   |  33 + security/keys/trusted-keys/Kconfig            |   8 + security/keys/trusted-keys/Makefile           |   2 + security/keys/trusted-keys/trusted_core.c     |   6 +- security/keys/trusted-keys/trusted_pkwm.c     | 190 +++++

  20 files changed, 1207 insertions(+), 201 deletions(-)

  create mode 100644 Documentation/ABI/testing/sysfs-firmware-plpks create mode 100644 arch/powerpc/platforms/pseries/plpks-sysfs.c create mode 100644 include/keys/trusted_pkwm.h
  create mode 100644 security/keys/trusted-keys/trusted_pkwm.c