embedded_tls/extensions/
messages.rs

1use crate::extensions::{
2    extension_data::{
3        key_share::{KeyShareClientHello, KeyShareServerHello},
4        max_fragment_length::MaxFragmentLength,
5        pre_shared_key::{PreSharedKeyClientHello, PreSharedKeyServerHello},
6        psk_key_exchange_modes::PskKeyExchangeModes,
7        server_name::{ServerNameList, ServerNameResponse},
8        signature_algorithms::SignatureAlgorithms,
9        signature_algorithms_cert::SignatureAlgorithmsCert,
10        supported_groups::SupportedGroups,
11        supported_versions::{SupportedVersionsClientHello, SupportedVersionsServerHello},
12        unimplemented::Unimplemented,
13    },
14    extension_group_macro::extension_group,
15};
16
17// Source: https://www.rfc-editor.org/rfc/rfc8446#section-4.2 table, rows marked with CH
18extension_group! {
19    pub enum ClientHelloExtension<'a> {
20        ServerName(ServerNameList<'a, 1>),
21        SupportedVersions(SupportedVersionsClientHello<1>),
22        SignatureAlgorithms(SignatureAlgorithms<25>),
23        SupportedGroups(SupportedGroups<13>),
24        KeyShare(KeyShareClientHello<'a, 1>),
25        PreSharedKey(PreSharedKeyClientHello<'a, 4>),
26        PskKeyExchangeModes(PskKeyExchangeModes<4>),
27        SignatureAlgorithmsCert(SignatureAlgorithmsCert<25>),
28        MaxFragmentLength(MaxFragmentLength),
29        StatusRequest(Unimplemented<'a>),
30        UseSrtp(Unimplemented<'a>),
31        Heartbeat(Unimplemented<'a>),
32        ApplicationLayerProtocolNegotiation(Unimplemented<'a>),
33        SignedCertificateTimestamp(Unimplemented<'a>),
34        ClientCertificateType(Unimplemented<'a>),
35        ServerCertificateType(Unimplemented<'a>),
36        Padding(Unimplemented<'a>),
37        EarlyData(Unimplemented<'a>),
38        Cookie(Unimplemented<'a>),
39        CertificateAuthorities(Unimplemented<'a>),
40        OidFilters(Unimplemented<'a>),
41        PostHandshakeAuth(Unimplemented<'a>)
42    }
43}
44
45// Source: https://www.rfc-editor.org/rfc/rfc8446#section-4.2 table, rows marked with SH
46extension_group! {
47    pub enum ServerHelloExtension<'a> {
48        KeyShare(KeyShareServerHello<'a>),
49        PreSharedKey(PreSharedKeyServerHello),
50        Cookie(Unimplemented<'a>), // temporary so we don't trip up on HelloRetryRequests
51        SupportedVersions(SupportedVersionsServerHello)
52    }
53}
54
55// Source: https://www.rfc-editor.org/rfc/rfc8446#section-4.2 table, rows marked with EE
56extension_group! {
57    pub enum EncryptedExtensionsExtension<'a> {
58        ServerName(ServerNameResponse),
59        MaxFragmentLength(MaxFragmentLength),
60        SupportedGroups(SupportedGroups<13>),
61        UseSrtp(Unimplemented<'a>),
62        Heartbeat(Unimplemented<'a>),
63        ApplicationLayerProtocolNegotiation(Unimplemented<'a>),
64        ClientCertificateType(Unimplemented<'a>),
65        ServerCertificateType(Unimplemented<'a>),
66        EarlyData(Unimplemented<'a>)
67    }
68}
69
70// Source: https://www.rfc-editor.org/rfc/rfc8446#section-4.2 table, rows marked with CR
71extension_group! {
72    pub enum CertificateRequestExtension<'a> {
73        StatusRequest(Unimplemented<'a>),
74        SignatureAlgorithms(SignatureAlgorithms<25>),
75        SignedCertificateTimestamp(Unimplemented<'a>),
76        CertificateAuthorities(Unimplemented<'a>),
77        OidFilters(Unimplemented<'a>),
78        SignatureAlgorithmsCert(Unimplemented<'a>),
79        CompressCertificate(Unimplemented<'a>)
80    }
81}
82
83// Source: https://www.rfc-editor.org/rfc/rfc8446#section-4.2 table, rows marked with CT
84extension_group! {
85    pub enum CertificateExtension<'a> {
86        StatusRequest(Unimplemented<'a>),
87        SignedCertificateTimestamp(Unimplemented<'a>)
88    }
89}
90
91// Source: https://www.rfc-editor.org/rfc/rfc8446#section-4.2 table, rows marked with NST
92extension_group! {
93    pub enum NewSessionTicketExtension<'a> {
94        EarlyData(Unimplemented<'a>)
95    }
96}
97
98// Source: https://www.rfc-editor.org/rfc/rfc8446#section-4.2 table, rows marked with HRR
99extension_group! {
100    pub enum HelloRetryRequestExtension<'a> {
101        KeyShare(Unimplemented<'a>),
102        Cookie(Unimplemented<'a>),
103        SupportedVersions(Unimplemented<'a>)
104    }
105}