summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
authorDavid Hook <dgh@cryptoworkshop.com>2022-08-08 18:26:22 +1000
committerDavid Hook <dgh@cryptoworkshop.com>2022-08-08 18:26:22 +1000
commit936681fdad330fda0c4b283fc9f4541336771d9f (patch)
tree7f5497ddfd052795e7ba787783767b29200a9658 /crypto
parentInitial Falcon implementation (diff)
downloadBouncyCastle.NET-ed25519-936681fdad330fda0c4b283fc9f4541336771d9f.tar.xz
minor refactoring
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/pqc/crypto/falcon/FalconKeyGenerationParameters.cs4
-rw-r--r--crypto/src/pqc/crypto/falcon/FalconKeyPairGenerator.cs6
-rw-r--r--crypto/src/pqc/crypto/falcon/FalconKeyParameters.cs4
-rw-r--r--crypto/src/pqc/crypto/falcon/FalconSigner.cs12
-rw-r--r--crypto/test/src/pqc/crypto/test/FalconTest.cs2
5 files changed, 14 insertions, 14 deletions
diff --git a/crypto/src/pqc/crypto/falcon/FalconKeyGenerationParameters.cs b/crypto/src/pqc/crypto/falcon/FalconKeyGenerationParameters.cs
index 3531a6670..24255f240 100644
--- a/crypto/src/pqc/crypto/falcon/FalconKeyGenerationParameters.cs
+++ b/crypto/src/pqc/crypto/falcon/FalconKeyGenerationParameters.cs
@@ -14,9 +14,9 @@ namespace Org.BouncyCastle.Pqc.Crypto.Falcon
             this.parameters = parameters;
         }
 
-        public FalconParameters GetParameters()
+        public FalconParameters Parameters
         {
-            return this.parameters;
+            get { return this.parameters; }
         }
     }
 }
diff --git a/crypto/src/pqc/crypto/falcon/FalconKeyPairGenerator.cs b/crypto/src/pqc/crypto/falcon/FalconKeyPairGenerator.cs
index 018dcd3d2..d7e4e5539 100644
--- a/crypto/src/pqc/crypto/falcon/FalconKeyPairGenerator.cs
+++ b/crypto/src/pqc/crypto/falcon/FalconKeyPairGenerator.cs
@@ -19,8 +19,8 @@ namespace Org.BouncyCastle.Pqc.Crypto.Falcon
         {
             this.parameters = (FalconKeyGenerationParameters)param;
             this.random = param.Random;
-            this.logn = ((FalconKeyGenerationParameters)param).GetParameters().GetLogN();
-            this.noncelen = ((FalconKeyGenerationParameters)param).GetParameters().GetNonceLength();
+            this.logn = ((FalconKeyGenerationParameters)param).Parameters.LogN;
+            this.noncelen = ((FalconKeyGenerationParameters)param).Parameters.NonceLength;
             this.nist = new FalconNIST(random, logn, noncelen);
             int n = 1 << (int)this.logn;
             int sk_coeff_size = 8;
@@ -46,7 +46,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Falcon
             pk = new byte[pk_size];
             sk = new byte[sk_size];
             nist.crypto_sign_keypair(pk, 0, sk, 0);
-            FalconParameters p = ((FalconKeyGenerationParameters)this.parameters).GetParameters();
+            FalconParameters p = ((FalconKeyGenerationParameters)this.parameters).Parameters;
             FalconPrivateKeyParameters privk = new FalconPrivateKeyParameters(p, sk);
             FalconPublicKeyParameters pubk = new FalconPublicKeyParameters(p, pk);
             return new AsymmetricCipherKeyPair(pubk, privk);
diff --git a/crypto/src/pqc/crypto/falcon/FalconKeyParameters.cs b/crypto/src/pqc/crypto/falcon/FalconKeyParameters.cs
index 87b0eaec7..95a546994 100644
--- a/crypto/src/pqc/crypto/falcon/FalconKeyParameters.cs
+++ b/crypto/src/pqc/crypto/falcon/FalconKeyParameters.cs
@@ -14,9 +14,9 @@ namespace Org.BouncyCastle.Pqc.Crypto.Falcon
             this.parameters = parameters;
         }
 
-        public FalconParameters GetParameters()
+        public FalconParameters Parameters
         {
-            return parameters;
+            get { return parameters; }
         }
     }
 }
diff --git a/crypto/src/pqc/crypto/falcon/FalconSigner.cs b/crypto/src/pqc/crypto/falcon/FalconSigner.cs
index 8af2f4c93..4c2362503 100644
--- a/crypto/src/pqc/crypto/falcon/FalconSigner.cs
+++ b/crypto/src/pqc/crypto/falcon/FalconSigner.cs
@@ -23,8 +23,8 @@ namespace Org.BouncyCastle.Pqc.Crypto.Falcon
                     encodedkey = skparam.GetEncoded();
                     nist = new FalconNIST(
                         ((ParametersWithRandom)param).Random, 
-                        skparam.GetParameters().GetLogN(),
-                        skparam.GetParameters().GetNonceLength());
+                        skparam.Parameters.LogN,
+                        skparam.Parameters.NonceLength);
                 }
                 else
                 {
@@ -33,8 +33,8 @@ namespace Org.BouncyCastle.Pqc.Crypto.Falcon
                     nist = new FalconNIST(
                         new SecureRandom(),
                         // CryptoServicesRegistrar.GetSecureRandom(),
-                        skparam.GetParameters().GetLogN(),
-                        skparam.GetParameters().GetNonceLength()
+                        skparam.Parameters.LogN,
+                        skparam.Parameters.NonceLength
                         ); 
                         // TODO when CryptoServicesRegistrar has been implemented, use that instead
 
@@ -47,8 +47,8 @@ namespace Org.BouncyCastle.Pqc.Crypto.Falcon
                 nist = new FalconNIST(
                     new SecureRandom(),
                     // CryptoServicesRegistrar.GetSecureRandom()
-                    pkparam.GetParameters().GetLogN(),
-                    pkparam.GetParameters().GetNonceLength());
+                    pkparam.Parameters.LogN,
+                    pkparam.Parameters.NonceLength);
             }
         }
 
diff --git a/crypto/test/src/pqc/crypto/test/FalconTest.cs b/crypto/test/src/pqc/crypto/test/FalconTest.cs
index f923f699f..0c73dfcfd 100644
--- a/crypto/test/src/pqc/crypto/test/FalconTest.cs
+++ b/crypto/test/src/pqc/crypto/test/FalconTest.cs
@@ -80,7 +80,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Tests
                             FalconPublicKeyParameters pkparam = new FalconPublicKeyParameters(parameters[fileIndex], pk);
                             verifier.Init(false, pkparam);
                             byte[] noncesig = new byte[sm_len - m_len - 2 + 1];
-                            noncesig[0] = (byte)(0x30 + parameters[fileIndex].GetLogN());
+                            noncesig[0] = (byte)(0x30 + parameters[fileIndex].LogN);
                             Array.Copy(sm, 2, noncesig, 1, 40);
                             Array.Copy(sm, 2 + 40 + m_len, noncesig, 40 + 1, sm_len - 2 - 40 - m_len);
                             bool vrfyrespass = verifier.VerifySignature(msg, noncesig);