summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/math/ec/rfc7748/X25519.cs12
-rw-r--r--crypto/src/math/ec/rfc7748/X448.cs12
2 files changed, 24 insertions, 0 deletions
diff --git a/crypto/src/math/ec/rfc7748/X25519.cs b/crypto/src/math/ec/rfc7748/X25519.cs
index ffddd4376..0b2be4af0 100644
--- a/crypto/src/math/ec/rfc7748/X25519.cs
+++ b/crypto/src/math/ec/rfc7748/X25519.cs
@@ -269,6 +269,12 @@ namespace Org.BouncyCastle.Math.EC.Rfc7748
 #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
             ScalarMultBase(k.AsSpan(kOff), r.AsSpan(rOff));
 #else
+            // Equivalent (but much slower)
+            //byte[] u = new byte[PointSize];
+            //u[0] = 9;
+
+            //ScalarMult(k, kOff, u, 0, r, rOff);
+
             int[] y = F.Create();
             int[] z = F.Create();
 
@@ -287,6 +293,12 @@ namespace Org.BouncyCastle.Math.EC.Rfc7748
 #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
         public static void ScalarMultBase(ReadOnlySpan<byte> k, Span<byte> r)
         {
+            // Equivalent (but much slower)
+            //Span<byte> u = stackalloc byte[PointSize];
+            //u[0] = 9;
+
+            //ScalarMult(k, u, r);
+
             int[] y = F.Create();
             int[] z = F.Create();
 
diff --git a/crypto/src/math/ec/rfc7748/X448.cs b/crypto/src/math/ec/rfc7748/X448.cs
index 7e078c5c6..0019f53fc 100644
--- a/crypto/src/math/ec/rfc7748/X448.cs
+++ b/crypto/src/math/ec/rfc7748/X448.cs
@@ -282,6 +282,12 @@ namespace Org.BouncyCastle.Math.EC.Rfc7748
 #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
             ScalarMultBase(k.AsSpan(kOff), r.AsSpan(rOff));
 #else
+            // Equivalent (but much slower)
+            //byte[] u = new byte[PointSize];
+            //u[0] = 5;
+
+            //ScalarMult(k, kOff, u, 0, r, rOff);
+
             uint[] x = F.Create();
             uint[] y = F.Create();
 
@@ -299,6 +305,12 @@ namespace Org.BouncyCastle.Math.EC.Rfc7748
 #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
         public static void ScalarMultBase(ReadOnlySpan<byte> k, Span<byte> r)
         {
+            // Equivalent (but much slower)
+            //Span<byte> u = stackalloc byte[PointSize];
+            //u[0] = 5;
+
+            //ScalarMult(k, u, r);
+
             uint[] x = F.Create();
             uint[] y = F.Create();