diff --git a/programs/nstool/source/AesCtrWrappedIFile.cpp b/programs/nstool/source/AesCtrWrappedIFile.cpp index 3acebd7..c322560 100644 --- a/programs/nstool/source/AesCtrWrappedIFile.cpp +++ b/programs/nstool/source/AesCtrWrappedIFile.cpp @@ -21,8 +21,6 @@ void AesCtrWrappedIFile::seek(size_t offset) void AesCtrWrappedIFile::read(byte_t* out, size_t len) { - //printf("[%x] AesCtrWrappedIFile::read(offset=0x%" PRIx64 ", size=0x%" PRIx64 ")\n", this, mFileOffset, len); - size_t read_len; size_t read_pos; @@ -32,8 +30,6 @@ void AesCtrWrappedIFile::read(byte_t* out, size_t len) { read_len = _MIN(len - (i * kCacheSize), kCacheSize); read_pos = ((mFileOffset >> 4) << 4) + (i * kCacheSize); - - //printf("[%x] AesCtrWrappedIFile::read() CACHE READ: readlen=%" PRIx64 "\n", this, read_len); (*mFile)->seek(read_pos); (*mFile)->read(mCache.data(), kCacheSizeAllocSize); @@ -64,8 +60,6 @@ void AesCtrWrappedIFile::write(const byte_t* in, size_t len) { write_len = _MIN(len - (i * kCacheSize), kCacheSize); write_pos = ((mFileOffset >> 4) << 4) + (i * kCacheSize); - - //printf("[%x] AesCtrWrappedIFile::read() CACHE READ: readlen=%" PRIx64 "\n", this, read_len); memcpy(mCache.data() + (mFileOffset & 0xf), in + (i * kCacheSize), write_len); @@ -77,25 +71,6 @@ void AesCtrWrappedIFile::write(const byte_t* in, size_t len) } seek(mFileOffset + len); - - /* - for (size_t i = 0; i < (len / kAesCtrScratchSize); i++) - { - memcpy(mScratch.data() + mBlockOffset, out + (i * kAesCtrScratchSize), kAesCtrScratchSize); - fnd::aes::AesCtr(mScratch.data(), kAesCtrScratchAllocSize, mKey.key, mCurrentCtr.iv, mScratch.data()); - (*mFile)->write(mScratch.data() + mBlockOffset, kAesCtrScratchSize); - } - - if (len % kAesCtrScratchSize) - { - size_t write_len = len % kAesCtrScratchSize; - size_t write_pos = ((len / kAesCtrScratchSize) * kAesCtrScratchSize); - memcpy(mScratch.data() + mBlockOffset, out + write_pos, write_len); - fnd::aes::AesCtr(mScratch.data(), kAesCtrScratchAllocSize, mKey.key, mCurrentCtr.iv, mScratch.data()); - (*mFile)->write(mScratch.data() + mBlockOffset, write_len); - } - */ - seek(mFileOffset + len); } void AesCtrWrappedIFile::write(const byte_t* in, size_t offset, size_t len) diff --git a/programs/nstool/source/LayeredIntegrityWrappedIFile.cpp b/programs/nstool/source/LayeredIntegrityWrappedIFile.cpp index 41b9faa..f2148d2 100644 --- a/programs/nstool/source/LayeredIntegrityWrappedIFile.cpp +++ b/programs/nstool/source/LayeredIntegrityWrappedIFile.cpp @@ -143,12 +143,9 @@ void LayeredIntegrityWrappedIFile::initialiseDataLayer(const LayeredIntegrityMet mDataOffset = 0; mDataBlockSize = hdr.getDataLayer().block_size; - // allocate scratchpad - //mScratch.alloc(mDataBlockSize * 0x10); + // allocate cache size_t cache_size = align(kDefaultCacheSize, mDataBlockSize); mCacheBlockNum = cache_size / mDataBlockSize; - //printf("Block Size: 0x%" PRIx64 "\n", mDataBlockSize); - //printf("Cache size: 0x%" PRIx64 ", (block_num: %" PRId64 ")\n", cache_size, mCacheBlockNum); mCache.alloc(cache_size); } @@ -180,8 +177,6 @@ void LayeredIntegrityWrappedIFile::readData(size_t block_offset, size_t block_nu throw fnd::Exception(kModuleName, "Read excessive of cache size"); } - //printf("readlen=0x%" PRIx64 "\n", read_len); - // validate blocks size_t validate_size; for (size_t i = 0; i < block_num; i++)