diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/math/mp/mp_comba.cpp | 88 | ||||
-rwxr-xr-x | src/scripts/comba.py | 9 |
2 files changed, 49 insertions, 48 deletions
diff --git a/src/lib/math/mp/mp_comba.cpp b/src/lib/math/mp/mp_comba.cpp index 1ebd29817..647cb68cd 100644 --- a/src/lib/math/mp/mp_comba.cpp +++ b/src/lib/math/mp/mp_comba.cpp @@ -1,7 +1,7 @@ /* * Comba Multiplication and Squaring * -* This file was automatically generated by comba.py +* This file was automatically generated by ./src/scripts/comba.py on 2016-01-01 * * Botan is released under the Simplified BSD License (see license.txt) */ @@ -18,14 +18,14 @@ void bigint_comba_sqr4(word z[8], const word x[4]) { word w2 = 0, w1 = 0, w0 = 0; - word3_muladd(&w2, &w1, &w0, x[ 0], x[ 0]); + word3_muladd (&w2, &w1, &w0, x[ 0], x[ 0]); z[ 0] = w0; w0 = 0; word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 1]); z[ 1] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 2]); - word3_muladd(&w1, &w0, &w2, x[ 1], x[ 1]); + word3_muladd (&w1, &w0, &w2, x[ 1], x[ 1]); z[ 2] = w2; w2 = 0; word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 3]); @@ -33,13 +33,13 @@ void bigint_comba_sqr4(word z[8], const word x[4]) z[ 3] = w0; w0 = 0; word3_muladd_2(&w0, &w2, &w1, x[ 1], x[ 3]); - word3_muladd(&w0, &w2, &w1, x[ 2], x[ 2]); + word3_muladd (&w0, &w2, &w1, x[ 2], x[ 2]); z[ 4] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[ 2], x[ 3]); z[ 5] = w2; w2 = 0; - word3_muladd(&w2, &w1, &w0, x[ 3], x[ 3]); + word3_muladd (&w2, &w1, &w0, x[ 3], x[ 3]); z[ 6] = w0; z[ 7] = w1; } @@ -90,14 +90,14 @@ void bigint_comba_sqr6(word z[12], const word x[6]) { word w2 = 0, w1 = 0, w0 = 0; - word3_muladd(&w2, &w1, &w0, x[ 0], x[ 0]); + word3_muladd (&w2, &w1, &w0, x[ 0], x[ 0]); z[ 0] = w0; w0 = 0; word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 1]); z[ 1] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 2]); - word3_muladd(&w1, &w0, &w2, x[ 1], x[ 1]); + word3_muladd (&w1, &w0, &w2, x[ 1], x[ 1]); z[ 2] = w2; w2 = 0; word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 3]); @@ -106,7 +106,7 @@ void bigint_comba_sqr6(word z[12], const word x[6]) word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 4]); word3_muladd_2(&w0, &w2, &w1, x[ 1], x[ 3]); - word3_muladd(&w0, &w2, &w1, x[ 2], x[ 2]); + word3_muladd (&w0, &w2, &w1, x[ 2], x[ 2]); z[ 4] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 5]); @@ -116,7 +116,7 @@ void bigint_comba_sqr6(word z[12], const word x[6]) word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 5]); word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 4]); - word3_muladd(&w2, &w1, &w0, x[ 3], x[ 3]); + word3_muladd (&w2, &w1, &w0, x[ 3], x[ 3]); z[ 6] = w0; w0 = 0; word3_muladd_2(&w0, &w2, &w1, x[ 2], x[ 5]); @@ -124,13 +124,13 @@ void bigint_comba_sqr6(word z[12], const word x[6]) z[ 7] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[ 3], x[ 5]); - word3_muladd(&w1, &w0, &w2, x[ 4], x[ 4]); + word3_muladd (&w1, &w0, &w2, x[ 4], x[ 4]); z[ 8] = w2; w2 = 0; word3_muladd_2(&w2, &w1, &w0, x[ 4], x[ 5]); z[ 9] = w0; w0 = 0; - word3_muladd(&w0, &w2, &w1, x[ 5], x[ 5]); + word3_muladd (&w0, &w2, &w1, x[ 5], x[ 5]); z[10] = w1; z[11] = w2; } @@ -209,14 +209,14 @@ void bigint_comba_sqr8(word z[16], const word x[8]) { word w2 = 0, w1 = 0, w0 = 0; - word3_muladd(&w2, &w1, &w0, x[ 0], x[ 0]); + word3_muladd (&w2, &w1, &w0, x[ 0], x[ 0]); z[ 0] = w0; w0 = 0; word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 1]); z[ 1] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 2]); - word3_muladd(&w1, &w0, &w2, x[ 1], x[ 1]); + word3_muladd (&w1, &w0, &w2, x[ 1], x[ 1]); z[ 2] = w2; w2 = 0; word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 3]); @@ -225,7 +225,7 @@ void bigint_comba_sqr8(word z[16], const word x[8]) word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 4]); word3_muladd_2(&w0, &w2, &w1, x[ 1], x[ 3]); - word3_muladd(&w0, &w2, &w1, x[ 2], x[ 2]); + word3_muladd (&w0, &w2, &w1, x[ 2], x[ 2]); z[ 4] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 5]); @@ -236,7 +236,7 @@ void bigint_comba_sqr8(word z[16], const word x[8]) word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 6]); word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 5]); word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 4]); - word3_muladd(&w2, &w1, &w0, x[ 3], x[ 3]); + word3_muladd (&w2, &w1, &w0, x[ 3], x[ 3]); z[ 6] = w0; w0 = 0; word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 7]); @@ -248,7 +248,7 @@ void bigint_comba_sqr8(word z[16], const word x[8]) word3_muladd_2(&w1, &w0, &w2, x[ 1], x[ 7]); word3_muladd_2(&w1, &w0, &w2, x[ 2], x[ 6]); word3_muladd_2(&w1, &w0, &w2, x[ 3], x[ 5]); - word3_muladd(&w1, &w0, &w2, x[ 4], x[ 4]); + word3_muladd (&w1, &w0, &w2, x[ 4], x[ 4]); z[ 8] = w2; w2 = 0; word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 7]); @@ -258,7 +258,7 @@ void bigint_comba_sqr8(word z[16], const word x[8]) word3_muladd_2(&w0, &w2, &w1, x[ 3], x[ 7]); word3_muladd_2(&w0, &w2, &w1, x[ 4], x[ 6]); - word3_muladd(&w0, &w2, &w1, x[ 5], x[ 5]); + word3_muladd (&w0, &w2, &w1, x[ 5], x[ 5]); z[10] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[ 4], x[ 7]); @@ -266,13 +266,13 @@ void bigint_comba_sqr8(word z[16], const word x[8]) z[11] = w2; w2 = 0; word3_muladd_2(&w2, &w1, &w0, x[ 5], x[ 7]); - word3_muladd(&w2, &w1, &w0, x[ 6], x[ 6]); + word3_muladd (&w2, &w1, &w0, x[ 6], x[ 6]); z[12] = w0; w0 = 0; word3_muladd_2(&w0, &w2, &w1, x[ 6], x[ 7]); z[13] = w1; w1 = 0; - word3_muladd(&w1, &w0, &w2, x[ 7], x[ 7]); + word3_muladd (&w1, &w0, &w2, x[ 7], x[ 7]); z[14] = w2; z[15] = w0; } @@ -387,14 +387,14 @@ void bigint_comba_sqr9(word z[18], const word x[9]) { word w2 = 0, w1 = 0, w0 = 0; - word3_muladd(&w2, &w1, &w0, x[ 0], x[ 0]); + word3_muladd (&w2, &w1, &w0, x[ 0], x[ 0]); z[ 0] = w0; w0 = 0; word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 1]); z[ 1] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 2]); - word3_muladd(&w1, &w0, &w2, x[ 1], x[ 1]); + word3_muladd (&w1, &w0, &w2, x[ 1], x[ 1]); z[ 2] = w2; w2 = 0; word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 3]); @@ -403,7 +403,7 @@ void bigint_comba_sqr9(word z[18], const word x[9]) word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 4]); word3_muladd_2(&w0, &w2, &w1, x[ 1], x[ 3]); - word3_muladd(&w0, &w2, &w1, x[ 2], x[ 2]); + word3_muladd (&w0, &w2, &w1, x[ 2], x[ 2]); z[ 4] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 5]); @@ -414,7 +414,7 @@ void bigint_comba_sqr9(word z[18], const word x[9]) word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 6]); word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 5]); word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 4]); - word3_muladd(&w2, &w1, &w0, x[ 3], x[ 3]); + word3_muladd (&w2, &w1, &w0, x[ 3], x[ 3]); z[ 6] = w0; w0 = 0; word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 7]); @@ -427,7 +427,7 @@ void bigint_comba_sqr9(word z[18], const word x[9]) word3_muladd_2(&w1, &w0, &w2, x[ 1], x[ 7]); word3_muladd_2(&w1, &w0, &w2, x[ 2], x[ 6]); word3_muladd_2(&w1, &w0, &w2, x[ 3], x[ 5]); - word3_muladd(&w1, &w0, &w2, x[ 4], x[ 4]); + word3_muladd (&w1, &w0, &w2, x[ 4], x[ 4]); z[ 8] = w2; w2 = 0; word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 8]); @@ -439,7 +439,7 @@ void bigint_comba_sqr9(word z[18], const word x[9]) word3_muladd_2(&w0, &w2, &w1, x[ 2], x[ 8]); word3_muladd_2(&w0, &w2, &w1, x[ 3], x[ 7]); word3_muladd_2(&w0, &w2, &w1, x[ 4], x[ 6]); - word3_muladd(&w0, &w2, &w1, x[ 5], x[ 5]); + word3_muladd (&w0, &w2, &w1, x[ 5], x[ 5]); z[10] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[ 3], x[ 8]); @@ -449,7 +449,7 @@ void bigint_comba_sqr9(word z[18], const word x[9]) word3_muladd_2(&w2, &w1, &w0, x[ 4], x[ 8]); word3_muladd_2(&w2, &w1, &w0, x[ 5], x[ 7]); - word3_muladd(&w2, &w1, &w0, x[ 6], x[ 6]); + word3_muladd (&w2, &w1, &w0, x[ 6], x[ 6]); z[12] = w0; w0 = 0; word3_muladd_2(&w0, &w2, &w1, x[ 5], x[ 8]); @@ -457,13 +457,13 @@ void bigint_comba_sqr9(word z[18], const word x[9]) z[13] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[ 6], x[ 8]); - word3_muladd(&w1, &w0, &w2, x[ 7], x[ 7]); + word3_muladd (&w1, &w0, &w2, x[ 7], x[ 7]); z[14] = w2; w2 = 0; word3_muladd_2(&w2, &w1, &w0, x[ 7], x[ 8]); z[15] = w0; w0 = 0; - word3_muladd(&w0, &w2, &w1, x[ 8], x[ 8]); + word3_muladd (&w0, &w2, &w1, x[ 8], x[ 8]); z[16] = w1; z[17] = w2; } @@ -599,14 +599,14 @@ void bigint_comba_sqr16(word z[32], const word x[16]) { word w2 = 0, w1 = 0, w0 = 0; - word3_muladd(&w2, &w1, &w0, x[ 0], x[ 0]); + word3_muladd (&w2, &w1, &w0, x[ 0], x[ 0]); z[ 0] = w0; w0 = 0; word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 1]); z[ 1] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 2]); - word3_muladd(&w1, &w0, &w2, x[ 1], x[ 1]); + word3_muladd (&w1, &w0, &w2, x[ 1], x[ 1]); z[ 2] = w2; w2 = 0; word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 3]); @@ -615,7 +615,7 @@ void bigint_comba_sqr16(word z[32], const word x[16]) word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 4]); word3_muladd_2(&w0, &w2, &w1, x[ 1], x[ 3]); - word3_muladd(&w0, &w2, &w1, x[ 2], x[ 2]); + word3_muladd (&w0, &w2, &w1, x[ 2], x[ 2]); z[ 4] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 5]); @@ -626,7 +626,7 @@ void bigint_comba_sqr16(word z[32], const word x[16]) word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 6]); word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 5]); word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 4]); - word3_muladd(&w2, &w1, &w0, x[ 3], x[ 3]); + word3_muladd (&w2, &w1, &w0, x[ 3], x[ 3]); z[ 6] = w0; w0 = 0; word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 7]); @@ -639,7 +639,7 @@ void bigint_comba_sqr16(word z[32], const word x[16]) word3_muladd_2(&w1, &w0, &w2, x[ 1], x[ 7]); word3_muladd_2(&w1, &w0, &w2, x[ 2], x[ 6]); word3_muladd_2(&w1, &w0, &w2, x[ 3], x[ 5]); - word3_muladd(&w1, &w0, &w2, x[ 4], x[ 4]); + word3_muladd (&w1, &w0, &w2, x[ 4], x[ 4]); z[ 8] = w2; w2 = 0; word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 9]); @@ -654,7 +654,7 @@ void bigint_comba_sqr16(word z[32], const word x[16]) word3_muladd_2(&w0, &w2, &w1, x[ 2], x[ 8]); word3_muladd_2(&w0, &w2, &w1, x[ 3], x[ 7]); word3_muladd_2(&w0, &w2, &w1, x[ 4], x[ 6]); - word3_muladd(&w0, &w2, &w1, x[ 5], x[ 5]); + word3_muladd (&w0, &w2, &w1, x[ 5], x[ 5]); z[10] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[ 0], x[11]); @@ -671,7 +671,7 @@ void bigint_comba_sqr16(word z[32], const word x[16]) word3_muladd_2(&w2, &w1, &w0, x[ 3], x[ 9]); word3_muladd_2(&w2, &w1, &w0, x[ 4], x[ 8]); word3_muladd_2(&w2, &w1, &w0, x[ 5], x[ 7]); - word3_muladd(&w2, &w1, &w0, x[ 6], x[ 6]); + word3_muladd (&w2, &w1, &w0, x[ 6], x[ 6]); z[12] = w0; w0 = 0; word3_muladd_2(&w0, &w2, &w1, x[ 0], x[13]); @@ -690,7 +690,7 @@ void bigint_comba_sqr16(word z[32], const word x[16]) word3_muladd_2(&w1, &w0, &w2, x[ 4], x[10]); word3_muladd_2(&w1, &w0, &w2, x[ 5], x[ 9]); word3_muladd_2(&w1, &w0, &w2, x[ 6], x[ 8]); - word3_muladd(&w1, &w0, &w2, x[ 7], x[ 7]); + word3_muladd (&w1, &w0, &w2, x[ 7], x[ 7]); z[14] = w2; w2 = 0; word3_muladd_2(&w2, &w1, &w0, x[ 0], x[15]); @@ -710,7 +710,7 @@ void bigint_comba_sqr16(word z[32], const word x[16]) word3_muladd_2(&w0, &w2, &w1, x[ 5], x[11]); word3_muladd_2(&w0, &w2, &w1, x[ 6], x[10]); word3_muladd_2(&w0, &w2, &w1, x[ 7], x[ 9]); - word3_muladd(&w0, &w2, &w1, x[ 8], x[ 8]); + word3_muladd (&w0, &w2, &w1, x[ 8], x[ 8]); z[16] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[ 2], x[15]); @@ -728,7 +728,7 @@ void bigint_comba_sqr16(word z[32], const word x[16]) word3_muladd_2(&w2, &w1, &w0, x[ 6], x[12]); word3_muladd_2(&w2, &w1, &w0, x[ 7], x[11]); word3_muladd_2(&w2, &w1, &w0, x[ 8], x[10]); - word3_muladd(&w2, &w1, &w0, x[ 9], x[ 9]); + word3_muladd (&w2, &w1, &w0, x[ 9], x[ 9]); z[18] = w0; w0 = 0; word3_muladd_2(&w0, &w2, &w1, x[ 4], x[15]); @@ -744,7 +744,7 @@ void bigint_comba_sqr16(word z[32], const word x[16]) word3_muladd_2(&w1, &w0, &w2, x[ 7], x[13]); word3_muladd_2(&w1, &w0, &w2, x[ 8], x[12]); word3_muladd_2(&w1, &w0, &w2, x[ 9], x[11]); - word3_muladd(&w1, &w0, &w2, x[10], x[10]); + word3_muladd (&w1, &w0, &w2, x[10], x[10]); z[20] = w2; w2 = 0; word3_muladd_2(&w2, &w1, &w0, x[ 6], x[15]); @@ -758,7 +758,7 @@ void bigint_comba_sqr16(word z[32], const word x[16]) word3_muladd_2(&w0, &w2, &w1, x[ 8], x[14]); word3_muladd_2(&w0, &w2, &w1, x[ 9], x[13]); word3_muladd_2(&w0, &w2, &w1, x[10], x[12]); - word3_muladd(&w0, &w2, &w1, x[11], x[11]); + word3_muladd (&w0, &w2, &w1, x[11], x[11]); z[22] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[ 8], x[15]); @@ -770,7 +770,7 @@ void bigint_comba_sqr16(word z[32], const word x[16]) word3_muladd_2(&w2, &w1, &w0, x[ 9], x[15]); word3_muladd_2(&w2, &w1, &w0, x[10], x[14]); word3_muladd_2(&w2, &w1, &w0, x[11], x[13]); - word3_muladd(&w2, &w1, &w0, x[12], x[12]); + word3_muladd (&w2, &w1, &w0, x[12], x[12]); z[24] = w0; w0 = 0; word3_muladd_2(&w0, &w2, &w1, x[10], x[15]); @@ -780,7 +780,7 @@ void bigint_comba_sqr16(word z[32], const word x[16]) word3_muladd_2(&w1, &w0, &w2, x[11], x[15]); word3_muladd_2(&w1, &w0, &w2, x[12], x[14]); - word3_muladd(&w1, &w0, &w2, x[13], x[13]); + word3_muladd (&w1, &w0, &w2, x[13], x[13]); z[26] = w2; w2 = 0; word3_muladd_2(&w2, &w1, &w0, x[12], x[15]); @@ -788,13 +788,13 @@ void bigint_comba_sqr16(word z[32], const word x[16]) z[27] = w0; w0 = 0; word3_muladd_2(&w0, &w2, &w1, x[13], x[15]); - word3_muladd(&w0, &w2, &w1, x[14], x[14]); + word3_muladd (&w0, &w2, &w1, x[14], x[14]); z[28] = w1; w1 = 0; word3_muladd_2(&w1, &w0, &w2, x[14], x[15]); z[29] = w2; w2 = 0; - word3_muladd(&w2, &w1, &w0, x[15], x[15]); + word3_muladd (&w2, &w1, &w0, x[15], x[15]); z[30] = w0; z[31] = w1; } diff --git a/src/scripts/comba.py b/src/scripts/comba.py index f0165a3ce..2fa95fb24 100755 --- a/src/scripts/comba.py +++ b/src/scripts/comba.py @@ -1,8 +1,9 @@ #!/usr/bin/python2 import sys +import datetime -# (C) 2011,2014,2015 Jack Lloyd +# (C) 2011,2014,2015,2016 Jack Lloyd # Botan is released under the Simplified BSD License (see license.txt) # Used to generate src/lib/math/mp/mp_comba.cpp @@ -64,7 +65,7 @@ def comba_square_code(N): for (rnd,idx) in zip(range(0, len(indexes)), indexes): for (i,pair) in zip(range(0, len(idx)), idx): if pair[0] == pair[1]: - print " word3_muladd(&%s, &%s, &%s, x[%2d], x[%2d]);" % (w2, w1, w0, pair[0], pair[1]) + print " word3_muladd (&%s, &%s, &%s, x[%2d], x[%2d]);" % (w2, w1, w0, pair[0], pair[1]) elif i % 2 == 0: print " word3_muladd_2(&%s, &%s, &%s, x[%2d], x[%2d]);" % (w2, w1, w0, pair[0], pair[1]) @@ -82,7 +83,7 @@ def main(args = None): print """/* * Comba Multiplication and Squaring * -* This file was automatically generated by comba.py +* This file was automatically generated by %s on %s * * Botan is released under the Simplified BSD License (see license.txt) */ @@ -91,7 +92,7 @@ def main(args = None): #include <botan/internal/mp_asmi.h> namespace Botan { -""" +""" % (sys.argv[0], datetime.date.today().strftime("%Y-%m-%d")) for n in [4,6,8,9,16]: print "/*\n* Comba %dx%d Squaring\n*/" % (n, n) |