aboutsummaryrefslogtreecommitdiffstats
path: root/src/math/mp/mp_asm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/mp/mp_asm.cpp')
-rw-r--r--src/math/mp/mp_asm.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/math/mp/mp_asm.cpp b/src/math/mp/mp_asm.cpp
index 7f98b47cb..a3caba620 100644
--- a/src/math/mp/mp_asm.cpp
+++ b/src/math/mp/mp_asm.cpp
@@ -7,6 +7,10 @@
*/
#include <botan/internal/mp_core.h>
+#include <botan/internal/mp_asmi.h>
+#include <botan/internal/mp_core.h>
+#include <botan/exceptn.h>
+#include <botan/mem_ops.h>
namespace Botan {
@@ -17,6 +21,20 @@ extern "C" {
*/
word bigint_add2_nc(word x[], size_t x_size, const word y[], size_t y_size)
{
+ word carry = 0;
+
+ const size_t blocks = y_size - (y_size % 8);
+
+ for(size_t i = 0; i != blocks; i += 8)
+ carry = word8_add2(x + i, y + i, carry);
+
+ for(size_t i = blocks; i != y_size; ++i)
+ x[i] = word_add(x[i], y[i], &carry);
+
+ for(size_t i = y_size; i != x_size; ++i)
+ x[i] = word_add(x[i], 0, &carry);
+
+ return carry;
}
/*