Skip to content

Commit

Permalink
Exclude AES CTR from block size check
Browse files Browse the repository at this point in the history
  • Loading branch information
embhorn authored and danielinux committed Dec 27, 2023
1 parent 1c24265 commit e65ce42
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wolfcrypt/ciphers.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def encrypt(self, string):
raise ValueError(
"empty string not allowed")

if len(string) % self.block_size and not "ChaCha" in self._native_type:
if len(string) % self.block_size and not self.mode == MODE_CTR and not "ChaCha" in self._native_type:
raise ValueError(
"string must be a multiple of %d in length" % self.block_size)

Expand Down Expand Up @@ -214,7 +214,7 @@ def decrypt(self, string):
raise ValueError(
"empty string not allowed")

if len(string) % self.block_size and not "ChaCha" in self._native_type:
if len(string) % self.block_size and not self.mode == MODE_CTR and not "ChaCha" in self._native_type:
raise ValueError(
"string must be a multiple of %d in length" % self.block_size)

Expand Down

0 comments on commit e65ce42

Please sign in to comment.