summaryrefslogtreecommitdiff
path: root/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx')
-rw-r--r--xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx45
1 files changed, 16 insertions, 29 deletions
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 7e19c995ae88..7ccc70c85955 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -120,24 +120,18 @@ SecurityEnvironment_NssImpl::~SecurityEnvironment_NssImpl() {
}
if( !m_tSymKeyList.empty() ) {
- std::list< PK11SymKey* >::iterator symKeyIt ;
-
- for( symKeyIt = m_tSymKeyList.begin() ; symKeyIt != m_tSymKeyList.end() ; ++symKeyIt )
- PK11_FreeSymKey( *symKeyIt ) ;
+ for( auto& symKey : m_tSymKeyList )
+ PK11_FreeSymKey( symKey ) ;
}
if( !m_tPubKeyList.empty() ) {
- std::list< SECKEYPublicKey* >::iterator pubKeyIt ;
-
- for( pubKeyIt = m_tPubKeyList.begin() ; pubKeyIt != m_tPubKeyList.end() ; ++pubKeyIt )
- SECKEY_DestroyPublicKey( *pubKeyIt ) ;
+ for( auto& pubKeyIt : m_tPubKeyList )
+ SECKEY_DestroyPublicKey( pubKeyIt ) ;
}
if( !m_tPriKeyList.empty() ) {
- std::list< SECKEYPrivateKey* >::iterator priKeyIt ;
-
- for( priKeyIt = m_tPriKeyList.begin() ; priKeyIt != m_tPriKeyList.end() ; ++priKeyIt )
- SECKEY_DestroyPrivateKey( *priKeyIt ) ;
+ for( auto& priKey : m_tPriKeyList )
+ SECKEY_DestroyPrivateKey( priKey ) ;
}
}
@@ -206,14 +200,10 @@ void SecurityEnvironment_NssImpl::setCertDb( CERTCertDBHandle* aCertDb ) {
}
void SecurityEnvironment_NssImpl::adoptSymKey( PK11SymKey* aSymKey ) {
- std::list< PK11SymKey* >::iterator keyIt ;
-
if( aSymKey != nullptr ) {
//First try to find the key in the list
- for( keyIt = m_tSymKeyList.begin() ; keyIt != m_tSymKeyList.end() ; ++keyIt ) {
- if( *keyIt == aSymKey )
- return ;
- }
+ if (std::find(m_tSymKeyList.begin(), m_tSymKeyList.end(), aSymKey) != m_tSymKeyList.end())
+ return;
//If we do not find the key in the list, add a new node
PK11SymKey* symkey = PK11_ReferenceSymKey( aSymKey ) ;
@@ -325,10 +315,8 @@ SecurityEnvironment_NssImpl::getPersonalCertificates()
//secondly, we try to find certificate from registered private keys.
if( !m_tPriKeyList.empty() ) {
- std::list< SECKEYPrivateKey* >::iterator priKeyIt ;
-
- for( priKeyIt = m_tPriKeyList.begin() ; priKeyIt != m_tPriKeyList.end() ; ++priKeyIt ) {
- xcert = NssPrivKeyToXCert( *priKeyIt ) ;
+ for( const auto& priKey : m_tPriKeyList ) {
+ xcert = NssPrivKeyToXCert( priKey ) ;
if( xcert != nullptr )
certsList.push_back( xcert ) ;
}
@@ -336,12 +324,12 @@ SecurityEnvironment_NssImpl::getPersonalCertificates()
length = certsList.size() ;
if( length != 0 ) {
- int i ;
- std::list< X509Certificate_NssImpl* >::iterator xcertIt ;
+ int i = 0;
Sequence< Reference< XCertificate > > certSeq( length ) ;
- for( i = 0, xcertIt = certsList.begin(); xcertIt != certsList.end(); ++xcertIt, ++i ) {
- certSeq[i] = *xcertIt ;
+ for( const auto& rXCert : certsList ) {
+ certSeq[i] = rXCert ;
+ ++i;
}
return certSeq ;
@@ -712,11 +700,10 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert,
}
//Destroying the temporary certificates
- std::vector<CERTCertificate*>::const_iterator cert_i;
- for (cert_i = vecTmpNSSCertificates.begin(); cert_i != vecTmpNSSCertificates.end(); ++cert_i)
+ for (auto& tmpCert : vecTmpNSSCertificates)
{
SAL_INFO("xmlsecurity.xmlsec", "Destroying temporary certificate");
- CERT_DestroyCertificate(*cert_i);
+ CERT_DestroyCertificate(tmpCert);
}
return validity ;
}