From 36c38833a1c137ee55ffa44e12df0f65f87456ad Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Thu, 2 Feb 2023 10:12:55 +0700 Subject: Cleanup warnings --- crypto/src/crypto/digests/PhotonBeetleDigest.cs | 20 ++++++------- crypto/src/crypto/engines/AsconEngine.cs | 23 +++++++-------- crypto/src/crypto/engines/ElephantEngine.cs | 16 +++++----- crypto/src/crypto/engines/ISAPEngine.cs | 24 +++++++-------- crypto/src/crypto/engines/PhotonBeetleEngine.cs | 20 +++++++------ crypto/src/crypto/engines/XoodyakEngine.cs | 16 +++++----- crypto/test/src/crypto/test/AsconTest.cs | 30 +++++++++---------- crypto/test/src/crypto/test/ElephantTest.cs | 19 ++++++------ crypto/test/src/crypto/test/ISAPTest.cs | 4 +-- crypto/test/src/crypto/test/PhotonBeetleTest.cs | 34 ++++++++++----------- crypto/test/src/crypto/test/XoodyakTest.cs | 39 ++++++++++++------------- 11 files changed, 120 insertions(+), 125 deletions(-) diff --git a/crypto/src/crypto/digests/PhotonBeetleDigest.cs b/crypto/src/crypto/digests/PhotonBeetleDigest.cs index e0961cc3f..13b30e025 100644 --- a/crypto/src/crypto/digests/PhotonBeetleDigest.cs +++ b/crypto/src/crypto/digests/PhotonBeetleDigest.cs @@ -1,19 +1,19 @@ using System; using System.IO; -using Org.BouncyCastle.Crypto.Utilities; -using Org.BouncyCastle.Utilities; -/** - * Photon-Beetle, https://www.isical.ac.in/~lightweight/beetle/ - * https://csrc.nist.gov/CSRC/media/Projects/lightweight-cryptography/documents/readonlyist-round/updated-spec-doc/photon-beetle-spec-readonly.pdf - *

- * Photon-Beetle with reference to C Reference Impl from: https://github.com/PHOTON-Beetle/Software - *

- */ +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Digests { - public class PhotonBeetleDigest : IDigest + /** + * Photon-Beetle, https://www.isical.ac.in/~lightweight/beetle/ + * https://csrc.nist.gov/CSRC/media/Projects/lightweight-cryptography/documents/readonlyist-round/updated-spec-doc/photon-beetle-spec-readonly.pdf + *

+ * Photon-Beetle with reference to C Reference Impl from: https://github.com/PHOTON-Beetle/Software + *

+ */ + public class PhotonBeetleDigest + : IDigest { private byte[] state; private byte[][] state_2d; diff --git a/crypto/src/crypto/engines/AsconEngine.cs b/crypto/src/crypto/engines/AsconEngine.cs index c3091b9ef..281c4b0df 100644 --- a/crypto/src/crypto/engines/AsconEngine.cs +++ b/crypto/src/crypto/engines/AsconEngine.cs @@ -1,21 +1,20 @@ using System; using System.IO; + using Org.BouncyCastle.Crypto.Modes; using Org.BouncyCastle.Crypto.Parameters; -using Org.BouncyCastle.Crypto.Utilities; -using Org.BouncyCastle.Utilities; -using static Org.BouncyCastle.Tls.DtlsReliableHandshake; - -/** -* ASCON AEAD v1.2, https://ascon.iaik.tugraz.at/ -* https://csrc.nist.gov/CSRC/media/Projects/lightweight-cryptography/documents/finalist-round/updated-spec-doc/ascon-spec-final.pdf -*

-* ASCON AEAD v1.2 with reference to C Reference Impl from: https://github.com/ascon/ascon-c -*

-*/ + namespace Org.BouncyCastle.Crypto.Engines { - public class AsconEngine : IAeadBlockCipher + /** + * ASCON AEAD v1.2, https://ascon.iaik.tugraz.at/ + * https://csrc.nist.gov/CSRC/media/Projects/lightweight-cryptography/documents/finalist-round/updated-spec-doc/ascon-spec-final.pdf + *

+ * ASCON AEAD v1.2 with reference to C Reference Impl from: https://github.com/ascon/ascon-c + *

+ */ + public class AsconEngine + : IAeadBlockCipher { public enum AsconParameters { diff --git a/crypto/src/crypto/engines/ElephantEngine.cs b/crypto/src/crypto/engines/ElephantEngine.cs index e3d9ca670..d5f05f658 100644 --- a/crypto/src/crypto/engines/ElephantEngine.cs +++ b/crypto/src/crypto/engines/ElephantEngine.cs @@ -1,18 +1,19 @@ using System; using System.IO; + using Org.BouncyCastle.Crypto.Modes; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Utilities; - -/** - * Elephant AEAD v2, based on the current round 3 submission, https://www.esat.kuleuven.be/cosic/elephant/ - * Reference C implementation: https://github.com/TimBeyne/Elephant - * Specification: https://csrc.nist.gov/CSRC/media/Projects/lightweight-cryptography/documents/finalist-round/updated-spec-doc/elephant-spec-final.pdf - */ namespace Org.BouncyCastle.Crypto.Engines { - public class ElephantEngine : IAeadBlockCipher + /** + * Elephant AEAD v2, based on the current round 3 submission, https://www.esat.kuleuven.be/cosic/elephant/ + * Reference C implementation: https://github.com/TimBeyne/Elephant + * Specification: https://csrc.nist.gov/CSRC/media/Projects/lightweight-cryptography/documents/finalist-round/updated-spec-doc/elephant-spec-final.pdf + */ + public class ElephantEngine + : IAeadBlockCipher { public enum ElephantParameters { @@ -20,6 +21,7 @@ namespace Org.BouncyCastle.Crypto.Engines elephant176, elephant200 } + private bool forEncryption; private readonly string algorithmName; private ElephantParameters parameters; diff --git a/crypto/src/crypto/engines/ISAPEngine.cs b/crypto/src/crypto/engines/ISAPEngine.cs index 3745f3ae9..0280b1ce1 100644 --- a/crypto/src/crypto/engines/ISAPEngine.cs +++ b/crypto/src/crypto/engines/ISAPEngine.cs @@ -1,23 +1,21 @@ using System; using System.IO; + using Org.BouncyCastle.Crypto.Modes; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Utilities; -using Org.BouncyCastle.Utilities; -using static Org.BouncyCastle.Tls.DtlsReliableHandshake; - - -/** - * ISAP AEAD v2, https://isap.iaik.tugraz.at/ - * https://csrc.nist.gov/CSRC/media/Projects/lightweight-cryptography/documents/constist-round/updated-spec-doc/isap-spec-const.pdf - *

- * ISAP AEAD v2 with reference to C Reference Impl from: https://github.com/isap-lwc/isap-code-package - *

- */ namespace Org.BouncyCastle.Crypto.Engines { - public class ISAPEngine : IAeadBlockCipher + /** + * ISAP AEAD v2, https://isap.iaik.tugraz.at/ + * https://csrc.nist.gov/CSRC/media/Projects/lightweight-cryptography/documents/constist-round/updated-spec-doc/isap-spec-const.pdf + *

+ * ISAP AEAD v2 with reference to C Reference Impl from: https://github.com/isap-lwc/isap-code-package + *

+ */ + public class ISAPEngine + : IAeadBlockCipher { public enum IsapType { @@ -821,7 +819,7 @@ namespace Org.BouncyCastle.Crypto.Engines "ISAP AEAD key must be 128 bits ulong"); } - /** + /* * Initialize variables. */ byte[] npub = new byte[iv.Length]; diff --git a/crypto/src/crypto/engines/PhotonBeetleEngine.cs b/crypto/src/crypto/engines/PhotonBeetleEngine.cs index 9245faa27..0d5728a76 100644 --- a/crypto/src/crypto/engines/PhotonBeetleEngine.cs +++ b/crypto/src/crypto/engines/PhotonBeetleEngine.cs @@ -1,25 +1,27 @@ using System; using System.IO; + using Org.BouncyCastle.Crypto.Modes; using Org.BouncyCastle.Crypto.Parameters; -/** - * Photon-Beetle, https://www.isical.ac.in/~lightweight/beetle/ - * https://csrc.nist.gov/CSRC/media/Projects/lightweight-cryptography/documents/readonlyist-round/updated-spec-doc/photon-beetle-spec-readonly.pdf - *

- * Photon-Beetle with reference to C Reference Impl from: https://github.com/PHOTON-Beetle/Software - *

- */ - namespace Org.BouncyCastle.Crypto.Engines { - public class PhotonBeetleEngine : IAeadBlockCipher + /** + * Photon-Beetle, https://www.isical.ac.in/~lightweight/beetle/ + * https://csrc.nist.gov/CSRC/media/Projects/lightweight-cryptography/documents/readonlyist-round/updated-spec-doc/photon-beetle-spec-readonly.pdf + *

+ * Photon-Beetle with reference to C Reference Impl from: https://github.com/PHOTON-Beetle/Software + *

+ */ + public class PhotonBeetleEngine + : IAeadBlockCipher { public enum PhotonBeetleParameters { pb32, pb128 } + private bool input_empty; private bool forEncryption; private bool initialised; diff --git a/crypto/src/crypto/engines/XoodyakEngine.cs b/crypto/src/crypto/engines/XoodyakEngine.cs index fb4f074ee..caf49e53c 100644 --- a/crypto/src/crypto/engines/XoodyakEngine.cs +++ b/crypto/src/crypto/engines/XoodyakEngine.cs @@ -5,15 +5,17 @@ using Org.BouncyCastle.Crypto.Modes; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Utilities; using Org.BouncyCastle.Utilities; -/** -* Xoodyak v1, https://csrc.nist.gov/CSRC/media/Projects/lightweight-cryptography/documents/finalist-round/updated-spec-doc/xoodyak-spec-final.pdf -*

-* Xoodyak with reference to C Reference Impl from: https://github.com/XKCP/XKCP -*

-*/ + namespace Org.BouncyCastle.Crypto.Engines { - public sealed class XoodyakEngine : IAeadBlockCipher + /** + * Xoodyak v1, https://csrc.nist.gov/CSRC/media/Projects/lightweight-cryptography/documents/finalist-round/updated-spec-doc/xoodyak-spec-final.pdf + *

+ * Xoodyak with reference to C Reference Impl from: https://github.com/XKCP/XKCP + *

+*/ + public sealed class XoodyakEngine + : IAeadBlockCipher { private bool forEncryption; private byte[] state; diff --git a/crypto/test/src/crypto/test/AsconTest.cs b/crypto/test/src/crypto/test/AsconTest.cs index bc40bcdaa..837dc413b 100644 --- a/crypto/test/src/crypto/test/AsconTest.cs +++ b/crypto/test/src/crypto/test/AsconTest.cs @@ -128,7 +128,7 @@ namespace Org.BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessBytes(m, 0, m.Length, c1, 0); Assert.Fail(aeadBlockCipher.AlgorithmName + " need to be initialed before ProcessBytes"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -138,7 +138,7 @@ namespace Org.BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessByte((byte)0, c1, 0); Assert.Fail(aeadBlockCipher.AlgorithmName + " need to be initialed before ProcessByte"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -148,7 +148,7 @@ namespace Org.BouncyCastle.Crypto.Tests aeadBlockCipher.Reset(); Assert.Fail(aeadBlockCipher.AlgorithmName + " need to be initialed before reset"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -158,7 +158,7 @@ namespace Org.BouncyCastle.Crypto.Tests aeadBlockCipher.DoFinal(c1, m.Length); Assert.Fail(aeadBlockCipher.AlgorithmName + " need to be initialed before dofinal"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -169,7 +169,7 @@ namespace Org.BouncyCastle.Crypto.Tests aeadBlockCipher.GetOutputSize(0); aeadBlockCipher.GetUpdateOutputSize(0); } - catch (ArgumentException e) + catch (ArgumentException) { //expected Assert.Fail(aeadBlockCipher.AlgorithmName + " functions can be called before initialisation"); @@ -185,7 +185,7 @@ namespace Org.BouncyCastle.Crypto.Tests aeadBlockCipher.Init(true, new ParametersWithIV(new KeyParameter(k1), iv)); Assert.Fail(aeadBlockCipher.AlgorithmName + " k size does not match"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -194,7 +194,7 @@ namespace Org.BouncyCastle.Crypto.Tests aeadBlockCipher.Init(true, new ParametersWithIV(new KeyParameter(k), iv1)); Assert.Fail(aeadBlockCipher.AlgorithmName + "iv size does not match"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -205,7 +205,7 @@ namespace Org.BouncyCastle.Crypto.Tests { aeadBlockCipher.DoFinal(c1, m.Length); } - catch (Exception e) + catch (Exception) { Assert.Fail(aeadBlockCipher.AlgorithmName + " allows no input for AAD and plaintext"); } @@ -232,7 +232,7 @@ namespace Org.BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessAadByte((byte)0); Assert.Fail("ProcessAadByte(s) cannot be called after encryption/decryption"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -241,7 +241,7 @@ namespace Org.BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessAadBytes(new byte[] { 0 }, 0, 1); Assert.Fail("ProcessAadByte(s) cannot be called once only"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -252,7 +252,7 @@ namespace Org.BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessAadBytes(new byte[] { 0 }, 1, 1); Assert.Fail("input for ProcessAadBytes is too short"); } - catch (DataLengthException e) + catch (DataLengthException) { //expected } @@ -261,7 +261,7 @@ namespace Org.BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessBytes(new byte[] { 0 }, 1, 1, c1, 0); Assert.Fail("input for ProcessBytes is too short"); } - catch (DataLengthException e) + catch (DataLengthException) { //expected } @@ -270,7 +270,7 @@ namespace Org.BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessBytes(new byte[16], 0, 16, new byte[16], 8); Assert.Fail("output for ProcessBytes is too short"); } - catch (OutputLengthException e) + catch (OutputLengthException) { //expected } @@ -279,7 +279,7 @@ namespace Org.BouncyCastle.Crypto.Tests aeadBlockCipher.DoFinal(new byte[2], 2); Assert.Fail("output for dofinal is too short"); } - catch (DataLengthException e) + catch (DataLengthException) { //expected } @@ -339,7 +339,7 @@ namespace Org.BouncyCastle.Crypto.Tests aeadBlockCipher.DoFinal(m4, offset); Assert.Fail("The decryption should fail"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected; } diff --git a/crypto/test/src/crypto/test/ElephantTest.cs b/crypto/test/src/crypto/test/ElephantTest.cs index 8d12a20e0..1cf72e5bf 100644 --- a/crypto/test/src/crypto/test/ElephantTest.cs +++ b/crypto/test/src/crypto/test/ElephantTest.cs @@ -46,7 +46,6 @@ namespace BouncyCastle.Crypto.Tests { string line; string[] data; - byte[] ptByte, adByte; byte[] rv; Dictionary map = new Dictionary(); while ((line = src.ReadLine()) != null) @@ -155,7 +154,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.DoFinal(c1, m.Length); Assert.Fail(aeadBlockCipher.AlgorithmName + " need to be initialed before dofinal"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -166,7 +165,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.GetOutputSize(0); aeadBlockCipher.GetUpdateOutputSize(0); } - catch (ArgumentException e) + catch (ArgumentException) { //expected Assert.Fail(aeadBlockCipher.AlgorithmName + " functions can be called before initialisation"); @@ -182,7 +181,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.Init(true, new ParametersWithIV(new KeyParameter(k1), iv)); Assert.Fail(aeadBlockCipher.AlgorithmName + " k size does not match"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -191,7 +190,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.Init(true, new ParametersWithIV(new KeyParameter(k), iv1)); Assert.Fail(aeadBlockCipher.AlgorithmName + "iv size does not match"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -202,7 +201,7 @@ namespace BouncyCastle.Crypto.Tests { aeadBlockCipher.DoFinal(c1, m.Length); } - catch (Exception e) + catch (Exception) { Assert.Fail(aeadBlockCipher.AlgorithmName + " allows no input for AAD and plaintext"); } @@ -249,7 +248,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessAadBytes(new byte[] { 0 }, 1, 1); Assert.Fail("input for ProcessAadBytes is too short"); } - catch (DataLengthException e) + catch (DataLengthException) { //expected } @@ -258,7 +257,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessBytes(new byte[] { 0 }, 1, 1, c1, 0); Assert.Fail("input for ProcessBytes is too short"); } - catch (DataLengthException e) + catch (DataLengthException) { //expected } @@ -276,7 +275,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.DoFinal(new byte[2], 2); Assert.Fail("output for dofinal is too short"); } - catch (DataLengthException e) + catch (DataLengthException) { //expected } @@ -336,7 +335,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.DoFinal(m4, offset); Assert.Fail("The decryption should fail"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected; } diff --git a/crypto/test/src/crypto/test/ISAPTest.cs b/crypto/test/src/crypto/test/ISAPTest.cs index 35c19702e..f38722e4a 100644 --- a/crypto/test/src/crypto/test/ISAPTest.cs +++ b/crypto/test/src/crypto/test/ISAPTest.cs @@ -58,7 +58,6 @@ namespace Org.BouncyCastle.Crypto.Tests { string line; string[] data; - byte[] ptByte, adByte; byte[] rv; Dictionary map = new Dictionary(); while ((line = src.ReadLine()) != null) @@ -127,8 +126,7 @@ namespace Org.BouncyCastle.Crypto.Tests { string line; string[] data; - byte[] ptByte, adByte; - byte[] rv; + byte[] ptByte; Dictionary map = new Dictionary(); while ((line = src.ReadLine()) != null) { diff --git a/crypto/test/src/crypto/test/PhotonBeetleTest.cs b/crypto/test/src/crypto/test/PhotonBeetleTest.cs index f4f5cfbdc..77a840825 100644 --- a/crypto/test/src/crypto/test/PhotonBeetleTest.cs +++ b/crypto/test/src/crypto/test/PhotonBeetleTest.cs @@ -46,7 +46,6 @@ namespace BouncyCastle.Crypto.Tests { string line; string[] data; - byte[] ptByte, adByte; byte[] rv; Dictionary map = new Dictionary(); while ((line = src.ReadLine()) != null) @@ -121,8 +120,7 @@ namespace BouncyCastle.Crypto.Tests { string line; string[] data; - byte[] ptByte, adByte; - byte[] rv; + byte[] ptByte; Dictionary map = new Dictionary(); while ((line = src.ReadLine()) != null) { @@ -187,7 +185,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.Reset(); Assert.Fail(aeadBlockCipher.AlgorithmName + " need to be initialed before reset"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -197,7 +195,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.DoFinal(c1, m.Length); Assert.Fail(aeadBlockCipher.AlgorithmName + " need to be initialed before dofinal"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -208,7 +206,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.GetOutputSize(0); aeadBlockCipher.GetUpdateOutputSize(0); } - catch (ArgumentException e) + catch (ArgumentException) { //expected Assert.Fail(aeadBlockCipher.AlgorithmName + " functions can be called before initialisation"); @@ -224,7 +222,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.Init(true, new ParametersWithIV(new KeyParameter(k1), iv)); Assert.Fail(aeadBlockCipher.AlgorithmName + " k size does not match"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -233,7 +231,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.Init(true, new ParametersWithIV(new KeyParameter(k), iv1)); Assert.Fail(aeadBlockCipher.AlgorithmName + "iv size does not match"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -244,7 +242,7 @@ namespace BouncyCastle.Crypto.Tests { aeadBlockCipher.DoFinal(c1, m.Length); } - catch (Exception e) + catch (Exception) { Assert.Fail(aeadBlockCipher.AlgorithmName + " allows no input for AAD and plaintext"); } @@ -271,7 +269,7 @@ namespace BouncyCastle.Crypto.Tests // aeadBlockCipher.ProcessAadByte((byte)0); // Assert.Fail("ProcessAadByte(s) cannot be called after encryption/decryption"); //} - //catch (ArgumentException e) + //catch (ArgumentException) //{ // //expected //} @@ -280,7 +278,7 @@ namespace BouncyCastle.Crypto.Tests // aeadBlockCipher.ProcessAadBytes(new byte[] { 0 }, 0, 1); // Assert.Fail("ProcessAadByte(s) cannot be called once only"); //} - //catch (ArgumentException e) + //catch (ArgumentException) //{ // //expected //} @@ -291,7 +289,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessAadBytes(new byte[] { 0 }, 1, 1); Assert.Fail("input for ProcessAadBytes is too short"); } - catch (DataLengthException e) + catch (DataLengthException) { //expected } @@ -300,7 +298,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessBytes(new byte[] { 0 }, 1, 1, c1, 0); Assert.Fail("input for ProcessBytes is too short"); } - catch (DataLengthException e) + catch (DataLengthException) { //expected } @@ -309,7 +307,7 @@ namespace BouncyCastle.Crypto.Tests // aeadBlockCipher.ProcessBytes(new byte[blocksize], 0, blocksize, new byte[blocksize], blocksize >> 1); // Assert.Fail("output for ProcessBytes is too short"); //} - //catch (OutputLengthException e) + //catch (OutputLengthException) //{ // //expected //} @@ -318,7 +316,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.DoFinal(new byte[2], 2); Assert.Fail("output for dofinal is too short"); } - catch (DataLengthException e) + catch (DataLengthException) { //expected } @@ -378,7 +376,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.DoFinal(m4, offset); Assert.Fail("The decryption should fail"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected; } @@ -479,7 +477,7 @@ namespace BouncyCastle.Crypto.Tests digest.BlockUpdate(new byte[1], 1, 1); Assert.Fail(digest.AlgorithmName + ": input for update is too short"); } - catch (DataLengthException e) + catch (DataLengthException) { //expected } @@ -488,7 +486,7 @@ namespace BouncyCastle.Crypto.Tests digest.DoFinal(new byte[digest.GetDigestSize() - 1], 2); Assert.Fail(digest.AlgorithmName + ": output for dofinal is too short"); } - catch (DataLengthException e) + catch (DataLengthException) { //expected } diff --git a/crypto/test/src/crypto/test/XoodyakTest.cs b/crypto/test/src/crypto/test/XoodyakTest.cs index 998478c4d..de0988b0e 100644 --- a/crypto/test/src/crypto/test/XoodyakTest.cs +++ b/crypto/test/src/crypto/test/XoodyakTest.cs @@ -42,7 +42,6 @@ namespace BouncyCastle.Crypto.Tests { string line; string[] data; - byte[] ptByte, adByte; byte[] rv; Dictionary map = new Dictionary(); while ((line = src.ReadLine()) != null) @@ -104,15 +103,13 @@ namespace BouncyCastle.Crypto.Tests private void testVectorsHash() { XoodyakDigest xoodyak = new XoodyakDigest(); - ICipherParameters param; var buf = new Dictionary(); //TestSampler sampler = new TestSampler(); using (var src = new StreamReader(SimpleTest.GetTestDataAsStream("crypto.xoodyak.LWC_HASH_KAT_256.txt"))) { string line; string[] data; - byte[] ptByte, adByte; - byte[] rv; + byte[] ptByte; Dictionary map = new Dictionary(); while ((line = src.ReadLine()) != null) { @@ -157,7 +154,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessBytes(m, 0, m.Length, c1, 0); Assert.Fail(aeadBlockCipher.AlgorithmName + " need to be initialed before ProcessBytes"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -167,7 +164,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessByte((byte)0, c1, 0); Assert.Fail(aeadBlockCipher.AlgorithmName + " need to be initialed before ProcessByte"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -177,7 +174,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.Reset(); Assert.Fail(aeadBlockCipher.AlgorithmName + " need to be initialed before reset"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -187,7 +184,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.DoFinal(c1, m.Length); Assert.Fail(aeadBlockCipher.AlgorithmName + " need to be initialed before dofinal"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -198,7 +195,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.GetOutputSize(0); aeadBlockCipher.GetUpdateOutputSize(0); } - catch (ArgumentException e) + catch (ArgumentException) { //expected Assert.Fail(aeadBlockCipher.AlgorithmName + " functions can be called before initialisation"); @@ -214,7 +211,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.Init(true, new ParametersWithIV(new KeyParameter(k1), iv)); Assert.Fail(aeadBlockCipher.AlgorithmName + " k size does not match"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -223,7 +220,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.Init(true, new ParametersWithIV(new KeyParameter(k), iv1)); Assert.Fail(aeadBlockCipher.AlgorithmName + "iv size does not match"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -234,7 +231,7 @@ namespace BouncyCastle.Crypto.Tests { aeadBlockCipher.DoFinal(c1, m.Length); } - catch (Exception e) + catch (Exception) { Assert.Fail(aeadBlockCipher.AlgorithmName + " allows no input for AAD and plaintext"); } @@ -261,7 +258,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessAadByte((byte)0); Assert.Fail("ProcessAadByte(s) cannot be called after encryption/decryption"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -270,7 +267,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessAadBytes(new byte[] { 0 }, 0, 1); Assert.Fail("ProcessAadByte(s) cannot be called once only"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected } @@ -281,7 +278,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessAadBytes(new byte[] { 0 }, 1, 1); Assert.Fail("input for ProcessAadBytes is too short"); } - catch (DataLengthException e) + catch (DataLengthException) { //expected } @@ -290,7 +287,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessBytes(new byte[] { 0 }, 1, 1, c1, 0); Assert.Fail("input for ProcessBytes is too short"); } - catch (DataLengthException e) + catch (DataLengthException) { //expected } @@ -299,7 +296,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.ProcessBytes(new byte[blocksize], 0, blocksize, new byte[blocksize], blocksize >> 1); Assert.Fail("output for ProcessBytes is too short"); } - catch (OutputLengthException e) + catch (OutputLengthException) { //expected } @@ -308,7 +305,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.DoFinal(new byte[2], 2); Assert.Fail("output for dofinal is too short"); } - catch (DataLengthException e) + catch (DataLengthException) { //expected } @@ -368,7 +365,7 @@ namespace BouncyCastle.Crypto.Tests aeadBlockCipher.DoFinal(m4, offset); Assert.Fail("The decryption should fail"); } - catch (ArgumentException e) + catch (ArgumentException) { //expected; } @@ -469,7 +466,7 @@ namespace BouncyCastle.Crypto.Tests digest.BlockUpdate(new byte[1], 1, 1); Assert.Fail(digest.AlgorithmName + ": input for update is too short"); } - catch (DataLengthException e) + catch (DataLengthException) { //expected } @@ -478,7 +475,7 @@ namespace BouncyCastle.Crypto.Tests digest.DoFinal(new byte[digest.GetDigestSize() - 1], 2); Assert.Fail(digest.AlgorithmName + ": output for dofinal is too short"); } - catch (DataLengthException e) + catch (DataLengthException) { //expected } -- cgit 1.4.1