Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AES MixColumns #499

Closed
stevemk14ebr opened this issue Nov 18, 2021 · 1 comment · Fixed by #749
Closed

AES MixColumns #499

stevemk14ebr opened this issue Nov 18, 2021 · 1 comment · Fixed by #749

Comments

@stevemk14ebr
Copy link
Contributor

Apologize for deleting the template, I do not have much time. The idea is to check for the ^ 0x1B operation typically used in AES's MixColumns operation. It looks as such:

https://en.wikipedia.org/wiki/Rijndael_MixColumns

for (c = 0; c < 4; c++) {
        a[c] = r[c];
        /* h is 0xff if the high bit of r[c] is set, 0 otherwise */
        h = (r[c] >> 7) & 1; /* arithmetic right shift, thus shifting in either zeros or ones */
        b[c] = r[c] << 1; /* implicitly removes high bit because b[c] is an 8-bit char, so we xor by 0x1b and not 0x11b in the next line */
        b[c] ^= h * 0x1B; /* Rijndael's Galois field */
    }

Sample 1e9fc7f32bd5522dd0222932eb9f1d8bd0a2e132c7b46cfcc622ad97831e6128 has this at VA 0x0040E3DE

 LOBYTE(result) = 0;
  for ( i = 1; i < 4; ++i )
  {
    v4 = 2 * *((_BYTE *)&a1 + i + 3);
    *(&a2 + i) = v4;
    if ( *(&a2 + i - 1) < 0 )
      *(&a2 + i) = v4 ^ 0x1B;
  }
  for ( j = 0; j < 4; ++j )
  {
    if ( (((unsigned __int8)a1 >> j) & 1) != 0 )
      LOBYTE(result) = *(&a2 + j) ^ result;
  }
  return result;

No AES rules hit for this sample.

@mr-tz
Copy link
Collaborator

mr-tz commented Nov 22, 2021

Great idea, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants