diff options
Diffstat (limited to 'extra/yassl/src/crypto_wrapper.cpp')
-rw-r--r-- | extra/yassl/src/crypto_wrapper.cpp | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/extra/yassl/src/crypto_wrapper.cpp b/extra/yassl/src/crypto_wrapper.cpp index c083c56f313..e6b28cd9302 100644 --- a/extra/yassl/src/crypto_wrapper.cpp +++ b/extra/yassl/src/crypto_wrapper.cpp @@ -58,13 +58,13 @@ struct MD5::MD5Impl { }; -MD5::MD5() : pimpl_(new (ys) MD5Impl) {} +MD5::MD5() : pimpl_(new MD5Impl) {} MD5::~MD5() { delete pimpl_; } -MD5::MD5(const MD5& that) : Digest(), pimpl_(new (ys) +MD5::MD5(const MD5& that) : Digest(), pimpl_(new MD5Impl(that.pimpl_->md5_)) {} @@ -116,14 +116,13 @@ struct SHA::SHAImpl { }; -SHA::SHA() : pimpl_(new (ys) SHAImpl) {} +SHA::SHA() : pimpl_(new SHAImpl) {} SHA::~SHA() { delete pimpl_; } -SHA::SHA(const SHA& that) : Digest(), pimpl_(new (ys) - SHAImpl(that.pimpl_->sha_)) {} +SHA::SHA(const SHA& that) : Digest(), pimpl_(new SHAImpl(that.pimpl_->sha_)) {} SHA& SHA::operator=(const SHA& that) { @@ -174,14 +173,13 @@ struct RMD::RMDImpl { }; -RMD::RMD() : pimpl_(new (ys) RMDImpl) {} +RMD::RMD() : pimpl_(new RMDImpl) {} RMD::~RMD() { delete pimpl_; } -RMD::RMD(const RMD& that) : Digest(), pimpl_(new (ys) - RMDImpl(that.pimpl_->rmd_)) {} +RMD::RMD(const RMD& that) : Digest(), pimpl_(new RMDImpl(that.pimpl_->rmd_)) {} RMD& RMD::operator=(const RMD& that) { @@ -232,7 +230,7 @@ struct HMAC_MD5::HMAC_MD5Impl { HMAC_MD5::HMAC_MD5(const byte* secret, unsigned int len) - : pimpl_(new (ys) HMAC_MD5Impl) + : pimpl_(new HMAC_MD5Impl) { pimpl_->mac_.SetKey(secret, len); } @@ -282,7 +280,7 @@ struct HMAC_SHA::HMAC_SHAImpl { HMAC_SHA::HMAC_SHA(const byte* secret, unsigned int len) - : pimpl_(new (ys) HMAC_SHAImpl) + : pimpl_(new HMAC_SHAImpl) { pimpl_->mac_.SetKey(secret, len); } @@ -333,7 +331,7 @@ struct HMAC_RMD::HMAC_RMDImpl { HMAC_RMD::HMAC_RMD(const byte* secret, unsigned int len) - : pimpl_(new (ys) HMAC_RMDImpl) + : pimpl_(new HMAC_RMDImpl) { pimpl_->mac_.SetKey(secret, len); } @@ -381,7 +379,7 @@ struct DES::DESImpl { }; -DES::DES() : pimpl_(new (ys) DESImpl) {} +DES::DES() : pimpl_(new DESImpl) {} DES::~DES() { delete pimpl_; } @@ -417,7 +415,7 @@ struct DES_EDE::DES_EDEImpl { }; -DES_EDE::DES_EDE() : pimpl_(new (ys) DES_EDEImpl) {} +DES_EDE::DES_EDE() : pimpl_(new DES_EDEImpl) {} DES_EDE::~DES_EDE() { delete pimpl_; } @@ -455,7 +453,7 @@ struct RC4::RC4Impl { }; -RC4::RC4() : pimpl_(new (ys) RC4Impl) {} +RC4::RC4() : pimpl_(new RC4Impl) {} RC4::~RC4() { delete pimpl_; } @@ -497,7 +495,7 @@ struct AES::AESImpl { }; -AES::AES(unsigned int ks) : pimpl_(new (ys) AESImpl(ks)) {} +AES::AES(unsigned int ks) : pimpl_(new AESImpl(ks)) {} AES::~AES() { delete pimpl_; } @@ -538,7 +536,7 @@ struct RandomPool::RandomImpl { TaoCrypt::RandomNumberGenerator RNG_; }; -RandomPool::RandomPool() : pimpl_(new (ys) RandomImpl) {} +RandomPool::RandomPool() : pimpl_(new RandomImpl) {} RandomPool::~RandomPool() { delete pimpl_; } @@ -582,7 +580,7 @@ void DSS::DSSImpl::SetPrivate(const byte* key, unsigned int sz) // Set public or private key DSS::DSS(const byte* key, unsigned int sz, bool publicKey) - : pimpl_(new (ys) DSSImpl) + : pimpl_(new DSSImpl) { if (publicKey) pimpl_->SetPublic(key, sz); @@ -653,7 +651,7 @@ void RSA::RSAImpl::SetPrivate(const byte* key, unsigned int sz) // Set public or private key RSA::RSA(const byte* key, unsigned int sz, bool publicKey) - : pimpl_(new (ys) RSAImpl) + : pimpl_(new RSAImpl) { if (publicKey) pimpl_->SetPublic(key, sz); @@ -725,13 +723,13 @@ struct Integer::IntegerImpl { explicit IntegerImpl(const TaoCrypt::Integer& i) : int_(i) {} }; -Integer::Integer() : pimpl_(new (ys) IntegerImpl) {} +Integer::Integer() : pimpl_(new IntegerImpl) {} Integer::~Integer() { delete pimpl_; } -Integer::Integer(const Integer& other) : pimpl_(new (ys) +Integer::Integer(const Integer& other) : pimpl_(new IntegerImpl(other.pimpl_->int_)) {} @@ -770,9 +768,9 @@ struct DiffieHellman::DHImpl { void AllocKeys(unsigned int pubSz, unsigned int privSz, unsigned int agrSz) { - publicKey_ = new (ys) byte[pubSz]; - privateKey_ = new (ys) byte[privSz]; - agreedKey_ = new (ys) byte[agrSz]; + publicKey_ = new byte[pubSz]; + privateKey_ = new byte[privSz]; + agreedKey_ = new byte[agrSz]; } }; @@ -781,7 +779,7 @@ struct DiffieHellman::DHImpl { /* // server Side DH, server's view DiffieHellman::DiffieHellman(const char* file, const RandomPool& random) - : pimpl_(new (ys) DHImpl(random.pimpl_->RNG_)) + : pimpl_(new DHImpl(random.pimpl_->RNG_)) { using namespace TaoCrypt; Source source; @@ -805,12 +803,12 @@ DiffieHellman::DiffieHellman(const char* file, const RandomPool& random) DiffieHellman::DiffieHellman(const byte* p, unsigned int pSz, const byte* g, unsigned int gSz, const byte* pub, unsigned int pubSz, const RandomPool& random) - : pimpl_(new (ys) DHImpl(random.pimpl_->RNG_)) + : pimpl_(new DHImpl(random.pimpl_->RNG_)) { using TaoCrypt::Integer; pimpl_->dh_.Initialize(Integer(p, pSz).Ref(), Integer(g, gSz).Ref()); - pimpl_->publicKey_ = new (ys) opaque[pubSz]; + pimpl_->publicKey_ = new opaque[pubSz]; memcpy(pimpl_->publicKey_, pub, pubSz); } @@ -818,7 +816,7 @@ DiffieHellman::DiffieHellman(const byte* p, unsigned int pSz, const byte* g, // Server Side DH, server's view DiffieHellman::DiffieHellman(const Integer& p, const Integer& g, const RandomPool& random) -: pimpl_(new (ys) DHImpl(random.pimpl_->RNG_)) +: pimpl_(new DHImpl(random.pimpl_->RNG_)) { using TaoCrypt::Integer; @@ -836,7 +834,7 @@ DiffieHellman::~DiffieHellman() { delete pimpl_; } // Client side and view, use server that for p and g DiffieHellman::DiffieHellman(const DiffieHellman& that) - : pimpl_(new (ys) DHImpl(*that.pimpl_)) + : pimpl_(new DHImpl(*that.pimpl_)) { pimpl_->dh_.GenerateKeyPair(pimpl_->ranPool_, pimpl_->privateKey_, pimpl_->publicKey_); @@ -957,7 +955,7 @@ x509* PemToDer(const char* fname, CertType type) Base64Decoder b64Dec(der); uint sz = der.size(); - mySTL::auto_ptr<x509> x(new (ys) x509(sz)); + mySTL::auto_ptr<x509> x(new x509(sz)); memcpy(x->use_buffer(), der.get_buffer(), sz); fclose(file); @@ -971,8 +969,6 @@ x509* PemToDer(const char* fname, CertType type) template class TaoCrypt::HMAC<TaoCrypt::MD5>; template class TaoCrypt::HMAC<TaoCrypt::SHA>; template class TaoCrypt::HMAC<TaoCrypt::RIPEMD160>; -template class TaoCrypt::Mode_BASE<16>; -template class TaoCrypt::Mode_BASE<8>; #endif #endif // !USE_CRYPTOPP_LIB |