VC2005 workaround

pull/2/head
weidai 2006-12-09 17:16:05 +00:00
parent 85b68c9b71
commit 5f1af2c96e
2 changed files with 8 additions and 3 deletions

View File

@ -424,15 +424,18 @@ void DES_XEX3::Base::UncheckedSetKey(CipherDir dir, const byte *key, unsigned in
{
AssertValidKeyLength(length);
if (!m_des.get())
m_des.reset(new DES::Encryption);
memcpy(m_x1, key+(dir==ENCRYPTION?0:2*8), BLOCKSIZE);
m_des.UncheckedSetKey(dir, key+8);
m_des->UncheckedSetKey(dir, key+8);
memcpy(m_x3, key+(dir==DECRYPTION?0:2*8), BLOCKSIZE);
}
void DES_XEX3::Base::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const
{
xorbuf(outBlock, inBlock, m_x1, BLOCKSIZE);
m_des.ProcessAndXorBlock(outBlock, xorBlock, outBlock);
m_des->ProcessAndXorBlock(outBlock, xorBlock, outBlock);
xorbuf(outBlock, m_x3, BLOCKSIZE);
}

4
des.h
View File

@ -116,7 +116,9 @@ class DES_XEX3 : public DES_XEX3_Info, public BlockCipherDocumentation
protected:
FixedSizeSecBlock<byte, BLOCKSIZE> m_x1, m_x3;
DES::Encryption m_des;
// VS2005 workaround: calling modules compiled with /clr gets unresolved external symbol DES::Base::ProcessAndXorBlock
// if we use DES::Encryption here directly without value_ptr.
value_ptr<DES::Encryption> m_des;
};
public: