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

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

?? tls_schannel.c

?? IEEE 802.11a/b/g 服務器端AP
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* * WPA Supplicant / SSL/TLS interface functions for Microsoft Schannel * Copyright (c) 2005, Jouni Malinen <j@w1.fi> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * Alternatively, this software may be distributed under the terms of BSD * license. * * See README and COPYING for more details. *//* * FIX: Go through all SSPI functions and verify what needs to be freed * FIX: session resumption * TODO: add support for server cert chain validation * TODO: add support for CA cert validation * TODO: add support for EAP-TLS (client cert/key conf) */#include "includes.h"#include <windows.h>#include <wincrypt.h>#include <schannel.h>#define SECURITY_WIN32#include <security.h>#include <sspi.h>#include "common.h"#include "tls.h"struct tls_global {	HMODULE hsecurity;	PSecurityFunctionTable sspi;	HCERTSTORE my_cert_store;};struct tls_connection {	int established, start;	int failed, read_alerts, write_alerts;	SCHANNEL_CRED schannel_cred;	CredHandle creds;	CtxtHandle context;	u8 eap_tls_prf[128];	int eap_tls_prf_set;};static int schannel_load_lib(struct tls_global *global){	INIT_SECURITY_INTERFACE pInitSecurityInterface;	global->hsecurity = LoadLibrary(TEXT("Secur32.dll"));	if (global->hsecurity == NULL) {		wpa_printf(MSG_ERROR, "%s: Could not load Secur32.dll - 0x%x",			   __func__, (unsigned int) GetLastError());		return -1;	}	pInitSecurityInterface = (INIT_SECURITY_INTERFACE) GetProcAddress(		global->hsecurity, "InitSecurityInterfaceA");	if (pInitSecurityInterface == NULL) {		wpa_printf(MSG_ERROR, "%s: Could not find "			   "InitSecurityInterfaceA from Secur32.dll",			   __func__);		FreeLibrary(global->hsecurity);		global->hsecurity = NULL;		return -1;	}	global->sspi = pInitSecurityInterface();	if (global->sspi == NULL) {		wpa_printf(MSG_ERROR, "%s: Could not read security "			   "interface - 0x%x",			   __func__, (unsigned int) GetLastError());		FreeLibrary(global->hsecurity);		global->hsecurity = NULL;		return -1;	}	return 0;}void * tls_init(const struct tls_config *conf){	struct tls_global *global;	global = os_zalloc(sizeof(*global));	if (global == NULL)		return NULL;	if (schannel_load_lib(global)) {		os_free(global);		return NULL;	}	return global;}void tls_deinit(void *ssl_ctx){	struct tls_global *global = ssl_ctx;	if (global->my_cert_store)		CertCloseStore(global->my_cert_store, 0);	FreeLibrary(global->hsecurity);	os_free(global);}int tls_get_errors(void *ssl_ctx){	return 0;}struct tls_connection * tls_connection_init(void *ssl_ctx){	struct tls_connection *conn;	conn = os_zalloc(sizeof(*conn));	if (conn == NULL)		return NULL;	conn->start = 1;	return conn;}void tls_connection_deinit(void *ssl_ctx, struct tls_connection *conn){	if (conn == NULL)		return;	os_free(conn);}int tls_connection_established(void *ssl_ctx, struct tls_connection *conn){	return conn ? conn->established : 0;}int tls_connection_shutdown(void *ssl_ctx, struct tls_connection *conn){	struct tls_global *global = ssl_ctx;	if (conn == NULL)		return -1;	conn->eap_tls_prf_set = 0;	conn->established = conn->failed = 0;	conn->read_alerts = conn->write_alerts = 0;	global->sspi->DeleteSecurityContext(&conn->context);	/* FIX: what else needs to be reseted? */	return 0;}int tls_global_set_params(void *tls_ctx,			  const struct tls_connection_params *params){	return -1;}int tls_global_set_verify(void *ssl_ctx, int check_crl){	return -1;}int tls_connection_set_verify(void *ssl_ctx, struct tls_connection *conn,			      int verify_peer){	return -1;}int tls_connection_get_keys(void *ssl_ctx, struct tls_connection *conn,			    struct tls_keys *keys){	/* Schannel does not export master secret or client/server random. */	return -1;}int tls_connection_prf(void *tls_ctx, struct tls_connection *conn,		       const char *label, int server_random_first,		       u8 *out, size_t out_len){	/*	 * Cannot get master_key from Schannel, but EapKeyBlock can be used to	 * generate session keys for EAP-TLS and EAP-PEAPv0. EAP-PEAPv2 and	 * EAP-TTLS cannot use this, though, since they are using different	 * labels. The only option could be to implement TLSv1 completely here	 * and just use Schannel or CryptoAPI for low-level crypto	 * functionality..	 */	if (conn == NULL || !conn->eap_tls_prf_set || server_random_first ||	    os_strcmp(label, "client EAP encryption") != 0 ||	    out_len > sizeof(conn->eap_tls_prf))		return -1;	os_memcpy(out, conn->eap_tls_prf, out_len);	return 0;}static u8 * tls_conn_hs_clienthello(struct tls_global *global,				    struct tls_connection *conn,				    size_t *out_len){	DWORD sspi_flags, sspi_flags_out;	SecBufferDesc outbuf;	SecBuffer outbufs[1];	SECURITY_STATUS status;	TimeStamp ts_expiry;	sspi_flags = ISC_REQ_REPLAY_DETECT |		ISC_REQ_CONFIDENTIALITY |		ISC_RET_EXTENDED_ERROR |		ISC_REQ_ALLOCATE_MEMORY |		ISC_REQ_MANUAL_CRED_VALIDATION;	wpa_printf(MSG_DEBUG, "%s: Generating ClientHello", __func__);	outbufs[0].pvBuffer = NULL;	outbufs[0].BufferType = SECBUFFER_TOKEN;	outbufs[0].cbBuffer = 0;	outbuf.cBuffers = 1;	outbuf.pBuffers = outbufs;	outbuf.ulVersion = SECBUFFER_VERSION;#ifdef UNICODE	status = global->sspi->InitializeSecurityContextW(		&conn->creds, NULL, NULL /* server name */, sspi_flags, 0,		SECURITY_NATIVE_DREP, NULL, 0, &conn->context,		&outbuf, &sspi_flags_out, &ts_expiry);#else /* UNICODE */	status = global->sspi->InitializeSecurityContextA(		&conn->creds, NULL, NULL /* server name */, sspi_flags, 0,		SECURITY_NATIVE_DREP, NULL, 0, &conn->context,		&outbuf, &sspi_flags_out, &ts_expiry);#endif /* UNICODE */	if (status != SEC_I_CONTINUE_NEEDED) {		wpa_printf(MSG_ERROR, "%s: InitializeSecurityContextA "			   "failed - 0x%x",			   __func__, (unsigned int) status);		return NULL;	}	if (outbufs[0].cbBuffer != 0 && outbufs[0].pvBuffer) {		u8 *buf;		wpa_hexdump(MSG_MSGDUMP, "SChannel - ClientHello",			    outbufs[0].pvBuffer, outbufs[0].cbBuffer);		conn->start = 0;		*out_len = outbufs[0].cbBuffer;		buf = os_malloc(*out_len);		if (buf == NULL)			return NULL;		os_memcpy(buf, outbufs[0].pvBuffer, *out_len);		global->sspi->FreeContextBuffer(outbufs[0].pvBuffer);		return buf;	}	wpa_printf(MSG_ERROR, "SChannel: Failed to generate ClientHello");	return NULL;}#ifndef SECPKG_ATTR_EAP_KEY_BLOCK#define SECPKG_ATTR_EAP_KEY_BLOCK 0x5btypedef struct _SecPkgContext_EapKeyBlock {	BYTE rgbKeys[128];	BYTE rgbIVs[64];} SecPkgContext_EapKeyBlock, *PSecPkgContext_EapKeyBlock;#endif /* !SECPKG_ATTR_EAP_KEY_BLOCK */static int tls_get_eap(struct tls_global *global, struct tls_connection *conn){	SECURITY_STATUS status;	SecPkgContext_EapKeyBlock kb;	/* Note: Windows NT and Windows Me/98/95 do not support getting	 * EapKeyBlock */	status = global->sspi->QueryContextAttributes(		&conn->context, SECPKG_ATTR_EAP_KEY_BLOCK, &kb);	if (status != SEC_E_OK) {		wpa_printf(MSG_DEBUG, "%s: QueryContextAttributes("			   "SECPKG_ATTR_EAP_KEY_BLOCK) failed (%d)",			   __func__, (int) status);		return -1;	}	wpa_hexdump_key(MSG_MSGDUMP, "Schannel - EapKeyBlock - rgbKeys",			kb.rgbKeys, sizeof(kb.rgbKeys));	wpa_hexdump_key(MSG_MSGDUMP, "Schannel - EapKeyBlock - rgbIVs",			kb.rgbIVs, sizeof(kb.rgbIVs));	os_memcpy(conn->eap_tls_prf, kb.rgbKeys, sizeof(kb.rgbKeys));	conn->eap_tls_prf_set = 1;	return 0;}u8 * tls_connection_handshake(void *ssl_ctx, struct tls_connection *conn,			      const u8 *in_data, size_t in_len,			      size_t *out_len, u8 **appl_data,			      size_t *appl_data_len){	struct tls_global *global = ssl_ctx;	DWORD sspi_flags, sspi_flags_out;	SecBufferDesc inbuf, outbuf;	SecBuffer inbufs[2], outbufs[1];	SECURITY_STATUS status;	TimeStamp ts_expiry;	u8 *out_buf = NULL;	if (appl_data)		*appl_data = NULL;	if (conn->start) {		return tls_conn_hs_clienthello(global, conn, out_len);	}	wpa_printf(MSG_DEBUG, "SChannel: %d bytes handshake data to process",		   in_len);	sspi_flags = ISC_REQ_REPLAY_DETECT |		ISC_REQ_CONFIDENTIALITY |		ISC_RET_EXTENDED_ERROR |		ISC_REQ_ALLOCATE_MEMORY |		ISC_REQ_MANUAL_CRED_VALIDATION;	/* Input buffer for Schannel */	inbufs[0].pvBuffer = (u8 *) in_data;	inbufs[0].cbBuffer = in_len;	inbufs[0].BufferType = SECBUFFER_TOKEN;	/* Place for leftover data from Schannel */	inbufs[1].pvBuffer = NULL;	inbufs[1].cbBuffer = 0;	inbufs[1].BufferType = SECBUFFER_EMPTY;	inbuf.cBuffers = 2;	inbuf.pBuffers = inbufs;	inbuf.ulVersion = SECBUFFER_VERSION;	/* Output buffer for Schannel */	outbufs[0].pvBuffer = NULL;	outbufs[0].cbBuffer = 0;	outbufs[0].BufferType = SECBUFFER_TOKEN;	outbuf.cBuffers = 1;	outbuf.pBuffers = outbufs;	outbuf.ulVersion = SECBUFFER_VERSION;#ifdef UNICODE	status = global->sspi->InitializeSecurityContextW(		&conn->creds, &conn->context, NULL, sspi_flags, 0,		SECURITY_NATIVE_DREP, &inbuf, 0, NULL,		&outbuf, &sspi_flags_out, &ts_expiry);#else /* UNICODE */	status = global->sspi->InitializeSecurityContextA(		&conn->creds, &conn->context, NULL, sspi_flags, 0,		SECURITY_NATIVE_DREP, &inbuf, 0, NULL,		&outbuf, &sspi_flags_out, &ts_expiry);#endif /* UNICODE */	wpa_printf(MSG_MSGDUMP, "Schannel: InitializeSecurityContext -> "		   "status=%d inlen[0]=%d intype[0]=%d inlen[1]=%d "		   "intype[1]=%d outlen[0]=%d",		   (int) status, (int) inbufs[0].cbBuffer,		   (int) inbufs[0].BufferType, (int) inbufs[1].cbBuffer,		   (int) inbufs[1].BufferType,		   (int) outbufs[0].cbBuffer);	if (status == SEC_E_OK || status == SEC_I_CONTINUE_NEEDED ||	    (FAILED(status) && (sspi_flags_out & ISC_RET_EXTENDED_ERROR))) {		if (outbufs[0].cbBuffer != 0 && outbufs[0].pvBuffer) {			wpa_hexdump(MSG_MSGDUMP, "SChannel - output",				    outbufs[0].pvBuffer, outbufs[0].cbBuffer);			*out_len = outbufs[0].cbBuffer;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲自拍偷拍欧美| 国内精品伊人久久久久av影院| 亚洲美女免费在线| 亚洲综合激情另类小说区| 一区二区三区日韩欧美| 日韩国产欧美在线观看| 高清久久久久久| 欧美日韩视频在线观看一区二区三区 | 91成人免费在线| www.亚洲激情.com| 3d动漫精品啪啪| 国产精品萝li| 美女视频黄久久| 欧美在线一区二区三区| 精品盗摄一区二区三区| 国产精品水嫩水嫩| 美女爽到高潮91| 一本大道久久a久久综合| 26uuuu精品一区二区| 亚洲国产一二三| 精品夜夜嗨av一区二区三区| eeuss鲁片一区二区三区在线看| 91精品在线观看入口| 亚洲欧美一区二区三区极速播放| 国产真实乱子伦精品视频| 欧美日韩不卡一区| 国产欧美一区二区在线观看| 亚洲综合偷拍欧美一区色| 国产成人一区二区精品非洲| 欧美高清dvd| 亚洲国产日韩在线一区模特| av中文字幕亚洲| 欧美sm美女调教| 日韩av高清在线观看| 色94色欧美sute亚洲线路一久| 91精品国产综合久久精品app| 久久亚洲一级片| 亚洲一二三区不卡| 91免费视频观看| 欧美另类z0zxhd电影| 亚洲日本在线观看| 色婷婷精品久久二区二区蜜臀av| 国产午夜亚洲精品羞羞网站| 免费的成人av| 91精品国产丝袜白色高跟鞋| 日韩国产欧美在线播放| 色综合久久综合网| 亚洲乱码一区二区三区在线观看| 成人午夜电影久久影院| 欧美韩日一区二区三区| 波多野结衣欧美| 欧美精品一区二| 国产麻豆一精品一av一免费 | 亚洲午夜精品网| 色先锋aa成人| 一区二区在线观看免费视频播放 | 国产精品每日更新在线播放网址 | 国产欧美综合在线观看第十页| 亚洲成人777| 精品一区二区三区免费播放| 欧美日韩电影一区| 亚洲综合色网站| 99免费精品视频| 樱花影视一区二区| 99久久精品免费看国产免费软件| 亚洲欧美视频在线观看视频| 在线视频观看一区| 亚洲成a人片综合在线| 91精品国产全国免费观看| 精品一区二区三区久久| 国产欧美日韩亚州综合| 91麻豆精东视频| 五月天网站亚洲| 久久五月婷婷丁香社区| 成人福利电影精品一区二区在线观看| 国产欧美日本一区二区三区| 91视频观看视频| 日韩精品一二区| 欧美日韩aaa| 美女视频免费一区| 91麻豆精品国产自产在线观看一区 | 国产a视频精品免费观看| 国产精品久久久久久亚洲毛片 | 日韩理论片中文av| av一二三不卡影片| 日韩电影免费在线看| 久久免费电影网| 91福利精品视频| 久久成人久久爱| 亚洲精品成人少妇| 久久蜜桃av一区精品变态类天堂| 福利电影一区二区三区| 五月婷婷激情综合网| 久久久噜噜噜久久中文字幕色伊伊| 成人av片在线观看| 亚洲一线二线三线久久久| 欧美日韩一卡二卡三卡| 岛国精品一区二区| 亚洲第一会所有码转帖| 国产精品污www在线观看| 91精品国产色综合久久ai换脸| 国产成人精品亚洲日本在线桃色| 亚洲麻豆国产自偷在线| 911精品产国品一二三产区| 成人av中文字幕| 日韩在线一区二区三区| 成人欧美一区二区三区在线播放| 91精品国产综合久久香蕉麻豆| 91女人视频在线观看| 国产在线一区二区| 日本三级韩国三级欧美三级| 久久久午夜精品理论片中文字幕| 欧美伊人久久久久久午夜久久久久| 亚洲国产精品一区二区www在线| 久久久综合激的五月天| 欧美性大战久久久久久久蜜臀| 粉嫩13p一区二区三区| 亚洲色图色小说| 欧美国产精品一区| 2024国产精品| 欧美岛国在线观看| 欧美一个色资源| 欧美日韩国产色站一区二区三区| 色婷婷激情综合| 一本高清dvd不卡在线观看| 国产一区二区三区四区五区美女| 一区二区免费在线播放| 亚洲伦理在线精品| 一区二区三区在线观看动漫| 亚洲欧洲精品一区二区三区| 国产日韩综合av| 国产欧美一二三区| 国产欧美精品一区二区三区四区| 久久一区二区三区四区| 久久日韩粉嫩一区二区三区| 久久久电影一区二区三区| 欧美另类z0zxhd电影| 粉嫩在线一区二区三区视频| 国产一区二区中文字幕| 日本亚洲电影天堂| 国产91精品入口| 成人app网站| 日本道色综合久久| 欧美午夜精品理论片a级按摩| 欧美在线播放高清精品| 欧美日韩一二三区| 亚洲一区二区三区中文字幕| 国产网红主播福利一区二区| 欧美综合一区二区| 福利电影一区二区| 欧美日韩一区二区三区不卡| 91污在线观看| 国产精品福利一区二区三区| 欧洲精品在线观看| 在线观看成人小视频| 一区二区三区在线观看欧美| 精品美女一区二区| 久久―日本道色综合久久| 中文字幕亚洲一区二区av在线| 亚洲男女一区二区三区| 精品亚洲免费视频| 成人av中文字幕| 日本久久电影网| 色综合中文字幕| 欧美三级乱人伦电影| 国产欧美一区二区三区鸳鸯浴 | 亚洲精品成a人| 免费av成人在线| 欧美亚洲动漫另类| 久久久久国产成人精品亚洲午夜| 一区二区三区在线看| 国产一区免费电影| 91麻豆精品国产91久久久资源速度| 久久久久久亚洲综合影院红桃| 亚洲综合男人的天堂| 国产乱码精品一区二区三区忘忧草 | 亚洲视频免费看| 激情综合一区二区三区| 欧美精三区欧美精三区| 欧美精彩视频一区二区三区| 亚洲自拍另类综合| 国产·精品毛片| 欧美日韩国产123区| 国产精品日韩精品欧美在线| 亚洲成av人片在线| 欧美亚洲综合一区| 中文字幕第一页久久| 国产一区二三区| 日韩亚洲欧美在线观看| 亚洲综合激情另类小说区| 国产99久久久精品| 久久精品亚洲麻豆av一区二区| 丝袜美腿高跟呻吟高潮一区| 欧美亚洲动漫精品| 一区视频在线播放| 成人免费观看视频| 国产亚洲欧美色| 国产91精品一区二区麻豆亚洲| 欧美一区二区三区免费视频| 天天亚洲美女在线视频|