mirror of
https://github.com/DarkStore-3DS/Project_CTR.git
synced 2026-07-03 00:39:14 +00:00
[makerom] Fixed size limitation on NCCH encryption.
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@ void AesCtrCrypt(u8 *key, u8 *ctr, u8 *input, u8 *output, u64 length, u64 offset
|
||||
{
|
||||
u8 stream[16];
|
||||
aes_context aes;
|
||||
u64 nc_off = 0;
|
||||
size_t nc_off = 0;
|
||||
|
||||
clrmem(&aes,sizeof(aes_context));
|
||||
aes_setkey_enc(&aes, key, 128);
|
||||
|
||||
@@ -201,6 +201,8 @@
|
||||
<ClCompile Include="code.c" />
|
||||
<ClCompile Include="crypto.c" />
|
||||
<ClCompile Include="ctr_utils.c" />
|
||||
<ClCompile Include="polarssl\aes.c" />
|
||||
<ClCompile Include="polarssl\padlock.c" />
|
||||
<ClCompile Include="romfs_fs.c" />
|
||||
<ClCompile Include="elf.c" />
|
||||
<ClCompile Include="exefs.c" />
|
||||
|
||||
@@ -473,6 +473,12 @@
|
||||
<ClCompile Include="romfs_fs.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="polarssl\aes.c">
|
||||
<Filter>Source Files\polarssl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="polarssl\padlock.c">
|
||||
<Filter>Source Files\polarssl</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Makefile">
|
||||
|
||||
+11
-11
@@ -1053,7 +1053,7 @@ int GetNcchInfo(ncch_info *info, ncch_hdr *hdr)
|
||||
info->titleId = u8_to_u64(hdr->titleId,LE);
|
||||
info->programId = u8_to_u64(hdr->programId,LE);
|
||||
|
||||
u32 block_size = GetNcchBlockSize(hdr);
|
||||
u64 block_size = GetNcchBlockSize(hdr);
|
||||
|
||||
info->formatVersion = u8_to_u16(hdr->formatVersion,LE);
|
||||
if(!IsCfa(hdr)){
|
||||
@@ -1061,18 +1061,18 @@ int GetNcchInfo(ncch_info *info, ncch_hdr *hdr)
|
||||
info->exhdrSize = u8_to_u32(hdr->exhdrSize,LE);
|
||||
info->acexOffset = (info->exhdrOffset + info->exhdrSize);
|
||||
info->acexSize = sizeof(access_descriptor);
|
||||
info->plainRegionOffset = (u64)(u8_to_u32(hdr->plainRegionOffset,LE)*block_size);
|
||||
info->plainRegionSize = (u64)(u8_to_u32(hdr->plainRegionSize,LE)*block_size);
|
||||
info->plainRegionOffset = ((u64)u8_to_u32(hdr->plainRegionOffset,LE))*block_size;
|
||||
info->plainRegionSize = ((u64)u8_to_u32(hdr->plainRegionSize,LE))*block_size;
|
||||
}
|
||||
|
||||
info->logoOffset = (u64)(u8_to_u32(hdr->logoOffset,LE)*block_size);
|
||||
info->logoSize = (u64)(u8_to_u32(hdr->logoSize,LE)*block_size);
|
||||
info->exefsOffset = (u64)(u8_to_u32(hdr->exefsOffset,LE)*block_size);
|
||||
info->exefsSize = (u64)(u8_to_u32(hdr->exefsSize,LE)*block_size);
|
||||
info->exefsHashDataSize = (u64)(u8_to_u32(hdr->exefsHashSize,LE)*block_size);
|
||||
info->romfsOffset = (u64) (u8_to_u32(hdr->romfsOffset,LE)*block_size);
|
||||
info->romfsSize = (u64) (u8_to_u32(hdr->romfsSize,LE)*block_size);
|
||||
info->romfsHashDataSize = (u64)(u8_to_u32(hdr->romfsHashSize,LE)*block_size);
|
||||
info->logoOffset = ((u64)u8_to_u32(hdr->logoOffset,LE))*block_size;
|
||||
info->logoSize = ((u64)u8_to_u32(hdr->logoSize,LE))*block_size;
|
||||
info->exefsOffset = ((u64)u8_to_u32(hdr->exefsOffset,LE))*block_size;
|
||||
info->exefsSize = ((u64)u8_to_u32(hdr->exefsSize,LE))*block_size;
|
||||
info->exefsHashDataSize = ((u64)u8_to_u32(hdr->exefsHashSize,LE))*block_size;
|
||||
info->romfsOffset = ((u64)u8_to_u32(hdr->romfsOffset,LE))*block_size;
|
||||
info->romfsSize = ((u64)u8_to_u32(hdr->romfsSize,LE))*block_size;
|
||||
info->romfsHashDataSize = ((u64)u8_to_u32(hdr->romfsHashSize,LE))*block_size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -839,14 +839,14 @@ int aes_crypt_cbc( aes_context *ctx,
|
||||
*/
|
||||
int aes_crypt_cfb128( aes_context *ctx,
|
||||
int mode,
|
||||
size_t length,
|
||||
uint64_t length,
|
||||
size_t *iv_off,
|
||||
unsigned char iv[16],
|
||||
const unsigned char *input,
|
||||
unsigned char *output )
|
||||
{
|
||||
int c;
|
||||
size_t n = *iv_off;
|
||||
size_t n = *iv_off;
|
||||
|
||||
if( mode == AES_DECRYPT )
|
||||
{
|
||||
@@ -886,7 +886,7 @@ int aes_crypt_cfb128( aes_context *ctx,
|
||||
* AES-CTR buffer encryption/decryption
|
||||
*/
|
||||
int aes_crypt_ctr( aes_context *ctx,
|
||||
size_t length,
|
||||
uint64_t length,
|
||||
size_t *nc_off,
|
||||
unsigned char nonce_counter[16],
|
||||
unsigned char stream_block[16],
|
||||
|
||||
@@ -116,7 +116,7 @@ int aes_crypt_ecb( aes_context *ctx,
|
||||
*/
|
||||
int aes_crypt_cbc( aes_context *ctx,
|
||||
int mode,
|
||||
size_t length,
|
||||
uint64_t length,
|
||||
unsigned char iv[16],
|
||||
const unsigned char *input,
|
||||
unsigned char *output );
|
||||
@@ -141,7 +141,7 @@ int aes_crypt_cbc( aes_context *ctx,
|
||||
*/
|
||||
int aes_crypt_cfb128( aes_context *ctx,
|
||||
int mode,
|
||||
size_t length,
|
||||
uint64_t length,
|
||||
size_t *iv_off,
|
||||
unsigned char iv[16],
|
||||
const unsigned char *input,
|
||||
@@ -169,7 +169,7 @@ int aes_crypt_cfb128( aes_context *ctx,
|
||||
* \return 0 if successful
|
||||
*/
|
||||
int aes_crypt_ctr( aes_context *ctx,
|
||||
size_t length,
|
||||
uint64_t length,
|
||||
size_t *nc_off,
|
||||
unsigned char nonce_counter[16],
|
||||
unsigned char stream_block[16],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "lib.h"
|
||||
#include "dir.h"
|
||||
#include "romfs_fs.h"
|
||||
#include "ncch_build.h"
|
||||
#include "romfs.h"
|
||||
|
||||
@@ -30,4 +30,4 @@ int ImportRomFsBinaryFromFile(romfs_buildctx *ctx)
|
||||
return INVALID_ROMFS_FILE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -36,12 +36,12 @@ typedef enum
|
||||
MAX_U64 = 0xffffffffffffffff,
|
||||
} data_type_max;
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned int u32;
|
||||
typedef unsigned long long u64;
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
|
||||
typedef signed char s8;
|
||||
typedef signed short s16;
|
||||
typedef signed int s32;
|
||||
typedef signed long long s64;
|
||||
typedef int8_t s8;
|
||||
typedef int16_t s16;
|
||||
typedef int32_t s32;
|
||||
typedef int64_t s64;
|
||||
|
||||
Reference in New Issue
Block a user