From 1e103c0e5b2a55bef4a3561b388c78dd5f8181ca Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Mon, 3 Aug 2015 19:11:23 -0400 Subject: [PATCH] Completed cutover to unscoped auto_ptr (which will use Crypto++'s namespace version) --- bench.cpp | 6 ++++-- datatest.cpp | 10 ++++++---- default.cpp | 4 +++- eccrypto.cpp | 4 +++- filters.cpp | 4 +++- nbtheory.cpp | 2 +- pubkey.h | 4 ++-- wait.cpp | 4 +++- 8 files changed, 25 insertions(+), 13 deletions(-) diff --git a/bench.cpp b/bench.cpp index e32b59a5..01a8ab45 100644 --- a/bench.cpp +++ b/bench.cpp @@ -4,6 +4,8 @@ #include "bench.h" #include "validate.h" +#include "stdcpp.h" +#include "smartptr.h" #include "aes.h" #include "blumshub.h" #include "files.h" @@ -191,7 +193,7 @@ void BenchMarkByName2(const char *factoryName, size_t keyLength = 0, const char else if (keyLength) name += " (" + IntToString(keyLength * 8) + "-bit key)"; - std::auto_ptr obj(ObjectFactoryRegistry::Registry().CreateObject(factoryName)); + auto_ptr obj(ObjectFactoryRegistry::Registry().CreateObject(factoryName)); if (!keyLength) keyLength = obj->DefaultKeyLength(); obj->SetKey(key, keyLength, CombinedNameValuePairs(params, MakeParameters(Name::IV(), ConstByteArrayParameter(key, obj->IVSize()), false))); @@ -213,7 +215,7 @@ void BenchMarkByNameKeyLess(const char *factoryName, const char *displayName=NUL if (displayName) name = displayName; - std::auto_ptr obj(ObjectFactoryRegistry::Registry().CreateObject(factoryName)); + auto_ptr obj(ObjectFactoryRegistry::Registry().CreateObject(factoryName)); BenchMark(name.c_str(), *obj, g_allocatedTime); } diff --git a/datatest.cpp b/datatest.cpp index 5595c4a1..14ae4cab 100644 --- a/datatest.cpp +++ b/datatest.cpp @@ -1,6 +1,8 @@ // datatest.cpp - written and placed in public domain by Wei Dai #include "config.h" +#include "stdcpp.h" +#include "smartptr.h" #include "integer.h" #include "factory.h" #include "filters.h" @@ -208,8 +210,8 @@ void TestSignatureScheme(TestData &v) std::string name = GetRequiredDatum(v, "Name"); std::string test = GetRequiredDatum(v, "Test"); - std::auto_ptr signer(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); - std::auto_ptr verifier(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); + auto_ptr signer(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); + auto_ptr verifier(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); TestDataNameValuePairs pairs(v); @@ -285,8 +287,8 @@ void TestAsymmetricCipher(TestData &v) std::string name = GetRequiredDatum(v, "Name"); std::string test = GetRequiredDatum(v, "Test"); - std::auto_ptr encryptor(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); - std::auto_ptr decryptor(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); + auto_ptr encryptor(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); + auto_ptr decryptor(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); std::string keyFormat = GetRequiredDatum(v, "KeyFormat"); diff --git a/default.cpp b/default.cpp index 8b389d09..b2443fad 100644 --- a/default.cpp +++ b/default.cpp @@ -1,8 +1,10 @@ // default.cpp - written and placed in the public domain by Wei Dai #include "pch.h" + #include "default.h" #include "stdcpp.h" +#include "smartptr.h" #include "queue.h" #include @@ -179,7 +181,7 @@ void DefaultDecryptor::CheckKey(const byte *salt, const byte *keyCheck) GenerateKeyIV(m_passphrase, m_passphrase.size(), salt, SALTLENGTH, key, IV); m_cipher.SetKeyWithIV(key, key.size(), IV); - std::auto_ptr decryptor(new StreamTransformationFilter(m_cipher)); + auto_ptr decryptor(new StreamTransformationFilter(m_cipher)); decryptor->Put(keyCheck, BLOCKSIZE); decryptor->ForceNextPut(); diff --git a/eccrypto.cpp b/eccrypto.cpp index 99225e76..a531e2e2 100644 --- a/eccrypto.cpp +++ b/eccrypto.cpp @@ -5,6 +5,8 @@ #ifndef CRYPTOPP_IMPORTS #include "eccrypto.h" +#include "stdcpp.h" +#include "smartptr.h" #include "nbtheory.h" #include "oids.h" #include "hex.h" @@ -440,7 +442,7 @@ template void DL_GroupParameters_EC::Initialize(const OID &oid) const EcRecommendedParameters ¶m = *it; m_oid = oid; - std::auto_ptr ec(param.NewEC()); + auto_ptr ec(param.NewEC()); this->m_groupPrecomputation.SetCurve(*ec); StringSource ssG(param.g, true, new HexDecoder); diff --git a/filters.cpp b/filters.cpp index 2b9faea7..49d23970 100644 --- a/filters.cpp +++ b/filters.cpp @@ -5,6 +5,8 @@ #ifndef CRYPTOPP_IMPORTS #include "filters.h" +#include "stdcpp.h" +#include "smartptr.h" #include "mqueue.h" #include "fltrimpl.h" #include "argnames.h" @@ -500,7 +502,7 @@ void ProxyFilter::SetFilter(Filter *filter) if (filter) { OutputProxy *proxy; - std::auto_ptr temp(proxy = new OutputProxy(*this, false)); + auto_ptr temp(proxy = new OutputProxy(*this, false)); m_filter->TransferAllTo(*proxy); m_filter->Attach(temp.release()); } diff --git a/nbtheory.cpp b/nbtheory.cpp index 4e903801..980cf72e 100644 --- a/nbtheory.cpp +++ b/nbtheory.cpp @@ -31,7 +31,7 @@ struct NewPrimeTable { const unsigned int maxPrimeTableSize = 3511; - std::auto_ptr > pPrimeTable(new std::vector); + auto_ptr > pPrimeTable(new std::vector); std::vector &primeTable = *pPrimeTable; primeTable.reserve(maxPrimeTableSize); diff --git a/pubkey.h b/pubkey.h index 0a5bed0e..ea73c91c 100644 --- a/pubkey.h +++ b/pubkey.h @@ -38,7 +38,7 @@ #include "eprecomp.h" #include "fips140.h" #include "argnames.h" -#include "stdcpp.h" +#include "smartptr.h" #include "trap.h" // VC60 workaround: this macro is defined in shlobj.h and conflicts with a template parameter used in this file @@ -1342,7 +1342,7 @@ class DL_SignerImpl : public DL_ObjectImpl p(new PK_MessageAccumulatorImpl); + auto_ptr p(new PK_MessageAccumulatorImpl); this->RestartMessageAccumulator(rng, *p); return p.release(); } diff --git a/wait.cpp b/wait.cpp index f00668a5..ab8e42ea 100644 --- a/wait.cpp +++ b/wait.cpp @@ -2,6 +2,8 @@ #include "pch.h" #include "wait.h" +#include "stdcpp.h" +#include "smartptr.h" #include "misc.h" #include "trap.h" @@ -145,7 +147,7 @@ void WaitObjectContainer::AddHandle(HANDLE handle, CallStack const& callStack) DWORD WINAPI WaitingThread(LPVOID lParam) { - std::auto_ptr pThread((WaitingThreadData *)lParam); + auto_ptr pThread((WaitingThreadData *)lParam); WaitingThreadData &thread = *pThread; std::vector handles;