Commit Graph

9 Commits

Author SHA1 Message Date
Karel Zak 42dea85c5a lib/md5: use ul_/UL_ prefix
The symbols names are too generic.

Addresses: https://github.com/karelzak/util-linux/issues/548
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-12-12 12:06:15 +01:00
Luca Ceresoli 424cee0f06 md5: declare byteReverse as static
byteReverse() is an internal function in md5.c, and is not exposed via
any header file, but it is not declared as static. This is a problem
with the md5.c file since it is copied more or less verbatim in other
programs (fontconfig and pjsip among others), causing a link error
when linking two of them together.

Fixes link failures such as:
  http://autobuild.buildroot.net/results/419ab2c0e034cc68991281c51caa8271b0fadbab/build-end.log

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
2017-11-08 11:49:59 +01:00
Mike Frysinger 6c6f719688 md5: fix strict aliasing warnings
This is the same fix as was merged in gcc/binutils where this code
appears to originate from.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-10-10 11:23:24 +02:00
Sami Kerola e429d14106 md5: use symbolical digest length
Magic hash lenght number 16 is turned to a definition MD5LENGTH,
and put into use everywhere where md5 checksum is in use.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-21 23:56:48 +02:00
Fabian Groffen aabe244176 build-sys: use WORDS_BIGENDIAN to determine platform byte-order
Autoconf contains the right magic to determine the endianness on many
platforms next to Linux.  This reverses previous commits to move away
from WORDS_BIGENDIAN:
"use __BYTE_ORDER rather than AC specific WORDS_BIGENDIAN"

This is necessary to compile on non Linux platforms like Darwin and
Solaris.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2011-01-17 15:34:45 +01:00
Karel Zak 6596057175 lib: bug (typo) in function MD5Final()
On Wed, Dec 09, 2009 at 10:08:38PM +0000, Jochen Voss wrote:
> while experimenting with coccinelle, I accidentally found what I
> believe is a bug in util-linux-ng release 2.17-rc2 (downloaded
> today). The problem is the following code in lib/md5.c (around line
> 153):
>
>     void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
>     {
>   [...]
>   memset(ctx, 0, sizeof(ctx));        /* In case it's sensitive */
>     }
>
> The third argument of memset should probably be the size of 'struct
> MD5Context' instead of the size of the pointer.  So my guess is
> that the memset line should be
>
>   memset(ctx, 0, sizeof(*ctx));       /* In case it's sensitive */
>
> instead.  I don't know whether this actually causes a problem,
> but the comment makes it seem possible that it does.

Note, this typo does not have any impact on the utils in the
util-linux-ng project, because we don't use MD5 for any security
sensitive data or cryptographic stuff. The typo also does not have any
impact to the final MD5 hashes.

Reported-by: Jochen Voss <voss@seehuhn.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-12-10 11:59:46 +01:00
Karel Zak 6fc2c88210 lib: add __BYTE_ORDER to md5.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-12-08 11:12:30 +01:00
Karel Zak d03dd60840 Imported from util-linux-2.12a tarball. 2006-12-07 00:26:14 +01:00
Karel Zak 95f1bdeee4 Imported from util-linux-2.11x tarball. 2006-12-07 00:26:05 +01:00