]>
git.cameronkatri.com Git - trustcache.git/blob - trustcache.h
8 # include <libkern/OSByteOrder.h>
9 # define htole32(x) OSSwapHostToLittleInt32(x)
10 # define le32toh(x) OSSwapLittleToHostInt32(x)
11 #elif __has_include(<endian.h>)
14 # include <sys/endian.h>
17 #include "machoparse/cs_blobs.h"
18 #include "uuid/uuid.h"
20 struct trust_cache_entry2
{
21 uint8_t cdhash
[CS_CDHASH_LEN
];
25 } __attribute__((__packed__
));
27 struct trust_cache_entry1
{
28 uint8_t cdhash
[CS_CDHASH_LEN
];
31 } __attribute__((__packed__
));
33 typedef uint8_t trust_cache_hash0
[CS_CDHASH_LEN
];
40 struct trust_cache_entry2
*entries2
;
41 struct trust_cache_entry1
*entries
;
42 trust_cache_hash0
*hashes
;
44 } __attribute__((__packed__
));
47 #define CS_TRUST_CACHE_AMFID 0x1
48 #define CS_TRUST_CACHE_ANE 0x2
50 struct trust_cache
opentrustcache(const char *path
);
51 int writetrustcache(struct trust_cache cache
, const char *path
);
52 struct trust_cache
cache_from_tree(const char *path
, uint32_t version
);
54 int tcinfo(int argc
, char **argv
);
55 int tccreate(int argc
, char **argv
);
56 int tcappend(int argc
, char **argv
);
57 int tcremove(int argc
, char **argv
);
59 int ent_cmp(const void * vp1
, const void * vp2
);
60 int hash_cmp(const void * vp1
, const void * vp2
);
62 void print_header(struct trust_cache cache
);
63 void print_hash(uint8_t cdhash
[CS_CDHASH_LEN
], bool newline
);
64 void print_entry(struct trust_cache_entry1 entry
);
65 void print_entry2(struct trust_cache_entry2 entry
);
66 void print_entries(struct trust_cache cache
);