diff options
author | lloyd <[email protected]> | 2010-03-16 00:21:30 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-16 00:21:30 +0000 |
commit | 4be0c32f1715ca97f6cc85bc1905899f5cd01cef (patch) | |
tree | 3f7d40f046f6c3fb12f3a23be909916a099344a3 /src/math/bigint/mp_generic | |
parent | b96139b84113b583a453c820127c4765c6f0f66f (diff) |
Add a special handler for the case of doing a subtraction as in:
x -= y;
where abs(x) < abs(y).
This change alone increases ECDSA performance by 5 to 15%
Diffstat (limited to 'src/math/bigint/mp_generic')
-rw-r--r-- | src/math/bigint/mp_generic/mp_asmi.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/math/bigint/mp_generic/mp_asmi.h b/src/math/bigint/mp_generic/mp_asmi.h index 9913c6ba9..8225f372d 100644 --- a/src/math/bigint/mp_generic/mp_asmi.h +++ b/src/math/bigint/mp_generic/mp_asmi.h @@ -1,6 +1,6 @@ /* * Lowest Level MPI Algorithms -* (C) 1999-2008 Jack Lloyd +* (C) 1999-2010 Jack Lloyd * 2006 Luca Piccarreta * * Distributed under the terms of the Botan license @@ -75,7 +75,7 @@ inline word word_sub(word x, word y, word* carry) /* * Eight Word Block Subtraction, Two Argument */ -inline word word8_sub2(word x[4], const word y[4], word carry) +inline word word8_sub2(word x[8], const word y[8], word carry) { x[0] = word_sub(x[0], y[0], &carry); x[1] = word_sub(x[1], y[1], &carry); @@ -89,6 +89,22 @@ inline word word8_sub2(word x[4], const word y[4], word carry) } /* +* Eight Word Block Subtraction, Two Argument +*/ +inline word word8_sub2_rev(word x[8], const word y[8], word carry) + { + x[0] = word_sub(y[0], x[0], &carry); + x[1] = word_sub(y[1], x[1], &carry); + x[2] = word_sub(y[2], x[2], &carry); + x[3] = word_sub(y[3], x[3], &carry); + x[4] = word_sub(y[4], x[4], &carry); + x[5] = word_sub(y[5], x[5], &carry); + x[6] = word_sub(y[6], x[6], &carry); + x[7] = word_sub(y[7], x[7], &carry); + return carry; + } + +/* * Eight Word Block Subtraction, Three Argument */ inline word word8_sub3(word z[8], const word x[8], @@ -108,7 +124,7 @@ inline word word8_sub3(word z[8], const word x[8], /* * Eight Word Block Linear Multiplication */ -inline word word8_linmul2(word x[4], word y, word carry) +inline word word8_linmul2(word x[8], word y, word carry) { x[0] = word_madd2(x[0], y, &carry); x[1] = word_madd2(x[1], y, &carry); |