APIdia Launch Partner
Top Fields Constructors Methods
sun.security.util.math.intpoly

public final Class MontgomeryIntegerPolynomialP256

extends IntegerPolynomial
implements IntegerMontgomeryFieldModuloP
Class Inheritance
All Implemented Interfaces
sun.security.util.math.IntegerMontgomeryFieldModuloP, sun.security.util.math.IntegerFieldModuloP
Imports
sun.security.util.math.ImmutableIntegerModuloP, .IntegerMontgomeryFieldModuloP, .SmallValue, .IntegerFieldModuloP, java.math.BigInteger, jdk.internal.vm.annotation.IntrinsicCandidate, .ForceInline, .Stable

Field Summary

Modifier and TypeField and Description
private static final int
private static final long[]
h

private static final long
private static final int
public static final BigInteger
private static final long[]
private static final int
public static final MontgomeryIntegerPolynomialP256
private static final long[]
private static final long[]
private static final long[]
Inherited from sun.security.util.math.intpoly.IntegerPolynomial:
bitsPerLimbnumLimbsTWO

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
protected long
private static BigInteger
protected void
finalCarryReduceLast(long[] limbs)

Implements abstract sun.security.util.math.intpoly.IntegerPolynomial.finalCarryReduceLast.

Carry out of the last limb and reduce back in. This method will be called as part of the "finalReduce" operation that puts the representation into a fully-reduced form.

public ImmutableIntegerModuloP
public IntegerPolynomial.ImmutableElement
public IntegerPolynomial.ImmutableElement
public IntegerPolynomial.ImmutableElement
getElement(BigInteger v)

Overrides sun.security.util.math.intpoly.IntegerPolynomial.getElement.

Implements sun.security.util.math.IntegerFieldModuloP.getElement.

Get the field element equivalent to the supplied BigInteger value.

public IntegerPolynomial.ImmutableElement
getElement(byte[] v, int offset, int length, byte highByte)

Overrides sun.security.util.math.intpoly.IntegerPolynomial.getElement.

Implements sun.security.util.math.IntegerFieldModuloP.getElement.

Get a field element from a little-endian unsigned integer stored at the specified position in an array.

public SmallValue
getSmallValue(int value)

Overrides sun.security.util.math.intpoly.IntegerPolynomial.getSmallValue.

Implements sun.security.util.math.IntegerFieldModuloP.getSmallValue.

Get a "small" value according to this implementation.

private void
halfLimbs(long[] a, long[] r)

protected void
mult(long[] a, long[] b, long[] r)

Implements abstract sun.security.util.math.intpoly.IntegerPolynomial.mult.

Unrolled Word-by-Word Montgomery Multiplication r = a * b * 2^-260 (mod P) See [1] Figure 5.

protected void
protected void
reduce(long[] limbs)

Implements abstract sun.security.util.math.intpoly.IntegerPolynomial.reduce.

Reduce an IntegerPolynomial representation (a) and store the result in a.

protected void
reduceIn(long[] limbs, long v, int i)

Implements abstract sun.security.util.math.intpoly.IntegerPolynomial.reduceIn.

public IntegerFieldModuloP
protected void
square(long[] a, long[] r)

Implements abstract sun.security.util.math.intpoly.IntegerPolynomial.square.

Multiply an IntegerPolynomial representation (a) with itself and store the result in an IntegerPolynomialRepresentation (r).

Inherited from sun.security.util.math.intpoly.IntegerPolynomial:
addLimbsaddLimbsModPowerTwocarrycarrycarryOutconditionalAssignconditionalSwapdecodeencodeencodeencodeSmallevaluatefinalReducegetMaxAddsgetNumLimbsgetSizelimbsToByteArraymultByIntsetLimbsValuePositive

Field Detail

BITS_PER_LIMBback to summary
private static final int BITS_PER_LIMB
hback to summary
private static final long[] h
LIMB_MASKback to summary
private static final long LIMB_MASK
MAX_ADDSback to summary
private static final int MAX_ADDS
MODULUSback to summary
public static final BigInteger MODULUS
modulusback to summary
private static final long[] modulus

Hides sun.security.util.math.intpoly.IntegerPolynomial.modulus.

Annotations
@Stable
NUM_LIMBSback to summary
private static final int NUM_LIMBS
ONEback to summary
public static final MontgomeryIntegerPolynomialP256 ONE
oneActualback to summary
private static final long[] oneActual
oneMontback to summary
private static final long[] oneMont
zeroback to summary
private static final long[] zero

Constructor Detail

MontgomeryIntegerPolynomialP256back to summary
private MontgomeryIntegerPolynomialP256()

Method Detail

carryValueback to summary
protected long carryValue(long x)

Overrides sun.security.util.math.intpoly.IntegerPolynomial.carryValue.

Annotations
@Override
evaluateModulusback to summary
private static BigInteger evaluateModulus()
finalCarryReduceLastback to summary
protected void finalCarryReduceLast(long[] limbs)

