2016-12-05 22:54:36 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
2017-04-17 23:38:30 +02:00
|
|
|
#define KEYDB_NAME "aeskeydb.bin"
|
|
|
|
|
2016-12-05 22:54:36 +01:00
|
|
|
#define KEYS_UNKNOWN 0
|
2017-05-21 21:15:01 +02:00
|
|
|
#define KEYS_DEVKIT 1
|
|
|
|
#define KEYS_RETAIL 2
|
2016-12-05 22:54:36 +01:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
u8 slot; // keyslot, 0x00...0x3F
|
2017-05-21 21:15:01 +02:00
|
|
|
char type; // type 'X' / 'Y' / 'N' for normalKey / 'I' for IV
|
2016-12-05 22:54:36 +01:00
|
|
|
char id[10]; // key ID for special keys, all zero for standard keys
|
|
|
|
u8 reserved[2]; // reserved space
|
2017-05-21 21:15:01 +02:00
|
|
|
u8 keyUnitType; // 0 for ALL units / 1 for devkit exclusive / 2 for retail exclusive
|
2016-12-05 22:54:36 +01:00
|
|
|
u8 isEncrypted; // 0 if not / anything else if it is
|
|
|
|
u8 key[16];
|
|
|
|
} __attribute__((packed)) AesKeyInfo;
|
|
|
|
|
|
|
|
u32 GetUnitKeysType(void);
|
2017-04-17 23:45:49 +02:00
|
|
|
void CryptAesKeyInfo(AesKeyInfo* info);
|
2017-08-01 00:09:41 +02:00
|
|
|
u32 LoadKeyFromFile(void* key, u32 keyslot, char type, char* id);
|
2017-08-15 02:16:53 +02:00
|
|
|
u32 InitKeyDb(const char* path);
|
2017-09-08 20:25:48 +02:00
|
|
|
u32 CheckRecommendedKeyDb(const char* path);
|