added internal buffers to encrypted sockets

This commit is contained in:
2025-11-06 22:27:41 +05:00
parent 375dd842d4
commit d36fe9e5b3
10 changed files with 233 additions and 126 deletions

View File

@@ -176,13 +176,14 @@ void AESStreamDecryptor_construct(AESStreamDecryptor* ptr, Array(u8) key, const
Result(u32) AESStreamDecryptor_decrypt(AESStreamDecryptor* ptr, Array(u8) src, Array(u8) dst){
Deferral(4);
u32 decrypted_size = __AESStreamDecryptor_calcDstSize(src.size);
try_assert(dst.size >= decrypted_size);
// if it is the beginning of the stream, read IV
if(ptr->block_counter == 0){
__Array_readNext(ptr->iv, &src, __AES_STREAM_IV_SIZE);
}
// size without IV
u32 decrypted_size = src.size;
try_assert(dst.size >= decrypted_size);
// decrypt full buffers
while(src.size > __AES_BUFFER_SIZE){