RFR(L): 8069539: RSA acceleration

Viswanathan, Sandhya sandhya.viswanathan at intel.com
Fri Mar 20 22:45:21 UTC 2015


Hi Florian,

My thoughts on this are as follows:
 
BigInteger.squareToLen is a private method and not a public method. 
The length calculation code in Java version of this method does not have the overflow check and the intrinsic follows the Java code. 

private static final int[] squareToLen(int[] x, int len, int[] z) {
        ...
        int zlen = len << 1;
        if (z == null || z.length < zlen)
            z = new int[zlen];
        ...
  }

Also the underlying array in BigInteger cannot be greater than MAX_MAG_LENGTH which is defined as:

private static final int MAX_MAG_LENGTH = Integer.MAX_VALUE / Integer.SIZE + 1; // (1 << 26)

So zlen calculation cannot overflow as int array x and its length len is coming from a BigInteger array.

Similarly mulAdd is a package private method and its inputs are allocated or verified at call sites.

Best Regards,
Sandhya 
	
-----Original Message-----
From: Florian Weimer [mailto:fweimer at redhat.com] 
Sent: Friday, March 20, 2015 4:11 AM
To: Viswanathan, Sandhya; Sergey Kuksenko; hotspot-compiler-dev at openjdk.java.net
Subject: Re: RFR(L): 8069539: RSA acceleration

On 03/19/2015 11:32 PM, Viswanathan, Sandhya wrote:
> Hi All,
> 
> Vladimir helped to place the webrev on cr.openjdk; please find the link below for your review and comments:
> 
> http://cr.openjdk.java.net/~kvn/8069539/webrev.00/

In src/share/vm/opto/library_call.cpp, can this computation overflow?
What happens as a result?

+    // Allocate the result array
+    Node* zlen = _gvn.transform(new AddINode(len, len));

Does inline_mulAdd() need range checks on the arguments?

-- 
Florian Weimer / Red Hat Product Security


More information about the hotspot-compiler-dev mailing list