summaryrefslogtreecommitdiff
path: root/ec2n.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2016-09-16 11:27:15 -0400
committerJeffrey Walton <noloader@gmail.com>2016-09-16 11:27:15 -0400
commit399a1546de71f41598c15edada28e7f0d616f541 (patch)
tree530160789358a3303be180df2d8529c82782156b /ec2n.cpp
parentfca5fbb36169a7522e6c533df9c322d47e3dc6bb (diff)
downloadcryptopp-git-399a1546de71f41598c15edada28e7f0d616f541.tar.gz
Add CRYPTOPP_ASSERT (Issue 277, CVE-2016-7420)
trap.h and CRYPTOPP_ASSERT has existed for over a year in Master. We deferred on the cut-over waiting for a minor version bump (5.7). We have to use it now due to CVE-2016-7420
Diffstat (limited to 'ec2n.cpp')
-rw-r--r--ec2n.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/ec2n.cpp b/ec2n.cpp
index e00b53e7..33a9d454 100644
--- a/ec2n.cpp
+++ b/ec2n.cpp
@@ -71,11 +71,11 @@ bool EC2N::DecodePoint(EC2N::Point &P, BufferedTransformation &bt, size_t encode
}
FieldElement z = m_field->Square(P.x);
- assert(P.x == m_field->SquareRoot(z));
+ CRYPTOPP_ASSERT(P.x == m_field->SquareRoot(z));
P.y = m_field->Divide(m_field->Add(m_field->Multiply(z, m_field->Add(P.x, m_a)), m_b), z);
- assert(P.x == m_field->Subtract(m_field->Divide(m_field->Subtract(m_field->Multiply(P.y, z), m_b), z), m_a));
+ CRYPTOPP_ASSERT(P.x == m_field->Subtract(m_field->Divide(m_field->Subtract(m_field->Multiply(P.y, z), m_b), z), m_a));
z = m_field->SolveQuadraticEquation(P.y);
- assert(m_field->Add(m_field->Square(z), z) == P.y);
+ CRYPTOPP_ASSERT(m_field->Add(m_field->Square(z), z) == P.y);
z.SetCoefficient(0, type & 1);
P.y = m_field->Multiply(z, P.x);
@@ -119,7 +119,7 @@ void EC2N::EncodePoint(byte *encodedPoint, const Point &P, bool compressed) cons
{
ArraySink sink(encodedPoint, EncodedPointSize(compressed));
EncodePoint(sink, P, compressed);
- assert(sink.TotalPutLength() == EncodedPointSize(compressed));
+ CRYPTOPP_ASSERT(sink.TotalPutLength() == EncodedPointSize(compressed));
}
EC2N::Point EC2N::BERDecodePoint(BufferedTransformation &bt) const