summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2013-12-17 19:16:20 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2013-12-17 19:16:20 +0700
commit53e57085de728ff9f23734f64e1a877ee39a327c (patch)
treef82964c348a778251b6cea473f048c84ae1b153c /crypto/src
parentMore porting from Java TLS, mainly enum replacement (diff)
downloadBouncyCastle.NET-ed25519-53e57085de728ff9f23734f64e1a877ee39a327c.tar.xz
Clean up all the special handling for IDEA stuff, back to a single release assembly.
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/AssemblyInfo.cs7
-rw-r--r--crypto/src/crypto/engines/IdeaEngine.cs46
-rw-r--r--crypto/src/security/CipherUtilities.cs4
-rw-r--r--crypto/src/security/MacUtilities.cs2
-rw-r--r--crypto/src/security/ParameterUtilities.cs6
5 files changed, 22 insertions, 43 deletions
diff --git a/crypto/src/AssemblyInfo.cs b/crypto/src/AssemblyInfo.cs
index 4e85daa95..ce84074f2 100644
--- a/crypto/src/AssemblyInfo.cs
+++ b/crypto/src/AssemblyInfo.cs
@@ -9,17 +9,12 @@ using System.Runtime.InteropServices;
 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
 //
-#if INCLUDE_IDEA
-[assembly: AssemblyTitle("BouncyCastle.CryptoExt")]
-[assembly: AssemblyDescription("Bouncy Castle Cryptography API (Extended)")]
-#else
 [assembly: AssemblyTitle("BouncyCastle.Crypto")]
 [assembly: AssemblyDescription("Bouncy Castle Cryptography API")]
-#endif
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("The Legion of the Bouncy Castle")]
 [assembly: AssemblyProduct("Bouncy Castle for .NET")]
-[assembly: AssemblyCopyright("Copyright (C) 2000-2011")]
+[assembly: AssemblyCopyright("Copyright (C) 2000-2013")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
diff --git a/crypto/src/crypto/engines/IdeaEngine.cs b/crypto/src/crypto/engines/IdeaEngine.cs
index f763c5939..46b5a787c 100644
--- a/crypto/src/crypto/engines/IdeaEngine.cs
+++ b/crypto/src/crypto/engines/IdeaEngine.cs
@@ -1,5 +1,3 @@
-#if INCLUDE_IDEA
-
 using System;
 
 using Org.BouncyCastle.Crypto.Parameters;
@@ -12,26 +10,26 @@ namespace Org.BouncyCastle.Crypto.Engines
     * This implementation is based on the "HOWTO: INTERNATIONAL DATA ENCRYPTION ALGORITHM"
     * implementation summary by Fauzan Mirza (F.U.Mirza@sheffield.ac.uk). (baring 1 typo at the
     * end of the mulinv function!).
-	* </p>
+    * </p>
     * <p>
     * It can be found at ftp://ftp.funet.fi/pub/crypt/cryptography/symmetric/idea/
-	* </p>
+    * </p>
     * <p>
-	* Note 1: This algorithm is patented in the USA, Japan, and Europe including
+    * Note 1: This algorithm is patented in the USA, Japan, and Europe including
     * at least Austria, France, Germany, Italy, Netherlands, Spain, Sweden, Switzerland
     * and the United Kingdom. Non-commercial use is free, however any commercial
     * products are liable for royalties. Please see
     * <a href="http://www.mediacrypt.com">www.mediacrypt.com</a> for
     * further details. This announcement has been included at the request of
     * the patent holders.
-	* </p>
-	* <p>
-	* Note 2: Due to the requests concerning the above, this algorithm is now only
-	* included in the extended assembly. It is not included in the default distributions.
-	* </p>
+    * </p>
+    * <p>
+    * Note 2: Due to the requests concerning the above, this algorithm is now only
+    * included in the extended assembly. It is not included in the default distributions.
+    * </p>
     */
     public class IdeaEngine
-		: IBlockCipher
+        : IBlockCipher
     {
         private const int  BLOCK_SIZE = 8;
         private int[] workingKey;
@@ -54,28 +52,28 @@ namespace Org.BouncyCastle.Crypto.Engines
             ICipherParameters	parameters)
         {
             if (!(parameters is KeyParameter))
-				throw new ArgumentException("invalid parameter passed to IDEA init - " + parameters.GetType().ToString());
+                throw new ArgumentException("invalid parameter passed to IDEA init - " + parameters.GetType().ToString());
 
-			workingKey = GenerateWorkingKey(forEncryption,
-				((KeyParameter)parameters).GetKey());
+            workingKey = GenerateWorkingKey(forEncryption,
+                ((KeyParameter)parameters).GetKey());
         }
 
-		public string AlgorithmName
+        public string AlgorithmName
         {
             get { return "IDEA"; }
         }
 
-		public bool IsPartialBlockOkay
-		{
-			get { return false; }
-		}
+        public bool IsPartialBlockOkay
+        {
+            get { return false; }
+        }
 
-		public int GetBlockSize()
+        public int GetBlockSize()
         {
             return BLOCK_SIZE;
         }
 
-		public int ProcessBlock(
+        public int ProcessBlock(
             byte[] input,
             int inOff,
             byte[] output,
@@ -228,7 +226,7 @@ namespace Org.BouncyCastle.Crypto.Engines
         * Common Divisor algorithm. Zero and one are self inverse.
         * <p>
         * i.e. x * MulInv(x) == 1 (modulo BASE)
-		* </p>
+        * </p>
         */
         private int MulInv(
             int x)
@@ -261,7 +259,7 @@ namespace Org.BouncyCastle.Crypto.Engines
         * Return the additive inverse of x.
         * <p>
         * i.e. x + AddInv(x) == 0
-		* </p>
+        * </p>
         */
         int AddInv(
             int x)
@@ -337,5 +335,3 @@ namespace Org.BouncyCastle.Crypto.Engines
         }
     }
 }
