Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v10.x backport] TLS1.3 (and dependent PRs) #27432

Closed
wants to merge 21 commits into from

Commits on Apr 29, 2019

  1. deps: update OpenSSL upgrade process

    Particularly, ensure that the commit messages are self-explanatory so
    that reviewers can understand that the large commits are the result of a
    simple repeatable process. This should make them easier to review.
    
    See: nodejs#26327 (comment)
    
    PR-URL: nodejs#26378
    Reviewed-By: Michael Dawson <[email protected]>
    Reviewed-By: Richard Lau <[email protected]>
    sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    a868ebe View commit details
    Browse the repository at this point in the history
  2. deps: upgrade openssl sources to 1.1.1b

    This updates all sources in deps/openssl/openssl with openssl-1.1.1b.
    
    PR-URL: nodejs#26327
    Reviewed-By: Gireesh Punathil <[email protected]>
    Reviewed-By: Michael Dawson <[email protected]>
    Reviewed-By: Ben Noordhuis <[email protected]>
    sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    c80bff3 View commit details
    Browse the repository at this point in the history
  3. deps: openssl-1.1.1b no longer packages .gitignore

    Since its not packaged, we don't have to delete it, and the Makefile
    and update can become a (tiny) bit simpler.
    
    PR-URL: nodejs#26327
    Reviewed-By: Gireesh Punathil <[email protected]>
    Reviewed-By: Michael Dawson <[email protected]>
    Reviewed-By: Ben Noordhuis <[email protected]>
    sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    63aa831 View commit details
    Browse the repository at this point in the history
  4. deps: add ARM64 Windows support in openssl

    This adds ARM64 Windows support in the OpenSSL build system.
    
    Since OpenSSL's ARM64 Windows support does not have support for ASM--
    that is, VC-WIN64-ARM inherits from VC-noCE-common which has no ASM
    files--`openssl_no_asm.gypi` is always used for building. This
    essentially forces the 'no-asm' Configure flag.
    
    PR-URL: nodejs#26001
    Fixes: nodejs#25998
    Reviewed-By: James M Snell <[email protected]>
    Reviewed-By: Sam Roberts <[email protected]>
    Signed-off-by: Beth Griggs <[email protected]>
    shigeki authored and sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    1cea121 View commit details
    Browse the repository at this point in the history
  5. deps: add s390 asm rules for OpenSSL-1.1.1

    This is a floating patch against OpenSSL-1.1.1 to generate asm files
    with Makefile rules.
    
    PR-URL: nodejs#25381
    Reviewed-By: Daniel Bevenius <[email protected]>
    Reviewed-By: Shigeki Ohtsu <[email protected]>
    Backport-PR-URL: nodejs#25688
    shigeki authored and sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    c2310c7 View commit details
    Browse the repository at this point in the history
  6. deps: update archs files for OpenSSL-1.1.1b

    `cd deps/openssl/config; make` updates all archs dependant files.
    
    PR-URL: nodejs#26327
    Reviewed-By: Gireesh Punathil <[email protected]>
    Reviewed-By: Michael Dawson <[email protected]>
    Reviewed-By: Ben Noordhuis <[email protected]>
    sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    f54db0b View commit details
    Browse the repository at this point in the history
  7. tls: support changing credentials dynamically

    This commit adds a setSecureContext() method to TLS servers. In
    order to maintain backwards compatibility, the method takes the
    options needed to create a new SecureContext, rather than an
    instance of SecureContext.
    
    Fixes: nodejs#4464
    Refs: nodejs#10349
    Refs: nodejs/help#603
    Refs: nodejs#15115
    PR-URL: nodejs#23644
    Reviewed-By: Ben Noordhuis <[email protected]>
    cjihrig authored and sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    f47e208 View commit details
    Browse the repository at this point in the history
  8. tls: get the local certificate after tls handshake

    Add an API to get the local certificate chosen during TLS handshake from
    the SSL context.
    
    Fix: nodejs#24095
    
    PR-URL: nodejs#24261
    Fixes: nodejs#24095
    Reviewed-By: Ben Noordhuis <[email protected]>
    Reviewed-By: Anna Henningsen <[email protected]>
    Reviewed-By: Daniel Bevenius <[email protected]>
    sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    5f5d3c9 View commit details
    Browse the repository at this point in the history
  9. tls: fix initRead socket argument name

    "wrapped" argument is the caller's "socket", not its "wrap", and its
    referred to as "socket" in the comments, so call it that.
    
    PR-URL: nodejs#25153
    Reviewed-By: Anna Henningsen <[email protected]>
    Reviewed-By: Tobias Nießen <[email protected]>
    Reviewed-By: James M Snell <[email protected]>
    Reviewed-By: Anatoli Papirovski <[email protected]>
    sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    4a82835 View commit details
    Browse the repository at this point in the history
  10. tls: do not confuse session and session ID

    session ID was named session in C++ and key in JS, Name them after what
    they are, as the 'newSession' event docs do.
    
    PR-URL: nodejs#25153
    Reviewed-By: Anna Henningsen <[email protected]>
    Reviewed-By: Tobias Nießen <[email protected]>
    Reviewed-By: James M Snell <[email protected]>
    Reviewed-By: Anatoli Papirovski <[email protected]>
    sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    78b42fc View commit details
    Browse the repository at this point in the history
  11. src: use consistent names for JSStream

    Its confusing to call a js class with a handle a "Wrap", usually it's
    the C++ handle that is called a Wrap (tcp_wrap, tls_wrap, ...). Its
    derived from Socket, and makes a JS stream look like a Socket, so call
    it that. Also, remove use of lib/_stream_wrap.js so it can be deprecated
    some time.
    
    PR-URL: nodejs#25153
    Reviewed-By: Anna Henningsen <[email protected]>
    Reviewed-By: Tobias Nießen <[email protected]>
    Reviewed-By: James M Snell <[email protected]>
    Reviewed-By: Anatoli Papirovski <[email protected]>
    sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    a6635b2 View commit details
    Browse the repository at this point in the history
  12. tls: remove unused ocsp extension parsing

    The OCSP info from parsing the TLS ClientHello has not been used since
    550c263, remove it.
    
    See: nodejs#1464
    
    PR-URL: nodejs#25153
    Reviewed-By: Anna Henningsen <[email protected]>
    Reviewed-By: Tobias Nießen <[email protected]>
    Reviewed-By: James M Snell <[email protected]>
    Reviewed-By: Anatoli Papirovski <[email protected]>
    sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    ae7c74c View commit details
    Browse the repository at this point in the history
  13. src: in-source comments and minor TLS cleanups

    Renamed some internal C++ methods and properties for consistency, and
    commented SSL I/O.
    
    - Rename waiting_new_session_ after is_waiting_new_session(), instead of
      using reverse naming (new_session_wait_), and change "waiting" to
      "awaiting".
    - Make TLSWrap::ClearIn() return void, the value is never used.
    - Fix a getTicketKeys() cut-n-paste error. Since it doesn't use the
      arguments, remove them from the js wrapper.
    - Remove call of setTicketKeys(getTicketKeys()), its a no-op.
    
    PR-URL: nodejs#25713
    Reviewed-By: Anna Henningsen <[email protected]>
    Reviewed-By: Michael Dawson <[email protected]>
    Reviewed-By: Ben Noordhuis <[email protected]>
    sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    6b327e5 View commit details
    Browse the repository at this point in the history
  14. tls: introduce client 'session' event

    OpenSSL has supported async notification of sessions and tickets since
    1.1.0 using SSL_CTX_sess_set_new_cb(), for all versions of TLS. Using
    the async API is optional for TLS1.2 and below, but for TLS1.3 it will
    be mandatory. Future-proof applications should start to use async
    notification immediately. In the future, for TLS1.3, applications that
    don't use the async API will silently, but gracefully, fail to resume
    sessions and instead do a full handshake.
    
    See: https://wiki.openssl.org/index.php/TLS1.3#Sessions
    
    PR-URL: nodejs#25831
    Reviewed-By: Anna Henningsen <[email protected]>
    Reviewed-By: Fedor Indutny <[email protected]>
    sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    2d25b65 View commit details
    Browse the repository at this point in the history
  15. tls: do not free cert in .getCertificate()

    The documentation of `SSL_get_certificate` states that it returns
    an internal pointer that must not be freed by the caller.
    
    Therefore, using a smart pointer to take ownership is incorrect.
    
    Refs: https://man.openbsd.org/SSL_get_certificate.3
    Refs: nodejs#24261
    Fixes: https://github.com/nodejs-private/security/issues/217
    
    PR-URL: nodejs#25490
    Reviewed-By: Daniel Bevenius <[email protected]>
    Reviewed-By: Colin Ihrig <[email protected]>
    Reviewed-By: James M Snell <[email protected]>
    Reviewed-By: Sam Roberts <[email protected]>
    Reviewed-By: Luigi Pinca <[email protected]>
    addaleax authored and sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    8c7406f View commit details
    Browse the repository at this point in the history
  16. src: remove unused TLWrap::EnableTrace()

    Declaration is unused, it was added by mistake in 46c5c33.
    
    PR-URL: nodejs#25861
    Reviewed-By: Fedor Indutny <[email protected]>
    Reviewed-By: Anna Henningsen <[email protected]>
    sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    38838af View commit details
    Browse the repository at this point in the history
  17. src: organize TLSWrap declarations by parent

    Make it clear which of the multiple interfaces a TLSWrap method is
    implementing by grouping and commenting the related methods.
    
    PR-URL: nodejs#25861
    Reviewed-By: Fedor Indutny <[email protected]>
    Reviewed-By: Anna Henningsen <[email protected]>
    sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    d3c7020 View commit details
    Browse the repository at this point in the history
  18. tls: don't shadow the tls global with a local

    `tls` shadows the global `tls` require, and isn't indicative of the
    arument type.
    
    PR-URL: nodejs#25861
    Reviewed-By: Fedor Indutny <[email protected]>
    Reviewed-By: Anna Henningsen <[email protected]>
    sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    1c3c9f3 View commit details
    Browse the repository at this point in the history
  19. src: const_cast is necessary for 1.1.1, not 0.9.7

    The const_cast used to be necessary for SSL_get_app_data() in OpenSSL
    0.9.7, but node doesn't compile against OpenSSL versions that old.
    However, now it's needed for the recently introduced
    SSL_renegotiate_pending(), which is not const-correct as of 1.1.1a.
    
    PR-URL: nodejs#25861
    Reviewed-By: Fedor Indutny <[email protected]>
    Reviewed-By: Anna Henningsen <[email protected]>
    sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    750b906 View commit details
    Browse the repository at this point in the history
  20. src: refactor SSLError case statement

    - Don't use both break and return simultaneously.
    - Use case:/UNREACHABLE() to enforce that all cases are handled, instead
      of CHECK().
    
    Backport-PR-URL: nodejs#25968
    PR-URL: nodejs#25861
    Reviewed-By: Fedor Indutny <[email protected]>
    Reviewed-By: Anna Henningsen <[email protected]>
    
    Reviewed-By: Michael Dawson <[email protected]>
    sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    5febe41 View commit details
    Browse the repository at this point in the history
  21. tls: support "BEGIN TRUSTED CERTIFICATE" for ca:

    Support the same PEM certificate formats for the ca: option to
    tls.createSecureContext() that are supported by openssl when loading a
    CAfile.
    
    Fixes: nodejs#24761
    
    PR-URL: nodejs#24733
    Reviewed-By: Anna Henningsen <[email protected]>
    Reviewed-By: Ben Noordhuis <[email protected]>
    sam-github committed Apr 29, 2019
    Configuration menu
    Copy the full SHA
    1f65f18 View commit details
    Browse the repository at this point in the history