From cff23429d658d3591e7e0af129f158e90d0a4776 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sat, 29 Sep 2001 03:11:58 +0000 Subject: [PATCH] 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 --- contrib/Makefile | 4 ++-- contrib/README | 2 +- contrib/pgcrypto/Makefile | 43 +++++++++++----------------------------- contrib/pgcrypto/README.pgcrypto | 10 ++++++---- contrib/pgcrypto/pgcrypto.sql.in | 24 +++++++++++----------- 5 files changed, 33 insertions(+), 50 deletions(-) diff --git a/contrib/Makefile b/contrib/Makefile index 8996c0abc2..b83762fec6 100644 --- a/contrib/Makefile +++ b/contrib/Makefile @@ -1,4 +1,4 @@ -# $Header: /cvsroot/pgsql/contrib/Makefile,v 1.27 2001/09/06 10:49:29 petere Exp $ +# $Header: /cvsroot/pgsql/contrib/Makefile,v 1.28 2001/09/29 03:11:58 momjian Exp $ subdir = contrib top_builddir = .. @@ -26,6 +26,7 @@ WANTED_DIRS = \ pg_logger \ pg_resetxlog \ pgbench \ + pgcrypto \ rserv \ rtree_gist \ seg \ @@ -41,7 +42,6 @@ WANTED_DIRS = \ # mac \ (does not have a makefile) # mysql \ (does not have a makefile) # oracle \ (does not have a makefile) -# pgcrypto \ (non-standard makefile) # start-scripts \ (does not have a makefile) # tools \ (does not have a makefile) # xml \ (non-standard makefile) diff --git a/contrib/README b/contrib/README index 54cf1c5848..54792b736e 100644 --- a/contrib/README +++ b/contrib/README @@ -134,7 +134,7 @@ pgbench - by Tatsuo Ishii pgcrypto - - Cryptographic hash functions + Cryptographic functions by Marko Kreen retep - diff --git a/contrib/pgcrypto/Makefile b/contrib/pgcrypto/Makefile index b8af281b95..c4d7eee76e 100644 --- a/contrib/pgcrypto/Makefile +++ b/contrib/pgcrypto/Makefile @@ -1,5 +1,5 @@ # -# $Header: /cvsroot/pgsql/contrib/pgcrypto/Makefile,v 1.7 2001/09/23 04:12:44 momjian Exp $ +# $Header: /cvsroot/pgsql/contrib/pgcrypto/Makefile,v 1.8 2001/09/29 03:11:58 momjian Exp $ # subdir = contrib/pgcrypto @@ -21,7 +21,7 @@ cryptsrc = builtin # This works ofcouse only with cryptolib = openssl # # 'silly' - use libc random() - very weak -random = dev +random = silly random_dev = \"/dev/urandom\" ########################## @@ -60,24 +60,18 @@ ifeq ($(random), silly) CRYPTO_CFLAGS += -DRAND_SILLY endif -NAME := pgcrypto -SRCS += pgcrypto.c px.c px-hmac.c px-crypt.c misc.c \ - crypt-gensalt.c random.c -OBJS := $(SRCS:.c=.o) -SHLIB_LINK := $(CRYPTO_LDFLAGS) -SO_MAJOR_VERSION = 0 -SO_MINOR_VERSION = 1 +MODULE_big := pgcrypto +SRCS += pgcrypto.c px.c px-hmac.c px-crypt.c misc.c \ + crypt-gensalt.c random.c +OBJS := $(SRCS:.c=.o) +DOCS := README.pgcrypto +DATA_built := pgcrypto.sql +EXTRA_CLEAN := gen-rtab -override CPPFLAGS += $(CRYPTO_CFLAGS) -I$(srcdir) -override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS) -rpath := +PG_CPPFLAGS := $(CRYPTO_CFLAGS) -I$(srcdir) +SHLIB_LINK := $(CRYPTO_LDFLAGS) -all: all-lib $(NAME).sql - -include $(top_srcdir)/src/Makefile.shlib - -$(NAME).sql: $(NAME).sql.in - sed 's,@MODULE_FILENAME@,$$libdir/$(NAME),g' $< >$@ +include $(top_srcdir)/contrib/contrib-global.mk rijndael.o: rijndael.tbl @@ -85,16 +79,3 @@ rijndael.tbl: $(CC) $(CPPFLAGS) $(CFLAGS) -DPRINT_TABS rijndael.c -o gen-rtab ./gen-rtab > rijndael.tbl -install: all installdirs - $(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(pkglibdir)/pgcrypto$(DLSUFFIX) - $(INSTALL_DATA) $(NAME).sql $(DESTDIR)$(datadir)/contrib/$(NAME).sql - $(INSTALL_DATA) README.$(NAME) $(DESTDIR)$(docdir)/contrib/README.$(NAME) - -installdirs: - $(mkinstalldirs) $(pkglibdir) $(datadir)/contrib $(docdir)/contrib - -uninstall: uninstall-lib - rm -f $(DESTDIR)$(pkglibdir)/pgcrypto$(DLSUFFIX) $(datadir)/contrib/$(NAME).sql $(docdir)/contrib/README.$(NAME) - -clean distclean maintainer-clean: clean-lib - rm -f $(OBJS) $(NAME).sql gen-rtab diff --git a/contrib/pgcrypto/README.pgcrypto b/contrib/pgcrypto/README.pgcrypto index c79f996a32..ba6c3fd837 100644 --- a/contrib/pgcrypto/README.pgcrypto +++ b/contrib/pgcrypto/README.pgcrypto @@ -9,10 +9,12 @@ INSTALLATION Edit makefile, if you want to use any external library. -NB! Default randomness source is /dev/urandom device. If you -do not have it, you also need to edit Makefile to let pgcrypto -use either OpenSSL PRNG or libc random() PRNG. Using libc random() -is discouraged. +NB! Default randomness source is libc random() function. This +is so only to get pgcrypto build everywhere. Randomness is +needed for gen_salt() function. So if you plan using it, you +should definitely change that by editing Makefile. You should +be using urandom device if your OS supports it, otherwise link +pgcrypto against OpenSSL library and use its PRNG. After editing Makefile: diff --git a/contrib/pgcrypto/pgcrypto.sql.in b/contrib/pgcrypto/pgcrypto.sql.in index 6cf54f1da6..bb5b4c167f 100644 --- a/contrib/pgcrypto/pgcrypto.sql.in +++ b/contrib/pgcrypto/pgcrypto.sql.in @@ -15,51 +15,51 @@ CREATE FUNCTION digest(bytea, text) RETURNS bytea - AS '@MODULE_FILENAME@', + AS 'MODULE_PATHNAME', 'pg_digest' LANGUAGE 'C'; CREATE FUNCTION digest_exists(text) RETURNS bool - AS '@MODULE_FILENAME@', + AS 'MODULE_PATHNAME', 'pg_digest_exists' LANGUAGE 'C'; CREATE FUNCTION hmac(bytea, bytea, text) RETURNS bytea - AS '@MODULE_FILENAME@', + AS 'MODULE_PATHNAME', 'pg_hmac' LANGUAGE 'C'; CREATE FUNCTION hmac_exists(text) RETURNS bool - AS '@MODULE_FILENAME@', + AS 'MODULE_PATHNAME', 'pg_hmac_exists' LANGUAGE 'C'; CREATE FUNCTION crypt(text, text) RETURNS text - AS '@MODULE_FILENAME@', + AS 'MODULE_PATHNAME', 'pg_crypt' LANGUAGE 'C'; CREATE FUNCTION gen_salt(text) RETURNS text - AS '@MODULE_FILENAME@', + AS 'MODULE_PATHNAME', 'pg_gen_salt' LANGUAGE 'C'; CREATE FUNCTION gen_salt(text, int4) RETURNS text - AS '@MODULE_FILENAME@', + AS 'MODULE_PATHNAME', 'pg_gen_salt_rounds' LANGUAGE 'C'; CREATE FUNCTION encrypt(bytea, bytea, text) RETURNS bytea - AS '@MODULE_FILENAME@', + AS 'MODULE_PATHNAME', 'pg_encrypt' LANGUAGE 'C'; CREATE FUNCTION decrypt(bytea, bytea, text) RETURNS bytea - AS '@MODULE_FILENAME@', + AS 'MODULE_PATHNAME', 'pg_decrypt' LANGUAGE 'C'; CREATE FUNCTION encrypt_iv(bytea, bytea, bytea, text) RETURNS bytea - AS '@MODULE_FILENAME@', + AS 'MODULE_PATHNAME', 'pg_encrypt_iv' LANGUAGE 'C'; CREATE FUNCTION decrypt_iv(bytea, bytea, bytea, text) RETURNS bytea - AS '@MODULE_FILENAME@', + AS 'MODULE_PATHNAME', 'pg_decrypt_iv' LANGUAGE 'C'; CREATE FUNCTION cipher_exists(text) RETURNS bool - AS '@MODULE_FILENAME@', + AS 'MODULE_PATHNAME', 'pg_cipher_exists' LANGUAGE 'C'; -- 2.11.0