mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
SubStorage in AesXtsFile should be resizable
This commit is contained in:
parent
ff96c8575b
commit
7dd21ae05b
2 changed files with 5 additions and 2 deletions
|
@ -126,7 +126,7 @@ namespace LibHac.Fs
|
||||||
{
|
{
|
||||||
return offset >= 0 &&
|
return offset >= 0 &&
|
||||||
size >= 0 &&
|
size >= 0 &&
|
||||||
offset <= offset - size;
|
offset <= offset + size;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Result DoRead(long offset, Span<byte> destination);
|
protected abstract Result DoRead(long offset, Span<byte> destination);
|
||||||
|
|
|
@ -42,7 +42,10 @@ namespace LibHac.FsSystem
|
||||||
ThrowHelper.ThrowResult(ResultFs.AesXtsFileTooShort.Value, "NAX0 key derivation failed.");
|
ThrowHelper.ThrowResult(ResultFs.AesXtsFileTooShort.Value, "NAX0 key derivation failed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
IStorage encStorage = BaseFile.AsStorage().Slice(HeaderLength, Utilities.AlignUp(Header.Size, 0x10));
|
var fileStorage = new FileStorage2(baseFile);
|
||||||
|
var encStorage = new SubStorage(fileStorage, HeaderLength, fileSize - HeaderLength);
|
||||||
|
encStorage.SetResizable(true);
|
||||||
|
|
||||||
BaseStorage = new CachedStorage(new Aes128XtsStorage(encStorage, Header.DecryptedKey1, Header.DecryptedKey2, BlockSize, true), 4, true);
|
BaseStorage = new CachedStorage(new Aes128XtsStorage(encStorage, Header.DecryptedKey1, Header.DecryptedKey2, BlockSize, true), 4, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue