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.

73 lines
2.1 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // FILE : randlib.h //
  3. // DESCRIPTION : //
  4. // AUTHOR : //
  5. // HISTORY : //
  6. // Oct 11 1996 jeffspel moved from ntagimp1.h //
  7. // //
  8. // Copyright (C) Microsoft Corporation, 1993 - 1999All Rights Reserved //
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef __RANDLIB_H__
  11. #define __RANDLIB_H__
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. // Additons for the New CryptGenRandom
  16. // #defines
  17. #define RAND_CTXT_LEN 60
  18. #define RC4_REKEY_PARAM 500 // rekey every 500 bytes
  19. typedef struct _RandContext
  20. {
  21. DWORD dwBitsFilled;
  22. BYTE rgbBitBuffer[RAND_CTXT_LEN];
  23. } RandContext;
  24. // prototypes
  25. BOOL NewGenRandom (
  26. IN OUT PBYTE *ppbRandSeed,
  27. IN PDWORD pcbRandSeed,
  28. IN OUT BYTE *pbBuffer,
  29. IN size_t dwLength
  30. );
  31. BOOL InitRand(
  32. IN OUT PBYTE *ppbRandSeed,
  33. IN PDWORD pcbRandSeed
  34. );
  35. BOOL DeInitRand(
  36. IN OUT PBYTE pbRandSeed,
  37. IN DWORD cbRandSeed
  38. );
  39. // DO NOT USE THIS CALL ANYMORE SHOULD ONLY BE USED BY RSA32 BSafeMakeKeyPair
  40. // Instead now use NewGenRandom
  41. BOOL GenRandom (
  42. IN HCRYPTPROV hUID,
  43. OUT BYTE *pbBuffer,
  44. IN size_t dwLength
  45. );
  46. BOOL RandomFillBuffer(
  47. OUT BYTE *pbBuffer,
  48. IN DWORD *pdwLength
  49. );
  50. void GatherRandomBits(
  51. IN OUT RandContext *prandContext
  52. );
  53. void AppendRand(RandContext* prandContext, void* pv, DWORD dwSize);
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif // __RANDLIB_H__