public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] KEYS: trusted: fix DCP blob payload length assignment
@ 2024-07-03 12:53 David Gstir
  2024-07-03 12:53 ` [PATCH 2/2] KEYS: trusted: dcp: fix leak of blob encryption key David Gstir
  2024-07-17 10:07 ` [PATCH 1/2] KEYS: trusted: fix DCP blob payload length assignment Jarkko Sakkinen
  0 siblings, 2 replies; 8+ messages in thread
From: David Gstir @ 2024-07-03 12:53 UTC (permalink / raw)
  To: sigma star Kernel Team, James Bottomley, Jarkko Sakkinen,
	Mimi Zohar, David Howells, Paul Moore, James Morris,
	Serge E. Hallyn, David Oberhollenzer, Richard Weinberger
  Cc: linux-integrity, keyrings, linux-security-module, linux-kernel,
	David Gstir, kernel test robot

The DCP trusted key type uses the wrong helper function to store
the blob's payload length which can lead to the wrong byte order
being used in case this would ever run on big endian architectures.

Fix by using correct helper function.

Signed-off-by: David Gstir <david@sigma-star.at>
Suggested-by: Richard Weinberger <richard@nod.at>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202405240610.fj53EK0q-lkp@intel.com/
Fixes: 2e8a0f40a39c ("KEYS: trusted: Introduce NXP DCP-backed trusted keys")
---
 security/keys/trusted-keys/trusted_dcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/keys/trusted-keys/trusted_dcp.c b/security/keys/trusted-keys/trusted_dcp.c
index b5f81a05be36..b0947f072a98 100644
--- a/security/keys/trusted-keys/trusted_dcp.c
+++ b/security/keys/trusted-keys/trusted_dcp.c
@@ -222,7 +222,7 @@ static int trusted_dcp_seal(struct trusted_key_payload *p, char *datablob)
 		return ret;
 	}
 
-	b->payload_len = get_unaligned_le32(&p->key_len);
+	put_unaligned_le32(p->key_len, &b->payload_len);
 	p->blob_len = blen;
 	return 0;
 }
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-07-17 11:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-03 12:53 [PATCH 1/2] KEYS: trusted: fix DCP blob payload length assignment David Gstir
2024-07-03 12:53 ` [PATCH 2/2] KEYS: trusted: dcp: fix leak of blob encryption key David Gstir
2024-07-17 10:32   ` Jarkko Sakkinen
2024-07-17 10:07 ` [PATCH 1/2] KEYS: trusted: fix DCP blob payload length assignment Jarkko Sakkinen
2024-07-17 10:19   ` Richard Weinberger
2024-07-17 11:26     ` Jarkko Sakkinen
2024-07-17 11:03   ` David Gstir
2024-07-17 11:27     ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox