summaryrefstree
path: root/kernel/security/proca/proca_certificate.h
blob: 78904832729f13e92270d88ac6fa16f6574f99e0 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * PROCA certificate
 *
 * Copyright (C) 2018 Samsung Electronics, Inc.
 * Hryhorii Tur, <hryhorii.tur@partner.samsung.com>
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef _LINUX_PROCA_CERTIFICATE_H
#define _LINUX_PROCA_CERTIFICATE_H

#include <linux/types.h>

#include "proca_porting.h"

struct proca_certificate {
	char *app_name;
	size_t app_name_size;

	char *five_signature_hash;
	size_t five_signature_hash_size;

	uint32_t flags;
};

int parse_proca_certificate(const char *certificate_buff,
			    const size_t buff_size,
			    struct proca_certificate *parsed_cert);

void deinit_proca_certificate(struct proca_certificate *certificate);

int compare_with_five_signature(const struct proca_certificate *certificate,
				const void *five_signature,
				const size_t five_signature_size);

int init_certificate_validation_hash(void);

int proca_certificate_copy(struct proca_certificate *dst,
			const struct proca_certificate *src);

bool is_certificate_relevant_to_task(
			const struct proca_certificate *parsed_cert,
			struct task_struct *task);

#endif //_LINUX_PROCA_CERTIFICATE_H