Cleared "auto_ptr is deprecated" warning. Switch to unique_ptr when C++11 is in effect

pull/35/head
Jeffrey Walton 2015-07-27 00:37:22 -04:00
parent f017391174
commit 9de95b4400
1 changed files with 6 additions and 1 deletions

View File

@ -20,6 +20,12 @@ void OAEP_Base::Pad(RandomNumberGenerator &rng, const byte *input, size_t inputL
{ {
CRYPTOPP_ASSERT (inputLength <= MaxUnpaddedLength(oaepBlockLen)); CRYPTOPP_ASSERT (inputLength <= MaxUnpaddedLength(oaepBlockLen));
#if defined(CRYPTOPP_CXX11)
std::unique_ptr<HashTransformation> pHash(NewHash());
#else
std::auto_ptr<HashTransformation> pHash(NewHash());
#endif
// convert from bit length to byte length // convert from bit length to byte length
if (oaepBlockLen % 8 != 0) if (oaepBlockLen % 8 != 0)
{ {
@ -28,7 +34,6 @@ void OAEP_Base::Pad(RandomNumberGenerator &rng, const byte *input, size_t inputL
} }
oaepBlockLen /= 8; oaepBlockLen /= 8;
std::auto_ptr<HashTransformation> pHash(NewHash());
const size_t hLen = pHash->DigestSize(); const size_t hLen = pHash->DigestSize();
const size_t seedLen = hLen, dbLen = oaepBlockLen-seedLen; const size_t seedLen = hLen, dbLen = oaepBlockLen-seedLen;
byte *const maskedSeed = oaepBlock; byte *const maskedSeed = oaepBlock;