diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/libpq/libpq-be.h | 24 | ||||
-rw-r--r-- | src/include/libpq/libpq.h | 9 | ||||
-rw-r--r-- | src/include/pg_config.h.in | 6 | ||||
-rw-r--r-- | src/include/pg_config.h.win32 | 6 | ||||
-rw-r--r-- | src/include/pg_config_manual.h | 9 |
5 files changed, 44 insertions, 10 deletions
diff --git a/src/include/libpq/libpq-be.h b/src/include/libpq/libpq-be.h index e78c565b1ea..34e52e44b0c 100644 --- a/src/include/libpq/libpq-be.h +++ b/src/include/libpq/libpq-be.h @@ -21,7 +21,7 @@ #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #endif -#ifdef USE_SSL +#ifdef USE_OPENSSL #include <openssl/ssl.h> #include <openssl/err.h> #endif @@ -184,17 +184,33 @@ typedef struct Port #endif /* - * SSL structures (keep these last so that USE_SSL doesn't affect - * locations of other fields) + * SSL structures (keep these last so that the locations of other fields + * are the same whether or not you build with SSL) */ #ifdef USE_SSL + bool ssl_in_use; + char *peer_cn; + bool peer_cert_valid; +#endif +#ifdef USE_OPENSSL SSL *ssl; X509 *peer; - char *peer_cn; unsigned long count; #endif } Port; +#ifdef USE_SSL +/* + * These functions are implemented by the glue code specific to each + * SSL implementation (e.g. be-secure-openssl.c) + */ +extern void be_tls_init(void); +extern int be_tls_open_server(Port *port); +extern void be_tls_close(Port *port); +extern ssize_t be_tls_read(Port *port, void *ptr, size_t len); +extern ssize_t be_tls_write(Port *port, void *ptr, size_t len); + +#endif extern ProtocolVersion FrontendProtocol; diff --git a/src/include/libpq/libpq.h b/src/include/libpq/libpq.h index e4e354dafa0..5da9d8d4f52 100644 --- a/src/include/libpq/libpq.h +++ b/src/include/libpq/libpq.h @@ -82,5 +82,14 @@ extern int secure_open_server(Port *port); extern void secure_close(Port *port); extern ssize_t secure_read(Port *port, void *ptr, size_t len); extern ssize_t secure_write(Port *port, void *ptr, size_t len); +extern ssize_t secure_raw_read(Port *port, void *ptr, size_t len); +extern ssize_t secure_raw_write(Port *port, const void *ptr, size_t len); + +extern bool ssl_loaded_verify_locations; + +/* GUCs */ +extern char *SSLCipherSuites; +extern char *SSLECDHCurve; +extern bool SSLPreferServerCiphers; #endif /* LIBPQ_H */ diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 4383ad5172c..5bdfa470dcf 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -778,15 +778,15 @@ /* Define to select named POSIX semaphores. */ #undef USE_NAMED_POSIX_SEMAPHORES +/* Define to build with OpenSSL support. (--with-openssl) */ +#undef USE_OPENSSL + /* Define to 1 to build with PAM support. (--with-pam) */ #undef USE_PAM /* Use replacement snprintf() functions. */ #undef USE_REPL_SNPRINTF -/* Define to build with (Open)SSL support. (--with-openssl) */ -#undef USE_SSL - /* Define to select SysV-style semaphores. */ #undef USE_SYSV_SEMAPHORES diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index f7c2419252b..00be15f230e 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -628,15 +628,15 @@ /* Define to select named POSIX semaphores. */ /* #undef USE_NAMED_POSIX_SEMAPHORES */ +/* Define to build with OpenSSL support. (--with-openssl) */ +/* #undef USE_OPENSSL */ + /* Define to 1 to build with PAM support. (--with-pam) */ /* #undef USE_PAM */ /* Use replacement snprintf() functions. */ #define USE_REPL_SNPRINTF 1 -/* Define to build with (Open)SSL support. (--with-openssl) */ -/* #undef USE_SSL */ - /* Define to select SysV-style semaphores. */ /* #undef USE_SYSV_SEMAPHORES */ diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h index 16f7ef9bea6..d78f38e3bd5 100644 --- a/src/include/pg_config_manual.h +++ b/src/include/pg_config_manual.h @@ -145,6 +145,15 @@ #endif /* + * USE_SSL code should be compiled only when compiling with an SSL + * implementation. (Currently, only OpenSSL is supported, but we might add + * more implementations in the future.) + */ +#ifdef USE_OPENSSL +#define USE_SSL +#endif + +/* * This is the default directory in which AF_UNIX socket files are * placed. Caution: changing this risks breaking your existing client * applications, which are likely to continue to look in the old |