Home | History | Annotate | Download | only in googlepatches
      1 diff --git a/google3/third_party/libsrtp/crypto/include/integers.h b/google3/third_party/libsrtp/crypto/include/integers.h
      2 index 7010efd..3515d13 100644
      3 --- a/google3/third_party/libsrtp/crypto/include/integers.h
      4 +++ b/google3/third_party/libsrtp/crypto/include/integers.h
      5 @@ -98,7 +98,6 @@ typedef unsigned short int	uint16_t;
      6  typedef unsigned int		uint32_t;
      7  #endif
      8  
      9 -
     10  #ifdef NO_64BIT_MATH
     11  typedef double uint64_t;
     12  /* assert that sizeof(double) == 8 */
     13 diff --git a/google3/third_party/libsrtp/include/srtp.h b/google3/third_party/libsrtp/include/srtp.h
     14 index 7f17853..bbaac95 100644
     15 --- a/google3/third_party/libsrtp/include/srtp.h
     16 +++ b/google3/third_party/libsrtp/include/srtp.h
     17 @@ -50,10 +50,6 @@
     18  extern "C" {
     19  #endif
     20  
     21 -#ifdef _MSC_VER
     22 -#pragma pack(4)
     23 -#endif
     24 -
     25  #include "crypto_kernel.h" 
     26  
     27  /**
     28 @@ -930,10 +926,6 @@ srtp_install_event_handler(srtp_event_handler_func_t func);
     29  #define SRTCP_E_BYTE_BIT 0x80
     30  #define SRTCP_INDEX_MASK 0x7fffffff
     31  
     32 -#ifdef _MSC_VER
     33 -#pragma pack()
     34 -#endif
     35 -
     36  #ifdef __cplusplus
     37  }
     38  #endif
     39 diff --git a/google3/third_party/libsrtp/srtp/srtp.c b/google3/third_party/libsrtp/srtp/srtp.c
     40 index 6010dd4..3fc52ee 100644
     41 --- a/google3/third_party/libsrtp/srtp/srtp.c
     42 +++ b/google3/third_party/libsrtp/srtp/srtp.c
     43 @@ -1657,6 +1657,8 @@ srtp_unprotect_rtcp(srtp_t ctx, void *srtcp_hdr, int *pkt_octet_len) {
     44    srtp_stream_ctx_t *stream;
     45    int prefix_len;
     46    uint32_t seq_num;
     47 +  int e_bit_in_packet;     /* whether the E-bit was found in the packet */
     48 +  int sec_serv_confidentiality; /* whether confidentiality was requested */
     49  
     50    /* we assume the hdr is 32-bit aligned to start */
     51    /*
     52 @@ -1694,7 +1696,10 @@ srtp_unprotect_rtcp(srtp_t ctx, void *srtcp_hdr, int *pkt_octet_len) {
     53        return err_status_no_ctx;
     54      } 
     55    }
     56 -  
     57 +
     58 +  sec_serv_confidentiality = stream->rtcp_services == sec_serv_conf ||
     59 +      stream->rtcp_services == sec_serv_conf_and_auth;
     60 +
     61    /* get tag length from stream context */
     62    tag_len = auth_get_tag_length(stream->rtcp_auth); 
     63  
     64 @@ -1714,8 +1719,12 @@ srtp_unprotect_rtcp(srtp_t ctx, void *srtcp_hdr, int *pkt_octet_len) {
     65     */
     66    trailer = (uint32_t *) ((char *) hdr +
     67  		     *pkt_octet_len -(tag_len + sizeof(srtcp_trailer_t)));
     68 -  if (*((unsigned char *) trailer) & SRTCP_E_BYTE_BIT) {
     69 -    enc_start = (uint32_t *)hdr + uint32s_in_rtcp_header;  
     70 +  e_bit_in_packet = (*((unsigned char *) trailer) & SRTCP_E_BYTE_BIT) == SRTCP_E_BYTE_BIT;
     71 +  if (e_bit_in_packet != sec_serv_confidentiality) {
     72 +    return err_status_cant_check;
     73 +  }
     74 +  if (sec_serv_confidentiality) {
     75 +    enc_start = (uint32_t *)hdr + uint32s_in_rtcp_header;
     76    } else {
     77      enc_octet_len = 0;
     78      enc_start = NULL; /* this indicates that there's no encryption */
     79 diff --git a/google3/third_party/libsrtp/test/srtp_driver.c b/google3/third_party/libsrtp/test/srtp_driver.c
     80 index f6a84f9..3c97072 100644
     81 --- a/google3/third_party/libsrtp/test/srtp_driver.c
     82 +++ b/google3/third_party/libsrtp/test/srtp_driver.c
     83 @@ -1246,7 +1246,7 @@ srtp_create_big_policy(srtp_policy_t **list) {
     84     * loop over policy list, mallocing a new list and copying values
     85     * into it (and incrementing the SSRC value as we go along)
     86     */
     87 -  tmp = NULL;
     88 +  tmp = p = NULL;
     89    while (policy_array[i] != NULL) {
     90      p  = (srtp_policy_t*) malloc(sizeof(srtp_policy_t));
     91      if (p == NULL)
     92