亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? srtp.c

?? mediastreamer2是開源的網絡傳輸媒體流的庫
?? C
?? 第 1 頁 / 共 4 頁
字號:
   /* initialize key limit to maximum value */#ifdef NO_64BIT_MATH{   uint64_t temp;   temp = make64(UINT_MAX,UINT_MAX);   key_limit_set(srtp->limit, temp);}#else   key_limit_set(srtp->limit, 0xffffffffffffLL);#endif   /* set the SSRC value */   srtp->ssrc = htonl(p->ssrc.value);   /* set the security service flags */   srtp->rtp_services  = p->rtp.sec_serv;   srtp->rtcp_services = p->rtcp.sec_serv;   /*    * set direction to unknown - this flag gets checked in srtp_protect(),    * srtp_unprotect(), srtp_protect_rtcp(), and srtp_unprotect_rtcp(), and     * gets set appropriately if it is set to unknown.    */   srtp->direction = dir_unknown;   /* initialize SRTCP replay database */   rdb_init(&srtp->rtcp_rdb);   /* DAM - no RTCP key limit at present */   /* initialize keys */   err = srtp_stream_init_keys(srtp, p->key);   if (err) return err;   return err_status_ok;   } /*  * srtp_event_reporter is an event handler function that merely  * reports the events that are reported by the callbacks  */ void srtp_event_reporter(srtp_event_data_t *data) {   err_report(err_level_warning, "srtp: in stream 0x%x: ", 	      data->stream->ssrc);   switch(data->event) {   case event_ssrc_collision:     err_report(err_level_warning, "\tSSRC collision\n");     break;   case event_key_soft_limit:     err_report(err_level_warning, "\tkey usage soft limit reached\n");     break;   case event_key_hard_limit:     err_report(err_level_warning, "\tkey usage hard limit reached\n");     break;   case event_packet_index_limit:     err_report(err_level_warning, "\tpacket index limit reached\n");     break;   default:     err_report(err_level_warning, "\tunknown event reported to handler\n");   } } /*  * srtp_event_handler is a global variable holding a pointer to the  * event handler function; this function is called for any unexpected  * event that needs to be handled out of the SRTP data path.  see  * srtp_event_t in srtp.h for more info  *  * it is okay to set srtp_event_handler to NULL, but we set   * it to the srtp_event_reporter.  */ static srtp_event_handler_func_t *srtp_event_handler = srtp_event_reporter; err_status_t srtp_install_event_handler(srtp_event_handler_func_t func) {   /*     * note that we accept NULL arguments intentionally - calling this    * function with a NULL arguments removes an event handler that's    * been previously installed    */   /* set global event handling function */   srtp_event_handler = func;   return err_status_ok; } err_status_t srtp_protect(srtp_ctx_t *ctx, void *rtp_hdr, int *pkt_octet_len) {   srtp_hdr_t *hdr = (srtp_hdr_t *)rtp_hdr;   uint32_t *enc_start;        /* pointer to start of encrypted portion  */   uint32_t *auth_start;       /* pointer to start of auth. portion      */   unsigned enc_octet_len = 0; /* number of octets in encrypted portion  */   xtd_seq_num_t est;          /* estimated xtd_seq_num_t of *hdr        */   int delta;                  /* delta of local pkt idx and that in hdr */   uint8_t *auth_tag = NULL;   /* location of auth_tag within packet     */   err_status_t status;      int tag_len;   srtp_stream_ctx_t *stream;   int prefix_len;   debug_print(mod_srtp, "function srtp_protect", NULL);  /* we assume the hdr is 32-bit aligned to start */   /* check the packet length - it must at least contain a full header */   if (*pkt_octet_len < octets_in_rtp_header)     return err_status_bad_param;   /*    * look up ssrc in srtp_stream list, and process the packet with    * the appropriate stream.  if we haven't seen this stream before,    * there's a template key for this srtp_session, and the cipher    * supports key-sharing, then we assume that a new stream using    * that key has just started up    */   stream = srtp_get_stream(ctx, hdr->ssrc);   if (stream == NULL) {     if (ctx->stream_template != NULL) {       srtp_stream_ctx_t *new_stream;       /* allocate and initialize a new stream */       status = srtp_stream_clone(ctx->stream_template, 				  hdr->ssrc, &new_stream);        if (status)	 return status;       /* add new stream to the head of the stream_list */       new_stream->next = ctx->stream_list;       ctx->stream_list = new_stream;       /* set direction to outbound */       new_stream->direction = dir_srtp_sender;       /* set stream (the pointer used in this function) */       stream = new_stream;     } else {       /* no template stream, so we return an error */       return err_status_no_ctx;     }    }   /*     * verify that stream is for sending traffic - this check will    * detect SSRC collisions, since a stream that appears in both    * srtp_protect() and srtp_unprotect() will fail this test in one of    * those functions.    */   if (stream->direction != dir_srtp_sender) {     if (stream->direction == dir_unknown) {       stream->direction = dir_srtp_sender;     } else {       srtp_handle_event(ctx, stream, event_ssrc_collision);     }   }  /*    * update the key usage limit, and check it to make sure that we   * didn't just hit either the soft limit or the hard limit, and call   * the event handler if we hit either.   */  switch(key_limit_update(stream->limit)) {  case key_event_normal:    break;  case key_event_soft_limit:     srtp_handle_event(ctx, stream, event_key_soft_limit);    break;   case key_event_hard_limit:    srtp_handle_event(ctx, stream, event_key_hard_limit);	return err_status_key_expired;  default:    break;  }   /* get tag length from stream */   tag_len = auth_get_tag_length(stream->rtp_auth);    /*    * find starting point for encryption and length of data to be    * encrypted - the encrypted portion starts after the rtp header    * extension, if present; otherwise, it starts after the last csrc,    * if any are present    *    * if we're not providing confidentiality, set enc_start to NULL    */   if (stream->rtp_services & sec_serv_conf) {     enc_start = (uint32_t *)hdr + uint32s_in_rtp_header + hdr->cc;       if (hdr->x == 1) {       srtp_hdr_xtnd_t *xtn_hdr = (srtp_hdr_xtnd_t *)enc_start;       enc_start += (ntohs(xtn_hdr->length) + 1);     }     enc_octet_len = (unsigned int)(*pkt_octet_len 				    - ((enc_start - (uint32_t *)hdr) << 2));   } else {     enc_start = NULL;   }   /*     * if we're providing authentication, set the auth_start and auth_tag    * pointers to the proper locations; otherwise, set auth_start to NULL    * to indicate that no authentication is needed    */   if (stream->rtp_services & sec_serv_auth) {     auth_start = (uint32_t *)hdr;     auth_tag = (uint8_t *)hdr + *pkt_octet_len;   } else {     auth_start = NULL;     auth_tag = NULL;   }   /*    * estimate the packet index using the start of the replay window       * and the sequence number from the header    */   delta = rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs(hdr->seq));   status = rdbx_check(&stream->rtp_rdbx, delta);   if (status)     return status;  /* we've been asked to reuse an index */   rdbx_add_index(&stream->rtp_rdbx, delta);#ifdef NO_64BIT_MATH   debug_print2(mod_srtp, "estimated packet index: %08x%08x", 		high32(est),low32(est));#else   debug_print(mod_srtp, "estimated packet index: %016llx", est);#endif   /*     * if we're using rindael counter mode, set nonce and seq     */   if (stream->rtp_cipher->type == &aes_icm) {     v128_t iv;     iv.v32[0] = 0;     iv.v32[1] = hdr->ssrc;#ifdef NO_64BIT_MATH     iv.v64[1] = be64_to_cpu(make64((high32(est) << 16) | (low32(est) >> 16),								 low32(est) << 16));#else     iv.v64[1] = be64_to_cpu(est << 16);#endif     status = cipher_set_iv(stream->rtp_cipher, &iv);   } else {       v128_t iv;     /* otherwise, set the index to est */  #ifdef NO_64BIT_MATH     iv.v32[0] = 0;     iv.v32[1] = 0;#else     iv.v64[0] = 0;#endif     iv.v64[1] = be64_to_cpu(est);     status = cipher_set_iv(stream->rtp_cipher, &iv);   }   if (status)     return err_status_cipher_fail;   /* shift est, put into network byte order */#ifdef NO_64BIT_MATH   est = be64_to_cpu(make64((high32(est) << 16) |						 (low32(est) >> 16),						 low32(est) << 16));#else   est = be64_to_cpu(est << 16);#endif      /*     * if we're authenticating using a universal hash, put the keystream    * prefix into the authentication tag    */   if (auth_start) {         prefix_len = auth_get_prefix_length(stream->rtp_auth);        if (prefix_len) {      status = cipher_output(stream->rtp_cipher, auth_tag, prefix_len);      if (status)	return err_status_cipher_fail;      debug_print(mod_srtp, "keystream prefix: %s", 		  octet_string_hex_string(auth_tag, prefix_len));    }  }  /* if we're encrypting, exor keystream into the message */  if (enc_start) {    status = cipher_encrypt(stream->rtp_cipher, 			    (uint8_t *)enc_start, &enc_octet_len);    if (status)      return err_status_cipher_fail;  }  /*   *  if we're authenticating, run authentication function and put result   *  into the auth_tag    */  if (auth_start) {            /* initialize auth func context */    status = auth_start(stream->rtp_auth);    if (status) return status;    /* run auth func over packet */    status = auth_update(stream->rtp_auth, 			 (uint8_t *)auth_start, *pkt_octet_len);    if (status) return status;        /* run auth func over ROC, put result into auth_tag */    debug_print(mod_srtp, "estimated packet index: %016llx", est);    status = auth_compute(stream->rtp_auth, (uint8_t *)&est, 4, auth_tag);     debug_print(mod_srtp, "srtp auth tag:    %s", 		octet_string_hex_string(auth_tag, tag_len));    if (status)      return err_status_auth_fail;     }  if (auth_tag) {    /* increase the packet length by the length of the auth tag */    *pkt_octet_len += tag_len;  }  return err_status_ok;  }err_status_tsrtp_unprotect(srtp_ctx_t *ctx, void *srtp_hdr, int *pkt_octet_len) {  srtp_hdr_t *hdr = (srtp_hdr_t *)srtp_hdr;  uint32_t *enc_start;      /* pointer to start of encrypted portion  */  uint32_t *auth_start;     /* pointer to start of auth. portion      */  unsigned enc_octet_len = 0;/* number of octets in encrypted portion */  uint8_t *auth_tag = NULL; /* location of auth_tag within packet     */  xtd_seq_num_t est;        /* estimated xtd_seq_num_t of *hdr        */  int delta;                /* delta of local pkt idx and that in hdr */  v128_t iv;  err_status_t status;  srtp_stream_ctx_t *stream;  uint8_t tmp_tag[SRTP_MAX_TAG_LEN];  int tag_len, prefix_len;  debug_print(mod_srtp, "function srtp_unprotect", NULL);  /* we assume the hdr is 32-bit aligned to start */  /* check the packet length - it must at least contain a full header */  if (*pkt_octet_len < octets_in_rtp_header)    return err_status_bad_param;  /*   * look up ssrc in srtp_stream list, and process the packet with    * the appropriate stream.  if we haven't seen this stream before,   * there's only one key for this srtp_session, and the cipher   * supports key-sharing, then we assume that a new stream using   * that key has just started up   */  stream = srtp_get_stream(ctx, hdr->ssrc);  if (stream == NULL) {    if (ctx->stream_template != NULL) {      stream = ctx->stream_template;      debug_print(mod_srtp, "using provisional stream (SSRC: 0x%08x)",		  hdr->ssrc);            /*        * set estimated packet index to sequence number from header,       * and set delta equal to the same value       */#ifdef NO_64BIT_MATH      est = (xtd_seq_num_t) make64(0,ntohs(hdr->seq));      delta = low32(est);#else      est = (xtd_seq_num_t) ntohs(hdr->seq);      delta = (int)est;#endif    } else {            /*       * no stream corresponding to SSRC found, and we don't do       * key-sharing, so return an error       */      return err_status_no_ctx;    }  } else {      /* estimate packet index from seq. num. in header */    delta = rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs(hdr->seq));        /* check replay database */    status = rdbx_check(&stream->rtp_rdbx, delta);    if (status)      return status;  }#ifdef NO_64BIT_MATH  debug_print2(mod_srtp, "estimated u_packet index: %08x%08x", high32(est),low32(est));#else  debug_print(mod_srtp, "estimated u_packet index: %016llx", est);#endif  /* get tag length from stream */  tag_len = auth_get_tag_length(stream->rtp_auth);   /*    * set the cipher's IV properly, depending on whatever cipher we   * happen to be using   */  if (stream->rtp_cipher->type == &aes_icm) {    /* aes counter mode */    iv.v32[0] = 0;    iv.v32[1] = hdr->ssrc;  /* still in network order */#ifdef NO_64BIT_MATH    iv.v64[1] = be64_to_cpu(make64((high32(est) << 16) | (low32(est) >> 16),			         low32(est) << 16));#else    iv.v64[1] = be64_to_cpu(est << 16);#endif    status = aes_icm_set_iv((aes_icm_ctx_t*)stream->rtp_cipher->state, &iv);  } else {          /* no particular format - set the iv to the pakcet index */  #ifdef NO_64BIT_MATH    iv.v32[0] = 0;    iv.v32[1] = 0;#else    iv.v64[0] = 0;#endif    iv.v64[1] = be64_to_cpu(est);    status = cipher_set_iv(stream->rtp_cipher, &iv);  }  if (status)    return err_status_cipher_fail;  /* shift est, put into network byte order */#ifdef NO_64BIT_MATH  est = be64_to_cpu(make64((high32(est) << 16) |					    (low32(est) >> 16),					    low32(est) << 16));#else  est = be64_to_cpu(est << 16);#endif  /*   * find starting point for decryption and length of data to be   * decrypted - the encrypted portion starts after the rtp header   * extension, if present; otherwise, it starts after the last csrc,   * if any are present   *   * if we're not providing confidentiality, set enc_start to NULL   */  if (stream->rtp_services & sec_serv_conf) {    enc_start = (uint32_t *)hdr + uint32s_in_rtp_header + hdr->cc;      if (hdr->x == 1) {      srtp_hdr_xtnd_t *xtn_hdr = (srtp_hdr_xtnd_t *)enc_start;      enc_start += (ntohs(xtn_hdr->length) + 1);    }      enc_octet_len = (uint32_t)(*pkt_octet_len - tag_len 			       - ((enc_start - (uint32_t *)hdr) << 2));  } else {    enc_start = NULL;  }  /*    * if we're providing authentication, set the auth_start and auth_tag   * pointers to the proper locations; otherwise, set auth_start to NULL   * to indicate that no authentication is needed   */  if (stream->rtp_services & sec_serv_auth) {    auth_start = (uint32_t *)hdr;    auth_tag = (uint8_t *)hdr + *pkt_octet_len - tag_len;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区成人久久免费影院| 欧美高清视频不卡网| 国产欧美精品一区二区三区四区 | 一区二区三国产精华液| 久久电影网站中文字幕| 色久综合一二码| 中文av一区二区| 久久国产综合精品| 欧美日韩精品一区二区三区四区| 国产精品无码永久免费888| 欧美aaaaaa午夜精品| 欧美视频在线一区二区三区 | 成人晚上爱看视频| 亚洲精品一区二区三区99| 亚洲综合色在线| 99久久精品免费观看| 亚洲国产精品ⅴa在线观看| 久久成人免费日本黄色| 欧美一区三区四区| 亚洲高清中文字幕| 欧洲日韩一区二区三区| 亚洲欧洲韩国日本视频| 成人午夜电影网站| 国产三级精品在线| 国产精品亚洲人在线观看| 精品美女在线播放| 久久国产精品无码网站| 日韩欧美高清dvd碟片| 青青草97国产精品免费观看无弹窗版| 日本韩国欧美一区二区三区| 亚洲精品视频观看| 在线观看国产日韩| 亚洲国产精品麻豆| 69堂精品视频| 国产原创一区二区| 久久久久久免费毛片精品| 国产一区二区三区电影在线观看| 色婷婷av一区二区三区之一色屋| 欧美中文字幕不卡| 亚洲第一会所有码转帖| 在线综合+亚洲+欧美中文字幕| 亚洲成人免费在线观看| 欧美二区在线观看| 精品一区二区三区日韩| 国产区在线观看成人精品| av电影一区二区| 亚洲伦在线观看| 欧美日韩激情在线| 激情综合网最新| 欧美高清一级片在线观看| 成人网在线播放| 一区二区三区毛片| 日韩一区二区在线免费观看| 国产一区欧美二区| 亚洲图片另类小说| 欧美一二三在线| 不卡av在线免费观看| 亚洲一区二区综合| 亚洲精品一区二区三区香蕉| 成人免费观看av| 亚洲6080在线| 26uuu精品一区二区三区四区在线| 成人av在线播放网址| 亚洲小说欧美激情另类| 精品国产一区二区亚洲人成毛片| 成人性生交大片| 天天影视色香欲综合网老头| 国产婷婷色一区二区三区| 色哟哟日韩精品| 狠狠色丁香久久婷婷综合_中| 一区视频在线播放| 欧美一二三四在线| 日本韩国精品一区二区在线观看| 蜜臀av性久久久久蜜臀aⅴ| 亚洲日本va在线观看| 精品国产一区二区精华| 色婷婷精品大在线视频| 国模无码大尺度一区二区三区| 亚洲黄色录像片| 久久精品一区二区| 日韩一区二区麻豆国产| 色综合色综合色综合 | 激情图区综合网| 一区二区三区中文在线观看| 精品处破学生在线二十三| 91成人看片片| 国产成人免费在线| 人禽交欧美网站| 一区二区三区日韩精品视频| 久久久www成人免费无遮挡大片| 欧美午夜电影一区| av在线播放不卡| 国产福利精品导航| 久久国产尿小便嘘嘘尿| 视频在线观看一区二区三区| 一区二区三区日韩精品视频| 国产精品免费av| 国产三级欧美三级日产三级99| 欧美一区二区三区四区五区 | 欧美乱妇23p| 色狠狠色狠狠综合| 91视频在线观看| 成人免费高清视频在线观看| 国产麻豆日韩欧美久久| 久久99精品视频| 丝袜美腿成人在线| 亚洲成a人在线观看| 亚洲免费资源在线播放| 亚洲天天做日日做天天谢日日欢 | 91精品国产综合久久久久| 色综合天天综合网国产成人综合天| 国产一区二区久久| 国产高清久久久| 国产一区二区免费在线| 国产精品一区二区在线播放| 激情五月播播久久久精品| 狠狠狠色丁香婷婷综合久久五月| 日本欧美加勒比视频| 免费一级片91| 国产麻豆一精品一av一免费| 国产真实乱偷精品视频免| 国产精品一线二线三线| 高清不卡一区二区在线| 不卡一二三区首页| 色av成人天堂桃色av| 欧美午夜片在线看| 欧美另类久久久品| 欧美成人女星排行榜| 久久青草国产手机看片福利盒子| 久久精品亚洲精品国产欧美kt∨| 国产亚洲人成网站| 亚洲人妖av一区二区| 亚洲黄色免费电影| 欧美aⅴ一区二区三区视频| 久久99国产精品免费网站| 成人在线视频首页| 色嗨嗨av一区二区三区| 日韩视频在线观看一区二区| 久久精品一区二区三区不卡 | 中文字幕欧美区| 亚洲精选在线视频| 日本成人在线一区| 国产一区二区中文字幕| 91麻豆产精品久久久久久| 欧美日韩国产a| 久久久久国产精品麻豆| 亚洲欧美激情插| 蜜臀久久99精品久久久久久9| 国产老妇另类xxxxx| 欧洲国内综合视频| 精品国产乱码久久久久久1区2区| 亚洲视频香蕉人妖| 美女视频黄a大片欧美| 成人激情开心网| 欧美一区二区三区不卡| 国产精品久久网站| 久久精品久久综合| 91成人国产精品| 国产亚洲精品7777| 日韩av不卡在线观看| 91小视频免费观看| 精品国产凹凸成av人导航| 一区二区三区四区中文字幕| 国产黑丝在线一区二区三区| 欧美日韩高清一区二区不卡| 国产精品天美传媒| 精久久久久久久久久久| 欧美日韩在线免费视频| 国产精品国产三级国产aⅴ入口| 日本中文字幕不卡| 在线观看免费成人| 亚洲欧洲日韩一区二区三区| 久久精品国产久精国产| 欧美日韩电影在线| 亚洲精品视频在线看| jlzzjlzz欧美大全| 久久综合丝袜日本网| 久久国产剧场电影| 日韩一区二区免费在线电影| 亚洲国产美国国产综合一区二区| 99在线精品一区二区三区| 国产欧美日韩三级| 久久国产福利国产秒拍| 欧美另类videos死尸| 亚洲裸体在线观看| 97精品电影院| 亚洲图片欧美激情| 99这里只有精品| 亚洲图片激情小说| 91在线高清观看| 中文字幕中文字幕一区二区| 福利一区二区在线观看| 久久免费电影网| 顶级嫩模精品视频在线看| 国产视频一区在线播放| 国产曰批免费观看久久久| 欧美videossexotv100| 国产在线精品视频| 国产网红主播福利一区二区| 国产精品一二二区|