summary refs log tree commit diff
path: root/crypto/src/pqc
diff options
context:
space:
mode:
authorDavid Hook <david.hook@keyfactor.com>2023-08-26 13:22:51 +1000
committerDavid Hook <david.hook@keyfactor.com>2023-08-26 13:22:51 +1000
commitb26247c89358daf60f2be507696666e2c05e98fd (patch)
tree9039002614b94e6b42a7fe93f9d0d71bef3b69bf /crypto/src/pqc
parentc~ change from SP 800-204 (draft) (diff)
downloadBouncyCastle.NET-ed25519-b26247c89358daf60f2be507696666e2c05e98fd.tar.xz
c~ change from SP 800-204 (draft)
Diffstat (limited to 'crypto/src/pqc')
-rw-r--r--crypto/src/pqc/crypto/crystals/dilithium/Packing.cs24
1 files changed, 12 insertions, 12 deletions
diff --git a/crypto/src/pqc/crypto/crystals/dilithium/Packing.cs b/crypto/src/pqc/crypto/crystals/dilithium/Packing.cs
index 0f1fec1d2..eaae195ee 100644
--- a/crypto/src/pqc/crypto/crystals/dilithium/Packing.cs
+++ b/crypto/src/pqc/crypto/crystals/dilithium/Packing.cs
@@ -70,8 +70,8 @@ namespace Org.BouncyCastle.Pqc.Crypto.Crystals.Dilithium
         {
             int i, j, k, end = 0;
 
-            Array.Copy(c, 0, sig, 0, DilithiumEngine.SeedBytes);
-            end += DilithiumEngine.SeedBytes;
+            Array.Copy(c, 0, sig, 0, engine.CTilde);
+            end += engine.CTilde;
 
             for (i = 0; i < engine.L; ++i)
             {
@@ -101,31 +101,31 @@ namespace Org.BouncyCastle.Pqc.Crypto.Crystals.Dilithium
 
         }
 
-        public static bool UnpackSignature(PolyVecL z, PolyVecK h, byte[] sig, DilithiumEngine Engine)
+        public static bool UnpackSignature(PolyVecL z, PolyVecK h, byte[] sig, DilithiumEngine engine)
         {
             int i, j, k;
             
-            int end = DilithiumEngine.SeedBytes;
-            for (i = 0; i < Engine.L; ++i)
+            int end = engine.CTilde;
+            for (i = 0; i < engine.L; ++i)
             {
-                z.Vec[i].UnpackZ(Arrays.CopyOfRange(sig, end + i * Engine.PolyZPackedBytes, end + (i + 1) * Engine.PolyZPackedBytes));
+                z.Vec[i].UnpackZ(Arrays.CopyOfRange(sig, end + i * engine.PolyZPackedBytes, end + (i + 1) * engine.PolyZPackedBytes));
             }
-            end += Engine.L * Engine.PolyZPackedBytes;
+            end += engine.L * engine.PolyZPackedBytes;
 
             k = 0;
-            for (i = 0; i < Engine.K; ++i)
+            for (i = 0; i < engine.K; ++i)
             {
                 for (j = 0; j < DilithiumEngine.N; ++j)
                 {
                     h.Vec[i].Coeffs[j] = 0;
                 }
 
-                if ((sig[end + Engine.Omega + i] & 0xFF) < k || (sig[end + Engine.Omega + i] & 0xFF) > Engine.Omega)
+                if ((sig[end + engine.Omega + i] & 0xFF) < k || (sig[end + engine.Omega + i] & 0xFF) > engine.Omega)
                 {
                     return false;
                 }
 
-                for (j = k; j < (sig[end + Engine.Omega + i] & 0xFF); ++j)
+                for (j = k; j < (sig[end + engine.Omega + i] & 0xFF); ++j)
                 {
                     if (j > k && (sig[end + j] & 0xFF) <= (sig[end + j - 1] & 0xFF))
                     {
@@ -134,9 +134,9 @@ namespace Org.BouncyCastle.Pqc.Crypto.Crystals.Dilithium
                     h.Vec[i].Coeffs[sig[end + j] & 0xFF] = 1;
                 }
 
-                k = (int)(sig[end + Engine.Omega + i]);
+                k = (int)(sig[end + engine.Omega + i]);
             }
-            for (j = k; j < Engine.Omega; ++j)
+            for (j = k; j < engine.Omega; ++j)
             {
                 if ((sig[end + j] & 0xFF) != 0)
                 {