~zooko/cryptopp/trunk

« back to all changes in this revision

Viewing changes to 3way.cpp

  • Committer: noloader
  • Date: 2015-06-29 13:37:03 UTC
  • Revision ID: svn-v4:57ff6487-cd31-0410-9ec3-f628ee90f5f0:trunk/c5:558
Cleared warning on operator precedence

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
        pi_gamma_pi(a0, a1, a2);        \
62
62
}                                                                                       
63
63
 
64
 
void ThreeWay::Base::UncheckedSetKey(CipherDir dir, const byte *uk, unsigned int length, unsigned int r)
 
64
void ThreeWay::Base::UncheckedSetKey(const byte *uk, unsigned int length, const NameValuePairs &params)
65
65
{
66
66
        AssertValidKeyLength(length);
67
 
        AssertValidRounds(r);
68
67
 
69
 
        m_rounds = r;
 
68
        m_rounds = GetRoundsAndThrowIfInvalid(params, this);
70
69
 
71
70
        for (unsigned int i=0; i<3; i++)
72
71
                m_k[i] = (word32)uk[4*i+3] | ((word32)uk[4*i+2]<<8) | ((word32)uk[4*i+1]<<16) | ((word32)uk[4*i]<<24);
73
72
 
74
 
        if (dir == DECRYPTION)
 
73
        if (!IsForwardTransformation())
75
74
        {
76
75
                theta(m_k[0], m_k[1], m_k[2]);
77
76
                mu(m_k[0], m_k[1], m_k[2]);