[Cryptech-Commits] [core/pkey/ecdsa384] 02/02: Same changes as for the P-256 core.

git at cryptech.is git at cryptech.is
Mon Apr 2 11:43:04 UTC 2018


This is an automated email from the git hooks/post-receive script.

meisterpaul1 at yandex.ru pushed a commit to branch fix
in repository core/pkey/ecdsa384.

commit 0332f99f8b9ef7ec9e520406abfe887a185ec87b
Author: Pavel V. Shatov (Meister) <meisterpaul1 at yandex.ru>
AuthorDate: Mon Apr 2 14:41:42 2018 +0300

    Same changes as for the P-256 core.
---
 bench/tb_curve_multiplier_384.v | 28 +++++++++++++++++++++++++---
 rtl/curve/rom/brom_p384_h_x.v   | 25 +++++++++++++------------
 rtl/curve/rom/brom_p384_h_y.v   | 24 ++++++++++++------------
 3 files changed, 50 insertions(+), 27 deletions(-)

diff --git a/bench/tb_curve_multiplier_384.v b/bench/tb_curve_multiplier_384.v
index cc02ee8..163f39f 100644
--- a/bench/tb_curve_multiplier_384.v
+++ b/bench/tb_curve_multiplier_384.v
@@ -46,17 +46,36 @@ module tb_curve_multiplier_384;
    //
    // Test Vectors
    //
+
+		/* Q = d * G */
    localparam	[383:0]	K_1	= 384'hc838b85253ef8dc7394fa5808a5183981c7deef5a69ba8f4f2117ffea39cfcd90e95f6cbc854abacab701d50c1f3cf24;
    localparam	[383:0]	PX_1	= 384'h1fbac8eebd0cbf35640b39efe0808dd774debff20a2a329e91713baf7d7f3c3e81546d883730bee7e48678f857b02ca0;
    localparam	[383:0]	PY_1	= 384'heb213103bd68ce343365a8a4c3d4555fa385f5330203bdd76ffad1f3affb95751c132007e1b240353cb0a4cf1693bdf9;
 
+		/* R = k * G */
    localparam	[383:0]	K_2	= 384'hdc6b44036989a196e39d1cdac000812f4bdd8b2db41bb33af51372585ebd1db63f0ce8275aa1fd45e2d2a735f8749359;
    localparam	[383:0]	PX_2	= 384'ha0c27ec893092dea1e1bd2ccfed3cf945c8134ed0c9f81311a0f4a05942db8dbed8dd59f267471d5462aa14fe72de856;
    localparam	[383:0]	PY_2	= 384'h855649409815bb91424eaca5fd76c97375d575d1422ec53d343bd33b847fdf0c11569685b528ab25493015428d7cf72b;
 
+		/* O = n * G */
    localparam	[383:0]	K_3	= 384'hffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973;
    localparam	[383:0]	PX_3	= 384'h000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;
    localparam	[383:0]	PY_3	= 384'h000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;
+		
+		/* H = 2 * G */
+	localparam	[383:0]	K_4	= 384'h000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002;
+	localparam	[383:0]	PX_4	= 384'h08d999057ba3d2d969260045c55b97f089025959a6f434d651d207d19fb96e9e4fe0e86ebe0e64f85b96a9c75295df61;
+	localparam	[383:0]	PY_4	= 384'h8e80f1fa5b1b3cedb7bfe8dffd6dba74b275d875bc6cc43e904e505f256ab4255ffd43e94d39e22d61501e700a940e80;
+		
+		/* G = (n + 1) * G */
+	localparam	[383:0]	K_5	= 384'hffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973 + 'd1;
+	localparam	[383:0]	PX_5	= 384'haa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7;
+	localparam	[383:0]	PY_5	= 384'h3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f;
+
+		/* H = (n + 2) * G */
+	localparam	[383:0]	K_6	= 384'hffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973 + 'd2;
+	localparam	[383:0]	PX_6	= 384'h08d999057ba3d2d969260045c55b97f089025959a6f434d651d207d19fb96e9e4fe0e86ebe0e64f85b96a9c75295df61;
+	localparam	[383:0]	PY_6	= 384'h8e80f1fa5b1b3cedb7bfe8dffd6dba74b275d875bc6cc43e904e505f256ab4255ffd43e94d39e22d61501e700a940e80;
 
 
    //
@@ -171,9 +190,12 @@ module tb_curve_multiplier_384;
       #100;
 
       /* run tests */
-      test_curve_multiplier(K_1, PX_1, PY_1);
-      test_curve_multiplier(K_2, PX_2, PY_2);
-      test_curve_multiplier(K_3, PX_3, PY_3);
+      //test_curve_multiplier(K_1, PX_1, PY_1);
+      //test_curve_multiplier(K_2, PX_2, PY_2);
+      //test_curve_multiplier(K_3, PX_3, PY_3);
+      //test_curve_multiplier(K_4, PX_4, PY_4);
+      //test_curve_multiplier(K_5, PX_5, PY_5);
+      test_curve_multiplier(K_6, PX_6, PY_6);
 
       /* print result */
       if (ok)	$display("tb_curve_multiplier_384: SUCCESS");
