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.

62 lines
1.6 KiB

  1. #include <wincrypt.h>
  2. #ifndef _WZCCRYPT_H_
  3. #define _WZCCRYPT_H_
  4. #define MASTER_SESSION_KEY_LENGTH 32
  5. #define MASTER_SESSION_IV_LENGTH 32
  6. typedef struct _MASTER_SESSION_KEYS {
  7. BYTE bPeerEncryptionKey[MASTER_SESSION_KEY_LENGTH];
  8. BYTE bAuthenticatorEncryptionKey[MASTER_SESSION_KEY_LENGTH];
  9. BYTE bPeerAuthenticationKey[MASTER_SESSION_KEY_LENGTH];
  10. BYTE bAuthenticatorAuthenticationKey[MASTER_SESSION_KEY_LENGTH];
  11. BYTE bPeerIV[MASTER_SESSION_IV_LENGTH];
  12. BYTE bAuthenticatorIV[MASTER_SESSION_IV_LENGTH];
  13. } MASTER_SESSION_KEYS, *PMASTER_SESSION_KEYS;
  14. DWORD
  15. GenerateMasterSessionKeys (
  16. PBYTE pbSecret,
  17. DWORD cbSecret,
  18. PBYTE pbRandom,
  19. DWORD cbRandom,
  20. PMASTER_SESSION_KEYS pMasterSessionKeys
  21. );
  22. #define MAX_SESSION_KEY_LENGTH 32
  23. #define csz_CLIENT_EAP_ENCRYPTION "client EAP encryption"
  24. typedef struct _SESSION_KEYS {
  25. DWORD dwKeyLength;
  26. BYTE bSendKey[MAX_SESSION_KEY_LENGTH];
  27. BYTE bReceiveKey[MAX_SESSION_KEY_LENGTH];
  28. } SESSION_KEYS, *PSESSION_KEYS;
  29. // secured session keys
  30. typedef struct _SEC_SESSION_KEYS {
  31. DATA_BLOB dblobSendKey;
  32. DATA_BLOB dblobReceiveKey;
  33. } SEC_SESSION_KEYS, *PSEC_SESSION_KEYS;
  34. DWORD
  35. DeriveSessionKeys (
  36. PBYTE pbMasterSendKey,
  37. PBYTE pbMasterReceiveKey,
  38. DWORD dwSessionKeyLength,
  39. PSESSION_KEYS pSessionKeys
  40. );
  41. DWORD
  42. GenerateDynamicKeys (
  43. PBYTE pbMasterSecret,
  44. DWORD dwMasterSecretLength,
  45. PBYTE pbRandom,
  46. DWORD dwRandomLength,
  47. DWORD dwDynamicKeyLength,
  48. SESSION_KEYS *pSessionKeys
  49. );
  50. #endif // _WZCCRYPT_H_