Are there known CX3 Calculation errors?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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?

0 Likes
1 Solution
Anonymous
Not applicable

Hi,

Please take a known set of values and check step by step using debug prints to see where the calculation mismatch happens. Thereby, we can come to an idea about the cause of this difference.

Regards,

- Madhu Sudhan

View solution in original post

0 Likes
1 Reply
Anonymous
Not applicable

Hi,

Please take a known set of values and check step by step using debug prints to see where the calculation mismatch happens. Thereby, we can come to an idea about the cause of this difference.

Regards,

- Madhu Sudhan

0 Likes