[3993] | 1 | /* rc6 (TM)
|
---|
| 2 | * Unoptimized sample implementation of Ron Rivest's submission to the
|
---|
| 3 | * AES bakeoff.
|
---|
| 4 | *
|
---|
| 5 | * Salvo Salasio, 19 June 1998
|
---|
| 6 | *
|
---|
| 7 | * Intellectual property notes: The name of the algorithm (RC6) is
|
---|
| 8 | * trademarked; any property rights to the algorithm or the trademark
|
---|
| 9 | * should be discussed with discussed with the authors of the defining
|
---|
| 10 | * paper "The RC6(TM) Block Cipher": Ronald L. Rivest (MIT),
|
---|
| 11 | * M.J.B. Robshaw (RSA Labs), R. Sidney (RSA Labs), and Y.L. Yin (RSA Labs),
|
---|
| 12 | * distributed 18 June 1998 and available from the lead author's web site.
|
---|
| 13 | *
|
---|
| 14 | * This sample implementation is placed in the public domain by the author,
|
---|
| 15 | * Salvo Salasio. The ROTL and ROTR definitions were cribbed from RSA Labs'
|
---|
| 16 | * RC5 reference implementation.
|
---|
| 17 | */
|
---|
| 18 |
|
---|
| 19 | /* RC6 is parameterized for w-bit words, b bytes of key, and
|
---|
| 20 | * r rounds. The AES version of RC6 specifies b=16, 24, or 32;
|
---|
| 21 | * w=32; and r=20.
|
---|
| 22 | */
|
---|
| 23 |
|
---|
[3999] | 24 | #define rc6keylen 43
|
---|
[3993] | 25 |
|
---|
| 26 | typedef unsigned int RC6KEY[rc6keylen];
|
---|
| 27 |
|
---|
| 28 | /*
|
---|
| 29 | * K=plain key
|
---|
| 30 | * b=plain key len
|
---|
| 31 | * S=prepared key by setup
|
---|
| 32 | * pt=uncrypted data
|
---|
| 33 | * ct=crypted data
|
---|
| 34 | * block size is always 16bytes
|
---|
| 35 | */
|
---|
| 36 | void rc6_key_setup(unsigned char *K, int b, unsigned int *S);
|
---|
| 37 | void rc6_block_encrypt(unsigned int *pt, unsigned int *ct, unsigned int *S);
|
---|
| 38 | void rc6_block_decrypt(unsigned int *ct, unsigned int *pt, unsigned int *S);
|
---|
| 39 |
|
---|