Completed cutover to unscoped auto_ptr (which will use Crypto++'s namespace version)
parent
7e6c9438da
commit
1e103c0e5b
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include "bench.h"
|
#include "bench.h"
|
||||||
#include "validate.h"
|
#include "validate.h"
|
||||||
|
#include "stdcpp.h"
|
||||||
|
#include "smartptr.h"
|
||||||
#include "aes.h"
|
#include "aes.h"
|
||||||
#include "blumshub.h"
|
#include "blumshub.h"
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
|
|
@ -191,7 +193,7 @@ void BenchMarkByName2(const char *factoryName, size_t keyLength = 0, const char
|
||||||
else if (keyLength)
|
else if (keyLength)
|
||||||
name += " (" + IntToString(keyLength * 8) + "-bit key)";
|
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)
|
if (!keyLength)
|
||||||
keyLength = obj->DefaultKeyLength();
|
keyLength = obj->DefaultKeyLength();
|
||||||
obj->SetKey(key, keyLength, CombinedNameValuePairs(params, MakeParameters(Name::IV(), ConstByteArrayParameter(key, obj->IVSize()), false)));
|
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)
|
if (displayName)
|
||||||
name = 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);
|
BenchMark(name.c_str(), *obj, g_allocatedTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
10
datatest.cpp
10
datatest.cpp
|
|
@ -1,6 +1,8 @@
|
||||||
// datatest.cpp - written and placed in public domain by Wei Dai
|
// datatest.cpp - written and placed in public domain by Wei Dai
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "stdcpp.h"
|
||||||
|
#include "smartptr.h"
|
||||||
#include "integer.h"
|
#include "integer.h"
|
||||||
#include "factory.h"
|
#include "factory.h"
|
||||||
#include "filters.h"
|
#include "filters.h"
|
||||||
|
|
@ -208,8 +210,8 @@ void TestSignatureScheme(TestData &v)
|
||||||
std::string name = GetRequiredDatum(v, "Name");
|
std::string name = GetRequiredDatum(v, "Name");
|
||||||
std::string test = GetRequiredDatum(v, "Test");
|
std::string test = GetRequiredDatum(v, "Test");
|
||||||
|
|
||||||
std::auto_ptr<PK_Signer> signer(ObjectFactoryRegistry<PK_Signer>::Registry().CreateObject(name.c_str()));
|
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_Verifier> verifier(ObjectFactoryRegistry<PK_Verifier>::Registry().CreateObject(name.c_str()));
|
||||||
|
|
||||||
TestDataNameValuePairs pairs(v);
|
TestDataNameValuePairs pairs(v);
|
||||||
|
|
||||||
|
|
@ -285,8 +287,8 @@ void TestAsymmetricCipher(TestData &v)
|
||||||
std::string name = GetRequiredDatum(v, "Name");
|
std::string name = GetRequiredDatum(v, "Name");
|
||||||
std::string test = GetRequiredDatum(v, "Test");
|
std::string test = GetRequiredDatum(v, "Test");
|
||||||
|
|
||||||
std::auto_ptr<PK_Encryptor> encryptor(ObjectFactoryRegistry<PK_Encryptor>::Registry().CreateObject(name.c_str()));
|
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_Decryptor> decryptor(ObjectFactoryRegistry<PK_Decryptor>::Registry().CreateObject(name.c_str()));
|
||||||
|
|
||||||
std::string keyFormat = GetRequiredDatum(v, "KeyFormat");
|
std::string keyFormat = GetRequiredDatum(v, "KeyFormat");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
// default.cpp - written and placed in the public domain by Wei Dai
|
// default.cpp - written and placed in the public domain by Wei Dai
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
#include "default.h"
|
#include "default.h"
|
||||||
#include "stdcpp.h"
|
#include "stdcpp.h"
|
||||||
|
#include "smartptr.h"
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
|
|
||||||
#include <time.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);
|
GenerateKeyIV(m_passphrase, m_passphrase.size(), salt, SALTLENGTH, key, IV);
|
||||||
|
|
||||||
m_cipher.SetKeyWithIV(key, key.size(), 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->Put(keyCheck, BLOCKSIZE);
|
||||||
decryptor->ForceNextPut();
|
decryptor->ForceNextPut();
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@
|
||||||
#ifndef CRYPTOPP_IMPORTS
|
#ifndef CRYPTOPP_IMPORTS
|
||||||
|
|
||||||
#include "eccrypto.h"
|
#include "eccrypto.h"
|
||||||
|
#include "stdcpp.h"
|
||||||
|
#include "smartptr.h"
|
||||||
#include "nbtheory.h"
|
#include "nbtheory.h"
|
||||||
#include "oids.h"
|
#include "oids.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
|
|
@ -440,7 +442,7 @@ template <class EC> void DL_GroupParameters_EC<EC>::Initialize(const OID &oid)
|
||||||
|
|
||||||
const EcRecommendedParameters<EllipticCurve> ¶m = *it;
|
const EcRecommendedParameters<EllipticCurve> ¶m = *it;
|
||||||
m_oid = oid;
|
m_oid = oid;
|
||||||
std::auto_ptr<EllipticCurve> ec(param.NewEC());
|
auto_ptr<EllipticCurve> ec(param.NewEC());
|
||||||
this->m_groupPrecomputation.SetCurve(*ec);
|
this->m_groupPrecomputation.SetCurve(*ec);
|
||||||
|
|
||||||
StringSource ssG(param.g, true, new HexDecoder);
|
StringSource ssG(param.g, true, new HexDecoder);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@
|
||||||
#ifndef CRYPTOPP_IMPORTS
|
#ifndef CRYPTOPP_IMPORTS
|
||||||
|
|
||||||
#include "filters.h"
|
#include "filters.h"
|
||||||
|
#include "stdcpp.h"
|
||||||
|
#include "smartptr.h"
|
||||||
#include "mqueue.h"
|
#include "mqueue.h"
|
||||||
#include "fltrimpl.h"
|
#include "fltrimpl.h"
|
||||||
#include "argnames.h"
|
#include "argnames.h"
|
||||||
|
|
@ -500,7 +502,7 @@ void ProxyFilter::SetFilter(Filter *filter)
|
||||||
if (filter)
|
if (filter)
|
||||||
{
|
{
|
||||||
OutputProxy *proxy;
|
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->TransferAllTo(*proxy);
|
||||||
m_filter->Attach(temp.release());
|
m_filter->Attach(temp.release());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ struct NewPrimeTable
|
||||||
{
|
{
|
||||||
const unsigned int maxPrimeTableSize = 3511;
|
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;
|
std::vector<word16> &primeTable = *pPrimeTable;
|
||||||
primeTable.reserve(maxPrimeTableSize);
|
primeTable.reserve(maxPrimeTableSize);
|
||||||
|
|
||||||
|
|
|
||||||
4
pubkey.h
4
pubkey.h
|
|
@ -38,7 +38,7 @@
|
||||||
#include "eprecomp.h"
|
#include "eprecomp.h"
|
||||||
#include "fips140.h"
|
#include "fips140.h"
|
||||||
#include "argnames.h"
|
#include "argnames.h"
|
||||||
#include "stdcpp.h"
|
#include "smartptr.h"
|
||||||
#include "trap.h"
|
#include "trap.h"
|
||||||
|
|
||||||
// VC60 workaround: this macro is defined in shlobj.h and conflicts with a template parameter used in this file
|
// 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:
|
public:
|
||||||
PK_MessageAccumulator * NewSignatureAccumulator(RandomNumberGenerator &rng) const
|
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);
|
this->RestartMessageAccumulator(rng, *p);
|
||||||
return p.release();
|
return p.release();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
wait.cpp
4
wait.cpp
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "wait.h"
|
#include "wait.h"
|
||||||
|
#include "stdcpp.h"
|
||||||
|
#include "smartptr.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "trap.h"
|
#include "trap.h"
|
||||||
|
|
||||||
|
|
@ -145,7 +147,7 @@ void WaitObjectContainer::AddHandle(HANDLE handle, CallStack const& callStack)
|
||||||
|
|
||||||
DWORD WINAPI WaitingThread(LPVOID lParam)
|
DWORD WINAPI WaitingThread(LPVOID lParam)
|
||||||
{
|
{
|
||||||
std::auto_ptr<WaitingThreadData> pThread((WaitingThreadData *)lParam);
|
auto_ptr<WaitingThreadData> pThread((WaitingThreadData *)lParam);
|
||||||
WaitingThreadData &thread = *pThread;
|
WaitingThreadData &thread = *pThread;
|
||||||
std::vector<HANDLE> handles;
|
std::vector<HANDLE> handles;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue