diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2024-03-14 20:19:25 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2024-03-14 20:19:25 +0700 |
commit | 1e96ddd13bf69786c1b8a0a2f826059c26047a41 (patch) | |
tree | 8c97b5832a523c84f55df4cc10bfad50e0bb686d /crypto/src/math/ec/rfc8032/ScalarUtilities.cs | |
parent | Fix for EdDSA verification infinite loop (diff) | |
download | BouncyCastle.NET-ed25519-1e96ddd13bf69786c1b8a0a2f826059c26047a41.tar.xz |
EdDSA: Explicit guard against infinite looping
Diffstat (limited to '')
-rw-r--r-- | crypto/src/math/ec/rfc8032/ScalarUtilities.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crypto/src/math/ec/rfc8032/ScalarUtilities.cs b/crypto/src/math/ec/rfc8032/ScalarUtilities.cs index fca4a0232..41d7f2696 100644 --- a/crypto/src/math/ec/rfc8032/ScalarUtilities.cs +++ b/crypto/src/math/ec/rfc8032/ScalarUtilities.cs @@ -71,11 +71,11 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032 } else { - // Keep the original value of p in t + // Copy the low limbs of the original p #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER - t[..(last + 1)].CopyFrom(p); + t[..last].CopyFrom(p); #else - Array.Copy(p, 0, t, 0, last + 1); + Array.Copy(p, 0, t, 0, last); #endif int sWords = s >> 5, sBits = s & 31; @@ -288,11 +288,11 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032 } else { - // Keep the original value of p in t + // Copy the low limbs of the original p #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER - t[..(last + 1)].CopyFrom(p); + t[..last].CopyFrom(p); #else - Array.Copy(p, 0, t, 0, last + 1); + Array.Copy(p, 0, t, 0, last); #endif int sWords = s >> 5, sBits = s & 31; |