summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-11-12 22:45:49 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-11-12 22:45:49 +0700
commit813bfe0c99a7a69164474f3c890218b26d5b332f (patch)
treeaa0db627a93ade6d53e5447acc66808ee7448ddd
parentRefactoring in Pqc.Crypto.Cmce (diff)
downloadBouncyCastle.NET-ed25519-813bfe0c99a7a69164474f3c890218b26d5b332f.tar.xz
Refactoring in Pqc.Crypto.Bike
-rw-r--r--crypto/src/pqc/crypto/bike/BikeRing.cs16
-rw-r--r--crypto/src/pqc/crypto/bike/BikeUtilities.cs10
2 files changed, 13 insertions, 13 deletions
diff --git a/crypto/src/pqc/crypto/bike/BikeRing.cs b/crypto/src/pqc/crypto/bike/BikeRing.cs
index e424c9c3d..414a14544 100644
--- a/crypto/src/pqc/crypto/bike/BikeRing.cs
+++ b/crypto/src/pqc/crypto/bike/BikeRing.cs
@@ -370,14 +370,14 @@ namespace Org.BouncyCastle.Pqc.Crypto.Bike
                     p6 = ImplModAdd(r, p6, pow_8);
                     p7 = ImplModAdd(r, p7, pow_8);
 
-                    z_i |= ((x[p0 >> 6] >> p0) & 1) << (j + 0);
-                    z_i |= ((x[p1 >> 6] >> p1) & 1) << (j + 1);
-                    z_i |= ((x[p2 >> 6] >> p2) & 1) << (j + 2);
-                    z_i |= ((x[p3 >> 6] >> p3) & 1) << (j + 3);
-                    z_i |= ((x[p4 >> 6] >> p4) & 1) << (j + 4);
-                    z_i |= ((x[p5 >> 6] >> p5) & 1) << (j + 5);
-                    z_i |= ((x[p6 >> 6] >> p6) & 1) << (j + 6);
-                    z_i |= ((x[p7 >> 6] >> p7) & 1) << (j + 7);
+                    z_i |= ((x[p0 >> 6] >> p0) & 1UL) << (j + 0);
+                    z_i |= ((x[p1 >> 6] >> p1) & 1UL) << (j + 1);
+                    z_i |= ((x[p2 >> 6] >> p2) & 1UL) << (j + 2);
+                    z_i |= ((x[p3 >> 6] >> p3) & 1UL) << (j + 3);
+                    z_i |= ((x[p4 >> 6] >> p4) & 1UL) << (j + 4);
+                    z_i |= ((x[p5 >> 6] >> p5) & 1UL) << (j + 5);
+                    z_i |= ((x[p6 >> 6] >> p6) & 1UL) << (j + 6);
+                    z_i |= ((x[p7 >> 6] >> p7) & 1UL) << (j + 7);
                 }
 
                 z[i] = z_i;
diff --git a/crypto/src/pqc/crypto/bike/BikeUtilities.cs b/crypto/src/pqc/crypto/bike/BikeUtilities.cs
index ce38e642a..c5689eaf6 100644
--- a/crypto/src/pqc/crypto/bike/BikeUtilities.cs
+++ b/crypto/src/pqc/crypto/bike/BikeUtilities.cs
@@ -38,7 +38,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Bike
             }
         }
 
-        internal static void FromBitArrayToByteArray(byte[] output, byte[] inputX, int inputOff, int inputLen)
+        internal static void FromBitArrayToByteArray(byte[] output, byte[] input, int inputOff, int inputLen)
         {
             int count = 0;
             int pos = 0;
@@ -46,19 +46,19 @@ namespace Org.BouncyCastle.Pqc.Crypto.Bike
             {
                 if (count + 8 >= inputLen)
                 {// last set of bits cannot have enough 8 bits
-                    int b = inputX[inputOff + count];
+                    int b = input[inputOff + count];
                     for (int j = inputLen - count - 1; j >= 1; j--)
                     { //bin in reversed order
-                        b |= inputX[inputOff + count + j] << j;
+                        b |= input[inputOff + count + j] << j;
                     }
                     output[pos] = (byte)b;
                 }
                 else
                 {
-                    int b = inputX[inputOff + count];
+                    int b = input[inputOff + count];
                     for (int j = 7; j >= 1; j--)
                     { //bin in reversed order
-                        b |= inputX[inputOff + count + j] << j;
+                        b |= input[inputOff + count + j] << j;
                     }
                     output[pos] = (byte)b;
                 }