Go to file
Benjamin Kaduk 6b1bb98fad Add SSL_CTX early callback
Provide a callback interface that gives the application the ability
to adjust the nascent SSL object at the earliest stage of ClientHello
processing, immediately after extensions have been collected but
before they have been processed.

This is akin to BoringSSL's "select_certificate_cb" (though it is not
API compatible), and as the name indicates, one major use is to examine
the supplied server name indication and select what certificate to
present to the client.  However, it can also be used to make more
sweeping configuration changes to the SSL object according to the
selected server identity and configuration.  That may include adjusting
the permitted TLS versions, swapping out the SSL_CTX object (as is
traditionally done in a tlsext_servername_callback), changing the
server's cipher list, and more.

We also wish to allow an early callback to indicate that it needs to perform
additional work asynchronously and resume processing later.  To that effect,
refactor the second half of tls_process_client_hello() into a subroutine to be
called at the post-processing stage (including the early callback itself), to
allow the callback to result in remaining in the same work stage for a later
call to succeed.  This requires allocating for and storing the CLIENTHELLO_MSG
in the SSL object to be preserved across such calls, but the storage is
reclaimed after ClientHello processing finishes.

Information about the CliehtHello is available to the callback by means of
accessor functions that can only be used from the early callback.  This allows
extensions to make use of the existing internal parsing machinery without
exposing structure internals (e.g., of PACKET), so that applications do not
have to write fragile parsing code.

Applications are encouraged to utilize an early callback and not use
a servername_callback, in order to avoid unexpected behavior that
occurs due to the relative order of processing between things like
session resumption and the historical servername callback.

Also tidy up nearby style by removing unnecessary braces around one-line
conditional bodies.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2279)
2017-02-23 19:40:26 +01:00
.github Don't need the checkbox; the hook does it 2017-01-28 17:26:56 -05:00
apps Check for the presence of _WIN32 rather than its value. 2017-02-23 14:41:20 +01:00
boringssl@490469f850 Run BoringSSL tests on Travis 2016-11-24 12:21:33 +01:00
Configurations appveyor.yml: engage VC-WIN64A-masm. 2017-02-21 22:39:00 +01:00
crypto Fix typo, should be && rather than & 2017-02-22 21:07:28 +01:00
demos
doc Add SSL_CTX early callback 2017-02-23 19:40:26 +01:00
engines e_afalg: Don't warn about kernel version when pedantic 2016-12-16 14:43:49 +01:00
external/perl
fuzz Update client, server and x509 fuzz corpus 2017-02-21 18:53:07 +01:00
include Add SSL_CTX early callback 2017-02-23 19:40:26 +01:00
ms
os-dep
ssl Add SSL_CTX early callback 2017-02-23 19:40:26 +01:00
test Tests for SSL_bytes_to_cipher_list() 2017-02-23 19:40:25 +01:00
tools
util Add SSL_CTX early callback 2017-02-23 19:40:26 +01:00
VMS
.gitattributes
.gitignore Review comments; fail build if nits found 2017-01-12 09:31:36 -05:00
.gitmodules Run BoringSSL tests on Travis 2016-11-24 12:21:33 +01:00
.travis-create-release.sh
.travis.yml .travis.yml: remove osx from build matrix. 2017-02-19 21:27:57 +01:00
ACKNOWLEDGEMENTS
appveyor.yml appveyor.yml: engage VC-WIN64A-masm. 2017-02-21 22:39:00 +01:00
AUTHORS
build.info
CHANGES Update CHANGES and NEWS for new release 2017-02-16 10:10:05 +00:00
config Implementation of the ARIA cipher as described in RFC 5794. 2017-02-21 11:51:45 +01:00
config.com
Configure Remove -Wno-parentheses-equality from gcc --strict-warnings options. 2017-02-22 14:21:18 -05:00
CONTRIBUTING
e_os.h Revert "Use memcmp() instead of CRYPTO_memcmp() when fuzzing" 2017-02-20 18:54:39 +01:00
FAQ
INSTALL Add support for parameterized SipHash 2017-02-01 14:14:36 -05:00
LICENSE
Makefile.shared
NEWS Update CHANGES and NEWS for new release 2017-02-16 10:10:05 +00:00
NOTES.DJGPP
NOTES.PERL
NOTES.VMS
NOTES.WIN
README
README.ECC
README.ENGINE
README.FIPS

 OpenSSL 1.1.1-dev

 Copyright (c) 1998-2016 The OpenSSL Project
 Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
 All rights reserved.

 DESCRIPTION
 -----------

 The OpenSSL Project is a collaborative effort to develop a robust,
 commercial-grade, fully featured, and Open Source toolkit implementing the
 Transport Layer Security (TLS) protocols (including SSLv3) as well as a
 full-strength general purpose cryptographic library.

 OpenSSL is descended from the SSLeay library developed by Eric A. Young
 and Tim J. Hudson.  The OpenSSL toolkit is licensed under a dual-license (the
 OpenSSL license plus the SSLeay license), which means that you are free to
 get and use it for commercial and non-commercial purposes as long as you
 fulfill the conditions of both licenses.

 OVERVIEW
 --------

 The OpenSSL toolkit includes:

 libssl (with platform specific naming):
     Provides the client and server-side implementations for SSLv3 and TLS.

 libcrypto (with platform specific naming):
     Provides general cryptographic and X.509 support needed by SSL/TLS but
     not logically part of it.

 openssl:
     A command line tool that can be used for:
        Creation of key parameters
        Creation of X.509 certificates, CSRs and CRLs
        Calculation of message digests
        Encryption and decryption
        SSL/TLS client and server tests
        Handling of S/MIME signed or encrypted mail
        And more...

 INSTALLATION
 ------------

 See the appropriate file:
        INSTALL         Linux, Unix, Windows, OpenVMS, ...
        NOTES.*         INSTALL addendums for different platforms

 SUPPORT
 -------

 See the OpenSSL website www.openssl.org for details on how to obtain
 commercial technical support. Free community support is available through the
 openssl-users email list (see
 https://www.openssl.org/community/mailinglists.html for further details).

 If you have any problems with OpenSSL then please take the following steps
 first:

    - Download the latest version from the repository
      to see if the problem has already been addressed
    - Configure with no-asm
    - Remove compiler optimisation flags

 If you wish to report a bug then please include the following information
 and create an issue on GitHub:

    - OpenSSL version: output of 'openssl version -a'
    - Any "Configure" options that you selected during compilation of the
      library if applicable (see INSTALL)
    - OS Name, Version, Hardware platform
    - Compiler Details (name, version)
    - Application Details (name, version)
    - Problem Description (steps that will reproduce the problem, if known)
    - Stack Traceback (if the application dumps core)

 Just because something doesn't work the way you expect does not mean it
 is necessarily a bug in OpenSSL. Use the openssl-users email list for this type
 of query.

 HOW TO CONTRIBUTE TO OpenSSL
 ----------------------------

 See CONTRIBUTING

 LEGALITIES
 ----------

 A number of nations restrict the use or export of cryptography. If you
 are potentially subject to such restrictions you should seek competent
 professional legal advice before attempting to develop or distribute
 cryptographic code.