Skip to content

Commit

Permalink
Migrate AES-CCM to Rust (#10279)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex authored Jan 28, 2024
1 parent 1729ede commit 98dfafe
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 379 deletions.
255 changes: 0 additions & 255 deletions src/cryptography/hazmat/backends/openssl/aead.py

This file was deleted.

4 changes: 0 additions & 4 deletions src/cryptography/hazmat/backends/openssl/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

from cryptography import utils, x509
from cryptography.exceptions import UnsupportedAlgorithm
from cryptography.hazmat.backends.openssl import aead
from cryptography.hazmat.backends.openssl.ciphers import _CipherContext
from cryptography.hazmat.bindings._rust import openssl as rust_openssl
from cryptography.hazmat.bindings.openssl import binding
Expand Down Expand Up @@ -561,9 +560,6 @@ def ed448_supported(self) -> bool:
and not self._lib.CRYPTOGRAPHY_IS_BORINGSSL
)

def aead_cipher_supported(self, cipher) -> bool:
return aead._aead_cipher_supported(self, cipher)

def _zero_data(self, data, length: int) -> None:
# We clear things this way because at the moment we're not
# sure of a better way that can guarantee it overwrites the
Expand Down
17 changes: 17 additions & 0 deletions src/cryptography/hazmat/bindings/_rust/openssl/aead.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ class ChaCha20Poly1305:
associated_data: bytes | None,
) -> bytes: ...

class AESCCM:
def __init__(self, key: bytes, tag_length: int = 16) -> None: ...
@staticmethod
def generate_key(key_size: int) -> bytes: ...
def encrypt(
self,
nonce: bytes,
data: bytes,
associated_data: bytes | None,
) -> bytes: ...
def decrypt(
self,
nonce: bytes,
data: bytes,
associated_data: bytes | None,
) -> bytes: ...

class AESSIV:
def __init__(self, key: bytes) -> None: ...
@staticmethod
Expand Down
Loading

0 comments on commit 98dfafe

Please sign in to comment.