• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) 2023 Huawei Device Co., Ltd.
4  */
5 
6 #include <linux/code_sign.h>
7 #include <linux/rbtree.h>
8 #include <../../crypto/asymmetric_keys/pkcs7_parser.h>
9 
10 #ifndef _CODE_SIGN_H
11 #define _CODE_SIGN_H
12 
13 struct cert_chain_info {
14 	__u32 signing_length;
15 	__u32 issuer_length;
16 	__u64 signing_ptr;
17 	__u64 issuer_ptr;
18 	__u32 path_len;
19 	__s32 cert_type;
20 	__u8 __reserved[32];
21 };
22 
23 struct cert_source {
24 	char *subject;
25 	char *issuer;
26 	unsigned int max_path_depth;
27 	int path_type;
28 	unsigned int cnt;
29 	struct rb_node node;
30 };
31 
32 #define ADD_CERT_CHAIN _IOW('k', 1, struct cert_chain_info)
33 #define REMOVE_CERT_CHAIN _IOW('k', 2, struct cert_chain_info)
34 
35 #define CERT_CHAIN_PATH_LEN_MAX 3
36 
37 #define KEY_ENABLE_CTX "u:r:key_enable:"
38 
39 /*
40  * cert_chain.c
41  */
42 struct cert_source *find_match(const char *subject, const char *issuer, bool is_dev);
43 
44 int code_sign_avc_has_perm(u16 tclass, u32 requested);
45 
46 int code_sign_open(struct inode *inode, struct file *filp);
47 
48 int code_sign_release(struct inode *inode, struct file *filp);
49 
50 long code_sign_ioctl(struct file *filp, unsigned int cmd, unsigned long args);
51 
52 #endif /* _CODE_SIGN_H */
53