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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/*
* Copyright (c) 2016 Andreas Schneider <asn@samba.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _MSCAT_H
#define _MSCAT_H
#include <stdbool.h>
#include <talloc.h>
#include <gnutls/pkcs7.h>
#include <libtasn1.h>
enum mscat_mac_algorithm {
MSCAT_MAC_UNKNOWN,
MSCAT_MAC_NULL,
MSCAT_MAC_MD5,
MSCAT_MAC_SHA1,
MSCAT_MAC_SHA256,
MSCAT_MAC_SHA512
};
struct mscat_pkcs7;
struct mscat_pkcs7 *mscat_pkcs7_init(TALLOC_CTX *mem_ctx);
int mscat_pkcs7_import_catfile(struct mscat_pkcs7 *mp7,
const char *catfile);
int mscat_pkcs7_verify(struct mscat_pkcs7 *mp7,
const char *ca_file);
struct mscat_ctl;
struct mscat_ctl *mscat_ctl_init(TALLOC_CTX *mem_ctx);
int mscat_ctl_import(struct mscat_ctl *ctl,
struct mscat_pkcs7 *pkcs7);
int mscat_ctl_get_member_count(struct mscat_ctl *ctl);
enum mscat_checksum_type {
MSCAT_CHECKSUM_STRING = 1,
MSCAT_CHECKSUM_BLOB
};
struct mscat_ctl_member {
struct {
enum mscat_checksum_type type;
union {
const char *string;
uint8_t *blob;
};
size_t size;
} checksum;
struct {
const char *name;
uint32_t flags;
} file;
struct {
const char *value;
uint32_t flags;
} osattr;
struct {
const char *guid;
uint32_t id;
} info;
struct {
enum mscat_mac_algorithm type;
uint8_t *digest;
size_t digest_size;
} mac;
};
int mscat_ctl_get_member(struct mscat_ctl *ctl,
TALLOC_CTX *mem_ctx,
unsigned int idx,
struct mscat_ctl_member **member);
int mscat_ctl_get_attribute_count(struct mscat_ctl *ctl);
struct mscat_ctl_attribute {
const char *name;
uint32_t flags;
const char *value;
};
int mscat_ctl_get_attribute(struct mscat_ctl *ctl,
TALLOC_CTX *mem_ctx,
unsigned int idx,
struct mscat_ctl_attribute **pattribute);
#endif /* _MSCAT_H */
|