aboutsummaryrefslogtreecommitdiff
path: root/contrib/pgcrypto/md5.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2001-01-09 16:07:14 +0000
committerBruce Momjian <bruce@momjian.us>2001-01-09 16:07:14 +0000
commite586026d10da39d591a43474c63fce73deb8f0d9 (patch)
treeb08531587b1a8b4741692c2d34c41ef69658e426 /contrib/pgcrypto/md5.c
parentf906597e50ae633556c978f72e67e6c61b6e554d (diff)
downloadpostgresql-e586026d10da39d591a43474c63fce73deb8f0d9.tar.gz
postgresql-e586026d10da39d591a43474c63fce73deb8f0d9.zip
The KAME files md5.* and sha1.* have the following changelog
entry: ---------------------------- revision 1.2 date: 2000/12/04 01:20:38; author: tgl; state: Exp; lines: +18 -18 Eliminate some of the more blatant platform-dependencies ... it builds here now, anyway ... ---------------------------- Which basically changes u_int*_t -> uint*_t, so now it does not compile neither under Debian 2.2 nor under NetBSD 1.5 which is platform independent<B8> all right. Also it replaces $KAME$ with $Id$ which is Bad Thing. PostgreSQL Id should be added as a separate line so the file history could be seen. So here is patch: * changes uint*_t -> uint*. I guess that was the original intention * adds uint64 type to include/c.h because its needed [somebody should check if I did it right] * adds back KAME Id, because KAME is the master repository * removes stupid c++ comments in pgcrypto.c * removes <sys/types.h> from the code, its not needed -- marko Marko Kreen
Diffstat (limited to 'contrib/pgcrypto/md5.c')
-rw-r--r--contrib/pgcrypto/md5.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/contrib/pgcrypto/md5.c b/contrib/pgcrypto/md5.c
index e6bc94c7b1a..9cdfa6e1aca 100644
--- a/contrib/pgcrypto/md5.c
+++ b/contrib/pgcrypto/md5.c
@@ -1,4 +1,5 @@
-/* $Id: md5.c,v 1.2 2000/12/04 01:20:38 tgl Exp $ */
+/* $Id: md5.c,v 1.3 2001/01/09 16:07:13 momjian Exp $ */
+/* $KAME: md5.c,v 1.3 2000/02/22 14:01:17 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -30,7 +31,6 @@
*/
#include <postgres.h>
-#include "pgcrypto.h"
#include "md5.h"
@@ -91,7 +91,7 @@
#define MD5_D0 0x10325476
/* Integer part of 4294967296 times abs(sin(i)), where i is in radians. */
-static const uint32_t T[65] = {
+static const uint32 T[65] = {
0,
0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
@@ -114,7 +114,7 @@ static const uint32_t T[65] = {
0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391,
};
-static const uint8_t md5_paddat[MD5_BUFLEN] = {
+static const uint8 md5_paddat[MD5_BUFLEN] = {
0x80, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -125,7 +125,7 @@ static const uint8_t md5_paddat[MD5_BUFLEN] = {
0, 0, 0, 0, 0, 0, 0, 0,
};
-static void md5_calc (uint8_t *, md5_ctxt *);
+static void md5_calc (uint8 *, md5_ctxt *);
void md5_init(ctxt)
md5_ctxt *ctxt;
@@ -141,7 +141,7 @@ void md5_init(ctxt)
void md5_loop(ctxt, input, len)
md5_ctxt *ctxt;
- uint8_t *input;
+ uint8 *input;
unsigned int len; /* number of bytes */
{
unsigned int gap, i;
@@ -155,7 +155,7 @@ void md5_loop(ctxt, input, len)
md5_calc(ctxt->md5_buf, ctxt);
for (i = gap; i + MD5_BUFLEN <= len; i += MD5_BUFLEN) {
- md5_calc((uint8_t *)(input + i), ctxt);
+ md5_calc((uint8 *)(input + i), ctxt);
}
ctxt->md5_i = len - i;
@@ -207,7 +207,7 @@ void md5_pad(ctxt)
}
void md5_result(digest, ctxt)
- uint8_t *digest;
+ uint8 *digest;
md5_ctxt *ctxt;
{
/* 4 byte words */
@@ -227,24 +227,24 @@ void md5_result(digest, ctxt)
}
#if BYTE_ORDER == BIG_ENDIAN
-uint32_t X[16];
+uint32 X[16];
#endif
static void md5_calc(b64, ctxt)
- uint8_t *b64;
+ uint8 *b64;
md5_ctxt *ctxt;
{
- uint32_t A = ctxt->md5_sta;
- uint32_t B = ctxt->md5_stb;
- uint32_t C = ctxt->md5_stc;
- uint32_t D = ctxt->md5_std;
+ uint32 A = ctxt->md5_sta;
+ uint32 B = ctxt->md5_stb;
+ uint32 C = ctxt->md5_stc;
+ uint32 D = ctxt->md5_std;
#if BYTE_ORDER == LITTLE_ENDIAN
- uint32_t *X = (uint32_t *)b64;
+ uint32 *X = (uint32 *)b64;
#endif
#if BYTE_ORDER == BIG_ENDIAN
/* 4 byte words */
/* what a brute force but fast! */
- uint8_t *y = (uint8_t *)X;
+ uint8 *y = (uint8 *)X;
y[ 0] = b64[ 3]; y[ 1] = b64[ 2]; y[ 2] = b64[ 1]; y[ 3] = b64[ 0];
y[ 4] = b64[ 7]; y[ 5] = b64[ 6]; y[ 6] = b64[ 5]; y[ 7] = b64[ 4];
y[ 8] = b64[11]; y[ 9] = b64[10]; y[10] = b64[ 9]; y[11] = b64[ 8];