Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] crypt-sha1

From: Sebastien Tandel <sebastien@xxxxxxxxx>
Date: Fri, 16 Mar 2007 16:12:12 +0100
Thanks for the answer.

And here is the patch to change guint -> guint32 in the hmac function.

Regards,
Sebastien Tandel

Luis Ontanon wrote:
> If they are in the hmac code that's probably my fault when I put it
> back in the repo.
>
> I don't think it will be causing any problems, as we do not run in any
> 16 bit platform guint is either equal to guint32 or larger (64) and
> the way the code is written is protected from both endianity and word
> lenght (as far as it is at least 32 bits).
>
> However, go ahead and change it.
>
> On 3/16/07, Sebastien Tandel <sebastien@xxxxxxxxx> wrote:
>   
>> Hi,
>>
>>    just for curiosity purposes :
>>
>> I'm looking at crypt-sha1.c, and seeing variables defined as guint and
>> not as guint32. On the other hand, we can also read in the header file
>> that Anders changed uint to uint32_t in 2004.
>> Are there some conflicts? Are there some reasons to keep the guint
>> instead of guint32?
>>
>> Regards,
>> Sebastien Tandel
>>
>>
>> _______________________________________________
>> Wireshark-dev mailing list
>> Wireshark-dev@xxxxxxxxxxxxx
>> http://www.wireshark.org/mailman/listinfo/wireshark-dev
>>
>>     
>
>
>   

Index: epan/crypt/crypt-sha1.c
===================================================================
--- epan/crypt/crypt-sha1.c	(révision 20799)
+++ epan/crypt/crypt-sha1.c	(copie de travail)
@@ -293,10 +293,10 @@
 /*
  * Output HMAC-SHA-1(key,buf)
  */
-void sha1_hmac( const guint8 *key, guint keylen, const guint8 *buf, guint buflen,
+void sha1_hmac( const guint8 *key, guint32 keylen, const guint8 *buf, guint32 buflen,
                 guint8 digest[20] )
 {
-    guint i;
+    guint32 i;
     sha1_context ctx;
     guint8 k_ipad[64];
     guint8 k_opad[64];
Index: epan/crypt/crypt-sha1.h
===================================================================
--- epan/crypt/crypt-sha1.h	(révision 20799)
+++ epan/crypt/crypt-sha1.h	(copie de travail)
@@ -39,7 +39,7 @@
 void sha1_starts( sha1_context *ctx );
 void sha1_update( sha1_context *ctx, const guint8 *input, guint32 length );
 void sha1_finish( sha1_context *ctx, guint8 digest[20] );
-void sha1_hmac( const guint8 *key, guint keylen, const guint8 *buf, guint buflen,
+void sha1_hmac( const guint8 *key, guint32 keylen, const guint8 *buf, guint32 buflen,
                 guint8 digest[20] );
 
 #endif /* crypt-sha1.h */