-
-#endif
diff --git a/crypto/src/security/CipherUtilities.cs b/crypto/src/security/CipherUtilities.cs
index cda769535..cdb711f69 100644
--- a/crypto/src/security/CipherUtilities.cs
+++ b/crypto/src/security/CipherUtilities.cs
@@ -389,11 +389,9 @@ namespace Org.BouncyCastle.Security
                 case CipherAlgorithm.HC256:
                     streamCipher = new HC256Engine();
                     break;
-#if INCLUDE_IDEA
                 case CipherAlgorithm.IDEA:
                     blockCipher = new IdeaEngine();
                     break;
-#endif
                 case CipherAlgorithm.NOEKEON:
                     blockCipher = new NoekeonEngine();
                     break;
@@ -716,9 +714,7 @@ namespace Org.BouncyCastle.Security
                 case CipherAlgorithm.DES: return new DesEngine();
                 case CipherAlgorithm.DESEDE: return new DesEdeEngine();
                 case CipherAlgorithm.GOST28147: return new Gost28147Engine();
-#if INCLUDE_IDEA
                 case CipherAlgorithm.IDEA: return new IdeaEngine();
-#endif
                 case CipherAlgorithm.NOEKEON: return new NoekeonEngine();
                 case CipherAlgorithm.RC2: return new RC2Engine();
                 case CipherAlgorithm.RC5: return new RC532Engine();
diff --git a/crypto/src/security/MacUtilities.cs b/crypto/src/security/MacUtilities.cs
index 49162fb57..77d141411 100644
--- a/crypto/src/security/MacUtilities.cs
+++ b/crypto/src/security/MacUtilities.cs
@@ -185,7 +185,6 @@ namespace Org.BouncyCastle.Security
             {
                 return new CfbBlockCipherMac(new SkipjackEngine());
             }
-#if INCLUDE_IDEA
             if (mechanism == "IDEAMAC")
             {
                 return new CbcBlockCipherMac(new IdeaEngine());
@@ -194,7 +193,6 @@ namespace Org.BouncyCastle.Security
             {
                 return new CfbBlockCipherMac(new IdeaEngine());
             }
-#endif
             if (mechanism == "RC2MAC")
             {
                 return new CbcBlockCipherMac(new RC2Engine());
diff --git a/crypto/src/security/ParameterUtilities.cs b/crypto/src/security/ParameterUtilities.cs
index bf448edff..b2d7c0dff 100644
--- a/crypto/src/security/ParameterUtilities.cs
+++ b/crypto/src/security/ParameterUtilities.cs
@@ -83,10 +83,8 @@ namespace Org.BouncyCastle.Security
                 CryptoProObjectIdentifiers.GostR28147Cbc);
             AddAlgorithm("HC128");
             AddAlgorithm("HC256");
-#if INCLUDE_IDEA
             AddAlgorithm("IDEA",
                 "1.3.6.1.4.1.188.7.1.1.2");
-#endif
             AddAlgorithm("NOEKEON");
             AddAlgorithm("RC2",
                 PkcsObjectIdentifiers.RC2Cbc,
@@ -234,12 +232,10 @@ namespace Org.BouncyCastle.Security
                 {
                     iv = Cast5CbcParameters.GetInstance(asn1Params).GetIV();
                 }
-#if INCLUDE_IDEA
                 else if (canonical == "IDEA")
                 {
                     iv = IdeaCbcPar.GetInstance(asn1Params).GetIV();
                 }
-#endif
                 else if (canonical == "RC2")
                 {
                     iv = RC2CbcParameter.GetInstance(asn1Params).GetIV();
@@ -288,10 +284,8 @@ namespace Org.BouncyCastle.Security
             if (canonical == "CAST5")
                 return new Cast5CbcParameters(CreateIV(random, 8), 128);
 
-#if INCLUDE_IDEA
             if (canonical == "IDEA")
                 return new IdeaCbcPar(CreateIV(random, 8));
-#endif
 
             if (canonical == "RC2")
                 return new RC2CbcParameter(CreateIV(random, 8));