- libosip2-3.1.0 (changes MD5 related function names)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
0.7.1
|
||||
=====
|
||||
09-Mar-2008: - libosip2-3.1.0 (changes MD5 related function names)
|
||||
04-Feb-2008: - 'Default Target' plugin: incoming calls to unknown
|
||||
are redirected to a "catch-all" target.
|
||||
02-Feb-2008: - More work on new plugin API.
|
||||
|
||||
@@ -338,5 +338,21 @@ if test $acx_check_libosip_version = fail; then
|
||||
fi
|
||||
AC_MSG_RESULT(ok)
|
||||
|
||||
|
||||
dnl
|
||||
dnl With libosip2-3.1.0, some MD5 related function names have changed.
|
||||
dnl Check for new names and if not present, create #defines that point
|
||||
dnl to the original old ones.
|
||||
dnl
|
||||
AC_CHECK_FUNCS(osip_MD5Init,
|
||||
,
|
||||
AC_MSG_RESULT(libosip2 is < 3.1.0 - creating some required defines)
|
||||
AC_DEFINE(osip_MD5Init, [MD5Init],[function osip_MD5Init])
|
||||
AC_DEFINE(osip_MD5Update, [MD5Update],[function osip_MD5Update])
|
||||
AC_DEFINE(osip_MD5Final, [MD5Final],[function osip_MD5Final])
|
||||
AC_DEFINE(osip_MD5Init, [MD5Init],[function osip_MD5Init])
|
||||
AC_DEFINE(osip_MD5_CTX, [MD5_CTX],[type osip_MD5_CTX]),
|
||||
)
|
||||
|
||||
])dnl ACX_CHECK_LIBOSIP_VERSION
|
||||
|
||||
|
||||
+15
@@ -102,6 +102,9 @@
|
||||
/* Define to 1 if you have the <netdb.h> header file. */
|
||||
#undef HAVE_NETDB_H
|
||||
|
||||
/* Define to 1 if you have the `osip_MD5Init' function. */
|
||||
#undef HAVE_OSIP_MD5INIT
|
||||
|
||||
/* Define if you have POSIX threads libraries and header files. */
|
||||
#undef HAVE_PTHREAD
|
||||
|
||||
@@ -286,6 +289,18 @@
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* function osip_MD5Final */
|
||||
#undef osip_MD5Final
|
||||
|
||||
/* function osip_MD5Init */
|
||||
#undef osip_MD5Init
|
||||
|
||||
/* function osip_MD5Update */
|
||||
#undef osip_MD5Update
|
||||
|
||||
/* type osip_MD5_CTX */
|
||||
#undef osip_MD5_CTX
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
|
||||
+42
-42
@@ -367,25 +367,25 @@ void DigestCalcHA1(
|
||||
OUT HASHHEX SessionKey
|
||||
)
|
||||
{
|
||||
MD5_CTX Md5Ctx;
|
||||
osip_MD5_CTX Md5Ctx;
|
||||
HASH HA1;
|
||||
|
||||
MD5Init(&Md5Ctx);
|
||||
if (pszUserName) MD5Update(&Md5Ctx, pszUserName, strlen(pszUserName));
|
||||
MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszRealm) MD5Update(&Md5Ctx, pszRealm, strlen(pszRealm));
|
||||
MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszPassword) MD5Update(&Md5Ctx, pszPassword, strlen(pszPassword));
|
||||
MD5Final(HA1, &Md5Ctx);
|
||||
osip_MD5Init(&Md5Ctx);
|
||||
if (pszUserName) osip_MD5Update(&Md5Ctx, pszUserName, strlen(pszUserName));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszRealm) osip_MD5Update(&Md5Ctx, pszRealm, strlen(pszRealm));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszPassword) osip_MD5Update(&Md5Ctx, pszPassword, strlen(pszPassword));
|
||||
osip_MD5Final(HA1, &Md5Ctx);
|
||||
|
||||
if ((pszAlg!=NULL) && (osip_strcasecmp(pszAlg, "md5-sess") == 0)) {
|
||||
MD5Init(&Md5Ctx);
|
||||
MD5Update(&Md5Ctx, HA1, HASHLEN);
|
||||
MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszNonce) MD5Update(&Md5Ctx, pszNonce, strlen(pszNonce));
|
||||
MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszCNonce) MD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce));
|
||||
MD5Final(HA1, &Md5Ctx);
|
||||
osip_MD5Init(&Md5Ctx);
|
||||
osip_MD5Update(&Md5Ctx, HA1, HASHLEN);
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszNonce) osip_MD5Update(&Md5Ctx, pszNonce, strlen(pszNonce));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszCNonce) osip_MD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce));
|
||||
osip_MD5Final(HA1, &Md5Ctx);
|
||||
};
|
||||
CvtHex(HA1, SessionKey);
|
||||
}
|
||||
@@ -403,57 +403,57 @@ void DigestCalcResponse(
|
||||
OUT HASHHEX Response /* request-digest or response-digest */
|
||||
)
|
||||
{
|
||||
MD5_CTX Md5Ctx;
|
||||
osip_MD5_CTX Md5Ctx;
|
||||
HASH HA2;
|
||||
HASH RespHash;
|
||||
HASHHEX HA2Hex;
|
||||
|
||||
/* calculate H(A2) */
|
||||
MD5Init(&Md5Ctx);
|
||||
if (pszMethod) MD5Update(&Md5Ctx, pszMethod, strlen(pszMethod));
|
||||
MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszDigestUri)MD5Update(&Md5Ctx, pszDigestUri, strlen(pszDigestUri));
|
||||
osip_MD5Init(&Md5Ctx);
|
||||
if (pszMethod) osip_MD5Update(&Md5Ctx, pszMethod, strlen(pszMethod));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszDigestUri) osip_MD5Update(&Md5Ctx, pszDigestUri, strlen(pszDigestUri));
|
||||
|
||||
if (pszQop!=NULL) {
|
||||
goto auth_withqop;
|
||||
};
|
||||
|
||||
/* auth_withoutqop: */
|
||||
MD5Final(HA2, &Md5Ctx);
|
||||
osip_MD5Final(HA2, &Md5Ctx);
|
||||
CvtHex(HA2, HA2Hex);
|
||||
|
||||
/* calculate response */
|
||||
MD5Init(&Md5Ctx);
|
||||
MD5Update(&Md5Ctx, HA1, HASHHEXLEN);
|
||||
MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszNonce) MD5Update(&Md5Ctx, pszNonce, strlen(pszNonce));
|
||||
MD5Update(&Md5Ctx, ":", 1);
|
||||
osip_MD5Init(&Md5Ctx);
|
||||
osip_MD5Update(&Md5Ctx, HA1, HASHHEXLEN);
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszNonce) osip_MD5Update(&Md5Ctx, pszNonce, strlen(pszNonce));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
|
||||
goto end;
|
||||
|
||||
auth_withqop:
|
||||
|
||||
MD5Update(&Md5Ctx, ":", 1);
|
||||
MD5Update(&Md5Ctx, HEntity, HASHHEXLEN);
|
||||
MD5Final(HA2, &Md5Ctx);
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
osip_MD5Update(&Md5Ctx, HEntity, HASHHEXLEN);
|
||||
osip_MD5Final(HA2, &Md5Ctx);
|
||||
CvtHex(HA2, HA2Hex);
|
||||
|
||||
/* calculate response */
|
||||
MD5Init(&Md5Ctx);
|
||||
MD5Update(&Md5Ctx, HA1, HASHHEXLEN);
|
||||
MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszNonce) MD5Update(&Md5Ctx, pszNonce, strlen(pszNonce));
|
||||
MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszNonceCount)MD5Update(&Md5Ctx, pszNonceCount, strlen(pszNonceCount));
|
||||
MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszCNonce) MD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce));
|
||||
MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszQop) MD5Update(&Md5Ctx, pszQop, strlen(pszQop));
|
||||
MD5Update(&Md5Ctx, ":", 1);
|
||||
osip_MD5Init(&Md5Ctx);
|
||||
osip_MD5Update(&Md5Ctx, HA1, HASHHEXLEN);
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszNonce) osip_MD5Update(&Md5Ctx, pszNonce, strlen(pszNonce));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszNonceCount)osip_MD5Update(&Md5Ctx, pszNonceCount, strlen(pszNonceCount));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszCNonce) osip_MD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
if (pszQop) osip_MD5Update(&Md5Ctx, pszQop, strlen(pszQop));
|
||||
osip_MD5Update(&Md5Ctx, ":", 1);
|
||||
|
||||
end:
|
||||
MD5Update(&Md5Ctx, HA2Hex, HASHHEXLEN);
|
||||
MD5Final(RespHash, &Md5Ctx);
|
||||
osip_MD5Update(&Md5Ctx, HA2Hex, HASHHEXLEN);
|
||||
osip_MD5Final(RespHash, &Md5Ctx);
|
||||
CvtHex(RespHash, Response);
|
||||
}
|
||||
|
||||
|
||||
+13
-13
@@ -773,13 +773,13 @@ int sip_calculate_branch_id (sip_ticket_t *ticket, char *id) {
|
||||
if (strncmp(param->gvalue, magic_cookie,
|
||||
strlen(magic_cookie))==0) {
|
||||
/* calculate MD5 hash */
|
||||
MD5_CTX Md5Ctx;
|
||||
osip_MD5_CTX Md5Ctx;
|
||||
HASH HA1;
|
||||
|
||||
MD5Init(&Md5Ctx);
|
||||
MD5Update(&Md5Ctx, param->gvalue,
|
||||
osip_MD5Init(&Md5Ctx);
|
||||
osip_MD5Update(&Md5Ctx, param->gvalue,
|
||||
strlen(param->gvalue));
|
||||
MD5Final(HA1, &Md5Ctx);
|
||||
osip_MD5Final(HA1, &Md5Ctx);
|
||||
CvtHex(HA1, hashstring);
|
||||
|
||||
DEBUGC(DBCLASS_BABBLE, "existing branch -> branch hash [%s]",
|
||||
@@ -799,53 +799,53 @@ int sip_calculate_branch_id (sip_ticket_t *ticket, char *id) {
|
||||
*/
|
||||
if (hashstring[0] == '\0') {
|
||||
/* calculate MD5 hash */
|
||||
MD5_CTX Md5Ctx;
|
||||
osip_MD5_CTX Md5Ctx;
|
||||
HASH HA1;
|
||||
char *tmp;
|
||||
|
||||
MD5Init(&Md5Ctx);
|
||||
osip_MD5Init(&Md5Ctx);
|
||||
|
||||
/* topmost via */
|
||||
osip_via_to_str(via, &tmp);
|
||||
if (tmp) {
|
||||
MD5Update(&Md5Ctx, tmp, strlen(tmp));
|
||||
osip_MD5Update(&Md5Ctx, tmp, strlen(tmp));
|
||||
osip_free(tmp);
|
||||
}
|
||||
|
||||
/* Tag in To header */
|
||||
osip_to_get_tag(sip_msg->to, ¶m);
|
||||
if (param && param->gvalue) {
|
||||
MD5Update(&Md5Ctx, param->gvalue, strlen(param->gvalue));
|
||||
osip_MD5Update(&Md5Ctx, param->gvalue, strlen(param->gvalue));
|
||||
}
|
||||
|
||||
/* Tag in From header */
|
||||
osip_from_get_tag(sip_msg->from, ¶m);
|
||||
if (param && param->gvalue) {
|
||||
MD5Update(&Md5Ctx, param->gvalue, strlen(param->gvalue));
|
||||
osip_MD5Update(&Md5Ctx, param->gvalue, strlen(param->gvalue));
|
||||
}
|
||||
|
||||
/* Call-ID */
|
||||
call_id = osip_message_get_call_id(sip_msg);
|
||||
osip_call_id_to_str(call_id, &tmp);
|
||||
if (tmp) {
|
||||
MD5Update(&Md5Ctx, tmp, strlen(tmp));
|
||||
osip_MD5Update(&Md5Ctx, tmp, strlen(tmp));
|
||||
osip_free(tmp);
|
||||
}
|
||||
|
||||
/* CSeq number (but not method) */
|
||||
tmp = osip_cseq_get_number(sip_msg->cseq);
|
||||
if (tmp) {
|
||||
MD5Update(&Md5Ctx, tmp, strlen(tmp));
|
||||
osip_MD5Update(&Md5Ctx, tmp, strlen(tmp));
|
||||
}
|
||||
|
||||
/* Request URI */
|
||||
osip_uri_to_str(sip_msg->req_uri, &tmp);
|
||||
if (tmp) {
|
||||
MD5Update(&Md5Ctx, tmp, strlen(tmp));
|
||||
osip_MD5Update(&Md5Ctx, tmp, strlen(tmp));
|
||||
osip_free(tmp);
|
||||
}
|
||||
|
||||
MD5Final(HA1, &Md5Ctx);
|
||||
osip_MD5Final(HA1, &Md5Ctx);
|
||||
CvtHex(HA1, hashstring);
|
||||
|
||||
DEBUGC(DBCLASS_BABBLE, "non-existing branch -> branch hash [%s]",
|
||||
|
||||
Reference in New Issue
Block a user