linux/security/keys/trusted-keys
Jarkko Sakkinen 3d9e043dab tpm-buf: Memory-safe allocations
Decouple kzalloc from buffer creation, so that a managed allocation can be
used:

	struct tpm_buf *buf __free(kfree) buf = kzalloc(TPM_BUFSIZE,
						GFP_KERNEL);
	if (!buf)
		return -ENOMEM;

	tpm_buf_init(buf, TPM_BUFSIZE);

Alternatively, other allocations are also possible (static data, stack,
etc) for example:

	u8 buf_data[512];
	struct tpm_buf *buf = (struct tpm_buf *)buf_data;
	tpm_buf_init(buf, sizeof(buf_data));

This is achieved by embedding buffer's header inside the allocated blob,
instead of having an outer wrapper.

Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@opinsys.com>
Tested-by: Srish Srinivasan <ssrish@linux.ibm.com>
Message-ID: <20260522013555.1063716-1-jarkko@kernel.org>
Signed-off-by: Ross Philipson <ross.philipson@oracle.com>
2026-08-25 18:13:36 +03:00
..
Kconfig KEYS: trusted: Debugging as a feature 2026-06-15 15:19:12 +03:00
Makefile keys/trusted_keys: establish PKWM as a trusted source 2026-01-30 09:27:26 +05:30
tpm2key.asn1 security: keys: trusted: use ASN.1 TPM2 key format for the blobs 2021-04-14 16:30:30 +03:00
trusted_caam.c KEYS: trusted: Debugging as a feature 2026-06-15 15:19:12 +03:00
trusted_core.c keys/trusted_keys: mark 'migratable' as __ro_after_init 2026-06-15 15:19:12 +03:00
trusted_dcp.c KEYS: trusted: dcp: fix key_len validation and calc_blob_len() return type 2026-07-23 18:23:23 +03:00
trusted_pkwm.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
trusted_tee.c KEYS: trusted: Make use of tee bus methods 2026-01-07 08:14:53 +01:00
trusted_tpm1.c tpm-buf: Memory-safe allocations 2026-08-25 18:13:36 +03:00
trusted_tpm2.c tpm-buf: Memory-safe allocations 2026-08-25 18:13:36 +03:00