1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (C) 2022 IBM Corporation 4 * Author: Nayna Jain <nayna@linux.ibm.com> 5 * 6 * Platform keystore for pseries LPAR(PLPKS). 7 */ 8 9 #ifndef _PSERIES_PLPKS_H 10 #define _PSERIES_PLPKS_H 11 12 #include <linux/types.h> 13 #include <linux/list.h> 14 15 #define OSSECBOOTAUDIT 0x40000000 16 #define OSSECBOOTENFORCE 0x20000000 17 #define WORLDREADABLE 0x08000000 18 #define SIGNEDUPDATE 0x01000000 19 20 #define PLPKS_VAR_LINUX 0x02 21 #define PLPKS_VAR_COMMON 0x04 22 23 struct plpks_var { 24 char *component; 25 u8 *name; 26 u8 *data; 27 u32 policy; 28 u16 namelen; 29 u16 datalen; 30 u8 os; 31 }; 32 33 struct plpks_var_name { 34 u8 *name; 35 u16 namelen; 36 }; 37 38 struct plpks_var_name_list { 39 u32 varcount; 40 struct plpks_var_name varlist[]; 41 }; 42 43 /** 44 * Writes the specified var and its data to PKS. 45 * Any caller of PKS driver should present a valid component type for 46 * their variable. 47 */ 48 int plpks_write_var(struct plpks_var var); 49 50 /** 51 * Removes the specified var and its data from PKS. 52 */ 53 int plpks_remove_var(char *component, u8 varos, 54 struct plpks_var_name vname); 55 56 /** 57 * Returns the data for the specified os variable. 58 */ 59 int plpks_read_os_var(struct plpks_var *var); 60 61 /** 62 * Returns the data for the specified firmware variable. 63 */ 64 int plpks_read_fw_var(struct plpks_var *var); 65 66 /** 67 * Returns the data for the specified bootloader variable. 68 */ 69 int plpks_read_bootloader_var(struct plpks_var *var); 70 71 #endif 72