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.

126 lines
3.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: keyexch.h
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 10-21-97 jbanes CAPI integration.
  15. //
  16. //----------------------------------------------------------------------------
  17. #ifndef __KEYEXCH_H__
  18. #define __KEYEXCH_H__
  19. typedef struct _SPContext SPContext;
  20. typedef struct _PUBLICKEY
  21. {
  22. BLOBHEADER * pPublic;
  23. DWORD cbPublic;
  24. // CRYPT_OBJID_BLOB Parameters;
  25. } PUBLICKEY, *PPUBLICKEY;
  26. SP_STATUS
  27. MakeSessionKeys(
  28. SPContext * pContext,
  29. HCRYPTPROV hProv,
  30. HCRYPTKEY hMasterKey);
  31. VOID
  32. ReverseMemCopy(
  33. PUCHAR Dest,
  34. PUCHAR Source,
  35. ULONG Size) ;
  36. void ReverseInPlace(PUCHAR pByte, DWORD cbByte);
  37. typedef
  38. SP_STATUS
  39. (WINAPI * GenerateServerExchangeValueFn)(
  40. SPContext * pContext, // in
  41. PUCHAR pServerExchangeValue, // out
  42. DWORD * pcbServerExchangeValue // in/out
  43. );
  44. typedef
  45. SP_STATUS
  46. (WINAPI * GenerateClientExchangeValueFn)(
  47. SPContext * pContext, // in / out
  48. PUCHAR pServerExchangeValue, // in
  49. DWORD pcbServerExchangeValue, // in
  50. PUCHAR pClientClearValue, // out
  51. DWORD * pcbClientClearValue, // in/out
  52. PUCHAR pClientExchangeValue, // out
  53. DWORD * pcbClientExchangeValue // in/out
  54. );
  55. typedef
  56. SP_STATUS
  57. (WINAPI * GenerateServerMasterKeyFn)(
  58. SPContext * pContext, // in
  59. PUCHAR pClientClearValue, // in
  60. DWORD cbClientClearValue, // in
  61. PUCHAR pClientExchangeValue, // in
  62. DWORD cbClientExchangeValue // in
  63. );
  64. typedef struct _KeyExchangeSystem {
  65. DWORD Type;
  66. PSTR pszName;
  67. // PrivateFromBlobFn PrivateFromBlob;
  68. GenerateServerExchangeValueFn GenerateServerExchangeValue;
  69. GenerateClientExchangeValueFn GenerateClientExchangeValue;
  70. GenerateServerMasterKeyFn GenerateServerMasterKey;
  71. } KeyExchangeSystem, * PKeyExchangeSystem;
  72. typedef struct kexchtoalg {
  73. ALG_ID idAlg;
  74. KeyExchangeSystem *System;
  75. } AlgToExch;
  76. extern AlgToExch g_AlgToExchMapping[];
  77. extern int g_iAlgToExchMappings;
  78. #define DSA_SIGNATURE_SIZE 40
  79. #define MAX_DSA_ENCODED_SIGNATURE_SIZE (DSA_SIGNATURE_SIZE + 100)
  80. #define MAGIC_DSS1 ((DWORD)'D' + ((DWORD)'S'<<8) + ((DWORD)'S'<<16) + ((DWORD)'1'<<24))
  81. #define MAGIC_DSS2 ((DWORD)'D' + ((DWORD)'S'<<8) + ((DWORD)'S'<<16) + ((DWORD)'2'<<24))
  82. #define MAGIC_DSS3 ((DWORD)'D' + ((DWORD)'S'<<8) + ((DWORD)'S'<<16) + ((DWORD)'3'<<24))
  83. #define MAGIC_DH1 ( ((DWORD)'D'<<8) + ((DWORD)'H'<<16) + ((DWORD)'1'<<24))
  84. /*
  85. * instantiations of systems
  86. */
  87. extern KeyExchangeSystem keyexchPKCS;
  88. extern KeyExchangeSystem keyexchDH;
  89. // PROV_RSA_SCHANNEL handle used when building ClientHello messages.
  90. extern HCRYPTPROV g_hRsaSchannel;
  91. extern PROV_ENUMALGS_EX * g_pRsaSchannelAlgs;
  92. extern DWORD g_cRsaSchannelAlgs;
  93. // PROV_DH_SCHANNEL handle used for client and server operations. This is
  94. // where the schannel ephemeral DH key lives.
  95. extern HCRYPTPROV g_hDhSchannelProv;
  96. extern PROV_ENUMALGS_EX * g_pDhSchannelAlgs;
  97. extern DWORD g_cDhSchannelAlgs;
  98. #endif /* __KEYEXCH_H__ */