~zooko/cryptopp/trunk

« back to all changes in this revision

Viewing changes to tea.cpp

  • Committer: weidai
  • Date: 2007-05-04 15:36:15 UTC
  • Revision ID: svn-v4:57ff6487-cd31-0410-9ec3-f628ee90f5f0:trunk/c5:339
fix compile

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
static const word32 DELTA = 0x9e3779b9;
10
10
typedef BlockGetAndPut<word32, BigEndian> Block;
11
11
 
12
 
void TEA::Base::UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length, unsigned int rounds)
 
12
void TEA::Base::UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params)
13
13
{
14
14
        AssertValidKeyLength(length);
15
15
 
16
16
        GetUserKey(BIG_ENDIAN_ORDER, m_k.begin(), 4, userKey, KEYLENGTH);
17
 
        m_limit = rounds * DELTA;
 
17
        m_limit = GetRoundsAndThrowIfInvalid(params, this) * DELTA;
18
18
}
19
19
 
20
20
void TEA::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const
49
49
        Block::Put(xorBlock, outBlock)(y)(z);
50
50
}
51
51
 
52
 
void XTEA::Base::UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length, unsigned int rounds)
 
52
void XTEA::Base::UncheckedSetKey(const byte *userKey, unsigned int length,  const NameValuePairs &params)
53
53
{
54
54
        AssertValidKeyLength(length);
55
55
 
56
56
        GetUserKey(BIG_ENDIAN_ORDER, m_k.begin(), 4, userKey, KEYLENGTH);
57
 
        m_limit = rounds * DELTA;
 
57
        m_limit = GetRoundsAndThrowIfInvalid(params, this) * DELTA;
58
58
}
59
59
 
60
60
void XTEA::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const