summary refs log tree commit diff
path: root/crypto/src/pqc
diff options
context:
space:
mode:
authorDavid Hook <dgh@cryptoworkshop.com>2022-08-25 13:19:16 +1000
committerDavid Hook <dgh@cryptoworkshop.com>2022-08-25 13:19:16 +1000
commit76ade496e1aff673fcd4fd81de4ae2cee888a883 (patch)
tree1e63550a7db8bda97c60988ba807e39895a7cb6f /crypto/src/pqc
parentMerge remote-tracking branch 'refs/remotes/origin/master' (diff)
downloadBouncyCastle.NET-ed25519-76ade496e1aff673fcd4fd81de4ae2cee888a883.tar.xz
added EncapsulationLength property
Diffstat (limited to 'crypto/src/pqc')
-rw-r--r--crypto/src/pqc/crypto/cmce/CmceKemExtractor.cs5
-rw-r--r--crypto/src/pqc/crypto/crystals/kyber/KyberKEMExtractor.cs2
-rw-r--r--crypto/src/pqc/crypto/frodo/FrodoKEMExtractor.cs5
-rw-r--r--crypto/src/pqc/crypto/ntru/NtruKemExtractor.cs5
-rw-r--r--crypto/src/pqc/crypto/ntruprime/NtruLPRimeKemExtractor.cs6
-rw-r--r--crypto/src/pqc/crypto/ntruprime/SNtruPrimeKemExtractor.cs6
-rw-r--r--crypto/src/pqc/crypto/saber/SABERKEMExtractor.cs2
-rw-r--r--crypto/src/pqc/crypto/sike/Internal.cs2
-rw-r--r--crypto/src/pqc/crypto/sike/SIKEEngine.cs2
-rw-r--r--crypto/src/pqc/crypto/sike/SIKEKEMExtractor.cs5
10 files changed, 10 insertions, 30 deletions
diff --git a/crypto/src/pqc/crypto/cmce/CmceKemExtractor.cs b/crypto/src/pqc/crypto/cmce/CmceKemExtractor.cs
index 9bbdec17b..805dce7b6 100644
--- a/crypto/src/pqc/crypto/cmce/CmceKemExtractor.cs
+++ b/crypto/src/pqc/crypto/cmce/CmceKemExtractor.cs
@@ -39,9 +39,6 @@ namespace Org.BouncyCastle.Pqc.Crypto.Cmce
             return session_key;
         }
 
-        public int GetInputSize()
-        {
-            return engine.CipherTextSize;
-        }
+        public int EncapsulationLength => engine.CipherTextSize;
     }
 }
diff --git a/crypto/src/pqc/crypto/crystals/kyber/KyberKEMExtractor.cs b/crypto/src/pqc/crypto/crystals/kyber/KyberKEMExtractor.cs
index e916e5575..38b826f43 100644
--- a/crypto/src/pqc/crypto/crystals/kyber/KyberKEMExtractor.cs
+++ b/crypto/src/pqc/crypto/crystals/kyber/KyberKEMExtractor.cs
@@ -31,6 +31,6 @@ namespace Org.BouncyCastle.Pqc.Crypto.Crystals.Kyber
             return rv;
         }
 
-        public int InputSize => engine.CryptoCipherTextBytes;
+        public int EncapsulationLength => engine.CryptoCipherTextBytes;
     }
 }
\ No newline at end of file
diff --git a/crypto/src/pqc/crypto/frodo/FrodoKEMExtractor.cs b/crypto/src/pqc/crypto/frodo/FrodoKEMExtractor.cs
index 475879a8d..055fe3bc6 100644
--- a/crypto/src/pqc/crypto/frodo/FrodoKEMExtractor.cs
+++ b/crypto/src/pqc/crypto/frodo/FrodoKEMExtractor.cs
@@ -29,9 +29,6 @@ namespace Org.BouncyCastle.Pqc.Crypto.Frodo
             return session_key;
         }
 
-        public int GetInputSize()
-        {
-            return engine.CipherTextSize;
-        }
+        public int EncapsulationLength => (int)engine.CipherTextSize;
     }
 }
\ No newline at end of file
diff --git a/crypto/src/pqc/crypto/ntru/NtruKemExtractor.cs b/crypto/src/pqc/crypto/ntru/NtruKemExtractor.cs
index 4d730a3f1..aba22a0f4 100644
--- a/crypto/src/pqc/crypto/ntru/NtruKemExtractor.cs
+++ b/crypto/src/pqc/crypto/ntru/NtruKemExtractor.cs
@@ -79,9 +79,6 @@ namespace Org.BouncyCastle.Pqc.Crypto.Ntru
             }
         }
 
