Skip to content

[TLS 1.3] Signature_Scheme Class#2958

Closed
hrantzsch wants to merge 7 commits intorandombit:dev/tls-13from
hrantzsch:tls/signature_scheme
Closed

[TLS 1.3] Signature_Scheme Class#2958
hrantzsch wants to merge 7 commits intorandombit:dev/tls-13from
hrantzsch:tls/signature_scheme

Conversation

@hrantzsch
Copy link
Copy Markdown
Collaborator

This PR introduces a class for signature schemes, replacing the existing Signature_Scheme enum and the free-standing functions around it (signature_algorithm_of_scheme, hash_function_of_scheme, etc).

Previously, it was not clear whether these functions would throw if an invalid or unknown scheme was provided. This has been changed: the member functions never throw. Rather, Signature_Scheme::is_available should be used to check if a scheme can be used (is implemented).

We intend to extend this class with higher level predicates, such as bool is_allowed_for(TLS::Version), or similar.

Note that this affects the public API of TLS::Policy and Signature_Scheme. Users can still create schemes as, e.g., Botan::TLS::Signature_Scheme::ECDSA_SHA256, because the enum class moved into the actual class (but is no longer an enum class).

Hannes Rantzsch and others added 4 commits April 5, 2022 18:14
* replace handshake protocol internals
    Add TLS 1.3 specific Handshake_Layer, Handshake_State,
    Handshake_Transitions, Transcript_Hash to replace
    functionality of TLS 1.2 Handshake_State.
    Related refactorings and module rearrangements.

* handling of Hello Retry Request
* handling alerts
* ensure handshake messages are not interleaved
* implement Exporters (RFC8446 7.5)
* Implement middlebox compatibility mode (RFC 8446 Appendix D.4)
* handle protocol version downgrade
* Post-Handshake-Message Key_Update
* OCSP stapling
* update of traffic secrets via a user-facing API
* Record_Size_Limit extension for TLS 1.3
* BoGo Tests integration/fixes for TLS 1.3
    ... we rebased the changes in jack/runner-20210401 to the current boringssl origin master (currently on reneme/boringssl)
    ... tests that are not applicable (yet) were disabled
    * prepend dummy ccs record for any second flight
    * too large decrypted plaintext
    * client hello version when renegotiating 1.2
    * don't try 1.3 if we have a 1.2 session to resume
    * server selected version handling
    * ALPN handling in TLS 1.3
    * segfault on empty certificate
    * user_canceled should be ignored
    * handle record padding
    * detect session ID downgrade attack
    * illegal compression method shall be 'decode error'
    * add missing check for unusable cipher suites
    * less scrutiny when checking version of initial rcv'd record
    * memory reservations for large records
    * detect unexpected extensions in EE
    * allow for better validation of OCSP responses
    * check for forbidden extensions in EE msg
    * validate allowed extensions in cert msg
    * empty Encrypted Extensions are not allowed
    * more explicit validation of Hello Retry Request
    * check signature algo in certificate
    * certificate constraint checking too loose
    * validate handshake type byte
    * refuse unprotected traffic after kex
    * detect bad alerts
    * support ALPN in TLS 1.3
    * allow 1.2 warning alerts in 1.3

Co-authored-by: René Meusel <rene.meusel@nexenio.com>
Co-authored-by: René Meusel <rene.meusel@nexenio.com>
@hrantzsch hrantzsch force-pushed the tls/signature_scheme branch from 3466d99 to 6c21d36 Compare April 14, 2022 15:02
@hrantzsch hrantzsch force-pushed the tls/signature_scheme branch from 6c21d36 to a907927 Compare April 14, 2022 15:32
Note that this affects the public API of TLS::Policy and Signature_Scheme

Co-authored-by: René Meusel <rene.meusel@nexenio.com>
@hrantzsch hrantzsch force-pushed the tls/signature_scheme branch from a907927 to 28a31c8 Compare April 14, 2022 16:10
Copy link
Copy Markdown
Owner

@randombit randombit left a comment

Choose a reason for hiding this comment

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

This looks great. In the last years I've often bemoaned that C++ does not have Rust-style enums which allow you to attach functions, but this is a nice approach to getting that behavior.

A few minor comments but overall 👍

@reneme
Copy link
Copy Markdown
Collaborator

reneme commented Apr 18, 2022

Please don't merge this yet. While finishing up the client authentication code I made a few adaptions to the API of Signature_Scheme which I'd like to discuss with @hrantzsch first tomorrow.

@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Apr 19, 2022

This pull request introduces 1 alert when merging e97ee42 into 8976bf2 - view on LGTM.com

new alerts:

  • 1 for Comparison result is always the same

@reneme reneme force-pushed the dev/tls-13 branch 2 times, most recently from 9af0d3b to a576ca3 Compare April 27, 2022 05:45
@reneme
Copy link
Copy Markdown
Collaborator

reneme commented Apr 27, 2022

Closed in favour of #2968

@reneme reneme closed this Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants