Tolerate null/empty seed
package org.bouncycastle.crypto.prng;
import org.bouncycastle.crypto.Digest;
+import org.bouncycastle.util.Arrays;
/**
* Random generation based on the digest with counter. Calling addSeedMaterial will
@@ -36,8 +37,11 @@ public DigestRandomGenerator(
public void addSeedMaterial(byte[] inSeed)
{
synchronized (this)
+ {
+ if (!Arrays.isNullOrEmpty(inSeed))
{
digestUpdate(inSeed);
+ }
digestUpdate(seed);
digestDoFinal(seed);
}
