- Timestamp:
- Dec 20, 2011 9:56:26 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/1.x/pjsip/src/pjsip/sip_auth_aka.c
r3553 r3916 153 153 154 154 } else if (aka_version == 2) { 155 155 156 /* 156 157 * For AKAv2, password is base64 encoded [1] parameters: … … 158 159 * 159 160 * The pseudo-random function (PRF) is HMAC-MD5 in this case. 160 * 161 * Hmmm.. but those above doesn't seem to work, and this below does! 162 */ 163 aka_cred.data.slen = PJSIP_AKA_RESLEN + PJSIP_AKA_IKLEN + 164 PJSIP_AKA_CKLEN; 165 aka_cred.data.ptr = pj_pool_alloc(pool, aka_cred.data.slen); 166 167 pj_memcpy(aka_cred.data.ptr + 0, res, PJSIP_AKA_RESLEN); 168 pj_memcpy(aka_cred.data.ptr + PJSIP_AKA_RESLEN, ik, PJSIP_AKA_IKLEN); 169 pj_memcpy(aka_cred.data.ptr + PJSIP_AKA_RESLEN + PJSIP_AKA_IKLEN, 170 ck, PJSIP_AKA_CKLEN); 161 */ 162 163 pj_str_t resikck; 164 const pj_str_t AKAv2_Passwd = { "http-digest-akav2-password", 26 }; 165 pj_uint8_t hmac_digest[16]; 166 char tmp_buf[48]; 167 int hmac64_len; 168 169 resikck.slen = PJSIP_AKA_RESLEN + PJSIP_AKA_IKLEN + PJSIP_AKA_CKLEN; 170 pj_assert(resikck.slen <= PJ_ARRAY_SIZE(tmp_buf)); 171 resikck.ptr = tmp_buf; 172 pj_memcpy(resikck.ptr + 0, res, PJSIP_AKA_RESLEN); 173 pj_memcpy(resikck.ptr + PJSIP_AKA_RESLEN, ik, PJSIP_AKA_IKLEN); 174 pj_memcpy(resikck.ptr + PJSIP_AKA_RESLEN + PJSIP_AKA_IKLEN, 175 ck, PJSIP_AKA_CKLEN); 176 177 pj_hmac_md5((const pj_uint8_t*)AKAv2_Passwd.ptr, AKAv2_Passwd.slen, 178 (const pj_uint8_t*)resikck.ptr, resikck.slen, 179 hmac_digest); 180 181 aka_cred.data.slen = hmac64_len = 182 PJ_BASE256_TO_BASE64_LEN(PJ_ARRAY_SIZE(hmac_digest)); 183 pj_assert(aka_cred.data.slen+1 <= PJ_ARRAY_SIZE(tmp_buf)); 184 aka_cred.data.ptr = tmp_buf; 185 pj_base64_encode(hmac_digest, PJ_ARRAY_SIZE(hmac_digest), 186 aka_cred.data.ptr, &len); 187 aka_cred.data.slen = hmac64_len; 171 188 172 189 pjsip_auth_create_digest(&auth->response, &chal->nonce,
Note: See TracChangeset
for help on using the changeset viewer.