Cleared "no member named 'unique_ptr' in namespace 'std'" error under C++11 on OS X

This commit is contained in:
Jeffrey Walton 2015-07-30 11:15:51 -04:00
parent e5171450e2
commit 60291122ae
2 changed files with 10 additions and 27 deletions

View File

@ -20,12 +20,9 @@ size_t OAEP_Base::MaxUnpaddedLength(size_t paddedLength) const
void OAEP_Base::Pad(RandomNumberGenerator &rng, const byte *input, size_t inputLength, byte *oaepBlock, size_t oaepBlockLen, const NameValuePairs &parameters) const
{
CRYPTOPP_ASSERT (inputLength <= MaxUnpaddedLength(oaepBlockLen));
#if defined(CRYPTOPP_CXX11)
std::unique_ptr<HashTransformation> pHash(NewHash());
#else
std::auto_ptr<HashTransformation> pHash(NewHash());
#endif
using CryptoPP::auto_ptr;
auto_ptr<HashTransformation> pHash(NewHash());
// convert from bit length to byte length
if (oaepBlockLen % 8 != 0)
@ -48,13 +45,8 @@ void OAEP_Base::Pad(RandomNumberGenerator &rng, const byte *input, size_t inputL
memset(maskedDB+hLen, 0, dbLen-hLen-inputLength-1);
maskedDB[dbLen-inputLength-1] = 0x01;
memcpy(maskedDB+dbLen-inputLength, input, inputLength);
#if defined(CRYPTOPP_CXX11)
std::unique_ptr<MaskGeneratingFunction> pMGF(NewMGF());
#else
std::auto_ptr<MaskGeneratingFunction> pMGF(NewMGF());
#endif
auto_ptr<MaskGeneratingFunction> pMGF(NewMGF());
rng.GenerateBlock(maskedSeed, seedLen);
pMGF->GenerateAndMask(*pHash, maskedDB, dbLen, maskedSeed, seedLen);
pMGF->GenerateAndMask(*pHash, maskedSeed, seedLen, maskedDB, dbLen);
@ -64,11 +56,8 @@ DecodingResult OAEP_Base::Unpad(const byte *oaepBlock, size_t oaepBlockLen, byte
{
bool invalid = false;
#if defined(CRYPTOPP_CXX11)
std::unique_ptr<HashTransformation> pHash(NewHash());
#else
using CryptoPP::auto_ptr;
std::auto_ptr<HashTransformation> pHash(NewHash());
#endif
// convert from bit length to byte length
if (oaepBlockLen % 8 != 0)
@ -87,12 +76,8 @@ DecodingResult OAEP_Base::Unpad(const byte *oaepBlock, size_t oaepBlockLen, byte
byte *const maskedSeed = t;
byte *const maskedDB = t+seedLen;
#if defined(CRYPTOPP_CXX11)
std::unique_ptr<MaskGeneratingFunction> pMGF(NewMGF());
#else
std::auto_ptr<MaskGeneratingFunction> pMGF(NewMGF());
#endif
std::auto_ptr<MaskGeneratingFunction> pMGF(NewMGF());
pMGF->GenerateAndMask(*pHash, maskedSeed, seedLen, maskedDB, dbLen);
pMGF->GenerateAndMask(*pHash, maskedDB, dbLen, maskedSeed, seedLen);

View File

@ -587,12 +587,13 @@ struct NewFixedLiteralDecoder
{
HuffmanDecoder * operator()() const
{
using CryptoPP::auto_ptr;
unsigned int codeLengths[288];
std::fill(codeLengths + 0, codeLengths + 144, 8);
std::fill(codeLengths + 144, codeLengths + 256, 9);
std::fill(codeLengths + 256, codeLengths + 280, 7);
std::fill(codeLengths + 280, codeLengths + 288, 8);
std::auto_ptr<HuffmanDecoder> pDecoder(new HuffmanDecoder);
auto_ptr<HuffmanDecoder> pDecoder(new HuffmanDecoder);
pDecoder->Initialize(codeLengths, 288);
return pDecoder.release();
}
@ -602,13 +603,10 @@ struct NewFixedDistanceDecoder
{
HuffmanDecoder * operator()() const
{
using CryptoPP::auto_ptr;
unsigned int codeLengths[32];
std::fill(codeLengths + 0, codeLengths + 32, 5U);
#if defined(CRYPTOPP_CXX11)
std::unique_ptr<HuffmanDecoder> pDecoder(new HuffmanDecoder);
#else
std::auto_ptr<HuffmanDecoder> pDecoder(new HuffmanDecoder);
#endif
auto_ptr<HuffmanDecoder> pDecoder(new HuffmanDecoder);
pDecoder->Initialize(codeLengths, 32);
return pDecoder.release();
}