[pacman-dev] Crypto algorithms
Dan McGee
dpmcgee at gmail.com
Mon Apr 9 10:46:03 EDT 2007
On 4/9/07, VMiklos <vmiklos at frugalware.org> wrote:
> Na Sun, Apr 08, 2007 at 08:21:01PM -0400, Dan McGee <dpmcgee at gmail.com> pisal(a):
> > We have a rather ragtag set of cryptography functions in use right
> > now, and weird files being used (md5driver? wtf).
>
> md5driver is _the_ standard md5 hashing algorithm, just like the sha1
> one. and of course it's portable after krix reverted some (probably
> accident) changes Judd made to the original one. grep for md5.*x86_64 in
> /usr/share/doc/pacman-*/NEWS. oh, you remove documentation sorry :(
One of the biggest issues I had was this code in sha1.h:
/* TODO check this comment */
/* The code below is from md5.h (from coreutils), little modifications */
#define UINT_MAX_32_BITS 4294967295U
/* This new ifdef allows splint to not fail on its static code check */
#ifdef S_SPLINT_S
typedef unsigned int sha_uint32;
#else
#if UINT_MAX == UINT_MAX_32_BITS
typedef unsigned int sha_uint32;
#else
#if USHRT_MAX == UINT_MAX_32_BITS
typedef unsigned short sha_uint32;
#else
#if ULONG_MAX == UINT_MAX_32_BITS
typedef unsigned long sha_uint32;
#else
/* The following line is intended to evoke an error. Using #error
is not portable enough. */
#error "Cannot determine unsigned 32-bit data type"
#endif /* ULONG_MAX */
#endif /* USHRT_MAX */
#endif /* UINT_MAX */
#endif /* S_SPLINT_S */
/* We have to make a guess about the integer type equivalent in size
to pointers which should always be correct. */
typedef unsigned long int sha_uintptr;
Every semantic parser except GCC chokes on this code because it is
doing so many screwy things. I'd rather use a set of tools that uses
similar calls across all hashing methods in order to allow for future
extensibility. In addition, BeeCrypt provides some ASM optimized
implementations of algorithms, and knowing what pacman's current choke
points are this is a good thing.
-Dan
More information about the pacman-dev
mailing list