summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2016-03-02 10:54:24 -0800
committerH. Peter Anvin <hpa@zytor.com>2016-03-02 10:54:24 -0800
commit140c214ad04a51dab937cda1fe1ea4b9d60fb86d (patch)
treefb32f5a3cb538002916cc48e0b24a0aaee187c9a
parent53f1559c06d8ca5578c61d3897d131b83f841689 (diff)
downloadnasm-140c214ad04a51dab937cda1fe1ea4b9d60fb86d.tar.gz
md5: use "compiler.h", WORDS_LITTLEENDIAN and make functions static
Look for WORDS_LITTLEENDIAN instead of the gcc-specific __BYTE_ORDER. Use our existing "compiler.h" portability layer. Make functions which are not exported static. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--md5.h9
-rw-r--r--md5c.c8
2 files changed, 8 insertions, 9 deletions
diff --git a/md5.h b/md5.h
index ea34cda1..fb6ac607 100644
--- a/md5.h
+++ b/md5.h
@@ -1,6 +1,7 @@
-#ifndef _MD5_H_
-#define _MD5_H_
+#ifndef MD5_H
+#define MD5_H
+#include "compiler.h"
#include <inttypes.h>
#define MD5_HASHBYTES 16
@@ -17,7 +18,5 @@ extern void MD5Update(MD5_CTX *context, unsigned char const *buf,
extern void MD5Final(unsigned char digest[MD5_HASHBYTES], MD5_CTX *context);
extern void MD5Transform(uint32_t buf[4], uint32_t const in[16]);
extern char * MD5End(MD5_CTX *, char *);
-extern char * MD5File(const char *, char *);
-extern char * MD5Data (const unsigned char *, unsigned int, char *);
-#endif /* !_MD5_H_ */
+#endif /* !MD5_H */
diff --git a/md5c.c b/md5c.c
index 27162327..5d5c91a3 100644
--- a/md5c.c
+++ b/md5c.c
@@ -15,18 +15,18 @@
* will fill a supplied 16-byte array with the digest.
*/
-#include <string.h> /* for memcpy() */
#include "md5.h"
+#include <string.h> /* for memcpy() */
-#if __BYTE_ORDER == 1234
+#ifdef WORDS_LITTEENDIAN
#define byteReverse(buf, len) /* Nothing */
#else
-void byteReverse(unsigned char *buf, unsigned longs);
+static void byteReverse(unsigned char *buf, unsigned longs);
/*
* Note: this code is harmless on little-endian machines.
*/
-void byteReverse(unsigned char *buf, unsigned longs)
+static void byteReverse(unsigned char *buf, unsigned longs)
{
uint32_t t;
do {