summaryrefslogtreecommitdiff
path: root/contrib/pgcrypto/Makefile
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2005-07-10 03:57:55 +0000
committerBruce Momjian <bruce@momjian.us>2005-07-10 03:57:55 +0000
commit73e2431817fec3d251a517ac185d210fda0ffcd6 (patch)
tree4e1b18833c479012bd61a1f75fed8474f3bfcc46 /contrib/pgcrypto/Makefile
parent4fcf8b11ff4561b7479b80396a0d697bda0e5115 (diff)
downloadpostgresql-73e2431817fec3d251a517ac185d210fda0ffcd6.tar.gz
Major pgcrypto changes:
of password-based encryption from RFC2440 (OpenPGP). The goal of this code is to be more featureful encryption solution than current encrypt(), which only functionality is running cipher over data. Compared to encrypt(), pgp_encrypt() does following: * It uses the equvialent of random Inital Vector to get cipher into random state before it processes user data * Stores SHA-1 of the data into result so any modification will be detected. * Remembers if data was text or binary - thus it can decrypt to/from text data. This was a major nuisance for encrypt(). * Stores info about used algorithms with result, so user needs not remember them - more user friendly! * Uses String2Key algorithms (similar to crypt()) with random salt to generate full-length binary key to be used for encrypting. * Uses standard format for data - you can feed it to GnuPG, if needed. Optional features (off by default): * Can use separate session key - user data will be encrypted with totally random key, which will be encrypted with S2K generated key and attached to result. * Data compression with zlib. * Can convert between CRLF<->LF line-endings - to get fully RFC2440-compliant behaviour. This is off by default as pgcrypto does not know the line-endings of user data. Interface is simple: pgp_encrypt(data text, key text) returns bytea pgp_decrypt(data text, key text) returns text pgp_encrypt_bytea(data bytea, key text) returns bytea pgp_decrypt_bytea(data bytea, key text) returns bytea To change parameters (cipher, compression, mdc): pgp_encrypt(data text, key text, parms text) returns bytea pgp_decrypt(data text, key text, parms text) returns text pgp_encrypt_bytea(data bytea, key text, parms text) returns bytea pgp_decrypt_bytea(data bytea, key text, parms text) returns bytea Parameter names I lifted from gpg: pgp_encrypt('message', 'key', 'compress-algo=1,cipher-algo=aes256') For text data, pgp_encrypt simply encrypts the PostgreSQL internal data. This maps to RFC2440 data type 't' - 'extenally specified encoding'. But this may cause problems if data is dumped and reloaded into database which as different internal encoding. My next goal is to implement data type 'u' - which means data is in UTF-8 encoding by converting internal encoding to UTF-8 and back. And there wont be any compatibility problems with current code, I think its ok to submit this without UTF-8 encoding by converting internal encoding to UTF-8 and back. And there wont be any compatibility problems with current code, I think its ok to submit this without UTF-8 support. Here is v4 of PGP encrypt. This depends on previously sent Fortuna-patch, as it uses the px_add_entropy function. - New function: pgp_key_id() for finding key id's. - Add SHA1 of user data and key into RNG pools. We need to get randomness from somewhere, and it is in user best interests to contribute. - Regenerate pgp-armor test for SQL_ASCII database. - Cleanup the key handling so that the pubkey support is less hackish. Marko Kreen
Diffstat (limited to 'contrib/pgcrypto/Makefile')
-rw-r--r--contrib/pgcrypto/Makefile25
1 files changed, 19 insertions, 6 deletions
diff --git a/contrib/pgcrypto/Makefile b/contrib/pgcrypto/Makefile
index 82f2a8295e..81ad9b372e 100644
--- a/contrib/pgcrypto/Makefile
+++ b/contrib/pgcrypto/Makefile
@@ -1,23 +1,35 @@
#
-# $PostgreSQL: pgsql/contrib/pgcrypto/Makefile,v 1.19 2005/07/10 03:55:28 momjian Exp $
+# $PostgreSQL: pgsql/contrib/pgcrypto/Makefile,v 1.20 2005/07/10 03:57:55 momjian Exp $
#
INT_SRCS = md5.c sha1.c sha2.c internal.c blf.c rijndael.c \
- fortuna.c random.c
+ fortuna.c random.c pgp-mpi-internal.c
INT_TESTS = sha2
-OSSL_SRCS = openssl.c
+OSSL_SRCS = openssl.c pgp-mpi-openssl.c
OSSL_TESTS = des 3des cast5
+ZLIB_OFF_CFLAGS = -DDISABLE_ZLIB
+ZLIB_TST = pgp-compression
+ZLIB_OFF_TST = pgp-zlib-DISABLED
+PUBENC_ON = pgp-pubkey-decrypt pgp-pubkey-encrypt pgp-info
+PUBENC_OFF = pgp-pubkey-DISABLED
+
CF_SRCS = $(if $(subst no,,$(with_openssl)), $(OSSL_SRCS), $(INT_SRCS))
CF_TESTS = $(if $(subst no,,$(with_openssl)), $(OSSL_TESTS), $(INT_TESTS))
-CF_CFLAGS =
+CF_CFLAGS = $(if $(subst yes,,$(with_zlib)), $(ZLIB_OFF_CFLAGS))
+CF_PGP_TESTS = $(if $(subst no,,$(with_zlib)), $(ZLIB_TST), $(ZLIB_OFF_TST)) \
+ $(if $(subst no,,$(with_openssl)), $(PUBENC_ON), $(PUBENC_OFF))
PG_CPPFLAGS = $(CF_CFLAGS)
SRCS = pgcrypto.c px.c px-hmac.c px-crypt.c misc.c \
crypt-gensalt.c crypt-blowfish.c crypt-des.c \
- crypt-md5.c $(CF_SRCS)
+ crypt-md5.c $(CF_SRCS) \
+ mbuf.c pgp.c pgp-armor.c pgp-cfb.c pgp-compress.c \
+ pgp-decrypt.c pgp-encrypt.c pgp-info.c pgp-mpi.c \
+ pgp-pubdec.c pgp-pubenc.c pgp-pubkey.c pgp-s2k.c \
+ pgp-pgsql.c
MODULE_big = pgcrypto
OBJS = $(SRCS:.c=.o)
@@ -27,7 +39,8 @@ EXTRA_CLEAN = gen-rtab
REGRESS = init md5 sha1 hmac-md5 hmac-sha1 blowfish rijndael \
$(CF_TESTS) \
- crypt-des crypt-md5 crypt-blowfish crypt-xdes
+ crypt-des crypt-md5 crypt-blowfish crypt-xdes \
+ pgp-armor pgp-decrypt pgp-encrypt $(CF_PGP_TESTS)
ifdef USE_PGXS