-
Notifications
You must be signed in to change notification settings - Fork 83
Add PSK support #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PSK support #107
Conversation
I'd really like to see this make its way in. Is there a path forward here? |
Needs review @alexanderheuts |
/// psk and psk_identity cannot be empty | ||
pub fn set_psk(&mut self, psk: &[u8], psk_identity: &str) -> Result<()> { | ||
assert!(psk_identity.len()>0); | ||
assert!(psk.len()>0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mbedtls_ssl_conf_psk
function already checks these arguments. I don't see a reason to check them here again
where | ||
F: FnMut(&mut HandshakeContext, &str) -> Result<()>, | ||
{ | ||
assert!(identity_len>0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, I don't see a reason for the assert.
|
||
/// psk cannot be empty | ||
pub fn set_psk(&mut self, psk: &[u8]) -> Result<()> { | ||
assert!(psk.len()>0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, I don't see a reason for the assert.
|
||
|
||
fn client(mut conn: TcpStream, psk: &[u8]) -> TlsResult<()> { | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: this doesn't need to be in it's own block
Close this PR since this is outdated and PSK support is already merged. |
Add PSK support to the library with one basic test.