Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit cff2342

Browse files
committed
I noticed that the contrib Makefiles were reorganized.
Converted pgcrypto one too. * Changed default randomness source to libc random() That way pgcrypto does not have any external dependencies and should work everywhere. * Re-enabled pgcrypto build in contrib/makefile * contrib/README update - there is more stuff than only 'hash functions' * Noted the libc random fact in README.pgcrypto Marko Kreen
1 parent 850ba41 commit cff2342

File tree

5 files changed

+33
-50
lines changed

5 files changed

+33
-50
lines changed

contrib/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Header: /cvsroot/pgsql/contrib/Makefile,v 1.27 2001/09/06 10:49:29 petere Exp $
1+
# $Header: /cvsroot/pgsql/contrib/Makefile,v 1.28 2001/09/29 03:11:58 momjian Exp $
22

33
subdir = contrib
44
top_builddir = ..
@@ -26,6 +26,7 @@ WANTED_DIRS = \
2626
pg_logger \
2727
pg_resetxlog \
2828
pgbench \
29+
pgcrypto \
2930
rserv \
3031
rtree_gist \
3132
seg \
@@ -41,7 +42,6 @@ WANTED_DIRS = \
4142
# mac \ (does not have a makefile)
4243
# mysql \ (does not have a makefile)
4344
# oracle \ (does not have a makefile)
44-
# pgcrypto \ (non-standard makefile)
4545
# start-scripts \ (does not have a makefile)
4646
# tools \ (does not have a makefile)
4747
# xml \ (non-standard makefile)

contrib/README

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ pgbench -
134134
by Tatsuo Ishii <t-ishii@sra.co.jp>
135135

136136
pgcrypto -
137-
Cryptographic hash functions
137+
Cryptographic functions
138138
by Marko Kreen <marko@l-t.ee>
139139

140140
retep -

contrib/pgcrypto/Makefile

+12-31
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# $Header: /cvsroot/pgsql/contrib/pgcrypto/Makefile,v 1.7 2001/09/23 04:12:44 momjian Exp $
2+
# $Header: /cvsroot/pgsql/contrib/pgcrypto/Makefile,v 1.8 2001/09/29 03:11:58 momjian Exp $
33
#
44

55
subdir = contrib/pgcrypto
@@ -21,7 +21,7 @@ cryptsrc = builtin
2121
# This works ofcouse only with cryptolib = openssl
2222
#
2323
# 'silly' - use libc random() - very weak
24-
random = dev
24+
random = silly
2525
random_dev = \"/dev/urandom\"
2626

2727
##########################
@@ -60,41 +60,22 @@ ifeq ($(random), silly)
6060
CRYPTO_CFLAGS += -DRAND_SILLY
6161
endif
6262

63-
NAME := pgcrypto
64-
SRCS += pgcrypto.c px.c px-hmac.c px-crypt.c misc.c \
65-
crypt-gensalt.c random.c
66-
OBJS := $(SRCS:.c=.o)
67-
SHLIB_LINK := $(CRYPTO_LDFLAGS)
68-
SO_MAJOR_VERSION = 0
69-
SO_MINOR_VERSION = 1
63+
MODULE_big := pgcrypto
64+
SRCS += pgcrypto.c px.c px-hmac.c px-crypt.c misc.c \
65+
crypt-gensalt.c random.c
66+
OBJS := $(SRCS:.c=.o)
67+
DOCS := README.pgcrypto
68+
DATA_built := pgcrypto.sql
69+
EXTRA_CLEAN := gen-rtab
7070

71-
override CPPFLAGS += $(CRYPTO_CFLAGS) -I$(srcdir)
72-
override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)
73-
rpath :=
71+
PG_CPPFLAGS := $(CRYPTO_CFLAGS) -I$(srcdir)
72+
SHLIB_LINK := $(CRYPTO_LDFLAGS)
7473

75-
all: all-lib $(NAME).sql
76-
77-
include $(top_srcdir)/src/Makefile.shlib
78-
79-
$(NAME).sql: $(NAME).sql.in
80-
sed 's,@MODULE_FILENAME@,$$libdir/$(NAME),g' $< >$@
74+
include $(top_srcdir)/contrib/contrib-global.mk
8175

8276
rijndael.o: rijndael.tbl
8377

8478
rijndael.tbl:
8579
$(CC) $(CPPFLAGS) $(CFLAGS) -DPRINT_TABS rijndael.c -o gen-rtab
8680
./gen-rtab > rijndael.tbl
8781

