aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math/bigint/bigint.h
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-12-07 11:54:49 -0500
committerJack Lloyd <[email protected]>2018-12-07 11:54:49 -0500
commitefad37ca79d9749e4492a07d61f0356aad221193 (patch)
tree2c9a4ebf8820f9e95f936d0f72ed9ebc605d81c4 /src/lib/math/bigint/bigint.h
parentdbadf2e21b9925b593beab95bead38b94622c4f4 (diff)
parente7038bf0c5a8e083555c2ce4e00a11a74e55cf0a (diff)
Merge GH #1773 Add BigInt::ct_reduce_below
Diffstat (limited to 'src/lib/math/bigint/bigint.h')
-rw-r--r--src/lib/math/bigint/bigint.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/math/bigint/bigint.h b/src/lib/math/bigint/bigint.h
index 31eee4c3c..a987fffda 100644
--- a/src/lib/math/bigint/bigint.h
+++ b/src/lib/math/bigint/bigint.h
@@ -347,6 +347,18 @@ class BOTAN_PUBLIC_API(2,0) BigInt final
size_t reduce_below(const BigInt& mod, secure_vector<word> &ws);
/**
+ * Return *this % mod
+ *
+ * Assumes that *this is (if anything) only slightly larger than mod and
+ * performs repeated subtractions. It should not be used if *this is much
+ * larger than mod, instead use modulo operator.
+ *
+ * Performs exactly bound subtractions, so if *this is >= bound*mod then the
+ * result will not be fully reduced. If bound is zero, nothing happens.
+ */
+ void ct_reduce_below(const BigInt& mod, secure_vector<word> &ws, size_t bound);
+
+ /**
* Zeroize the BigInt. The size of the underlying register is not
* modified.
*/