diff options
author | Joachim StroĢmbergson <joachim@secworks.se> | 2015-05-22 15:00:24 +0200 |
---|---|---|
committer | Joachim StroĢmbergson <joachim@secworks.se> | 2015-05-22 15:00:24 +0200 |
commit | 7bb2e93583ad67c1f9beb37742116c4903d32677 (patch) | |
tree | 69bc0ec9e0c41ca85337ad03e85096a55fb14d74 /src/model | |
parent | 28f6859c5dbaf7da1dc3bcccb831dc64f2046606 (diff) |
Updated the C model with version of modexp that supports explicit, separate lengths for exponent and modulus. Also added new test cases, cleaned up code etc.
Diffstat (limited to 'src/model')
-rwxr-xr-x | src/model/c/Debug/modexp | bin | 47444 -> 0 bytes | |||
-rw-r--r-- | src/model/c/src/ModExpTestBench.c | 3 | ||||
-rw-r--r-- | src/model/c/src/RSATestBench.c | 9 | ||||
-rw-r--r-- | src/model/c/src/autogenerated_tests.c | 512 | ||||
-rw-r--r-- | src/model/c/src/bignum_uint32_t.c | 9 | ||||
-rw-r--r-- | src/model/c/src/bignum_uint32_t.h | 1 | ||||
-rw-r--r-- | src/model/c/src/montgomery_array.c | 67 | ||||
-rw-r--r-- | src/model/c/src/montgomery_array.h | 6 | ||||
-rw-r--r-- | src/model/c/src/simple_tests.c | 52 |
9 files changed, 548 insertions, 111 deletions
diff --git a/src/model/c/Debug/modexp b/src/model/c/Debug/modexp Binary files differdeleted file mode 100755 index a49298d..0000000 --- a/src/model/c/Debug/modexp +++ /dev/null diff --git a/src/model/c/src/ModExpTestBench.c b/src/model/c/src/ModExpTestBench.c index ab236c1..9254992 100644 --- a/src/model/c/src/ModExpTestBench.c +++ b/src/model/c/src/ModExpTestBench.c @@ -3,11 +3,14 @@ #include "simple_tests.h" #include "autogenerated_tests.h" #include "montgomery_array_test.h" +#include "bignum_uint32_t.h" int main(void) { simple_tests(); autogenerated_tests(); montgomery_array_tests(0); + print_assert_array_stats(); + return EXIT_SUCCESS; } diff --git a/src/model/c/src/RSATestBench.c b/src/model/c/src/RSATestBench.c deleted file mode 100644 index 423db7d..0000000 --- a/src/model/c/src/RSATestBench.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include "montgomery_array_test.h" - -int main(void) { - montgomery_array_tests(); - - return EXIT_SUCCESS; -} diff --git a/src/model/c/src/autogenerated_tests.c b/src/model/c/src/autogenerated_tests.c index 2a80c42..80a078f 100644 --- a/src/model/c/src/autogenerated_tests.c +++ b/src/model/c/src/autogenerated_tests.c @@ -2,8 +2,288 @@ #include <stdlib.h> #include "montgomery_array.h" #include "bignum_uint32_t.h" -void autogenerated_BASIC_M4962768465676381896(void) { - printf("=== autogenerated_BASIC_M4962768465676381896 ===\n"); +void autogenerated_RSA_ENCRYPT_2x64_M4962768465676381896(void) { + printf("=== autogenerated_RSA_ENCRYPT_2x64_M4962768465676381896 ===\n"); + uint32_t X[] = { 0x00000000, 0x0e9266b8, 0x551464f6, 0xd9bec692, 0x823015f9 }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0xa2117847, 0xefd41b61, 0x9201d6aa, 0x603a342f }; + uint32_t expected[] = { 0x00000000, 0x4374e2ee, 0xd6ebcbee, 0xc56fc9b4, 0xa96a7ec4 }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(5, X, E, M, Z); + assertArrayEquals(5, expected, Z); +} +void autogenerated_RSA_DECRYPT_2x64_M4962768465676381896(void) { + printf("=== autogenerated_RSA_DECRYPT_2x64_M4962768465676381896 ===\n"); + uint32_t X[] = { 0x00000000, 0x4374e2ee, 0xd6ebcbee, 0xc56fc9b4, 0xa96a7ec4 }; + uint32_t E[] = { 0x00000000, 0x2917b6e0, 0xbe8d9057, 0x5890c532, 0xb7799b21 }; + uint32_t M[] = { 0x00000000, 0xa2117847, 0xefd41b61, 0x9201d6aa, 0x603a342f }; + uint32_t expected[] = { 0x00000000, 0x0e9266b8, 0x551464f6, 0xd9bec692, 0x823015f9 }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(5, X, E, M, Z); + assertArrayEquals(5, expected, Z); +} +void autogenerated_RSA_ENCRYPT_2x128_M6062092045291406770(void) { + printf("=== autogenerated_RSA_ENCRYPT_2x128_M6062092045291406770 ===\n"); + uint32_t X[] = { 0x00000000, 0x0c17fd78, 0xf27c977d, 0xa0114106, 0x07470d60, 0x139a1ae4, 0x5d968f90, 0x4593ee2e, 0x1da3e837 }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0xc44ca764, 0x1ada0dbf, 0x8c0755ba, 0xeb3244ae, 0xe1a335d4, 0x4e70a1af, 0xfd5af5ef, 0xdea24599 }; + uint32_t expected[] = { 0x00000000, 0x893262a1, 0xf96e8a49, 0x4c90c488, 0x667d5ab1, 0x6030bc1a, 0x7aff19ba, 0x321e0696, 0x9d0f47cf }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(9, X, E, M, Z); + assertArrayEquals(9, expected, Z); +} +void autogenerated_RSA_DECRYPT_2x128_M6062092045291406770(void) { + printf("=== autogenerated_RSA_DECRYPT_2x128_M6062092045291406770 ===\n"); + uint32_t X[] = { 0x00000000, 0x893262a1, 0xf96e8a49, 0x4c90c488, 0x667d5ab1, 0x6030bc1a, 0x7aff19ba, 0x321e0696, 0x9d0f47cf }; + uint32_t E[] = { 0x00000000, 0xaae28026, 0x292a0225, 0xe9e4c8c0, 0xfbd6baea, 0x6bd50aee, 0xa1cce68d, 0x654a8176, 0x7eb73801 }; + uint32_t M[] = { 0x00000000, 0xc44ca764, 0x1ada0dbf, 0x8c0755ba, 0xeb3244ae, 0xe1a335d4, 0x4e70a1af, 0xfd5af5ef, 0xdea24599 }; + uint32_t expected[] = { 0x00000000, 0x0c17fd78, 0xf27c977d, 0xa0114106, 0x07470d60, 0x139a1ae4, 0x5d968f90, 0x4593ee2e, 0x1da3e837 }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(9, X, E, M, Z); + assertArrayEquals(9, expected, Z); +} +void autogenerated_RSA_ENCRYPT_2x256_M5994408293843538622(void) { + printf("=== autogenerated_RSA_ENCRYPT_2x256_M5994408293843538622 ===\n"); + uint32_t X[] = { 0x00000000, 0x0ff1b35b, 0x08c6b82f, 0x53ece67a, 0x8b848024, 0x1ea4d811, 0x3bcc1f04, 0xd67b1e0f, 0xc7801bee, 0xdf814c2c, 0xd5977a5d, 0x277d375e, 0x8e7c7852, 0x8cb446c4, 0x525d9f3f, 0x70d9e40e, 0xef4787af }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0x4cd99cbf, 0xa7165b65, 0x5122a1cc, 0xa4ccee08, 0x0c141ce8, 0x7e108a1e, 0x177c1151, 0x10c51d54, 0x17b87a76, 0x016d6ae3, 0x8351c2cc, 0xd05e887c, 0xba8c57a1, 0x4dd8c7fa, 0xd7fbf97d, 0xbc0af707 }; + uint32_t expected[] = { 0x00000000, 0x48bfc274, 0x4587eff4, 0x5aa75e7a, 0xf9adb6b9, 0x288c745c, 0x7f1affc7, 0x05996c9d, 0x71152da6, 0x2a7ee7be, 0xb0ecbb95, 0x81f972f9, 0x1f0d1411, 0x4c8b05c3, 0x65c38f61, 0xdfce77a7, 0x75951597 }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(17, X, E, M, Z); + assertArrayEquals(17, expected, Z); +} +void autogenerated_RSA_DECRYPT_2x256_M5994408293843538622(void) { + printf("=== autogenerated_RSA_DECRYPT_2x256_M5994408293843538622 ===\n"); + uint32_t X[] = { 0x00000000, 0x48bfc274, 0x4587eff4, 0x5aa75e7a, 0xf9adb6b9, 0x288c745c, 0x7f1affc7, 0x05996c9d, 0x71152da6, 0x2a7ee7be, 0xb0ecbb95, 0x81f972f9, 0x1f0d1411, 0x4c8b05c3, 0x65c38f61, 0xdfce77a7, 0x75951597 }; + uint32_t E[] = { 0x00000000, 0x1d854e70, 0x54a802ed, 0xd58fff25, 0x547d2046, 0xd914f4d1, 0xde734e0b, 0x272c529e, 0x98598fdd, 0x2cd7d922, 0x1d246293, 0xd42d4017, 0x2a90f236, 0xa1acc014, 0xa7b8522a, 0x9ed33d45, 0xb8dd22c1 }; + uint32_t M[] = { 0x00000000, 0x4cd99cbf, 0xa7165b65, 0x5122a1cc, 0xa4ccee08, 0x0c141ce8, 0x7e108a1e, 0x177c1151, 0x10c51d54, 0x17b87a76, 0x016d6ae3, 0x8351c2cc, 0xd05e887c, 0xba8c57a1, 0x4dd8c7fa, 0xd7fbf97d, 0xbc0af707 }; + uint32_t expected[] = { 0x00000000, 0x0ff1b35b, 0x08c6b82f, 0x53ece67a, 0x8b848024, 0x1ea4d811, 0x3bcc1f04, 0xd67b1e0f, 0xc7801bee, 0xdf814c2c, 0xd5977a5d, 0x277d375e, 0x8e7c7852, 0x8cb446c4, 0x525d9f3f, 0x70d9e40e, 0xef4787af }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(17, X, E, M, Z); + assertArrayEquals(17, expected, Z); +} +void autogenerated_RSA_ENCRYPT_2x512_4990200181210089783(void) { + printf("=== autogenerated_RSA_ENCRYPT_2x512_4990200181210089783 ===\n"); + uint32_t X[] = { 0x00000000, 0x0e1b23b0, 0x5542e901, 0x147433ab, 0xd7986938, 0x547529be, 0x60d71757, 0xfe3fdc94, 0x5ef33809, 0x6507881f, 0xa2e32792, 0xbc4e44f9, 0xe96c0dcc, 0xfc8b363f, 0x0ba59c81, 0xecffdf67, 0xe0544059, 0x61cc8727, 0x5441a70c, 0xea4c88c4, 0x4ddea42b, 0x77434b60, 0x439233f3, 0xcdd922d3, 0xc28f420f, 0xc599e5b2, 0x2df23e06, 0x97a10532, 0x7a4d6c22, 0xd14e6ce5, 0xbccc309e, 0xa7b16cbc, 0xbd613d75 }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0x89676725, 0x8564ca30, 0xe10df272, 0x1a0be3b1, 0x9b37dc7d, 0x1ee4f58a, 0x315da110, 0x900b23db, 0xb6a7b475, 0xf6a2f5bb, 0x2ffd5cee, 0x9c945814, 0xdb9b8a20, 0xeca37844, 0x08fcad00, 0xaff3d3d2, 0x10b14bc9, 0xf905fed9, 0xbc9f5d9d, 0xb275fbc8, 0x0c0a3d16, 0x79af4255, 0x51091394, 0x0725ce6b, 0x0b0ef4cf, 0x1198e1bf, 0x064efe08, 0xcfe492c7, 0x80c99c8b, 0xf32c48a7, 0x2c6f0e69, 0xdb987b67 }; + uint32_t expected[] = { 0x00000000, 0x433dd044, 0xff6133e9, 0x99b38759, 0xd6a9561b, 0xd4557486, 0x46d32e6a, 0x36e54067, 0xe5d8ec14, 0xda0620f8, 0x884b1f88, 0x0a4c9154, 0xe7f4ae0c, 0xd53c45d3, 0x84fb9de3, 0xd134a95d, 0xa159d65e, 0x7b957d45, 0x18ee0505, 0xd8e9f2b3, 0xbe24ccc5, 0xcf31d327, 0x6a649d8e, 0xb2aa93d6, 0xf72ca97d, 0xdc076ee2, 0x5626a371, 0x33454835, 0xd4676e0f, 0xab0d53c4, 0xfb0ebec5, 0x19d1a7b0, 0xad40cafb }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(33, X, E, M, Z); + assertArrayEquals(33, expected, Z); +} +void autogenerated_RSA_DECRYPT_2x512_4990200181210089783(void) { + printf("=== autogenerated_RSA_DECRYPT_2x512_4990200181210089783 ===\n"); + uint32_t X[] = { 0x00000000, 0x433dd044, 0xff6133e9, 0x99b38759, 0xd6a9561b, 0xd4557486, 0x46d32e6a, 0x36e54067, 0xe5d8ec14, 0xda0620f8, 0x884b1f88, 0x0a4c9154, 0xe7f4ae0c, 0xd53c45d3, 0x84fb9de3, 0xd134a95d, 0xa159d65e, 0x7b957d45, 0x18ee0505, 0xd8e9f2b3, 0xbe24ccc5, 0xcf31d327, 0x6a649d8e, 0xb2aa93d6, 0xf72ca97d, 0xdc076ee2, 0x5626a371, 0x33454835, 0xd4676e0f, 0xab0d53c4, 0xfb0ebec5, 0x19d1a7b0, 0xad40cafb }; + uint32_t E[] = { 0x00000000, 0x54680be9, 0xf5b6c3aa, 0x21265330, 0x1aa6011a, 0x82925f45, 0x116c6f15, 0x945bc2ec, 0x8cbffb28, 0x265d8133, 0x11ee6b6b, 0xb100404d, 0x682c8cab, 0x4b7891f2, 0xc5cb69be, 0xc99286a8, 0x2c6e6948, 0xece22a99, 0x785f7c52, 0xfa2e315a, 0xab9866ce, 0x536b127a, 0xa8898c64, 0xcfdd0269, 0x7fea51b0, 0x7ff48067, 0xb73a32f8, 0x3489ac33, 0x2299f3b0, 0xee5f60ea, 0xf08de877, 0x599ceb2b, 0xd32ba9d1 }; + uint32_t M[] = { 0x00000000, 0x89676725, 0x8564ca30, 0xe10df272, 0x1a0be3b1, 0x9b37dc7d, 0x1ee4f58a, 0x315da110, 0x900b23db, 0xb6a7b475, 0xf6a2f5bb, 0x2ffd5cee, 0x9c945814, 0xdb9b8a20, 0xeca37844, 0x08fcad00, 0xaff3d3d2, 0x10b14bc9, 0xf905fed9, 0xbc9f5d9d, 0xb275fbc8, 0x0c0a3d16, 0x79af4255, 0x51091394, 0x0725ce6b, 0x0b0ef4cf, 0x1198e1bf, 0x064efe08, 0xcfe492c7, 0x80c99c8b, 0xf32c48a7, 0x2c6f0e69, 0xdb987b67 }; + uint32_t expected[] = { 0x00000000, 0x0e1b23b0, 0x5542e901, 0x147433ab, 0xd7986938, 0x547529be, 0x60d71757, 0xfe3fdc94, 0x5ef33809, 0x6507881f, 0xa2e32792, 0xbc4e44f9, 0xe96c0dcc, 0xfc8b363f, 0x0ba59c81, 0xecffdf67, 0xe0544059, 0x61cc8727, 0x5441a70c, 0xea4c88c4, 0x4ddea42b, 0x77434b60, 0x439233f3, 0xcdd922d3, 0xc28f420f, 0xc599e5b2, 0x2df23e06, 0x97a10532, 0x7a4d6c22, 0xd14e6ce5, 0xbccc309e, 0xa7b16cbc, 0xbd613d75 }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(33, X, E, M, Z); + assertArrayEquals(33, expected, Z); +} +void autogenerated_RSA_ENCRYPT_2x1024_M6518700023368260482(void) { + printf("=== autogenerated_RSA_ENCRYPT_2x1024_M6518700023368260482 ===\n"); + uint32_t X[] = { 0x00000000, 0x0a311e48, 0x0d000a72, 0x1abe90c3, 0xfde69c22, 0xb68a5512, 0x9e0e3179, 0x9830556f, 0xb3012eaf, 0xc2e02fc5, 0x5dded2d0, 0xc5c7ad29, 0x9292ab12, 0x60393a6a, 0x81f2ce8a, 0xdffaf8e3, 0xc719e252, 0x5961a5fc, 0x6b29d3e5, 0x3421e018, 0xec174916, 0xa1ae3027, 0xf9bdec45, 0xe67ab6fa, 0x7ae109d1, 0xb840fc18, 0x1a8a17cc, 0xee81b969, 0x7bb5db8e, 0x5263943a, 0xa55ee6cd, 0x62c716f5, 0x830bfe99, 0x39f77d9d, 0x6684b8e4, 0xfae01bbd, 0xe04cb546, 0x7205a682, 0x7aba9d46, 0xd02a3970, 0x106d3dc0, 0x9ee094b5, 0xdc454b0b, 0x6661c887, 0x731569cb, 0xa37867cd, 0x3fe6992a, 0xed571459, 0x41585bf3, 0x8bc4979f, 0x1dc42dc1, 0xc44e2f03, 0xbd1e3599, 0xab66c76d, 0x0fac6628, 0x3eaef9fe, 0xaac66e77, 0x07ef4d15, 0x5f2bc8f1, 0xa8299364, 0xfea22998, 0xf55f7ee7, 0xdb61eef0, 0x898e8c64, 0xd5535329 }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0xd49c6a62, 0xae09979b, 0x5337cdad, 0xb457e3f7, 0x5550dd37, 0x05180d6d, 0xf5fbe3a5, 0xa108dbf3, 0x88629746, 0xca129de2, 0x8302471f, 0x15058a33, 0x97c1d786, 0xf87da044, 0x13acbbe8, 0x9dad545c, 0xdd778482, 0x24f3bf5b, 0x42473afd, 0x89b05301, 0x9299817b, 0xc1222669, 0x4ec4a193, 0x274889fa, 0xcd1bce7a, 0x41b5310d, 0xf86b14a4, 0x5673ea86, 0x521b8374, 0xd28da0ac, 0xc84464f1, 0x1ec80fe6, 0xe75ecc90, 0x6c34aee2, 0xa627e90f, 0xb7688407, 0x41833bdf, 0x411ab5da, 0x6759d67b, 0x182bc41a, 0x910dfa56, 0xf6e345de, 0xe1aae4d1, 0xa7c63ba1, 0xd65aa619, 0xd8b2c716, 0x483cdc54, 0x516ba960, 0xa221a1c4, 0xee39e3c3, 0x0d839205, 0xd6adba6a, 0xc8fa9741, 0x4434bab7, 0x0cb18c9c, 0x75c967d4, 0xb15febac, 0x7237454e, 0x72087e79, 0xd9e1acf1, 0xfc374a56, 0xa7741ed9, 0xc16ad5d8, 0x285d4f41 }; + uint32_t expected[] = { 0x00000000, 0xc1dded3d, 0x28434587, 0xcccdffa8, 0xc98a9a1c, 0x04a6eb9f, 0xcf672252, 0x3ca88273, 0x4fa3868a, 0xd2228ce5, 0x005f7876, 0x2abbc04b, 0x04d86c72, 0x8466923d, 0x41d7077b, 0x950250b9, 0xb0044ecd, 0x440bd649, 0x23a57ce7, 0xd5651065, 0xa7aab420, 0x4a6f7a81, 0x433c6761, 0xe5a44ca7, 0x903dfee9, 0xcf7946a7, 0x22914c75, 0xbd0204ab, 0x192f78ad, 0xd45811cd, 0xa1b58078, 0x3ed0a735, 0xd81e6402, 0x2faf947c, 0xe7b85734, 0x18ada37a, 0xd438e4ce, 0xb9e2a374, 0x88968bf2, 0xe2db443c, 0xa9e8bb02, 0x32bca770, 0xa2964ec0, 0x782d3bd5, 0x575dc836, 0xd57f2b1b, 0x444300b2, 0x07889868, 0xb6f174dc, 0x0663243e, 0x93c14967, 0x4696ffb1, 0xd7c9a423, 0x1168031b, 0x55577481, 0x91ed0cde, 0x5ba3fc60, 0x55845380, 0x21dc1d33, 0x2c5fa2e5, 0xbc12c97e, 0x4bcc04ea, 0x692a309d, 0x8e1c9e02, 0xaa1c0a3d }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(65, X, E, M, Z); + assertArrayEquals(65, expected, Z); +} +void autogenerated_RSA_DECRYPT_2x1024_M6518700023368260482(void) { + printf("=== autogenerated_RSA_DECRYPT_2x1024_M6518700023368260482 ===\n"); + uint32_t X[] = { 0x00000000, 0xc1dded3d, 0x28434587, 0xcccdffa8, 0xc98a9a1c, 0x04a6eb9f, 0xcf672252, 0x3ca88273, 0x4fa3868a, 0xd2228ce5, 0x005f7876, 0x2abbc04b, 0x04d86c72, 0x8466923d, 0x41d7077b, 0x950250b9, 0xb0044ecd, 0x440bd649, 0x23a57ce7, 0xd5651065, 0xa7aab420, 0x4a6f7a81, 0x433c6761, 0xe5a44ca7, 0x903dfee9, 0xcf7946a7, 0x22914c75, 0xbd0204ab, 0x192f78ad, 0xd45811cd, 0xa1b58078, 0x3ed0a735, 0xd81e6402, 0x2faf947c, 0xe7b85734, 0x18ada37a, 0xd438e4ce, 0xb9e2a374, 0x88968bf2, 0xe2db443c, 0xa9e8bb02, 0x32bca770, 0xa2964ec0, 0x782d3bd5, 0x575dc836, 0xd57f2b1b, 0x444300b2, 0x07889868, 0xb6f174dc, 0x0663243e, 0x93c14967, 0x4696ffb1, 0xd7c9a423, 0x1168031b, 0x55577481, 0x91ed0cde, 0x5ba3fc60, 0x55845380, 0x21dc1d33, 0x2c5fa2e5, 0xbc12c97e, 0x4bcc04ea, 0x692a309d, 0x8e1c9e02, 0xaa1c0a3d }; + uint32_t E[] = { 0x00000000, 0x19f18035, 0xcc60d544, 0x19d27c61, 0x8ed90eb3, 0x3690e87d, 0x773ca91e, 0xdade42b8, 0x0a3f677f, 0x7f0bf0c3, 0xad92b9fb, 0x52db2b4c, 0x8aa72367, 0x0a449805, 0x1b3b511c, 0x1d7e7d6b, 0x741a1b6a, 0x3d8800fe, 0x547dfdc2, 0xa802c31a, 0xfefb2a15, 0xce0ab737, 0x1fa90820, 0xdf80b4ea, 0x9ce78816, 0xb782861e, 0x7af81e25, 0x4343e5bf, 0xebe0b724, 0x6ece76ab, 0x01aa5089, 0xe4e21ba3, 0x248b6b0d, 0x1c091b64, 0x9c37f319, 0x22c25e57, 0x5a7448d1, 0x5a8300da, 0x1278cd36, 0x0cb4c6ac, 0x8deed224, 0xb7fdd7d0, 0x6326c04d, 0x539fff6f, 0x63778630, 0x85468bf5, 0x5a9c33f7, 0x160efc5c, 0xf8e4b6d1, 0x353bd641, 0x117508cc, 0xd1996bc5, 0x0a392c11, 0xb0e1ffe8, 0xe7b14a2e, 0x5013a5af, 0xbcce99d5, 0x8b93bd75, 0xa4e198d7, 0x4c18c142, 0xe51872d5, 0x7ef0cf34, 0x3ae53a47, 0xf5297694, 0xfd0c2275 }; + uint32_t M[] = { 0x00000000, 0xd49c6a62, 0xae09979b, 0x5337cdad, 0xb457e3f7, 0x5550dd37, 0x05180d6d, 0xf5fbe3a5, 0xa108dbf3, 0x88629746, 0xca129de2, 0x8302471f, 0x15058a33, 0x97c1d786, 0xf87da044, 0x13acbbe8, 0x9dad545c, 0xdd778482, 0x24f3bf5b, 0x42473afd, 0x89b05301, 0x9299817b, 0xc1222669, 0x4ec4a193, 0x274889fa, 0xcd1bce7a, 0x41b5310d, 0xf86b14a4, 0x5673ea86, 0x521b8374, 0xd28da0ac, 0xc84464f1, 0x1ec80fe6, 0xe75ecc90, 0x6c34aee2, 0xa627e90f, 0xb7688407, 0x41833bdf, 0x411ab5da, 0x6759d67b, 0x182bc41a, 0x910dfa56, 0xf6e345de, 0xe1aae4d1, 0xa7c63ba1, 0xd65aa619, 0xd8b2c716, 0x483cdc54, 0x516ba960, 0xa221a1c4, 0xee39e3c3, 0x0d839205, 0xd6adba6a, 0xc8fa9741, 0x4434bab7, 0x0cb18c9c, 0x75c967d4, 0xb15febac, 0x7237454e, 0x72087e79, 0xd9e1acf1, 0xfc374a56, 0xa7741ed9, 0xc16ad5d8, 0x285d4f41 }; + uint32_t expected[] = { 0x00000000, 0x0a311e48, 0x0d000a72, 0x1abe90c3, 0xfde69c22, 0xb68a5512, 0x9e0e3179, 0x9830556f, 0xb3012eaf, 0xc2e02fc5, 0x5dded2d0, 0xc5c7ad29, 0x9292ab12, 0x60393a6a, 0x81f2ce8a, 0xdffaf8e3, 0xc719e252, 0x5961a5fc, 0x6b29d3e5, 0x3421e018, 0xec174916, 0xa1ae3027, 0xf9bdec45, 0xe67ab6fa, 0x7ae109d1, 0xb840fc18, 0x1a8a17cc, 0xee81b969, 0x7bb5db8e, 0x5263943a, 0xa55ee6cd, 0x62c716f5, 0x830bfe99, 0x39f77d9d, 0x6684b8e4, 0xfae01bbd, 0xe04cb546, 0x7205a682, 0x7aba9d46, 0xd02a3970, 0x106d3dc0, 0x9ee094b5, 0xdc454b0b, 0x6661c887, 0x731569cb, 0xa37867cd, 0x3fe6992a, 0xed571459, 0x41585bf3, 0x8bc4979f, 0x1dc42dc1, 0xc44e2f03, 0xbd1e3599, 0xab66c76d, 0x0fac6628, 0x3eaef9fe, 0xaac66e77, 0x07ef4d15, 0x5f2bc8f1, 0xa8299364, 0xfea22998, 0xf55f7ee7, 0xdb61eef0, 0x898e8c64, 0xd5535329 }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(65, X, E, M, Z); + assertArrayEquals(65, expected, Z); +} +void autogenerated_65537_64_M4962768465676381896(void) { + printf("=== autogenerated_65537_64_M4962768465676381896 ===\n"); + uint32_t X[] = { 0x00000000, 0xd522fe95, 0x63d4a7f1 }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0xc2a94bf9, 0x1f25be1f }; + uint32_t expected[] = { 0x00000000, 0x810ea537, 0xf16a61ab }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(3, X, E, M, Z); + assertArrayEquals(3, expected, Z); +} +void autogenerated_65537_64_M5159275287763741611(void) { + printf("=== autogenerated_65537_64_M5159275287763741611 ===\n"); + uint32_t X[] = { 0x00000000, 0xdb5a7e09, 0x86b98bfb }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0xb3164743, 0xe1de267d }; + uint32_t expected[] = { 0x00000000, 0x9fc7f328, 0x3ba0ae18 }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(3, X, E, M, Z); + assertArrayEquals(3, expected, Z); +} +void autogenerated_65537_64_3760534544499724252(void) { + printf("=== autogenerated_65537_64_3760534544499724252 ===\n"); + uint32_t X[] = { 0x00000000, 0xf077656f, 0x3bf9e69b }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0xb6684dc3, 0x79a5824b }; + uint32_t expected[] = { 0x00000000, 0x419a024f, 0xdddf178e }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(3, X, E, M, Z); + assertArrayEquals(3, expected, Z); +} +void autogenerated_65537_128_3878376283807279832(void) { + printf("=== autogenerated_65537_128_3878376283807279832 ===\n"); + uint32_t X[] = { 0x00000000, 0xf5e8eee0, 0xc06b048a, 0x964b2105, 0x2c36ad6b }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0x956e61b3, 0x27997bc4, 0x94e7e5c9, 0xb53585cf }; + uint32_t expected[] = { 0x00000000, 0x1e97bff8, 0x60029e6e, 0xedaef85e, 0xfb0c6562 }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(5, X, E, M, Z); + assertArrayEquals(5, expected, Z); +} +void autogenerated_65537_128_5594822731491506219(void) { + printf("=== autogenerated_65537_128_5594822731491506219 ===\n"); + uint32_t X[] = { 0x00000000, 0x94c70152, 0x9760b47a, 0x7922cacc, 0xc9c2f56b }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0x9f887d3a, 0xa1230a1a, 0xe560a3f7, 0xc245a555 }; + uint32_t expected[] = { 0x00000000, 0x5555e69f, 0xb4fc0507, 0x4aa643fb, 0xd910f8b2 }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(5, X, E, M, Z); + assertArrayEquals(5, expected, Z); +} +void autogenerated_65537_128_769311575533169616(void) { + printf("=== autogenerated_65537_128_769311575533169616 ===\n"); + uint32_t X[] = { 0x00000000, 0xececab79, 0x8abb30ad, 0xfd2d013e, 0xf5f24773 }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0xa7b17ce0, 0xf7f05f94, 0x629d65a2, 0x139a2d49 }; + uint32_t expected[] = { 0x00000000, 0x34ec0fed, 0x8e605c68, 0x8ac69c43, 0x564e08ef }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(5, X, E, M, Z); + assertArrayEquals(5, expected, Z); +} +void autogenerated_65537_256_7584111717683545699(void) { + printf("=== autogenerated_65537_256_7584111717683545699 ===\n"); + uint32_t X[] = { 0x00000000, 0xbd589a51, 0x2ba97013, 0xc4736649, 0xe233fd5c, 0x39fcc5e5, 0x2d60b324, 0x1112f2d0, 0x1177c62b }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0xf169d36e, 0xbe2ce61d, 0xc2e87809, 0x4fed15c3, 0x7c70eac5, 0xa123e643, 0x299b36d2, 0x788e583b }; + uint32_t expected[] = { 0x00000000, 0x7c5f0fee, 0x73028fc5, 0xc4fe57c4, 0x91a6f5be, 0x33a5c174, 0x2d2c2bcd, 0xda80e7d6, 0xfb4c889f }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(9, X, E, M, Z); + assertArrayEquals(9, expected, Z); +} +void autogenerated_65537_256_M3116426901380202388(void) { + printf("=== autogenerated_65537_256_M3116426901380202388 ===\n"); + uint32_t X[] = { 0x00000000, 0xc5c1f875, 0x62caa265, 0x58c31648, 0xd77101ee, 0x94b50d12, 0x2e2e7ae8, 0x3abe9570, 0x105c1855 }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0xf51bef0c, 0x2fb32570, 0x4eb3fe31, 0x7934d65d, 0x90d5a552, 0x52648a86, 0x565fb839, 0xc75f1a47 }; + uint32_t expected[] = { 0x00000000, 0x839155be, 0xd05138cc, 0x98d22bd5, 0x11c6b803, 0xe88f2c20, 0x5a0ccc95, 0xd25fec18, 0x738a2779 }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(9, X, E, M, Z); + assertArrayEquals(9, expected, Z); +} +void autogenerated_65537_256_1049687409305378688(void) { + printf("=== autogenerated_65537_256_1049687409305378688 ===\n"); + uint32_t X[] = { 0x00000000, 0x82de8463, 0xf235d47f, 0x95751d38, 0x580de775, 0x6aebb7a8, 0x6d60c9ad, 0xaf927246, 0xad3ebde3 }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0xc3606522, 0xbc9af383, 0xd6734d1c, 0x77921e72, 0x150019c7, 0x934fe417, 0x5be873ad, 0x91875637 }; + uint32_t expected[] = { 0x00000000, 0x2c94c309, 0x70134b91, 0xac7f5ab5, 0xa203d0ba, 0x1e3a3933, 0xf0a6e980, 0x4ca3af7e, 0xe6fc5275 }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(9, X, E, M, Z); + assertArrayEquals(9, expected, Z); +} +void autogenerated_65537_512_7440167874398799474(void) { + printf("=== autogenerated_65537_512_7440167874398799474 ===\n"); + uint32_t X[] = { 0x00000000, 0xe91e19b4, 0xc45338ec, 0x4de78521, 0x26761b1c, 0xcae937be, 0x2ab87f56, 0xd66443b5, 0x0636c0e0, 0x163fe5e6, 0x094faa6c, 0x9e754917, 0x5f5dcf8e, 0x340ffed6, 0xbfbe4247, 0x7772b5b4, 0x5850ce63 }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0xc0386396, 0xecea4cb2, 0xf975ffdd, 0x8a2d8972, 0x5d03f82b, 0xab1293fe, 0x164f77ae, 0x59212631, 0x51d7a4c4, 0x93eaab90, 0x3304e412, 0x5eee3a88, 0x9679e002, 0x99ad216e, 0x6adce8ed, 0xb2d08efd }; + uint32_t expected[] = { 0x00000000, 0x892c9c50, 0x0eb9ea6b, 0x28759466, 0xc0051310, 0xa785aea0, 0xf4a74c0f, 0x56974b49, 0x43b1b9d6, 0x80e3ce92, 0x088ffc0f, 0xac26662b, 0xfeacdaa0, 0x87ca5bd8, 0x3723e796, 0xad22dabf, 0x3abdc23f }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(17, X, E, M, Z); + assertArrayEquals(17, expected, Z); +} +void autogenerated_65537_512_6048688486258747650(void) { + printf("=== autogenerated_65537_512_6048688486258747650 ===\n"); + uint32_t X[] = { 0x00000000, 0xf9a16e25, 0x5074fe3c, 0xd04724c5, 0x806b40cd, 0x42c89208, 0x4c71c52b, 0x8234b8b2, 0x56fa0c8a, 0x3431a0ad, 0xbce87c69, 0xb9aa3a2d, 0x3e45ec1a, 0xb9d13738, 0x9eebd0f0, 0xd30f3cda, 0x6ab6a2fb }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0x994de332, 0xd6c3cbda, 0x63a87924, 0xd6774ad2, 0xf06c2310, 0xdb5a499f, 0x06deb232, 0x64b22116, 0x50ccaf57, 0xa88cec88, 0xba5dd49d, 0x022b0bba, 0xd6cec5d2, 0x3d8e4ef6, 0x23948572, 0x1e2f98ff }; + uint32_t expected[] = { 0x00000000, 0x7b505c69, 0x2e70ea98, 0xbd34e0fb, 0x168742fe, 0x9da33217, 0x65e652be, 0xd44b4f76, 0x6735effe, 0xbf7e75d1, 0xacd328e2, 0xdfad8e05, 0xd12e370d, 0xe17e7944, 0x44839e35, 0xcf076872, 0x1d0dd369 }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(17, X, E, M, Z); + assertArrayEquals(17, expected, Z); +} +void autogenerated_65537_512_M3689965194811981076(void) { + printf("=== autogenerated_65537_512_M3689965194811981076 ===\n"); + uint32_t X[] = { 0x00000000, 0xd24b95c4, 0x4525868a, 0x8df5b5cb, 0x8e68c32d, 0x6ded6bed, 0xeccc3433, 0x7a2fc0c0, 0x46b54898, 0x4f6da5c2, 0x6de64a90, 0xbef0d2b6, 0x13ef5a96, 0xa9338232, 0x3e887893, 0x9d5f9cf3, 0xad6f28b7 }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0xaaad186d, 0xe7baeeaa, 0xb439b14e, 0x5880e681, 0x2a1e5b87, 0x5aaaf09e, 0x96de78c5, 0xe25616c0, 0x25afe443, 0x9a987cbe, 0xb13ee8b4, 0x546fa2fb, 0xa4a1de34, 0xaa196c50, 0x78d64632, 0x690fc5f5 }; + uint32_t expected[] = { 0x00000000, 0x3518d088, 0x032f7380, 0x4031fd22, 0x9709c823, 0x35e0e6e7, 0xaeaaf0d1, 0x965c7b88, 0x43679c12, 0x5b2967cc, 0x3de0bf24, 0xd8222647, 0xa9d1a700, 0x68463812, 0x20e3674a, 0x8c7e4f56, 0x261c6bbd }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(17, X, E, M, Z); + assertArrayEquals(17, expected, Z); +} +void autogenerated_65537_1024_M5783369654979853500(void) { + printf("=== autogenerated_65537_1024_M5783369654979853500 ===\n"); + uint32_t X[] = { 0x00000000, 0xa05bba64, 0x84e94373, 0x6dde5c2c, 0xd2a943ef, 0xb3f24892, 0x9ece7d28, 0x1289c608, 0xa37ae367, 0x64709285, 0x656501bc, 0xe885e891, 0xf6a80718, 0xf0ec2ec7, 0x10db7220, 0xbdb7584b, 0x0e5eae7f, 0x7be75140, 0x843dfd12, 0x791f077d, 0x8fc3a6ef, 0x0f68aa78, 0x0a8f00a6, 0xcbf7ffe6, 0x53203c2b, 0xe4bd9493, 0x42e1e01e, 0x0467c1b5, 0x7d6eb524, 0xe15db3e5, 0x56abb799, 0x42eb1f18, 0xcdbef06b }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0xff36ef6e, 0x220264eb, 0x8418c06d, 0x65fda3dc, 0x02d04dd5, 0xe8c100a2, 0x00dde237, 0x24f8ce0b, 0x6e07bb42, 0xbc969ecb, 0x5b20795c, 0x12d42376, 0x2d599b65, 0xb50f9ed7, 0x9b7e97f3, 0x24b477bd, 0x2b811840, 0xbc98d794, 0x85cb4cf4, 0xd06421e1, 0xdd8682bb, 0x3a3069ae, 0x3f2868c3, 0xe3eaf12a, 0x8505e761, 0x1344bd32, 0x374fd824, 0x90ab2641, 0xb3349edc, 0xd2e9ed7c, 0x433a59a7, 0xcb81cefb }; + uint32_t expected[] = { 0x00000000, 0x629cd01e, 0xeec284a7, 0x52e0eef0, 0x49b5461b, 0xe5588064, 0x1036af2b, 0x09631c3d, 0x471d1c43, 0x014ebd7c, 0x006962d0, 0x47f24fbc, 0xce52670c, 0x380006eb, 0x2e27645b, 0x26c15463, 0xcd6579da, 0x112b8e69, 0x4bfac5fd, 0x78abc67f, 0xd4178004, 0xd012319a, 0xa5aac5a3, 0xe93b8f9e, 0xd3d70264, 0x70c7879f, 0x7833d800, 0xdb211611, 0x0360f30d, 0x545415e0, 0x62a67262, 0x1ec14e9c, 0x084ab43c }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(33, X, E, M, Z); + assertArrayEquals(33, expected, Z); +} +void autogenerated_65537_1024_5690344643830992838(void) { + printf("=== autogenerated_65537_1024_5690344643830992838 ===\n"); + uint32_t X[] = { 0x00000000, 0x9ac5781c, 0xc33c6ddb, 0x1a1d545d, 0x8eab2b95, 0x07feaad9, 0x40e08f09, 0x044c1336, 0xd0de9ce1, 0xa369776e, 0xdd8a9482, 0x756c57ac, 0x2aac2e1f, 0xc63d91b1, 0xf889a279, 0x7a85197a, 0xfd08d55c, 0x2573bc2b, 0x11d17aa2, 0xcc392762, 0xcd5a7e16, 0xfa6c1dff, 0xa0b22f02, 0x0ef2da59, 0x368e265d, 0xe4f6e8de, 0x22d25e49, 0x52e7b585, 0x202990f3, 0x0bbd7b70, 0x74a34f3a, 0xe1d13154, 0x31cc405d }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0x84515ae0, 0xf2d5a705, 0x7734bf3a, 0x4da6eaa6, 0x1944b51d, 0xa5fb3a57, 0x5a440187, 0x9355ec20, 0x35ae2a85, 0x92ab3771, 0x79cd9fd9, 0x387812d4, 0x4a41b188, 0x51991e7a, 0xbaac1aa7, 0x9620fad1, 0xa51bb587, 0x1a4a2f15, 0x2ee0ae47, 0xa8a82cc8, 0x97879869, 0x9c0597ba, 0x4e89218b, 0x04c14860, 0x57918ed3, 0x0d805dee, 0x874fc2de, 0x07fb38dd, 0x2697ee98, 0x8291a940, 0xf7e6d200, 0x51420f4b }; + uint32_t expected[] = { 0x00000000, 0x6c166ef7, 0x725077b5, 0x7b646265, 0xae4f4e58, 0xb70b41a5, 0x4dacd54e, 0x82c848db, 0x1eb8ff36, 0x7d6091cd, 0xbbba393b, 0x7945a49e, 0x33a0b667, 0x67508150, 0x5061e5fe, 0x4c9645c1, 0x9db4590a, 0x4e4cfa72, 0x93853483, 0x8986535e, 0x507ba8c5, 0x88e0bd2d, 0xfbf03956, 0x802a6b6a, 0x8c962721, 0x7490df57, 0x2d737004, 0xaa788bb1, 0xd78b9270, 0xa40da8d4, 0x176fa08d, 0x20fb2d11, 0xefb5bc89 }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(33, X, E, M, Z); + assertArrayEquals(33, expected, Z); +} +void autogenerated_65537_1024_2419688117908792423(void) { + printf("=== autogenerated_65537_1024_2419688117908792423 ===\n"); + uint32_t X[] = { 0x00000000, 0x8f0d849c, 0xf1cb1c5f, 0x0ef53bcf, 0x2c31095b, 0xfe679cd0, 0xcbb66497, 0xcd84f77b, 0x48710dc0, 0x9ebb9553, 0xa16506d9, 0x11aac7ff, 0xc30338f3, 0x1cd31a07, 0x4b678697, 0xd2c05341, 0xc56c354a, 0x14876355, 0xd8f9e574, 0x78492187, 0x0541c64c, 0xe923695c, 0xd6ddde71, 0xd5f48b7b, 0xb67409dd, 0xd9d89a4a, 0xd099f240, 0x54fb9df6, 0xa034e202, 0x4b8481df, 0x17f22b6b, 0x7233bad6, 0x8cad8077 }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0x94f1063a, 0xfe669689, 0x224774ac, 0x311fd893, 0x6583e32a, 0x43c9f97f, 0x0d54ea60, 0x744e6cb5, 0x01ac9ca9, 0x64ccd37b, 0x756b17de, 0x0e24fa3d, 0x1739416c, 0x93493d32, 0xa26d8bc8, 0x1027a85d, 0xe57c521d, 0xd9d41f45, 0x70126f28, 0xbff39dab, 0x91f5a599, 0x5caa82e8, 0x4207209b, 0x743456bd, 0x381e192e, 0xe4ab62cc, 0x36789c1f, 0xc3c49c61, 0x47bd88a6, 0x9b32ceb9, 0x9a788152, 0xdf62ac99 }; + uint32_t expected[] = { 0x00000000, 0x84c0c985, 0x1e26fac5, 0x93a4e93d, 0x1ad34adb, 0x2b5f9401, 0x7caddfe3, 0x74dbf2e8, 0xb31ec0dc, 0x96250563, 0xa0a20a13, 0x4f8ced49, 0x7607f54d, 0x0ad713ed, 0xd7d48b94, 0xc4d1208c, 0x384a21e3, 0xe0f8df83, 0xb99c81f1, 0xb5de5696, 0x0ce6d530, 0x6a66a752, 0x647841d6, 0xca48aa42, 0x6618294c, 0x5b49cbd5, 0xd7d56021, 0xaad1fb73, 0x243eed3c, 0x24dcfbd6, 0xed2b7d6e, 0x657a9158, 0x2ded4806 }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(33, X, E, M, Z); + assertArrayEquals(33, expected, Z); +} +void autogenerated_65537_2048_M4113938405113783334(void) { + printf("=== autogenerated_65537_2048_M4113938405113783334 ===\n"); + uint32_t X[] = { 0x00000000, 0xda6e2e85, 0x5824e207, 0x45ee32dd, 0x6d7d0760, 0xb3a9c61b, 0x7be595c5, 0x85c1c49e, 0xe4d625b1, 0x20c56008, 0x430c3cb7, 0x2c540f38, 0x66523dd2, 0xfcf17832, 0x50582f71, 0x7eb2f07a, 0x93345aa9, 0x597ade09, 0x8b9c0941, 0x278830cd, 0x37b1201c, 0xecf2040c, 0xc29ec523, 0x3a4a3bd8, 0x0367ed3d, 0xa89eecb8, 0x76dc66e9, 0x777dd7bd, 0x7f62d55c, 0xa8e8ba6f, 0xf4489835, 0xcc9cf28c, 0x3fdcaecd, 0x51184699, 0xa258306a, 0x1e647707, 0x54262b94, 0xb7a36505, 0x9aed9938, 0x4883f740, 0x057d9de7, 0x3fc40a91, 0x7cf906af, 0x63fd0ec2, 0xbfae9156, 0x86313b15, 0x7fe84a3f, 0x48b807be, 0x49cf1056, 0x8126426c, 0xc92988f4, 0x5200a85b, 0x3b6aa13c, 0xe5140a99, 0x0169bde3, 0x68047fef, 0xb0e8f397, 0xc9aad3fe, 0x214df4be, 0x398eae69, 0x3a1e03fe, 0x880ea533, 0x90d09c4c, 0xc97a61c3, 0x163180f7 }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0xfdcf0b56, 0x2eb94cfa, 0xca1d70c4, 0x97749cf2, 0xcc141493, 0x0f3eda36, 0xc123b16c, 0x5a08f3a8, 0xfd9a6896, 0x7ac7b4c4, 0xcda1ec80, 0x47d43ad6, 0xfdca1eb2, 0x11b7d2d7, 0xe837846f, 0xa0b8297d, 0xb48b429f, 0x041ef3cc, 0xb12cbce5, 0x161b9957, 0xea87f0b6, 0xa22055c4, 0x6fcbb797, 0x808621dd, 0xe6e504e6, 0x327f49df, 0x561ecf33, 0xc711a492, 0x58550b7e, 0x04581369, 0x09890ffb, 0x25c28e6d, 0x78978789, 0xc2764a9d, 0x6007cd85, 0x8e5cc8d8, 0x6ee57b71, 0x0bc542fe, 0x6a14429d, 0x6d5a0377, 0xf4d884f0, 0x41b0219a, 0xb57d9896, 0x93f5fe8d, 0x39bb38cb, 0xa298839e, 0xcca69590, 0x6c7f38c3, 0x085ef2f7, 0x959d20ee, 0x0001c96f, 0x7377fe9b, 0x29e30d98, 0x465b0163, 0x6bbbc38d, 0xe714fadb, 0x071620d4, 0x746dc927, 0x31efcc22, 0xbe375b2d, 0x923b17aa, 0x89cba654, 0x09ccf55e, 0xdaf4214d }; + uint32_t expected[] = { 0x00000000, 0x92da3497, 0xc72af709, 0xddb39762, 0x99b61f5b, 0x54cdff4a, 0x96d4974b, 0xac4e1b8c, 0x00c4f466, 0x682f0260, 0x2e4e637a, 0xe8a3cf27, 0x8f9cb9de, 0xc7e880e0, 0x75208b9b, 0x6d68e3d5, 0x8f271c6c, 0x493501e5, 0x46abdcd1, 0x0bbae3e4, 0x116f8f6e, 0x61a88b33, 0xfc3cfcc8, 0xf0f8f1c3, 0x44c71f4e, 0xd4e749e3, 0xe028a544, 0x5998def5, 0xcd29cb3c, 0x669d63e5, 0x8e05f9a6, 0xcbbf8715, 0x455eb515, 0x53901215, 0xeb7b8178, 0x2a877a68, 0x1dc80383, 0x8480910b, 0x81a1cf06, 0x2214a756, 0x48fa3863, 0x776f6673, 0xc94fbcb9, 0xc83f469a, 0xa06239de, 0xfa4ba04f, 0x619bc8d0, 0x512f47a7, 0x6f97cb6c, 0xa0dffcae, 0x758da9dd, 0x8798cb88, 0x2c272a49, 0x184c4af4, 0x15efffba, 0xe49fd324, 0x408062bb, 0x9439b750, 0x5a1b7adc, 0x414ec643, 0xdb05d719, 0xc4d61318, 0x6eb4b7ef, 0xb19dd6a5, 0xf0663037 }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(65, X, E, M, Z); + assertArrayEquals(65, expected, Z); +} +void autogenerated_65537_2048_1028944263296872045(void) { + printf("=== autogenerated_65537_2048_1028944263296872045 ===\n"); + uint32_t X[] = { 0x00000000, 0xe3d684f5, 0x78dbbe30, 0x5b33b58e, 0x249587b6, 0x0f2ec06f, 0x919383c0, 0x93bd14cd, 0x41628255, 0xa4092a77, 0x1ba3359b, 0x1b6b020f, 0x8fc4a70b, 0xb6fa5104, 0x66e605da, 0x44072fff, 0x28cfbaf6, 0xea123cef, 0x44aacf63, 0xa1b0d16a, 0x6ba7232c, 0x2416bd91, 0xa88df1cc, 0xda43e9a6, 0x467934ef, 0x8593fbfc, 0x8959a0b4, 0xc01fa978, 0xb7eb127a, 0x94193525, 0x0cf3b4cc, 0xa296e5e0, 0x8fd9255a, 0xbaf9251d, 0xe1cb6425, 0xdea0c562, 0x78529f28, 0xf34e650d, 0xec746673, 0xbaa44424, 0x3a28b70a, 0xc23bee9a, 0x2837faba, 0x74676824, 0x398caad3, 0x65932ab6, 0xc8d6681f, 0x977bbc94, 0x4181d990, 0x4a626290, 0x9ee408fb, 0x8fc0e59a, 0x8625a36e, 0xc109b7ab, 0xc041fde9, 0x7fc735a1, 0xe5182e3f, 0xf2e20789, 0x68b9e50f, 0x52314f43, 0x70835afb, 0x109d897a, 0x1cd5e4b0, 0x105a697b, 0x2980f41d }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0xb958079c, 0xc541aa93, 0x9efbf94f, 0xd594e395, 0x1d548c16, 0xb4abdf14, 0xbd8c82bb, 0xb42802e3, 0x478addbd, 0x7d4deeb3, 0x1fb79019, 0x0c89d637, 0x69bc6f37, 0x60a7a5b2, 0x931937ad, 0xc33c1cf6, 0x0192292c, 0xd87cce69, 0xe6e1f6ac, 0xc6cdc3a4, 0x926658f0, 0x43222677, 0xbd33b169, 0x4d098e0a, 0x97be378a, 0xc8800ea1, 0xa5a847b2, 0x6380e436, 0xb49746eb, 0x74f4dfed, 0x683d3c50, 0xa50c9be2, 0x2e08a55c, 0xa668f87b, 0xa240d27d, 0x495dbe9a, 0x9de167c3, 0xad5675d3, 0x931637c4, 0x62d04f57, 0xe04a77d6, 0xaf8a3c59, 0x35e65211, 0x611c0f27, 0x5085682f, 0xccd2d106, 0x90834ea6, 0xde8d76ec, 0x3751124a, 0x82fcb5c1, 0x4d2bddf2, 0x98dd163f, 0x83a59ebe, 0x52c4ed71, 0x89e32d8b, 0xbae2cb1b, 0xb6aed3ee, 0xa49b1500, 0xec955140, 0x60a51366, 0x204979dc, 0xe768518a, 0xf936206a, 0x5895665f }; + uint32_t expected[] = { 0x00000000, 0x0f4bdce4, 0x9040c526, 0x526e3eef, 0xbeb59dae, 0xd68d2452, 0xca6f0f6e, 0x6da60fa5, 0xb1be05c6, 0x8acfed77, 0xf59361a1, 0x68a58c32, 0xb7ade887, 0xc9bfd4b3, 0xef2c20ec, 0x323866cf, 0xf3f24f7e, 0x144f00cd, 0xa87bc5e3, 0xdf58c6d9, 0x8c6aeb78, 0xeaa9e854, 0x4a91f016, 0x84627af0, 0xde4ee3a5, 0x23dea3e7, 0xbd7232db, 0xb0b5c34f, 0xae56d8fd, 0xb83bb89b, 0x73e5a46d, 0x4118e8e7, 0x2ee8f58a, 0x210e6999, 0x580eac36, 0x6c0cec53, 0x7d72801e, 0xcce7963e, 0xe3ec04fb, 0xf1a158b9, 0x545c66f8, 0x64640964, 0x776e3faa, 0x43663db0, 0x8560fe82, 0xba3c4aea, 0x7e6c4af5, 0x8e32f713, 0x2875ab8b, 0x73dbb402, 0x0ff89a7e, 0xf7e71598, 0x27eac398, 0x8e004902, 0xd3bb7df3, 0xbf6107f0, 0x6a7dda9e, 0xb56a8e96, 0x2118c8e7, 0x0b02885d, 0x83efc0e7, 0x399d22a8, 0xc86ecb15, 0xeddd585f, 0xf09591c0 }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(65, X, E, M, Z); + assertArrayEquals(65, expected, Z); +} +void autogenerated_65537_2048_M4248726279996728686(void) { + printf("=== autogenerated_65537_2048_M4248726279996728686 ===\n"); + uint32_t X[] = { 0x00000000, 0xe8a2829e, 0xf2a6ccb4, 0xc1c5e54f, 0x9aa899a1, 0x19e7b71d, 0x83ea0e80, 0x18871ecb, 0xb17d526d, 0xe778777f, 0x3d37cc46, 0xd7df88b2, 0xe5b0ad8a, 0xcbcfd49b, 0xbdfbcb7a, 0xc838468c, 0x6529d118, 0x5d40cde6, 0x305db565, 0xbfcfd9c5, 0x1786bee7, 0xc1fb680f, 0x7103332e, 0x22943088, 0xcc997a91, 0xc0a911c7, 0x56127fd7, 0xabc7abf9, 0xb5f6b351, 0x3501b65b, 0x47e4a411, 0x6c672e50, 0x163d8209, 0xaa02e4d6, 0x0f5a8b4f, 0x13a1a9e6, 0x39213fb0, 0x41b9791a, 0xf6d3b355, 0x6fd8a48e, 0xa45c15cd, 0xd8a52683, 0x0f28c7ae, 0x320102c3, 0x8dfef035, 0x6838f6df, 0xcd29cb1a, 0xf850076e, 0x8dcf3fab, 0xadfbbd9e, 0xdc9670e8, 0x888dc31d, 0x94bca763, 0x0c57d05d, 0x2e7d920e, 0x587b72c7, 0x1d7dc4d2, 0xb00aff3d, 0x536efdfb, 0x5630db60, 0xa2e85cf9, 0xf5c90653, 0x0d14262e, 0xe54efa65, 0x51af9b3d }; + uint32_t E[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010001 }; + uint32_t M[] = { 0x00000000, 0x8306f344, 0x4cb9abbc, 0x0440401b, 0x14000671, 0xcdba9a37, 0x1c635012, 0x96f61217, 0x493d2ea2, 0x2e2e05b2, 0xd18f6deb, 0x668e3c73, 0x8219014f, 0x36064b4d, 0x3fde88de, 0x1448cb3d, 0xe872888b, 0x168ffc4e, 0x4c6f6f8b, 0xcede3550, 0xd6562fbe, 0x09d3e510, 0x0aea5ab5, 0xd23c38cd, 0x18769962, 0x70cc21c1, 0x082d5abb, 0x327428c6, 0x54280113, 0x3f162c9d, 0xe44083f7, 0xd6ff9b9b, 0xc8b2ad8e, 0x98beb23b, 0x2560b917, 0xc79031c4, 0x35c6fade, 0xb41fe0c0, 0x47282b64, 0xaaebd3c6, 0x1a6885a6, 0x0ae3ee01, 0x16485afd, 0x899a0e18, 0x25bba14e, 0xa9925815, 0x3f3fbfd6, 0xd97655e4, 0xe65a8021, 0xe95c11a7, 0x230331d9, 0xb84fac9f, 0xc53ea152, 0x42ee499a, 0xee9c6182, 0x75302cf6, 0x36589d9e, 0x7b855a26, 0xe8143e32, 0x550bb8b4, 0x2a602f16, 0x06a60831, 0x0a3f1165, 0x94cc0abe, 0xc888007d }; + uint32_t expected[] = { 0x00000000, 0x4ef4af85, 0x33d981a1, 0x223ac128, 0xecd4f6de, 0x83809d8d, 0x2d95d75b, 0x2ae5c9d0, 0x92780c00, 0x0c0f774e, 0xab35a6bb, 0x4922a554, 0xbfb578ce, 0x4a72367e, 0xd2879fda, 0x035a6da4, 0xb714e84f, 0xd52ac930, 0xb8ccb104, 0xb8af2869, 0x83772d25, 0x428c2e63, 0x74ef9b9e, 0x2ccc35b0, 0x21c3697c, 0xe7c9a306, 0x27964c2c, 0xbc794695, 0x46ea2659, 0xb7c47ec8, 0x81cc2a97, 0xcf8080e6, 0xab2f9aa1, 0x0171a861, 0x96cb9a66, 0xf6818959, 0xc9c06f8b, 0xe4356567, 0x516d7820, 0xe9deacc7, 0xdc2f95a2, 0x22dfceef, 0xe40cfbc8, 0x903dee50, 0x6240fbb4, 0x4a7779cf, 0x8c0b552d, 0x52a4a22d, 0x91b0750e, 0xed340c90, 0x335d2997, 0x4a573c3c, 0xb449ad24, 0xc9a9e144, 0x2ce699cb, 0x9d099727, 0x847ff56f, 0xd7a3aff0, 0x711c919e, 0x4c022f39, 0xed9498e8, 0x5ae99593, 0x277ef4ce, 0x2ca8e150, 0x3995f0b9 }; + uint32_t Z[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; + mod_exp_array(65, X, E, M, Z); + assertArrayEquals(65, expected, Z); +} +void autogenerated_BASIC_33_M4962768465676381896(void) { + printf("=== autogenerated_BASIC_33_M4962768465676381896 ===\n"); uint32_t X[] = { 0x00000001, 0x946473e1 }; uint32_t E[] = { 0x00000001, 0x0e85e74f }; uint32_t M[] = { 0x00000001, 0x70754797 }; @@ -12,8 +292,8 @@ void autogenerated_BASIC_M4962768465676381896(void) { mod_exp_array(2, X, E, M, Z); assertArrayEquals(2, expected, Z); } -void autogenerated_BASIC_8982867242010371843(void) { - printf("=== autogenerated_BASIC_8982867242010371843 ===\n"); +void autogenerated_BASIC_33_8982867242010371843(void) { + printf("=== autogenerated_BASIC_33_8982867242010371843 ===\n"); uint32_t X[] = { 0x00000001, 0x6eb4ac2d }; uint32_t E[] = { 0x00000001, 0xbb200e41 }; uint32_t M[] = { 0x00000001, 0x27347dc3 }; @@ -22,8 +302,8 @@ void autogenerated_BASIC_8982867242010371843(void) { mod_exp_array(2, X, E, M, Z); assertArrayEquals(2, expected, Z); } -void autogenerated_BASIC_5090788032873075449(void) { - printf("=== autogenerated_BASIC_5090788032873075449 ===\n"); +void autogenerated_BASIC_33_5090788032873075449(void) { + printf("=== autogenerated_BASIC_33_5090788032873075449 ===\n"); uint32_t X[] = { 0x00000001, 0x9e504a03 }; uint32_t E[] = { 0x00000001, 0x9bc057ef }; uint32_t M[] = { 0x00000001, 0xc8b53fe5 }; @@ -32,8 +312,8 @@ void autogenerated_BASIC_5090788032873075449(void) { mod_exp_array(2, X, E, M, Z); assertArrayEquals(2, expected, Z); } -void autogenerated_BASIC_8448510918869952728(void) { - printf("=== autogenerated_BASIC_8448510918869952728 ===\n"); +void autogenerated_BASIC_33_8448510918869952728(void) { + printf("=== autogenerated_BASIC_33_8448510918869952728 ===\n"); uint32_t X[] = { 0x00000001, 0x73f7b309 }; uint32_t E[] = { 0x00000001, 0x91c10f7f }; uint32_t M[] = { 0x00000001, 0x4be322c9 }; @@ -42,8 +322,8 @@ void autogenerated_BASIC_8448510918869952728(void) { mod_exp_array(2, X, E, M, Z); assertArrayEquals(2, expected, Z); } -void autogenerated_BASIC_4036237668019554146(void) { - printf("=== autogenerated_BASIC_4036237668019554146 ===\n"); +void autogenerated_BASIC_33_4036237668019554146(void) { + printf("=== autogenerated_BASIC_33_4036237668019554146 ===\n"); uint32_t X[] = { 0x00000001, 0xd0f3961d }; uint32_t E[] = { 0x00000001, 0xcdbc9c9d }; uint32_t M[] = { 0x00000001, 0x30367d5b }; @@ -52,8 +332,8 @@ void autogenerated_BASIC_4036237668019554146(void) { mod_exp_array(2, X, E, M, Z); assertArrayEquals(2, expected, Z); } -void autogenerated_BASIC_M8925041444689012509(void) { - printf("=== autogenerated_BASIC_M8925041444689012509 ===\n"); +void autogenerated_BASIC_33_M8925041444689012509(void) { + printf("=== autogenerated_BASIC_33_M8925041444689012509 ===\n"); uint32_t X[] = { 0x00000001, 0x34130e17 }; uint32_t E[] = { 0x00000001, 0xf45e52c9 }; uint32_t M[] = { 0x00000001, 0x9cb5c68d }; @@ -62,8 +342,8 @@ void autogenerated_BASIC_M8925041444689012509(void) { mod_exp_array(2, X, E, M, Z); assertArrayEquals(2, expected, Z); } -void autogenerated_BASIC_M5713608137760059379(void) { - printf("=== autogenerated_BASIC_M5713608137760059379 ===\n"); +void autogenerated_BASIC_33_M5713608137760059379(void) { + printf("=== autogenerated_BASIC_33_M5713608137760059379 ===\n"); uint32_t X[] = { 0x00000001, 0x77505dbd }; uint32_t E[] = { 0x00000001, 0xdb808627 }; uint32_t M[] = { 0x00000001, 0xad1fed09 }; @@ -72,8 +352,8 @@ void autogenerated_BASIC_M5713608137760059379(void) { mod_exp_array(2, X, E, M, Z); assertArrayEquals(2, expected, Z); } -void autogenerated_BASIC_6816968587684568101(void) { - printf("=== autogenerated_BASIC_6816968587684568101 ===\n"); +void autogenerated_BASIC_33_6816968587684568101(void) { + printf("=== autogenerated_BASIC_33_6816968587684568101 ===\n"); uint32_t X[] = { 0x00000001, 0x3272b6ef }; uint32_t E[] = { 0x00000001, 0x2cb6c09b }; uint32_t M[] = { 0x00000001, 0xefbc64fd }; @@ -82,8 +362,8 @@ void autogenerated_BASIC_6816968587684568101(void) { mod_exp_array(2, X, E, M, Z); assertArrayEquals(2, expected, Z); } -void autogenerated_BASIC_4168013900853404774(void) { - printf("=== autogenerated_BASIC_4168013900853404774 ===\n"); +void autogenerated_BASIC_33_4168013900853404774(void) { + printf("=== autogenerated_BASIC_33_4168013900853404774 ===\n"); uint32_t X[] = { 0x00000001, 0x3c20bbcf }; uint32_t E[] = { 0x00000001, 0xa495d8ab }; uint32_t M[] = { 0x00000001, 0x75ddb9ef }; @@ -92,8 +372,8 @@ void autogenerated_BASIC_4168013900853404774(void) { mod_exp_array(2, X, E, M, Z); assertArrayEquals(2, expected, Z); } -void autogenerated_BASIC_M8394821325674331878(void) { - printf("=== autogenerated_BASIC_M8394821325674331878 ===\n"); +void autogenerated_BASIC_33_M8394821325674331878(void) { + printf("=== autogenerated_BASIC_33_M8394821325674331878 ===\n"); uint32_t X[] = { 0x00000001, 0x93d3d0d3 }; uint32_t E[] = { 0x00000001, 0x43c2dfef }; uint32_t M[] = { 0x00000001, 0x7443cbf1 }; @@ -102,8 +382,8 @@ void autogenerated_BASIC_M8394821325674331878(void) { mod_exp_array(2, X, E, M, Z); assertArrayEquals(2, expected, Z); } -void autogenerated_BASIC_M2919828800172604435(void) { - printf("=== autogenerated_BASIC_M2919828800172604435 ===\n"); +void autogenerated_BASIC_30_M2919828800172604435(void) { + printf("=== autogenerated_BASIC_30_M2919828800172604435 ===\n"); uint32_t X[] = { 0x3d746ec5 }; uint32_t E[] = { 0x3f7ea6d5 }; uint32_t M[] = { 0x29b6675f }; @@ -112,8 +392,8 @@ void autogenerated_BASIC_M2919828800172604435(void) { mod_exp_array(1, X, E, M, Z); assertArrayEquals(1, expected, Z); } -void autogenerated_BASIC_4770912732078070597(void) { - printf("=== autogenerated_BASIC_4770912732078070597 ===\n"); +void autogenerated_BASIC_30_4770912732078070597(void) { + printf("=== autogenerated_BASIC_30_4770912732078070597 ===\n"); uint32_t X[] = { 0x200c0f45 }; uint32_t E[] = { 0x24774bab }; uint32_t M[] = { 0x234ca073 }; @@ -122,8 +402,8 @@ void autogenerated_BASIC_4770912732078070597(void) { mod_exp_array(1, X, E, M, Z); assertArrayEquals(1, expected, Z); } -void autogenerated_BASIC_3593487472385409519(void) { - printf("=== autogenerated_BASIC_3593487472385409519 ===\n"); +void autogenerated_BASIC_30_3593487472385409519(void) { + printf("=== autogenerated_BASIC_30_3593487472385409519 ===\n"); uint32_t X[] = { 0x248819d1 }; uint32_t E[] = { 0x2ad2b6ed }; uint32_t M[] = { 0x269cc6bf }; @@ -132,8 +412,8 @@ void autogenerated_BASIC_3593487472385409519(void) { mod_exp_array(1, X, E, M, Z); assertArrayEquals(1, expected, Z); } -void autogenerated_BASIC_4981749054780354961(void) { - printf("=== autogenerated_BASIC_4981749054780354961 ===\n"); +void autogenerated_BASIC_30_4981749054780354961(void) { + printf("=== autogenerated_BASIC_30_4981749054780354961 ===\n"); uint32_t X[] = { 0x27bec4e7 }; uint32_t E[] = { 0x36fe540f }; uint32_t M[] = { 0x25a46d61 }; @@ -142,8 +422,8 @@ void autogenerated_BASIC_4981749054780354961(void) { mod_exp_array(1, X, E, M, Z); assertArrayEquals(1, expected, Z); } -void autogenerated_BASIC_7702189670289360961(void) { - printf("=== autogenerated_BASIC_7702189670289360961 ===\n"); +void autogenerated_BASIC_30_7702189670289360961(void) { + printf("=== autogenerated_BASIC_30_7702189670289360961 ===\n"); uint32_t X[] = { 0x302def29 }; uint32_t E[] = { 0x25b9c233 }; uint32_t M[] = { 0x33af5461 }; @@ -152,8 +432,8 @@ void autogenerated_BASIC_7702189670289360961(void) { mod_exp_array(1, X, E, M, Z); assertArrayEquals(1, expected, Z); } -void autogenerated_BASIC_M5169634701858105792(void) { - printf("=== autogenerated_BASIC_M5169634701858105792 ===\n"); +void autogenerated_BASIC_30_M5169634701858105792(void) { + printf("=== autogenerated_BASIC_30_M5169634701858105792 ===\n"); uint32_t X[] = { 0x240d8cf5 }; uint32_t E[] = { 0x2a6a7381 }; uint32_t M[] = { 0x3471d1e9 }; @@ -162,8 +442,8 @@ void autogenerated_BASIC_M5169634701858105792(void) { mod_exp_array(1, X, E, M, Z); assertArrayEquals(1, expected, Z); } -void autogenerated_BASIC_6469444563916025786(void) { - printf("=== autogenerated_BASIC_6469444563916025786 ===\n"); +void autogenerated_BASIC_30_6469444563916025786(void) { + printf("=== autogenerated_BASIC_30_6469444563916025786 ===\n"); uint32_t X[] = { 0x3cc9270b }; uint32_t E[] = { 0x27858fdd }; uint32_t M[] = { 0x21e65001 }; @@ -172,8 +452,8 @@ void autogenerated_BASIC_6469444563916025786(void) { mod_exp_array(1, X, E, M, Z); assertArrayEquals(1, expected, Z); } -void autogenerated_BASIC_M2453278165832221565(void) { - printf("=== autogenerated_BASIC_M2453278165832221565 ===\n"); +void autogenerated_BASIC_30_M2453278165832221565(void) { + printf("=== autogenerated_BASIC_30_M2453278165832221565 ===\n"); uint32_t X[] = { 0x30ca6ceb }; uint32_t E[] = { 0x212c387b }; uint32_t M[] = { 0x2e07a7bb }; @@ -182,8 +462,8 @@ void autogenerated_BASIC_M2453278165832221565(void) { mod_exp_array(1, X, E, M, Z); assertArrayEquals(1, expected, Z); } -void autogenerated_BASIC_M1847183855567461116(void) { - printf("=== autogenerated_BASIC_M1847183855567461116 ===\n"); +void autogenerated_BASIC_30_M1847183855567461116(void) { + printf("=== autogenerated_BASIC_30_M1847183855567461116 ===\n"); uint32_t X[] = { 0x3d02c5a1 }; uint32_t E[] = { 0x35f12b45 }; uint32_t M[] = { 0x32f0b03f }; @@ -192,8 +472,8 @@ void autogenerated_BASIC_M1847183855567461116(void) { mod_exp_array(1, X, E, M, Z); assertArrayEquals(1, expected, Z); } -void autogenerated_BASIC_M7037130911981370263(void) { - printf("=== autogenerated_BASIC_M7037130911981370263 ===\n"); +void autogenerated_BASIC_30_M7037130911981370263(void) { + printf("=== autogenerated_BASIC_30_M7037130911981370263 ===\n"); uint32_t X[] = { 0x2692d1cd }; uint32_t E[] = { 0x3b21ef8d }; uint32_t M[] = { 0x2042c76d }; @@ -202,8 +482,8 @@ void autogenerated_BASIC_M7037130911981370263(void) { mod_exp_array(1, X, E, M, Z); assertArrayEquals(1, expected, Z); } -void autogenerated_BASIC_5073338267670769216(void) { - printf("=== autogenerated_BASIC_5073338267670769216 ===\n"); +void autogenerated_BASIC_126_5073338267670769216(void) { + printf("=== autogenerated_BASIC_126_5073338267670769216 ===\n"); uint32_t X[] = { 0x3028983f, 0xdc9bdc25, 0xa3fdfeda, 0x283f4463 }; uint32_t E[] = { 0x29493211, 0xc4252db0, 0x7775443d, 0x13e1d929 }; uint32_t M[] = { 0x2fb9ba2f, 0xa485d5f7, 0x3c6652c9, 0x670fdbfd }; @@ -212,8 +492,8 @@ void autogenerated_BASIC_5073338267670769216(void) { mod_exp_array(4, X, E, M, Z); assertArrayEquals(4, expected, Z); } -void autogenerated_BASIC_M1841989679506188752(void) { - printf("=== autogenerated_BASIC_M1841989679506188752 ===\n"); +void autogenerated_BASIC_126_M1841989679506188752(void) { + printf("=== autogenerated_BASIC_126_M1841989679506188752 ===\n"); uint32_t X[] = { 0x29462882, 0x12caa2d5, 0xb80e1c66, 0x1006807f }; uint32_t E[] = { 0x3285c343, 0x2acbcb0f, 0x4d023228, 0x2ecc73db }; uint32_t M[] = { 0x267d2f2e, 0x51c216a7, 0xda752ead, 0x48d22d89 }; @@ -222,8 +502,8 @@ void autogenerated_BASIC_M1841989679506188752(void) { mod_exp_array(4, X, E, M, Z); assertArrayEquals(4, expected, Z); } -void autogenerated_BASIC_M3339729654500648482(void) { - printf("=== autogenerated_BASIC_M3339729654500648482 ===\n"); +void autogenerated_BASIC_126_M3339729654500648482(void) { + printf("=== autogenerated_BASIC_126_M3339729654500648482 ===\n"); uint32_t X[] = { 0x2963efb9, 0xc6f5d260, 0xa2d0fe74, 0x49726b57 }; uint32_t E[] = { 0x2f55c103, 0xbace4bf1, 0x2ab9fac2, 0x30aec7d3 }; uint32_t M[] = { 0x376cf9ae, 0xd9e988e8, 0xbd995f5c, 0xdeec42f5 }; @@ -232,8 +512,8 @@ void autogenerated_BASIC_M3339729654500648482(void) { mod_exp_array(4, X, E, M, Z); assertArrayEquals(4, expected, Z); } -void autogenerated_BASIC_M6837928193394880512(void) { - printf("=== autogenerated_BASIC_M6837928193394880512 ===\n"); +void autogenerated_BASIC_126_M6837928193394880512(void) { + printf("=== autogenerated_BASIC_126_M6837928193394880512 ===\n"); uint32_t X[] = { 0x2a9283cc, 0x5999f49d, 0xf8cf6ab2, 0x5f47bf25 }; uint32_t E[] = { 0x2c7564a0, 0x2d1fcda1, 0x2825318a, 0xae23c271 }; uint32_t M[] = { 0x32b892f9, 0x096c5ada, 0x43918370, 0x8398c7e3 }; @@ -242,8 +522,8 @@ void autogenerated_BASIC_M6837928193394880512(void) { mod_exp_array(4, X, E, M, Z); assertArrayEquals(4, expected, Z); } -void autogenerated_BASIC_M7333111649825079555(void) { - printf("=== autogenerated_BASIC_M7333111649825079555 ===\n"); +void autogenerated_BASIC_126_M7333111649825079555(void) { + printf("=== autogenerated_BASIC_126_M7333111649825079555 ===\n"); uint32_t X[] = { 0x246fa2ec, 0x405f234d, 0x39b93e77, 0xf16bcc91 }; uint32_t E[] = { 0x2807eb7a, 0x646df633, 0xeaa95a21, 0x85252adf }; uint32_t M[] = { 0x2cdd3307, 0x782e5711, 0x584f179b, 0x011087df }; @@ -252,8 +532,8 @@ void autogenerated_BASIC_M7333111649825079555(void) { mod_exp_array(4, X, E, M, Z); assertArrayEquals(4, expected, Z); } -void autogenerated_BASIC_480186175131589607(void) { - printf("=== autogenerated_BASIC_480186175131589607 ===\n"); +void autogenerated_BASIC_126_480186175131589607(void) { + printf("=== autogenerated_BASIC_126_480186175131589607 ===\n"); uint32_t X[] = { 0x300a5cf7, 0x269f6369, 0x02e025cb, 0xaf16fcfd }; uint32_t E[] = { 0x2cc4b1c0, 0x9205a8b4, 0xbc130ee2, 0x923f1f3f }; uint32_t M[] = { 0x2cd376d5, 0xd9e3b080, 0x2533288a, 0xd4b9bb37 }; @@ -262,8 +542,8 @@ void autogenerated_BASIC_480186175131589607(void) { mod_exp_array(4, X, E, M, Z); assertArrayEquals(4, expected, Z); } -void autogenerated_BASIC_M5239159917778665002(void) { - printf("=== autogenerated_BASIC_M5239159917778665002 ===\n"); +void autogenerated_BASIC_126_M5239159917778665002(void) { + printf("=== autogenerated_BASIC_126_M5239159917778665002 ===\n"); uint32_t X[] = { 0x3eaed5af, 0xa287db7e, 0x4ff07fee, 0x9bbda80b }; uint32_t E[] = { 0x3c077d49, 0xf3a131ab, 0x6289042a, 0xc15083cb }; uint32_t M[] = { 0x344b8538, 0xcf4f2576, 0xd28c1c52, 0xc83a8199 }; @@ -272,8 +552,8 @@ void autogenerated_BASIC_M5239159917778665002(void) { mod_exp_array(4, X, E, M, Z); assertArrayEquals(4, expected, Z); } -void autogenerated_BASIC_228752064885223799(void) { - printf("=== autogenerated_BASIC_228752064885223799 ===\n"); +void autogenerated_BASIC_126_228752064885223799(void) { + printf("=== autogenerated_BASIC_126_228752064885223799 ===\n"); uint32_t X[] = { 0x3904d7ab, 0x13937a4f, 0x926856d1, 0x6bdda621 }; uint32_t E[] = { 0x3d360083, 0xa50eaf0e, 0xffce2df2, 0xb1f51cef }; uint32_t M[] = { 0x2d32376f, 0x205555b3, 0x2c9daf8c, 0xe2b7cf81 }; @@ -282,8 +562,8 @@ void autogenerated_BASIC_228752064885223799(void) { mod_exp_array(4, X, E, M, Z); assertArrayEquals(4, expected, Z); } -void autogenerated_BASIC_856940511857911599(void) { - printf("=== autogenerated_BASIC_856940511857911599 ===\n"); +void autogenerated_BASIC_126_856940511857911599(void) { + printf("=== autogenerated_BASIC_126_856940511857911599 ===\n"); uint32_t X[] = { 0x23e80223, 0x52b700ee, 0x6cb8a294, 0x47c6fac9 }; uint32_t E[] = { 0x253cebdb, 0xcc78dcb4, 0x925682b3, 0x490c424b }; uint32_t M[] = { 0x2f2885eb, 0x67987cee, 0x717298bd, 0x7a1baf7b }; @@ -292,8 +572,8 @@ void autogenerated_BASIC_856940511857911599(void) { mod_exp_array(4, X, E, M, Z); assertArrayEquals(4, expected, Z); } -void autogenerated_BASIC_M6501553661140603953(void) { - printf("=== autogenerated_BASIC_M6501553661140603953 ===\n"); +void autogenerated_BASIC_126_M6501553661140603953(void) { + printf("=== autogenerated_BASIC_126_M6501553661140603953 ===\n"); uint32_t X[] = { 0x287e9711, 0x4d346dab, 0x3ff5e6da, 0xa93edebd }; uint32_t E[] = { 0x3658192a, 0x4b5fac3f, 0x9a78bc81, 0x5ac8c667 }; uint32_t M[] = { 0x238cd95d, 0x298ee5e1, 0x320323da, 0x0a46ec21 }; @@ -302,8 +582,8 @@ void autogenerated_BASIC_M6501553661140603953(void) { mod_exp_array(4, X, E, M, Z); assertArrayEquals(4, expected, Z); } -void autogenerated_BASIC_M8496483018338900149(void) { - printf("=== autogenerated_BASIC_M8496483018338900149 ===\n"); +void autogenerated_BASIC_510_M8496483018338900149(void) { + printf("=== autogenerated_BASIC_510_M8496483018338900149 ===\n"); uint32_t X[] = { 0x3b4511d5, 0x5f61da31, 0x4bf252e0, 0x3962f93c, 0x590171d0, 0xda31097f, 0x0f73fee3, 0x0ba1b379, 0x514b7d8f, 0x1e337cf9, 0x733512ac, 0x4f5b0b52, 0x40762697, 0xb3a30c84, 0x5563b4db, 0x59f7cef1 }; uint32_t E[] = { 0x271cb7c4, 0x11f07a63, 0x1df850e7, 0x8bf6df66, 0x7bc8fa0e, 0xa51002ce, 0xf16946c5, 0x96916dc7, 0xba1681b1, 0x5ca395ab, 0x7839780d, 0xc5e760c3, 0x578af4f9, 0xffbbbd8c, 0x8576c8fc, 0x518012a7 }; uint32_t M[] = { 0x3c0f154d, 0x7fc7750a, 0x03eb8968, 0xfbde501a, 0x63848fe5, 0xdcd7d883, 0x5131c9f9, 0xa9ca3399, 0xba581205, 0x4cf86f2a, 0xed928b92, 0x13a0e90f, 0x5b24c81a, 0xf4ac077c, 0x68b8ac70, 0xc58961fd }; @@ -312,8 +592,8 @@ void autogenerated_BASIC_M8496483018338900149(void) { mod_exp_array(16, X, E, M, Z); assertArrayEquals(16, expected, Z); } -void autogenerated_BASIC_6145567102166328515(void) { - printf("=== autogenerated_BASIC_6145567102166328515 ===\n"); +void autogenerated_BASIC_510_6145567102166328515(void) { + printf("=== autogenerated_BASIC_510_6145567102166328515 ===\n"); uint32_t X[] = { 0x23446522, 0x9185c81e, 0x09283a50, 0x82c1f517, 0xd00d3159, 0x846c2c99, 0x261d1dcb, 0xde183d66, 0x98f8a990, 0xd295bd50, 0x09ef8644, 0xadcf9cdb, 0x5eec13a3, 0x92baa627, 0x18caa215, 0x8836480f }; uint32_t E[] = { 0x397f2b38, 0xa95cc0bc, 0xc13b26cf, 0xa20dda3c, 0xf8801c39, 0x00731abe, 0x2ad0afc4, 0xdb247141, 0xc29b5a2d, 0x9e51a3ed, 0xcf364a51, 0x90b761d5, 0xfa0624d3, 0x3a0b27c7, 0xa36bc66c, 0x6423efd3 }; uint32_t M[] = { 0x3ad2464f, 0x75da362c, 0x6e5c37b4, 0x432cc6b7, 0x6f48b57c, 0xebb87e14, 0x0a3d3f4d, 0xfa4c32c0, 0x165a5892, 0x742f720d, 0x8b4e1b43, 0x281d5390, 0xff2f77dc, 0x698dbc05, 0xdee97a68, 0xde2c176d }; @@ -322,8 +602,8 @@ void autogenerated_BASIC_6145567102166328515(void) { mod_exp_array(16, X, E, M, Z); assertArrayEquals(16, expected, Z); } -void autogenerated_BASIC_7216348574014690328(void) { - printf("=== autogenerated_BASIC_7216348574014690328 ===\n"); +void autogenerated_BASIC_1022_7216348574014690328(void) { + printf("=== autogenerated_BASIC_1022_7216348574014690328 ===\n"); uint32_t X[] = { 0x35baa860, 0x4e47ad49, 0xc6c4a7c0, 0x7857335b, 0x9b81d24f, 0x7be86e34, 0xf84f7560, 0x484b20db, 0xb83b4f9e, 0x694c6987, 0x7d3232f5, 0x18ee8603, 0x94eca5ef, 0x5179ef69, 0xf6600efb, 0xfc71deab, 0xdb939552, 0x642db1e0, 0x78e11e39, 0x924f0dbd, 0xdb225803, 0x449bbb35, 0xfc40ee05, 0x9b19931c, 0x8b8af884, 0xb5f96476, 0xf97ad419, 0xcc7543f9, 0xce25ed83, 0x94da3499, 0x4f37f331, 0xe64e7799 }; uint32_t E[] = { 0x3a7570f2, 0x38cb0f2f, 0x2e6c8989, 0xcf7c2665, 0xa0fce3d0, 0x12c7a8eb, 0x40fab1ea, 0x39eb4809, 0x822fa6cc, 0x4ef9d604, 0x2ca1cd3b, 0xa9b23cdb, 0x17e823ce, 0x5fea5198, 0x1ab12946, 0xcec748b5, 0x752a3a6f, 0x73421a9a, 0x7138d7a4, 0xa47327c0, 0x17475543, 0xe841c19a, 0x3085410a, 0x06438b4c, 0xe0d4b918, 0xfeccca17, 0x9ed86072, 0x86db4a93, 0x60c7d437, 0xcdfe77e3, 0x2631f264, 0x80c9b645 }; uint32_t M[] = { 0x34d90901, 0xf192009c, 0xc34f345f, 0x63f592b2, 0xaba32d7a, 0x161d1510, 0x2c264dec, 0x07306f1d, 0x3e61c031, 0xacd4eba0, 0xff1318ff, 0x09a78cf4, 0x97bace67, 0xc8fcecf4, 0x3b3901a3, 0x5d447957, 0xc0397708, 0x7e7e48f9, 0x571db58a, 0x80d65921, 0x68a025e0, 0x4f85f776, 0xaa8450c7, 0x15c42f52, 0xe65507f2, 0xdfeed660, 0x0db8eddb, 0xb1e48d93, 0x7e314a2f, 0xea81ccb1, 0xbe22cc03, 0xf2928621 }; @@ -332,8 +612,8 @@ void autogenerated_BASIC_7216348574014690328(void) { mod_exp_array(32, X, E, M, Z); assertArrayEquals(32, expected, Z); } -void autogenerated_BASIC_M5663191947183200100(void) { - printf("=== autogenerated_BASIC_M5663191947183200100 ===\n"); +void autogenerated_BASIC_2046_M5663191947183200100(void) { + printf("=== autogenerated_BASIC_2046_M5663191947183200100 ===\n"); uint32_t X[] = { 0x21558179, 0x3e2914b1, 0xefe95957, 0x965fdead, 0xe766d8fc, 0x136eadf4, 0xa6106a2a, 0x88b2df7e, 0xe0b0eaae, 0x2c17946a, 0x6f5b5563, 0x228052ae, 0x7fc40d80, 0xf81354db, 0xfceecd1a, 0xa5e4c97d, 0x433ecfcd, 0xc20d1e4d, 0x2a748fe3, 0x1d9e63f0, 0xdc6c25d6, 0xdae5c8be, 0x1d8c5431, 0xb1d7d270, 0xed5b2566, 0x1463b0fd, 0xa9e26cf7, 0x3dd6fbd7, 0x1347c8f7, 0x76c2cc37, 0xf382b786, 0x1d5ac517, 0x26b96692, 0x2c1fe6f8, 0x5852dbf8, 0x4bcabda2, 0xbedb2f5f, 0xbfe58158, 0x8cd5d15f, 0xac7c7f4c, 0xf8ba47d2, 0x86c6571d, 0x06a4760b, 0xa6afa0e1, 0x7a819f62, 0x5cdbfe15, 0x9b2d10b5, 0xf508b1fd, 0xb3f0462a, 0x92f45a64, 0x69b6ec58, 0xbfad8fab, 0x6799260f, 0x27415db5, 0xf6ac7832, 0xe547826d, 0x6a9806a5, 0x36c62a88, 0x98bee14d, 0x9b8c2648, 0xabdbbd3d, 0xaf59eea1, 0x164eacb5, 0x3a18e427 }; uint32_t E[] = { 0x2519837b, 0xe73a9031, 0xe241606d, 0x21e70fa2, 0x7881f254, 0x4e60831d, 0x266f408e, 0x4a83e6ed, 0xa7741995, 0x32b477ba, 0x91bdf5d0, 0x4acd7a06, 0x51e344b9, 0xdf376e4e, 0x8494e625, 0xa0cc9697, 0x817a0c93, 0x3b68cefb, 0x46de14c1, 0x52229965, 0x329645bd, 0xf4176adc, 0x29a8bc50, 0x44900fec, 0x1558d492, 0xf838a8e7, 0xea207abd, 0xcd21a28c, 0x91e6b02f, 0x2a490ea8, 0x5d99663b, 0x87c92fb6, 0x0a185325, 0x5256a7a3, 0x496b7288, 0x6688b6c8, 0x650e1776, 0x54cd429f, 0x90ea3b18, 0x0b72ae61, 0xcc8651b3, 0xa488742d, 0x93c401ef, 0x5a2220ff, 0xaee1f257, 0xf9d1e29a, 0xd47151fe, 0x4978342b, 0x0927048a, 0x404b0689, 0xdc9df8cc, 0xfba9845f, 0xeb8a39b0, 0xd3f24ae2, 0x5ea9ca0a, 0x0c064f94, 0x35368ae2, 0xeab6c035, 0x9baa39c6, 0x2ef6259d, 0xa2577555, 0x514c7d98, 0x0890d44f, 0xf416fbdd }; uint32_t M[] = { 0x2c5337a9, 0x3f2e1ca6, 0x91de65ea, 0xc3f9a3c2, 0xdc9099e0, 0x64ebe412, 0xf4583fae, 0x1fc8e8dd, 0x92dcbbfb, 0x9159239e, 0xdbbec456, 0x8735a660, 0x8248dbbc, 0x76f01415, 0x3cb8a897, 0x7cc09280, 0x6cc6db51, 0x9c2544da, 0x316564ce, 0x4b6d9b3b, 0x3e0e123f, 0x942a4a3c, 0x1f128873, 0x5ad14862, 0xdde8e6dd, 0x73da31fb, 0x1a8a2046, 0xc3ff18c6, 0x24e31d54, 0x7d8a1796, 0x88ab346c, 0x262bb321, 0x2cada5dc, 0x1fb2284c, 0x042375fd, 0xba10d309, 0xcda978ec, 0x229ee156, 0x8470728a, 0xa58017fd, 0x65727801, 0x1ea396a6, 0xbd9a4bc1, 0x8e97c08f, 0xd7529796, 0x2c8339e9, 0xc5340a83, 0x6f7d1f9c, 0xd6014fec, 0xdffa2265, 0xfa9906a9, 0xafbd424a, 0x631994ae, 0x73a9b3f1, 0x2284f999, 0x6f8c87f6, 0x93136a66, 0x47c81e45, 0xd35f0e41, 0x238d6960, 0x96cf337d, 0x8865e4cc, 0x15039c40, 0x65ee7211 }; @@ -343,39 +623,67 @@ void autogenerated_BASIC_M5663191947183200100(void) { assertArrayEquals(64, expected, Z); } void autogenerated_tests(void) { - autogenerated_BASIC_M4962768465676381896(); - autogenerated_BASIC_8982867242010371843(); - autogenerated_BASIC_5090788032873075449(); - autogenerated_BASIC_8448510918869952728(); - autogenerated_BASIC_4036237668019554146(); - autogenerated_BASIC_M8925041444689012509(); - autogenerated_BASIC_M5713608137760059379(); - autogenerated_BASIC_6816968587684568101(); - autogenerated_BASIC_4168013900853404774(); - autogenerated_BASIC_M8394821325674331878(); - autogenerated_BASIC_M2919828800172604435(); - autogenerated_BASIC_4770912732078070597(); - autogenerated_BASIC_3593487472385409519(); - autogenerated_BASIC_4981749054780354961(); - autogenerated_BASIC_7702189670289360961(); - autogenerated_BASIC_M5169634701858105792(); - autogenerated_BASIC_6469444563916025786(); - autogenerated_BASIC_M2453278165832221565(); - autogenerated_BASIC_M1847183855567461116(); - autogenerated_BASIC_M7037130911981370263(); - autogenerated_BASIC_5073338267670769216(); - autogenerated_BASIC_M1841989679506188752(); - autogenerated_BASIC_M3339729654500648482(); - autogenerated_BASIC_M6837928193394880512(); - autogenerated_BASIC_M7333111649825079555(); - autogenerated_BASIC_480186175131589607(); - autogenerated_BASIC_M5239159917778665002(); - autogenerated_BASIC_228752064885223799(); - autogenerated_BASIC_856940511857911599(); - autogenerated_BASIC_M6501553661140603953(); - autogenerated_BASIC_M8496483018338900149(); - autogenerated_BASIC_6145567102166328515(); - autogenerated_BASIC_7216348574014690328(); - autogenerated_BASIC_M5663191947183200100(); + autogenerated_RSA_ENCRYPT_2x64_M4962768465676381896(); + autogenerated_RSA_DECRYPT_2x64_M4962768465676381896(); + autogenerated_RSA_ENCRYPT_2x128_M6062092045291406770(); + autogenerated_RSA_DECRYPT_2x128_M6062092045291406770(); + autogenerated_RSA_ENCRYPT_2x256_M5994408293843538622(); + autogenerated_RSA_DECRYPT_2x256_M5994408293843538622(); + autogenerated_RSA_ENCRYPT_2x512_4990200181210089783(); + autogenerated_RSA_DECRYPT_2x512_4990200181210089783(); + autogenerated_RSA_ENCRYPT_2x1024_M6518700023368260482(); + autogenerated_RSA_DECRYPT_2x1024_M6518700023368260482(); + autogenerated_65537_64_M4962768465676381896(); + autogenerated_65537_64_M5159275287763741611(); + autogenerated_65537_64_3760534544499724252(); + autogenerated_65537_128_3878376283807279832(); + autogenerated_65537_128_5594822731491506219(); + autogenerated_65537_128_769311575533169616(); + autogenerated_65537_256_7584111717683545699(); + autogenerated_65537_256_M3116426901380202388(); + autogenerated_65537_256_1049687409305378688(); + autogenerated_65537_512_7440167874398799474(); + autogenerated_65537_512_6048688486258747650(); + autogenerated_65537_512_M3689965194811981076(); + autogenerated_65537_1024_M5783369654979853500(); + autogenerated_65537_1024_5690344643830992838(); + autogenerated_65537_1024_2419688117908792423(); + autogenerated_65537_2048_M4113938405113783334(); + autogenerated_65537_2048_1028944263296872045(); + autogenerated_65537_2048_M4248726279996728686(); + autogenerated_BASIC_33_M4962768465676381896(); + autogenerated_BASIC_33_8982867242010371843(); + autogenerated_BASIC_33_5090788032873075449(); + autogenerated_BASIC_33_8448510918869952728(); + autogenerated_BASIC_33_4036237668019554146(); + autogenerated_BASIC_33_M8925041444689012509(); + autogenerated_BASIC_33_M5713608137760059379(); + autogenerated_BASIC_33_6816968587684568101(); + autogenerated_BASIC_33_4168013900853404774(); + autogenerated_BASIC_33_M8394821325674331878(); + autogenerated_BASIC_30_M2919828800172604435(); + autogenerated_BASIC_30_4770912732078070597(); + autogenerated_BASIC_30_3593487472385409519(); + autogenerated_BASIC_30_4981749054780354961(); + autogenerated_BASIC_30_7702189670289360961(); + autogenerated_BASIC_30_M5169634701858105792(); + autogenerated_BASIC_30_6469444563916025786(); + autogenerated_BASIC_30_M2453278165832221565(); + autogenerated_BASIC_30_M1847183855567461116(); + autogenerated_BASIC_30_M7037130911981370263(); + autogenerated_BASIC_126_5073338267670769216(); + autogenerated_BASIC_126_M1841989679506188752(); + autogenerated_BASIC_126_M3339729654500648482(); + autogenerated_BASIC_126_M6837928193394880512(); + autogenerated_BASIC_126_M7333111649825079555(); + autogenerated_BASIC_126_480186175131589607(); + autogenerated_BASIC_126_M5239159917778665002(); + autogenerated_BASIC_126_228752064885223799(); + autogenerated_BASIC_126_856940511857911599(); + autogenerated_BASIC_126_M6501553661140603953(); + autogenerated_BASIC_510_M8496483018338900149(); + autogenerated_BASIC_510_6145567102166328515(); + autogenerated_BASIC_1022_7216348574014690328(); + autogenerated_BASIC_2046_M5663191947183200100(); } diff --git a/src/model/c/src/bignum_uint32_t.c b/src/model/c/src/bignum_uint32_t.c index c40b538..8dcadd7 100644 --- a/src/model/c/src/bignum_uint32_t.c +++ b/src/model/c/src/bignum_uint32_t.c @@ -2,6 +2,8 @@ #include <stdlib.h> #include "bignum_uint32_t.h" +int assert_array_total = 0; +int assert_array_error = 0; void assertArrayEquals(uint32_t length, uint32_t *expected, uint32_t *actual) { //needed in tests int equals = 1; for (uint32_t i = 0; i < length; i++) @@ -13,6 +15,13 @@ void assertArrayEquals(uint32_t length, uint32_t *expected, uint32_t *actual) { for (uint32_t i = 0; i < length - 1; i++) printf("%8x, ", actual[i]); printf("%8x]\n", actual[length - 1]); + assert_array_total++; + if (!equals) + assert_array_error++; +} + +void print_assert_array_stats(void) { + printf("%d tests, failed: %d\n", assert_array_total, assert_array_error); } void copy_array(uint32_t length, uint32_t *src, uint32_t *dst) { diff --git a/src/model/c/src/bignum_uint32_t.h b/src/model/c/src/bignum_uint32_t.h index e275fc4..bccd345 100644 --- a/src/model/c/src/bignum_uint32_t.h +++ b/src/model/c/src/bignum_uint32_t.h @@ -19,5 +19,6 @@ void zero_array(uint32_t length, uint32_t *a); void copy_array(uint32_t length, uint32_t *src, uint32_t *dst); void debugArray(char *msg, uint32_t length, uint32_t *array); void assertArrayEquals(uint32_t length, uint32_t *expected, uint32_t *actual); +void print_assert_array_stats(void); #endif /* BIGNUM_UINT32_T_H_ */ diff --git a/src/model/c/src/montgomery_array.c b/src/model/c/src/montgomery_array.c index c3579a9..259dcff 100644 --- a/src/model/c/src/montgomery_array.c +++ b/src/model/c/src/montgomery_array.c @@ -102,6 +102,53 @@ void mont_exp_array(uint32_t length, uint32_t *X, uint32_t *E, uint32_t *M, } +// Experimental version where we add explicit lengths. +void mont_exp_array2(uint32_t explength, uint32_t modlength, uint32_t *X, uint32_t *E, uint32_t *M, + uint32_t *Nr, uint32_t *P, uint32_t *ONE, uint32_t *temp, + uint32_t *temp2, uint32_t *Z) { + //debugArray("X ", length, X); + //debugArray("E ", length, E); + //debugArray("M ", length, M); + + // 1. Nr := 2 ** 2N mod M + const uint32_t N = 32 * modlength; + m_residue_2_2N_array(modlength, N, M, temp, Nr); + //debugArray("Nr", length, Nr); + + // 2. Z0 := MontProd( 1, Nr, M ) + zero_array(modlength, ONE); + ONE[modlength - 1] = 1; + mont_prod_array(modlength, ONE, Nr, M, Z); + //debugArray("Z0", length, Z); + + // 3. P0 := MontProd( X, Nr, M ); + mont_prod_array(modlength, X, Nr, M, P); + //debugArray("P0", length, P); + + // 4. for i = 0 to explength - 1 loop + for (uint32_t i = 0; i < (explength * 32); i++) { + uint32_t ei_ = E[explength - 1 - (i / 32)]; + uint32_t ei = (ei_ >> (i % 32)) & 1; + // 6. if (ei = 1) then Zi+1 := MontProd ( Zi, Pi, M) else Zi+1 := Zi + if (ei == 1) { + mont_prod_array(modlength, Z, P, M, temp2); + copy_array(modlength, temp2, Z); + //debugArray("Z ", length, Z); + } + // 5. Pi+1 := MontProd( Pi, Pi, M ); + mont_prod_array(modlength, P, P, M, temp2); + copy_array(modlength, temp2, P); + //debugArray("P ", length, P); + // 7. end for + } + // 8. Zn := MontProd( 1, Zn, M ); + mont_prod_array(modlength, ONE, Z, M, temp2); + copy_array(modlength, temp2, Z); + //debugArray("Z ", length, Z); + // 9. RETURN Zn + +} + void die(const char *c) { printf("Fatal error: %s\n", c); exit(1); @@ -125,3 +172,23 @@ void mod_exp_array(uint32_t length, uint32_t *X, uint32_t *E, uint32_t *M, uint3 free(temp); free(temp2); } + +// Experimental version with explicit explength separate from modlength. +void mod_exp_array2(uint32_t explength, uint32_t modlength, uint32_t *X, uint32_t *E, uint32_t *M, uint32_t *Z) { + uint32_t *Nr = calloc(modlength, sizeof(uint32_t)); + uint32_t *P = calloc(modlength, sizeof(uint32_t)); + uint32_t *ONE = calloc(modlength, sizeof(uint32_t)); + uint32_t *temp = calloc(modlength, sizeof(uint32_t)); + uint32_t *temp2 = calloc(modlength, sizeof(uint32_t)); + if (Nr == NULL) die("calloc"); + if (P == NULL) die("calloc"); + if (ONE == NULL) die("calloc"); + if (temp == NULL) die("calloc"); + if (temp2 == NULL) die("calloc"); + mont_exp_array2(explength, modlength, X, E, M, Nr, P, ONE, temp, temp2, Z); + free(Nr); + free(P); + free(ONE); + free(temp); + free(temp2); +} diff --git a/src/model/c/src/montgomery_array.h b/src/model/c/src/montgomery_array.h index 984bc07..48f0f39 100644 --- a/src/model/c/src/montgomery_array.h +++ b/src/model/c/src/montgomery_array.h @@ -12,4 +12,10 @@ void mont_prod_array(uint32_t length, uint32_t *A, uint32_t *B, uint32_t *M, uint32_t *s); void mod_exp_array(uint32_t length, uint32_t *X, uint32_t *E, uint32_t *M, uint32_t *Z); + +void mont_prod_array2(uint32_t explength, uint32_t modlength, uint32_t *A, uint32_t *B, uint32_t *M, + uint32_t *s); + +void mod_exp_array2(uint32_t explength, uint32_t modlength, uint32_t *X, uint32_t *E, uint32_t *M, uint32_t *Z); + #endif /* MONTGOMERY_ARRAY_H_ */ diff --git a/src/model/c/src/simple_tests.c b/src/model/c/src/simple_tests.c index 402a8ac..54f7a67 100644 --- a/src/model/c/src/simple_tests.c +++ b/src/model/c/src/simple_tests.c @@ -62,9 +62,61 @@ void simple_251_251_257(void) { assertArrayEquals(1, expected, Z); } + +void small_e_256_mod(void) { + printf("=== Simple test with small, implicit e ===\n"); + uint32_t X[] = {0x00000000, 0xbd589a51, 0x2ba97013, + 0xc4736649, 0xe233fd5c, 0x39fcc5e5, + 0x2d60b324, 0x1112f2d0, 0x1177c62b}; + uint32_t E[] = {0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00010001}; + + uint32_t M[] = {0x00000000, 0xf169d36e, 0xbe2ce61d, + 0xc2e87809, 0x4fed15c3, 0x7c70eac5, + 0xa123e643, 0x299b36d2, 0x788e583b }; + + uint32_t expected[] = {0x00000000, 0x7c5f0fee, 0x73028fc5, + 0xc4fe57c4, 0x91a6f5be, 0x33a5c174, + 0x2d2c2bcd, 0xda80e7d6, 0xfb4c889f}; + + uint32_t Z[] = {0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000}; + + mod_exp_array(9, X, E, M, Z); + assertArrayEquals(9, expected, Z); +} + +void small_e_256_mod2(void) { + printf("=== Simple test with explicit e ===\n"); + uint32_t X[] = {0x00000000, 0xbd589a51, 0x2ba97013, + 0xc4736649, 0xe233fd5c, 0x39fcc5e5, + 0x2d60b324, 0x1112f2d0, 0x1177c62b}; + uint32_t E[] = {0x00010001}; + + uint32_t M[] = {0x00000000, 0xf169d36e, 0xbe2ce61d, + 0xc2e87809, 0x4fed15c3, 0x7c70eac5, + 0xa123e643, 0x299b36d2, 0x788e583b }; + + uint32_t expected[] = {0x00000000, 0x7c5f0fee, 0x73028fc5, + 0xc4fe57c4, 0x91a6f5be, 0x33a5c174, + 0x2d2c2bcd, 0xda80e7d6, 0xfb4c889f}; + + uint32_t Z[] = {0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000}; + + mod_exp_array2(1, 9, X, E, M, Z); + assertArrayEquals(9, expected, Z); +} + + void simple_tests(void) { simple_3_7_11(); simple_251_251_257(); + small_e_256_mod(); + small_e_256_mod2(); } //====================================================================== |