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.

70 lines
2.3 KiB

  1. typedef struct _DESKey
  2. {
  3. BYTE rgbKey[DES_BLOCKLEN];
  4. DESTable sKeyTable;
  5. } DESKEY, *PDESKEY;
  6. // assumes pbKeyMaterial is at least DES_BLOCKLEN bytes
  7. BOOL FMyMakeDESKey(
  8. PDESKEY pDESKey, // out
  9. BYTE* pbKeyMaterial); // in
  10. BOOL FMyPrimitiveSHA(
  11. PBYTE pbData, // in
  12. DWORD cbData, // in
  13. BYTE rgbHash[A_SHA_DIGEST_LEN]); // out
  14. BOOL FMyPrimitiveDESDecrypt(
  15. PBYTE pbBlock, // in out
  16. DWORD *pcbBlock, // in out
  17. DESKEY sDESKey); // in
  18. BOOL FMyPrimitiveDESEncrypt(
  19. PBYTE* ppbBlock, // in out
  20. DWORD* pcbBlock, // in out
  21. DESKEY sDESKey); // in
  22. BOOL FMyPrimitiveDeriveKey(
  23. PBYTE pbSalt, // in
  24. DWORD cbSalt, // in
  25. PBYTE pbOtherData, // in [optional]
  26. DWORD cbOtherData, // in
  27. DESKEY* pDesKey); // out
  28. BOOL FMyOldPrimitiveHMAC(
  29. DESKEY sMacKey, // in
  30. PBYTE pbData, // in
  31. DWORD cbData, // in
  32. BYTE rgbHMAC[A_SHA_DIGEST_LEN]); // out
  33. BOOL FMyPrimitiveHMAC(
  34. DESKEY sMacKey, // in
  35. PBYTE pbData, // in
  36. DWORD cbData, // in
  37. BYTE rgbHMAC[A_SHA_DIGEST_LEN]); // out
  38. BOOL FMyPrimitiveHMACParam(
  39. PBYTE pbKeyMaterial, // in
  40. DWORD cbKeyMaterial, // in
  41. PBYTE pbData, // in
  42. DWORD cbData, // in
  43. BYTE rgbHMAC[A_SHA_DIGEST_LEN]); // out
  44. #define PBKDF2_MAX_SALT_SIZE (16)
  45. BOOL PKCS5DervivePBKDF2(
  46. PBYTE pbKeyMaterial,
  47. DWORD cbKeyMaterial,
  48. PBYTE pbSalt,
  49. DWORD cbSalt,
  50. DWORD KeyGenAlg,
  51. DWORD cIterationCount,
  52. DWORD iBlockIndex,
  53. BYTE rgbPKCS5Key[A_SHA_DIGEST_LEN] // output buffer
  54. );