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

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

?? srtp.c

?? mediastreamer2是開源的網絡傳輸媒體流的庫
?? C
?? 第 1 頁 / 共 4 頁
字號:
  /* we assume the hdr is 32-bit aligned to start */  /*   * 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) {      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 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);    }  }    /* get tag length from stream context */  tag_len = auth_get_tag_length(stream->rtcp_auth);   /*   * set encryption start and encryption length - if we're not   * providing confidentiality, set enc_start to NULL   */  enc_start = (uint32_t *)hdr + uint32s_in_rtcp_header;    enc_octet_len = *pkt_octet_len - octets_in_rtcp_header;  /* all of the packet, except the header, gets encrypted */  /* NOTE: hdr->length is not usable - it refers to only the first	 RTCP report in the compound packet! */  /* NOTE: trailer is 32-bit aligned because RTCP 'packets' are always	 multiples of 32-bits (RFC 3550 6.1) */  trailer = (uint32_t *) ((char *)enc_start + enc_octet_len);  if (stream->rtcp_services & sec_serv_conf) {    *trailer = htonl(SRTCP_E_BIT);     /* set encrypt bit */      } else {    enc_start = NULL;    enc_octet_len = 0;	/* 0 is network-order independant */    *trailer = 0x00000000;     /* set encrypt bit */      }  /*    * set the auth_start and auth_tag pointers to the proper locations   * (note that srtpc *always* provides authentication, unlike srtp)   */  /* Note: This would need to change for optional mikey data */  auth_start = (uint32_t *)hdr;  auth_tag = (uint8_t *)hdr + *pkt_octet_len + sizeof(srtcp_trailer_t);   /*    * check sequence number for overruns, and copy it into the packet   * if its value isn't too big   */  status = rdb_increment(&stream->rtcp_rdb);  if (status)    return status;  seq_num = rdb_get_value(&stream->rtcp_rdb);  *trailer |= htonl(seq_num);  debug_print(mod_srtp, "srtcp index: %x", seq_num);  /*    * if we're using rindael counter mode, set nonce and seq    */  if (stream->rtcp_cipher->type == &aes_icm) {    v128_t iv;        iv.v32[0] = 0;    iv.v32[1] = hdr->ssrc;  /* still in network order! */    iv.v32[2] = htonl(seq_num >> 16);    iv.v32[3] = htonl(seq_num << 16);    status = aes_icm_set_iv((aes_icm_ctx_t*)stream->rtcp_cipher->state, &iv);  } else {      v128_t iv;        /* otherwise, just set the index to seq_num */      iv.v32[0] = 0;    iv.v32[1] = 0;    iv.v32[2] = 0;    iv.v32[3] = htonl(seq_num);    status = cipher_set_iv(stream->rtcp_cipher, &iv);  }  if (status)    return err_status_cipher_fail;  /*    * if we're authenticating using a universal hash, put the keystream   * prefix into the authentication tag   */    /* if auth_start is non-null, then put keystream into tag  */  if (auth_start) {    /* put keystream prefix into auth_tag */    prefix_len = auth_get_prefix_length(stream->rtcp_auth);        status = cipher_output(stream->rtcp_cipher, auth_tag, prefix_len);    debug_print(mod_srtp, "keystream prefix: %s", 		octet_string_hex_string(auth_tag, prefix_len));    if (status)      return err_status_cipher_fail;  }  /* if we're encrypting, exor keystream into the message */  if (enc_start) {    status = cipher_encrypt(stream->rtcp_cipher, 			    (uint8_t *)enc_start, &enc_octet_len);    if (status)      return err_status_cipher_fail;  }  /* initialize auth func context */  auth_start(stream->rtcp_auth);  /*    * run auth func over packet (including trailer), and write the   * result at auth_tag    */  status = auth_compute(stream->rtcp_auth, 			(uint8_t *)auth_start, 			(*pkt_octet_len) + sizeof(srtcp_trailer_t), 			auth_tag);  debug_print(mod_srtp, "srtcp auth tag:    %s", 	      octet_string_hex_string(auth_tag, tag_len));  if (status)    return err_status_auth_fail;         /* increase the packet length by the length of the auth tag and seq_num*/  *pkt_octet_len += (tag_len + sizeof(srtcp_trailer_t));      return err_status_ok;  }err_status_t srtp_unprotect_rtcp(srtp_t ctx, void *srtcp_hdr, int *pkt_octet_len) {  srtcp_hdr_t *hdr = (srtcp_hdr_t *)srtcp_hdr;  uint32_t *enc_start;      /* pointer to start of encrypted portion  */  uint32_t *auth_start;     /* pointer to start of auth. portion      */  uint32_t *trailer;        /* pointer to start of trailer            */  unsigned enc_octet_len = 0;/* number of octets in encrypted portion */  uint8_t *auth_tag = NULL; /* location of auth_tag within packet     */  uint8_t tmp_tag[SRTP_MAX_TAG_LEN];  err_status_t status;     int tag_len;  srtp_stream_ctx_t *stream;  int prefix_len;  uint32_t seq_num;  /* we assume the hdr is 32-bit aligned to start */  /*   * 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, "srtcp using provisional stream (SSRC: 0x%08x)", 		  hdr->ssrc);    } else {      /* no template stream, so we return an error */      return err_status_no_ctx;    }   }    /* get tag length from stream context */  tag_len = auth_get_tag_length(stream->rtcp_auth);   /*   * set encryption start, encryption length, and trailer   */  enc_octet_len = *pkt_octet_len -                   (octets_in_rtcp_header + tag_len + sizeof(srtcp_trailer_t));  /* index & E (encryption) bit follow normal data.  hdr->len	 is the number of words (32-bit) in the normal packet minus 1 */  /* This should point trailer to the word past the end of the	 normal data. */  /* This would need to be modified for optional mikey data */  /*   * NOTE: trailer is 32-bit aligned because RTCP 'packets' are always   *	 multiples of 32-bits (RFC 3550 6.1)   */  trailer = (uint32_t *) ((char *) hdr +		     *pkt_octet_len -(tag_len + sizeof(srtcp_trailer_t)));  if (*((unsigned char *) trailer) & SRTCP_E_BYTE_BIT) {    enc_start = (uint32_t *)hdr + uint32s_in_rtcp_header;    } else {    enc_octet_len = 0;    enc_start = NULL; /* this indicates that there's no encryption */  }  /*    * set the auth_start and auth_tag pointers to the proper locations   * (note that srtcp *always* uses authentication, unlike srtp)   */  auth_start = (uint32_t *)hdr;  auth_tag = (uint8_t *)hdr + *pkt_octet_len - tag_len;  /*    * check the sequence number for replays   */  /* this is easier than dealing with bitfield access */  seq_num = ntohl(*trailer) & SRTCP_INDEX_MASK;  debug_print(mod_srtp, "srtcp index: %x", seq_num);  status = rdb_check(&stream->rtcp_rdb, seq_num);  if (status)    return status;  /*    * if we're using aes counter mode, set nonce and seq    */  if (stream->rtcp_cipher->type == &aes_icm) {    v128_t iv;    iv.v32[0] = 0;    iv.v32[1] = hdr->ssrc; /* still in network order! */    iv.v32[2] = htonl(seq_num >> 16);    iv.v32[3] = htonl(seq_num << 16);    status = aes_icm_set_iv((aes_icm_ctx_t*)stream->rtcp_cipher->state, &iv);  } else {      v128_t iv;        /* otherwise, just set the index to seq_num */      iv.v32[0] = 0;    iv.v32[1] = 0;    iv.v32[2] = 0;    iv.v32[3] = htonl(seq_num);    status = cipher_set_iv(stream->rtcp_cipher, &iv);  }  if (status)    return err_status_cipher_fail;  /* initialize auth func context */  auth_start(stream->rtcp_auth);  /* run auth func over packet, put result into tmp_tag */  status = auth_compute(stream->rtcp_auth, (uint8_t *)auth_start,  			*pkt_octet_len - tag_len,			tmp_tag);  debug_print(mod_srtp, "srtcp computed tag:       %s", 	      octet_string_hex_string(tmp_tag, tag_len));  if (status)    return err_status_auth_fail;       /* compare the tag just computed with the one in the packet */  debug_print(mod_srtp, "srtcp tag from packet:    %s", 	      octet_string_hex_string(auth_tag, tag_len));    if (octet_string_is_eq(tmp_tag, auth_tag, tag_len))    return err_status_auth_fail;  /*    * if we're authenticating using a universal hash, put the keystream   * prefix into the authentication tag   */  prefix_len = auth_get_prefix_length(stream->rtcp_auth);      if (prefix_len) {    status = cipher_output(stream->rtcp_cipher, auth_tag, prefix_len);    debug_print(mod_srtp, "keystream prefix: %s", 		octet_string_hex_string(auth_tag, prefix_len));    if (status)      return err_status_cipher_fail;  }  /* if we're decrypting, exor keystream into the message */  if (enc_start) {    status = cipher_encrypt(stream->rtcp_cipher, 			    (uint8_t *)enc_start, &enc_octet_len);    if (status)      return err_status_cipher_fail;  }  /* decrease the packet length by the length of the auth tag and seq_num*/  *pkt_octet_len -= (tag_len + sizeof(srtcp_trailer_t));  /*    * verify that stream is for received 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.   *   * we do this check *after* the authentication check, so that the   * latter check will catch any attempts to fool us into thinking   * that we've got a collision   */  if (stream->direction != dir_srtp_receiver) {    if (stream->direction == dir_unknown) {      stream->direction = dir_srtp_receiver;    } else {      srtp_handle_event(ctx, stream, event_ssrc_collision);    }  }  /*    * if the stream is a 'provisional' one, in which the template context   * is used, then we need to allocate a new stream at this point, since   * the authentication passed   */  if (stream == ctx->stream_template) {      srtp_stream_ctx_t *new_stream;    /*      * allocate and initialize a new stream      *      * note that we indicate failure if we can't allocate the new     * stream, and some implementations will want to not return     * failure here     */    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 stream (the pointer used in this function) */    stream = new_stream;  }  /* we've passed the authentication check, so add seq_num to the rdb */  rdb_add_index(&stream->rtcp_rdb, seq_num);          return err_status_ok;  }/* * dtls keying for srtp  */err_status_tcrypto_policy_set_from_profile_for_rtp(crypto_policy_t *policy, 				       srtp_profile_t profile) {  /* set SRTP policy from the SRTP profile in the key set */  switch(profile) {  case srtp_profile_aes128_cm_sha1_80:    crypto_policy_set_aes_cm_128_hmac_sha1_80(policy);    crypto_policy_set_aes_cm_128_hmac_sha1_80(policy);    break;  case srtp_profile_aes128_cm_sha1_32:    crypto_policy_set_aes_cm_128_hmac_sha1_32(policy);    crypto_policy_set_aes_cm_128_hmac_sha1_80(policy);    break;  case srtp_profile_null_sha1_80:    crypto_policy_set_null_cipher_hmac_sha1_80(policy);    crypto_policy_set_null_cipher_hmac_sha1_80(policy);    break;    /* the following profiles are not (yet) supported */  case srtp_profile_null_sha1_32:  case srtp_profile_aes256_cm_sha1_80:  case srtp_profile_aes256_cm_sha1_32:  default:    return err_status_bad_param;  }  return err_status_ok;}err_status_tcrypto_policy_set_from_profile_for_rtcp(crypto_policy_t *policy, 					srtp_profile_t profile) {  /* set SRTP policy from the SRTP profile in the key set */  switch(profile) {  case srtp_profile_aes128_cm_sha1_80:    crypto_policy_set_aes_cm_128_hmac_sha1_80(policy);    break;  case srtp_profile_aes128_cm_sha1_32:    crypto_policy_set_aes_cm_128_hmac_sha1_80(policy);    break;  case srtp_profile_null_sha1_80:    crypto_policy_set_null_cipher_hmac_sha1_80(policy);    break;    /* the following profiles are not (yet) supported */  case srtp_profile_null_sha1_32:  case srtp_profile_aes256_cm_sha1_80:  case srtp_profile_aes256_cm_sha1_32:  default:    return err_status_bad_param;  }  return err_status_ok;}voidappend_salt_to_key(uint8_t *key, unsigned int bytes_in_key,		   uint8_t *salt, unsigned int bytes_in_salt) {  memcpy(key + bytes_in_key, salt, bytes_in_salt);}unsigned intsrtp_profile_get_master_key_length(srtp_profile_t profile) {  switch(profile) {  case srtp_profile_aes128_cm_sha1_80:    return 16;    break;  case srtp_profile_aes128_cm_sha1_32:    return 16;    break;  case srtp_profile_null_sha1_80:    return 16;    break;    /* the following profiles are not (yet) supported */  case srtp_profile_null_sha1_32:  case srtp_profile_aes256_cm_sha1_80:  case srtp_profile_aes256_cm_sha1_32:  default:    return 0;  /* indicate error by returning a zero */  }}unsigned intsrtp_profile_get_master_salt_length(srtp_profile_t profile) {  switch(profile) {  case srtp_profile_aes128_cm_sha1_80:    return 14;    break;  case srtp_profile_aes128_cm_sha1_32:    return 14;    break;  case srtp_profile_null_sha1_80:    return 14;    break;    /* the following profiles are not (yet) supported */  case srtp_profile_null_sha1_32:  case srtp_profile_aes256_cm_sha1_80:  case srtp_profile_aes256_cm_sha1_32:  default:    return 0;  /* indicate error by returning a zero */  }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品在线网站| 亚洲欧洲av另类| 99久久精品国产精品久久| 日韩精品一二三区| 一区二区三区四区高清精品免费观看| 制服丝袜日韩国产| 色婷婷综合久久久中文一区二区 | 色婷婷av一区| 国产专区欧美精品| 偷拍一区二区三区四区| 日韩毛片视频在线看| 久久综合九色综合欧美98| 在线播放一区二区三区| 91日韩在线专区| 国产精品一区二区免费不卡 | 亚洲欧洲精品一区二区三区不卡| 欧美天堂一区二区三区| 9i看片成人免费高清| 国产精品一区二区无线| 奇米在线7777在线精品 | 亚洲欧美一区二区视频| 久久伊人蜜桃av一区二区| 欧美一级理论性理论a| 精品视频123区在线观看| 91在线国产观看| 国产清纯在线一区二区www| 日韩午夜电影av| 91精品国产综合久久精品性色| 一本到三区不卡视频| jizzjizzjizz欧美| 国产黄色精品网站| 国产剧情一区在线| 国产精品77777| 国产一区二区伦理片| 久久成人免费日本黄色| 麻豆一区二区99久久久久| 免费亚洲电影在线| 欧美日韩一区二区三区四区五区| 91麻豆免费视频| 色婷婷综合久色| 欧美曰成人黄网| 91麻豆免费观看| 欧美日韩一区三区四区| 91精选在线观看| 日韩欧美一区二区在线视频| 日韩一区二区三区在线| 精品免费国产二区三区 | 亚洲主播在线播放| 婷婷久久综合九色国产成人| 欧亚洲嫩模精品一区三区| 欧美性大战xxxxx久久久| 欧美人与z0zoxxxx视频| 欧美一级夜夜爽| 亚洲精品一区二区三区福利| 国产视频一区二区三区在线观看| 国产欧美精品一区二区色综合朱莉| 国产农村妇女毛片精品久久麻豆 | 美腿丝袜亚洲一区| 欧美一区二区三区思思人| 日韩一区二区三区在线| 精品日韩一区二区三区 | 免费国产亚洲视频| 国产乱妇无码大片在线观看| 成人av影院在线| 在线影院国内精品| 91精品婷婷国产综合久久| 精品国产免费一区二区三区四区| 欧美激情资源网| 亚洲日本在线天堂| 日本不卡123| 欧美成人免费网站| 亚洲国产高清在线| 亚洲第一会所有码转帖| 久久er精品视频| 91丨porny丨户外露出| 正在播放亚洲一区| 国产欧美精品区一区二区三区| 亚洲精品视频免费观看| 久草精品在线观看| 99久久久精品免费观看国产蜜| 欧美影院一区二区| 欧美一级专区免费大片| 亚洲视频在线一区二区| 欧美日韩一区二区欧美激情| 精品av综合导航| 亚洲一区免费观看| 国产一区二区按摩在线观看| 91黄视频在线| 国产亚洲精品aa午夜观看| 亚洲一区在线观看视频| 国产精品99久久不卡二区| 欧美日韩一区二区三区不卡| 国产欧美日韩三区| 免费久久精品视频| 91年精品国产| 久久精品一区四区| 欧美羞羞免费网站| 国产欧美一二三区| 麻豆91在线看| 欧美日韩精品系列| 亚洲色图另类专区| 国产综合一区二区| 4438x亚洲最大成人网| 亚洲视频综合在线| 国产一区二区三区日韩| 欧美猛男超大videosgay| 亚洲欧美色综合| 国产aⅴ综合色| 日韩美女主播在线视频一区二区三区 | 色综合天天做天天爱| 亚洲精品在线免费观看视频| 天天综合色天天| 精品视频1区2区| 亚洲另类一区二区| 99视频有精品| 亚洲国产成人在线| 国产精品亚洲人在线观看| 欧美一区二区三区免费在线看 | 国产黄色精品网站| 久久久影院官网| 极品瑜伽女神91| 亚洲国产一区二区视频| 91亚洲永久精品| 综合av第一页| 成人丝袜18视频在线观看| 久久久久久久久久美女| 国产在线不卡视频| 精品国产乱码久久久久久闺蜜| 全部av―极品视觉盛宴亚洲| 91精品在线观看入口| 日本一区中文字幕| 3d成人动漫网站| 美女尤物国产一区| 精品国产91乱码一区二区三区| 免费人成网站在线观看欧美高清| 亚洲在线成人精品| 欧美综合天天夜夜久久| 亚洲国产精品久久久久婷婷884| 在线影视一区二区三区| 亚洲成av人片一区二区三区| 欧美精品一级二级| 蜜臀av性久久久久蜜臀av麻豆| 日韩欧美成人激情| 国产精品伊人色| 国产精品免费观看视频| 99亚偷拍自图区亚洲| 亚洲一级电影视频| 91精品国产一区二区三区蜜臀| 免费在线观看一区二区三区| 久久一区二区三区国产精品| 精品国产乱码久久久久久牛牛| 精品一区二区三区免费播放| 久久久久久久综合| 91视频你懂的| 亚洲.国产.中文慕字在线| 日韩欧美视频在线| 粉嫩久久99精品久久久久久夜| 亚洲日本va午夜在线电影| 欧美喷水一区二区| 国产专区欧美精品| 亚洲日本韩国一区| 日韩亚洲欧美成人一区| 国产高清精品久久久久| 亚洲另类中文字| 日韩亚洲欧美中文三级| 福利一区二区在线观看| 99久久婷婷国产精品综合| 香蕉成人伊视频在线观看| 精品国产一区二区亚洲人成毛片 | 成人三级伦理片| 亚洲精品少妇30p| 日韩亚洲欧美一区| 9i在线看片成人免费| 日本欧美在线观看| 亚洲欧洲另类国产综合| 日韩一区二区三区观看| 成人免费毛片嘿嘿连载视频| 亚洲一线二线三线久久久| 久久九九久精品国产免费直播| 91香蕉视频污| 欧美精品色一区二区三区| 成人性生交大片免费| 日韩精品91亚洲二区在线观看| 国产日韩综合av| 91精品国产综合久久香蕉麻豆| 成人h精品动漫一区二区三区| 性欧美大战久久久久久久久| 国产日韩欧美综合一区| 制服丝袜国产精品| 91免费版pro下载短视频| 老司机精品视频线观看86| 尤物av一区二区| 亚洲国产精品精华液ab| 日韩一卡二卡三卡四卡| 色呦呦一区二区三区| 国产99久久久久久免费看农村| 欧美视频一二三区| 成人动漫中文字幕| 开心九九激情九九欧美日韩精美视频电影| 1024精品合集|