1 #ifndef _WIMLIB_SECURITY_H
2 #define _WIMLIB_SECURITY_H
4 #include "wimlib/rbtree.h"
5 #include "wimlib/types.h"
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'. */
11 struct wim_security_data *sd;
12 struct rb_root rb_root;
13 int32_t orig_num_entries;
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 0). */
24 /* The number of security descriptors in the array @descriptors, below.
25 * It is really an unsigned int on-disk, but it must fit into an int
26 * because the security ID's are signed. (Not like you would ever have
27 * more than a few hundred security descriptors anyway.) */
30 /* Array of sizes of the descriptors in the array @descriptors. */
33 /* Array of descriptors. */
38 destroy_sd_set(struct wim_sd_set *sd_set, bool rollback);
41 lookup_sd(struct wim_sd_set *set, const u8 hash[]);
44 sd_set_add_sd(struct wim_sd_set *sd_set, const char descriptor[],
48 init_sd_set(struct wim_sd_set *sd_set, struct wim_security_data *sd);
50 extern struct wim_security_data *
51 new_wim_security_data(void);
54 read_security_data(const u8 metadata_resource[],
55 u64 metadata_resource_len, struct wim_security_data **sd_p);
57 print_security_data(const struct wim_security_data *sd);
60 write_security_data(const struct wim_security_data *sd, u8 *p);
63 free_security_data(struct wim_security_data *sd);
65 #endif /* _WIMLIB_SECURITY_H */