summary refs log tree commit diff
path: root/crypto/src/security/SecureRandom.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-06-23 23:59:11 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-06-23 23:59:11 +0700
commit4dc05f350dadb70caf7d52f051110f5509ef46e1 (patch)
tree34df561fd099bf7bf3fc1b70aa4506d4a814fefd /crypto/src/security/SecureRandom.cs
parentReplace Assembly.GetExecutingAssembly calls (diff)
downloadBouncyCastle.NET-ed25519-4dc05f350dadb70caf7d52f051110f5509ef46e1.tar.xz
Remvoe ThreadedSeedGenerator
Diffstat (limited to 'crypto/src/security/SecureRandom.cs')
-rw-r--r--crypto/src/security/SecureRandom.cs37
1 files changed, 0 insertions, 37 deletions
diff --git a/crypto/src/security/SecureRandom.cs b/crypto/src/security/SecureRandom.cs
index 4a16a6c4d..eb5d69618 100644
--- a/crypto/src/security/SecureRandom.cs
+++ b/crypto/src/security/SecureRandom.cs
@@ -2,7 +2,6 @@ using System;
 using System.Threading;
 
 using Org.BouncyCastle.Crypto;
-using Org.BouncyCastle.Crypto.Digests;
 using Org.BouncyCastle.Crypto.Prng;
 using Org.BouncyCastle.Crypto.Utilities;
 using Org.BouncyCastle.Utilities;
@@ -14,40 +13,6 @@ namespace Org.BouncyCastle.Security
     {
         private static long counter = Times.NanoTime();
 
-#if PORTABLE
-        private static object counterLock = new object();
-        private static long NextCounterValue()
-        {
-            lock (counterLock)
-            {
-                return ++counter;
-            }
-        }
-
-        private static readonly SecureRandom[] master = { null };
-        private static SecureRandom Master
-        {
-            get
-            {
-                lock (master)
-                {
-                    if (master[0] == null)
-                    {
-                        SecureRandom sr = master[0] = GetInstance("SHA256PRNG", false);
-
-                        // Even though Ticks has at most 8 or 14 bits of entropy, there's no harm in adding it.
-                        sr.SetSeed(DateTime.Now.Ticks);
-
-                        // 32 will be enough when ThreadedSeedGenerator is fixed.  Until then, ThreadedSeedGenerator returns low
-                        // entropy, and this is not sufficient to be secure. http://www.bouncycastle.org/csharpdevmailarchive/msg00814.html
-                        sr.SetSeed(new ThreadedSeedGenerator().GenerateSeed(32, true));
-                    }
-
-                    return master[0];
-                }
-            }
-        }
-#else
         private static long NextCounterValue()
         {
             return Interlocked.Increment(ref counter);
@@ -58,7 +23,6 @@ namespace Org.BouncyCastle.Security
         {
             get { return master; }
         }
-#endif
 
         private static DigestRandomGenerator CreatePrng(string digestName, bool autoSeed)
         {
@@ -155,7 +119,6 @@ namespace Org.BouncyCastle.Security
 
         public override int Next(int maxValue)
         {
-
             if (maxValue < 2)
             {
                 if (maxValue < 0)