summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-02-10 13:31:11 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-02-10 13:31:11 +0700
commit44528a599c73bf638088ce040253b5fe6878d20b (patch)
treed01c88e4c24b653f83693536c7808f3cf8559d3f
parentAdd TestRandomData class (diff)
downloadBouncyCastle.NET-ed25519-44528a599c73bf638088ce040253b5fe6878d20b.tar.xz
Tolerate null/empty seed
-rw-r--r--crypto/src/crypto/prng/DigestRandomGenerator.cs9
1 files changed, 6 insertions, 3 deletions
diff --git a/crypto/src/crypto/prng/DigestRandomGenerator.cs b/crypto/src/crypto/prng/DigestRandomGenerator.cs
index f5a29952a..024db2852 100644
--- a/crypto/src/crypto/prng/DigestRandomGenerator.cs
+++ b/crypto/src/crypto/prng/DigestRandomGenerator.cs
@@ -1,7 +1,7 @@
 using System;
 
-using Org.BouncyCastle.Crypto.Digests;
 using Org.BouncyCastle.Crypto.Utilities;
+using Org.BouncyCastle.Utilities;
 
 namespace Org.BouncyCastle.Crypto.Prng
 {
@@ -40,8 +40,11 @@ namespace Org.BouncyCastle.Crypto.Prng
 		{
 			lock (this)
 			{
-				DigestUpdate(inSeed);
-				DigestUpdate(seed);
+                if (!Arrays.IsNullOrEmpty(inSeed))
+                {
+                    DigestUpdate(inSeed);
+                }
+                DigestUpdate(seed);
 				DigestDoFinal(seed);
 			}
 		}