Skip to content

Commit 98dfafe

Browse files
authored
Migrate AES-CCM to Rust (#10279)
1 parent 1729ede commit 98dfafe

File tree

6 files changed

+226
-379
lines changed

6 files changed

+226
-379
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
@@ -561,9 +560,6 @@ def ed448_supported(self) -> bool:
561560
and not self._lib.CRYPTOGRAPHY_IS_BORINGSSL
562561
)
563562

564-
def aead_cipher_supported(self, cipher) -> bool:
565-
return aead._aead_cipher_supported(self, cipher)
566-
567563
def _zero_data(self, data, length: int) -> None:
568564
# We clear things this way because at the moment we're not
569565
# 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)