]> wimlib.net Git - wimlib/blob - include/wimlib/security.h
Adjust endianness detection
[wimlib] / include / wimlib / security.h
1 #ifndef _WIMLIB_SECURITY_H
2 #define _WIMLIB_SECURITY_H
3
4 #include "wimlib/types.h"
5
6 struct wim_security_data;
7 struct avl_tree_node;
8
9 /* Map from SHA1 message digests of security descriptors to security IDs, which
10  * are themselves indices into the table of security descriptors in the 'struct
11  * wim_security_data'. */
12 struct wim_sd_set {
13         struct wim_security_data *sd;
14         struct avl_tree_node *root;
15         int32_t orig_num_entries;
16 };
17
18 /* Table of security descriptors for a WIM image. */
19 struct wim_security_data {
20         /* The total length of the security data, in bytes.  If there are no
21          * security descriptors, this field, when read from the on-disk metadata
22          * resource, may be either 8 (which is correct) or 0 (which is
23          * interpreted as 8). */
24         u32 total_length;
25
26         /* The number of security descriptors in the array @descriptors. */
27         u32 num_entries;
28
29         /* Array of sizes of the descriptors, in bytes, in the array
30          * @descriptors. */
31         u64 *sizes;
32
33         /* Array of pointers to the security descriptors in the
34          * SECURITY_DESCRIPTOR_RELATIVE format. */
35         u8 **descriptors;
36 };
37
38 extern void
39 rollback_new_security_descriptors(struct wim_sd_set *sd_set);
40
41 extern void
42 destroy_sd_set(struct wim_sd_set *sd_set);
43
44 extern int32_t
45 sd_set_add_sd(struct wim_sd_set *sd_set, const char descriptor[],
46               size_t size);
47
48 extern int
49 init_sd_set(struct wim_sd_set *sd_set, struct wim_security_data *sd);
50
51 extern struct wim_security_data *
52 new_wim_security_data(void);
53
54 extern int
55 read_wim_security_data(const u8 *buf, size_t buf_len,
56                        struct wim_security_data **sd_ret);
57
58 extern u8 *
59 write_wim_security_data(const struct wim_security_data * restrict sd,
60                         u8 * restrict p);
61
62 extern void
63 print_wim_security_data(const struct wim_security_data *sd);
64
65 extern void
66 free_wim_security_data(struct wim_security_data *sd);
67
68 #endif /* _WIMLIB_SECURITY_H */