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

Update openssl 1.1.1i #36520

Closed
wants to merge 5 commits into from

Conversation

MylesBorins
Copy link
Contributor

Lots of different commits here

tarball for update: https://www.openssl.org/source/openssl-1.1.1i.tar.gz
akamai fork: https://github.com/akamai/openssl/tree/OpenSSL_1_1_1i-quic

/cc @nodejs/crypto

@nodejs-github-bot nodejs-github-bot added the openssl Issues and PRs related to the OpenSSL dependency. label Dec 14, 2020
@MylesBorins MylesBorins added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 14, 2020
@jasnell
Copy link
Member

jasnell commented Dec 15, 2020

If this breaks the quic builds at all in CI those should not be considered blocking for this PR. I'll reconcile those and fix that up after this lands.

@jasnell
Copy link
Member

jasnell commented Dec 15, 2020

Rubber stamp LGTM

@MylesBorins
Copy link
Contributor Author

looks like the way I applied the git patch put some stuff in the wrong directory... fixing it now and will repush

@jasnell
Copy link
Member

jasnell commented Dec 15, 2020

The patch in the repo is out of date. It's better to cherry pick the commits directly from the akamai repo and hope for the best lol... If they don't apply skip it and the quic builds will just have to fail until I can get in an update things.

@MylesBorins
Copy link
Contributor Author

MylesBorins commented Dec 15, 2020

@jasnell I updated the patch manually (to keep it for posterity) from the repo. The issue was that I didn't specify directory when running git am so some files ended up in the root. I'm updating the instructions.

edit: just running the command to update the architecture files then I'll update this PR and re-run CI

@MylesBorins MylesBorins removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 15, 2020
@MylesBorins MylesBorins force-pushed the update-openssl-1.1.1i branch 2 times, most recently from fdc5f54 to 18b8a54 Compare December 15, 2020 01:08
@MylesBorins
Copy link
Contributor Author

MylesBorins commented Dec 15, 2020

ugh, compilation is completely busted and I'm really not sure what's going on. May not have time to get this together tonight

edit: spouse is watching bachelorette which is a great opportunity to run some builds 😂

