mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
87688ddf87
the pubkey functions a bit. The actual RSA-specific code there is tiny, most of the patch consists of reorg of the pubkey code, as lots of it was written as elgamal-only. --------------------------------------------------------------------------- The SHLIB section was copy-pasted from somewhere and contains several unnecessary libs. This cleans it up a bit. -lcrypt we don't use system crypt() -lssl, -lssleay32 no SSL here -lz in win32 section already added on previous line -ldes The chance anybody has it is pretty low. And the chance pgcrypto works with it is even lower. Also trim the win32 section. --------------------------------------------------------------------------- It is already disabled in Makefile, remove code too. --------------------------------------------------------------------------- I was bit hasty making the random exponent 'k' a prime. Further researh shows that Elgamal encryption has no specific needs in respect to k, any random number is fine. It is bit different for signing, there it needs to be 'relatively prime' to p - 1, that means GCD(k, p-1) == 1, which is also a lot lighter than full primality. As we don't do signing, this can be ignored. This brings major speedup to Elgamal encryption. --------------------------------------------------------------------------- o pgp_mpi_free: Accept NULLs o pgp_mpi_cksum: result should be 16bit o Remove function name from error messages - to be similar to other SQL functions, and it does not match anyway the called function o remove couple junk lines --------------------------------------------------------------------------- o Support for RSA encryption o Big reorg to better separate generic and algorithm-specific code. o Regression tests for RSA. --------------------------------------------------------------------------- o Tom stuck a CVS id into file. I doubt the usefulness of it, but if it needs to be in the file then rather at the end. Also tag it as comment for asciidoc. o Mention bytea vs. text difference o Couple clarifications --------------------------------------------------------------------------- There is a choice whether to update it with pgp functions or remove it. I decided to remove it, updating is pointless. I've tried to keep the core of pgcrypto relatively independent from main PostgreSQL, to make it easy to use externally if needed, and that is good. Eg. that made development of PGP functions much nicer. But I have no plans to release it as generic library, so keeping such doc up-to-date is waste of time. If anyone is interested in using it in other products, he can probably bother to read the source too. Commented source is another thing - I'll try to make another pass over code to see if there is anything non-obvious that would need more comments. --------------------------------------------------------------------------- Marko Kreen
71 lines
2.1 KiB
Makefile
71 lines
2.1 KiB
Makefile
#
|
|
# $PostgreSQL: pgsql/contrib/pgcrypto/Makefile,v 1.22 2005/08/13 02:06:20 momjian Exp $
|
|
#
|
|
|
|
INT_SRCS = md5.c sha1.c sha2.c internal.c blf.c rijndael.c \
|
|
fortuna.c random.c pgp-mpi-internal.c
|
|
INT_TESTS = sha2
|
|
|
|
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 = $(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) \
|
|
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)
|
|
DOCS = README.pgcrypto
|
|
DATA_built = pgcrypto.sql
|
|
EXTRA_CLEAN = gen-rtab
|
|
|
|
REGRESS = init md5 sha1 hmac-md5 hmac-sha1 blowfish rijndael \
|
|
$(CF_TESTS) \
|
|
crypt-des crypt-md5 crypt-blowfish crypt-xdes \
|
|
pgp-armor pgp-decrypt pgp-encrypt $(CF_PGP_TESTS)
|
|
|
|
|
|
ifdef USE_PGXS
|
|
PGXS = $(shell pg_config --pgxs)
|
|
include $(PGXS)
|
|
else
|
|
subdir = contrib/pgcrypto
|
|
top_builddir = ../..
|
|
include $(top_builddir)/src/Makefile.global
|
|
include $(top_srcdir)/contrib/contrib-global.mk
|
|
endif
|
|
|
|
# Add libraries that pgcrypto depends (or might depend) on into the
|
|
# shared library link. (The order in which you list them here doesn't
|
|
# matter.)
|
|
SHLIB_LINK += $(filter -lcrypto -lz, $(LIBS))
|
|
ifeq ($(PORTNAME), win32)
|
|
SHLIB_LINK += $(filter -leay32, $(LIBS))
|
|
# those must be at the end
|
|
SHLIB_LINK += -lwsock32 -lws2_32
|
|
endif
|
|
|
|
rijndael.o: rijndael.tbl
|
|
|
|
rijndael.tbl:
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -DPRINT_TABS rijndael.c -o gen-rtab
|
|
./gen-rtab > rijndael.tbl
|