mirror of
https://github.com/Legrandin/pycryptodome.git
synced 2025-10-19 07:53:49 +00:00
Use CCMMessageTooLongError exception for all cases
This commit is contained in:
parent
84a395ab77
commit
215a151ecc
1 changed files with 6 additions and 2 deletions
|
@ -373,7 +373,9 @@ class CcmMode(object):
|
|||
|
||||
self._cumul_msg_len += len(plaintext)
|
||||
if self._cumul_msg_len > self._msg_len:
|
||||
raise ValueError("Message is too long")
|
||||
msg = "Message longer than declared for (%u bytes vs %u bytes" % \
|
||||
(self._cumul_msg_len, self._msg_len)
|
||||
raise CCMMessageTooLongError(msg)
|
||||
|
||||
if self._mac_status == MacStatus.PROCESSING_AUTH_DATA:
|
||||
# Associated data is concatenated with the least number
|
||||
|
@ -450,7 +452,9 @@ class CcmMode(object):
|
|||
|
||||
self._cumul_msg_len += len(ciphertext)
|
||||
if self._cumul_msg_len > self._msg_len:
|
||||
raise ValueError("Message is too long")
|
||||
msg = "Message longer than declared for (%u bytes vs %u bytes" % \
|
||||
(self._cumul_msg_len, self._msg_len)
|
||||
raise CCMMessageTooLongError(msg)
|
||||
|
||||
if self._mac_status == MacStatus.PROCESSING_AUTH_DATA:
|
||||
# Associated data is concatenated with the least number
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue