Hi,
In this pull request, I've fixed the memory leak during data encryption.
My approach is the same, as I did for the decryption (#219): now we use buffers with references to the input data instead of data copying.
Don't be afraid of so many files changed. I just renamed two commonly used structures:
SecurityBuffer -> OwnedSecurityBuffer. It uses Vec inside, so I've added the Owned prefix.
DecryptBuffer -> SecurityBuffer. We use it for decryption and encryption, so DecryptBuffer is a bad name.
Moreover, I added a test for testing encryption and decryption in the FFI layer. I highly recommend running FFI tests with Miri.
[!NOTE]
Currently, we cannot run Miri because one dependency in the dependency tree has failed to compile with nightly Rust.
I already fixed it and found some UB and memory leaks. I'll provide a separate PR with an updated Cargo.lock and another PR for UB + memory leak fixes.
Hi, In this pull request, I've fixed the memory leak during data encryption.
My approach is the same, as I did for the decryption (#219): now we use buffers with references to the input data instead of data copying.
Don't be afraid of so many files changed. I just renamed two commonly used structures:
SecurityBuffer
->OwnedSecurityBuffer
. It usesVec
inside, so I've added theOwned
prefix.DecryptBuffer
->SecurityBuffer
. We use it for decryption and encryption, soDecryptBuffer
is a bad name.Moreover, I added a test for testing encryption and decryption in the FFI layer. I highly recommend running FFI tests with
Miri
.I already fixed it and found some UB and memory leaks. I'll provide a separate PR with an updated
Cargo.lock
and another PR for UB + memory leak fixes.closes #217