I am definitely not familiar with the Crypto++ library but am
trying to use it as a compiler benchmark.

In the 5.1 codebase, I see the function below (first few lines).
Since the index i is word32 which is unsigned, I would think
that expressions like i-8 and i-5 and i-3 would wrap around
to large positive numbers which is not what is wanted here.

Are there any special procedures to follow for porting
to a 64-bit target?

-- Tom Deneau



void Serpent::Base::UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned 
int keylen)
{
        AssertValidKeyLength(keylen);

        word32 *k = m_key;
        GetUserKey(LITTLE_ENDIAN_ORDER, k, 8, userKey, keylen);

        word32  i,a,b,c,d,e;

        if (keylen < 32)
                k[keylen/4] |= word32(1) << ((keylen%4)*8);

        k += 8;
        word32 t = k[-1];
        for (i = 0; i < 132; ++i)
                k[i] = t = rotlFixed(k[i-8] ^ k[i-5] ^ k[i-3] ^ t ^ 0x9e3779b9 ^ i, 
11);
        k -= 20;

Reply via email to