Skip to content

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

Closed
wants to merge 6 commits into from
Closed

Add PSK support #107

wants to merge 6 commits into from

Conversation

ndokmai
Copy link

@ndokmai ndokmai commented May 23, 2020

Add PSK support to the library with one basic test.

@lachlansneff
Copy link

I'd really like to see this make its way in. Is there a path forward here?

@jethrogb
Copy link
Member

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);
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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<()> {
{
Copy link
Contributor

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

@dongcarl dongcarl mentioned this pull request Jul 25, 2022
@Taowyoo
Copy link
Collaborator

Taowyoo commented May 10, 2023

Close this PR since this is outdated and PSK support is already merged.
Pls check comments in #205 for more info

@Taowyoo Taowyoo closed this May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants