Skip to content

Commit

Permalink
Add polynomial for 512-bit block ciphers
Browse files Browse the repository at this point in the history
I believe this is correct, but it may be wrong. According to the Kalyna team, the polynomial for GCM mode is x^512 + x^8 + x^5 + x^2 + 1. It appears the polinomial applies to other block cipher modes of operations, like CMAC.Dropping the first term and evaluating the remaining terms at X=2 results in 293 (0x125)
  • Loading branch information
noloader committed May 13, 2017
1 parent e226523 commit 7697857
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmac.cpp
Expand Up @@ -31,9 +31,15 @@ static void MulU(byte *k, unsigned int length)
k[15] ^= 0x87;
break;
case 32:
// Should this be 0x425?
k[30] ^= 4;
k[31] ^= 0x23;
break;
case 64:
// https://crypto.stackexchange.com/q/9815/10496
k[62] ^= 1;
k[63] ^= 0x25;
break;
default:
throw InvalidArgument("CMAC: " + IntToString(length) + " is not a supported cipher block size");
}
Expand Down

1 comment on commit 7697857

@noloader
Copy link
Collaborator Author

@noloader noloader commented on 7697857 May 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CCM and GCM modes are unchanged at the moment.

Also see Issue 408 and Issue 423.

Please sign in to comment.