Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
belle-sip
Commits
1aacdc34
Commit
1aacdc34
authored
Jun 25, 2015
by
Simon Morlat
Browse files
fix cnonce generation to be really random and not too short.
parent
4215ac84
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/auth_helper.c
View file @
1aacdc34
...
...
@@ -201,7 +201,9 @@ int belle_sip_auth_helper_fill_authorization(belle_sip_header_authorization_t* a
if
(
auth_mode
)
{
CHECK_IS_PRESENT
(
authorization
,
authorization
,
nonce_count
)
if
(
!
belle_sip_header_authorization_get_cnonce
(
authorization
))
{
snprintf
(
cnonce
,
sizeof
(
cnonce
),
"%08x"
,(
short
)(
long
)
authorization
^
0x5555555
);
/*spseudo randomly genrated cnonce*/
int
cnonce_value
=
0
;
belle_sip_random_bytes
((
unsigned
char
*
)
&
cnonce_value
,
sizeof
(
cnonce_value
));
snprintf
(
cnonce
,
sizeof
(
cnonce
),
"%08x"
,
cnonce_value
);
belle_sip_header_authorization_set_cnonce
(
authorization
,
cnonce
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment