Leaked source code of windows server 2003
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.

277 lines
8.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: pct1prot.h
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 09-23-97 jbanes LSA integration stuff.
  15. //
  16. //----------------------------------------------------------------------------
  17. #ifndef _PCT1PROT_H_
  18. #define _PCT1PROT_H_
  19. /* keyexchange algs */
  20. #define PCT1_EXCH_RSA_PKCS1 0x0001
  21. #define PCT1_EXCH_RSA_PKCS1_TOKEN_DES 0x0002
  22. #define PCT1_EXCH_RSA_PKCS1_TOKEN_DES3 0x0003
  23. #define PCT1_EXCH_RSA_PKCS1_TOKEN_RC2 0x0004
  24. #define PCT1_EXCH_RSA_PKCS1_TOKEN_RC4 0x0005
  25. #define PCT1_EXCH_DH_PKCS3 0x0006
  26. #define PCT1_EXCH_DH_PKCS3_TOKEN_DES 0x0007
  27. #define PCT1_EXCH_DH_PKCS3_TOKEN_DES3 0x0008
  28. #define PCT1_EXCH_FORTEZZA_TOKEN 0x0009
  29. #define PCT1_EXCH_UNKNOWN 0xffff
  30. /* data encryption algs */
  31. /* encryption alg masks */
  32. #define PCT1_CIPHER_ALG 0xffff0000
  33. #define PCT1_CIPHER_STRENGTH 0x0000ff00
  34. #define PCT1_CSTR_POS 8
  35. #define PCT1_CIPHER_MAC 0x000000ff
  36. /* specific algs */
  37. #define PCT1_CIPHER_DES 0x00010000
  38. #define PCT1_CIPHER_IDEA 0x00020000
  39. #define PCT1_CIPHER_RC2 0x00030000
  40. #define PCT1_CIPHER_RC4 0x00040000
  41. #define PCT1_CIPHER_2DES 0x00050000
  42. #define PCT1_CIPHER_3DES 0x00060000
  43. #define PCT1_CIPHER_SKIPJACK 0x01000000
  44. #define PCT1_CIPHER_NONE 0x00000000
  45. #define PCT1_CIPHER_UNKNOWN 0xffffffff
  46. /* data encryption strength specs */
  47. #define PCT1_ENC_BITS_40 0x00002800
  48. #define PCT1_ENC_BITS_56 0x00003800
  49. #define PCT1_ENC_BITS_64 0x00004000
  50. #define PCT1_ENC_BITS_80 0x00005000
  51. #define PCT1_ENC_BITS_128 0x00008000
  52. #define PCT1_ENC_BITS_168 0x0000a800
  53. #define PCT1_ENC_BITS_192 0x0000c000
  54. /* mac strength specs */
  55. #define PCT1_MAC_BITS_128 0x00000040
  56. /* hashing algs */
  57. #define PCT1_HASH_MD5 0x0001
  58. #define PCT1_HASH_MD5_TRUNC_64 0x0002
  59. #define PCT1_HASH_SHA 0x0003
  60. #define PCT1_HASH_SHA_TRUNC_80 0x0004
  61. #define PCT1_HASH_DES_DM 0x0005
  62. #define PCT1_HASH_MD2 0x0006
  63. #define PCT1_HASH_UNKNOWN 0xffff
  64. /* certificate types */
  65. #define PCT1_CERT_NONE 0x0000
  66. #define PCT1_CERT_X509 0x0001
  67. #define PCT1_CERT_PKCS7 0x0002
  68. #define PCT1_CERT_X509_CHAIN 0x0003
  69. /* signature algorithms */
  70. #define PCT1_SIG_NONE 0x0000
  71. #define PCT1_SIG_RSA_MD5 0x0001
  72. #define PCT1_SIG_RSA_SHA 0x0002
  73. #define PCT1_SIG_DSA_SHA 0x0003
  74. /* these are for internal use only */
  75. #define PCT1_SIG_RSA_MD2 0x0004
  76. #define PCT1_SIG_RSA 0x0005
  77. #define PCT1_SIG_RSA_SHAMD5 0x0006
  78. #define PCT1_SIG_FORTEZZA_TOKEN 0x0007
  79. /* key derivation separators */
  80. #define PCT_CONST_CWK "cwcwcwcwcw"
  81. #define PCT_CONST_CWK_LEN 2
  82. #define PCT_CONST_SWK "svwsvwsvwsvwsvw"
  83. #define PCT_CONST_SWK_LEN 3
  84. #define PCT_CONST_CMK "cmaccmaccmaccmaccmac"
  85. #define PCT_CONST_CMK_LEN 4
  86. #define PCT_CONST_SMK "svmacsvmacsvmacsvmacsvmac"
  87. #define PCT_CONST_SMK_LEN 5
  88. #define PCT_CONST_SR "svsvsvsvsv"
  89. #define PCT_CONST_SR_LEN 2
  90. #define PCT_CONST_SLK "slslslslsl"
  91. #define PCT_CONST_SLK_LEN 2
  92. #define PCT_CONST_RESP "srsrsrsrsr"
  93. #define PCT_CONST_RESP_LEN 2
  94. #define PCT_CONST_VP "cvp"
  95. #define PCT_CONST_VP_LEN 3
  96. #define PCT_USE_CERT 1
  97. #define PCT_MAKE_MAC 2
  98. #define DERIVATION_BUFFER_SIZE 1024
  99. /* data structs */
  100. /* message constants and types */
  101. #define PCT_MASTER_KEY_SIZE 16
  102. #define PCT_SESSION_ID_SIZE 32
  103. #define PCT_CHALLENGE_SIZE 32
  104. #define PCT1_MAX_KEY_ARGS 8
  105. #define RESPONSE_SIZE 32 /* allows for hash output growth */
  106. #define PCT_MAX_SHAKE_LEN 32768 /* longest handshake message len */
  107. /* implementation constants */
  108. #define PCT_MAX_NUM_SEP 5
  109. #define PCT_MAX_SEP_LEN 5
  110. #define PCT1_MAX_CERT_SPECS 5
  111. #define PCT1_MAX_SIG_SPECS 5
  112. #define PCT1_MAX_EXCH_SPECS 5
  113. #define PCT1_MAX_CIPH_SPECS 16
  114. #define PCT1_MAX_HASH_SPECS 16
  115. /* mismatch vector */
  116. #define PCT_NUM_MISMATCHES 6
  117. #define PCT_IMIS_CIPHER 1
  118. #define PCT_IMIS_HASH 2
  119. #define PCT_IMIS_CERT 4
  120. #define PCT_IMIS_EXCH 8
  121. #define PCT_IMIS_CL_CERT 16
  122. #define PCT_IMIS_CL_SIG 32
  123. SP_STATUS WINAPI
  124. Pct1ServerProtocolHandler(
  125. PSPContext pContext,
  126. PSPBuffer pCommInput,
  127. PSPBuffer pCommOutput);
  128. SP_STATUS WINAPI
  129. Pct1ClientProtocolHandler(
  130. PSPContext pContext,
  131. PSPBuffer pCommInput,
  132. PSPBuffer pCommOutput);
  133. SP_STATUS WINAPI
  134. Pct1DecryptHandler(
  135. PSPContext pContext,
  136. PSPBuffer pCommInput,
  137. PSPBuffer pAppOutput);
  138. SP_STATUS WINAPI
  139. Pct1GetHeaderSize(
  140. PSPContext pContext,
  141. PSPBuffer pCommInput,
  142. DWORD * pcbHeaderSize);
  143. SP_STATUS WINAPI Pct1DecryptMessage(PSPContext pContext,
  144. PSPBuffer pCommInput,
  145. PSPBuffer pAppOutput);
  146. SP_STATUS WINAPI Pct1EncryptRaw(PSPContext pContext,
  147. PSPBuffer pAppInput,
  148. PSPBuffer pCommOutput,
  149. DWORD dwFlags);
  150. #define PCT1_ENCRYPT_ESCAPE 0x00000001
  151. SP_STATUS WINAPI Pct1EncryptMessage(PSPContext pContext,
  152. PSPBuffer pAppInput,
  153. PSPBuffer pCommOutput);
  154. SP_STATUS Pct1SrvHandleClientHello(PSPContext pContext,
  155. PSPBuffer pCommInput,
  156. PPct1_Client_Hello pHello,
  157. PSPBuffer pCommOutput);
  158. SP_STATUS Pct1SrvHandleCMKey(PSPContext pContext,
  159. PSPBuffer pCommInput,
  160. PSPBuffer pCommOutput);
  161. SP_STATUS Pct1CliHandleServerHello(PSPContext pContext,
  162. PSPBuffer pCommInput,
  163. PPct1_Server_Hello pHello,
  164. PSPBuffer pCommOutput);
  165. SP_STATUS Pct1CliHandleServerVerify(PSPContext pContext,
  166. PSPBuffer pCommInput,
  167. PSPBuffer pCommOutput);
  168. SP_STATUS Pct1HandleError(PSPContext pContext,
  169. PSPBuffer pCommInput,
  170. PSPBuffer pCommOutput);
  171. SP_STATUS Pct1GenerateError(PSPContext pContext,
  172. PSPBuffer pCommOutput,
  173. SP_STATUS pError,
  174. PSPBuffer pErrData);
  175. SP_STATUS
  176. WINAPI
  177. GeneratePct1StyleHello(
  178. PSPContext pContext,
  179. PSPBuffer pOutput);
  180. SP_STATUS
  181. Pct1CliRestart(PSPContext pContext,
  182. PPct1_Server_Hello pHello,
  183. PSPBuffer pCommOutput);
  184. SP_STATUS
  185. Pct1SrvRestart(PSPContext pContext,
  186. PPct1_Client_Hello pHello,
  187. PSPBuffer pCommOutput);
  188. VOID
  189. Pct1ActivateSessionKeys(PSPContext pContext);
  190. SP_STATUS
  191. Pct1MakeSessionKeys(PSPContext pContext);
  192. SP_STATUS Pct1EndVerifyPrelude(PSPContext pContext,
  193. PUCHAR VerifyPrelude,
  194. DWORD * pcbVerifyPrelude
  195. );
  196. SP_STATUS Pct1BeginVerifyPrelude(PSPContext pContext,
  197. PUCHAR pClientHello,
  198. DWORD cbClientHello,
  199. PUCHAR pServerHello,
  200. DWORD cbServerHello);
  201. SP_STATUS
  202. Pct1ComputeResponse(
  203. PSPContext pContext,
  204. PBYTE pbChallenge,
  205. DWORD cbChallenge,
  206. PBYTE pbConnectionID,
  207. DWORD cbConnectionID,
  208. PBYTE pbSessionID,
  209. DWORD cbSessionID,
  210. PBYTE pbResponse,
  211. PDWORD pcbResponse);
  212. #endif /* _PCT1PROT_H_ */