Completed cutover to unscoped auto_ptr (which will use Crypto++'s namespace version)

pull/35/head
Jeffrey Walton 2015-08-03 19:11:23 -04:00
parent 7e6c9438da
commit 1e103c0e5b
8 changed files with 25 additions and 13 deletions

View File

@ -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<T_FactoryOutput> obj(ObjectFactoryRegistry<T_FactoryOutput>::Registry().CreateObject(factoryName));
auto_ptr<T_FactoryOutput> obj(ObjectFactoryRegistry<T_FactoryOutput>::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<T> obj(ObjectFactoryRegistry<T>::Registry().CreateObject(factoryName));
auto_ptr<T> obj(ObjectFactoryRegistry<T>::Registry().CreateObject(factoryName));
BenchMark(name.c_str(), *obj, g_allocatedTime);
}

View File

@ -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<PK_Signer> signer(ObjectFactoryRegistry<PK_Signer>::Registry().CreateObject(name.c_str()));
std::auto_ptr<PK_Verifier> verifier(ObjectFactoryRegistry<PK_Verifier>::Registry().CreateObject(name.c_str()));
auto_ptr<PK_Signer> signer(ObjectFactoryRegistry<PK_Signer>::Registry().CreateObject(name.c_str()));
auto_ptr<PK_Verifier> verifier(ObjectFactoryRegistry<PK_Verifier>::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<PK_Encryptor> encryptor(ObjectFactoryRegistry<PK_Encryptor>::Registry().CreateObject(name.c_str()));
std::auto_ptr<PK_Decryptor> decryptor(ObjectFactoryRegistry<PK_Decryptor>::Registry().CreateObject(name.c_str()));
auto_ptr<PK_Encryptor> encryptor(ObjectFactoryRegistry<PK_Encryptor>::Registry().CreateObject(name.c_str()));
auto_ptr<PK_Decryptor> decryptor(ObjectFactoryRegistry<PK_Decryptor>::Registry().CreateObject(name.c_str()));
std::string keyFormat = GetRequiredDatum(v, "KeyFormat");

View File

@ -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 <time.h>
@ -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<StreamTransformationFilter> decryptor(new StreamTransformationFilter(m_cipher));
auto_ptr<StreamTransformationFilter> decryptor(new StreamTransformationFilter(m_cipher));
decryptor->Put(keyCheck, BLOCKSIZE);
decryptor->ForceNextPut();

View File

@ -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 <class EC> void DL_GroupParameters_EC<EC>::Initialize(const OID &oid)
const EcRecommendedParameters<EllipticCurve> &param = *it;
m_oid = oid;
std::auto_ptr<EllipticCurve> ec(param.NewEC());
auto_ptr<EllipticCurve> ec(param.NewEC());
this->m_groupPrecomputation.SetCurve(*ec);
StringSource ssG(param.g, true, new HexDecoder);

View File

@ -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<OutputProxy> temp(proxy = new OutputProxy(*this, false));
auto_ptr<OutputProxy> temp(proxy = new OutputProxy(*this, false));
m_filter->TransferAllTo(*proxy);
m_filter->Attach(temp.release());
}

View File

@ -31,7 +31,7 @@ struct NewPrimeTable
{
const unsigned int maxPrimeTableSize = 3511;
std::auto_ptr<std::vector<word16> > pPrimeTable(new std::vector<word16>);
auto_ptr<std::vector<word16> > pPrimeTable(new std::vector<word16>);
std::vector<word16> &primeTable = *pPrimeTable;
primeTable.reserve(maxPrimeTableSize);

View File

@ -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<DL_SignerBase<typename SCHEME_OPTIONS
public:
PK_MessageAccumulator * NewSignatureAccumulator(RandomNumberGenerator &rng) const
{
std::auto_ptr<PK_MessageAccumulatorBase> p(new PK_MessageAccumulatorImpl<CPP_TYPENAME SCHEME_OPTIONS::HashFunction>);
auto_ptr<PK_MessageAccumulatorBase> p(new PK_MessageAccumulatorImpl<CPP_TYPENAME SCHEME_OPTIONS::HashFunction>);
this->RestartMessageAccumulator(rng, *p);
return p.release();
}

View File

@ -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<WaitingThreadData> pThread((WaitingThreadData *)lParam);
auto_ptr<WaitingThreadData> pThread((WaitingThreadData *)lParam);
WaitingThreadData &thread = *pThread;
std::vector<HANDLE> handles;