Closed
Description
Cryptography 39.0.0 introduced a memory leak in the ChaCha20Poly1305 class. It is still present in the most recent release (41.0.2).
- python -m venv venv
- source venv/bin/activate
- pip install cryptography
- Run the following script. Monitor memory usage using
top
.
from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305
key = ChaCha20Poly1305.generate_key()
while True:
chacha = ChaCha20Poly1305(key)
Cryptography 38.0.4 - Memory usage remains constant.
Cryptography >= 39.0.0 - Memory usage increases until the process is killed.