Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
7a4cc54e
Commit
7a4cc54e
authored
Dec 04, 2000
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eliminate some of the more blatant platform-dependencies ... it builds here now, anyway ...
parent
2bf2ee78
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
50 deletions
+50
-50
contrib/pgcrypto/md5.c
contrib/pgcrypto/md5.c
+18
-18
contrib/pgcrypto/md5.h
contrib/pgcrypto/md5.h
+11
-11
contrib/pgcrypto/sha1.c
contrib/pgcrypto/sha1.c
+9
-9
contrib/pgcrypto/sha1.h
contrib/pgcrypto/sha1.h
+12
-12
No files found.
contrib/pgcrypto/md5.c
View file @
7a4cc54e
/* $
KAME: md5.c,v 1.3 2000/02/22 14:01:17 itojun
Exp $ */
/* $
Id: md5.c,v 1.2 2000/12/04 01:20:38 tgl
Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
...
...
@@ -91,7 +91,7 @@
#define MD5_D0 0x10325476
/* Integer part of 4294967296 times abs(sin(i)), where i is in radians. */
static
const
u
_
int32_t
T
[
65
]
=
{
static
const
uint32_t
T
[
65
]
=
{
0
,
0xd76aa478
,
0xe8c7b756
,
0x242070db
,
0xc1bdceee
,
0xf57c0faf
,
0x4787c62a
,
0xa8304613
,
0xfd469501
,
...
...
@@ -114,7 +114,7 @@ static const u_int32_t T[65] = {
0xf7537e82
,
0xbd3af235
,
0x2ad7d2bb
,
0xeb86d391
,
};
static
const
u
_
int8_t
md5_paddat
[
MD5_BUFLEN
]
=
{
static
const
uint8_t
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 u_int8_t md5_paddat[MD5_BUFLEN] = {
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
};
static
void
md5_calc
__P
((
u_int8_t
*
,
md5_ctxt
*
)
);
static
void
md5_calc
(
uint8_t
*
,
md5_ctxt
*
);
void
md5_init
(
ctxt
)
md5_ctxt
*
ctxt
;
...
...
@@ -141,10 +141,10 @@ void md5_init(ctxt)
void
md5_loop
(
ctxt
,
input
,
len
)
md5_ctxt
*
ctxt
;
u
_
int8_t
*
input
;
u
_
int
len
;
/* number of bytes */
uint8_t
*
input
;
u
nsigned
int
len
;
/* number of bytes */
{
u
_
int
gap
,
i
;
u
nsigned
int
gap
,
i
;
ctxt
->
md5_n
+=
len
*
8
;
/* byte to bit */
gap
=
MD5_BUFLEN
-
ctxt
->
md5_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
((
u
_
int8_t
*
)(
input
+
i
),
ctxt
);
md5_calc
((
uint8_t
*
)(
input
+
i
),
ctxt
);
}
ctxt
->
md5_i
=
len
-
i
;
...
...
@@ -170,7 +170,7 @@ void md5_loop(ctxt, input, len)
void
md5_pad
(
ctxt
)
md5_ctxt
*
ctxt
;
{
u
_
int
gap
;
u
nsigned
int
gap
;
/* Don't count up padding. Keep md5_n. */
gap
=
MD5_BUFLEN
-
ctxt
->
md5_i
;
...
...
@@ -207,7 +207,7 @@ void md5_pad(ctxt)
}
void
md5_result
(
digest
,
ctxt
)
u
_
int8_t
*
digest
;
uint8_t
*
digest
;
md5_ctxt
*
ctxt
;
{
/* 4 byte words */
...
...
@@ -227,24 +227,24 @@ void md5_result(digest, ctxt)
}
#if BYTE_ORDER == BIG_ENDIAN
u
_
int32_t
X
[
16
];
uint32_t
X
[
16
];
#endif
static
void
md5_calc
(
b64
,
ctxt
)
u
_
int8_t
*
b64
;
uint8_t
*
b64
;
md5_ctxt
*
ctxt
;
{
u
_
int32_t
A
=
ctxt
->
md5_sta
;
u
_
int32_t
B
=
ctxt
->
md5_stb
;
u
_
int32_t
C
=
ctxt
->
md5_stc
;
u
_
int32_t
D
=
ctxt
->
md5_std
;
uint32_t
A
=
ctxt
->
md5_sta
;
uint32_t
B
=
ctxt
->
md5_stb
;
uint32_t
C
=
ctxt
->
md5_stc
;
uint32_t
D
=
ctxt
->
md5_std
;
#if BYTE_ORDER == LITTLE_ENDIAN
u
_int32_t
*
X
=
(
u_
int32_t
*
)
b64
;
u
int32_t
*
X
=
(
u
int32_t
*
)
b64
;
#endif
#if BYTE_ORDER == BIG_ENDIAN
/* 4 byte words */
/* what a brute force but fast! */
u
_int8_t
*
y
=
(
u_
int8_t
*
)
X
;
u
int8_t
*
y
=
(
u
int8_t
*
)
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
];
...
...
contrib/pgcrypto/md5.h
View file @
7a4cc54e
/* $
KAME: md5.h,v 1.3 2000/02/22 14:01:18 itojun
Exp $ */
/* $
Id: md5.h,v 1.2 2000/12/04 01:20:38 tgl
Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
...
...
@@ -36,8 +36,8 @@
typedef
struct
{
union
{
u
_
int32_t
md5_state32
[
4
];
u
_int8_t
md5_state8
[
16
];
uint32_t
md5_state32
[
4
];
u
int8_t
md5_state8
[
16
];
}
md5_st
;
#define md5_sta md5_st.md5_state32[0]
...
...
@@ -47,20 +47,20 @@ typedef struct {
#define md5_st8 md5_st.md5_state8
union
{
u
_
int64_t
md5_count64
;
u
_int8_t
md5_count8
[
8
];
uint64_t
md5_count64
;
u
int8_t
md5_count8
[
8
];
}
md5_count
;
#define md5_n md5_count.md5_count64
#define md5_n8 md5_count.md5_count8
u
_
int
md5_i
;
u
_int8_t
md5_buf
[
MD5_BUFLEN
];
u
nsigned
int
md5_i
;
u
int8_t
md5_buf
[
MD5_BUFLEN
];
}
md5_ctxt
;
extern
void
md5_init
__P
((
md5_ctxt
*
)
);
extern
void
md5_loop
__P
((
md5_ctxt
*
,
u_int8_t
*
,
u_int
)
);
extern
void
md5_pad
__P
((
md5_ctxt
*
)
);
extern
void
md5_result
__P
((
u_int8_t
*
,
md5_ctxt
*
)
);
extern
void
md5_init
(
md5_ctxt
*
);
extern
void
md5_loop
(
md5_ctxt
*
,
uint8_t
*
,
unsigned
int
);
extern
void
md5_pad
(
md5_ctxt
*
);
extern
void
md5_result
(
uint8_t
*
,
md5_ctxt
*
);
/* compatibility */
#define MD5_CTX md5_ctxt
...
...
contrib/pgcrypto/sha1.c
View file @
7a4cc54e
/* $
KAME: sha1.c,v 1.3 2000/02/22 14:01:18 itojun
Exp $ */
/* $
Id: sha1.c,v 1.2 2000/12/04 01:20:38 tgl
Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
...
...
@@ -49,7 +49,7 @@
#ifndef unsupported
/* constant table */
static
u
_
int32_t
_K
[]
=
{
0x5a827999
,
0x6ed9eba1
,
0x8f1bbcdc
,
0xca62c1d6
};
static
uint32_t
_K
[]
=
{
0x5a827999
,
0x6ed9eba1
,
0x8f1bbcdc
,
0xca62c1d6
};
#define K(t) _K[(t) / 20]
#define F0(b, c, d) (((b) & (c)) | ((~(b)) & (d)))
...
...
@@ -81,15 +81,15 @@ static u_int32_t _K[] = { 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6 };
sha1_step(ctxt); \
}
static
void
sha1_step
__P
((
struct
sha1_ctxt
*
)
);
static
void
sha1_step
(
struct
sha1_ctxt
*
);
static
void
sha1_step
(
ctxt
)
struct
sha1_ctxt
*
ctxt
;
{
u
_
int32_t
a
,
b
,
c
,
d
,
e
;
uint32_t
a
,
b
,
c
,
d
,
e
;
size_t
t
,
s
;
u
_
int32_t
tmp
;
uint32_t
tmp
;
#if BYTE_ORDER == LITTLE_ENDIAN
struct
sha1_ctxt
tctxt
;
...
...
@@ -221,13 +221,13 @@ sha1_loop(ctxt, input0, len)
const
caddr_t
input0
;
size_t
len
;
{
const
u
_
int8_t
*
input
;
const
uint8_t
*
input
;
size_t
gaplen
;
size_t
gapstart
;
size_t
off
;
size_t
copysiz
;
input
=
(
const
u
_
int8_t
*
)
input0
;
input
=
(
const
uint8_t
*
)
input0
;
off
=
0
;
while
(
off
<
len
)
{
...
...
@@ -250,9 +250,9 @@ sha1_result(ctxt, digest0)
struct
sha1_ctxt
*
ctxt
;
caddr_t
digest0
;
{
u
_
int8_t
*
digest
;
uint8_t
*
digest
;
digest
=
(
u
_
int8_t
*
)
digest0
;
digest
=
(
uint8_t
*
)
digest0
;
sha1_pad
(
ctxt
);
#if BYTE_ORDER == BIG_ENDIAN
bcopy
(
&
ctxt
->
h
.
b8
[
0
],
digest
,
20
);
...
...
contrib/pgcrypto/sha1.h
View file @
7a4cc54e
/* $
KAME: sha1.h,v 1.4 2000/02/22 14:01:18 itojun
Exp $ */
/* $
Id: sha1.h,v 1.2 2000/12/04 01:20:38 tgl
Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
...
...
@@ -39,24 +39,24 @@
struct
sha1_ctxt
{
union
{
u
_int8_t
b8
[
20
];
u
_
int32_t
b32
[
5
];
u
int8_t
b8
[
20
];
uint32_t
b32
[
5
];
}
h
;
union
{
u
_int8_t
b8
[
8
];
u
_
int64_t
b64
[
1
];
u
int8_t
b8
[
8
];
uint64_t
b64
[
1
];
}
c
;
union
{
u
_int8_t
b8
[
64
];
u
_
int32_t
b32
[
16
];
u
int8_t
b8
[
64
];
uint32_t
b32
[
16
];
}
m
;
u
_int8_t
count
;
u
int8_t
count
;
};
extern
void
sha1_init
__P
((
struct
sha1_ctxt
*
)
);
extern
void
sha1_pad
__P
((
struct
sha1_ctxt
*
)
);
extern
void
sha1_loop
__P
((
struct
sha1_ctxt
*
,
const
caddr_t
,
size_t
)
);
extern
void
sha1_result
__P
((
struct
sha1_ctxt
*
,
caddr_t
)
);
extern
void
sha1_init
(
struct
sha1_ctxt
*
);
extern
void
sha1_pad
(
struct
sha1_ctxt
*
);
extern
void
sha1_loop
(
struct
sha1_ctxt
*
,
const
caddr_t
,
size_t
);
extern
void
sha1_result
(
struct
sha1_ctxt
*
,
caddr_t
);
/* compatibilty with other SHA1 source codes */
typedef
struct
sha1_ctxt
SHA1_CTX
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment