diff --git a/jdk/src/jdk.crypto.ec/share/native/libsunec/impl/ec.c b/jdk/src/jdk.crypto.ec/share/native/libsunec/impl/ec.c index dd1f9101e25..4f3cab36b8c 100644 --- a/jdk/src/jdk.crypto.ec/share/native/libsunec/impl/ec.c +++ b/jdk/src/jdk.crypto.ec/share/native/libsunec/impl/ec.c @@ -34,7 +34,7 @@ * Dr Vipul Gupta and * Douglas Stebila , Sun Microsystems Laboratories * - * Last Modified Date from the Original Code: Nov 2016 + * Last Modified Date from the Original Code: November 2016 *********************************************************************** */ #include "mplogic.h" @@ -714,6 +714,16 @@ ECDSA_SignDigestWithSeed(ECPrivateKey *key, SECItem *signature, goto cleanup; } + /* + * Using an equivalent exponent of fixed length (same as n or 1 bit less + * than n) to keep the kG timing relatively constant. + * + * Note that this is an extra step on top of the approach defined in + * ANSI X9.62 so as to make a fixed length K. + */ + CHECK_MPI_OK( mp_add(&k, &n, &k) ); + CHECK_MPI_OK( mp_div_2(&k, &k) ); + /* ** ANSI X9.62, Section 5.3.2, Step 2 **