1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * 2025 by Marek Behún <kabel@kernel.org> 4 */ 5 6 #ifndef __TURRIS_SIGNING_KEY_H 7 #define __TURRIS_SIGNING_KEY_H 8 9 #include <linux/key.h> 10 #include <linux/types.h> 11 12 struct device; 13 14 #ifdef CONFIG_KEYS 15 struct turris_signing_key_subtype { 16 u16 key_size; 17 u8 data_size; 18 u8 sig_size; 19 u8 public_key_size; 20 const char *hash_algo; 21 const void *(*get_public_key)(const struct key *key); 22 int (*sign)(const struct key *key, const void *msg, void *signature); 23 }; 24 turris_signing_key_get_dev(const struct key * key)25static inline struct device *turris_signing_key_get_dev(const struct key *key) 26 { 27 return key->payload.data[1]; 28 } 29 30 int 31 devm_turris_signing_key_create(struct device *dev, const struct turris_signing_key_subtype *subtype, 32 const char *desc); 33 #endif 34 35 #endif /* __TURRIS_SIGNING_KEY_H */ 36