From 399a1546de71f41598c15edada28e7f0d616f541 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 16 Sep 2016 11:27:15 -0400 Subject: 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 --- ec2n.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ec2n.cpp') 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 -- cgit v1.2.1