summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-02-10 17:29:43 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-02-10 17:29:43 +0700
commit1e3d65331924ac2cea24155266a1caa9e4ffdbfb (patch)
treef637349c262a4c953871e359cd711a5bf7710854
parentAesEngine_X86 perf. opts. (diff)
downloadBouncyCastle.NET-ed25519-1e3d65331924ac2cea24155266a1caa9e4ffdbfb.tar.xz
Refactor Haraka
-rw-r--r--crypto/src/crypto/digests/Haraka256_X86.cs8
-rw-r--r--crypto/src/crypto/digests/Haraka512_X86.cs18
2 files changed, 13 insertions, 13 deletions
diff --git a/crypto/src/crypto/digests/Haraka256_X86.cs b/crypto/src/crypto/digests/Haraka256_X86.cs
index 4c9a798c0..51642a65b 100644
--- a/crypto/src/crypto/digests/Haraka256_X86.cs
+++ b/crypto/src/crypto/digests/Haraka256_X86.cs
@@ -98,11 +98,11 @@ namespace Org.BouncyCastle.Crypto.Digests
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         private static void ImplAes(ref Vector128<byte> s0, ref Vector128<byte> s1, ReadOnlySpan<Vector128<byte>> rc)
         {
-            s0 = Aes.Encrypt(s0, rc[0]);
-            s1 = Aes.Encrypt(s1, rc[1]);
+            var t0 = Aes.Encrypt(s0, rc[0]);
+            var t1 = Aes.Encrypt(s1, rc[1]);
 
-            s0 = Aes.Encrypt(s0, rc[2]);
-            s1 = Aes.Encrypt(s1, rc[3]);
+            s0 = Aes.Encrypt(t0, rc[2]);
+            s1 = Aes.Encrypt(t1, rc[3]);
         }
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/crypto/src/crypto/digests/Haraka512_X86.cs b/crypto/src/crypto/digests/Haraka512_X86.cs
index 6dcd3e782..fb979ab48 100644
--- a/crypto/src/crypto/digests/Haraka512_X86.cs
+++ b/crypto/src/crypto/digests/Haraka512_X86.cs
@@ -166,15 +166,15 @@ namespace Org.BouncyCastle.Crypto.Digests
         private static void ImplAes(ref Vector128<byte> s0, ref Vector128<byte> s1, ref Vector128<byte> s2,
             ref Vector128<byte> s3, ReadOnlySpan<Vector128<byte>> rc)
         {
-            s0 = Aes.Encrypt(s0, rc[0]);
-            s1 = Aes.Encrypt(s1, rc[1]);
-            s2 = Aes.Encrypt(s2, rc[2]);
-            s3 = Aes.Encrypt(s3, rc[3]);
-
-            s0 = Aes.Encrypt(s0, rc[4]);
-            s1 = Aes.Encrypt(s1, rc[5]);
-            s2 = Aes.Encrypt(s2, rc[6]);
-            s3 = Aes.Encrypt(s3, rc[7]);
+            var t0 = Aes.Encrypt(s0, rc[0]);
+            var t1 = Aes.Encrypt(s1, rc[1]);
+            var t2 = Aes.Encrypt(s2, rc[2]);
+            var t3 = Aes.Encrypt(s3, rc[3]);
+
+            s0 = Aes.Encrypt(t0, rc[4]);
+            s1 = Aes.Encrypt(t1, rc[5]);
+            s2 = Aes.Encrypt(t2, rc[6]);
+            s3 = Aes.Encrypt(t3, rc[7]);
         }
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]