Skip to content

Commit e65ce42

Browse files
embhorndanielinux
authored andcommitted
Exclude AES CTR from block size check
1 parent 1c24265 commit e65ce42

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

wolfcrypt/ciphers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def encrypt(self, string):
181181
raise ValueError(
182182
"empty string not allowed")
183183

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

@@ -214,7 +214,7 @@ def decrypt(self, string):
214214
raise ValueError(
215215
"empty string not allowed")
216216

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

0 commit comments

Comments
 (0)