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.

163 lines
3.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1997.
  5. //
  6. // File: cryptkey.h
  7. //
  8. // Contents: Functions that are used to pack and unpack different messages
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 12-23-97 v-sbhatt Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #ifndef _CRYPTKEY_H_
  18. #define _CRYPTKEY_H_
  19. //
  20. // Generic CryptSystem structure to be used for all cryptographic operations
  21. //
  22. typedef struct _CryptSystem
  23. {
  24. DWORD dwCryptState; //State in which the system is in
  25. DWORD dwSignatureAlg; //Signature AlgID
  26. DWORD dwKeyExchAlg; //KeyExchAlgID
  27. DWORD dwSessKeyAlg; //Symmetric Key ALg
  28. DWORD dwMACAlg; //MAC algID
  29. UCHAR rgbClientRandom[LICENSE_RANDOM]; //Client Random
  30. UCHAR rgbServerRandom[LICENSE_RANDOM]; //ServerRandom
  31. UCHAR rgbPreMasterSecret[LICENSE_PRE_MASTER_SECRET]; //Place for pms and ms
  32. UCHAR rgbMACSaltKey[LICENSE_MAC_WRITE_KEY];
  33. UCHAR rgbSessionKey[LICENSE_SESSION_KEY];
  34. }CryptSystem, *PCryptSystem;
  35. #define CRYPT_SYSTEM_STATE_INITIALIZED 0x00000000
  36. #define CRYPT_SYSTEM_STATE_PRE_MASTER_SECRET 0x00000001
  37. #define CRYPT_SYSTEM_STATE_MASTER_SECRET 0x00000002
  38. #define CRYPT_SYSTEM_STATE_SESSION_KEY 0x00000003
  39. #define CRYPT_SYSTEM_STATE_MAC_DONE 0x00000004
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. LICENSE_STATUS
  44. CALL_TYPE
  45. LicenseSetPreMasterSecret(
  46. PCryptSystem pCrypt,
  47. PUCHAR pPreMasterSecret
  48. );
  49. LICENSE_STATUS
  50. CALL_TYPE
  51. LicenseBuildMasterSecret(
  52. PCryptSystem pSystem
  53. );
  54. LICENSE_STATUS
  55. CALL_TYPE
  56. LicenseMakeSessionKeys(
  57. PCryptSystem pCrypt,
  58. DWORD dwReserved
  59. );
  60. LICENSE_STATUS
  61. CALL_TYPE
  62. LicenseVerifyServerCert(
  63. PHydra_Server_Cert pCert
  64. );
  65. LICENSE_STATUS
  66. CALL_TYPE
  67. LicenseGenerateMAC(
  68. PCryptSystem pCrypt,
  69. PBYTE pbData,
  70. DWORD cbData,
  71. PBYTE pbMACData
  72. );
  73. LICENSE_STATUS
  74. CALL_TYPE
  75. LicenseEnvelopeData(
  76. PBYTE pbPublicKey,
  77. DWORD cbPublicKey,
  78. PBYTE pbData,
  79. DWORD cbData,
  80. PBYTE pbEnvelopedData,
  81. DWORD *cbEnvelopedData
  82. );
  83. LICENSE_STATUS
  84. CALL_TYPE
  85. LicenseDecryptEnvelopedData(
  86. PBYTE pbPrivateKey,
  87. DWORD cbPrivateKey,
  88. PBYTE pbEnvelopedData,
  89. DWORD cbEnvelopedData,
  90. PBYTE pbData,
  91. DWORD *pcbData );
  92. LICENSE_STATUS
  93. CALL_TYPE
  94. LicenseEncryptSessionData(
  95. PCryptSystem pCrypt,
  96. PBYTE pbData,
  97. DWORD cbData
  98. );
  99. LICENSE_STATUS
  100. CALL_TYPE
  101. LicenseDecryptSessionData(
  102. PCryptSystem pCrypt,
  103. PBYTE pbData,
  104. DWORD cbData
  105. );
  106. //Temporarily declared and defined in Cryptkey.h and .c
  107. LICENSE_STATUS
  108. CALL_TYPE
  109. GenerateClientHWID(
  110. PHWID phwid
  111. );
  112. LICENSE_STATUS
  113. CALL_TYPE
  114. LicenseEncryptHwid(
  115. PHWID pHwid,
  116. PDWORD pcbEncryptedHwid,
  117. PBYTE pEncryptedHwid,
  118. DWORD cbSecretKey,
  119. PBYTE pSecretKey );
  120. LICENSE_STATUS
  121. CALL_TYPE
  122. LicenseDecryptHwid(
  123. PHWID pHwid,
  124. DWORD cbEncryptedHwid,
  125. PBYTE pEncryptedHwid,
  126. DWORD cbSecretKey,
  127. PBYTE pSecretKey );
  128. LICENSE_STATUS
  129. CALL_TYPE
  130. UnpackHydraServerCertificate(
  131. PBYTE pbMessage,
  132. DWORD cbMessage,
  133. PHydra_Server_Cert pCanonical );
  134. #ifdef __cplusplus
  135. }
  136. #endif
  137. #endif //_CRYPTKEY_H_