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

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

?? ssl.c

?? 一個開源的VPN原碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
	  /* Recieve Key */	  buf = &ks->plaintext_read_buf;	  if (buf->len	      && ((ks->state == S_SENT_KEY && !session->opt->server)		  || (ks->state == S_START && session->opt->server)))	    {	      int status;	      struct key key;	      status = read_key (&key, &session->opt->key_type, buf);	      if (status == -1)		{		  msg (D_TLS_ERRORS,		       "TLS Error: Error reading data channel key from plaintext buffer");		  goto error;		}	      if (!check_key (&key, &session->opt->key_type))		{		  msg (D_TLS_ERRORS, "TLS Error: Bad decrypting key received from peer");		  goto error;		}	      ASSERT (buf->len > 0);	      if (!session->opt->disable_occ && strncmp (BPTR (buf), session->opt->options, buf->len))		{		  msg (D_TLS_ERRORS,		       "TLS Error: Local ('%s') and Remote ('%s') options are incompatible",		       session->opt->options, BPTR (buf));		  status = 0;		}	      buf_clear (buf);	      if (status == 1)		{		  init_key_ctx (&ks->key.decrypt, &key, &session->opt->key_type,				DO_DECRYPT, "Data Channel Decrypt");		}	      CLEAR (key);	      if (status == 0)		goto error;	      state_change = true;	      msg (D_TLS_DEBUG, "Rec Key");	      ks->state = S_GOT_KEY;	    }	  /* Write outgoing plaintext to TLS object */	  buf = &ks->plaintext_write_buf;	  if (buf->len)	    {	      int status = key_state_write_plaintext (ks, buf);	      if (status == -1)		{		  msg (D_TLS_ERRORS,		       "TLS ERROR: Outgoing Plaintext -> TLS object write error");		  goto error;		}	      if (status == 1)		{		  state_change = true;		  msg (D_TLS_DEBUG, "Outgoing Plaintext -> TLS");		}	    }	  /* Outgoing Ciphertext to reliable buffer */	  if (ks->state >= S_START)	    {	      buf = reliable_get_buf (&ks->send_reliable);	      if (buf)		{		  int status = key_state_read_ciphertext (ks, buf, MTU_SIZE (&multi->opt.frame));		  if (status == -1)		    {		      msg (D_TLS_ERRORS,			   "TLS Error: Ciphertext -> reliable UDP transport read error");		      goto error;		    }		  if (status == 1)		    {		      reliable_mark_active_outgoing (&ks->send_reliable, buf, P_CONTROL_V1);		      state_change = true;		      msg (D_TLS_DEBUG, "Outgoing Ciphertext -> Reliable");		    }		}	    }	}      else /* state is ACTIVE */	{	  /* Send 1 or more ACKs (each received control packet gets one ACK) */	  if (!to_udp->len && !reliable_ack_empty (&ks->rec_ack))	    {	      buf = &ks->ack_write_buf;	      ASSERT (buf_init (buf, EXTRA_FRAME (&multi->opt.frame)));	      write_control_auth (session, ks, buf, to_udp_addr, P_ACK_V1,				  RELIABLE_ACK_SIZE, false, current);	      *to_udp = *buf;	      generated_output = true;	      state_change = true;	      msg (D_TLS_DEBUG, "Post-Active Dedicated ACK -> UDP");	      break;	    }	}      mutex_cycle (L_TLS);     }  while (state_change);  current = time (NULL);  /* When should we wake up again? */  {    if (ks->state >= S_INITIAL && ks->state < S_ACTIVE)      {	compute_earliest_wakeup (wakeup, reliable_send_timeout (&ks->send_reliable, current));		if (ks->must_negotiate)	  compute_earliest_wakeup (wakeup, ks->must_negotiate - current);      }    if (ks->established && session->opt->renegotiate_seconds)      compute_earliest_wakeup (wakeup, ks->established + session->opt->renegotiate_seconds - current);    if (*wakeup)      msg (D_TLS_DEBUG, "tls_process: timeout set to %d", *wakeup);    return generated_output;  }error:  ks->state = S_ERROR;  msg (D_TLS_ERRORS, "TLS Error: TLS handshake failed");  return false;}#undef ks#undef ks_lame/* * Called at the top of the event loop in openvpn.c. * * Basically decides if we should call tls_process for * the active or untrusted sessions. */booltls_multi_process (struct tls_multi *multi,		   struct buffer *to_udp,		   struct sockaddr_in *to_udp_addr,		   struct udp_socket *to_udp_socket,		   time_t * wakeup,		   time_t current){  int i;  bool generated_output = false;  mutex_lock (L_TLS);  /*   * Process each session object having state of S_INITIAL or greater,   * and which has a defined remote IP addr.   */  for (i = 0; i < TM_SIZE; ++i)    {      struct tls_session *session = &multi->session[i];      struct key_state *ks = &session->key[KS_PRIMARY];      struct key_state *ks_lame = &session->key[KS_LAME_DUCK];      /* set initial remote address */      if (i == TM_ACTIVE && ks->state == S_INITIAL && addr_defined (&to_udp_socket->addr->actual))	ks->remote_addr = to_udp_socket->addr->actual;      msg (D_TLS_DEBUG,	   "tls_multi_process: i=%d state=%s, mysid=%s, stored-sid=%s, stored-ip=%s",	   i,	   state_name (ks->state),	   session_id_print (&session->session_id),	   session_id_print (&ks->session_id_remote),	   print_sockaddr (&ks->remote_addr));      if (ks->state >= S_INITIAL && addr_defined (&ks->remote_addr))	{	  current = time (NULL);	  if (tls_process (multi, session, to_udp, to_udp_addr, to_udp_socket, wakeup, current))	    generated_output = true;	  /*	   * If tls_process hits an error:	   * (1) If the session has an unexpired lame duck key, preserve it.	   * (2) Reinitialize the session.	   */	  if (ks->state == S_ERROR)	    {	      if (i == TM_ACTIVE && ks_lame->state == S_ACTIVE)		move_session(multi, TM_LAME_DUCK, TM_ACTIVE, true);	      else		reset_session (multi, session);	    }	}      mutex_cycle (L_TLS);    }  current = time (NULL);  /*   * If lame duck session expires, kill it.   */  if (lame_duck_must_die (&multi->session[TM_LAME_DUCK], wakeup, current)) {    tls_session_free(&multi->session[TM_LAME_DUCK], true);    msg (D_TLS_DEBUG_LOW, "tls_multi_process: killed expiring key");  }  /*   * If untrusted session achieves TLS authentication,   * move it to active session, usurping any prior session.   */  if (DECRYPT_KEY_ENABLED (multi, &multi->session[TM_UNTRUSTED].key[KS_PRIMARY])) {    move_session(multi, TM_ACTIVE, TM_UNTRUSTED, true);    msg (D_TLS_DEBUG_LOW, "tls_multi_process: untrusted session promoted to trusted");  }  mutex_unlock (L_TLS);  return generated_output;}/* * When OpenVPN is built in pthread-mode, thread_func * will periodically call tls_multi_process. */#ifdef USE_PTHREAD/* * Main thread <-> TLS thread communication * errors are fatal if they are of these types. */static inline boollocal_sock_fatal (){  return errno == ENOTCONN || errno == ECONNREFUSED;}/* * This routine is the TLS work thread. */static void *thread_func (void *arg){  const int gc_level = gc_new_level ();  const struct thread_parms parm = *(struct thread_parms*) arg;  fd_set reads;  time_t current;  bool fatal;#if 0  /*   * Under Linux, Posix threads appear to inherit mlockall state   * from parent.  This is good news, since mlockall will fail   * if we restart after having downgraded privileges with   * --user or group.   */  if (parm.mlock) /* should we disable paging? */    do_mlockall (true);  #endif  /* change thread priority if requested */  set_nice (parm.nice);  /* event loop */  current = time (NULL);  while (true)    {      int stat;      time_t wakeup;      struct tt_ret ret;      struct buffer buf;      /*       * Call tls_multi_process repeatedly as long       * as it has data to forward to the UDP port.       */      do {	CLEAR (ret);	CLEAR (buf);	wakeup = TLS_MULTI_REFRESH;   /* maximum timeout */		/* do one TLS process pass */	if (tls_multi_process (parm.multi, &buf, &ret.to_udp_addr,			       parm.udp_socket, &wakeup, current))	  {	    /* make a fresh copy of buf in ret */	    ret.to_udp = clone_buf(&buf);	    /* send buffer to foreground where it will be forwarded to remote */	    stat = write (parm.sd, &ret, sizeof (ret));	    fatal = local_sock_fatal();	    check_status (stat, "write to foreground");	    if (fatal)	      goto exit;	  }      } while (ret.to_udp.len);      /* do a quick garbage collect */      gc_collect (gc_level);      /* wait on select */      {	struct timeval tv;	tv.tv_sec = wakeup;	tv.tv_usec = 0;	FD_ZERO (&reads);	FD_SET (parm.sd, &reads);	stat = select (parm.sd + 1, &reads, NULL, NULL, &tv);      }      /* update current time */      current = time (NULL);      /* received a message from foreground */      check_status (stat, "select");      /* timeout? */      if (!stat)	continue;      /* process message from foreground */      if (stat > 0 && FD_ISSET (parm.sd, &reads))	{	  struct tt_cmd tc;	  stat = read (parm.sd, &tc, sizeof (tc));	  fatal = local_sock_fatal();	  check_status (stat, "read from foreground");	  if (stat == sizeof (tc))	    {	      if (tc.cmd == TTCMD_PROCESS)		;	      else if (tc.cmd == TTCMD_EXIT)		break;	      else		msg (D_TLS_DEBUG, "TLS_THREAD: Unknown TTCMD code: %d", tc.cmd);	    }	  else if (fatal)	    break;	}    } exit:  close (parm.sd);  gc_free_level (gc_level);  return NULL;}/* * Send a command to TLS thread. */static inttls_thread_send_command (int sd, int cmd){  struct tt_cmd tc;  int stat;  bool fatal;  tc.cmd = cmd;  stat = write (sd, &tc, sizeof (tc));  fatal = local_sock_fatal();  check_status (stat, "write command to tls thread");  if (stat == sizeof (tc))    return 1;  else if (fatal)    return -1;  else    return 0;}/* * Create the TLS thread. */inttls_thread_create (struct tls_multi *multi,		   struct udp_socket *udp_socket,		   int nice, bool mlock){  struct thread_parms *tp = (struct thread_parms *) malloc (sizeof (struct thread_parms));  int sd[2];  ASSERT (tp);  tp->multi = multi;  tp->udp_socket = udp_socket;  tp->nice = nice;  tp->mlock = mlock;  /*   * Make a socket for foreground and background threads   * to communicate.  The background thread will set its   * end to blocking, while the foreground will set its   * end to non-blocking.   */  if (socketpair (PF_UNIX, SOCK_DGRAM, 0, sd) == -1)    msg (M_ERR, "socketpair call failed");  set_nonblock (sd[0]);  tp->sd = sd[1];  work_thread_create (thread_func, (void*)tp);  return sd[0];}/* * Send a command to TLS thread telling it to cycle * through tls_multi_process() as long as there * is data to process. */inttls_thread_process (int sd){  return tls_thread_send_command (sd, TTCMD_PROCESS);}/* * Close the TLS thread */voidtls_thread_close (int sd){  if (sd)    {      struct tt_ret ttr;      tls_thread_send_command (sd, TTCMD_EXIT);      work_thread_join ();      /* free any unprocessed buffers sent from background to foreground */      while (tls_thread_rec_buf (sd, &ttr, false) == 1)	{	  free_buf (&ttr.to_udp);	}      close (sd);    }}/* * Receive an object from the TLS thread which * normally contains a buffer to be sent to * the remote peer over the UDP port. * * Return: *  1 if ok *  0 if non-fatal error *  -1 if fatal error */inttls_thread_rec_buf (int sd, struct tt_ret* ttr, bool do_check_status){  int stat;  bool fatal;  stat = read (sd, ttr, sizeof (*ttr));  fatal = local_sock_fatal();  if (do_check_status)    check_status (stat, "read buffer from tls thread");  if (stat == sizeof (*ttr))    return 1;  else if (fatal)    return -1;  else    return 0;}#endif/* * Pre and post-process the encryption & decryption buffers in order * to implement a multiplexed TLS channel over the UDP port. *//* * * When we are in TLS mode, this is the first routine which sees * an incoming packet. * * If it's a data packet, we set opt so that our caller can * decrypt it.  We also give our caller the appropriate decryption key. * * If it's a control packet, we authenticate it and process it, * possibly creating a new tls_session if it represents the * first packet of a new session.  For control packets, we will * also zero the size of *buf so that our caller ignores the * packet on our return. * * Note that openvpn only allows one active session at a time, * so a new session (once authenticated) will always usurp * an old session. * * Return true if input was an authenticated control channel * packet. * * If we are running in TLS thread mode, all public routines

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产综合久久久蜜臀粉嫩 | 国产精品一区在线| 欧美性受xxxx| 1024成人网| proumb性欧美在线观看| 久久精品视频在线看| 欧美系列亚洲系列| 亚洲欧美色一区| 色综合久久久久综合99| 亚洲精品网站在线观看| 日本丰满少妇一区二区三区| 1000精品久久久久久久久| 99re6这里只有精品视频在线观看| 国产精品日韩成人| 在线免费观看不卡av| 亚洲在线免费播放| 5月丁香婷婷综合| 美国三级日本三级久久99| 久久精品一区二区三区四区| 国产91丝袜在线18| 亚洲裸体xxx| 色琪琪一区二区三区亚洲区| 日本在线不卡视频| 一区二区三区欧美在线观看| 日本一区二区免费在线| 中文在线一区二区| 国产精品久久久久久户外露出| 精品国产麻豆免费人成网站| 成人97人人超碰人人99| 美女一区二区久久| 亚洲三级视频在线观看| 日韩欧美国产一区二区三区 | 国产欧美日韩三区| 欧美久久高跟鞋激| 91免费看片在线观看| 韩国午夜理伦三级不卡影院| 色欧美片视频在线观看在线视频| 亚洲不卡一区二区三区| 夜夜亚洲天天久久| 精品国产3级a| 欧美一区二区三区视频在线观看| 成人污污视频在线观看| 韩国三级中文字幕hd久久精品| 日本欧美久久久久免费播放网| 久久精品二区亚洲w码| 国产suv精品一区二区883| 99精品热视频| 欧美视频在线一区| 精品成人一区二区三区四区| 99国产欧美久久久精品| 国产福利一区二区| 久久人人爽爽爽人久久久| 国内精品写真在线观看| 日日夜夜精品视频天天综合网| 91精品国产综合久久久久久| 国产成人精品午夜视频免费| 久久精品国产精品亚洲综合| 国产在线视视频有精品| 日韩一级片在线播放| 亚洲欧美自拍偷拍| 日本一区二区三区四区| 午夜精品久久久久久久| 亚洲电影激情视频网站| 奇米色777欧美一区二区| 久久se这里有精品| 91久久一区二区| 欧美激情自拍偷拍| 欧美aaa在线| 国产精品免费观看视频| 亚洲欧洲一区二区在线播放| 一区二区三区**美女毛片| 丝袜诱惑亚洲看片| 国产精品中文字幕一区二区三区| 成人开心网精品视频| 欧美亚洲日本国产| 日韩精品一区在线| 国产精品国产成人国产三级| 亚洲国产欧美日韩另类综合| 免费看欧美女人艹b| 成人动漫av在线| 在线综合亚洲欧美在线视频| 国产亚洲欧美色| 午夜伊人狠狠久久| 国产成人aaaa| 91精品国产免费久久综合| 中文字幕日本乱码精品影院| 天堂一区二区在线| 99视频在线观看一区三区| 91精品欧美一区二区三区综合在 | 婷婷开心激情综合| 国产成人av一区二区三区在线| 欧美亚洲免费在线一区| 国产欧美日产一区| 蜜臀av性久久久久蜜臀aⅴ| av成人老司机| 精品国产99国产精品| 樱花影视一区二区| 国产美女在线精品| 51午夜精品国产| 亚洲男同性视频| 岛国精品在线播放| 精品国产1区二区| 日韩成人免费电影| 色爱区综合激月婷婷| 亚洲国产精品尤物yw在线观看| 欧美成人猛片aaaaaaa| 国产精品卡一卡二卡三| 久久99精品久久久久久久久久久久| 成人网在线播放| 精品国产91亚洲一区二区三区婷婷| 伊人开心综合网| 97精品久久久午夜一区二区三区| 精品少妇一区二区三区| 亚洲一区二区三区四区的| 成人永久aaa| 久久免费电影网| 国产精品一级片在线观看| 欧美人妖巨大在线| 亚洲成人黄色影院| 欧美福利视频导航| 五月综合激情网| 欧美精品第一页| 奇米色777欧美一区二区| 欧洲一区二区三区在线| 亚洲一区二区三区三| 欧美一区二区三区色| 成熟亚洲日本毛茸茸凸凹| 26uuu另类欧美亚洲曰本| 一区二区三区国产| 精品亚洲成a人在线观看| 欧美一区二区三区日韩| 婷婷国产v国产偷v亚洲高清| 欧美美女bb生活片| 日本久久一区二区| 4438x成人网最大色成网站| 欧美精品 国产精品| 欧美r级在线观看| 久久综合综合久久综合| 在线播放日韩导航| 偷拍与自拍一区| 欧美高清视频www夜色资源网| 午夜影院在线观看欧美| 欧美日本精品一区二区三区| 亚洲午夜精品在线| 欧美日韩国产免费| 亚洲天堂精品在线观看| 99热在这里有精品免费| 亚洲国产美女搞黄色| 国产人伦精品一区二区| 91精品国产91久久久久久一区二区| 免费成人在线播放| 亚洲欧美另类图片小说| 国产精品国产自产拍高清av王其| 欧洲国产伦久久久久久久| 久88久久88久久久| 三级欧美韩日大片在线看| av网站免费线看精品| 91麻豆精品国产91久久久使用方法| 一级做a爱片久久| 成人精品免费网站| 亚洲精品免费在线| 欧美老肥妇做.爰bbww| 韩国女主播成人在线| 国产精品成人一区二区三区夜夜夜 | 日韩美女视频一区| 欧美综合视频在线观看| 日韩国产高清影视| 日韩亚洲欧美在线| 国产69精品久久99不卡| 亚洲国产日日夜夜| 久久嫩草精品久久久久| 色综合天天综合狠狠| 热久久国产精品| 国产精品美女久久久久久久久久久| 欧美午夜精品一区二区蜜桃| 日韩不卡在线观看日韩不卡视频| 久久亚洲一区二区三区明星换脸 | 国产一区啦啦啦在线观看| 亚洲欧洲韩国日本视频| 欧美一区二区三区免费在线看| 懂色av一区二区夜夜嗨| 亚洲午夜精品久久久久久久久| 久久综合久久综合亚洲| 欧美午夜免费电影| 国产精品一品视频| 日本中文字幕不卡| 中文字幕日韩av资源站| 欧美刺激午夜性久久久久久久| 波多野结衣在线aⅴ中文字幕不卡 波多野结衣在线一区 | 日韩精品一区二区三区蜜臀| 99久久国产综合色|国产精品| 秋霞影院一区二区| 亚洲日本青草视频在线怡红院| 日韩三级免费观看| 91久久久免费一区二区| 高潮精品一区videoshd| 日本不卡视频在线观看| 亚洲宅男天堂在线观看无病毒| 亚洲国产精品精华液ab| 538prom精品视频线放|