-        public int GetInputSize()
-        {
-            return _parameters.ParameterSet.NtruCiphertextBytes();
-        }
+        public int EncapsulationLength => _parameters.ParameterSet.NtruCiphertextBytes();
     }
 }
\ No newline at end of file
diff --git a/crypto/src/pqc/crypto/ntruprime/NtruLPRimeKemExtractor.cs b/crypto/src/pqc/crypto/ntruprime/NtruLPRimeKemExtractor.cs
index 34f152994..57dce2438 100644
--- a/crypto/src/pqc/crypto/ntruprime/NtruLPRimeKemExtractor.cs
+++ b/crypto/src/pqc/crypto/ntruprime/NtruLPRimeKemExtractor.cs
@@ -25,10 +25,6 @@ namespace Org.BouncyCastle.Pqc.Crypto.NtruPrime
             return session_key;
         }
 
-        public int GetInputSize()
-        {
-            return _primeEngine.CipherTextSize;
-        }
-        
+        public int EncapsulationLength => _primeEngine.CipherTextSize;
     }
 }
diff --git a/crypto/src/pqc/crypto/ntruprime/SNtruPrimeKemExtractor.cs b/crypto/src/pqc/crypto/ntruprime/SNtruPrimeKemExtractor.cs
index 15f144ac2..2229599e1 100644
--- a/crypto/src/pqc/crypto/ntruprime/SNtruPrimeKemExtractor.cs
+++ b/crypto/src/pqc/crypto/ntruprime/SNtruPrimeKemExtractor.cs
@@ -25,10 +25,6 @@ namespace Org.BouncyCastle.Pqc.Crypto.NtruPrime
             return session_key;
         }
 
-        public int GetInputSize()
-        {
-            return _primeEngine.CipherTextSize;
-        }
-        
+        public int EncapsulationLength => _primeEngine.CipherTextSize;
     }
 }
diff --git a/crypto/src/pqc/crypto/saber/SABERKEMExtractor.cs b/crypto/src/pqc/crypto/saber/SABERKEMExtractor.cs
index 6fe447e80..83d6f9d65 100644
--- a/crypto/src/pqc/crypto/saber/SABERKEMExtractor.cs
+++ b/crypto/src/pqc/crypto/saber/SABERKEMExtractor.cs
@@ -28,6 +28,6 @@ namespace Org.BouncyCastle.Pqc.Crypto.Saber
             return session_key;
         }
 
-        public int InputSize => engine.GetCipherTextSize();
+        public int EncapsulationLength => engine.GetCipherTextSize();
     }
 }
\ No newline at end of file
diff --git a/crypto/src/pqc/crypto/sike/Internal.cs b/crypto/src/pqc/crypto/sike/Internal.cs
index 6835185f0..06df0a202 100644
--- a/crypto/src/pqc/crypto/sike/Internal.cs
+++ b/crypto/src/pqc/crypto/sike/Internal.cs
@@ -14,7 +14,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Sike
                 protected internal static uint LOG2RADIX = 6;
 
                 protected internal uint CRYPTO_PUBLICKEYBYTES;
-                protected internal uint CRYPTO_CIPHERTEXTBYTES;
+                protected internal int CRYPTO_CIPHERTEXTBYTES;
                 protected internal uint CRYPTO_BYTES;
                 protected internal uint CRYPTO_SECRETKEYBYTES;
 
diff --git a/crypto/src/pqc/crypto/sike/SIKEEngine.cs b/crypto/src/pqc/crypto/sike/SIKEEngine.cs
index 638087688..de1ed1ed5 100644
--- a/crypto/src/pqc/crypto/sike/SIKEEngine.cs
+++ b/crypto/src/pqc/crypto/sike/SIKEEngine.cs
@@ -21,7 +21,7 @@ internal class SIKEEngine
         return param.MSG_BYTES * 8;
     }
 
-    public uint GetCipherTextSize()
+    public int GetCipherTextSize()
     {
         return param.CRYPTO_CIPHERTEXTBYTES;
     }
diff --git a/crypto/src/pqc/crypto/sike/SIKEKEMExtractor.cs b/crypto/src/pqc/crypto/sike/SIKEKEMExtractor.cs
index 3915e8890..144b4649f 100644
--- a/crypto/src/pqc/crypto/sike/SIKEKEMExtractor.cs
+++ b/crypto/src/pqc/crypto/sike/SIKEKEMExtractor.cs
@@ -36,10 +36,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Sike
         return session_key;
     }
 
-//    public int GetInputSize()
-//    {
-//        return engine.GetCipherTextSize();
-//    }
+        public int EncapsulationLength => (int)engine.GetCipherTextSize();
 
     }