aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math/bigint/bigint.h
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-04-23 19:01:51 -0400
committerJack Lloyd <[email protected]>2018-04-23 19:33:06 -0400
commitd1479ede7bc01b60f67d6826611baf43987e941b (patch)
tree86deee3c166871aa58039c857196f2ef6be6b5e9 /src/lib/math/bigint/bigint.h
parentc90d868a533c13501e8d6e3b71919501b9d70f9e (diff)
Add BigInt::mod_sub
Diffstat (limited to 'src/lib/math/bigint/bigint.h')
-rw-r--r--src/lib/math/bigint/bigint.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/math/bigint/bigint.h b/src/lib/math/bigint/bigint.h
index eec7f6176..bb7a69541 100644
--- a/src/lib/math/bigint/bigint.h
+++ b/src/lib/math/bigint/bigint.h
@@ -266,6 +266,22 @@ class BOTAN_PUBLIC_API(2,0) BigInt final
BigInt& rev_sub(const word y[], size_t y_size, secure_vector<word>& ws);
/**
+ * Set *this to (*this + y) % mod
+ * @param y the BigInt to add - assumed y >= 0 and y < mod
+ * @param mod the positive modulus
+ * @param ws a temp workspace
+ */
+ BigInt& mod_add(const BigInt& y, const BigInt& mod, secure_vector<word>& ws);
+
+ /**
+ * Set *this to (*this - y) % mod
+ * @param y the BigInt to subtract - assumed y >= 0 and y < mod
+ * @param mod the positive modulus
+ * @param ws a temp workspace
+ */
+ BigInt& mod_sub(const BigInt& y, const BigInt& mod, secure_vector<word>& ws);
+
+ /**
* Return *this below mod
*
* Assumes that *this is (if anything) only slightly larger than