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.

115 lines
2.9 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // FILE : schderiv.h //
  3. // DESCRIPTION : //
  4. // AUTHOR : //
  5. // HISTORY : //
  6. // Oct 9 1997 jeffspel Create //
  7. // //
  8. // Copyright (C) 1993 Microsoft Corporation All Rights Reserved //
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef __SCHDERIV_H__
  11. #define __SCHDERIV_H__
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #define RC_KEYLEN 16
  16. #define MAX_PREMASTER_LEN 512 // DH key must be <= 4096 bits
  17. #define MAX_RANDOM_LEN 256
  18. #define TLS_MASTER_LEN 48
  19. #define SSL3_MASTER_LEN 48
  20. // definition of a Secure Channel hash structure
  21. typedef struct _SCH_KeyData
  22. {
  23. BYTE rgbPremaster[MAX_PREMASTER_LEN];
  24. DWORD cbPremaster;
  25. BYTE rgbClientRandom[MAX_RANDOM_LEN];
  26. DWORD cbClientRandom;
  27. BYTE rgbServerRandom[MAX_RANDOM_LEN];
  28. DWORD cbServerRandom;
  29. ALG_ID EncAlgid;
  30. ALG_ID HashAlgid;
  31. DWORD cbEnc;
  32. DWORD cbEncMac;
  33. DWORD cbHash;
  34. DWORD cbIV;
  35. BOOL fFinished;
  36. BOOL dwFlags;
  37. } SCH_KEY, *PSCH_KEY;
  38. // definition of a Secure Channel hash structure
  39. typedef struct _SCH_HashData
  40. {
  41. ALG_ID ProtocolAlgid;
  42. ALG_ID EncAlgid;
  43. ALG_ID HashAlgid;
  44. DWORD cbEnc;
  45. DWORD cbEncMac;
  46. DWORD cbHash;
  47. DWORD cbIV;
  48. BYTE rgbClientRandom[MAX_RANDOM_LEN];
  49. DWORD cbClientRandom;
  50. BYTE rgbServerRandom[MAX_RANDOM_LEN];
  51. DWORD cbServerRandom;
  52. BYTE rgbFinal[MAX_RANDOM_LEN];
  53. DWORD cbFinal;
  54. BOOL dwFlags;
  55. } SCH_HASH, *PSCH_HASH;
  56. // definition of a TLS1 PRF hash structure
  57. typedef struct _PRF_HashData
  58. {
  59. BYTE rgbLabel[MAX_RANDOM_LEN];
  60. DWORD cbLabel;
  61. BYTE rgbSeed[MAX_RANDOM_LEN];
  62. DWORD cbSeed;
  63. BYTE rgbMasterKey[TLS_MASTER_LEN];
  64. } PRF_HASH;
  65. extern DWORD
  66. SCHSetKeyParam(
  67. IN Context_t *pContext,
  68. IN Key_t *pKey,
  69. IN DWORD dwParam,
  70. IN CONST BYTE *pbData);
  71. extern BOOL
  72. SCHGetKeyParam(
  73. Key_t *pKey,
  74. DWORD dwParam,
  75. PBYTE pbData);
  76. extern DWORD
  77. SChGenMasterKey(
  78. Key_t *pKey,
  79. PSCH_HASH pSChHash);
  80. extern DWORD
  81. SecureChannelDeriveKey(
  82. Hash_t *pHash,
  83. ALG_ID Algid,
  84. DWORD dwFlags,
  85. HCRYPTKEY *phKey);
  86. extern DWORD
  87. SetPRFHashParam(
  88. PRF_HASH *pPRFHash,
  89. DWORD dwParam,
  90. CONST BYTE *pbData);
  91. extern DWORD
  92. CalculatePRF(
  93. PRF_HASH *pPRFHash,
  94. BYTE *pbData,
  95. DWORD *pcbData);
  96. #ifdef __cplusplus
  97. }
  98. #endif
  99. #endif // __SCHDERIV_H__