iwlwifi: mvm: fix version check for GEO_TX_POWER_LIMIT support
[linux/fpc-iii.git] / arch / s390 / purgatory / purgatory.c
blob3528e6da4e8792f020b94786a99da13049d5ba46
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Purgatory code running between two kernels.
5 * Copyright IBM Corp. 2018
7 * Author(s): Philipp Rudo <prudo@linux.vnet.ibm.com>
8 */
10 #include <linux/kexec.h>
11 #include <linux/sha256.h>
12 #include <linux/string.h>
13 #include <asm/purgatory.h>
15 int verify_sha256_digest(void)
17 struct kexec_sha_region *ptr, *end;
18 u8 digest[SHA256_DIGEST_SIZE];
19 struct sha256_state sctx;
21 sha256_init(&sctx);
22 end = purgatory_sha_regions + ARRAY_SIZE(purgatory_sha_regions);
24 for (ptr = purgatory_sha_regions; ptr < end; ptr++)
25 sha256_update(&sctx, (uint8_t *)(ptr->start), ptr->len);
27 sha256_final(&sctx, digest);
29 if (memcmp(digest, purgatory_sha256_digest, sizeof(digest)))
30 return 1;
32 return 0;