-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement SSL_get_client_ciphers (#1159)
# Notes This commit implements `SSL_get_client_ciphers`, which returns a "stack" (really just a list) of `SSL_CIPHER` structs [presented by the client](https://github.com/openssl/openssl/blob/master/ssl/statem/statem_srvr.c#L2002) during the `|ssl|`'s most recent handshake. [Like OpenSSL](https://github.com/openssl/openssl/blob/e2972982c64f3f1ac10b3ebe1086d99ec67631bd/ssl/ssl_lib.c#L1433), we free this list when the connection is freed. OpenSSL [obtains this list](https://github.com/openssl/openssl/blob/7a5f58b2cf0d7b2fa0451603a88c3976c657dae9/ssl/ssl_lib.c#L3205-L3212) from from an `SSL_CONNECTION` object, something that we or BoringSSL appear to have removed. So, we're left with the choice of where to store client ciphers. Options include internal/opaque structs `SSL_CTX`, `SSL_HANDSHAKE`, `SSL_SESSION`, `SSL_CONFIG`, and `SSL3_STATE`. Of these, `SSL_HANDSHAKE` or `SSL_SESSION` seemed most appropriate, but `SSL_HANDSHAKE` is [reset](https://github.com/aws/aws-lc/blob/main/ssl/ssl_lib.cc#L871) immediately after the handshake phase completes and `SSL_SESSION` incurs complications around caching. `SSL_CTX` appears to hold more configuration than mutable state, so we went with storing the client ciphers on `SSL3_STATE`. One important drawback to note here is that `SSL3_STATE` has "experimental" support for ASN.1 serialization. To avoid introducing irrevocable changes to that format, we do not include the client ciphers in that serialized object. When deserialized, client ciphers will be populated as "null". We can add support for this as an optional field in the future if required. # Commit History * Implement SSL_get_client_ciphers * ExpectHandshakeSuccess includes 0RTT w/o cipher exchange * Assign to ctx directly * Set client cipher suites for tls13 * Factor out common logic and rely on ssl->ctx->peer_ciphers * Adjust test case, TLS 1.3 handshake still fails ``` [----------] Global test environment tear-down [==========] 8 tests from 1 test suite ran. (30 ms total) [ PASSED ] 6 tests. [ FAILED ] 2 tests, listed below: [ FAILED ] WithVersion/SSLVersionTest.GetPeerCertificate/TLS1_3, where GetParam() = 32-byte object <04-03 00-00 00-00 00-00 54-4C 53-31 5F-33 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00> [ FAILED ] WithVersion/SSLVersionTest.GetPeerCertificate/TLS1_3_SSL_TRANSFER, where GetParam() = 32-byte object <04-03 00-00 00-00 00-00 54-4C 53-31 5F-33 5F-53 53-4C 5F-54 52-41 4E-53 46-45 52-00 01-00 00-00> ``` * Revert "Factor out common logic and rely on ssl->ctx->peer_ciphers" This reverts commit 64de7d6. * Revert "Revert "Factor out common logic and rely on ssl->ctx->peer_ciphers"" This reverts commit 450c8d25510522d90aa5c38a7797b9670a1c67ab. * Remove outdated CBS evenness check * Move parsing up, store ciphers on handshake object * Tests passing, skip transfer tests * Only set peer_ciphers on ssl->s3 * Reset peer_ciphers on clear, address TODOs * Rename peer_ciphers to client_ciphers * Send handshake failure alert on parsing failure * Rename client_ciphers to client_cipher_suites * Move client cipher stack to SSL struct * Preserve SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST behavior, push SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST on parse error * Address @andhop docs + comments feedback * Add SSL_get_client_ciphers for QUIC
- Loading branch information
1 parent
15b2d6c
commit 05449f5
Showing
7 changed files
with
120 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters