summaryrefslogtreecommitdiff
path: root/contrib/pgcrypto
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/pgcrypto')
-rw-r--r--contrib/pgcrypto/.gitignore1
-rw-r--r--contrib/pgcrypto/Makefile9
-rw-r--r--contrib/pgcrypto/expected/init.out8
-rw-r--r--contrib/pgcrypto/pgcrypto--1.0.sql (renamed from contrib/pgcrypto/pgcrypto.sql.in)5
-rw-r--r--contrib/pgcrypto/pgcrypto--unpackaged--1.0.sql35
-rw-r--r--contrib/pgcrypto/pgcrypto.control5
-rw-r--r--contrib/pgcrypto/sql/init.sql10
-rw-r--r--contrib/pgcrypto/uninstall_pgcrypto.sql45
8 files changed, 47 insertions, 71 deletions
diff --git a/contrib/pgcrypto/.gitignore b/contrib/pgcrypto/.gitignore
index 07b24d98f03..19b6c5ba425 100644
--- a/contrib/pgcrypto/.gitignore
+++ b/contrib/pgcrypto/.gitignore
@@ -1,3 +1,2 @@
-/pgcrypto.sql
# Generated subdirectories
/results/
diff --git a/contrib/pgcrypto/Makefile b/contrib/pgcrypto/Makefile
index f429fab4edd..dadec953c2a 100644
--- a/contrib/pgcrypto/Makefile
+++ b/contrib/pgcrypto/Makefile
@@ -1,6 +1,4 @@
-#
# contrib/pgcrypto/Makefile
-#
INT_SRCS = md5.c sha1.c sha2.c internal.c internal-sha2.c blf.c rijndael.c \
fortuna.c random.c pgp-mpi-internal.c imath.c
@@ -26,9 +24,9 @@ SRCS = pgcrypto.c px.c px-hmac.c px-crypt.c \
MODULE_big = pgcrypto
OBJS = $(SRCS:.c=.o)
-DATA_built = pgcrypto.sql
-DATA = uninstall_pgcrypto.sql
-EXTRA_CLEAN = gen-rtab
+
+EXTENSION = pgcrypto
+DATA = pgcrypto--1.0.sql pgcrypto--unpackaged--1.0.sql
REGRESS = init md5 sha1 hmac-md5 hmac-sha1 blowfish rijndael \
$(CF_TESTS) \
@@ -36,6 +34,7 @@ REGRESS = init md5 sha1 hmac-md5 hmac-sha1 blowfish rijndael \
pgp-armor pgp-decrypt pgp-encrypt $(CF_PGP_TESTS) \
pgp-pubkey-decrypt pgp-pubkey-encrypt pgp-info
+EXTRA_CLEAN = gen-rtab
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/pgcrypto/expected/init.out b/contrib/pgcrypto/expected/init.out
index 4cb10819975..bd8f8e13809 100644
--- a/contrib/pgcrypto/expected/init.out
+++ b/contrib/pgcrypto/expected/init.out
@@ -1,13 +1,7 @@
--
-- init pgcrypto
--
---
--- first, define the functions. Turn off echoing so that expected file
--- does not depend on contents of pgcrypto.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-RESET client_min_messages;
+CREATE EXTENSION pgcrypto;
-- ensure consistent test output regardless of the default bytea format
SET bytea_output TO escape;
-- check for encoding fn's
diff --git a/contrib/pgcrypto/pgcrypto.sql.in b/contrib/pgcrypto/pgcrypto--1.0.sql
index 37ae1004122..29b489fbe51 100644
--- a/contrib/pgcrypto/pgcrypto.sql.in
+++ b/contrib/pgcrypto/pgcrypto--1.0.sql
@@ -1,7 +1,4 @@
-/* contrib/pgcrypto/pgcrypto.sql.in */
-
--- Adjust this setting to control where the objects get created.
-SET search_path = public;
+/* contrib/pgcrypto/pgcrypto--1.0.sql */
CREATE OR REPLACE FUNCTION digest(text, text)
RETURNS bytea
diff --git a/contrib/pgcrypto/pgcrypto--unpackaged--1.0.sql b/contrib/pgcrypto/pgcrypto--unpackaged--1.0.sql
new file mode 100644
index 00000000000..64f0cdf23ac
--- /dev/null
+++ b/contrib/pgcrypto/pgcrypto--unpackaged--1.0.sql
@@ -0,0 +1,35 @@
+/* contrib/pgcrypto/pgcrypto--unpackaged--1.0.sql */
+
+ALTER EXTENSION pgcrypto ADD function digest(text,text);
+ALTER EXTENSION pgcrypto ADD function digest(bytea,text);
+ALTER EXTENSION pgcrypto ADD function hmac(text,text,text);
+ALTER EXTENSION pgcrypto ADD function hmac(bytea,bytea,text);
+ALTER EXTENSION pgcrypto ADD function crypt(text,text);
+ALTER EXTENSION pgcrypto ADD function gen_salt(text);
+ALTER EXTENSION pgcrypto ADD function gen_salt(text,integer);
+ALTER EXTENSION pgcrypto ADD function encrypt(bytea,bytea,text);
+ALTER EXTENSION pgcrypto ADD function decrypt(bytea,bytea,text);
+ALTER EXTENSION pgcrypto ADD function encrypt_iv(bytea,bytea,bytea,text);
+ALTER EXTENSION pgcrypto ADD function decrypt_iv(bytea,bytea,bytea,text);
+ALTER EXTENSION pgcrypto ADD function gen_random_bytes(integer);
+ALTER EXTENSION pgcrypto ADD function pgp_sym_encrypt(text,text);
+ALTER EXTENSION pgcrypto ADD function pgp_sym_encrypt_bytea(bytea,text);
+ALTER EXTENSION pgcrypto ADD function pgp_sym_encrypt(text,text,text);
+ALTER EXTENSION pgcrypto ADD function pgp_sym_encrypt_bytea(bytea,text,text);
+ALTER EXTENSION pgcrypto ADD function pgp_sym_decrypt(bytea,text);
+ALTER EXTENSION pgcrypto ADD function pgp_sym_decrypt_bytea(bytea,text);
+ALTER EXTENSION pgcrypto ADD function pgp_sym_decrypt(bytea,text,text);
+ALTER EXTENSION pgcrypto ADD function pgp_sym_decrypt_bytea(bytea,text,text);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_encrypt(text,bytea);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_encrypt_bytea(bytea,bytea);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_encrypt(text,bytea,text);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_encrypt_bytea(bytea,bytea,text);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_decrypt(bytea,bytea);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_decrypt_bytea(bytea,bytea);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_decrypt(bytea,bytea,text);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_decrypt_bytea(bytea,bytea,text);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_decrypt(bytea,bytea,text,text);
+ALTER EXTENSION pgcrypto ADD function pgp_pub_decrypt_bytea(bytea,bytea,text,text);
+ALTER EXTENSION pgcrypto ADD function pgp_key_id(bytea);
+ALTER EXTENSION pgcrypto ADD function armor(bytea);
+ALTER EXTENSION pgcrypto ADD function dearmor(text);
diff --git a/contrib/pgcrypto/pgcrypto.control b/contrib/pgcrypto/pgcrypto.control
new file mode 100644
index 00000000000..8375cf9e7bb
--- /dev/null
+++ b/contrib/pgcrypto/pgcrypto.control
@@ -0,0 +1,5 @@
+# pgcrypto extension
+comment = 'cryptographic functions'
+default_version = '1.0'
+module_pathname = '$libdir/pgcrypto'
+relocatable = true
diff --git a/contrib/pgcrypto/sql/init.sql b/contrib/pgcrypto/sql/init.sql
index 8c1d2192a68..5c3d100576b 100644
--- a/contrib/pgcrypto/sql/init.sql
+++ b/contrib/pgcrypto/sql/init.sql
@@ -2,15 +2,7 @@
-- init pgcrypto
--
---
--- first, define the functions. Turn off echoing so that expected file
--- does not depend on contents of pgcrypto.sql.
---
-SET client_min_messages = warning;
-\set ECHO none
-\i pgcrypto.sql
-\set ECHO all
-RESET client_min_messages;
+CREATE EXTENSION pgcrypto;
-- ensure consistent test output regardless of the default bytea format
SET bytea_output TO escape;
diff --git a/contrib/pgcrypto/uninstall_pgcrypto.sql b/contrib/pgcrypto/uninstall_pgcrypto.sql
deleted file mode 100644
index 3005c50333a..00000000000
--- a/contrib/pgcrypto/uninstall_pgcrypto.sql
+++ /dev/null
@@ -1,45 +0,0 @@
-/* contrib/pgcrypto/uninstall_pgcrypto.sql */
-
--- Adjust this setting to control where the objects get dropped.
-SET search_path = public;
-
-DROP FUNCTION digest(text, text);
-DROP FUNCTION digest(bytea, text);
-
-DROP FUNCTION hmac(text, text, text);
-DROP FUNCTION hmac(bytea, bytea, text);
-
-DROP FUNCTION crypt(text, text);
-DROP FUNCTION gen_salt(text);
-DROP FUNCTION gen_salt(text, int4);
-
-DROP FUNCTION encrypt(bytea, bytea, text);
-DROP FUNCTION decrypt(bytea, bytea, text);
-DROP FUNCTION encrypt_iv(bytea, bytea, bytea, text);
-DROP FUNCTION decrypt_iv(bytea, bytea, bytea, text);
-
-DROP FUNCTION gen_random_bytes(int4);
-
-DROP FUNCTION pgp_sym_encrypt(text, text);
-DROP FUNCTION pgp_sym_encrypt_bytea(bytea, text);
-DROP FUNCTION pgp_sym_encrypt(text, text, text);
-DROP FUNCTION pgp_sym_encrypt_bytea(bytea, text, text);
-DROP FUNCTION pgp_sym_decrypt(bytea, text);
-DROP FUNCTION pgp_sym_decrypt_bytea(bytea, text);
-DROP FUNCTION pgp_sym_decrypt(bytea, text, text);
-DROP FUNCTION pgp_sym_decrypt_bytea(bytea, text, text);
-
-DROP FUNCTION pgp_pub_encrypt(text, bytea);
-DROP FUNCTION pgp_pub_encrypt_bytea(bytea, bytea);
-DROP FUNCTION pgp_pub_encrypt(text, bytea, text);
-DROP FUNCTION pgp_pub_encrypt_bytea(bytea, bytea, text);
-DROP FUNCTION pgp_pub_decrypt(bytea, bytea);
-DROP FUNCTION pgp_pub_decrypt_bytea(bytea, bytea);
-DROP FUNCTION pgp_pub_decrypt(bytea, bytea, text);
-DROP FUNCTION pgp_pub_decrypt_bytea(bytea, bytea, text);
-DROP FUNCTION pgp_pub_decrypt(bytea, bytea, text, text);
-DROP FUNCTION pgp_pub_decrypt_bytea(bytea, bytea, text, text);
-
-DROP FUNCTION pgp_key_id(bytea);
-DROP FUNCTION armor(bytea);
-DROP FUNCTION dearmor(text);