^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2019 IBM Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Author: Nayna Jain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * PowerPC secure variable operations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #ifndef SECVAR_OPS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define SECVAR_OPS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) extern const struct secvar_operations *secvar_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct secvar_operations {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) int (*get)(const char *key, uint64_t key_len, u8 *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) uint64_t *data_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) int (*get_next)(const char *key, uint64_t *key_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) uint64_t keybufsize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) int (*set)(const char *key, uint64_t key_len, u8 *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) uint64_t data_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #ifdef CONFIG_PPC_SECURE_BOOT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) extern void set_secvar_ops(const struct secvar_operations *ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) static inline void set_secvar_ops(const struct secvar_operations *ops) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #endif