mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-02-17 17:19:35 +08:00
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>
This commit is contained in:
parent
53f1559c06
commit
140c214ad0
9
md5.h
9
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 */
|
||||
|
8
md5c.c
8
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user