Import initial data key_x (prod/dev included)

This commit is contained in:
jakcron
2022-04-17 09:59:12 +08:00
parent 23fb3821d5
commit 059610f41e
4 changed files with 28 additions and 0 deletions
+14
View File
@@ -80,6 +80,9 @@ int LoadKeysFromResources(keys_struct *keys)
SetNormalKey(keys,zeros_aesKey);
SetSystemFixedKey(keys,zeros_aesKey);
// CCI
SetCciInitialDataKeyX(keys, zeros_aesKey);
/* RSA Keys */
// CIA
Rsa2048Key_Set(&keys->rsa.xs, tpki_rsa.priv_exponent, tpki_rsa.modulus);
@@ -112,6 +115,9 @@ int LoadKeysFromResources(keys_struct *keys)
for(int i = 0; i < 4; i++)
SetNcchKeyX(keys, dev_unfixed_ncch_keyX[i],i);
// CCI
SetCciInitialDataKeyX(keys, dev_initial_data_keyx);
/* RSA Keys */
// CIA
Rsa2048Key_Set(&keys->rsa.xs, xs9_dpki_rsa.priv_exponent, xs9_dpki_rsa.modulus);
@@ -143,6 +149,8 @@ int LoadKeysFromResources(keys_struct *keys)
for(int i = 0; i < 4; i++)
SetNcchKeyX(keys, prod_unfixed_ncch_keyX[i],i);
// CCI
SetCciInitialDataKeyX(keys, dev_initial_data_keyx);
/* RSA Keys */
// CIA
@@ -362,6 +370,12 @@ int SetSystemFixedKey(keys_struct *keys, const u8 *key)
return CopyData(&keys->aes.systemFixedKey,key,16);
}
int SetCciInitialDataKeyX(keys_struct *keys, const u8 *key)
{
if(!keys) return -1;
return CopyData(&keys->aes.initialDataKeyX,key,16);
}
int SetCaCert(keys_struct *keys, const u8 *cert)
{
if(!keys) return -1;
+4
View File
@@ -62,6 +62,9 @@ typedef struct
u8 *ncchKey0;
u8 *ncchKey1;
// CCI
u8 *initialDataKeyX;
} aes;
struct
@@ -96,6 +99,7 @@ int SetCommonKey(keys_struct *keys, const u8 *key, u8 Index);
int SetCurrentCommonKey(keys_struct *keys, u8 Index);
int SetNormalKey(keys_struct *keys, const u8 *key);
int SetSystemFixedKey(keys_struct *keys, const u8 *key);
int SetCciInitialDataKeyX(keys_struct *keys, const u8 *key);
void Rsa2048Key_Alloc(rsa2048_key* key);
void Rsa2048Key_Free(rsa2048_key* key);
+5
View File
@@ -30,6 +30,11 @@ static const unsigned char ctr_common_etd_key_dpki[6][16] =
{ 0xAA, 0xDA, 0x4C, 0xA8, 0xF6, 0xE5, 0xA9, 0x77, 0xE0, 0xA0, 0xF9, 0xE4, 0x76, 0xCF, 0x0D, 0x63 }
};
static const unsigned char dev_initial_data_keyx[16] =
{
0x5C, 0x3D, 0x38, 0xAC, 0x17, 0x40, 0x99, 0x4E, 0xFC, 0x8F, 0xD0, 0xBE, 0x8D, 0x80, 0x97, 0xB3
};
//RSA Keys
static const CtrRsa4096Key root_dpki_rsa =
{
+5
View File
@@ -23,6 +23,11 @@ static const unsigned char ctr_common_etd_key_ppki[6][16] =
{ 0xA5, 0x05, 0x1C, 0xA1, 0xB3, 0x7D, 0xCF, 0x3A, 0xFB, 0xCF, 0x8C, 0xC1, 0xED, 0xD9, 0xCE, 0x02 } , // 5
};
static const unsigned char prod_initial_data_keyx[16] =
{
0xB5, 0x29, 0x22, 0x1C, 0xDD, 0xB5, 0xDB, 0x5A, 0x1B, 0xF2, 0x6E, 0xFF, 0x20, 0x41, 0xE8, 0x75
};
// RSA KEYS
static const CtrRsa4096Key root_ppki_rsa =
{