Adds CT validation to SSL connections
Disabled by default, but can be enabled by setting the ct_validation_callback on a SSL or SSL_CTX. Reviewed-by: Ben Laurie <ben@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
@@ -159,6 +159,9 @@
|
||||
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/symhacks.h>
|
||||
# ifndef OPENSSL_NO_CT
|
||||
# include <openssl/ct.h>
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -862,6 +865,9 @@ const char *SSL_get_psk_identity(const SSL *s);
|
||||
|
||||
/* Register callbacks to handle custom TLS Extensions for client or server. */
|
||||
|
||||
__owur int SSL_CTX_has_client_custom_ext(const SSL_CTX *ctx,
|
||||
unsigned int ext_type);
|
||||
|
||||
__owur int SSL_CTX_add_client_custom_ext(SSL_CTX *ctx, unsigned int ext_type,
|
||||
custom_ext_add_cb add_cb,
|
||||
custom_ext_free_cb free_cb,
|
||||
@@ -1865,6 +1871,43 @@ __owur const char *SSL_CIPHER_standard_name(const SSL_CIPHER *c);
|
||||
|
||||
int DTLSv1_listen(SSL *s, BIO_ADDR *client);
|
||||
|
||||
# ifndef OPENSSL_NO_CT
|
||||
|
||||
/*
|
||||
* Sets a |callback| that is invoked upon receipt of ServerHelloDone to validate
|
||||
* the received SCTs.
|
||||
* If the callback returns a non-positive result, the connection is terminated.
|
||||
* Call this function before beginning a handshake.
|
||||
* If a NULL |callback| is provided, SCT validation is disabled.
|
||||
* |arg| is arbitrary userdata that will be passed to the callback whenever it
|
||||
* is invoked. Ownership of |arg| remains with the caller.
|
||||
*
|
||||
* NOTE: A side-effect of setting a CT callback is that an OCSP stapled response
|
||||
* will be requested.
|
||||
*/
|
||||
__owur int SSL_set_ct_validation_callback(SSL *s,
|
||||
ct_validation_cb callback,
|
||||
void *arg);
|
||||
__owur int SSL_CTX_set_ct_validation_callback(SSL_CTX *ctx,
|
||||
ct_validation_cb callback,
|
||||
void *arg);
|
||||
/*
|
||||
* Gets the callback being used to validate SCTs.
|
||||
* This will return NULL if SCTs are neither being requested nor validated.
|
||||
*/
|
||||
__owur ct_validation_cb SSL_get_ct_validation_callback(const SSL *s);
|
||||
__owur ct_validation_cb SSL_CTX_get_ct_validation_callback(const SSL_CTX *ctx);
|
||||
|
||||
/* Gets the SCTs received from a connection */
|
||||
const STACK_OF(SCT) *SSL_get0_peer_scts(SSL *s);
|
||||
|
||||
/* Load the CT log list from the default location */
|
||||
int SSL_CTX_set_default_ctlog_list_file(SSL_CTX *ctx);
|
||||
/* Load the CT log list from the specified file path */
|
||||
int SSL_CTX_set_ctlog_list_file(SSL_CTX *ctx, const char *path);
|
||||
|
||||
# endif /* OPENSSL_NO_CT */
|
||||
|
||||
/* What the "other" parameter contains in security callback */
|
||||
/* Mask for type */
|
||||
# define SSL_SECOP_OTHER_TYPE 0xffff0000
|
||||
@@ -1976,6 +2019,7 @@ void ERR_load_SSL_strings(void);
|
||||
|
||||
/* Function codes. */
|
||||
# define SSL_F_CHECK_SUITEB_CIPHER_LIST 331
|
||||
# define SSL_F_CT_MOVE_SCTS 345
|
||||
# define SSL_F_D2I_SSL_SESSION 103
|
||||
# define SSL_F_DANE_CTX_ENABLE 347
|
||||
# define SSL_F_DANE_MTYPE_SET 393
|
||||
@@ -2058,11 +2102,13 @@ void ERR_load_SSL_strings(void);
|
||||
# define SSL_F_SSL_CREATE_CIPHER_LIST 166
|
||||
# define SSL_F_SSL_CTRL 232
|
||||
# define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY 168
|
||||
# define SSL_F_SSL_CTX_GET_CT_VALIDATION_CALLBACK 349
|
||||
# define SSL_F_SSL_CTX_MAKE_PROFILES 309
|
||||
# define SSL_F_SSL_CTX_NEW 169
|
||||
# define SSL_F_SSL_CTX_SET_ALPN_PROTOS 343
|
||||
# define SSL_F_SSL_CTX_SET_CIPHER_LIST 269
|
||||
# define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE 290
|
||||
# define SSL_F_SSL_CTX_SET_CT_VALIDATION_CALLBACK 396
|
||||
# define SSL_F_SSL_CTX_SET_PURPOSE 226
|
||||
# define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT 219
|
||||
# define SSL_F_SSL_CTX_SET_SSL_VERSION 170
|
||||
@@ -2082,6 +2128,8 @@ void ERR_load_SSL_strings(void);
|
||||
# define SSL_F_SSL_DANE_ENABLE 395
|
||||
# define SSL_F_SSL_DO_CONFIG 391
|
||||
# define SSL_F_SSL_DO_HANDSHAKE 180
|
||||
# define SSL_F_SSL_GET0_PEER_SCTS 397
|
||||
# define SSL_F_SSL_GET_CT_VALIDATION_CALLBACK 398
|
||||
# define SSL_F_SSL_GET_NEW_SESSION 181
|
||||
# define SSL_F_SSL_GET_PREV_SESSION 217
|
||||
# define SSL_F_SSL_GET_SERVER_CERT_INDEX 322
|
||||
@@ -2111,6 +2159,7 @@ void ERR_load_SSL_strings(void);
|
||||
# define SSL_F_SSL_SET_ALPN_PROTOS 344
|
||||
# define SSL_F_SSL_SET_CERT 191
|
||||
# define SSL_F_SSL_SET_CIPHER_LIST 271
|
||||
# define SSL_F_SSL_SET_CT_VALIDATION_CALLBACK 399
|
||||
# define SSL_F_SSL_SET_FD 192
|
||||
# define SSL_F_SSL_SET_PKEY 193
|
||||
# define SSL_F_SSL_SET_PURPOSE 227
|
||||
@@ -2136,6 +2185,7 @@ void ERR_load_SSL_strings(void);
|
||||
# define SSL_F_SSL_USE_RSAPRIVATEKEY 204
|
||||
# define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1 205
|
||||
# define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE 206
|
||||
# define SSL_F_SSL_VALIDATE_CT 400
|
||||
# define SSL_F_SSL_VERIFY_CERT_CHAIN 207
|
||||
# define SSL_F_SSL_WRITE 208
|
||||
# define SSL_F_STATE_MACHINE 353
|
||||
@@ -2253,6 +2303,7 @@ void ERR_load_SSL_strings(void);
|
||||
# define SSL_R_CONTEXT_NOT_DANE_ENABLED 167
|
||||
# define SSL_R_COOKIE_GEN_CALLBACK_FAILURE 400
|
||||
# define SSL_R_COOKIE_MISMATCH 308
|
||||
# define SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED 206
|
||||
# define SSL_R_DANE_ALREADY_ENABLED 172
|
||||
# define SSL_R_DANE_CANNOT_OVERRIDE_MTYPE_FULL 173
|
||||
# define SSL_R_DANE_NOT_ENABLED 175
|
||||
@@ -2377,8 +2428,10 @@ void ERR_load_SSL_strings(void);
|
||||
# define SSL_R_REQUIRED_CIPHER_MISSING 215
|
||||
# define SSL_R_REQUIRED_COMPRESSSION_ALGORITHM_MISSING 342
|
||||
# define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING 345
|
||||
# define SSL_R_SCT_VERIFICATION_FAILED 208
|
||||
# define SSL_R_SERVERHELLO_TLSEXT 275
|
||||
# define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277
|
||||
# define SSL_R_SET_FAILED 209
|
||||
# define SSL_R_SHUTDOWN_WHILE_IN_INIT 407
|
||||
# define SSL_R_SIGNATURE_ALGORITHMS_ERROR 360
|
||||
# define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220
|
||||
|
||||
@@ -240,6 +240,12 @@ extern "C" {
|
||||
/* ExtensionType value from RFC7301 */
|
||||
# define TLSEXT_TYPE_application_layer_protocol_negotiation 16
|
||||
|
||||
/*
|
||||
* Extension type for Certificate Transparency
|
||||
* https://tools.ietf.org/html/rfc6962#section-3.3.1
|
||||
*/
|
||||
# define TLSEXT_TYPE_signed_certificate_timestamp 18
|
||||
|
||||
/*
|
||||
* ExtensionType value for TLS padding extension.
|
||||
* http://tools.ietf.org/html/draft-agl-tls-padding
|
||||
|
||||
Reference in New Issue
Block a user