pgcrypto Makefile update

Поиск
Список
Период
Сортировка
Искать

pgcrypto Makefile update

От:
Marko Kreen <marko@l-t.ee>
Дата:

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 
 
 pgcrypto -
-	Cryptographic hash functions
+	Cryptographic functions
 	by Marko Kreen 
 
 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';
 
 

Re: pgcrypto Makefile update

От:
Marko Kreen <marko@l-t.ee>
Дата:
On Tue, Sep 25, 2001 at 07:34:35PM +0200, Marko Kreen wrote:
> * Changed default randomness source to libc random()
>   That way pgcrypto does not have any external dependencies
>   and should work everywhere.

Found type mismatch in random.c.  Please apply this also.

-- 
marko


Index: contrib/pgcrypto/random.c
===================================================================
RCS file: /opt/cvs/pgsql/pgsql/contrib/pgcrypto/random.c,v
retrieving revision 1.1
diff -u -r1.1 random.c
--- contrib/pgcrypto/random.c	23 Sep 2001 04:12:44 -0000	1.1
+++ contrib/pgcrypto/random.c	25 Sep 2001 18:51:37 -0000
@@ -80,7 +80,7 @@
 
 #ifdef RAND_SILLY
 
-int px_get_random_bytes(char *dst, unsigned count)
+int px_get_random_bytes(uint8 *dst, unsigned count)
 {
 	int i;
 	for (i = 0; i < count; i++) {

Re: pgcrypto Makefile update

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

Your patch has been added to the PostgreSQL unapplied patches list at:

	http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.


> On Tue, Sep 25, 2001 at 07:34:35PM +0200, Marko Kreen wrote:
> > * Changed default randomness source to libc random()
> >   That way pgcrypto does not have any external dependencies
> >   and should work everywhere.
> 
> Found type mismatch in random.c.  Please apply this also.
> 
> -- 
> marko
> 
> 
> Index: contrib/pgcrypto/random.c
> ===================================================================
> RCS file: /opt/cvs/pgsql/pgsql/contrib/pgcrypto/random.c,v
> retrieving revision 1.1
> diff -u -r1.1 random.c
> --- contrib/pgcrypto/random.c	23 Sep 2001 04:12:44 -0000	1.1
> +++ contrib/pgcrypto/random.c	25 Sep 2001 18:51:37 -0000
> @@ -80,7 +80,7 @@
>  
>  #ifdef RAND_SILLY
>  
> -int px_get_random_bytes(char *dst, unsigned count)
> +int px_get_random_bytes(uint8 *dst, unsigned count)
>  {
>  	int i;
>  	for (i = 0; i < count; i++) {
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: pgcrypto Makefile update

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

Your patch has been added to the PostgreSQL unapplied patches list at:

	http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

> 
> 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 
>  
>  pgcrypto -
> -	Cryptographic hash functions
> +	Cryptographic functions
>  	by Marko Kreen 
>  
>  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';
>  
>  
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: pgcrypto Makefile update

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

Patch applied.  Thanks.

> 
> 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 
>  
>  pgcrypto -
> -	Cryptographic hash functions
> +	Cryptographic functions
>  	by Marko Kreen 
>  
>  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';
>  
>  
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: pgcrypto Makefile update

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

Patch applied.  Thanks.

> On Tue, Sep 25, 2001 at 07:34:35PM +0200, Marko Kreen wrote:
> > * Changed default randomness source to libc random()
> >   That way pgcrypto does not have any external dependencies
> >   and should work everywhere.
> 
> Found type mismatch in random.c.  Please apply this also.
> 
> -- 
> marko
> 
> 
> Index: contrib/pgcrypto/random.c
> ===================================================================
> RCS file: /opt/cvs/pgsql/pgsql/contrib/pgcrypto/random.c,v
> retrieving revision 1.1
> diff -u -r1.1 random.c
> --- contrib/pgcrypto/random.c	23 Sep 2001 04:12:44 -0000	1.1
> +++ contrib/pgcrypto/random.c	25 Sep 2001 18:51:37 -0000
> @@ -80,7 +80,7 @@
>  
>  #ifdef RAND_SILLY
>  
> -int px_get_random_bytes(char *dst, unsigned count)
> +int px_get_random_bytes(uint8 *dst, unsigned count)
>  {
>  	int i;
>  	for (i = 0; i < count; i++) {
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
FAQ