Changeset 1479 for pjproject/trunk/pjnath/src/pjnath/stun_auth.c
- Timestamp:
- Oct 5, 2007 3:53:56 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/stun_auth.c
r1439 r1479 343 343 pj_hmac_sha1_init(&ctx, (pj_uint8_t*)key.ptr, key.slen); 344 344 345 #if PJ_STUN_OLD_STYLE_MI_FINGERPRINT 346 /* Pre rfc3489bis-06 style of calculation */ 347 pj_hmac_sha1_update(&ctx, pkt, 20); 348 #else 345 349 /* First calculate HMAC for the header. 346 350 * The calculation is different depending on whether FINGERPRINT attribute … … 355 359 pj_hmac_sha1_update(&ctx, pkt, 20); 356 360 } 361 #endif /* PJ_STUN_OLD_STYLE_MI_FINGERPRINT */ 357 362 358 363 /* Now update with the message body */ 359 364 pj_hmac_sha1_update(&ctx, pkt+20, amsgi_pos); 365 #if PJ_STUN_OLD_STYLE_MI_FINGERPRINT 360 366 // This is no longer necessary as per rfc3489bis-08 361 //if (amsgi_pos & 0x3F) { 362 // pj_uint8_t zeroes[64]; 363 // pj_bzero(zeroes, sizeof(zeroes)); 364 // pj_hmac_sha1_update(&ctx, zeroes, 64-(amsgi_pos & 0x3F)); 365 //} 367 if ((amsgi_pos+20) & 0x3F) { 368 pj_uint8_t zeroes[64]; 369 pj_bzero(zeroes, sizeof(zeroes)); 370 pj_hmac_sha1_update(&ctx, zeroes, 64-((amsgi_pos+20) & 0x3F)); 371 } 372 #endif 366 373 pj_hmac_sha1_final(&ctx, digest); 367 374 … … 475 482 pj_hmac_sha1_init(&ctx, (pj_uint8_t*)key->ptr, key->slen); 476 483 484 #if PJ_STUN_OLD_STYLE_MI_FINGERPRINT 485 /* Pre rfc3489bis-06 style of calculation */ 486 pj_hmac_sha1_update(&ctx, pkt, 20); 487 #else 477 488 /* First calculate HMAC for the header. 478 489 * The calculation is different depending on whether FINGERPRINT attribute … … 487 498 pj_hmac_sha1_update(&ctx, pkt, 20); 488 499 } 500 #endif /* PJ_STUN_OLD_STYLE_MI_FINGERPRINT */ 489 501 490 502 /* Now update with the message body */ 491 503 pj_hmac_sha1_update(&ctx, pkt+20, amsgi_pos); 504 #if PJ_STUN_OLD_STYLE_MI_FINGERPRINT 492 505 // This is no longer necessary as per rfc3489bis-08 493 //if (amsgi_pos & 0x3F) { 494 // pj_uint8_t zeroes[64]; 495 // pj_bzero(zeroes, sizeof(zeroes)); 496 // pj_hmac_sha1_update(&ctx, zeroes, 64-(amsgi_pos & 0x3F)); 497 //} 506 if ((amsgi_pos+20) & 0x3F) { 507 pj_uint8_t zeroes[64]; 508 pj_bzero(zeroes, sizeof(zeroes)); 509 pj_hmac_sha1_update(&ctx, zeroes, 64-((amsgi_pos+20) & 0x3F)); 510 } 511 #endif 498 512 pj_hmac_sha1_final(&ctx, digest); 499 513
Note: See TracChangeset
for help on using the changeset viewer.