summaryrefslogtreecommitdiffstats
path: root/security/integrity/platform_certs/load_ipl_s390.c
blob: c7c381a9ddaac080d33c1c1b320d97e3d0f7599f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// SPDX-License-Identifier: GPL-2.0

#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/cred.h>
#include <linux/err.h>
#include <linux/efi.h>
#include <linux/slab.h>
#include <keys/asymmetric-type.h>
#include <keys/system_keyring.h>
#include <asm/boot_data.h>
#include "../integrity.h"

/*
 * Load the certs contained in the IPL report created by the machine loader
 * into the platform trusted keyring.
 */
static int __init load_ipl_certs(void)
{
	void *ptr, *end;
	unsigned int len;

	if (!ipl_cert_list_addr)
		return 0;
	/* Copy the certificates to the platform keyring */
	ptr = __va(ipl_cert_list_addr);
	end = ptr + ipl_cert_list_size;
	while ((void *) ptr < end) {
		len = *(unsigned int *) ptr;
		ptr += sizeof(unsigned int);
		add_to_platform_keyring("IPL:db", ptr, len);
		ptr += len;
	}
	return 0;
}
late_initcall(load_ipl_certs);