From 9c5f05dfd4bd757ecdbeabe4bcd60caaf45a5789 Mon Sep 17 00:00:00 2001 From: "Pavel V. Shatov (Meister)" Date: Tue, 17 Apr 2018 14:43:53 +0300 Subject: Additional test cases. --- test_vectors/format_test_vectors.py | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'test_vectors/format_test_vectors.py') diff --git a/test_vectors/format_test_vectors.py b/test_vectors/format_test_vectors.py index 2d4744a..e6e04c5 100644 --- a/test_vectors/format_test_vectors.py +++ b/test_vectors/format_test_vectors.py @@ -4,7 +4,7 @@ # Formats test vectors for ecdsa_fpga_model # # Author: Pavel Shatov -# Copyright (c) 2017, NORDUnet A/S +# Copyright (c) 2017-2018, NORDUnet A/S # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -61,7 +61,13 @@ P384_BASE = keys.get_public_key(1, curve.P384) # # format one test vector # -def format_c_header(f, curve, da, qax, qay, db, qbx, qby, sx, sy): +def format_c_header( f, curve, + da, qax, qay, + db, qbx, qby, + sx, sy, + hx, hy, + qa2x, qa2y, + qb2x, qb2y): if curve == CURVE_P256: curve_str = "P_256" if curve == CURVE_P384: curve_str = "P_384" @@ -77,6 +83,15 @@ def format_c_header(f, curve, da, qax, qay, db, qbx, qby, sx, sy): format_c_array(f, sx, "#define " + curve_str + "_S_X" + " \\\n") format_c_array(f, sy, "#define " + curve_str + "_S_Y" + " \\\n") + + format_c_array(f, hx, "#define " + curve_str + "_H_X" + " \\\n") + format_c_array(f, hy, "#define " + curve_str + "_H_Y" + " \\\n") + + format_c_array(f, qa2x, "#define " + curve_str + "_QA2_X" + " \\\n") + format_c_array(f, qa2y, "#define " + curve_str + "_QA2_Y" + " \\\n") + + format_c_array(f, qb2x, "#define " + curve_str + "_QB2_X" + " \\\n") + format_c_array(f, qb2y, "#define " + curve_str + "_QB2_Y" + " \\\n") # # format one test vector @@ -108,6 +123,8 @@ def format_verilog_include( f, curve, n, format_verilog_concatenation(f, qa2y, "localparam [" + msb_index + ":0] " + curve_str + "_QA2_Y" + " =\n") format_verilog_concatenation(f, db, "localparam [" + msb_index + ":0] " + curve_str + "_DB" + " =\n") + format_verilog_concatenation(f, qbx, "localparam [" + msb_index + ":0] " + curve_str + "_QB_X" + " =\n") + format_verilog_concatenation(f, qby, "localparam [" + msb_index + ":0] " + curve_str + "_QB_Y" + " =\n") format_verilog_concatenation(f, qb2x, "localparam [" + msb_index + ":0] " + curve_str + "_QB2_X" + " =\n") format_verilog_concatenation(f, qb2y, "localparam [" + msb_index + ":0] " + curve_str + "_QB2_Y" + " =\n") @@ -372,7 +389,10 @@ if __name__ == "__main__": format_c_header( file_h, next_curve, da, qax, qay, db, qbx, qby, - QAB.x, QBA.y) + QAB.x, QBA.y, + H.x, H.y, + QA2.x, QA2.y, + QB2.x, QB2.y) format_verilog_include( file_v, next_curve, n, da, qax, qay, -- cgit v1.2.3