Changeset 1265 for pjproject/trunk/pjnath/src/pjnath/stun_auth.c
- Timestamp:
- May 11, 2007 10:37:14 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/stun_auth.c
r1126 r1265 120 120 const pj_stun_realm_attr *arealm; 121 121 const pj_stun_realm_attr *anonce; 122 pj_hmac_sha1_context ctx; 122 123 pj_uint8_t digest[PJ_SHA1_DIGEST_SIZE]; 123 124 pj_uint8_t md5_digest[16]; … … 328 329 } 329 330 330 /* Now calculate HMAC of the message */ 331 pj_hmac_sha1(pkt, amsgi_pos, (pj_uint8_t*)key.ptr, key.slen, digest); 331 /* Now calculate HMAC of the message, adding zero padding if necessary 332 * to make the input 64 bytes aligned. 333 */ 334 pj_hmac_sha1_init(&ctx, (pj_uint8_t*)key.ptr, key.slen); 335 pj_hmac_sha1_update(&ctx, pkt, amsgi_pos); 336 if (amsgi_pos & 0x3F) { 337 pj_uint8_t zeroes[64]; 338 pj_bzero(zeroes, sizeof(zeroes)); 339 pj_hmac_sha1_update(&ctx, zeroes, 64-(amsgi_pos & 0x3F)); 340 } 341 pj_hmac_sha1_final(&ctx, digest); 332 342 333 343 /* Compare HMACs */
Note: See TracChangeset
for help on using the changeset viewer.