Looking for Source of AES code
Brian Gladman
brg at gladman.plus.com
Tue Sep 14 04:35:59 EDT 2004
Damien O'Rourke wrote:
> Hi,
>
> I have some AES code here in C and I am trying to find it's author and
> source. I can't find
> it on the Internet so I figure it was taken from a book. Now I don't want
> to send the entire
> code to the list for obvious reasons however I was hoping you could help me
> from the following
> small snippet. Maybe the use of " _fastcall " might jog someone's memory.
> If there is
> code that appears similar to this but is not exactly the same I would
> appreciate the source
> of that also.
>
>
> void _fastcall encrypt(FILE *Encryption_File, FILE *Encrypted_File, unsigned
> *expkey)
> {
> uchar in[16], out[16];
> unsigned state[NumberOfBytes], rnd, i;
>
> while (!feof(Encryption_File))
> {
> uchar k=0;
> fread(in,sizeof(uchar),16,Encryption_File);/
>
> *(state+0)= *(in+0)<<24 | *(in+1)<< 16 | *(in+2)<<8 | *(in+3);
> *(state+1)= *(in+4)<<24 | *(in+5)<< 16 | *(in+6)<<8 | *(in+7) ;
> *(state+2)= *(in+8)<<24 | *(in+9)<< 16 | *(in+10)<<8 | *(in+11) ;
> *(state+3)= *(in+1)<<24 | *(in+3)<< 16 | *(in+14)<<8 | *(in+15) ;
I don't know whose code it is but it has bugs in it.
The line above should be:
*(state+3)= *(in+12)<<24 | *(in+13)<< 16 | *(in+14)<<8 | *(in+15);
I doubt that this is the only problem in this code either.
[snip]
Brian Gladman
---------------------------------------------------------------------
The Cryptography Mailing List
Unsubscribe by sending "unsubscribe cryptography" to majordomo at metzdowd.com
More information about the cryptography
mailing list