.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * purgatory: Runs between two kernels |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | * |
---|
6 | 7 | * Author: |
---|
7 | 8 | * Vivek Goyal <vgoyal@redhat.com> |
---|
8 | | - * |
---|
9 | | - * This source code is licensed under the GNU General Public License, |
---|
10 | | - * Version 2. See the file COPYING for more details. |
---|
11 | 9 | */ |
---|
12 | 10 | |
---|
13 | 11 | #include <linux/bug.h> |
---|
14 | | -#include <linux/sha256.h> |
---|
| 12 | +#include <crypto/sha.h> |
---|
15 | 13 | #include <asm/purgatory.h> |
---|
16 | 14 | |
---|
17 | 15 | #include "../boot/string.h" |
---|
18 | 16 | |
---|
19 | | -unsigned long purgatory_backup_dest __section(.kexec-purgatory); |
---|
20 | | -unsigned long purgatory_backup_src __section(.kexec-purgatory); |
---|
21 | | -unsigned long purgatory_backup_sz __section(.kexec-purgatory); |
---|
| 17 | +u8 purgatory_sha256_digest[SHA256_DIGEST_SIZE] __section(".kexec-purgatory"); |
---|
22 | 18 | |
---|
23 | | -u8 purgatory_sha256_digest[SHA256_DIGEST_SIZE] __section(.kexec-purgatory); |
---|
24 | | - |
---|
25 | | -struct kexec_sha_region purgatory_sha_regions[KEXEC_SEGMENT_MAX] __section(.kexec-purgatory); |
---|
26 | | - |
---|
27 | | -/* |
---|
28 | | - * On x86, second kernel requries first 640K of memory to boot. Copy |
---|
29 | | - * first 640K to a backup region in reserved memory range so that second |
---|
30 | | - * kernel can use first 640K. |
---|
31 | | - */ |
---|
32 | | -static int copy_backup_region(void) |
---|
33 | | -{ |
---|
34 | | - if (purgatory_backup_dest) { |
---|
35 | | - memcpy((void *)purgatory_backup_dest, |
---|
36 | | - (void *)purgatory_backup_src, purgatory_backup_sz); |
---|
37 | | - } |
---|
38 | | - return 0; |
---|
39 | | -} |
---|
| 19 | +struct kexec_sha_region purgatory_sha_regions[KEXEC_SEGMENT_MAX] __section(".kexec-purgatory"); |
---|
40 | 20 | |
---|
41 | 21 | static int verify_sha256_digest(void) |
---|
42 | 22 | { |
---|
.. | .. |
---|
68 | 48 | for (;;) |
---|
69 | 49 | ; |
---|
70 | 50 | } |
---|
71 | | - copy_backup_region(); |
---|
72 | 51 | } |
---|
73 | 52 | |
---|
74 | 53 | /* |
---|