aboutsummaryrefslogtreecommitdiff
path: root/test/format_test_vectors.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/format_test_vectors.py')
-rw-r--r--test/format_test_vectors.py21
1 files changed, 11 insertions, 10 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