From 1a1a6a635dc952520d6b90f411554b7d44e32954 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Mon, 17 Oct 2022 17:45:51 +0700 Subject: System.Linq cleanup --- crypto/src/cms/CMSUtils.cs | 22 ++++++++++++---------- crypto/src/pkix/PkixCertPath.cs | 1 - .../src/pqc/crypto/crystals/dilithium/PolyVecL.cs | 8 +------- .../pqc/crypto/crystals/dilithium/PolyVecMatrix.cs | 8 +------- crypto/src/pqc/crypto/falcon/FalconSmallPrimes.cs | 5 ----- 5 files changed, 14 insertions(+), 30 deletions(-) diff --git a/crypto/src/cms/CMSUtils.cs b/crypto/src/cms/CMSUtils.cs index e30ac0491..6800c1d2a 100644 --- a/crypto/src/cms/CMSUtils.cs +++ b/crypto/src/cms/CMSUtils.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.Cms; @@ -84,9 +83,10 @@ namespace Org.BouncyCastle.Cms var result = new List(); if (attrCertStore != null) { - result.AddRange( - attrCertStore.EnumerateMatches(null) - .Select(c => new DerTaggedObject(false, 2, c.AttributeCertificate))); + foreach (var attrCert in attrCertStore.EnumerateMatches(null)) + { + result.Add(new DerTaggedObject(false, 2, attrCert.AttributeCertificate)); + } } return result; } @@ -96,9 +96,10 @@ namespace Org.BouncyCastle.Cms var result = new List(); if (certStore != null) { - result.AddRange( - certStore.EnumerateMatches(null) - .Select(c => c.CertificateStructure)); + foreach (var cert in certStore.EnumerateMatches(null)) + { + result.Add(cert.CertificateStructure); + } } return result; } @@ -108,9 +109,10 @@ namespace Org.BouncyCastle.Cms var result = new List(); if (crlStore != null) { - result.AddRange( - crlStore.EnumerateMatches(null) - .Select(c => c.CertificateList)); + foreach (var crl in crlStore.EnumerateMatches(null)) + { + result.Add(crl.CertificateList); + } } return result; } diff --git a/crypto/src/pkix/PkixCertPath.cs b/crypto/src/pkix/PkixCertPath.cs index 54a3c8f6a..95280173a 100644 --- a/crypto/src/pkix/PkixCertPath.cs +++ b/crypto/src/pkix/PkixCertPath.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; diff --git a/crypto/src/pqc/crypto/crystals/dilithium/PolyVecL.cs b/crypto/src/pqc/crypto/crystals/dilithium/PolyVecL.cs index 75309b374..58c286768 100644 --- a/crypto/src/pqc/crypto/crystals/dilithium/PolyVecL.cs +++ b/crypto/src/pqc/crypto/crystals/dilithium/PolyVecL.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Org.BouncyCastle.Pqc.Crypto.Crystals.Dilithium +namespace Org.BouncyCastle.Pqc.Crypto.Crystals.Dilithium { internal class PolyVecL { diff --git a/crypto/src/pqc/crypto/crystals/dilithium/PolyVecMatrix.cs b/crypto/src/pqc/crypto/crystals/dilithium/PolyVecMatrix.cs index cb41889b9..fa1af0560 100644 --- a/crypto/src/pqc/crypto/crystals/dilithium/PolyVecMatrix.cs +++ b/crypto/src/pqc/crypto/crystals/dilithium/PolyVecMatrix.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Org.BouncyCastle.Pqc.Crypto.Crystals.Dilithium +namespace Org.BouncyCastle.Pqc.Crypto.Crystals.Dilithium { internal class PolyVecMatrix { diff --git a/crypto/src/pqc/crypto/falcon/FalconSmallPrimes.cs b/crypto/src/pqc/crypto/falcon/FalconSmallPrimes.cs index dcefa7f05..8e11990bc 100644 --- a/crypto/src/pqc/crypto/falcon/FalconSmallPrimes.cs +++ b/crypto/src/pqc/crypto/falcon/FalconSmallPrimes.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace Org.BouncyCastle.Pqc.Crypto.Falcon { class FalconSmallPrimes -- cgit 1.4.1