1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#[cfg(test)]
mod extension_use_extended_master_secret_test;
use super::*;
const EXTENSION_USE_EXTENDED_MASTER_SECRET_HEADER_SIZE: usize = 4;
/// ## Specifications
///
/// * [RFC 8422]
///
/// [RFC 8422]: https://tools.ietf.org/html/rfc8422
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ExtensionUseExtendedMasterSecret {
pub(crate) supported: bool,
}
impl ExtensionUseExtendedMasterSecret {
/// The extension type this value is carried under.
pub fn extension_value(&self) -> ExtensionValue {
ExtensionValue::UseExtendedMasterSecret
}
/// The encoded size of this message in bytes.
pub fn size(&self) -> usize {
2
}
/// Encodes this message to `writer`.
///
/// # Errors
///
/// Fails on a write error, or if a field exceeds the length its wire format allows.
pub fn marshal<W: Write>(&self, writer: &mut W) -> Result<()> {
// length
writer.write_u16::<BigEndian>(0)?;
Ok(writer.flush()?)
}
/// Decodes one of these messages from `reader`.
///
/// # Errors
///
/// Fails if `reader` is truncated or its contents are not a valid encoding.
pub fn unmarshal<R: Read>(reader: &mut R) -> Result<Self> {
let _ = reader.read_u16::<BigEndian>()?;
Ok(ExtensionUseExtendedMasterSecret { supported: true })
}
}