linux/security/integrity/platform_certs/load_ipl_s390.c
Alexander Gordeev 979fe44af8 s390/ipl: fix virtual vs physical address confusion
The value of ipl_cert_list_addr boot variable contains
a physical address, which is used directly. That works
because virtual and physical address spaces are currently
the same, but otherwise it is wrong.

While at it, fix also a comment for the platform keyring.

Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20230816132942.2540411-1-agordeev@linux.ibm.com
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
2023-08-18 15:08:12 +02:00

37 lines
860 B
C

// 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);