Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1474 lines
44 KiB

  1. /*
  2. Copyright (c) 1997, Microsoft Corporation, all rights reserved
  3. File:
  4. eaptls.h
  5. Description:
  6. PPP EAP TLS Authentication Protocol. Based on RFC xxxx.
  7. History:
  8. Oct 9, 1997: Vijay Baliga created original version.
  9. */
  10. #ifndef _EAPTLS_H_
  11. #define _EAPTLS_H_
  12. #define EAPTLS_KEY_13 L"System\\CurrentControlSet\\Services\\Rasman\\PPP\\EAP\\13"
  13. #define EAPTLS_VAL_SERVER_CONFIG_DATA L"ServerConfigData"
  14. #define EAPTLS_VAL_MAX_TLS_MESSAGE_LENGTH L"MaxTLSMessageLength"
  15. #define EAPTLS_VAL_IGNORE_NO_REVOCATION_CHECK L"IgnoreNoRevocationCheck"
  16. #define EAPTLS_VAL_IGNORE_REVOCATION_OFFLINE L"IgnoreRevocationOffline"
  17. #define EAPTLS_VAL_NO_ROOT_REVOCATION_CHECK L"NoRootRevocationCheck"
  18. #define EAPTLS_VAL_NO_REVOCATION_CHECK L"NoRevocationCheck"
  19. #define EAPTLS_8021x_PIN_DATA_DESCR L"starcehvionrsf"
  20. #define MAX_HASH_SIZE 20 // Certificate hash size
  21. // EAPTLS_PACKET flags
  22. #define EAPTLS_PACKET_FLAG_LENGTH_INCL 0x80
  23. #define EAPTLS_PACKET_FLAG_MORE_FRAGMENTS 0x40
  24. #define EAPTLS_PACKET_FLAG_TLS_START 0x20
  25. //
  26. // Versioning for PEAP. This will include the highest and lowest
  27. // supported versions
  28. //
  29. #define EAPTLS_PACKET_HIGHEST_SUPPORTED_VERSION 0x00
  30. #define EAPTLS_PACKET_LOWEST_SUPPORTED_VERSION 0x00
  31. #define EAPTLS_PACKET_CURRENT_VERSION 0x00
  32. typedef struct _EAPTLS_PACKET
  33. {
  34. BYTE bCode; // See EAPCODE_*
  35. BYTE bId; // Id of this packet
  36. BYTE pbLength[2]; // Length of this packet
  37. BYTE bType; // Should be PPP_EAP_TLS
  38. // (only for Request, Response)
  39. BYTE bFlags; // See EAPTLS_PACKET_FLAG_*
  40. // (only for Request, Response)
  41. BYTE pbData[1]; // Data
  42. // (only for Request, Response)
  43. } EAPTLS_PACKET;
  44. #define EAPTLS_PACKET_HDR_LEN (sizeof(EAPTLS_PACKET) - 1)
  45. // The largest EAP TLS header has 4 more octects for TLS blob size
  46. #define EAPTLS_PACKET_HDR_LEN_MAX (EAPTLS_PACKET_HDR_LEN + 4)
  47. // EAP TLS states
  48. typedef enum EAPTLS_STATE
  49. {
  50. EAPTLS_STATE_INITIAL,
  51. EAPTLS_STATE_SENT_START, // Server only
  52. EAPTLS_STATE_SENT_HELLO,
  53. EAPTLS_STATE_SENT_FINISHED,
  54. EAPTLS_STATE_RECD_FINISHED, // Client only
  55. EAPTLS_STATE_SENT_RESULT, // Server only
  56. EAPTLS_STATE_RECD_RESULT, // Client only
  57. EAPTLS_STATE_WAIT_FOR_USER_OK // Client only
  58. } EAPTLS_STATE;
  59. // Highest number we can handle
  60. #define EAPTLS_STATE_LIMIT EAPTLS_STATE_RECD_RESULT
  61. typedef struct _EAPTLS_HASH
  62. {
  63. DWORD cbHash; // Number of bytes in the hash
  64. BYTE pbHash[MAX_HASH_SIZE]; // The hash of a certificate
  65. } EAPTLS_HASH;
  66. // Values of the EAPTLS_CONN_PROPERTIES->fFlags field
  67. // Use a certificate on this machine
  68. #define EAPTLS_CONN_FLAG_REGISTRY 0x00000001
  69. // Do not validate server cert
  70. #define EAPTLS_CONN_FLAG_NO_VALIDATE_CERT 0x00000002
  71. // Do not Validate server name
  72. #define EAPTLS_CONN_FLAG_NO_VALIDATE_NAME 0x00000004
  73. // Send a different EAP Identity
  74. #define EAPTLS_CONN_FLAG_DIFF_USER 0x00000008
  75. // User simple cert selection logic
  76. #define EAPTLS_CONN_FLAG_SIMPLE_CERT_SEL 0x00000010
  77. #define EAPTLS_CONN_PROP_WATERMARK 0xBEEFFEEB
  78. //
  79. // EAPTLS_CONN_PROPERTIES + EAPTLS_CONN_PROPERTIES_V1_EXTRA
  80. // are send back to the calling application. However, internally
  81. // EAPTLS_CONN_PROPERTIES_V1 is used.
  82. //
  83. typedef struct _EAPTLS_CONN_PROPERTIES
  84. {
  85. DWORD dwVersion; //Version will be 1 for this release
  86. DWORD dwSize; // Number of bytes in this structure
  87. DWORD fFlags; // See EAPTLS_CONN_FLAG_*
  88. EAPTLS_HASH Hash; // Hash of the first certificate
  89. WCHAR awszServerName[1]; // server name of the first server
  90. } EAPTLS_CONN_PROPERTIES;
  91. //
  92. // This is a very messy way of doing things
  93. // but cannot help it because the verion
  94. // checking on the data structure was not
  95. // done to begin with. Hopefully some day
  96. // we will be able to get away from this
  97. // deal. Other part of the story is CM is
  98. // unable to create targetted connectoids.
  99. // So we have to carry this structure going
  100. // ahead unless CM is smart about targetted
  101. // connectoids.
  102. //
  103. // Additional stuff required in
  104. // version 1 of data structure
  105. //
  106. typedef struct _EAPTLS_CONN_PROPERTIES_V1_EXTRA
  107. {
  108. DWORD dwNumHashes; // Number of Hashes in the
  109. // structure including the one
  110. // in v0 struct above
  111. BYTE bData[1]; // Data - contains an array of
  112. // EAPTLS_HASH structures followed by
  113. // a string specifying server names
  114. // minus the first server
  115. }EAPTLS_CONN_PROPERTIES_V1_EXTRA;
  116. //The new v1.0 structure used internally
  117. typedef struct _EAPTLS_CONN_PROPERTIES_V1
  118. {
  119. DWORD dwVersion; // Version will be 1 for this release
  120. DWORD dwSize; // Number of bytes in this structure
  121. DWORD fFlags; // See EAPTLS_CONN_FLAG_*
  122. DWORD dwNumHashes; // Number of hash structures in the list
  123. BYTE bData[1]; // Data - contains an array of
  124. // EAPTLS_HASH structures followed by
  125. // a string specifying server name
  126. }EAPTLS_CONN_PROPERTIES_V1;
  127. // The old 'PIN must be saved' flag
  128. #define EAPTLS_USER_FLAG_OLD_SAVE_PIN 0x00000001
  129. // The PIN must be saved
  130. #define EAPTLS_USER_FLAG_SAVE_PIN 0x00000002
  131. typedef struct _EAPTLS_USER_PROPERTIES
  132. {
  133. DWORD reserved; // Must be 0 (compare with EAPLOGONINFO)
  134. DWORD dwVersion;
  135. DWORD dwSize; // Number of bytes in this structure
  136. DWORD fFlags; // See EAPTLS_USER_FLAG_*
  137. EAPTLS_HASH Hash; // Hash for the user certificate
  138. WCHAR* pwszDiffUser; // The EAP Identity to send
  139. DWORD dwPinOffset; // Offset in abData
  140. WCHAR* pwszPin; // The smartcard PIN
  141. USHORT usLength; // Part of UnicodeString
  142. USHORT usMaximumLength; // Part of UnicodeString
  143. UCHAR ucSeed; // To unlock the UnicodeString
  144. WCHAR awszString[1]; // Storage for pwszDiffUser and pwszPin
  145. } EAPTLS_USER_PROPERTIES;
  146. typedef struct _EAPTLS_PIN
  147. {
  148. WCHAR *pwszPin;
  149. USHORT usLength;
  150. USHORT usMaximumLength;
  151. UCHAR ucSeed;
  152. } EAPTLS_PIN;
  153. // Values of the EAPTLSCB->fFlags field
  154. // We are the server
  155. #define EAPTLSCB_FLAG_SERVER 0x00000001
  156. // We are a router
  157. #define EAPTLSCB_FLAG_ROUTER 0x00000002
  158. // The call is happening during logon
  159. #define EAPTLSCB_FLAG_LOGON 0x00000004
  160. // Negotiation is complete, and so far appears successful. A server may get a
  161. // TLS Alert message from the client at this point, in which case it will
  162. // realize that the negotiation was unsuccessful. However, a client never
  163. // changes its mind.
  164. #define EAPTLSCB_FLAG_SUCCESS 0x00000008
  165. // The peer has a large blob to send. So it has divided it into fragments
  166. #define EAPTLSCB_FLAG_RECEIVING_FRAGMENTS 0x00000010
  167. // Keeps track of whether we need to call FreeCredentialsHandle(hCredential)
  168. #define EAPTLSCB_FLAG_HCRED_INVALID 0x00000020
  169. // Keeps track of whether we need to call DeleteSecurityContext(hContext)
  170. #define EAPTLSCB_FLAG_HCTXT_INVALID 0x00000040
  171. // We are not allowed to display any UI
  172. #define EAPTLSCB_FLAG_NON_INTERACTIVE 0x00000080
  173. // This is the first link in a multilink bundle. This is not a callback.
  174. #define EAPTLSCB_FLAG_FIRST_LINK 0x00000100
  175. // The user data was obtained from Winlogon
  176. #define EAPTLSCB_FLAG_WINLOGON_DATA 0x00000200
  177. // We are doing Machine Authentication
  178. #define EAPTLSCB_FLAG_MACHINE_AUTH 0x00000400
  179. // We are providing guest access
  180. #define EAPTLSCB_FLAG_GUEST_ACCESS 0x00000800
  181. //We want to do something specific to 8021x auth
  182. #define EAPTLSCB_FLAG_8021X_AUTH 0x00001000
  183. //We are using cached credentials
  184. #define EAPTLSCB_FLAG_USING_CACHED_CREDS 0x00002000
  185. //We are running in PEAP context
  186. #define EAPTLSCB_FLAG_EXECUTING_PEAP 0x00004000
  187. // The EAP TLS work buffer
  188. typedef struct _EAPTLS_CONTROL_BLOCK
  189. {
  190. EAPTLS_STATE EapTlsState;
  191. DWORD fFlags; // See EAPTLSCB_FLAG_*
  192. HANDLE hTokenImpersonateUser; // Client only
  193. WCHAR awszIdentity[UNLEN + 1];// Server only
  194. RAS_AUTH_ATTRIBUTE* pAttributes; // Username or MPPE key
  195. EAPTLS_CONN_PROPERTIES_V1* pConnProp; // Client only
  196. EAPTLS_CONN_PROPERTIES_V1 * pNewConnProp;// Client only
  197. EAPTLS_USER_PROPERTIES* pUserProp;
  198. // Client only, EAPTLSCB_FLAG_LOGON only
  199. BYTE* pUserData;
  200. DWORD dwSizeOfUserData;
  201. PCCERT_CONTEXT pCertContext;
  202. CredHandle hCredential; // The credentials handle
  203. CtxtHandle hContext; // The context handle
  204. ULONG fContextReq; // Required context attributes
  205. BYTE* pbBlobIn; // TLS blob received from the peer
  206. DWORD cbBlobIn; // Number of bytes in the TLS blob
  207. // received from the peer
  208. DWORD cbBlobInBuffer; // Number of bytes allocated for the
  209. // pbBlobIn buffer
  210. DWORD dwBlobInRemining; // We are receiving fragments from
  211. // the peer and the peer has
  212. // promised to send dwBlobInRemining
  213. // more bytes
  214. BYTE* pbBlobOut; // TLS blob created for the peer
  215. DWORD cbBlobOut; // Number of bytes in the TLS blob
  216. // created for the peer
  217. DWORD cbBlobOutBuffer; // Number of bytes allocated for the
  218. // pbBlobOut buffer
  219. DWORD dwBlobOutOffset; // Pointer to the first byte in
  220. // pbBlobOut that has to be sent
  221. DWORD dwBlobOutOffsetNew; // Update dwBlobOutOffset to this
  222. // value when the peer confirms
  223. // receipt of the previous packet
  224. BYTE bCode; // bCode of the last packet sent
  225. BYTE bId; // bId of the last packet sent
  226. DWORD dwAuthResultCode; // The error code that we get when
  227. // the negotiation is complete
  228. EAPTLS_PIN *pSavedPin; //
  229. HANDLE hEventLog;
  230. BYTE* pUIContextData;
  231. BYTE bNextId; // Saved when we raise UI
  232. EAPTLS_PACKET ReceivePacket; // Saved when we go off to get PIN
  233. } EAPTLSCB;
  234. typedef struct _EAPTLS_CERT_NODE EAPTLS_CERT_NODE;
  235. struct _EAPTLS_CERT_NODE
  236. {
  237. EAPTLS_CERT_NODE* pNext;
  238. EAPTLS_HASH Hash;
  239. WCHAR* pwszDisplayName;
  240. WCHAR* pwszFriendlyName;
  241. WCHAR* pwszIssuer;
  242. WCHAR* pwszExpiration;
  243. //
  244. // New fields added vivekk
  245. //
  246. FILETIME IssueDate;
  247. #if 0
  248. WCHAR* pwszIssuedTo;
  249. WCHAR* pwszIssuedBy;
  250. #endif
  251. };
  252. // Values of the EAPTLS_CONN_DIALOG->fFlags field
  253. // We are a router
  254. #define EAPTLS_CONN_DIALOG_FLAG_ROUTER 0x00000001
  255. #define EAPTLS_CONN_DIALOG_FLAG_READONLY 0x00000002
  256. typedef struct _EAPTLS_CONN_DIALOG
  257. {
  258. DWORD fFlags; // See
  259. // EAPTLS_CONN_DIALOG_FLAG_*
  260. EAPTLS_CERT_NODE* pCertList; //List of all the root certificates
  261. //from internet trusted root store
  262. EAPTLS_CERT_NODE** ppSelCertList; //List of pointers to selected certs.
  263. //will be as many as num hashes
  264. //in conn prop.
  265. EAPTLS_CONN_PROPERTIES* pConnProp; // ConfigData in phonebook
  266. EAPTLS_CONN_PROPERTIES_V1 * pConnPropv1; // Version 1.0 config data
  267. HWND hWndRadioUseCard;
  268. HWND hWndRadioUseRegistry;
  269. HWND hWndCheckValidateCert;
  270. HWND hWndCheckValidateName;
  271. HWND hWndEditServerName;
  272. HWND hWndStaticRootCaName;
  273. //HWND hWndComboRootCaName; //This will go away
  274. HWND hWndListRootCaName; //This is the new list
  275. HWND hWndCheckDiffUser;
  276. HWND hWndCheckUseSimpleSel;
  277. HWND hWndViewCertDetails;
  278. } EAPTLS_CONN_DIALOG;
  279. // Values of the EAPTLS_USER_DIALOG->fFlags field
  280. // We need to send a different EAP Identity
  281. #define EAPTLS_USER_DIALOG_FLAG_DIFF_USER 0x00000001
  282. // We need to change the title
  283. #define EAPTLS_USER_DIALOG_FLAG_DIFF_TITLE 0x00000002
  284. //USe simple cert selection
  285. #define EAPTLS_USER_DIALOG_FLAG_USE_SIMPLE_CERTSEL 0x00000004
  286. //
  287. // Nodes are grouped by displayname
  288. //
  289. typedef struct _EAPTLS_GROUPED_CERT_NODES EAPTLS_GROUPED_CERT_NODES;
  290. typedef struct _EAPTLS_GROUPED_CERT_NODES* PEAPTLS_GROUPED_CERT_NODES;
  291. struct _EAPTLS_GROUPED_CERT_NODES
  292. {
  293. PEAPTLS_GROUPED_CERT_NODES pNext;
  294. WCHAR* pwszDisplayName;
  295. //Most current one in the colation...
  296. EAPTLS_CERT_NODE* pMostRecentCert;
  297. };
  298. typedef struct _EAPTLS_USER_DIALOG
  299. {
  300. DWORD fFlags; // See
  301. // EAPTLS_USER_DIALOG_FLAG_*
  302. EAPTLS_CERT_NODE* pCertList;
  303. EAPTLS_CERT_NODE* pCert;
  304. PEAPTLS_GROUPED_CERT_NODES pGroupedList;
  305. EAPTLS_USER_PROPERTIES* pUserProp; // UserData in registry
  306. const WCHAR* pwszEntry;
  307. const WCHAR* pwszStoreName;
  308. BOOL fIdentity; //Identity UI is being shown here
  309. HWND hWndComboUserName;
  310. HWND hWndBtnViewCert;
  311. // These are required for the server's certificate selection
  312. HWND hWndEditFriendlyName;
  313. HWND hWndEditIssuer;
  314. HWND hWndEditExpiration;
  315. HWND hWndStaticDiffUser;
  316. HWND hWndEditDiffUser;
  317. } EAPTLS_USER_DIALOG;
  318. // Values of the EAPTLS_PIN_DIALOG->fFlags field
  319. // We need to send a different EAP Identity
  320. #define EAPTLS_PIN_DIALOG_FLAG_DIFF_USER 0x00000001
  321. // The UI is coming up before Logon
  322. #define EAPTLS_PIN_DIALOG_FLAG_LOGON 0x00000002
  323. #define EAPTLS_PIN_DIALOG_FLAG_ROUTER 0x00000004
  324. typedef struct _EAPTLS_PIN_DIALOG
  325. {
  326. DWORD fFlags; // See
  327. // EAPTLS_PIN_DIALOG_FLAG_*
  328. EAPTLS_USER_PROPERTIES* pUserProp; // UserData in registry
  329. const WCHAR* pwszEntry;
  330. PCCERT_CONTEXT pCertContext; //Certificate Context for selected certificate.
  331. DWORD dwRetCode; //Return Code of Validate PIN operation.
  332. HWND hWndStaticDiffUser;
  333. HWND hWndEditDiffUser;
  334. HWND hWndStaticPin;
  335. HWND hWndEditPin;
  336. } EAPTLS_PIN_DIALOG;
  337. #define NUM_CHARS_TITLE 100
  338. typedef struct _EAPTLS_VALIDATE_SERVER
  339. {
  340. DWORD dwSize;
  341. DWORD fShowCertDetails;
  342. EAPTLS_HASH Hash; //Hash of the root certificate to show details
  343. WCHAR awszTitle[NUM_CHARS_TITLE];
  344. WCHAR awszWarning[1];
  345. } EAPTLS_VALIDATE_SERVER;
  346. #ifdef ALLOC_EAPTLS_GLOBALS
  347. DWORD g_dwEapTlsTraceId = INVALID_TRACEID;
  348. int g_nEapTlsClientNextState[] =
  349. {
  350. EAPTLS_STATE_SENT_HELLO,
  351. EAPTLS_STATE_INITIAL, // Impossible
  352. EAPTLS_STATE_SENT_FINISHED,
  353. EAPTLS_STATE_RECD_FINISHED,
  354. EAPTLS_STATE_RECD_RESULT,
  355. EAPTLS_STATE_INITIAL, // Impossible
  356. EAPTLS_STATE_RECD_RESULT,
  357. EAPTLS_STATE_RECD_FINISHED
  358. };
  359. int g_nEapTlsServerNextState[] =
  360. {
  361. EAPTLS_STATE_SENT_START,
  362. EAPTLS_STATE_SENT_HELLO,
  363. EAPTLS_STATE_SENT_FINISHED,
  364. EAPTLS_STATE_SENT_RESULT,
  365. EAPTLS_STATE_INITIAL, // Impossible
  366. EAPTLS_STATE_SENT_RESULT,
  367. EAPTLS_STATE_INITIAL, // Impossible
  368. EAPTLS_STATE_INITIAL, // Impossible
  369. };
  370. CHAR *g_szEapTlsState[] =
  371. {
  372. "Initial",
  373. "SentStart",
  374. "SentHello",
  375. "SentFinished",
  376. "RecdFinished",
  377. "SentResult",
  378. "RecdResult",
  379. "WaitForUserOK",
  380. };
  381. #else // !ALLOC_EAPTLS_GLOBALS
  382. extern DWORD g_dwEapTlsTraceId;
  383. #endif // ALLOC_EAPTLS_GLOBALS
  384. // Prototypes for functions in util.c
  385. VOID
  386. EapTlsTrace(
  387. IN CHAR* Format,
  388. ...
  389. );
  390. DWORD
  391. EapTlsInitialize2(
  392. IN BOOL fInitialize,
  393. IN BOOL fUI
  394. );
  395. DWORD
  396. EapTlsInitialize(
  397. IN BOOL fInitialize
  398. );
  399. VOID
  400. EncodePin(
  401. IN EAPTLS_USER_PROPERTIES* pUserProp
  402. );
  403. VOID
  404. DecodePin(
  405. IN EAPTLS_USER_PROPERTIES* pUserProp
  406. );
  407. BOOL
  408. FFormatMachineIdentity1 (
  409. LPWSTR lpszMachineNameRaw,
  410. LPWSTR * lppszMachineNameFormatted );
  411. BOOL
  412. FFormatMachineIdentity (
  413. IN LPWSTR lpszMachineNameRaw,
  414. OUT LPWSTR * lppszMachineNameFormatted );
  415. BOOL
  416. FCertToStr(
  417. IN PCCERT_CONTEXT pCertContext,
  418. IN DWORD fFlags,
  419. IN BOOL fMachineCert,
  420. OUT WCHAR** ppwszName
  421. );
  422. BOOL
  423. FMachineAuthCertToStr (
  424. IN PCCERT_CONTEXT pCertContext,
  425. OUT WCHAR ** ppwszName
  426. );
  427. BOOL
  428. FGetFriendlyName(
  429. IN PCCERT_CONTEXT pCertContext,
  430. OUT WCHAR** ppwszName
  431. );
  432. BOOL
  433. FSmartCardReaderInstalled(
  434. VOID
  435. );
  436. DWORD DwGetEKUUsage (
  437. IN PCCERT_CONTEXT pCertContext,
  438. OUT PCERT_ENHKEY_USAGE * ppUsage
  439. );
  440. BOOL
  441. FCheckUsage(
  442. IN PCCERT_CONTEXT pCertContext,
  443. IN PCERT_ENHKEY_USAGE pUsage,
  444. IN BOOL fMachine
  445. );
  446. BOOL
  447. FCheckSCardCertAndCanOpenSilentContext (
  448. IN PCCERT_CONTEXT pCertContext
  449. );
  450. BOOL
  451. FCheckCSP(
  452. IN PCCERT_CONTEXT pCertContext
  453. );
  454. BOOL
  455. FCheckTimeValidity(
  456. IN PCCERT_CONTEXT pCertContext
  457. );
  458. DWORD DwCheckCertPolicy (
  459. IN PCCERT_CONTEXT pCertContextUser,
  460. OUT PCCERT_CHAIN_CONTEXT * ppCertChainContext
  461. );
  462. DWORD
  463. GetRootCertHashAndNameVerifyChain(
  464. IN PCERT_CONTEXT pCertContextServer,
  465. OUT EAPTLS_HASH* pHash,
  466. OUT WCHAR** ppwszName,
  467. IN BOOL fVerifyGP,
  468. OUT BOOL * pfRootCheckRequired
  469. );
  470. DWORD
  471. ServerConfigDataIO(
  472. IN BOOL fRead,
  473. IN WCHAR* pwszMachineName,
  474. IN OUT BYTE** ppData,
  475. IN DWORD dwNumBytes
  476. );
  477. VOID
  478. FreeCertList(
  479. IN EAPTLS_CERT_NODE* pNode
  480. );
  481. VOID
  482. CreateCertList(
  483. IN BOOL fServer,
  484. IN BOOL fRouter,
  485. IN BOOL fRoot,
  486. OUT EAPTLS_CERT_NODE** ppCertList,
  487. OUT EAPTLS_CERT_NODE** ppCert,
  488. IN DWORD dwNumHashStructs,
  489. IN EAPTLS_HASH* pHash,
  490. IN WCHAR* pwszStoreName
  491. );
  492. DWORD
  493. GetDefaultClientMachineCert(
  494. IN HCERTSTORE hCertStore,
  495. OUT PCCERT_CONTEXT* ppCertContext
  496. );
  497. DWORD
  498. GetDefaultMachineCert(
  499. IN HCERTSTORE hCertStore,
  500. OUT PCCERT_CONTEXT* ppCertContext
  501. );
  502. DWORD
  503. GetCertFromLogonInfo(
  504. IN BYTE* pUserDataIn,
  505. IN DWORD dwSizeOfUserDataIn,
  506. OUT PCCERT_CONTEXT* ppCertContext
  507. );
  508. DWORD
  509. GetIdentityFromLogonInfo(
  510. IN BYTE* pUserDataIn,
  511. IN DWORD dwSizeOfUserDataIn,
  512. OUT WCHAR** ppwszIdentity
  513. );
  514. DWORD
  515. ReadConnectionData(
  516. IN BOOL fWireless,
  517. IN BYTE* pConnectionDataIn,
  518. IN DWORD dwSizeOfConnectionDataIn,
  519. OUT EAPTLS_CONN_PROPERTIES** ppConnProp
  520. );
  521. DWORD
  522. ReadUserData(
  523. IN BYTE* pUserDataIn,
  524. IN DWORD dwSizeOfUserDataIn,
  525. OUT EAPTLS_USER_PROPERTIES** ppUserProp
  526. );
  527. DWORD
  528. AllocUserDataWithNewIdentity(
  529. IN EAPTLS_USER_PROPERTIES* pUserProp,
  530. IN WCHAR* pwszIdentity,
  531. OUT EAPTLS_USER_PROPERTIES** ppUserProp
  532. );
  533. DWORD
  534. AllocUserDataWithNewPin(
  535. IN EAPTLS_USER_PROPERTIES* pUserProp,
  536. IN PBYTE pbzPin,
  537. IN DWORD cbPin,
  538. OUT EAPTLS_USER_PROPERTIES** ppUserProp
  539. );
  540. WCHAR*
  541. WszFromId(
  542. IN HINSTANCE hInstance,
  543. IN DWORD dwStringId
  544. );
  545. // Prototypes for functions in eaptls.c
  546. DWORD
  547. EapTlsBegin(
  548. OUT VOID** ppWorkBuffer,
  549. IN PPP_EAP_INPUT* pPppEapInput
  550. );
  551. DWORD
  552. EapTlsEnd(
  553. IN EAPTLSCB* pEapTlsCb
  554. );
  555. DWORD
  556. EapTlsMakeMessage(
  557. IN EAPTLSCB* pEapTlsCb,
  558. IN PPP_EAP_PACKET* pInput,
  559. OUT PPP_EAP_PACKET* pOutput,
  560. IN DWORD cbSendPacket,
  561. OUT PPP_EAP_OUTPUT* pEapOutput,
  562. IN PPP_EAP_INPUT* pEapInput
  563. );
  564. DWORD
  565. GetCredentials(
  566. IN EAPTLSCB* pEapTlsCb
  567. );
  568. DWORD
  569. EapTlsCMakeMessage(
  570. IN EAPTLSCB* pEapTlsCb,
  571. IN EAPTLS_PACKET* pReceivePacket,
  572. OUT EAPTLS_PACKET* pSendPacket,
  573. IN DWORD cbSendPacket,
  574. OUT PPP_EAP_OUTPUT* pEapOutput,
  575. IN PPP_EAP_INPUT* pEapInput
  576. );
  577. DWORD
  578. EapTlsSMakeMessage(
  579. IN EAPTLSCB* pEapTlsCb,
  580. IN EAPTLS_PACKET* pReceivePacket,
  581. OUT EAPTLS_PACKET* pSendPacket,
  582. IN DWORD cbSendPacket,
  583. OUT PPP_EAP_OUTPUT* pEapOutput,
  584. IN PPP_EAP_INPUT* pEapInput
  585. );
  586. // Prototypes for functions in scard.c
  587. DWORD
  588. GetCertFromCard(
  589. OUT PCCERT_CONTEXT* ppCertContext
  590. );
  591. VOID
  592. FreeScardDlgDll(
  593. VOID
  594. );
  595. // Prototypes for functions in eapui.cpp
  596. HINSTANCE
  597. GetHInstance(
  598. VOID
  599. );
  600. // Prototypes for functions in dialog.c
  601. VOID
  602. GetString(
  603. IN HWND hwndParent,
  604. IN UINT ID,
  605. IN OUT WCHAR** ppwszString
  606. );
  607. //
  608. //Prototypes in eaptls.c
  609. //
  610. DWORD
  611. AssociatePinWithCertificate(
  612. IN PCCERT_CONTEXT pCertContext,
  613. IN EAPTLS_USER_PROPERTIES* pUserProp,
  614. IN BOOL fErarePIN,
  615. IN BOOL fCheckNullPin
  616. );
  617. DWORD EncryptData
  618. (
  619. IN PBYTE pbPlainData,
  620. IN DWORD cbPlainData,
  621. OUT PBYTE * ppEncData,
  622. OUT DWORD * pcbEncData
  623. );
  624. //
  625. // Prototypes of functions in util.c
  626. //
  627. DWORD GetMBytePIN ( WCHAR * pwszPIN, CHAR ** ppszPIN );
  628. DWORD VerifyCallerTrust ( void * callersaddress );
  629. #if 0
  630. //
  631. //This function get's the hash blob
  632. //deposited by Group Policy in the registry
  633. //
  634. DWORD
  635. ReadGPCARootHashes(
  636. DWORD *pdwSizeOfRootHashBlob,
  637. PBYTE *ppbRootHashBlob
  638. );
  639. #endif
  640. //
  641. // These functions are around the cludgy
  642. // CONN PROP structure.
  643. //
  644. EAPTLS_CONN_PROPERTIES_V1_EXTRA UNALIGNED * ConnPropGetExtraPointer (EAPTLS_CONN_PROPERTIES * pConnProp);
  645. DWORD ConnPropGetNumHashes(EAPTLS_CONN_PROPERTIES * pConnProp );
  646. void ConnPropSetNumHashes(EAPTLS_CONN_PROPERTIES * pConnProp, DWORD dwNumHashes );
  647. DWORD ConnPropGetV1Struct ( EAPTLS_CONN_PROPERTIES * pConnProp, EAPTLS_CONN_PROPERTIES_V1 ** ppConnPropv1 );
  648. DWORD ConnPropGetV0Struct ( EAPTLS_CONN_PROPERTIES_V1 * pConnPropv1, EAPTLS_CONN_PROPERTIES ** ppConnProp );
  649. void ShowCertDetails ( HWND hWnd, HCERTSTORE hStore, PCCERT_CONTEXT pCertContext);
  650. //////////////////////////All Peap Related Declarations /////////////////////
  651. //
  652. // PEAP Message Types
  653. //
  654. //
  655. //TBD: Check with IANA ( ashwinp ) what the type will be.
  656. #define PEAP_TYPE_AVP 0x21
  657. //
  658. // TLV Format is:
  659. // Flags - 2bits
  660. // Type - 14 bits
  661. // Length - 2 octets
  662. // Value - Variable
  663. //
  664. // TLV Flags
  665. //
  666. #define PEAP_AVP_FLAG_MANDATORY 0x80
  667. //
  668. // TLV types are of following types
  669. //
  670. // Status TLV. Tell's if the outcome of the EAP is success
  671. // or failure.
  672. //
  673. #define MS_PEAP_AVP_LANGUAGE_NEGOTIATE 0x01
  674. #define MS_PEAP_AVP_CIPHERSUITE_NEGOTIATE 0x02
  675. #define MS_PEAP_AVP_TYPE_STATUS 0x03
  676. //
  677. // Values possible in Status AVP
  678. //
  679. #define MS_PEAP_AVP_VALUE_SUCCESS 0x1
  680. #define MS_PEAP_AVP_VALUE_FAILURE 0x2
  681. // PEAP Reg Keys
  682. #define PEAP_KEY_25 L"System\\CurrentControlSet\\Services\\Rasman\\PPP\\EAP\\25"
  683. #define PEAP_VAL_SERVER_CONFIG_DATA L"ServerConfigData"
  684. //
  685. // This key is required for include only MSCHAPv2. IF this is missing all protocols will be included in PEAP
  686. // except PEAP itself
  687. //
  688. #define PEAP_KEY_PEAP L"System\\CurrentControlSet\\Services\\Rasman\\PPP\\EAP\\25"
  689. #define PEAP_CRIPPLE_VALUE L"EAPMschapv2Only"
  690. #define PEAP_KEY_EAP L"System\\CurrentControlSet\\Services\\Rasman\\PPP\\EAP"
  691. #define PEAP_REGVAL_PATH L"Path"
  692. #define PEAP_REGVAL_FRIENDLYNAME L"FriendlyName"
  693. #define PEAP_REGVAL_CONFIGDLL L"ConfigUIPath"
  694. #define PEAP_REGVAL_IDENTITYDLL L"IdentityPath"
  695. #define PEAP_REGVAL_INTERACTIVEUIDLL L"InteractiveUIPath"
  696. #define PEAP_REGVAL_CONFIGCLSID L"ConfigCLSID"
  697. #define PEAP_REGVAL_ROLESSUPPORTED L"RolesSupported"
  698. #define PEAP_EAPTYPE_IDENTITY 1
  699. #define PEAP_EAPTYPE_NAK 3
  700. typedef DWORD (APIENTRY * RASEAPFREE)( PBYTE );
  701. typedef DWORD (APIENTRY * RASEAPINVOKECONFIGUI)( DWORD, HWND, DWORD, PBYTE, DWORD, PBYTE*, DWORD*);
  702. typedef DWORD (APIENTRY * RASEAPGETIDENTITY)( DWORD, HWND, DWORD, const WCHAR*, const WCHAR*, PBYTE, DWORD, PBYTE, DWORD, PBYTE*, DWORD*, WCHAR** );
  703. typedef DWORD (APIENTRY * RASEAPINVOKEINTERACTIVEUI)(
  704. DWORD,
  705. HWND,
  706. PBYTE,
  707. DWORD,
  708. PBYTE *,
  709. DWORD *);
  710. //List of all EAP types allowed in PEAP
  711. typedef struct _PEAP_EAP_INFO PEAP_EAP_INFO;
  712. typedef struct _PEAP_EAP_INFO* PPEAP_EAP_INFO;
  713. struct _PEAP_EAP_INFO
  714. {
  715. //Next one in the list
  716. PPEAP_EAP_INFO pNext;
  717. //Type
  718. DWORD dwTypeId;
  719. // Path of the protocol DLL
  720. LPWSTR lpwszPath;
  721. //Friendly Name
  722. LPWSTR lpwszFriendlyName;
  723. //Configuration UI path for client
  724. LPWSTR lpwszConfigUIPath;
  725. //Identity UI path
  726. LPWSTR lpwszIdentityUIPath;
  727. //Interactive UI path
  728. LPWSTR lpwszInteractiveUIPath;
  729. //Configuration GUID
  730. LPWSTR lpwszConfigClsId;
  731. //Library HAndle
  732. HMODULE hEAPModule;
  733. //Eap Info for each EAP Type
  734. PPP_EAP_INFO PppEapInfo;
  735. //Work buffer for each eap type
  736. PBYTE pWorkBuf;
  737. // Original Client Config from PEAP blob
  738. PBYTE pbClientConfigOrig;
  739. // Client Config Length
  740. DWORD dwClientConfigOrigSize;
  741. // New client config
  742. PBYTE pbNewClientConfig;
  743. // New client config length
  744. DWORD dwNewClientConfigSize;
  745. // Original User Config information
  746. PBYTE pbUserConfigOrig;
  747. // Original size of user configuration
  748. DWORD dwUserConfigOrigSize;
  749. // New user config
  750. PBYTE pbUserConfigNew;
  751. // New user config size
  752. DWORD dwNewUserConfigSize;
  753. //
  754. DWORD (APIENTRY *RasEapGetCredentials)(
  755. IN DWORD dwTypeId,
  756. IN VOID * pWorkBuf,
  757. OUT VOID ** pInfo);
  758. //There will be more items in this node...
  759. };
  760. typedef enum _PEAP_STATE
  761. {
  762. PEAP_STATE_INITIAL,
  763. PEAP_STATE_TLS_INPROGRESS, // PEAP-Part 1 (TLS) is being executed
  764. PEAP_WAITING_FOR_IDENTITY, // Client should expect and identity request
  765. // server should send identity request
  766. PEAP_STATE_IDENTITY_REQUEST_SENT, // identity request send by server
  767. PEAP_STATE_IDENTITY_RESPONSE_SENT, // identity response send to server
  768. PEAP_STATE_EAP_TYPE_INPROGRESS, // PEAP-Part 2 (Embedded EAP) is being
  769. // executed
  770. PEAP_STATE_EAP_TYPE_FINISHED, // sever should send identity request
  771. PEAP_STATE_PEAP_SUCCESS_SEND, // server send PEAP success request
  772. PEAP_STATE_PEAP_FAIL_SEND, // server send PEAP fail request
  773. PEAP_STATE_FAST_ROAMING_IDENTITY_REQUEST// client is not setup to do fast roaming
  774. // and the server send a roaming success
  775. // we replied with fail and are now expecting
  776. // an identity request from server.
  777. } PEAP_STATE;
  778. //
  779. // connection properties for
  780. // each of the peap entries
  781. //
  782. typedef struct _PEAP_ENTRY_CONN_PROPERTIES
  783. {
  784. DWORD dwVersion; //Version will be 1 for this release
  785. DWORD dwSize; //Number of bytes in this structure
  786. DWORD dwEapTypeId; //TypeId for this Entry Properties
  787. BYTE bData[1]; //Actual conn properties for the given
  788. //Type Id
  789. }PEAP_ENTRY_CONN_PROPERTIES, *PPEAP_ENTRY_CONN_PROPERTIES;
  790. //
  791. // This structure holds EapTlsConn Prop along with
  792. // each configured eap type.
  793. //
  794. // Allow fast roaming
  795. #define PEAP_CONN_FLAG_FAST_ROAMING 0x00000001
  796. typedef struct _PEAP_CONN_PROPERTIES
  797. {
  798. //Version will be 1 for this release
  799. DWORD dwVersion;
  800. //
  801. //Number of bytes in this structure
  802. //
  803. DWORD dwSize;
  804. //Number of types configured in this PEAP
  805. //For now there is only one.
  806. DWORD dwNumPeapTypes;
  807. //Flags
  808. DWORD dwFlags;
  809. //Tls Connection Properties to start with - This is a variable length structure
  810. EAPTLS_CONN_PROPERTIES_V1 EapTlsConnProp;
  811. //Array of PPEAP_ENTRY_CONN_PROPERTIES follows here
  812. }PEAP_CONN_PROP, *PPEAP_CONN_PROP;
  813. //
  814. // Default credentials for eaptypes that dont expose
  815. // identity UI
  816. //
  817. typedef struct _PEAP_DEFAULT_CREDENTIALS
  818. {
  819. WCHAR wszUserName[UNLEN+1];
  820. WCHAR wszPassword[PWLEN+1];
  821. WCHAR wszDomain[DNLEN+1];
  822. }PEAP_DEFAULT_CREDENTIALS, *PPEAP_DEFAULT_CREDENTIALS;
  823. //
  824. // user properties for
  825. // each of the peap entries
  826. //
  827. typedef struct _PEAP_ENTRY_USER_PROPERTIES
  828. {
  829. DWORD dwVersion; //Version will be 1 for this release
  830. DWORD dwSize; //Number of bytes in this structure
  831. DWORD dwEapTypeId; //TypeId for this Entry Properties
  832. BOOL fUsingPeapDefault; //Default Identity provided by PEAP is being used.
  833. BYTE bData[1]; //Actual User properties for the given
  834. //Type Id
  835. }PEAP_ENTRY_USER_PROPERTIES, *PPEAP_ENTRY_USER_PROPERTIES;
  836. // Allow fast roaming
  837. #define PEAP_USER_FLAG_FAST_ROAMING 0x00000001
  838. typedef struct _PEAP_USER_PROPERTIES
  839. {
  840. //Version will be 1 for this release
  841. DWORD dwVersion;
  842. //Number of bytes in this structure
  843. DWORD dwSize;
  844. //Flags
  845. DWORD dwFlags;
  846. //Hash for user certificate
  847. EAPTLS_HASH CertHash;
  848. // User properties for an entry
  849. PEAP_ENTRY_USER_PROPERTIES UserProperties;
  850. //
  851. // Array of PEAP_ENTRY_USER_PROPERTIES for each eap type.
  852. // should be as many as dwNumPeapTypes in PEAP_CONN_PROP
  853. // structure
  854. // For now there is only one element...
  855. }PEAP_USER_PROP, *PPEAP_USER_PROP;
  856. // We are a router
  857. #define PEAP_CONN_DIALOG_FLAG_ROUTER 0x00000001
  858. #define PEAP_CONN_DIALOG_FLAG_8021x 0x00000002
  859. typedef struct _PEAP_CONN_DIALOG
  860. {
  861. DWORD fFlags; // See
  862. // PEAP_CONN_DIALOG_FLAG_*
  863. EAPTLS_CERT_NODE* pCertList; //List of all the root certificates
  864. //from internet trusted root store
  865. EAPTLS_CERT_NODE** ppSelCertList; //List of pointers to selected certs.
  866. //will be as many as num hashes
  867. //in conn prop.
  868. PPEAP_CONN_PROP pConnProp;
  869. PPEAP_EAP_INFO pEapInfo; //List of all the PEAP Eap Types
  870. PPEAP_EAP_INFO pSelEapInfo; //Selected Peap Type
  871. HWND hWndCheckValidateCert;
  872. HWND hWndCheckValidateName;
  873. HWND hWndEditServerName;
  874. HWND hWndStaticRootCaName;
  875. HWND hWndListRootCaName;
  876. HWND hWndComboPeapType;
  877. HWND hWndButtonConfigure;
  878. HWND hWndCheckEnableFastReconnect;
  879. } PEAP_CONN_DIALOG, *PPEAP_CONN_DIALOG;
  880. typedef struct _PEAP_SERVER_CONFIG_DIALOG
  881. {
  882. EAPTLS_CERT_NODE* pCertList; //List of all certificates in MY machine
  883. //store
  884. EAPTLS_CERT_NODE* pSelCertList; //List of selected cert.
  885. PPEAP_USER_PROP pUserProp; //User properties
  886. PPEAP_USER_PROP pNewUserProp; //New USer Properties
  887. PPEAP_EAP_INFO pEapInfo; //List of all the PEAP Eap Types
  888. PPEAP_EAP_INFO pSelEapInfo; //Selected Peap Type
  889. LPWSTR pwszMachineName;
  890. HWND hWndComboServerName;
  891. HWND hWndEditFriendlyName;
  892. HWND hWndEditIssuer;
  893. HWND hWndEditExpiration;
  894. HWND hWndComboPeapType;
  895. HWND hWndBtnConfigure;
  896. HWND hEndEnableFastReconnect;
  897. }PEAP_SERVER_CONFIG_DIALOG, *PPEAP_SERVER_CONFIG_DIALOG;
  898. typedef struct _PEAP_DEFAULT_CRED_DIALOG
  899. {
  900. PEAP_DEFAULT_CREDENTIALS PeapDefaultCredentials;
  901. HWND hWndUserName;
  902. HWND hWndPassword;
  903. HWND hWndDomain;
  904. }PEAP_DEFAULT_CRED_DIALOG, *PPEAP_DEFAULT_CRED_DIALOG;
  905. typedef struct _PEAP_INTERACTIVE_UI
  906. {
  907. DWORD dwEapTypeId; // Embedded Eap Type Id requesting
  908. // interactive UI
  909. DWORD dwSizeofUIContextData;
  910. BYTE bUIContextData[1];
  911. }PEAP_INTERACTIVE_UI, *PPEAP_INTERACTIVE_UI;
  912. typedef struct _PEAP_COOKIE_ATTRIBUTE
  913. {
  914. RAS_AUTH_ATTRIBUTE_TYPE raaType;
  915. DWORD dwLength;
  916. BYTE Data[1];
  917. }PEAP_COOKIE_ATTRIBUTE, *PPEAP_COOKIE_ATTRIBUTE;
  918. typedef struct _PEAP_COOKIE
  919. {
  920. WCHAR awszIdentity[DNLEN+UNLEN+1]; // Outer Identity that was used for
  921. // authentication.
  922. DWORD dwNumAuthAttribs; // Number of Ras Auth Attributes
  923. // other than MPPE keys
  924. // returned when auth succeeded
  925. // with full handshake
  926. BYTE Data[1]; // Data Conn Props + RAS Auth Attribs
  927. }PEAP_COOKIE, *PPEAP_COOKIE;
  928. //PEAP Flags
  929. #define PEAPCB_FLAG_SERVER 0x00000001 // This is a server
  930. #define PEAPCB_FLAG_ROUTER 0x00000002 // This is a router
  931. #define PEAPCB_FLAG_NON_INTERACTIVE 0x00000004 // No UI should be displayed
  932. #define PEAPCB_FLAG_LOGON 0x00000008 // The user data was
  933. // obtained from Winlogon
  934. #define PEAPCB_FLAG_PREVIEW 0x00000010 // User has checked
  935. // "Prompt for information
  936. // before dialing"
  937. #define PEAPCB_FLAG_FIRST_LINK 0x00000020 // This is the first link
  938. #define PEAPCB_FLAG_MACHINE_AUTH 0x00000040 // Use the default machine cert
  939. // or user cert based on the
  940. // application logon context
  941. #define PEAPCB_FLAG_GUEST_ACCESS 0x00000080 // Request to provide guest
  942. // access.
  943. #define PEAPCB_FLAG_8021X_AUTH 0x00000100 // Anything specific to 8021x
  944. // to be done in TLS
  945. #define PEAPCB_VERSION_OK 0x00000200 // version negotiation took place
  946. // and all's ok.
  947. #define PEAPCB_FAST_ROAMING 0x00000400 // Allow fast roaming
  948. typedef struct _PEAP_CONTROL_BLOCK
  949. {
  950. PEAP_STATE PeapState; //Current Peap State
  951. DWORD dwFlags; //Peap Flags
  952. HANDLE hTokenImpersonateUser; //Impersonation token.
  953. BYTE bId; //Peap Packet Id
  954. WCHAR awszIdentity[DNLEN+ UNLEN + 1];
  955. WCHAR awszTypeIdentity[DNLEN+ UNLEN + 1];
  956. WCHAR awszPassword[PWLEN+1]; //Type's password if
  957. //send in.
  958. BOOL fTlsConnPropDirty; //Need to save the TLS Conn prop
  959. EAPTLS_CONN_PROPERTIES_V1 * pNewTlsConnProp;
  960. BOOL fEntryConnPropDirty;
  961. PPEAP_CONN_PROP pConnProp; //Peap Connection Prop
  962. BOOL fTlsUserPropDirty; //Need to saveTLS user prop
  963. BOOL fEntryUserPropDirty;
  964. DWORD dwAuthResultCode; //Result of authentication
  965. BOOL fReceivedTLVSuccessFail; //Received a TLV instead of
  966. //a real success or failure
  967. BOOL fSendTLVSuccessforFastRoaming;
  968. PPP_EAP_PACKET * pPrevReceivePacket; //Previously received packet
  969. WORD cbPrevReceivePacket; //Number of bytes in previously
  970. //received packet
  971. PBYTE pPrevDecData; //Previously Decrypted packet data
  972. WORD cbPrevDecData; //Data size
  973. //
  974. // Encryption related entries in the control block
  975. //
  976. HCRYPTPROV hProv; //CryptoProvider
  977. //
  978. // following info is used if we use TLS to do encryption
  979. // This is the desired way of doing things since the cipher suite
  980. // is negotiated within TLS
  981. SecPkgContext_StreamSizes PkgStreamSizes;
  982. SecPkgContext_ConnectionInfo PkgConnInfo;
  983. PBYTE pbIoBuffer;
  984. DWORD dwIoBufferLen; //Enc or Dec Data Length
  985. PPEAP_USER_PROP pUserProp; //Peap User Prop
  986. RAS_AUTH_ATTRIBUTE * pTlsUserAttributes; //User Attributes send
  987. //back by EAPTLS
  988. PPEAP_INTERACTIVE_UI pUIContextData; //UI context Data for an eap type
  989. BOOL fInvokedInteractiveUI; //PEAP has invoked interactive UI
  990. BOOL fExecutingInteractiveUI;
  991. EAPTLSCB * pEapTlsCB; //Tls Control Block
  992. PPEAP_EAP_INFO pEapInfo; //Eap info - contains all data reqd for
  993. //eap type to function well.
  994. }PEAPCB, * PPEAPCB;
  995. DWORD
  996. EapPeapInitialize(
  997. IN BOOL fInitialize
  998. );
  999. DWORD
  1000. EapPeapBegin(
  1001. OUT VOID** ppWorkBuffer,
  1002. IN PPP_EAP_INPUT* pPppEapInput
  1003. );
  1004. DWORD
  1005. EapPeapEnd(
  1006. IN PPEAPCB pPeapCb
  1007. );
  1008. DWORD
  1009. EapPeapMakeMessage(
  1010. IN PPEAPCB pPeapCb,
  1011. IN PPP_EAP_PACKET* pInput,
  1012. OUT PPP_EAP_PACKET* pOutput,
  1013. IN DWORD cbSendPacket,
  1014. OUT PPP_EAP_OUTPUT* pEapOutput,
  1015. IN PPP_EAP_INPUT* pEapInput
  1016. );
  1017. DWORD
  1018. EapPeapCMakeMessage(
  1019. IN PPEAPCB pPeapCb,
  1020. IN PPP_EAP_PACKET* pReceivePacket,
  1021. OUT PPP_EAP_PACKET* pSendPacket,
  1022. IN DWORD cbSendPacket,
  1023. OUT PPP_EAP_OUTPUT* pEapOutput,
  1024. IN PPP_EAP_INPUT* pEapInput
  1025. );
  1026. DWORD
  1027. EapPeapSMakeMessage(
  1028. IN PPEAPCB pPeapCb,
  1029. IN PPP_EAP_PACKET* pReceivePacket,
  1030. OUT PPP_EAP_PACKET* pSendPacket,
  1031. IN DWORD cbSendPacket,
  1032. OUT PPP_EAP_OUTPUT* pEapOutput,
  1033. IN PPP_EAP_INPUT* pEapInput
  1034. );
  1035. //Peap functions from util.c
  1036. DWORD
  1037. PeapReadConnectionData(
  1038. IN BOOL fWireless,
  1039. IN BYTE* pConnectionDataIn,
  1040. IN DWORD dwSizeOfConnectionDataIn,
  1041. OUT PPEAP_CONN_PROP* ppConnProp
  1042. );
  1043. DWORD
  1044. PeapReadUserData(
  1045. IN BYTE* pUserDataIn,
  1046. IN DWORD dwSizeOfUserDataIn,
  1047. OUT PPEAP_USER_PROP* ppUserProp
  1048. );
  1049. DWORD
  1050. PeapReDoUserData (
  1051. IN DWORD dwNewTypeId,
  1052. OUT PPEAP_USER_PROP* ppNewUserProp
  1053. );
  1054. DWORD
  1055. PeapEapInfoAddListNode (PPEAP_EAP_INFO * ppEapInfo);
  1056. VOID
  1057. PeapEapInfoFreeList ( PPEAP_EAP_INFO pEapInfo );
  1058. DWORD
  1059. PeapEapInfoExpandSZ (HKEY hkeyPeapType,
  1060. LPWSTR pwszValue,
  1061. LPWSTR * ppValueData );
  1062. DWORD
  1063. PeapEapInfoGetList ( LPWSTR lpwszMachineName, PPEAP_EAP_INFO * ppEapInfo);
  1064. DWORD
  1065. PeapEapInfoSetConnData ( PPEAP_EAP_INFO pEapInfo, PPEAP_CONN_PROP pPeapConnProp );
  1066. DWORD PeapEapInfoInvokeClientConfigUI ( HWND hWndParent,
  1067. PPEAP_EAP_INFO pEapInfo,
  1068. DWORD fFlags);
  1069. DWORD
  1070. PeapGetFirstEntryConnProp ( PPEAP_CONN_PROP pConnProp,
  1071. PEAP_ENTRY_CONN_PROPERTIES UNALIGNED ** ppEntryProp
  1072. );
  1073. DWORD
  1074. PeapGetFirstEntryUserProp ( PPEAP_USER_PROP pUserProp,
  1075. PEAP_ENTRY_USER_PROPERTIES UNALIGNED ** ppEntryProp
  1076. );
  1077. DWORD
  1078. PeapEapInfoCopyListNode ( DWORD dwTypeId,
  1079. PPEAP_EAP_INFO pEapInfoList,
  1080. PPEAP_EAP_INFO * ppEapInfo );
  1081. DWORD
  1082. PeapEapInfoFindListNode ( DWORD dwTypeId,
  1083. PPEAP_EAP_INFO pEapInfoList,
  1084. PPEAP_EAP_INFO * ppEapInfo );
  1085. DWORD PeapEapInfoInvokeIdentityUI ( HWND hWndParent,
  1086. PPEAP_EAP_INFO pEapInfo,
  1087. const WCHAR * pwszPhoneBook,
  1088. const WCHAR * pwszEntry,
  1089. PBYTE pbUserDataIn,
  1090. DWORD cbUserDataIn,
  1091. WCHAR** ppwszIdentityOut,
  1092. DWORD fFlags);
  1093. #ifdef __cplusplus
  1094. extern "C"
  1095. #endif
  1096. DWORD PeapEapInfoInvokeServerConfigUI ( HWND hWndParent,
  1097. LPWSTR lpwszMachineName,
  1098. PPEAP_EAP_INFO pEapInfo
  1099. );
  1100. DWORD
  1101. OpenPeapRegistryKey(
  1102. IN WCHAR* pwszMachineName,
  1103. IN REGSAM samDesired,
  1104. OUT HKEY* phKeyPeap
  1105. );
  1106. DWORD
  1107. PeapServerConfigDataIO(
  1108. IN BOOL fRead,
  1109. IN WCHAR* pwszMachineName,
  1110. IN OUT BYTE** ppData,
  1111. IN DWORD dwNumBytes
  1112. );
  1113. INT_PTR CALLBACK
  1114. PeapConnDialogProc(
  1115. IN HWND hWnd,
  1116. IN UINT unMsg,
  1117. IN WPARAM wParam,
  1118. IN LPARAM lParam
  1119. );
  1120. INT_PTR CALLBACK
  1121. PeapServerDialogProc(
  1122. IN HWND hWnd,
  1123. IN UINT unMsg,
  1124. IN WPARAM wParam,
  1125. IN LPARAM lParam
  1126. );
  1127. INT_PTR CALLBACK
  1128. DefaultCredDialogProc(
  1129. IN HWND hWnd,
  1130. IN UINT unMsg,
  1131. IN WPARAM wParam,
  1132. IN LPARAM lParam
  1133. );
  1134. DWORD
  1135. GetIdentityFromUserName (
  1136. LPWSTR lpszUserName,
  1137. LPWSTR lpszDomain,
  1138. LPWSTR * ppwszIdentity
  1139. );
  1140. BOOL FFormatUserIdentity (
  1141. LPWSTR lpszUserNameRaw,
  1142. LPWSTR * lppszUserNameFormatted
  1143. );
  1144. DWORD
  1145. GetLocalMachineName (
  1146. OUT WCHAR ** ppLocalMachineName
  1147. );
  1148. BOOL
  1149. IsPeapCrippled(HKEY hKeyLM);
  1150. /////////////////////////////////////////////////////////
  1151. // XPSP1 related stuff
  1152. /////////////////////////////////////////////////////////
  1153. HINSTANCE
  1154. GetResouceDLLHInstance(
  1155. VOID
  1156. );
  1157. #endif // #ifndef _EAPTLS_H_