summaryrefslogtreecommitdiff
path: root/gf2_32.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 /gf2_32.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 'gf2_32.cpp')
-rw-r--r--gf2_32.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/gf2_32.cpp b/gf2_32.cpp
index 929dac0d..084a1da3 100644
--- a/gf2_32.cpp
+++ b/gf2_32.cpp
@@ -52,7 +52,7 @@ GF2_32::Element GF2_32::MultiplicativeInverse(Element a) const
word32 g0=m_modulus, g1=a, g2=a;
word32 v0=0, v1=1, v2=1;
- assert(g1);
+ CRYPTOPP_ASSERT(g1);
while (!(g2 & 0x80000000))
{
@@ -70,25 +70,25 @@ GF2_32::Element GF2_32::MultiplicativeInverse(Element a) const
{
if (g1 < g0 || ((g0^g1) < g0 && (g0^g1) < g1))
{
- assert(BitPrecision(g1) <= BitPrecision(g0));
+ CRYPTOPP_ASSERT(BitPrecision(g1) <= BitPrecision(g0));
g2 = g1;
v2 = v1;
}
else
{
- assert(BitPrecision(g1) > BitPrecision(g0));
+ CRYPTOPP_ASSERT(BitPrecision(g1) > BitPrecision(g0));
g2 = g0; g0 = g1; g1 = g2;
v2 = v0; v0 = v1; v1 = v2;
}
while ((g0^g2) >= g2)
{
- assert(BitPrecision(g0) > BitPrecision(g2));
+ CRYPTOPP_ASSERT(BitPrecision(g0) > BitPrecision(g2));
g2 <<= 1;
v2 <<= 1;
}
- assert(BitPrecision(g0) == BitPrecision(g2));
+ CRYPTOPP_ASSERT(BitPrecision(g0) == BitPrecision(g2));
g0 ^= g2;
v0 ^= v2;
}