Skip to content

Commit 116ea8b

Browse files
committed
kdf: missing error implementation
Signed-off-by: Arthur Gautier <[email protected]>
1 parent e610496 commit 116ea8b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

openssl/src/kdf.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use cfg_if::cfg_if;
2+
use std::error;
23
use std::ffi::{CStr, CString, NulError};
34
use std::fmt;
45
use std::io;
@@ -41,6 +42,20 @@ impl From<ErrorStack> for KDFError {
4142
}
4243
}
4344

45+
impl fmt::Display for KDFError {
46+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
47+
use KDFError::*;
48+
match self {
49+
Utf8Error(ref e) => e.fmt(f),
50+
NulError(ref e) => e.fmt(f),
51+
NoSuchKDF => write!(f, "No such KDF"),
52+
SSL(ref e) => e.fmt(f),
53+
}
54+
}
55+
}
56+
57+
impl error::Error for KDFError {}
58+
4459
pub trait KDFParams {
4560
fn kdf_name(&self) -> String;
4661
fn to_params(&self) -> Result<Params, KDFError>;

0 commit comments

Comments
 (0)