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/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 ++++++++++++------------- 5 files changed, 59 insertions(+), 67 deletions(-) (limited to 'crypto/test') 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