[16157] in cryptography@c2.net mail archive

home help back first fref pref prev next nref lref last post

Re: Looking for Source of AES code

daemon@ATHENA.MIT.EDU (Brian Gladman)
Tue Sep 14 17:46:29 2004

X-Original-To: cryptography@metzdowd.com
X-Original-To: cryptography@metzdowd.com
Date: Tue, 14 Sep 2004 09:35:59 +0100
From: Brian Gladman <brg@gladman.plus.com>
Reply-To: brg@gladman.plus.com
Cc: cryptography@metzdowd.com
In-Reply-To: <00e601c4997f$f5f66b00$4325ce88@DamienORourke>

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@metzdowd.com

home help back first fref pref prev next nref lref last post