Implements abstract sun.security.util.math.intpoly.IntegerPolynomial.finalCarryReduceLast.

Doc from sun.security.util.math.intpoly.IntegerPolynomial.finalCarryReduceLast.

Carry out of the last limb and reduce back in. This method will be called as part of the "finalReduce" operation that puts the representation into a fully-reduced form. It is representation- specific, because representations have different amounts of empty space in the high-order limb. Requires that limbs.length=numLimbs.

Annotations
@Override
fromMontgomeryback to summary
public ImmutableIntegerModuloP fromMontgomery(ImmutableIntegerModuloP n)

Implements sun.security.util.math.IntegerMontgomeryFieldModuloP.fromMontgomery.

Annotations
@Override
get0back to summary
public IntegerPolynomial.ImmutableElement get0()

Overrides sun.security.util.math.intpoly.IntegerPolynomial.get0.

Implements sun.security.util.math.IntegerFieldModuloP.get0.

Doc from sun.security.util.math.IntegerFieldModuloP.get0.

Get the additive identity element 0

Annotations
@Override
get1back to summary
public IntegerPolynomial.ImmutableElement get1()

Overrides sun.security.util.math.intpoly.IntegerPolynomial.get1.

Implements sun.security.util.math.IntegerFieldModuloP.get1.

Doc from sun.security.util.math.IntegerFieldModuloP.get1.

Get the multiplicative identity element 1

Annotations
@Override
getElementback to summary
public IntegerPolynomial.ImmutableElement getElement(BigInteger v)

Overrides sun.security.util.math.intpoly.IntegerPolynomial.getElement.

Implements sun.security.util.math.IntegerFieldModuloP.getElement.

Doc from sun.security.util.math.IntegerFieldModuloP.getElement.

Get the field element equivalent to the supplied BigInteger value. The supplied value may be negative or larger than the modulus that defines the field.

Annotations
@Override
getElementback to summary
public IntegerPolynomial.ImmutableElement getElement(byte[] v, int offset, int length, byte highByte)

Overrides sun.security.util.math.intpoly.IntegerPolynomial.getElement.

Implements sun.security.util.math.IntegerFieldModuloP.getElement.

Doc from sun.security.util.math.IntegerFieldModuloP.getElement.

Get a field element from a little-endian unsigned integer stored at the specified position in an array. The supplied value may be larger than the modulus that defines the field. This method also takes a byte which is interpreted as an additional high-order byte of the number. The array will not be modified.

getSmallValueback to summary
public SmallValue getSmallValue(int value)

Overrides sun.security.util.math.intpoly.IntegerPolynomial.getSmallValue.

Implements sun.security.util.math.IntegerFieldModuloP.getSmallValue.

Doc from sun.security.util.math.IntegerFieldModuloP.getSmallValue.

Get a "small" value according to this implementation. This value may be used in optimized forms of some operations to avoid unnecessary calculations. For example, multiplication is much faster when it is known that one of the numbers fits within a single limb. The definition of "small", and the range of accepted values, is implementation-specific.

Annotations
@Override
halfLimbsback to summary
private void halfLimbs(long[] a, long[] r)
multback to summary
protected void mult(long[] a, long[] b, long[] r)

Implements abstract sun.security.util.math.intpoly.IntegerPolynomial.mult.

Unrolled Word-by-Word Montgomery Multiplication r = a * b * 2^-260 (mod P) See [1] Figure 5. "Algorithm 2: Word-by-Word Montgomery Multiplication for a Montgomery Friendly modulus p".

Note

Step 6. Skipped; Instead use numAdds to reuse existing overflow logic.

Annotations
@Override
@IntrinsicCandidate
postEncodeCarryback to summary
protected void postEncodeCarry(long[] v)

Overrides sun.security.util.math.intpoly.IntegerPolynomial.postEncodeCarry.

Annotations
@Override
reduceback to summary
protected void reduce(long[] limbs)

Implements abstract sun.security.util.math.intpoly.IntegerPolynomial.reduce.

Doc from sun.security.util.math.intpoly.IntegerPolynomial.reduce.

Reduce an IntegerPolynomial representation (a) and store the result in a. Requires that a.length == numLimbs.

Annotations
@Override
reduceInback to summary
protected void reduceIn(long[] limbs, long v, int i)

Implements abstract sun.security.util.math.intpoly.IntegerPolynomial.reduceIn.

Annotations
@Override
residueFieldback to summary
public IntegerFieldModuloP residueField()

Implements sun.security.util.math.IntegerMontgomeryFieldModuloP.residueField.

squareback to summary
protected void square(long[] a, long[] r)

Implements abstract sun.security.util.math.intpoly.IntegerPolynomial.square.

Doc from sun.security.util.math.intpoly.IntegerPolynomial.square.

Multiply an IntegerPolynomial representation (a) with itself and store the result in an IntegerPolynomialRepresentation (r). Requires that a.length == r.length == numLimbs. It is allowed for a and r to be the same array.

Annotations
@Override