MIG-Vita/cmd56/cmd56.h
2024-02-15 17:40:56 +13:00

47 lines
1.3 KiB
C

#ifndef CMD56_H
#define CMD56_H 1
#include <stdint.h>
static char key0[0x20] = { 0xDD, 0x10, 0x25, 0x44, 0x15, 0x23, 0xFD, 0xC0, 0xF9, 0xE9, 0x15, 0x26, 0xDC, 0x2A, 0xE0, 0x84, 0xA9, 0x03, 0xA2, 0x97, 0xD4, 0xBB, 0xF8, 0x52, 0xD3, 0xD4, 0x94, 0x2C, 0x89, 0x03, 0xCC, 0x77 };
typedef struct src_packet_header {
uint8_t key[0x20];
uint32_t response_code;
uint32_t data_size;
uint32_t response_size;
uint8_t command;
uint8_t unknown_host_value;
uint8_t additional_data_size;
uint8_t data[0x1d1];
} __attribute__((packed)) src_packet_header;
typedef struct dst_packet_header {
uint32_t response_code;
uint32_t additional_data_size;
uint16_t response_size;
uint8_t error_code;
uint8_t data[0x1f5];
} __attribute__((packed)) dst_packet_header;
enum CART_STATUS {
READ_WRITE_LOCK = 0xFF,
ALL_OK = 0x00
};
enum PACKET_SUB_COMMANDS {
START = 0xC4,
GET_STATUS = 0xC2,
GENERATE_RANDOM_KEYSEED = 0xA1,
ENCRYPT_VITA_RANDOM = 0xA2,
VITA_AUTHENTICITY_CHECK = 0xA3,
CHALLENGE = 0xA4,
KLIC_PART_AND_CMAC_SIGNATURE = 0xB1,
RIFBUF_KEY_PART = 0xC1
};
// exposed functions:
void cmd56_reset();
void cmd56_update_keyid(uint16_t key_id);
void cmd56_set_keys(char* rif_part, char* klic_part);
void cmd56_run(char* buffer);
#endif