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