diff --git a/makerom/crypto.c b/makerom/crypto.c index e83b9f7..f654efe 100644 --- a/makerom/crypto.c +++ b/makerom/crypto.c @@ -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); diff --git a/makerom/makerom.vcxproj b/makerom/makerom.vcxproj index 195b75f..7ec49cd 100644 --- a/makerom/makerom.vcxproj +++ b/makerom/makerom.vcxproj @@ -201,6 +201,8 @@ + + diff --git a/makerom/makerom.vcxproj.filters b/makerom/makerom.vcxproj.filters index b0c347c..6603f55 100644 --- a/makerom/makerom.vcxproj.filters +++ b/makerom/makerom.vcxproj.filters @@ -473,6 +473,12 @@ Source Files + + Source Files\polarssl + + + Source Files\polarssl + diff --git a/makerom/ncch.c b/makerom/ncch.c index 7182f53..ecfd7ee 100644 --- a/makerom/ncch.c +++ b/makerom/ncch.c @@ -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; } diff --git a/makerom/polarssl/aes.c b/makerom/polarssl/aes.c index 6456c54..8d8ebb6 100644 --- a/makerom/polarssl/aes.c +++ b/makerom/polarssl/aes.c @@ -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], diff --git a/makerom/polarssl/aes.h b/makerom/polarssl/aes.h index 0a4519c..469bef3 100644 --- a/makerom/polarssl/aes.h +++ b/makerom/polarssl/aes.h @@ -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], diff --git a/makerom/romfs_import.c b/makerom/romfs_import.c index 48d68f6..37762bf 100644 --- a/makerom/romfs_import.c +++ b/makerom/romfs_import.c @@ -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; -} \ No newline at end of file +} diff --git a/makerom/types.h b/makerom/types.h index c12d242..4f8696f 100644 --- a/makerom/types.h +++ b/makerom/types.h @@ -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;