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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#![warn(rust_2018_idioms)]
#![allow(dead_code)]
use async_trait::async_trait;
use thiserror::Error;
use std::io;
#[cfg(feature = "vnet")]
#[macro_use]
extern crate lazy_static;
#[cfg(target_family = "windows")]
#[macro_use]
extern crate bitflags;
pub mod fixed_big_int;
pub mod replay_detector;
#[async_trait]
pub trait KeyingMaterialExporter {
async fn export_keying_material(
&self,
label: &str,
context: &[u8],
length: usize,
) -> std::result::Result<Vec<u8>, KeyingMaterialExporterError>;
}
#[derive(Debug, Error, PartialEq)]
#[non_exhaustive]
pub enum KeyingMaterialExporterError {
#[error("tls handshake is in progress")]
HandshakeInProgress,
#[error("context is not supported for export_keying_material")]
ContextUnsupported,
#[error("export_keying_material can not be used with a reserved label")]
ReservedExportKeyingMaterial,
#[error("no cipher suite for export_keying_material")]
CipherSuiteUnset,
#[error("export_keying_material io: {0}")]
Io(#[source] error::IoError),
#[error("export_keying_material hash: {0}")]
Hash(String),
}
impl From<io::Error> for KeyingMaterialExporterError {
fn from(e: io::Error) -> Self {
KeyingMaterialExporterError::Io(error::IoError(e))
}
}
#[cfg(feature = "buffer")]
pub mod buffer;
#[cfg(feature = "conn")]
pub mod conn;
#[cfg(feature = "ifaces")]
pub mod ifaces;
#[cfg(feature = "vnet")]
pub mod vnet;
#[cfg(feature = "marshal")]
pub mod marshal;
#[cfg(feature = "buffer")]
pub use crate::buffer::Buffer;
#[cfg(feature = "conn")]
pub use crate::conn::Conn;
#[cfg(feature = "marshal")]
pub use crate::marshal::{exact_size_buf::ExactSizeBuf, Marshal, MarshalSize, Unmarshal};
mod error;
pub use error::{Error, Result};
#[cfg(feature = "sync")]
pub mod sync;