Changeset 1265 for pjproject/trunk/pjnath/src/pjnath/stun_msg.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_msg.c
r1239 r1265 2140 2140 2141 2141 pj_uint8_t md5_key_buf[16]; 2142 pj_hmac_sha1_context ctx; 2142 2143 pj_str_t key; 2143 2144 … … 2182 2183 } 2183 2184 2184 /* Calculate HMAC-SHA1 digest */ 2185 pj_hmac_sha1((pj_uint8_t*)start, buf-start, 2186 (pj_uint8_t*)key.ptr, key.slen, 2187 amsgint->hmac); 2185 /* Calculate HMAC-SHA1 digest, add zero padding to input 2186 * if necessary to make the input 64 bytes aligned. 2187 */ 2188 pj_hmac_sha1_init(&ctx, (pj_uint8_t*)key.ptr, key.slen); 2189 pj_hmac_sha1_update(&ctx, (pj_uint8_t*)start, buf-start); 2190 if ((buf-start) & 0x3F) { 2191 pj_uint8_t zeroes[64]; 2192 pj_bzero(zeroes, sizeof(zeroes)); 2193 pj_hmac_sha1_update(&ctx, zeroes, 64-((buf-start) & 0x3F)); 2194 } 2195 pj_hmac_sha1_final(&ctx, amsgint->hmac); 2188 2196 2189 2197 /* Put this attribute in the message */
Note: See TracChangeset
for help on using the changeset viewer.