mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8295723: security/infra/wycheproof/RunWycheproof.java fails with Assertion Error
Reviewed-by: mschoene, ascarpino, coffeys, rhalade, weijun
This commit is contained in:
parent
bd324cee9c
commit
0f925fefdf
5 changed files with 128 additions and 65 deletions
|
@ -61,9 +61,6 @@ public final class DHKeyPairGenerator extends KeyPairGeneratorSpi {
|
|||
// The size in bits of the prime modulus
|
||||
private int pSize;
|
||||
|
||||
// The size in bits of the random exponent (private value)
|
||||
private int lSize;
|
||||
|
||||
// The source of randomness
|
||||
private SecureRandom random;
|
||||
|
||||
|
@ -111,7 +108,6 @@ public final class DHKeyPairGenerator extends KeyPairGeneratorSpi {
|
|||
}
|
||||
|
||||
this.pSize = keysize;
|
||||
this.lSize = params.getL();
|
||||
this.random = random;
|
||||
}
|
||||
|
||||
|
@ -138,9 +134,8 @@ public final class DHKeyPairGenerator extends KeyPairGeneratorSpi {
|
|||
|
||||
params = (DHParameterSpec) algParams;
|
||||
pSize = params.getP().bitLength();
|
||||
lSize = params.getL();
|
||||
try {
|
||||
checkKeySize(pSize, lSize);
|
||||
checkKeySize(pSize, params.getL());
|
||||
} catch (InvalidParameterException ipe) {
|
||||
throw new InvalidAlgorithmParameterException(ipe.getMessage());
|
||||
}
|
||||
|
@ -157,20 +152,12 @@ public final class DHKeyPairGenerator extends KeyPairGeneratorSpi {
|
|||
random = SunJCE.getRandom();
|
||||
}
|
||||
|
||||
if (params == null) { // when init() not called
|
||||
try {
|
||||
params = ParameterCache.getDHParameterSpec(pSize, random);
|
||||
lSize = params.getL();
|
||||
} catch (GeneralSecurityException e) {
|
||||
// should never happen
|
||||
throw new ProviderException(e);
|
||||
}
|
||||
}
|
||||
BigInteger p = params.getP();
|
||||
BigInteger g = params.getG();
|
||||
|
||||
int lSize = params.getL();
|
||||
if (lSize == 0) { // not specified; use our own default
|
||||
lSize = getDefDHPrivateExpSize(pSize);
|
||||
lSize = getDefDHPrivateExpSize(params);
|
||||
}
|
||||
|
||||
BigInteger x;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue