2020-01-17 02:06:17 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* openssl.h
|
|
|
|
* OpenSSL supporting functionality shared between frontend and backend
|
|
|
|
*
|
2022-01-08 01:04:57 +01:00
|
|
|
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
|
2020-01-17 02:06:17 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
|
|
|
* src/include/common/openssl.h
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef COMMON_OPENSSL_H
|
|
|
|
#define COMMON_OPENSSL_H
|
|
|
|
|
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
#include <openssl/ssl.h>
|
|
|
|
|
2020-06-27 18:47:58 +02:00
|
|
|
/*
|
|
|
|
* OpenSSL doesn't provide any very nice way to identify the min/max
|
|
|
|
* protocol versions the library supports, so we fake it as best we can.
|
|
|
|
* Note in particular that this doesn't account for restrictions that
|
|
|
|
* might be specified in the installation's openssl.cnf.
|
|
|
|
*
|
|
|
|
* We disable SSLv3 and older in library setup, so TLSv1 is the oldest
|
|
|
|
* protocol version of interest.
|
|
|
|
*/
|
|
|
|
#define MIN_OPENSSL_TLS_VERSION "TLSv1"
|
|
|
|
|
|
|
|
#if defined(TLS1_3_VERSION)
|
|
|
|
#define MAX_OPENSSL_TLS_VERSION "TLSv1.3"
|
|
|
|
#elif defined(TLS1_2_VERSION)
|
|
|
|
#define MAX_OPENSSL_TLS_VERSION "TLSv1.2"
|
|
|
|
#elif defined(TLS1_1_VERSION)
|
|
|
|
#define MAX_OPENSSL_TLS_VERSION "TLSv1.1"
|
|
|
|
#else
|
|
|
|
#define MAX_OPENSSL_TLS_VERSION "TLSv1"
|
|
|
|
#endif
|
|
|
|
|
2020-01-17 02:06:17 +01:00
|
|
|
/* src/common/protocol_openssl.c */
|
|
|
|
#ifndef SSL_CTX_set_min_proto_version
|
|
|
|
extern int SSL_CTX_set_min_proto_version(SSL_CTX *ctx, int version);
|
|
|
|
extern int SSL_CTX_set_max_proto_version(SSL_CTX *ctx, int version);
|
|
|
|
#endif
|
|
|
|
|
2020-06-27 18:47:58 +02:00
|
|
|
#endif /* USE_OPENSSL */
|
2020-01-17 02:06:17 +01:00
|
|
|
|
|
|
|
#endif /* COMMON_OPENSSL_H */
|