Looks like there was still more of an issue with the git am command (I patch to deps/openssl not deps/openssl/openssl... so fingers crossed that this time we have success!

@MylesBorins MylesBorins force-pushed the update-openssl-1.1.1i branch from 18b8a54 to e5758b5 Compare December 15, 2020 03:23
@MylesBorins
Copy link
Contributor Author

MylesBorins commented Dec 15, 2020

OK! I've managed to get the build working locally, but only with ./configure --experimental-quic. Compilation is failing without the experimental-quic flag and my guess is we are missing the ifndef somewhere in the openssl code.

May poke at this a bit more tonight, but just documenting where I'm at for now.

edit: I think I got it!!! needed to reapply 69f8290e6f to guard the inclusion of quic when it isn't used. phew. Fingers crossed that tests pass now.

@MylesBorins MylesBorins force-pushed the update-openssl-1.1.1i branch from e5758b5 to 36109a4 Compare December 15, 2020 03:50
MylesBorins and others added 5 commits December 14, 2020 22:53
This updates all sources in deps/openssl/openssl by:
    $ cd deps/openssl/
    $ rm -rf openssl
    $ tar zxf ~/tmp/openssl-1.1.1i.tar.gz
    $ mv openssl-1.1.1i openssl
    $ git add --all openssl
    $ git commit openssl
Add support for BoringSSL QUIC APIs

This is a cherry-pick of 2a4b03a306439307e0b822b17eda3bdabddfbb68
on the master-quic-support2 branch (2019-10-07)
Which was a rebase/squash of master-quic-support:

* 5aa62ce Add support for more secrets - Todd Short/Todd Short (master-quic-support)
* 58e0643 Tweeks to quic_change_cipher_state() - Todd Short/Todd Short
* 8169702 Move QUIC code out of tls13_change_cipher_state() - Todd Short/Todd Short
* a08cfe6 Correctly disable middlebox compat - Todd Short/Todd Short
* 3a9eabf Add OPENSSL_NO_QUIC wrapper - Todd Short/Todd Short
* f550eca Add client early traffic secret storage - Todd Short/Todd Short
* 1b787ae Quick fix: s2c to c2s for early secret - Todd Short/Todd Short
* f97e6a9 Don't process an incomplete message - Todd Short/Todd Short
* 81f0ce2 Reset init state in SSL_process_quic_post_handshake() - Todd Short/Todd Short
* 5d59cf9 Fix quic_transport constructors/parsers - Todd Short/Todd Short
* 5e5f91c Fix INSTALL nit. - Todd Short/Todd Short
* bd290ab Fix duplicate word in docs - Todd Short/Todd Short
* 699590b fixup! Handle partial handshake messages - Todd Short/Todd Short
* a472a8d Handle partial handshake messages - Todd Short/Todd Short
* 363cf3d fixup! Use proper secrets for handshake - Todd Short/Todd Short
* b03fee6 Use proper secrets for handshake - Todd Short/Todd Short
* 2ab1aa0 Move QUIC transport params to encrypted extensions - Todd Short/Todd Short
* 0d16af9 Make temp secret names less confusing - Todd Short/Todd Short
* abb6f39 New method to get QUIC secret length - Todd Short/Todd Short
* 05fdae9 Add support for BoringSSL QUIC APIs - Todd Short/Todd Short

This adds a compatible API for BoringSSL's QUIC support, based
on the current |draft-ietf-quic-tls|.

Based on BoringSSL commit 3c034b2cf386b3131f75520705491871a2e0cafe
Based on BoringSSL commit c8e0f90f83b9ec38ea833deb86b5a41360b62b6a
Based on BoringSSL commit 3cbb0299a28a8bd0136257251a78b91a96c5eec8
Based on BoringSSL commit cc9d935256539af2d3b7f831abf57c0d685ffd81
Based on BoringSSL commit e6eef1ca16a022e476bbaedffef044597cfc8f4b
Based on BoringSSL commit 6f733791148cf8a076bf0e95498235aadbe5926d
Based on BoringSSL commit 384d0eaf1930af1ebc47eda751f0c78dfcba1c03
Based on BoringSSL commit a0373182eb5cc7b81d49f434596b473c7801c942
Based on BoringSSL commit b1b76aee3cb43ce11889403c5334283d951ebd37

New method to get QUIC secret length

Make temp secret names less confusing

Move QUIC transport params to encrypted extensions

Use proper secrets for handshake

fixup! Use proper secrets for handshake

Handle partial handshake messages

fixup! Handle partial handshake messages

Fix duplicate word in docs

Fix INSTALL nit.

Fix quic_transport constructors/parsers

Reset init state in SSL_process_quic_post_handshake()

Don't process an incomplete message

Quick fix: s2c to c2s for early secret

Add client early traffic secret storage

Add OPENSSL_NO_QUIC wrapper

Correctly disable middlebox compat

Move QUIC code out of tls13_change_cipher_state()

Create quic_change_cipher_state() that does the minimal required
to generate the QUIC secrets. (e.g. encryption contexts are not
initialized).

Tweeks to quic_change_cipher_state()

Add support for more secrets

Fix resumption secret

(cherry picked from commit 16fafdf4e0ec6cddd5705f407e5dca26cb30914d)

QUIC: Handle EndOfEarlyData and MaxEarlyData

QUIC: Increase HKDF_MAXBUF to 2048

Fall-through for 0RTT

Some cleanup for the main QUIC changes

Try to reduce unneeded whitespace changes and wrap new code to 80 columns.
Reword documentation to attempt to improve clarity.
Add some more sanity checks and clarifying comments to the code.
Update referenced I-D versions.

Prevent KeyUpdate for QUIC

QUIC does not use the TLS KeyUpdate message/mechanism, and indeed
it is an error to generate or receive such a message.  Add the
necessary checks (noting that the check for receipt should be
redundant since SSL_provide_quic_data() is the only way to provide
input to the TLS layer for a QUIC connection).

Test KeyUpdate rejection

For now, just test that we don't generate any, since we don't really
expose the mechanics for encrypting one and the QUIC API is not
integrated into the TLSProxy setup.

Fix out-of-bounds read when TLS msg is split up into multiple chunks

Previously, SSL_provide_quic_data tried to handle this kind of
situation, but it failed when the length of input data is less than
SSL3_HM_HEADER_LENGTH.  If that happens, the code might get wrong
message length by reading value from out-of-bounds region.

Revert "Fix out-of-bounds read when TLS msg is split up into multiple chunks"

This reverts commit 18f993cbdae498111c94a075fd9b115bd8367574.

Test HKDF with empty IKM

Add an extra EVP test that provides empty input key material.
It currently fails, since attempting to set a zero-length key
on an EVP_PKEY_CTX results in a call to OPENSSL_memdup() with
length zero, which returns NULL and is detected as failure.

Allow zero-length HKDF keys

When making a copy to keep in the EVP_PKEY_CTX, allocate a single
byte for the cached key instead of letting memdup return NULL
and cause the call to fail.  The length still gets set to zero
properly, so we don't end up inspecting the allocated byte, but
it's important to have a non-NULL pointer set.

Buffer all provided quic data

Make all data supplied via SSL_provide_quic_data() pass through an
internal buffer, so that we can handle data supplied with arbitrary
framing and only parse complete TLS records onto the list of QUIC_DATA
managed by quic_input_data_head/quic_input_data_tail.

This lets us remove the concept of "incomplete" QUIC_DATA structures,
and the 'offset' field needed to support them.

However, we've already moved the provided data onto the buffer by
the time we can check for KeyUpdate messages, so defer that check
to quic_get_message() (where it is adjacent to the preexisting
ChangeCipherSpec check).

To avoid extra memory copies, we also make the QUIC_DATA structures
just store offsets into the consolidated buffer instead of having copies
of the TLS handshake messages themselves.

enforce consistent encryption level for handshake messages

The QUIC-TLS spec requires that TLS handshake messages do not cross
encryption level boundaries, but we were not previously enforcing this.
PR-URL: nodejs#34033
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
After an OpenSSL source update, all the config files need to be
regenerated and committed by:
  $ make -C deps/openssl/config
  $ git add deps/openssl/config/archs
  $ git add deps/openssl/openssl/include/crypto/bn_conf.h
  $ git add deps/openssl/openssl/include/crypto/dso_conf.h
  $ git add deps/openssl/openssl/include/openssl/opensslconf.h
  $ git commit
@MylesBorins MylesBorins force-pushed the update-openssl-1.1.1i branch from 36109a4 to 3f77eb7 Compare December 15, 2020 03:53
@MylesBorins MylesBorins added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 15, 2020
@MylesBorins MylesBorins removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 15, 2020
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rubber stamp LGTM.

@MylesBorins
Copy link
Contributor Author

Looks like make snapshot is failing on sharedlibs_debug

/home/iojs/build/workspace/node-test-commit-linux-containered/out/Debug/obj.target/tools/v8_gypfiles/libv8_initializers.a -lm -ldl -Wl,--end-group
23:41:46 collect2: fatal error: ld terminated with signal 9 [Killed]
23:41:46 compilation terminated.
23:41:46 node_mksnapshot.target.mk:208: recipe for target '/home/iojs/build/workspace/node-test-commit-linux-containered/out/Debug/node_mksnapshot' failed
23:41:46 make[2]: *** [/home/iojs/build/workspace/node-test-commit-linux-containered/out/Debug/node_mksnapshot] Error 1
23:41:46 make[2]: *** Waiting for unfinished jobs....
23:41:47 /usr/bin/ld: error: /home/iojs/build/workspace/node-test-commit-linux-containered/out/Debug/embedtest(.debug_info) is too large (0x30052d9a bytes)
23:41:47 /usr/bin/ld: error: /home/iojs/build/workspace/node-test-commit-linux-containered/out/Debug/mkcodecache(.debug_info) is too large (0x30075ecd bytes)
23:41:47 rm fa309b4689a758e9e8a16895fbbf2b4922a45c96.intermediate 736d921f6b1b990ce7212282398c5c71fcfd32a0.intermediate

@MylesBorins
Copy link
Contributor Author

MylesBorins commented Dec 15, 2020

/cc @joyeecheung maybe you know what's going on with make snapshot?

edit: looks like the most recent CI was green and just didn't update the GitHub UI

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rubber stamp LGTM

@MylesBorins MylesBorins added the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 17, 2020
@github-actions github-actions bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 17, 2020
@github-actions
Copy link
Contributor

Commit Queue failed
- Loading data for nodejs/node/pull/36520
✔  Done loading data for nodejs/node/pull/36520
----------------------------------- PR info ------------------------------------
Title      Update openssl 1.1.1i (#36520)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     MylesBorins:update-openssl-1.1.1i -> nodejs:master
Labels     openssl
Commits    5
 - deps: update patch and docs for openssl update
 - deps: upgrade openssl sources to 1.1.1i
 - deps: various quic patches from akamai/openssl
 - deps: re-enable OPENSSL_NO_QUIC guards
 - deps: update archs files for OpenSSL-1.1.1i
Committers 1
 - Myles Borins 
PR-URL: https://github.com/nodejs/node/pull/36520
Reviewed-By: James M Snell 
Reviewed-By: Richard Lau 
Reviewed-By: Michael Dawson 
Reviewed-By: Beth Griggs 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/36520
Reviewed-By: James M Snell 
Reviewed-By: Richard Lau 
Reviewed-By: Michael Dawson 
Reviewed-By: Beth Griggs 
--------------------------------------------------------------------------------
   ✔  Last GitHub Actions successful
   ℹ  Last Full PR CI on 2020-12-15T11:20:30Z: https://ci.nodejs.org/job/node-test-pull-request/34946/
- Querying data for job/node-test-pull-request/34946/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
   ℹ  This PR was created on Mon, 14 Dec 2020 23:55:42 GMT
   ✔  Approvals: 4
   ✔  - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/36520#pullrequestreview-552635549
   ✔  - Richard Lau (@richardlau): https://github.com/nodejs/node/pull/36520#pullrequestreview-552660209
   ✔  - Michael Dawson (@mhdawson) (TSC): https://github.com/nodejs/node/pull/36520#pullrequestreview-554086288
   ✔  - Beth Griggs (@BethGriggs) (TSC): https://github.com/nodejs/node/pull/36520#pullrequestreview-554176336
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/master up to date...
From https://github.com/nodejs/node
 * branch                  master     -> FETCH_HEAD
✔  origin/master is now up-to-date
- Downloading patch for 36520
From https://github.com/nodejs/node
 * branch                  refs/pull/36520/merge -> FETCH_HEAD
✔  Fetched commits as 0e96dc1f95be..3f77eb742ab4
--------------------------------------------------------------------------------
[master 972c4cceda] deps: update patch and docs for openssl update
 Author: Myles Borins 
 Date: Mon Dec 14 17:10:23 2020 -0500
 2 files changed, 1981 insertions(+), 336 deletions(-)
Removing deps/openssl/openssl/ssl/statem/statem_quic.c
Removing deps/openssl/openssl/ssl/ssl_quic.c
Removing deps/openssl/openssl/include/openssl/opensslconf.h
Removing deps/openssl/openssl/include/crypto/dso_conf.h
Removing deps/openssl/openssl/include/crypto/bn_conf.h
Removing deps/openssl/openssl/doc/man3/SSL_CTX_set_quic_method.pod
Removing deps/openssl/openssl/crypto/ec/asm/ecp_nistz256-avx2.pl
[master c8ad6e4e30] deps: upgrade openssl sources to 1.1.1i
 Author: Myles Borins 
 Date: Mon Dec 14 17:47:09 2020 -0500
 373 files changed, 4265 insertions(+), 5667 deletions(-)
 mode change 100644 => 100755 deps/openssl/openssl/apps/ca.c
 delete mode 100755 deps/openssl/openssl/crypto/ec/asm/ecp_nistz256-avx2.pl
 delete mode 100644 deps/openssl/openssl/doc/man3/SSL_CTX_set_quic_method.pod
 delete mode 100644 deps/openssl/openssl/include/crypto/bn_conf.h
 delete mode 100644 deps/openssl/openssl/include/crypto/dso_conf.h
 delete mode 100644 deps/openssl/openssl/include/openssl/opensslconf.h
 delete mode 100644 deps/openssl/openssl/ssl/ssl_quic.c
 delete mode 100644 deps/openssl/openssl/ssl/statem/statem_quic.c
 create mode 100644 deps/openssl/openssl/test/certs/ca-cert-ec-explicit.pem
 create mode 100644 deps/openssl/openssl/test/certs/ca-cert-ec-named.pem
 create mode 100644 deps/openssl/openssl/test/certs/ca-key-ec-explicit.pem
 create mode 100644 deps/openssl/openssl/test/certs/ca-key-ec-named.pem
 create mode 100644 deps/openssl/openssl/test/certs/ee-cert-ec-explicit.pem
 create mode 100644 deps/openssl/openssl/test/certs/ee-cert-ec-named-explicit.pem
 create mode 100644 deps/openssl/openssl/test/certs/ee-cert-ec-named-named.pem
 create mode 100644 deps/openssl/openssl/test/certs/ee-key-ec-explicit.pem
 create mode 100644 deps/openssl/openssl/test/certs/ee-key-ec-named-explicit.pem
 create mode 100644 deps/openssl/openssl/test/certs/ee-key-ec-named-named.pem
 create mode 100644 deps/openssl/openssl/test/certs/ee-self-signed.pem
 create mode 100644 deps/openssl/openssl/test/certs/root-expired.pem
 create mode 100644 deps/openssl/openssl/test/cmactest.c
 create mode 100644 deps/openssl/openssl/test/recipes/04-test_pem_data/cert-254-chars-at-the-end.pem
 create mode 100644 deps/openssl/openssl/test/recipes/04-test_pem_data/cert-254-chars-in-the-middle.pem
 create mode 100644 deps/openssl/openssl/test/recipes/04-test_pem_data/cert-oneline-multiple-of-254.pem
 create mode 100644 deps/openssl/openssl/test/recipes/05-test_cmac.t
 create mode 100644 deps/openssl/openssl/test/recipes/15-test_genec.t
 create mode 100644 deps/openssl/openssl/test/recipes/20-test_dgst.t
 create mode 100644 deps/openssl/openssl/test/tested25519.pem
 create mode 100644 deps/openssl/openssl/test/tested25519pub.pem
 create mode 100644 deps/openssl/openssl/test/tested448.pem
 create mode 100644 deps/openssl/openssl/test/tested448pub.pem
[master 4804717d66] deps: various quic patches from akamai/openssl
 Author: Todd Short 
 Date: Fri Apr 12 11:13:25 2019 -0400
 35 files changed, 1532 insertions(+), 33 deletions(-)
 create mode 100644 deps/openssl/openssl/doc/man3/SSL_CTX_set_quic_method.pod
 create mode 100644 deps/openssl/openssl/ssl/ssl_quic.c
 create mode 100644 deps/openssl/openssl/ssl/statem/statem_quic.c
[master cd52eda73f] deps: re-enable OPENSSL_NO_QUIC guards
 Author: James M Snell 
 Date: Tue Jun 23 17:40:53 2020 -0700
 2 files changed, 8 insertions(+)
[master 3791d5ed7d] deps: update archs files for OpenSSL-1.1.1i
 Author: Myles Borins 
 Date: Mon Dec 14 22:12:07 2020 -0500
 232 files changed, 2134 insertions(+), 471 deletions(-)
 create mode 100644 deps/openssl/openssl/include/crypto/bn_conf.h
 create mode 100644 deps/openssl/openssl/include/crypto/dso_conf.h
 create mode 100644 deps/openssl/openssl/include/openssl/opensslconf.h
   ✔  Patches applied
There are 5 commits in the PR. Attempting autorebase.
Rebasing (2/10)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
deps: update patch and docs for openssl update

PR-URL: #36520
Reviewed-By: James M Snell jasnell@gmail.com
Reviewed-By: Richard Lau rlau@redhat.com
Reviewed-By: Michael Dawson midawson@redhat.com
Reviewed-By: Beth Griggs bgriggs@redhat.com

[detached HEAD 72a6ede4dc] deps: update patch and docs for openssl update
Author: Myles Borins mylesborins@github.com
Date: Mon Dec 14 17:10:23 2020 -0500
2 files changed, 1981 insertions(+), 336 deletions(-)
Rebasing (3/10)
Rebasing (4/10)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
deps: upgrade openssl sources to 1.1.1i

This updates all sources in deps/openssl/openssl by:
$ cd deps/openssl/
$ rm -rf openssl
$ tar zxf ~/tmp/openssl-1.1.1i.tar.gz
$ mv openssl-1.1.1i openssl
$ git add --all openssl
$ git commit openssl

PR-URL: #36520
Reviewed-By: James M Snell jasnell@gmail.com
Reviewed-By: Richard Lau rlau@redhat.com
Reviewed-By: Michael Dawson midawson@redhat.com
Reviewed-By: Beth Griggs bgriggs@redhat.com

[detached HEAD 274864f701] deps: upgrade openssl sources to 1.1.1i
Author: Myles Borins mylesborins@github.com
Date: Mon Dec 14 17:47:09 2020 -0500
373 files changed, 4265 insertions(+), 5667 deletions(-)
mode change 100644 => 100755 deps/openssl/openssl/apps/ca.c
delete mode 100755 deps/openssl/openssl/crypto/ec/asm/ecp_nistz256-avx2.pl
delete mode 100644 deps/openssl/openssl/doc/man3/SSL_CTX_set_quic_method.pod
delete mode 100644 deps/openssl/openssl/include/crypto/bn_conf.h
delete mode 100644 deps/openssl/openssl/include/crypto/dso_conf.h
delete mode 100644 deps/openssl/openssl/include/openssl/opensslconf.h
delete mode 100644 deps/openssl/openssl/ssl/ssl_quic.c
delete mode 100644 deps/openssl/openssl/ssl/statem/statem_quic.c
create mode 100644 deps/openssl/openssl/test/certs/ca-cert-ec-explicit.pem
create mode 100644 deps/openssl/openssl/test/certs/ca-cert-ec-named.pem
create mode 100644 deps/openssl/openssl/test/certs/ca-key-ec-explicit.pem
create mode 100644 deps/openssl/openssl/test/certs/ca-key-ec-named.pem
create mode 100644 deps/openssl/openssl/test/certs/ee-cert-ec-explicit.pem
create mode 100644 deps/openssl/openssl/test/certs/ee-cert-ec-named-explicit.pem
create mode 100644 deps/openssl/openssl/test/certs/ee-cert-ec-named-named.pem
create mode 100644 deps/openssl/openssl/test/certs/ee-key-ec-explicit.pem
create mode 100644 deps/openssl/openssl/test/certs/ee-key-ec-named-explicit.pem
create mode 100644 deps/openssl/openssl/test/certs/ee-key-ec-named-named.pem
create mode 100644 deps/openssl/openssl/test/certs/ee-self-signed.pem
create mode 100644 deps/openssl/openssl/test/certs/root-expired.pem
create mode 100644 deps/openssl/openssl/test/cmactest.c
create mode 100644 deps/openssl/openssl/test/recipes/04-test_pem_data/cert-254-chars-at-the-end.pem
create mode 100644 deps/openssl/openssl/test/recipes/04-test_pem_data/cert-254-chars-in-the-middle.pem
create mode 100644 deps/openssl/openssl/test/recipes/04-test_pem_data/cert-oneline-multiple-of-254.pem
create mode 100644 deps/openssl/openssl/test/recipes/05-test_cmac.t
create mode 100644 deps/openssl/openssl/test/recipes/15-test_genec.t
create mode 100644 deps/openssl/openssl/test/recipes/20-test_dgst.t
create mode 100644 deps/openssl/openssl/test/tested25519.pem
create mode 100644 deps/openssl/openssl/test/tested25519pub.pem
create mode 100644 deps/openssl/openssl/test/tested448.pem
create mode 100644 deps/openssl/openssl/test/tested448pub.pem
Rebasing (5/10)
Rebasing (6/10)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
deps: various quic patches from akamai/openssl

Add support for BoringSSL QUIC APIs

This is a cherry-pick of 2a4b03a306439307e0b822b17eda3bdabddfbb68
on the master-quic-support2 branch (2019-10-07)
Which was a rebase/squash of master-quic-support:

  • 5aa62ce Add support for more secrets - Todd Short/Todd Short (master-quic-support)
  • 58e0643 Tweeks to quic_change_cipher_state() - Todd Short/Todd Short
  • 8169702 Move QUIC code out of tls13_change_cipher_state() - Todd Short/Todd Short
  • a08cfe6 Correctly disable middlebox compat - Todd Short/Todd Short
  • 3a9eabf Add OPENSSL_NO_QUIC wrapper - Todd Short/Todd Short
  • f550eca Add client early traffic secret storage - Todd Short/Todd Short
  • 1b787ae Quick fix: s2c to c2s for early secret - Todd Short/Todd Short
  • f97e6a9 Don't process an incomplete message - Todd Short/Todd Short
  • 81f0ce2 Reset init state in SSL_process_quic_post_handshake() - Todd Short/Todd Short
  • 5d59cf9 Fix quic_transport constructors/parsers - Todd Short/Todd Short
  • 5e5f91c Fix INSTALL nit. - Todd Short/Todd Short
  • bd290ab Fix duplicate word in docs - Todd Short/Todd Short
  • 699590b fixup! Handle partial handshake messages - Todd Short/Todd Short
  • a472a8d Handle partial handshake messages - Todd Short/Todd Short
  • 363cf3d fixup! Use proper secrets for handshake - Todd Short/Todd Short
  • b03fee6 Use proper secrets for handshake - Todd Short/Todd Short
  • 2ab1aa0 Move QUIC transport params to encrypted extensions - Todd Short/Todd Short
  • 0d16af9 Make temp secret names less confusing - Todd Short/Todd Short
  • abb6f39 New method to get QUIC secret length - Todd Short/Todd Short
  • 05fdae9 Add support for BoringSSL QUIC APIs - Todd Short/Todd Short

This adds a compatible API for BoringSSL's QUIC support, based
on the current |draft-ietf-quic-tls|.

Based on BoringSSL commit 3c034b2cf386b3131f75520705491871a2e0cafe
Based on BoringSSL commit c8e0f90f83b9ec38ea833deb86b5a41360b62b6a
Based on BoringSSL commit 3cbb0299a28a8bd0136257251a78b91a96c5eec8
Based on BoringSSL commit cc9d935256539af2d3b7f831abf57c0d685ffd81
Based on BoringSSL commit e6eef1ca16a022e476bbaedffef044597cfc8f4b
Based on BoringSSL commit 6f733791148cf8a076bf0e95498235aadbe5926d
Based on BoringSSL commit 384d0eaf1930af1ebc47eda751f0c78dfcba1c03
Based on BoringSSL commit a0373182eb5cc7b81d49f434596b473c7801c942
Based on BoringSSL commit b1b76aee3cb43ce11889403c5334283d951ebd37

New method to get QUIC secret length

Make temp secret names less confusing

Move QUIC transport params to encrypted extensions

Use proper secrets for handshake

fixup! Use proper secrets for handshake

Handle partial handshake messages

fixup! Handle partial handshake messages

Fix duplicate word in docs

Fix INSTALL nit.

Fix quic_transport constructors/parsers

Reset init state in SSL_process_quic_post_handshake()

Don't process an incomplete message

Quick fix: s2c to c2s for early secret

Add client early traffic secret storage

Add OPENSSL_NO_QUIC wrapper

Correctly disable middlebox compat

Move QUIC code out of tls13_change_cipher_state()

Create quic_change_cipher_state() that does the minimal required
to generate the QUIC secrets. (e.g. encryption contexts are not
initialized).

Tweeks to quic_change_cipher_state()

Add support for more secrets

Fix resumption secret

(cherry picked from commit 16fafdf4e0ec6cddd5705f407e5dca26cb30914d)

QUIC: Handle EndOfEarlyData and MaxEarlyData

QUIC: Increase HKDF_MAXBUF to 2048

Fall-through for 0RTT

Some cleanup for the main QUIC changes

Try to reduce unneeded whitespace changes and wrap new code to 80 columns.
Reword documentation to attempt to improve clarity.
Add some more sanity checks and clarifying comments to the code.
Update referenced I-D versions.

Prevent KeyUpdate for QUIC

QUIC does not use the TLS KeyUpdate message/mechanism, and indeed
it is an error to generate or receive such a message. Add the
necessary checks (noting that the check for receipt should be
redundant since SSL_provide_quic_data() is the only way to provide
input to the TLS layer for a QUIC connection).

Test KeyUpdate rejection

For now, just test that we don't generate any, since we don't really
expose the mechanics for encrypting one and the QUIC API is not
integrated into the TLSProxy setup.

Fix out-of-bounds read when TLS msg is split up into multiple chunks

Previously, SSL_provide_quic_data tried to handle this kind of
situation, but it failed when the length of input data is less than
SSL3_HM_HEADER_LENGTH. If that happens, the code might get wrong
message length by reading value from out-of-bounds region.

Revert "Fix out-of-bounds read when TLS msg is split up into multiple chunks"

This reverts commit 18f993cbdae498111c94a075fd9b115bd8367574.

Test HKDF with empty IKM

Add an extra EVP test that provides empty input key material.
It currently fails, since attempting to set a zero-length key
on an EVP_PKEY_CTX results in a call to OPENSSL_memdup() with
length zero, which returns NULL and is detected as failure.

Allow zero-length HKDF keys

When making a copy to keep in the EVP_PKEY_CTX, allocate a single
byte for the cached key instead of letting memdup return NULL
and cause the call to fail. The length still gets set to zero
properly, so we don't end up inspecting the allocated byte, but
it's important to have a non-NULL pointer set.

Buffer all provided quic data

Make all data supplied via SSL_provide_quic_data() pass through an
internal buffer, so that we can handle data supplied with arbitrary
framing and only parse complete TLS records onto the list of QUIC_DATA
managed by quic_input_data_head/quic_input_data_tail.

This lets us remove the concept of "incomplete" QUIC_DATA structures,
and the 'offset' field needed to support them.

However, we've already moved the provided data onto the buffer by
the time we can check for KeyUpdate messages, so defer that check
to quic_get_message() (where it is adjacent to the preexisting
ChangeCipherSpec check).

To avoid extra memory copies, we also make the QUIC_DATA structures
just store offsets into the consolidated buffer instead of having copies
of the TLS handshake messages themselves.

enforce consistent encryption level for handshake messages

The QUIC-TLS spec requires that TLS handshake messages do not cross
encryption level boundaries, but we were not previously enforcing this.

PR-URL: #36520
Reviewed-By: James M Snell jasnell@gmail.com
Reviewed-By: Richard Lau rlau@redhat.com
Reviewed-By: Michael Dawson midawson@redhat.com
Reviewed-By: Beth Griggs bgriggs@redhat.com

[detached HEAD d0100a501c] deps: various quic patches from akamai/openssl
Author: Todd Short tshort@akamai.com
Date: Fri Apr 12 11:13:25 2019 -0400
35 files changed, 1532 insertions(+), 33 deletions(-)
create mode 100644 deps/openssl/openssl/doc/man3/SSL_CTX_set_quic_method.pod
create mode 100644 deps/openssl/openssl/ssl/ssl_quic.c
create mode 100644 deps/openssl/openssl/ssl/statem/statem_quic.c
Rebasing (7/10)
Rebasing (8/10)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
deps: re-enable OPENSSL_NO_QUIC guards

PR-URL: #34033
Reviewed-By: Anna Henningsen anna@addaleax.net
Reviewed-By: Jiawen Geng technicalcute@gmail.com
Reviewed-By: Daniel Bevenius daniel.bevenius@gmail.com

PR-URL: #36520
Reviewed-By: James M Snell jasnell@gmail.com
Reviewed-By: Richard Lau rlau@redhat.com
Reviewed-By: Michael Dawson midawson@redhat.com
Reviewed-By: Beth Griggs bgriggs@redhat.com

[detached HEAD 801d961813] deps: re-enable OPENSSL_NO_QUIC guards
Author: James M Snell jasnell@gmail.com
Date: Tue Jun 23 17:40:53 2020 -0700
2 files changed, 8 insertions(+)
Rebasing (9/10)
Rebasing (10/10)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
deps: update archs files for OpenSSL-1.1.1i

After an OpenSSL source update, all the config files need to be
regenerated and committed by:
$ make -C deps/openssl/config
$ git add deps/openssl/config/archs
$ git add deps/openssl/openssl/include/crypto/bn_conf.h
$ git add deps/openssl/openssl/include/crypto/dso_conf.h
$ git add deps/openssl/openssl/include/openssl/opensslconf.h
$ git commit

PR-URL: #36520
Reviewed-By: James M Snell jasnell@gmail.com
Reviewed-By: Richard Lau rlau@redhat.com
Reviewed-By: Michael Dawson midawson@redhat.com
Reviewed-By: Beth Griggs bgriggs@redhat.com

[detached HEAD 4dbc586a79] deps: update archs files for OpenSSL-1.1.1i
Author: Myles Borins mylesborins@github.com
Date: Mon Dec 14 22:12:07 2020 -0500
232 files changed, 2134 insertions(+), 471 deletions(-)
create mode 100644 deps/openssl/openssl/include/crypto/bn_conf.h
create mode 100644 deps/openssl/openssl/include/crypto/dso_conf.h
create mode 100644 deps/openssl/openssl/include/openssl/opensslconf.h

Successfully rebased and updated refs/heads/master.
✔ 72a6ede4dc454b093fc22f050627507a305a5121
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 1:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✔ 0:0 Title is formatted correctly. title-format
✔ 0:0 Title is <= 50 columns. title-length
✔ 274864f701644e3342089633ecedfba560dcdd8e
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 9:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✔ 0:0 Title is formatted correctly. title-format
✔ 0:0 Title is <= 50 columns. title-length
✖ d0100a501c48d905607fe81e4855ce5b5296808b
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✖ 7:72 Line should be <= 72 columns. line-length
✖ 9:72 Line should be <= 72 columns. line-length
✖ 12:72 Line should be <= 72 columns. line-length
✖ 15:72 Line should be <= 72 columns. line-length
✖ 16:72 Line should be <= 72 columns. line-length
✖ 19:72 Line should be <= 72 columns. line-length
✖ 21:72 Line should be <= 72 columns. line-length
✖ 23:72 Line should be <= 72 columns. line-length
✖ 95:72 Line should be <= 72 columns. line-length
✖ 121:72 Line should be <= 72 columns. line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 164:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✔ 0:0 Title is formatted correctly. title-format
✔ 0:0 Title is <= 50 columns. title-length
✔ 801d961813cf6cf7b8829a4b8a5474bb960e5764
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 6:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✔ 0:0 Title is formatted correctly. title-format
✔ 0:0 Title is <= 50 columns. title-length
✔ 4dbc586a794723057d8279c20718228384b8d66e
✔ 0:0 skipping fixes-url fixes-url
✔ 0:0 blank line after title line-after-title
✔ 0:0 line-lengths are valid line-length
✔ 0:0 metadata is at end of message metadata-end
✔ 10:8 PR-URL is valid. pr-url
✔ 0:0 reviewers are valid reviewers
✔ 0:0 valid subsystems subsystem
✔ 0:0 Title is formatted correctly. title-format
✔ 0:0 Title is <= 50 columns. title-length
ℹ Please fix the commit message and try again.

https://github.com/nodejs/node/actions/runs/426994337

@github-actions github-actions bot added the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label Dec 17, 2020
MylesBorins added a commit that referenced this pull request Dec 17, 2020
PR-URL: #36520
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
MylesBorins added a commit that referenced this pull request Dec 17, 2020
This updates all sources in deps/openssl/openssl by:
    $ cd deps/openssl/
    $ rm -rf openssl
    $ tar zxf ~/tmp/openssl-1.1.1i.tar.gz
    $ mv openssl-1.1.1i openssl
    $ git add --all openssl
    $ git commit openssl

PR-URL: #36520
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
MylesBorins pushed a commit that referenced this pull request Dec 17, 2020
Add support for BoringSSL QUIC APIs

This is a cherry-pick of 2a4b03a306439307e0b822b17eda3bdabddfbb68
on the master-quic-support2 branch (2019-10-07)
Which was a rebase/squash of master-quic-support:

* 5aa62ce Add support for more secrets - Todd Short/Todd Short (master-quic-support)
* 58e0643 Tweeks to quic_change_cipher_state() - Todd Short/Todd Short
* 8169702 Move QUIC code out of tls13_change_cipher_state() - Todd Short/Todd Short
* a08cfe6 Correctly disable middlebox compat - Todd Short/Todd Short
* 3a9eabf Add OPENSSL_NO_QUIC wrapper - Todd Short/Todd Short
* f550eca Add client early traffic secret storage - Todd Short/Todd Short
* 1b787ae Quick fix: s2c to c2s for early secret - Todd Short/Todd Short
* f97e6a9 Don't process an incomplete message - Todd Short/Todd Short
* 81f0ce2 Reset init state in SSL_process_quic_post_handshake() - Todd Short/Todd Short
* 5d59cf9 Fix quic_transport constructors/parsers - Todd Short/Todd Short
* 5e5f91c Fix INSTALL nit. - Todd Short/Todd Short
* bd290ab Fix duplicate word in docs - Todd Short/Todd Short
* 699590b fixup! Handle partial handshake messages - Todd Short/Todd Short
* a472a8d Handle partial handshake messages - Todd Short/Todd Short
* 363cf3d fixup! Use proper secrets for handshake - Todd Short/Todd Short
* b03fee6 Use proper secrets for handshake - Todd Short/Todd Short
* 2ab1aa0 Move QUIC transport params to encrypted extensions - Todd Short/Todd Short
* 0d16af9 Make temp secret names less confusing - Todd Short/Todd Short
* abb6f39 New method to get QUIC secret length - Todd Short/Todd Short
* 05fdae9 Add support for BoringSSL QUIC APIs - Todd Short/Todd Short

This adds a compatible API for BoringSSL's QUIC support, based
on the current |draft-ietf-quic-tls|.

Based on BoringSSL commit 3c034b2cf386b3131f75520705491871a2e0cafe
Based on BoringSSL commit c8e0f90f83b9ec38ea833deb86b5a41360b62b6a
Based on BoringSSL commit 3cbb0299a28a8bd0136257251a78b91a96c5eec8
Based on BoringSSL commit cc9d935256539af2d3b7f831abf57c0d685ffd81
Based on BoringSSL commit e6eef1ca16a022e476bbaedffef044597cfc8f4b
Based on BoringSSL commit 6f733791148cf8a076bf0e95498235aadbe5926d
Based on BoringSSL commit 384d0eaf1930af1ebc47eda751f0c78dfcba1c03
Based on BoringSSL commit a0373182eb5cc7b81d49f434596b473c7801c942
Based on BoringSSL commit b1b76aee3cb43ce11889403c5334283d951ebd37

New method to get QUIC secret length

Make temp secret names less confusing

Move QUIC transport params to encrypted extensions

Use proper secrets for handshake

fixup! Use proper secrets for handshake

Handle partial handshake messages

fixup! Handle partial handshake messages

Fix duplicate word in docs

Fix INSTALL nit.

Fix quic_transport constructors/parsers

Reset init state in SSL_process_quic_post_handshake()

Don't process an incomplete message

Quick fix: s2c to c2s for early secret

Add client early traffic secret storage

Add OPENSSL_NO_QUIC wrapper

Correctly disable middlebox compat

Move QUIC code out of tls13_change_cipher_state()

Create quic_change_cipher_state() that does the minimal required
to generate the QUIC secrets. (e.g. encryption contexts are not
initialized).

Tweeks to quic_change_cipher_state()

Add support for more secrets

Fix resumption secret

(cherry picked from commit 16fafdf4e0ec6cddd5705f407e5dca26cb30914d)

QUIC: Handle EndOfEarlyData and MaxEarlyData

QUIC: Increase HKDF_MAXBUF to 2048

Fall-through for 0RTT

Some cleanup for the main QUIC changes

Try to reduce unneeded whitespace changes and wrap new code to 80 columns.
Reword documentation to attempt to improve clarity.
Add some more sanity checks and clarifying comments to the code.
Update referenced I-D versions.

Prevent KeyUpdate for QUIC

QUIC does not use the TLS KeyUpdate message/mechanism, and indeed
it is an error to generate or receive such a message.  Add the
necessary checks (noting that the check for receipt should be
redundant since SSL_provide_quic_data() is the only way to provide
input to the TLS layer for a QUIC connection).

Test KeyUpdate rejection

For now, just test that we don't generate any, since we don't really
expose the mechanics for encrypting one and the QUIC API is not
integrated into the TLSProxy setup.

Fix out-of-bounds read when TLS msg is split up into multiple chunks

Previously, SSL_provide_quic_data tried to handle this kind of
situation, but it failed when the length of input data is less than
SSL3_HM_HEADER_LENGTH.  If that happens, the code might get wrong
message length by reading value from out-of-bounds region.

Revert "Fix out-of-bounds read when TLS msg is split up into multiple chunks"

This reverts commit 18f993cbdae498111c94a075fd9b115bd8367574.

Test HKDF with empty IKM

Add an extra EVP test that provides empty input key material.
It currently fails, since attempting to set a zero-length key
on an EVP_PKEY_CTX results in a call to OPENSSL_memdup() with
length zero, which returns NULL and is detected as failure.

Allow zero-length HKDF keys

When making a copy to keep in the EVP_PKEY_CTX, allocate a single
byte for the cached key instead of letting memdup return NULL
and cause the call to fail.  The length still gets set to zero
properly, so we don't end up inspecting the allocated byte, but
it's important to have a non-NULL pointer set.

Buffer all provided quic data

Make all data supplied via SSL_provide_quic_data() pass through an
internal buffer, so that we can handle data supplied with arbitrary
framing and only parse complete TLS records onto the list of QUIC_DATA
managed by quic_input_data_head/quic_input_data_tail.

This lets us remove the concept of "incomplete" QUIC_DATA structures,
and the 'offset' field needed to support them.

However, we've already moved the provided data onto the buffer by
the time we can check for KeyUpdate messages, so defer that check
to quic_get_message() (where it is adjacent to the preexisting
ChangeCipherSpec check).

To avoid extra memory copies, we also make the QUIC_DATA structures
just store offsets into the consolidated buffer instead of having copies
of the TLS handshake messages themselves.

enforce consistent encryption level for handshake messages

The QUIC-TLS spec requires that TLS handshake messages do not cross
encryption level boundaries, but we were not previously enforcing this.

PR-URL: #36520
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
MylesBorins pushed a commit that referenced this pull request Dec 17, 2020
PR-URL: #34033
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>

PR-URL: #36520
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
MylesBorins added a commit that referenced this pull request Dec 17, 2020
After an OpenSSL source update, all the config files need to be
regenerated and committed by:
  $ make -C deps/openssl/config
  $ git add deps/openssl/config/archs
  $ git add deps/openssl/openssl/include/crypto/bn_conf.h
  $ git add deps/openssl/openssl/include/crypto/dso_conf.h
  $ git add deps/openssl/openssl/include/openssl/opensslconf.h
  $ git commit

PR-URL: #36520
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
@MylesBorins
Copy link
Contributor Author

MylesBorins commented Dec 17, 2020

landed in b833305...e51267b

targos pushed a commit that referenced this pull request Dec 21, 2020
PR-URL: #36520
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
targos pushed a commit that referenced this pull request Dec 21, 2020
This updates all sources in deps/openssl/openssl by:
    $ cd deps/openssl/
    $ rm -rf openssl
    $ tar zxf ~/tmp/openssl-1.1.1i.tar.gz
    $ mv openssl-1.1.1i openssl
    $ git add --all openssl
    $ git commit openssl

PR-URL: #36520
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
targos pushed a commit that referenced this pull request Dec 21, 2020
Add support for BoringSSL QUIC APIs

This is a cherry-pick of 2a4b03a306439307e0b822b17eda3bdabddfbb68
on the master-quic-support2 branch (2019-10-07)
Which was a rebase/squash of master-quic-support:

* 5aa62ce Add support for more secrets - Todd Short/Todd Short (master-quic-support)
* 58e0643 Tweeks to quic_change_cipher_state() - Todd Short/Todd Short
* 8169702 Move QUIC code out of tls13_change_cipher_state() - Todd Short/Todd Short
* a08cfe6 Correctly disable middlebox compat - Todd Short/Todd Short
* 3a9eabf Add OPENSSL_NO_QUIC wrapper - Todd Short/Todd Short
* f550eca Add client early traffic secret storage - Todd Short/Todd Short
* 1b787ae Quick fix: s2c to c2s for early secret - Todd Short/Todd Short
* f97e6a9 Don't process an incomplete message - Todd Short/Todd Short
* 81f0ce2 Reset init state in SSL_process_quic_post_handshake() - Todd Short/Todd Short
* 5d59cf9 Fix quic_transport constructors/parsers - Todd Short/Todd Short
* 5e5f91c Fix INSTALL nit. - Todd Short/Todd Short
* bd290ab Fix duplicate word in docs - Todd Short/Todd Short
* 699590b fixup! Handle partial handshake messages - Todd Short/Todd Short
* a472a8d Handle partial handshake messages - Todd Short/Todd Short
* 363cf3d fixup! Use proper secrets for handshake - Todd Short/Todd Short
* b03fee6 Use proper secrets for handshake - Todd Short/Todd Short
* 2ab1aa0 Move QUIC transport params to encrypted extensions - Todd Short/Todd Short
* 0d16af9 Make temp secret names less confusing - Todd Short/Todd Short
* abb6f39 New method to get QUIC secret length - Todd Short/Todd Short
* 05fdae9 Add support for BoringSSL QUIC APIs - Todd Short/Todd Short

This adds a compatible API for BoringSSL's QUIC support, based
on the current |draft-ietf-quic-tls|.

Based on BoringSSL commit 3c034b2cf386b3131f75520705491871a2e0cafe
Based on BoringSSL commit c8e0f90f83b9ec38ea833deb86b5a41360b62b6a
Based on BoringSSL commit 3cbb0299a28a8bd0136257251a78b91a96c5eec8
Based on BoringSSL commit cc9d935256539af2d3b7f831abf57c0d685ffd81
Based on BoringSSL commit e6eef1ca16a022e476bbaedffef044597cfc8f4b
Based on BoringSSL commit 6f733791148cf8a076bf0e95498235aadbe5926d
Based on BoringSSL commit 384d0eaf1930af1ebc47eda751f0c78dfcba1c03
Based on BoringSSL commit a0373182eb5cc7b81d49f434596b473c7801c942
Based on BoringSSL commit b1b76aee3cb43ce11889403c5334283d951ebd37

New method to get QUIC secret length

Make temp secret names less confusing

Move QUIC transport params to encrypted extensions

Use proper secrets for handshake

fixup! Use proper secrets for handshake

Handle partial handshake messages

fixup! Handle partial handshake messages

Fix duplicate word in docs

Fix INSTALL nit.

Fix quic_transport constructors/parsers

Reset init state in SSL_process_quic_post_handshake()

Don't process an incomplete message

Quick fix: s2c to c2s for early secret

Add client early traffic secret storage

Add OPENSSL_NO_QUIC wrapper

Correctly disable middlebox compat

Move QUIC code out of tls13_change_cipher_state()

Create quic_change_cipher_state() that does the minimal required
to generate the QUIC secrets. (e.g. encryption contexts are not
initialized).

Tweeks to quic_change_cipher_state()

Add support for more secrets

Fix resumption secret

(cherry picked from commit 16fafdf4e0ec6cddd5705f407e5dca26cb30914d)

QUIC: Handle EndOfEarlyData and MaxEarlyData

QUIC: Increase HKDF_MAXBUF to 2048

Fall-through for 0RTT

Some cleanup for the main QUIC changes

Try to reduce unneeded whitespace changes and wrap new code to 80 columns.
Reword documentation to attempt to improve clarity.
Add some more sanity checks and clarifying comments to the code.
Update referenced I-D versions.

Prevent KeyUpdate for QUIC

QUIC does not use the TLS KeyUpdate message/mechanism, and indeed
it is an error to generate or receive such a message.  Add the
necessary checks (noting that the check for receipt should be
redundant since SSL_provide_quic_data() is the only way to provide
input to the TLS layer for a QUIC connection).

Test KeyUpdate rejection

For now, just test that we don't generate any, since we don't really
expose the mechanics for encrypting one and the QUIC API is not
integrated into the TLSProxy setup.

Fix out-of-bounds read when TLS msg is split up into multiple chunks

Previously, SSL_provide_quic_data tried to handle this kind of
situation, but it failed when the length of input data is less than
SSL3_HM_HEADER_LENGTH.  If that happens, the code might get wrong
message length by reading value from out-of-bounds region.

Revert "Fix out-of-bounds read when TLS msg is split up into multiple chunks"

This reverts commit 18f993cbdae498111c94a075fd9b115bd8367574.

Test HKDF with empty IKM

Add an extra EVP test that provides empty input key material.
It currently fails, since attempting to set a zero-length key
on an EVP_PKEY_CTX results in a call to OPENSSL_memdup() with
length zero, which returns NULL and is detected as failure.

Allow zero-length HKDF keys

When making a copy to keep in the EVP_PKEY_CTX, allocate a single
byte for the cached key instead of letting memdup return NULL
and cause the call to fail.  The length still gets set to zero
properly, so we don't end up inspecting the allocated byte, but
it's important to have a non-NULL pointer set.

Buffer all provided quic data

Make all data supplied via SSL_provide_quic_data() pass through an
internal buffer, so that we can handle data supplied with arbitrary
framing and only parse complete TLS records onto the list of QUIC_DATA
managed by quic_input_data_head/quic_input_data_tail.

This lets us remove the concept of "incomplete" QUIC_DATA structures,
and the 'offset' field needed to support them.

However, we've already moved the provided data onto the buffer by
the time we can check for KeyUpdate messages, so defer that check
to quic_get_message() (where it is adjacent to the preexisting
ChangeCipherSpec check).

To avoid extra memory copies, we also make the QUIC_DATA structures
just store offsets into the consolidated buffer instead of having copies
of the TLS handshake messages themselves.

enforce consistent encryption level for handshake messages

The QUIC-TLS spec requires that TLS handshake messages do not cross
encryption level boundaries, but we were not previously enforcing this.

PR-URL: #36520
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
targos pushed a commit that referenced this pull request Dec 21, 2020
PR-URL: #34033
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>

PR-URL: #36520
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
targos pushed a commit that referenced this pull request Dec 21, 2020
After an OpenSSL source update, all the config files need to be
regenerated and committed by:
  $ make -C deps/openssl/config
  $ git add deps/openssl/config/archs
  $ git add deps/openssl/openssl/include/crypto/bn_conf.h
  $ git add deps/openssl/openssl/include/crypto/dso_conf.h
  $ git add deps/openssl/openssl/include/openssl/opensslconf.h
  $ git commit

PR-URL: #36520
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
@targos targos removed the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
openssl Issues and PRs related to the OpenSSL dependency.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants