Skip to content

Commit 22f0816

Browse files
committed
Migrate AES-CCM to Rust
1 parent ea5a5b4 commit 22f0816

File tree

6 files changed

+225
-378
lines changed

6 files changed

+225
-378
lines changed

src/cryptography/hazmat/backends/openssl/aead.py

Lines changed: 0 additions & 255 deletions
This file was deleted.

src/cryptography/hazmat/backends/openssl/backend.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
from cryptography import utils, x509
1313
from cryptography.exceptions import UnsupportedAlgorithm
14-
from cryptography.hazmat.backends.openssl import aead
1514
from cryptography.hazmat.backends.openssl.ciphers import _CipherContext
1615
from cryptography.hazmat.bindings._rust import openssl as rust_openssl
1716
from cryptography.hazmat.bindings.openssl import binding
@@ -559,9 +558,6 @@ def ed448_supported(self) -> bool:
559558
and not self._lib.CRYPTOGRAPHY_IS_BORINGSSL
560559
)
561560

562-
def aead_cipher_supported(self, cipher) -> bool:
563-
return aead._aead_cipher_supported(self, cipher)
564-
565561
def _zero_data(self, data, length: int) -> None:
566562
# We clear things this way because at the moment we're not
567563
# sure of a better way that can guarantee it overwrites the

src/cryptography/hazmat/bindings/_rust/openssl/aead.pyi

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,23 @@ class ChaCha20Poly1305:
3636
associated_data: bytes | None,
3737
) -> bytes: ...
3838

39+
class AESCCM:
40+
def __init__(self, key: bytes, tag_length: int = 16) -> None: ...
41+
@staticmethod
42+
def generate_key(key_size: int) -> bytes: ...
43+
def encrypt(
44+
self,
45+
nonce: bytes,
46+
data: bytes,
47+
associated_data: bytes | None,
48+
) -> bytes: ...
49+
def decrypt(
50+
self,
51+
nonce: bytes,
52+
data: bytes,
53+
associated_data: bytes | None,
54+
) -> bytes: ...
55+
3956
class AESSIV:
4057
def __init__(self, key: bytes) -> None: ...
4158
@staticmethod

0 commit comments

Comments
 (0)