Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow TLS PSK without server certificate (#2083)
While we currently support TLS [pre-shared keys (PSKs)][1] for TLS 1.2, our python integration tests have shown that we don't currently support TLS 1.2 PSKs on the server side unless a certificate has been configured. PSKs can be used for both secret establishment and authentication, so there likely exist legitimate use-cases for establishing PSK connections without certificates. CPython's integration tests [expect this][2] behavior. This gap appears to be incidental, not intentional. Unrelated [OCSP work][3] introduced a requirement that a valid certificate public key is loaded on the server before we sort out handshake parameters. If that load fails, the hanshake is aborted before PSK can be negotiated for secret establishment. To fix this, we simply check whether the server has a PSK callback enabled, and allow the certificate loading to fail if so. We also handle the potential nullity of the public key. This PR only applies to TLSv1.2 PSK. TLSv1.3 moved PSK negotiation earlier in the handshake to client/server hello's, so does utilize this code path. Currently, we only support TLSv1.3 PSK for session resumption, _not "pure" PSK used for initial shared secret establishment. I have [a branch][4] where I'm implementing this, but it's non-trivial. We won't be able to delete the TLSv1.3 PSK python test patch until we implement "pure" TLSv1.3 PSK. [1]: https://datatracker.ietf.org/doc/html/rfc4279 [2]: https://github.com/python/cpython/blob/aeb9b65aa26444529e4adc7d6e5b0d3dd9889ec2/Lib/test/test_ssl.py#L4395 [3]: https://github.com/aws/aws-lc/pull/1120/files#diff-2743f6406343b4e3d671a71af35cf44a36ad77cef1b6cfbc02f25dc732915ee9R790 [4]: https://github.com/WillChilds-Klein/aws-lc/tree/tls13-pure-psk
- Loading branch information