[8u] RFR 8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size

Aleksey Shipilev shade at redhat.com
Fri Aug 9 10:08:35 UTC 2019


On 8/8/19 9:40 PM, Martin Balao wrote:
> http://cr.openjdk.java.net/~mbalao/webrevs/8147502/8147502.webrev.jdk8u.jdk.00/

Product change backport looks good.

So the difference in SignatureDigestTruncate.java is:

--- orig	2019-08-09 12:03:20.976137087 +0200
+++ new	2019-08-08 21:15:19.000000000 +0200
@@ -21,7 +21,7 @@
  * questions.
  */

-import jdk.test.lib.Convert;
+import jdk.testlibrary.Convert;

 import java.security.*;
 import java.security.spec.*;
@@ -34,8 +34,8 @@
  * @summary Test that digests are properly truncated before the signature
  *     is applied. The digest should be truncated to the bit length of the
  *     group order.
- * @library /test/lib
- * @build jdk.test.lib.Convert
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.Convert
  * @run main SignatureDigestTruncate
  */
 public class SignatureDigestTruncate {
@@ -114,12 +114,12 @@
     }

     public static void main(String[] args) throws Exception {
-        runTest("SHA384withECDSAinP1363Format", "sect283r1",
+        runTest("SHA384withECDSA", "sect283r1",
             "abcdef10234567", "010203040506070809",
             "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d" +
             "1e1f20212223",
-            "01d7544b5d3935216bd45e2f8042537e1e0296a11e0eb96666199281b409" +
-            "42abccd5358a035de8a314d3e6c2a97614daebf5fb1313540eec3f9a3272" +
-            "068aa10922ccae87d255c84c");
+            "304c022401d7544b5d3935216bd45e2f8042537e1e0296a11e0eb9666619" +
+            "9281b40942abccd5358a0224035de8a314d3e6c2a97614daebf5fb131354" +
+            "0eec3f9a3272068aa10922ccae87d255c84c");
     }
 }

We don't have SHA384withECDSAinP1363Format in 8u, that's why it was changed?

The difference in Convert.java is the absence of trailing newline, apparently:

$ diff -uwb ~/trunks/jdk-jdk/test/lib/jdk/test/lib/Convert.java new
--- /home/shade/trunks/jdk-jdk/test/lib/jdk/test/lib/Convert.java	2019-07-25 07:50:18.361190854 +0200
+++ new	2019-08-08 21:15:39.000000000 +0200
@@ -21,7 +21,7 @@
  * questions.
  */

-package jdk.test.lib;
+package jdk.testlibrary;

 import java.math.BigInteger;

@@ -82,4 +82,3 @@
     }
 }

-



-- 
Thanks,
-Aleksey



More information about the jdk8u-dev mailing list