cs_dingling.h 964 B

1234567891011121314151617181920212223242526272829303132
  1. #include <stdlib.h>
  2. #include "cs_blobs.h"
  3. #define LOG(str, args...) do { NSLog(@"[amfid_payload] " str, ##args); } while(0)
  4. #define ERROR(str, args...) LOG("ERROR: [%s] " str, __func__, ##args)
  5. #define INFO(str, args...) LOG("INFO: " str, ##args)
  6. typedef struct {
  7. const char* name;
  8. uint64_t file_off;
  9. int fd;
  10. const void* addr;
  11. size_t size;
  12. } img_info_t;
  13. const uint8_t *find_code_signature(img_info_t *info, uint32_t *cs_size);
  14. int find_best_codedir(const void *csblob,
  15. uint32_t csblob_size,
  16. const CS_CodeDirectory **chosen_cd,
  17. uint32_t *csb_offset,
  18. const CS_GenericBlob **entitlements);
  19. int hash_code_directory(const CS_CodeDirectory *directory, uint8_t hash[CS_CDHASH_LEN]);
  20. static unsigned int hash_rank(const CS_CodeDirectory *cd);
  21. const char *get_hash_name(uint8_t hash_type);
  22. int open_img(img_info_t* info);
  23. void close_img(img_info_t* info);