Changeset 0eeb4286f4b713f9c443f493185535afe34866aa

Show
Ignore:
Timestamp:
03/10/07 21:15:36 (1 year ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1173557736 +0000
git-parent:

[5c09dbbad9c76ea76d7060b0fee10b7d3c8abb3a]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1173557736 +0000
Message:

Ahem. Fix crappy previous commit.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libs/srtp/srtp.c

    r5c09dbb r0eeb428  
    601601        return EINVAL; 
    602602 
    603     uint32_t index = s->rtcp_index++; 
    604     if (index == 0x7fffffff) 
    605         s->rtcp_index = 0; /* 31-bit wrap */ 
    606  
     603    /* Updates SRTCP index (safe here) */ 
     604    uint32_t index; 
     605    memcpy (&index, buf + len, 4); 
     606    index = ntohl (index); 
     607    if (((index - s->rtcp_index) & 0x7fffffff) < 0x40000000) 
     608        s->rtcp_index = index; /* Update index */ 
     609 
     610    /* Crypts SRTCP */ 
    607611    if (s->flags & SRTCP_UNENCRYPTED) 
    608612        return 0; 
     
    638642        return ENOSPC; 
    639643 
    640     uint32_t index = s->rtcp_index; 
     644    uint32_t index = ++s->rtcp_index; 
     645    if (index >> 31) 
     646        s->rtcp_index = index = 0; /* 31-bit wrap */ 
     647 
    641648    if ((s->flags & SRTCP_UNENCRYPTED) == 0) 
    642649        index |= 0x80000000; /* Set Encrypted bit */ 
     
    647654        return val; 
    648655 
    649     len += 4; /* Digest SRTCP index too */ 
     656    len += 4; /* Digests SRTCP index too */ 
    650657 
    651658    const uint8_t *tag = rtcp_digest (s->rtp.mac, buf, len); 
    652659    memcpy (buf + len, tag, s->tag_len); 
    653660    *lenp = len + s->tag_len; 
    654     s->rtcp_index++; /* Update index */ 
    655661    return 0; 
    656662} 
     
    684690 
    685691    len -= 4; /* Remove SRTCP index before decryption */ 
    686     uint32_t index; 
    687     memcpy (&index, buf + len, 4); 
    688     index = ntohl (index); 
    689     if (((index - s->rtcp_index) & 0xffffffff) < 0x80000000) 
    690         s->rtcp_index = index; /* Update index */ 
    691  
    692692    *lenp = len; 
    693693    return srtp_crypt (s, buf, len);