summaryrefslogtreecommitdiff
path: root/arch/x86/kernel/cpu/microcode
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2025-04-28 11:30:06 -0700
committerBorislav Petkov (AMD) <bp@alien8.de>2025-04-28 21:03:58 +0200
commitc0a62eadb6fd158e4d6d4d47d806109e7ae32e8b (patch)
tree3a3a4f6032209a1795634af5f23fe8a164a17502 /arch/x86/kernel/cpu/microcode
parent4e2c719782a84702db7fc2dc07ced796f308fec7 (diff)
x86/microcode/AMD: Use sha256() instead of init/update/final
Just call sha256() instead of doing the init/update/final sequence. No functional changes. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/20250428183006.782501-1-ebiggers@kernel.org
Diffstat (limited to 'arch/x86/kernel/cpu/microcode')
-rw-r--r--arch/x86/kernel/cpu/microcode/amd.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index 57bd61f9c69b8..b2bbfc4ef3dcf 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -211,7 +211,6 @@ static bool verify_sha256_digest(u32 patch_id, u32 cur_rev, const u8 *data, unsi
{
struct patch_digest *pd = NULL;
u8 digest[SHA256_DIGEST_SIZE];
- struct sha256_state s;
int i;
if (x86_family(bsp_cpuid_1_eax) < 0x17 ||
@@ -230,9 +229,7 @@ static bool verify_sha256_digest(u32 patch_id, u32 cur_rev, const u8 *data, unsi
return false;
}
- sha256_init(&s);
- sha256_update(&s, data, len);
- sha256_final(&s, digest);
+ sha256(data, len, digest);
if (memcmp(digest, pd->sha256, sizeof(digest))) {
pr_err("Patch 0x%x SHA256 digest mismatch!\n", patch_id);