summary refs log tree commit diff
path: root/crypto/src/math/ec/rfc7748/X25519.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-10-05 20:48:03 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-10-05 20:48:03 +0700
commit8f7c63588dd18dc3e56e1253ac2779956ac60eb4 (patch)
treefd45fc6050faa2d4965783e5c6137d9e951e2c73 /crypto/src/math/ec/rfc7748/X25519.cs
parentSpan-bases variants for Mod methods (diff)
downloadBouncyCastle.NET-ed25519-8f7c63588dd18dc3e56e1253ac2779956ac60eb4.tar.xz
Span-based variants for XDH/EdDSA
Diffstat (limited to 'crypto/src/math/ec/rfc7748/X25519.cs')
-rw-r--r--crypto/src/math/ec/rfc7748/X25519.cs4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/src/math/ec/rfc7748/X25519.cs b/crypto/src/math/ec/rfc7748/X25519.cs
index 954b2dd90..ffddd4376 100644
--- a/crypto/src/math/ec/rfc7748/X25519.cs
+++ b/crypto/src/math/ec/rfc7748/X25519.cs
@@ -266,6 +266,9 @@ namespace Org.BouncyCastle.Math.EC.Rfc7748
 
         public static void ScalarMultBase(byte[] k, int kOff, byte[] r, int rOff)
         {
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+            ScalarMultBase(k.AsSpan(kOff), r.AsSpan(rOff));
+#else
             int[] y = F.Create();
             int[] z = F.Create();
 
@@ -278,6 +281,7 @@ namespace Org.BouncyCastle.Math.EC.Rfc7748
 
             F.Normalize(y);
             F.Encode(y, r, rOff);
+#endif
         }
 
 #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER