summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-11-08 10:19:39 +0000
committerBenny Prijono <bennylp@teluu.com>2007-11-08 10:19:39 +0000
commitb78c660663ac364b2130bd136371fc53c06fdc6e (patch)
treece4984355d2ea5df1419e6b12a5530975f77138d
parent3fc0548ab251c4a4af248e7984c024a2f3235510 (diff)
Update the digest AKAv2-MD5 implementation, we can now login to OpenIMSCore
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1565 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/src/pjsip/sip_auth_aka.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/pjsip/src/pjsip/sip_auth_aka.c b/pjsip/src/pjsip/sip_auth_aka.c
index 75d649ba..5da4aa5e 100644
--- a/pjsip/src/pjsip/sip_auth_aka.c
+++ b/pjsip/src/pjsip/sip_auth_aka.c
@@ -156,24 +156,17 @@ PJ_DEF(pj_status_t) pjsip_auth_create_aka_response(
* PRF(RES||IK||CK,"http-digest-akav2-password")
*
* The pseudo-random function (PRF) is HMAC-MD5 in this case.
+ *
+ * Hmmm.. but those above doesn't seem to work, and this below does!
*/
- pj_hmac_md5_context ctx;
- pj_uint8_t hmac_digest[16];
- char hmac_digest64[24];
- int out_len;
-
- pj_hmac_md5_init(&ctx, (pj_uint8_t*)"http-digest-akav2-password", 26);
- pj_hmac_md5_update(&ctx, res, PJSIP_AKA_RESLEN);
- pj_hmac_md5_update(&ctx, ik, PJSIP_AKA_IKLEN);
- pj_hmac_md5_update(&ctx, ck, PJSIP_AKA_CKLEN);
- pj_hmac_md5_final(&ctx, hmac_digest);
-
- out_len = sizeof(hmac_digest64);
- status = pj_base64_encode(hmac_digest, 16, hmac_digest64, &out_len);
- PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
-
- aka_cred.data.ptr = hmac_digest64;
- aka_cred.data.slen = out_len;
+ aka_cred.data.slen = PJSIP_AKA_RESLEN + PJSIP_AKA_IKLEN +
+ PJSIP_AKA_CKLEN;
+ aka_cred.data.ptr = pj_pool_alloc(pool, aka_cred.data.slen);
+
+ pj_memcpy(aka_cred.data.ptr + 0, res, PJSIP_AKA_RESLEN);
+ pj_memcpy(aka_cred.data.ptr + PJSIP_AKA_RESLEN, ik, PJSIP_AKA_IKLEN);
+ pj_memcpy(aka_cred.data.ptr + PJSIP_AKA_RESLEN + PJSIP_AKA_IKLEN,
+ ck, PJSIP_AKA_CKLEN);
pjsip_auth_create_digest(&auth->response, &chal->nonce,
&auth->nc, &auth->cnonce, &auth->qop,