fixed connection bugs

This commit is contained in:
2025-11-02 15:26:30 +05:00
parent 8179609d47
commit 94fcbe5daf
9 changed files with 61 additions and 29 deletions

View File

@@ -88,6 +88,7 @@ typedef struct AESStreamEncryptor {
/// @param dec_class &br_aes_XXX_ctr_vtable
void AESStreamEncryptor_construct(AESStreamEncryptor* ptr, Array(u8) key, const br_block_ctr_class* ctr_class);
/// use this only at the beginning of the stream
#define AESStreamEncryptor_calcDstSize(src_size) (src_size + __AES_BLOCK_IV_SIZE)
/// @brief If ptr->block_counter == 0, writes random IV to `dst`. After that writes encrypted data to dst.
@@ -114,7 +115,7 @@ typedef struct AESStreamDecryptor {
void AESStreamDecryptor_construct(AESStreamDecryptor* ptr, Array(u8) key, const br_block_ctr_class* ctr_class);
/// @brief Reads IV from `src`, then decrypts data and writes it to dst
/// @param src array of size at least AESStreamEncryptor_calcDstSize(0).
/// @param src array of any size
/// @param dst array of size >= src.size
/// @return size of decrypted data
Result(u32) AESStreamDecryptor_decrypt(AESStreamDecryptor* ptr, Array(u8) src, Array(u8) dst);