88-
install: all installdirs
89-
$(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(pkglibdir)/pgcrypto$(DLSUFFIX)
90-
$(INSTALL_DATA) $(NAME).sql $(DESTDIR)$(datadir)/contrib/$(NAME).sql
91-
$(INSTALL_DATA) README.$(NAME) $(DESTDIR)$(docdir)/contrib/README.$(NAME)
92-
93-
installdirs:
94-
$(mkinstalldirs) $(pkglibdir) $(datadir)/contrib $(docdir)/contrib
95-
96-
uninstall: uninstall-lib
97-
rm -f $(DESTDIR)$(pkglibdir)/pgcrypto$(DLSUFFIX) $(datadir)/contrib/$(NAME).sql $(docdir)/contrib/README.$(NAME)
98-
99-
clean distclean maintainer-clean: clean-lib
100-
rm -f $(OBJS) $(NAME).sql gen-rtab

contrib/pgcrypto/README.pgcrypto

+6-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ INSTALLATION
99

1010
Edit makefile, if you want to use any external library.
1111

12-
NB! Default randomness source is /dev/urandom device. If you
13-
do not have it, you also need to edit Makefile to let pgcrypto
14-
use either OpenSSL PRNG or libc random() PRNG. Using libc random()
15-
is discouraged.
12+
NB! Default randomness source is libc random() function. This
13+
is so only to get pgcrypto build everywhere. Randomness is
14+
needed for gen_salt() function. So if you plan using it, you
15+
should definitely change that by editing Makefile. You should
16+
be using urandom device if your OS supports it, otherwise link
17+
pgcrypto against OpenSSL library and use its PRNG.
1618

1719
After editing Makefile:
1820

contrib/pgcrypto/pgcrypto.sql.in

+12-12
Original file line numberDiff line numberDiff line change
@@ -15,51 +15,51 @@
1515

1616

1717
CREATE FUNCTION digest(bytea, text) RETURNS bytea
18-
AS '@MODULE_FILENAME@',
18+
AS 'MODULE_PATHNAME',
1919
'pg_digest' LANGUAGE 'C';
2020

2121
CREATE FUNCTION digest_exists(text) RETURNS bool
22-
AS '@MODULE_FILENAME@',
22+
AS 'MODULE_PATHNAME',
2323
'pg_digest_exists' LANGUAGE 'C';
2424

2525
CREATE FUNCTION hmac(bytea, bytea, text) RETURNS bytea
26-
AS '@MODULE_FILENAME@',
26+
AS 'MODULE_PATHNAME',
2727
'pg_hmac' LANGUAGE 'C';
2828

2929
CREATE FUNCTION hmac_exists(text) RETURNS bool
30-
AS '@MODULE_FILENAME@',
30+
AS 'MODULE_PATHNAME',
3131
'pg_hmac_exists' LANGUAGE 'C';
3232

3333
CREATE FUNCTION crypt(text, text) RETURNS text
34-
AS '@MODULE_FILENAME@',
34+
AS 'MODULE_PATHNAME',
3535
'pg_crypt' LANGUAGE 'C';
3636

3737
CREATE FUNCTION gen_salt(text) RETURNS text
38-
AS '@MODULE_FILENAME@',
38+
AS 'MODULE_PATHNAME',
3939
'pg_gen_salt' LANGUAGE 'C';
4040

4141
CREATE FUNCTION gen_salt(text, int4) RETURNS text
42-
AS '@MODULE_FILENAME@',
42+
AS 'MODULE_PATHNAME',
4343
'pg_gen_salt_rounds' LANGUAGE 'C';
4444

4545
CREATE FUNCTION encrypt(bytea, bytea, text) RETURNS bytea
46-
AS '@MODULE_FILENAME@',
46+
AS 'MODULE_PATHNAME',
4747
'pg_encrypt' LANGUAGE 'C';
4848

4949
CREATE FUNCTION decrypt(bytea, bytea, text) RETURNS bytea
50-
AS '@MODULE_FILENAME@',
50+
AS 'MODULE_PATHNAME',
5151
'pg_decrypt' LANGUAGE 'C';
5252

5353
CREATE FUNCTION encrypt_iv(bytea, bytea, bytea, text) RETURNS bytea
54-
AS '@MODULE_FILENAME@',
54+
AS 'MODULE_PATHNAME',
5555
'pg_encrypt_iv' LANGUAGE 'C';
5656

5757
CREATE FUNCTION decrypt_iv(bytea, bytea, bytea, text) RETURNS bytea
58-
AS '@MODULE_FILENAME@',
58+
AS 'MODULE_PATHNAME',
5959
'pg_decrypt_iv' LANGUAGE 'C';
6060

6161
CREATE FUNCTION cipher_exists(text) RETURNS bool
62-
AS '@MODULE_FILENAME@',
62+
AS 'MODULE_PATHNAME',
6363
'pg_cipher_exists' LANGUAGE 'C';
6464

6565

0 commit comments

Comments
 (0)