Sony PlayStation2 Study
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.3 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. # _____ ___ ____ ___ ____
  3. # ____| | ____| | | |____|
  4. # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
  5. #-----------------------------------------------------------------------
  6. # Copyright (c) 2009 jimmikaelkael
  7. # Licenced under Academic Free License version 2.0
  8. # Review ps2sdk README & LICENSE files for further details.
  9. */
  10. /**
  11. * @file
  12. * Definitions and imports for secrman module.
  13. */
  14. #ifndef __LIBSECR_COMMON_H__
  15. #define __LIBSECR_COMMON_H__
  16. #include <tamtypes.h>
  17. /** Encrypted file Data Block info struct */
  18. typedef struct SecrBitBlockData{
  19. /** Size of data block */
  20. u32 size;
  21. /** Flags : 0x01 = signed, 0x02 = encrypted. */
  22. u32 flags;
  23. u8 checksum[8];
  24. } SecrBitBlockData_t;
  25. typedef struct SecrBitTableHeader{
  26. /** KELF header size (same as SecrKELFHeader_t.KELF_header_size) */
  27. u32 headersize;
  28. /** Number of blocks in the KELF file */
  29. u8 block_count;
  30. u8 pad1;
  31. u8 pad2;
  32. u8 pad3;
  33. } SecrBitTableHeader_t;
  34. /** Encrypted file BIT table struct */
  35. typedef struct SecrBitTable {
  36. SecrBitTableHeader_t header;
  37. /** KELF section information. */
  38. SecrBitBlockData_t blocks[63];
  39. } SecrBitTable_t;
  40. /** Encrypted file header struct */
  41. typedef struct KELF_Header{
  42. u8 UserHeader[16];
  43. /** Size of data blocks = Decrypted elf size */
  44. u32 ELF_size;
  45. /** KELF header size */
  46. u16 KELF_header_size;
  47. u16 unknown5;
  48. /** Controls the layout of the KELF header. */
  49. u16 flags;
  50. /** Number of entries in the bit table. */
  51. u16 BIT_count;
  52. u32 mg_zones;
  53. } SecrKELFHeader_t;
  54. int SecrCardBootHeader(int port, int slot, void *buffer, SecrBitTable_t *BitTable, s32 *pSize);
  55. int SecrCardBootBlock(void *src, void *dst, unsigned int size);
  56. void *SecrCardBootFile(int port, int slot, void *buffer);
  57. int SecrDiskBootHeader(void *buffer, SecrBitTable_t *BitTable, s32 *pSize);
  58. int SecrDiskBootBlock(void *src, void *dst, unsigned int size);
  59. void *SecrDiskBootFile(void *buffer);
  60. /* FOLLOWING EXPORTS ARE ONLY AVAILABLE IN SPECIAL SECRMAN OR FREESECR */
  61. int SecrDownloadHeader(int port, int slot, void *buffer, SecrBitTable_t *BitTable, s32 *pSize);
  62. int SecrDownloadBlock(void *src, unsigned int size);
  63. void *SecrDownloadFile(int port, int slot, void *buffer);
  64. int SecrDownloadGetKbit(int port, int slot, void *kbit);
  65. int SecrDownloadGetKc(int port, int slot, void *kbit);
  66. int SecrDownloadGetICVPS2(void *icvps2);
  67. #endif /* __LIBSECR_COMMON_H__ */