summaryrefslogtreecommitdiff
path: root/strciphr.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2021-11-28 19:57:28 -0500
committerJeffrey Walton <noloader@gmail.com>2021-11-28 19:57:28 -0500
commite546fb74d71180630618606685228e277e1dbaf7 (patch)
treefd87602b0f08ea48f39f1e9a6cfe9f8d8d7d0162 /strciphr.cpp
parentb418f93483562f1b59d0ba963dcdcc16b6a6a793 (diff)
downloadcryptopp-git-e546fb74d71180630618606685228e277e1dbaf7.tar.gz
Add ASSERT in ProcessData to warn of non-distinct buffers (GH #1088)
Diffstat (limited to 'strciphr.cpp')
-rw-r--r--strciphr.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/strciphr.cpp b/strciphr.cpp
index f73a05e1..d2e5feb3 100644
--- a/strciphr.cpp
+++ b/strciphr.cpp
@@ -81,6 +81,10 @@ void AdditiveCipherTemplate<S>::ProcessData(byte *outString, const byte *inStrin
CRYPTOPP_ASSERT(outString); CRYPTOPP_ASSERT(inString);
CRYPTOPP_ASSERT(length % this->MandatoryBlockSize() == 0);
+ // If this assert fires, then outString == inString. You could experience a
+ // performance hit. Also see https://github.com/weidai11/cryptopp/issues/1088'
+ CRYPTOPP_ASSERT(outString != inString);
+
PolicyInterface &policy = this->AccessPolicy();
unsigned int bytesPerIteration = policy.GetBytesPerIteration();
@@ -225,6 +229,10 @@ void CFB_CipherTemplate<BASE>::ProcessData(byte *outString, const byte *inString
CRYPTOPP_ASSERT(outString); CRYPTOPP_ASSERT(inString);
CRYPTOPP_ASSERT(length % this->MandatoryBlockSize() == 0);
+ // If this assert fires, then outString == inString. You could experience a
+ // performance hit. Also see https://github.com/weidai11/cryptopp/issues/1088'
+ CRYPTOPP_ASSERT(outString != inString);
+
PolicyInterface &policy = this->AccessPolicy();
unsigned int bytesPerIteration = policy.GetBytesPerIteration();
byte *reg = policy.GetRegisterBegin();