1 Reply Latest reply on Nov 27, 2017 2:14 AM by Madhu Lakshmipathy

    Are there known CX3 Calculation errors?

    user_393857635

      I am trying to use implement an encryption algorithm on the CX3 known as XTEA. I used the following code on the CX3 and Windows, but got a different result when using 64 for Num_rounds, v[2] = {0x274DCC86, 0x3E0DA996} and key={0x12345678, 0x12345678, 0x12345678, 0x12345678}.

       

      void decipher(const size_t Num_rounds, uint32_t v[2], uint32_t const key[4])

      {

         size_t index;

         uint32_t v0 = v[0];

         uint32_t v1 = v[1];

         const uint32_t Delta = 0x9E3779B9;

         uint32_t sum = Delta * Num_rounds;

         for (index = 0U; index < Num_rounds; index++)

         {

            v1 -= (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + key[(sum>>11) & 0x3]);

            v0 -= (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + key[sum & 0x3]);

         }

         v[0]=v0;

         v[1]=v1;

      }

       

      The deciphered data should return 0, but doesn't on CX3. Is this a known issue I don't know about or am I doing something wrong?