Skip to content

Commit

Permalink
Add asserts to CFB_ModePolicy::SetFeedbackSize
Browse files Browse the repository at this point in the history
  • Loading branch information
noloader committed Sep 30, 2023
1 parent 2e23f64 commit 8d3e357
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ void CFB_ModePolicy::CipherResynchronize(const byte *iv, size_t length)

void CFB_ModePolicy::SetFeedbackSize(unsigned int feedbackSize)
{
CRYPTOPP_ASSERT(feedbackSize >= 0);
CRYPTOPP_ASSERT(feedbackSize <= BlockSize());
if (feedbackSize > BlockSize())
throw InvalidArgument("CFB_Mode: invalid feedback size");
m_feedbackSize = feedbackSize ? feedbackSize : BlockSize();
Expand Down

0 comments on commit 8d3e357

Please sign in to comment.