summaryrefslogtreecommitdiff
path: root/include/linux/turris-signing-key.h
blob: 8a435b73c3a94a9926fdb0146f82c539e5027759 (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
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * 2025 by Marek Behún <kabel@kernel.org>
 */

#ifndef __TURRIS_SIGNING_KEY_H
#define __TURRIS_SIGNING_KEY_H

#include <linux/key.h>
#include <linux/types.h>

struct device;

#ifdef CONFIG_KEYS
struct turris_signing_key_subtype {
	u16 key_size;
	u8 data_size;
	u8 sig_size;
	u8 public_key_size;
	const char *hash_algo;
	const void *(*get_public_key)(const struct key *key);
	int (*sign)(const struct key *key, const void *msg, void *signature);
};

static inline struct device *turris_signing_key_get_dev(const struct key *key)
{
	return key->payload.data[1];
}

int
devm_turris_signing_key_create(struct device *dev, const struct turris_signing_key_subtype *subtype,
			       const char *desc);
#endif

#endif /* __TURRIS_SIGNING_KEY_H */