aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/format_test_vectors.py21
-rw-r--r--test/modexp_fpga_model_vectors.h24
2 files changed, 23 insertions, 22 deletions
diff --git a/test/format_test_vectors.py b/test/format_test_vectors.py
index f9e4ba8..abbe42d 100644
--- a/test/format_test_vectors.py
+++ b/test/format_test_vectors.py
@@ -142,16 +142,17 @@ def modinv(a, m):
def format_c_header(f, key, n, m, d, s, p, q, dp, dq, mp, mq):
# write all numbers in vector
- format_c_array(f, n, "#define N_" + str(key) + " \\\n")
- format_c_array(f, m, "#define M_" + str(key) + " \\\n")
- format_c_array(f, d, "#define D_" + str(key) + " \\\n")
- format_c_array(f, s, "#define S_" + str(key) + " \\\n")
- format_c_array(f, p, "#define P_" + str(key) + " \\\n")
- format_c_array(f, q, "#define Q_" + str(key) + " \\\n")
- format_c_array(f, dp, "#define DP_" + str(key) + " \\\n")
- format_c_array(f, dq, "#define DQ_" + str(key) + " \\\n")
- format_c_array(f, mp, "#define MP_" + str(key) + " \\\n")
- format_c_array(f, mq, "#define MQ_" + str(key) + " \\\n")
+ format_c_array(f, n, "#define N_" + key + " \\\n")
+ format_c_array(f, m, "#define M_" + key + " \\\n")
+ format_c_array(f, d, "#define D_" + key + " \\\n")
+ format_c_array(f, s, "#define S_" + key + " \\\n")
+
+ format_c_array(f, p, "#define P_" + str(int(key)//2) + " \\\n")
+ format_c_array(f, q, "#define Q_" + str(int(key)//2) + " \\\n")
+ format_c_array(f, dp, "#define DP_" + str(int(key)//2) + " \\\n")
+ format_c_array(f, dq, "#define DQ_" + str(int(key)//2) + " \\\n")
+ format_c_array(f, mp, "#define MP_" + str(int(key)//2) + " \\\n")
+ format_c_array(f, mq, "#define MQ_" + str(int(key)//2) + " \\\n")
#
# calculate Montgomery factor
diff --git a/test/modexp_fpga_model_vectors.h b/test/modexp_fpga_model_vectors.h
index 622b16c..348ff49 100644
--- a/test/modexp_fpga_model_vectors.h
+++ b/test/modexp_fpga_model_vectors.h
@@ -20,27 +20,27 @@
0xa76b945b, 0x49a3f645, 0x76801499, 0xb98e6a16, \
0xd2467b6a, 0x75b7d614, 0x0fff0fde, 0xb31d1819}
-#define P_384 \
+#define P_192 \
{0xe9ac4cf6, 0x03b2d80a, 0x7f1d091e, 0x49d5f1a0, \
0xac2ae4ff, 0xbf9bf375}
-#define Q_384 \
+#define Q_192 \
{0xc1468f3e, 0xc6909231, 0x5a4d74ba, 0x477b303f, \
0x4b2e10d1, 0x1f44e815}
-#define DP_384 \
+#define DP_192 \
{0x69b6c286, 0x95fbc613, 0x51988034, 0x8cb0d684, \
0x9aff38e4, 0x9ef9ddb5}
-#define DQ_384 \
+#define DQ_192 \
{0x1eda82b7, 0x84bf4377, 0x39712ff7, 0x24be179f, \
0xa302c190, 0x80ab6159}
-#define MP_384 \
+#define MP_192 \
{0x9e163bb5, 0x35e718cb, 0xcde52b7b, 0x5db8552b, \
0x46a300e0, 0x34f91e6b}
-#define MQ_384 \
+#define MQ_192 \
{0x7b01a724, 0x90f0d5f9, 0x9e237ce5, 0x6d31fd28, \
0x4ecb9dad, 0x58bf366a}
@@ -68,27 +68,27 @@
0xfd1e029d, 0xfe887387, 0x4312635f, 0xb2b54b8d, \
0x5d3b379e, 0x161eaa4f, 0xedfd932b, 0x780f0203}
-#define P_512 \
+#define P_256 \
{0xfedea889, 0x97cfdb79, 0xcca87074, 0xe5abcda1, \
0x3be201c4, 0xc416fd15, 0xf2130931, 0x61ff5937}
-#define Q_512 \
+#define Q_256 \
{0xf0889147, 0x5aa60f93, 0xb9927d86, 0x8f795c5c, \
0x8e98dcf2, 0xad3aad74, 0x9441583a, 0x967dce41}
-#define DP_512 \
+#define DP_256 \
{0x2504d437, 0xfffbe9e5, 0xfc0aef22, 0x9b8563bd, \
0xaa83fe3b, 0xc53b8d91, 0x15731c5f, 0xb6db2eeb}
-#define DQ_512 \
+#define DQ_256 \
{0xd3265fba, 0x2eb65638, 0x4d106ec7, 0x000dfe69, \
0x75f87505, 0x47d299d0, 0x1c115cdd, 0x599ca8c1}
-#define MP_512 \
+#define MP_256 \
{0x23359955, 0xcad299b6, 0x049bb248, 0x3828b6a5, \
0x74c85825, 0x7dd8e109, 0x07edbda9, 0x4980c2c9}
-#define MQ_512 \
+#define MQ_256 \
{0x8578120b, 0x91f4ca9e, 0x371d3e70, 0x0005bb89, \
0xd31ed864, 0x477bd9cf, 0x65a1f03b, 0x606d3bc8}