Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
belle-sip
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
External Wiki
External Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BC
public
belle-sip
Commits
e930ed9e
Commit
e930ed9e
authored
Dec 26, 2017
by
DanmeiChen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove variable lenth arrays
parent
142ab58b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
+12
-10
auth-helper.h
include/belle-sip/auth-helper.h
+3
-0
auth_helper.c
src/auth_helper.c
+6
-7
belle_sip_refresher_tester.c
tester/belle_sip_refresher_tester.c
+3
-3
No files found.
include/belle-sip/auth-helper.h
View file @
e930ed9e
...
@@ -22,6 +22,9 @@
...
@@ -22,6 +22,9 @@
#include "belle-sip/defs.h"
#include "belle-sip/defs.h"
#include "belle-sip/belle-sip.h"
#include "belle-sip/belle-sip.h"
#define MAX_LENGTH_BYTE 32
#define MAX_RESPONSE_SIZE 65
BELLE_SIP_BEGIN_DECLS
BELLE_SIP_BEGIN_DECLS
/**
/**
...
...
src/auth_helper.c
View file @
e930ed9e
...
@@ -22,7 +22,6 @@
...
@@ -22,7 +22,6 @@
#include <string.h>
#include <string.h>
#include "bctoolbox/crypto.h"
#include "bctoolbox/crypto.h"
#ifndef BELLE_SIP_CNONCE_LENGTH
#ifndef BELLE_SIP_CNONCE_LENGTH
#define BELLE_SIP_CNONCE_LENGTH 16
#define BELLE_SIP_CNONCE_LENGTH 16
#endif
#endif
...
@@ -100,7 +99,7 @@ int belle_sip_auth_helper_compute_ha1_for_algorithm(const char *userid, const ch
...
@@ -100,7 +99,7 @@ int belle_sip_auth_helper_compute_ha1_for_algorithm(const char *userid, const ch
return
-
1
;
return
-
1
;
}
}
size_t
length_byte
=
(
size
-
1
)
/
2
;
size_t
length_byte
=
(
size
-
1
)
/
2
;
uint8_t
out
[
32
];
uint8_t
out
[
MAX_LENGTH_BYTE
];
size_t
di
;
size_t
di
;
char
*
ask
;
char
*
ask
;
if
(
!
userid
)
{
if
(
!
userid
)
{
...
@@ -138,7 +137,7 @@ int belle_sip_auth_helper_compute_ha2_for_algorithm(const char *method, const ch
...
@@ -138,7 +137,7 @@ int belle_sip_auth_helper_compute_ha2_for_algorithm(const char *method, const ch
return
-
1
;
return
-
1
;
}
}
size_t
length_byte
=
(
size
-
1
)
/
2
;
size_t
length_byte
=
(
size
-
1
)
/
2
;
uint8_t
out
[
32
];
uint8_t
out
[
MAX_LENGTH_BYTE
];
size_t
di
;
size_t
di
;
char
*
ask
;
char
*
ask
;
ha2
[
length_byte
*
2
]
=
'\0'
;
ha2
[
length_byte
*
2
]
=
'\0'
;
...
@@ -165,7 +164,7 @@ int belle_sip_auth_helper_compute_response_for_algorithm(const char *ha1, const
...
@@ -165,7 +164,7 @@ int belle_sip_auth_helper_compute_response_for_algorithm(const char *ha1, const
return
-
1
;
return
-
1
;
}
}
size_t
length_byte
=
(
size
-
1
)
/
2
;
size_t
length_byte
=
(
size
-
1
)
/
2
;
uint8_t
out
[
32
];
uint8_t
out
[
MAX_LENGTH_BYTE
];
size_t
di
;
size_t
di
;
char
*
ask
;
char
*
ask
;
response
[
length_byte
*
2
]
=
'\0'
;
response
[
length_byte
*
2
]
=
'\0'
;
...
@@ -200,7 +199,7 @@ int belle_sip_auth_helper_compute_response_qop_auth_for_algorithm(const char* ha
...
@@ -200,7 +199,7 @@ int belle_sip_auth_helper_compute_response_qop_auth_for_algorithm(const char* ha
return
-
1
;
return
-
1
;
}
}
size_t
length_byte
=
(
size
-
1
)
/
2
;
size_t
length_byte
=
(
size
-
1
)
/
2
;
uint8_t
out
[
32
];
uint8_t
out
[
MAX_LENGTH_BYTE
];
size_t
di
;
size_t
di
;
char
*
ask
;
char
*
ask
;
char
nounce_count_as_string
[
9
];
char
nounce_count_as_string
[
9
];
...
@@ -240,8 +239,8 @@ int belle_sip_auth_helper_fill_authorization(belle_sip_header_authorization_t* a
...
@@ -240,8 +239,8 @@ int belle_sip_auth_helper_fill_authorization(belle_sip_header_authorization_t* a
}
}
int
auth_mode
=
0
;
int
auth_mode
=
0
;
char
*
uri
;
char
*
uri
;
char
ha2
[
65
];
char
ha2
[
MAX_RESPONSE_SIZE
];
char
response
[
65
];
char
response
[
MAX_RESPONSE_SIZE
];
char
cnonce
[
BELLE_SIP_CNONCE_LENGTH
+
1
];
char
cnonce
[
BELLE_SIP_CNONCE_LENGTH
+
1
];
response
[
size
-
1
]
=
ha2
[
size
-
1
]
=
'\0'
;
response
[
size
-
1
]
=
ha2
[
size
-
1
]
=
'\0'
;
...
...
tester/belle_sip_refresher_tester.c
View file @
e930ed9e
...
@@ -120,7 +120,7 @@ static void compute_response(const char* username
...
@@ -120,7 +120,7 @@ static void compute_response(const char* username
,
char
*
response
,
char
*
response
,
size_t
size
,
size_t
size
,
const
char
*
algo
)
{
,
const
char
*
algo
)
{
char
ha1
[
65
],
ha2
[
65
];
char
ha1
[
MAX_RESPONSE_SIZE
],
ha2
[
MAX_RESPONSE_SIZE
];
belle_sip_auth_helper_compute_ha1_for_algorithm
(
username
,
realm
,
passwd
,
ha1
,
size
,
algo
);
belle_sip_auth_helper_compute_ha1_for_algorithm
(
username
,
realm
,
passwd
,
ha1
,
size
,
algo
);
belle_sip_auth_helper_compute_ha2_for_algorithm
(
method
,
uri
,
ha2
,
size
,
algo
);
belle_sip_auth_helper_compute_ha2_for_algorithm
(
method
,
uri
,
ha2
,
size
,
algo
);
belle_sip_auth_helper_compute_response_for_algorithm
(
ha1
,
nonce
,
ha2
,
response
,
size
,
algo
);
belle_sip_auth_helper_compute_response_for_algorithm
(
ha1
,
nonce
,
ha2
,
response
,
size
,
algo
);
...
@@ -138,7 +138,7 @@ static void compute_response_auth_qop(const char* username
...
@@ -138,7 +138,7 @@ static void compute_response_auth_qop(const char* username
,
char
*
response
,
char
*
response
,
size_t
size
,
size_t
size
,
const
char
*
algo
)
{
,
const
char
*
algo
)
{
char
ha1
[
65
],
ha2
[
65
];
char
ha1
[
MAX_RESPONSE_SIZE
],
ha2
[
MAX_RESPONSE_SIZE
];
belle_sip_auth_helper_compute_ha1_for_algorithm
(
username
,
realm
,
passwd
,
ha1
,
size
,
algo
);
belle_sip_auth_helper_compute_ha1_for_algorithm
(
username
,
realm
,
passwd
,
ha1
,
size
,
algo
);
belle_sip_auth_helper_compute_ha2_for_algorithm
(
method
,
uri
,
ha2
,
size
,
algo
);
belle_sip_auth_helper_compute_ha2_for_algorithm
(
method
,
uri
,
ha2
,
size
,
algo
);
belle_sip_auth_helper_compute_response_qop_auth_for_algorithm
(
ha1
,
nonce
,
nonce_count
,
cnonce
,
qop
,
ha2
,
response
,
size
,
algo
);
belle_sip_auth_helper_compute_response_qop_auth_for_algorithm
(
ha1
,
nonce
,
nonce_count
,
cnonce
,
qop
,
ha2
,
response
,
size
,
algo
);
...
@@ -206,7 +206,7 @@ static void server_process_request_event(void *obj, const belle_sip_request_even
...
@@ -206,7 +206,7 @@ static void server_process_request_event(void *obj, const belle_sip_request_even
belle_sip_error
(
"Algorithm [%s] is not correct "
,
algo
);
belle_sip_error
(
"Algorithm [%s] is not correct "
,
algo
);
return
;
return
;
}
}
char
local_resp
[
65
];
char
local_resp
[
MAX_RESPONSE_SIZE
];
if
(
qop
&&
strcmp
(
qop
,
"auth"
)
==
0
)
{
if
(
qop
&&
strcmp
(
qop
,
"auth"
)
==
0
)
{
compute_response_auth_qop
(
belle_sip_header_authorization_get_username
(
authorization
)
compute_response_auth_qop
(
belle_sip_header_authorization_get_username
(
authorization
)
,
belle_sip_header_authorization_get_realm
(
authorization
)
,
belle_sip_header_authorization_get_realm
(
authorization
)
...
...
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