diff --git a/rtl/curve/rom/brom_p384_h_x.v b/rtl/curve/rom/brom_p384_h_x.v
index b6a0886..5fef79a 100644
--- a/rtl/curve/rom/brom_p384_h_x.v
+++ b/rtl/curve/rom/brom_p384_h_x.v
@@ -54,18 +54,19 @@ module brom_p384_h_x
    always @(posedge clk)
      //
      case (b_addr)
-       4'b0000:	bram_reg_b <= 32'h1b13ea8a;
-       4'b0001:	bram_reg_b <= 32'h8b574391;
-       4'b0010:	bram_reg_b <= 32'h8155ad27;
-       4'b0011:	bram_reg_b <= 32'h55fa1b42;
-       4'b0100:	bram_reg_b <= 32'hfb57ab8d;
-       4'b0101:	bram_reg_b <= 32'h4c117c3e;
-       4'b0110:	bram_reg_b <= 32'he8b0c8cf;
-       4'b0111:	bram_reg_b <= 32'h23c5893a;
-       4'b1000:	bram_reg_b <= 32'h19bea517;
-       4'b1001:	bram_reg_b <= 32'he29c71c2;
-       4'b1010:	bram_reg_b <= 32'h82e9f590;
-       4'b1011:	bram_reg_b <= 32'haaf06bba;
+       4'b0000:	bram_reg_b <= 32'h5295df61;
+       4'b0001:	bram_reg_b <= 32'h5b96a9c7;
+       4'b0010:	bram_reg_b <= 32'hbe0e64f8;
+       4'b0011:	bram_reg_b <= 32'h4fe0e86e;
+       4'b0100:	bram_reg_b <= 32'h9fb96e9e;
+       4'b0101:	bram_reg_b <= 32'h51d207d1;
+       4'b0110:	bram_reg_b <= 32'ha6f434d6;
+       4'b0111:	bram_reg_b <= 32'h89025959;
+       4'b1000:	bram_reg_b <= 32'hc55b97f0;
+       4'b1001:	bram_reg_b <= 32'h69260045;
+       4'b1010:	bram_reg_b <= 32'h7ba3d2d9;
+       4'b1011:	bram_reg_b <= 32'h08d99905;
      endcase
+	  
 
 endmodule
diff --git a/rtl/curve/rom/brom_p384_h_y.v b/rtl/curve/rom/brom_p384_h_y.v
index c390e3d..f56efc5 100644
--- a/rtl/curve/rom/brom_p384_h_y.v
+++ b/rtl/curve/rom/brom_p384_h_y.v
@@ -54,18 +54,18 @@ module brom_p384_h_y
    always @(posedge clk)
      //
      case (b_addr)
-       4'b0000:	bram_reg_b <= 32'h6f15f19d;
-       4'b0001:	bram_reg_b <= 32'h85bce284;
-       4'b0010:	bram_reg_b <= 32'he2817e62;
-       4'b0011:	bram_reg_b <= 32'hf59f4e30;
-       4'b0100:	bram_reg_b <= 32'h4a0f473e;
-       4'b0101:	bram_reg_b <= 32'h1625ceec;
-       4'b0110:	bram_reg_b <= 32'hd765eb83;
-       4'b0111:	bram_reg_b <= 32'h070be242;
-       4'b1000:	bram_reg_b <= 32'h6d6d23d6;
-       4'b1001:	bram_reg_b <= 32'ha2616740;
-       4'b1010:	bram_reg_b <= 32'h69d9d390;
-       4'b1011:	bram_reg_b <= 32'hc9e821b5;
+       4'b0000:	bram_reg_b <= 32'h0a940e80;
+       4'b0001:	bram_reg_b <= 32'h61501e70;
+       4'b0010:	bram_reg_b <= 32'h4d39e22d;
+       4'b0011:	bram_reg_b <= 32'h5ffd43e9;
+       4'b0100:	bram_reg_b <= 32'h256ab425;
+       4'b0101:	bram_reg_b <= 32'h904e505f;
+       4'b0110:	bram_reg_b <= 32'hbc6cc43e;
+       4'b0111:	bram_reg_b <= 32'hb275d875;
+       4'b1000:	bram_reg_b <= 32'hfd6dba74;
+       4'b1001:	bram_reg_b <= 32'hb7bfe8df;
+       4'b1010:	bram_reg_b <= 32'h5b1b3ced;
+       4'b1011:	bram_reg_b <= 32'h8e80f1fa;
      endcase
 
 endmodule



More information about the Commits mailing list