-
Notifications
You must be signed in to change notification settings - Fork 85
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
basic support for SIP SHA-256 digest #180
Conversation
Thanks, can you add a test case for |
I gave it a try, but I fear I don't know enough of the Baresip internals to do a proper test. In the attachment, a draft of implementation: but it fails with:
Since Also, isn't it already covered by the Thanks. |
@@ -155,6 +193,10 @@ static bool auth_handler(const struct sip_hdr *hdr, const struct sip_msg *msg, | |||
if (err) | |||
goto out; | |||
|
|||
err = pl_strdup(&realm->algorithm, &ch.algorithm); |
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.
I have added a new test case baresip/retest@78ea4df
If algorithm is not specified, pl_strdup fails with EINVAL.
@alberanid could you take a closer look at the failed test? |
@sreimers I hope to be able to do so in the next few weeks, but I can't guarantee any timeline at the moment. |
See baresip/retest#39 - let me know is something else is needed. Thanks. |
}; | ||
|
||
void sha256(const uint8_t *d, size_t n, uint8_t *md); | ||
int sha256_printf(uint8_t *md, const char *fmt, ...); |
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.
is it possible to make the sha256 code into a separate PR ?
this way it is easier to test and to review ...
hi @alberanid it looks like your patch have some merge conflicts now. |
Unfortunately for the next few weeks I'll be really busy, but I'll try to do it as soon as possible. |
hi @alberanid we have added wrappers for sha256: so if you rebase your patch, the patch should be smaller :) |
hi @alberanid if there is no progress here, I suggest to close the PR and open a new one when you have time to work on it. I am happy to help with this |
hi @alfredh , yes, it's fine for me. I'd like to merge our implementation, but right now I can't commit to any timeline. Feel free to use the code in this PR, in any case. |
This PR introduces support for SHA-256 in SIP authentication.
What's missing:
Also notice that right now it only works if OpenSSL is available; sha1.c doesn't support sha2 algorithms
and I'm not sure which of the various implementations is better to be included in Baresip.
An example of SIP server that supports SHA-256 digests is FlexiSIP.
Any help to improve this PR is welcome.