bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hmac-md5


From: Simon Josefsson
Subject: Re: hmac-md5
Date: Thu, 06 Oct 2005 13:29:03 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Paul Eggert <address@hidden> writes:

> Simon Josefsson <address@hidden> writes:
>
>> Has anyone used md5_buffer from the md5 module on a platform with char
>> that is larger than 1 byte?
>
> Do you mean a host where UCHAR_MAX > 255?  I doubt whether anyone has
> done that.  POSIX requires that UCHAR_MAX == 255.  A small fraction of
> GNU code is portable to hosts where UCHAR_MAX > 255, but usually this
> is more for the amusement of the author than anything else.
>
> If you meant sizeof (char) > 1, then I really doubt whether anyone has
> done that.  C has required that sizeof (char) == 1 for ages.

Ok, then perhaps 'char*' is better than 'void*' for hmac-md5.  When I
think more about it, also the encoding of the bytes inside 'char*'
matter.  Is there a portability requirement that 'char foo = 0xAA' end
up with 10101010 in the memory buffer (void*)&foo?  I think we need
that assumption since the md5 module uses 'void*'.

I'm not sure about 'unsigned char*'.  Using 'unsigned char*' usually
lead to plenty of signed/unsigned warnings sooner or later.  If we
make the code work regardless of whether 'char'=='unsigned char' or
'char'=='signed char', do we really have to specify 'unsigned char*'
in the API?  Perhaps 'char*' leads to less problems.

I never realize how little I know until I start to do things..

Thanks,
Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]