Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit db7d1a7

Browse files
committed
pgcrypto: Remove non-OpenSSL support
pgcrypto had internal implementations of some encryption algorithms, as an alternative to calling out to OpenSSL. These were rarely used, since most production installations are built with OpenSSL. Moreover, maintaining parallel code paths makes the code more complex and difficult to maintain. This patch removes these internal implementations. Now, pgcrypto is only built if OpenSSL support is configured. Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Discussion: https://www.postgresql.org/message-id/flat/0b42f1df-8cba-6a30-77d7-acc241cc88c1%40enterprisedb.com
1 parent a5b336b commit db7d1a7

15 files changed

+42
-7742
lines changed

contrib/Makefile

+2-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ SUBDIRS = \
3636
pg_stat_statements \
3737
pg_surgery \
3838
pg_trgm \
39-
pgcrypto \
4039
pgrowlocks \
4140
pgstattuple \
4241
pg_visibility \
@@ -52,9 +51,9 @@ SUBDIRS = \
5251
vacuumlo
5352

5453
ifeq ($(with_ssl),openssl)
55-
SUBDIRS += sslinfo
54+
SUBDIRS += pgcrypto sslinfo
5655
else
57-
ALWAYS_SUBDIRS += sslinfo
56+
ALWAYS_SUBDIRS += pgcrypto sslinfo
5857
endif
5958

6059
ifneq ($(with_uuid),no)

contrib/pgcrypto/Makefile

+27-46
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,46 @@
11
# contrib/pgcrypto/Makefile
22

3-
INT_SRCS = internal.c internal-sha2.c blf.c rijndael.c \
4-
pgp-mpi-internal.c imath.c
5-
INT_TESTS = sha2
6-
7-
OSSL_SRCS = openssl.c pgp-mpi-openssl.c
8-
OSSL_TESTS = sha2 des 3des cast5
9-
103
ZLIB_TST = pgp-compression
114
ZLIB_OFF_TST = pgp-zlib-DISABLED
125

13-
CF_SRCS = $(if $(subst openssl,,$(with_ssl)), $(INT_SRCS), $(OSSL_SRCS))
14-
CF_TESTS = $(if $(subst openssl,,$(with_ssl)), $(INT_TESTS), $(OSSL_TESTS))
156
CF_PGP_TESTS = $(if $(subst no,,$(with_zlib)), $(ZLIB_TST), $(ZLIB_OFF_TST))
167

17-
SRCS = \
18-
$(CF_SRCS) \
19-
crypt-blowfish.c \
20-
crypt-des.c \
21-
crypt-gensalt.c \
22-
crypt-md5.c \
23-
mbuf.c \
24-
pgcrypto.c \
25-
pgp-armor.c \
26-
pgp-cfb.c \
27-
pgp-compress.c \
28-
pgp-decrypt.c \
29-
pgp-encrypt.c \
30-
pgp-info.c \
31-
pgp-mpi.c \
32-
pgp-pgsql.c \
33-
pgp-pubdec.c \
34-
pgp-pubenc.c \
35-
pgp-pubkey.c \
36-
pgp-s2k.c \
37-
pgp.c \
38-
px-crypt.c \
39-
px-hmac.c \
40-
px.c
8+
OBJS = \
9+
$(WIN32RES) \
10+
crypt-blowfish.o \
11+
crypt-des.o \
12+
crypt-gensalt.o \
13+
crypt-md5.o \
14+
mbuf.o \
15+
openssl.o \
16+
pgcrypto.o \
17+
pgp-armor.o \
18+
pgp-cfb.o \
19+
pgp-compress.o \
20+
pgp-decrypt.o \
21+
pgp-encrypt.o \
22+
pgp-info.o \
23+
pgp-mpi.o \
24+
pgp-mpi-openssl.o \
25+
pgp-pgsql.o \
26+
pgp-pubdec.o \
27+
pgp-pubenc.o \
28+
pgp-pubkey.o \
29+
pgp-s2k.o \
30+
pgp.o \
31+
px-crypt.o \
32+
px-hmac.o \
33+
px.o
4134

4235
MODULE_big = pgcrypto
43-
OBJS = \
44-
$(SRCS:.c=.o) \
45-
$(WIN32RES)
4636

4737
EXTENSION = pgcrypto
4838
DATA = pgcrypto--1.3.sql pgcrypto--1.2--1.3.sql pgcrypto--1.1--1.2.sql \
4939
pgcrypto--1.0--1.1.sql
5040
PGFILEDESC = "pgcrypto - cryptographic functions"
5141

5242
REGRESS = init md5 sha1 hmac-md5 hmac-sha1 blowfish rijndael \
53-
$(CF_TESTS) \
43+
sha2 des 3des cast5 \
5444
crypt-des crypt-md5 crypt-blowfish crypt-xdes \
5545
pgp-armor pgp-decrypt pgp-encrypt $(CF_PGP_TESTS) \
5646
pgp-pubkey-decrypt pgp-pubkey-encrypt pgp-info
@@ -77,12 +67,3 @@ SHLIB_LINK += $(filter -leay32, $(LIBS))
7767
# those must be at the end
7868
SHLIB_LINK += -lws2_32
7969
endif
80-
81-
# Upstream uses a larger subset of C99.
82-
imath.o: CFLAGS+=$(PERMIT_DECLARATION_AFTER_STATEMENT)
83-
84-
rijndael.o: rijndael.tbl
85-
86-
rijndael.tbl:
87-
$(CC) $(CPPFLAGS) $(CFLAGS) -DPRINT_TABS rijndael.c -o gen-rtab
88-
./gen-rtab > rijndael.tbl

0 commit comments

Comments
 (0)