mirror of
https://github.com/DarkStore-3DS/Project_CTR.git
synced 2026-07-03 00:39:14 +00:00
big update
lots cleaned, added cia to cci conv, it 's called a block, separated reading from building, improved ncch keyx stuff, and basic verbose for keys, elf checking and romfs
This commit is contained in:
+7
-15
@@ -1,6 +1,13 @@
|
||||
#include "lib.h"
|
||||
#include "crypto.h"
|
||||
|
||||
bool VerifySha256(void *data, u64 size, u8 hash[32])
|
||||
{
|
||||
u8 calchash[32];
|
||||
ctr_sha(data, size, calchash, CTR_SHA_256);
|
||||
return memcmp(hash,calchash,32) == 0;
|
||||
}
|
||||
|
||||
void ctr_sha(void *data, u64 size, u8 *hash, int mode)
|
||||
{
|
||||
switch(mode){
|
||||
@@ -9,21 +16,6 @@ void ctr_sha(void *data, u64 size, u8 *hash, int mode)
|
||||
}
|
||||
}
|
||||
|
||||
u8* AesKeyScrambler(u8 *Key, u8 *KeyX, u8 *KeyY)
|
||||
{
|
||||
// Process KeyX/KeyY to get raw normal key
|
||||
for(int i = 0; i < 16; i++)
|
||||
Key[i] = KeyX[i] ^ ((KeyY[i] >> 2) | ((KeyY[i < 15 ? i+1 : 0] & 3) << 6));
|
||||
|
||||
const u8 SCRAMBLE_SECRET[16] = {0x51, 0xD7, 0x5D, 0xBE, 0xFD, 0x07, 0x57, 0x6A, 0x1C, 0xFC, 0x2A, 0xF0, 0x94, 0x4B, 0xD5, 0x6C};
|
||||
|
||||
// Apply Secret to get final normal key
|
||||
for(int i = 0; i < 16; i++)
|
||||
Key[i] = Key[i] ^ SCRAMBLE_SECRET[i];
|
||||
|
||||
return Key;
|
||||
}
|
||||
|
||||
void ctr_add_counter(ctr_aes_context* ctx, u32 carry)
|
||||
{
|
||||
u32 counter[4];
|
||||
|
||||
Reference in New Issue
Block a user