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.

79 lines
1.5 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // File: cbckey.h
  4. //
  5. // Microsoft Digital Rights Management
  6. // Copyright (C) Microsoft Corporation, 1998 - 1999, All Rights Reserved
  7. //
  8. // Description:
  9. //
  10. //-----------------------------------------------------------------------------
  11. #ifndef __CBCMAC_H__
  12. #define __CBCMAC_H__
  13. // #define _TEST_MAC to compile code in a "default" environment
  14. #ifndef _TEST_MAC
  15. #define _TEST_MAC
  16. #endif
  17. #ifdef _TEST_MAC
  18. #define SHCLASS
  19. #endif
  20. typedef struct _CBCKey {
  21. UINT32 a1, b1, c1, d1, e1, f1, a2, b2, c2, d2, e2, f2;
  22. } CBCKey;
  23. UINT32 CBC64WS4_asm(
  24. UINT32 *Data,
  25. unsigned NumDWORDBlocks,
  26. UINT32 *pKey2,
  27. CBCKey key );
  28. UINT32 InvCBC64WS4_asm(
  29. UINT32 *Data,
  30. unsigned NumDWORDBlocks,
  31. UINT32 *pKey2,
  32. CBCKey key,
  33. CBCKey ikey );
  34. UINT32 inv32(UINT32 n);
  35. typedef struct {
  36. UINT32 sum,t;
  37. BYTE buf[8];
  38. DWORD dwBufLen;
  39. } CBCState;
  40. void CBC64Init( CBCKey *cbckey, CBCState *cbcstate, BYTE *pKey );
  41. void CBC64InitState( CBCState *cbcstate );
  42. void CBC64InvKey( CBCKey *cbcKey, CBCKey *cbcInvKey );
  43. void CBC64Update( CBCKey *key, CBCState *cbcstate,DWORD dwLen, BYTE *pData );
  44. UINT32 CBC64Finalize( CBCKey *key, CBCState *cbcstate, UINT32 *pKey2 );
  45. UINT32 CBC64Invert( CBCKey *key, CBCKey *ikey, UINT32 MacA1, UINT32 MacA2,
  46. UINT32 MacB1, UINT32 MacB2, UINT32 *pInvKey2 );
  47. #endif