summary refs log tree commit diff
path: root/crypto/test/src
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/test/src')
-rw-r--r--crypto/test/src/crypto/prng/test/TestEntropySourceProvider.cs2
-rw-r--r--crypto/test/src/util/test/FixedSecureRandom.cs9
2 files changed, 10 insertions, 1 deletions
diff --git a/crypto/test/src/crypto/prng/test/TestEntropySourceProvider.cs b/crypto/test/src/crypto/prng/test/TestEntropySourceProvider.cs

index ae80b3dbe..1c0d24dba 100644 --- a/crypto/test/src/crypto/prng/test/TestEntropySourceProvider.cs +++ b/crypto/test/src/crypto/prng/test/TestEntropySourceProvider.cs
@@ -53,7 +53,7 @@ namespace Org.BouncyCastle.Crypto.Prng.Test #if NET6_0_OR_GREATER || NETSTANDARD2_1_OR_GREATER int IEntropySource.GetEntropy(Span<byte> output) { - int length = bitsRequired / 8; + int length = System.Math.Min(output.Length, bitsRequired / 8); data.AsSpan(index, length).CopyTo(output); index += length; return length; diff --git a/crypto/test/src/util/test/FixedSecureRandom.cs b/crypto/test/src/util/test/FixedSecureRandom.cs
index a7f3c1f3b..a23438794 100644 --- a/crypto/test/src/util/test/FixedSecureRandom.cs +++ b/crypto/test/src/util/test/FixedSecureRandom.cs
@@ -213,6 +213,15 @@ namespace Org.BouncyCastle.Utilities.Test return GetNextBytes(this, numBytes); } + // NOTE: .NET Core 3.1 has Span<T>, but is tested against our .NET Standard 2.0 assembly. +//#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER +#if NET6_0_OR_GREATER || NETSTANDARD2_1_OR_GREATER + public override void GenerateSeed(Span<byte> seed) + { + NextBytes(seed); + } +#endif + public override void NextBytes(byte[] buf) { NextBytes(buf, 0, buf.Length);