aboutsummaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/modexp_tester.c184
1 files changed, 184 insertions, 0 deletions
diff --git a/sw/modexp_tester.c b/sw/modexp_tester.c
index 2389640..c9b9a80 100644
--- a/sw/modexp_tester.c
+++ b/sw/modexp_tester.c
@@ -512,6 +512,188 @@ static void tc7()
//------------------------------------------------------------------
+// tc8()
+//
+// Testcase with 2048 bit operands.
+//------------------------------------------------------------------
+static void tc8()
+{
+ uint32_t message[] = {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 exponent[] = {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 modulus[] = {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 };
+ uint8_t result;
+
+ printf("Running TC8: 2048 bit operands.s\n");
+
+ result = testrunner(65, exponent, 65, modulus, message, expected);
+
+ if (result)
+ printf("TC8: OK\n");
+ else
+ printf("TC8: NOT OK\n");
+}
+
+
+//------------------------------------------------------------------
+// tc9()
+//
+// Testcase with 2048 bit operands.
+//------------------------------------------------------------------
+static void tc9()
+{
+ uint32_t message[] = {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 exponent[] = {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 modulus[] = {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};
+
+
+ uint32_t expected[] = {0x24665860, 0x4b150493, 0xc0834602, 0xc0b99ab5,
+ 0xbe649545, 0xa7d8b1ca, 0x55c1b98a, 0x1dce374b,
+ 0x65750415, 0x573dfed7, 0x95df9943, 0x58a4aea0,
+ 0x5fb40a92, 0x1408d9c2, 0xb5e23fc9, 0x225eb60b,
+ 0x41d33a41, 0xbf958f7f, 0x619f5ac1, 0x207647f3,
+ 0x223e56f8, 0x26afd4ae, 0x6a297840, 0x830947db,
+ 0xbc5af940, 0x4c97ebb1, 0xca38b220, 0x04c9a26d,
+ 0x49a16b72, 0x0882c658, 0x2dbc50e0, 0x67e2d057,
+ 0x4b8ef356, 0x4ba5eac3, 0x17237d9f, 0x27c111a8,
+ 0xc1b1944e, 0xe91fd6b6, 0xa78d9747, 0x61e946d3,
+ 0x0078fe23, 0x7770a088, 0x6d5762af, 0x435ac5f9,
+ 0x36cde9d5, 0xc313804d, 0xa4623760, 0xb1c37572,
+ 0x2b22486d, 0x8af131e3, 0x3e5fc3ea, 0x0d9c9ba0,
+ 0x218bcc8f, 0x8bcdfea2, 0xcf55a599, 0x57b9fcbc,
+ 0x5c087f62, 0xec130a15, 0x7e8bd1f5, 0x60eaaa51,
+ 0x020dd89b, 0x890cc6ea, 0x042d0054, 0x74055863};
+
+ uint8_t result;
+
+ printf("Running TC9: 2048 bit operands.s\n");
+
+ result = testrunner(64, exponent, 64, modulus, message, expected);
+
+ if (result)
+ printf("TC9: OK\n");
+ else
+ printf("TC9: NOT OK\n");
+}
+
+
+//------------------------------------------------------------------
// main()
//------------------------------------------------------------------
int main(void)
@@ -530,6 +712,8 @@ int main(void)
tc5();
tc6();
tc7();
+ tc8();
+ tc9();
return 0;
}