JCE: move rng.init() into initialize() methods of WolfCryptKeyPairGenerator

pull/73/head
Chris Conlon 2024-04-12 15:00:31 -06:00
parent 947db4345a
commit 5f382e244d
1 changed files with 14 additions and 3 deletions

View File

@ -91,9 +91,6 @@ public class WolfCryptKeyPairGenerator extends KeyPairGeneratorSpi {
this.type = type;
this.rng = new Rng();
this.rng.init();
if (debug.DEBUG)
algString = typeToString(type);
}
@ -114,6 +111,13 @@ public class WolfCryptKeyPairGenerator extends KeyPairGeneratorSpi {
this.publicExponent = Rsa.getDefaultRsaExponent();
}
synchronized (rngLock) {
if (this.rng == null) {
this.rng = new Rng();
this.rng.init();
}
}
if (debug.DEBUG)
log("init with keysize: " + keysize);
}
@ -127,6 +131,13 @@ public class WolfCryptKeyPairGenerator extends KeyPairGeneratorSpi {
"AlgorithmParameterSpec must not be null");
}
synchronized (rngLock) {
if (this.rng == null) {
this.rng = new Rng();
this.rng.init();
}
}
switch (type) {
case WC_RSA: