pgcrypto Makefile update

From: Marko Kreen <marko(at)l-t(dot)ee>
To: pgsql-patches(at)postgresql(dot)org
Subject: pgcrypto Makefile update
Date: 2001-09-25 17:34:35
Message-ID: 20010925193435.A986@l-t.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


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

Index: contrib/Makefile
===================================================================
RCS file: /opt/cvs/pgsql/pgsql/contrib/Makefile,v
retrieving revision 1.27
diff -u -r1.27 Makefile
--- contrib/Makefile 6 Sep 2001 10:49:29 -0000 1.27
+++ contrib/Makefile 25 Sep 2001 12:50:21 -0000
@@ -26,6 +26,7 @@
pg_logger \
pg_resetxlog \
pgbench \
+ pgcrypto \
rserv \
rtree_gist \
seg \
@@ -41,7 +42,6 @@
# 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)
Index: contrib/README
===================================================================
RCS file: /opt/cvs/pgsql/pgsql/contrib/README,v
retrieving revision 1.47
diff -u -r1.47 README
--- contrib/README 4 Sep 2001 19:21:42 -0000 1.47
+++ contrib/README 23 Sep 2001 12:55:15 -0000
@@ -134,7 +134,7 @@
by Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>

pgcrypto -
- Cryptographic hash functions
+ Cryptographic functions
by Marko Kreen <marko(at)l-t(dot)ee>

retep -
Index: contrib/pgcrypto/Makefile
===================================================================
RCS file: /opt/cvs/pgsql/pgsql/contrib/pgcrypto/Makefile,v
retrieving revision 1.7
diff -u -r1.7 Makefile
--- contrib/pgcrypto/Makefile 23 Sep 2001 04:12:44 -0000 1.7
+++ contrib/pgcrypto/Makefile 25 Sep 2001 16:40:22 -0000
@@ -21,7 +21,7 @@
# 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 @@
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
-
-override CPPFLAGS += $(CRYPTO_CFLAGS) -I$(srcdir)
-override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)
-rpath :=
+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

-all: all-lib $(NAME).sql
+PG_CPPFLAGS := $(CRYPTO_CFLAGS) -I$(srcdir)
+SHLIB_LINK := $(CRYPTO_LDFLAGS)

-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 @@
$(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
Index: contrib/pgcrypto/README.pgcrypto
===================================================================
RCS file: /opt/cvs/pgsql/pgsql/contrib/pgcrypto/README.pgcrypto,v
retrieving revision 1.5
diff -u -r1.5 README.pgcrypto
--- contrib/pgcrypto/README.pgcrypto 23 Sep 2001 04:12:44 -0000 1.5
+++ contrib/pgcrypto/README.pgcrypto 25 Sep 2001 16:54:57 -0000
@@ -9,10 +9,12 @@

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:

Index: contrib/pgcrypto/pgcrypto.sql.in
===================================================================
RCS file: /opt/cvs/pgsql/pgsql/contrib/pgcrypto/pgcrypto.sql.in,v
retrieving revision 1.5
diff -u -r1.5 pgcrypto.sql.in
--- contrib/pgcrypto/pgcrypto.sql.in 23 Sep 2001 04:12:44 -0000 1.5
+++ contrib/pgcrypto/pgcrypto.sql.in 23 Sep 2001 12:44:06 -0000
@@ -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';

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Kenneth Been 2001-09-25 18:12:30 rtree improvements
Previous Message Liam Stewart 2001-09-25 14:10:59 fix for JDBC test suite