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
error_chain!{
errors {
Init(stage: InitStage) {
description("an error occurred during initialization")
display("initialization failed at {:?} stage", stage)
}
Prereq(prereq: Prerequisite) {
description("a required argument was not provided to the builder")
display("missing prerequisite: {:?}", prereq)
}
State(state_problem: StateProblem) {
description("invalid state error")
display("state error of type {:?}", state_problem)
}
Input
Decrypt
}
}
#[derive(Debug)]
pub enum InitStage {
ValidateKeyLengths, ValidatePskLengths, ValidateCipherTypes,
GetRngImpl, GetDhImpl, GetCipherImpl, GetHashImpl
}
#[derive(Debug)]
pub enum Prerequisite {
LocalPrivateKey, RemotePublicKey
}
#[derive(Debug)]
pub enum StateProblem {
MissingKeyMaterial, MissingPsk, NotTurnToWrite, NotTurnToRead,
HandshakeNotFinished, HandshakeAlreadyFinished, OneWay
}