Skip to content

ChaCha20Poly1305 memory leak #9255

Closed
@PaulWhitingS2

Description

@PaulWhitingS2

Cryptography 39.0.0 introduced a memory leak in the ChaCha20Poly1305 class. It is still present in the most recent release (41.0.2).

  1. python -m venv venv
  2. source venv/bin/activate
  3. pip install cryptography
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions