summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
authorroyb <roy.basmacier@primekey.com>2024-06-06 13:55:52 -0400
committerroyb <roy.basmacier@primekey.com>2024-06-06 13:55:52 -0400
commitc70b82eeb8e413f37e13857669bdfb001990a9e7 (patch)
tree56afdd0ef6ec8a52b8dcfda8b4bad488e0f0c4a4 /crypto/src
parentNerdbank.GitVersioning 3.6.139 (diff)
downloadBouncyCastle.NET-ed25519-c70b82eeb8e413f37e13857669bdfb001990a9e7.tar.xz
Dilithium SampleInBall change and KATs updated
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/pqc/crypto/crystals/dilithium/DilithiumEngine.cs4
-rw-r--r--crypto/src/pqc/crypto/crystals/dilithium/Poly.cs2
2 files changed, 3 insertions, 3 deletions
diff --git a/crypto/src/pqc/crypto/crystals/dilithium/DilithiumEngine.cs b/crypto/src/pqc/crypto/crystals/dilithium/DilithiumEngine.cs
index 9bbdcdad4..2f37887d7 100644
--- a/crypto/src/pqc/crypto/crystals/dilithium/DilithiumEngine.cs
+++ b/crypto/src/pqc/crypto/crystals/dilithium/DilithiumEngine.cs
@@ -109,7 +109,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Crystals.Dilithium
             _random = random;
             PolyVecHPackedBytes = Omega + K;
             CryptoPublicKeyBytes = SeedBytes + K * PolyT1PackedBytes;
-            CryptoSecretKeyBytes = 3 * SeedBytes + L * PolyEtaPackedBytes + K * PolyEtaPackedBytes + K * PolyT0PackedBytes;
+            CryptoSecretKeyBytes = 2 * SeedBytes + TrBytes + L * PolyEtaPackedBytes + K * PolyEtaPackedBytes + K * PolyT0PackedBytes;
             CryptoBytes = CTilde + L * PolyZPackedBytes + PolyVecHPackedBytes;
 
             if (Gamma1 == (1 << 17))
@@ -237,7 +237,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Crystals.Dilithium
             ShakeDigest256.BlockUpdate(sig, 0, K * PolyW1PackedBytes);
             ShakeDigest256.OutputFinal(sig, 0, CTilde);
 
-            cp.Challenge(sig); // use only first SeedBytes of sig
+            cp.Challenge(sig); // use only first CTilde of sig
 
             cp.PolyNtt();
 
diff --git a/crypto/src/pqc/crypto/crystals/dilithium/Poly.cs b/crypto/src/pqc/crypto/crystals/dilithium/Poly.cs
index eb209f8a2..eb08daaca 100644
--- a/crypto/src/pqc/crypto/crystals/dilithium/Poly.cs
+++ b/crypto/src/pqc/crypto/crystals/dilithium/Poly.cs
@@ -590,7 +590,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Crystals.Dilithium
             byte[] buf = new byte[Symmetric.Stream256BlockBytes];
 
             ShakeDigest ShakeDigest256 = new ShakeDigest(256);
-            ShakeDigest256.BlockUpdate(seed, 0, DilithiumEngine.SeedBytes);
+            ShakeDigest256.BlockUpdate(seed, 0, Engine.CTilde);
             ShakeDigest256.Output(buf, 0, Symmetric.Stream256BlockBytes);
 
             signs = 0;