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.

75 lines
1.8 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. sha2.h
  5. Abstract:
  6. This module contains the public data structures and API definitions
  7. needed to utilize the low-level SHA2 (256/384/512) FIPS 180-2
  8. Author:
  9. Scott Field (SField) 11-Jun-2001
  10. Revision History:
  11. --*/
  12. #ifndef RSA32API
  13. #define RSA32API __stdcall
  14. #endif
  15. #ifndef _SHA2_H_
  16. #define _SHA2_H_ 1
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. #define SHA256_DIGEST_LEN (32)
  21. #define SHA384_DIGEST_LEN (48)
  22. #define SHA512_DIGEST_LEN (64)
  23. typedef struct {
  24. union {
  25. #if _WIN64
  26. ULONGLONG state64[4]; /* force alignment */
  27. #endif
  28. ULONG state[8]; /* state (ABCDEFGH) */
  29. };
  30. ULONG count[2]; /* number of bytes, msb first */
  31. unsigned char buffer[64]; /* input buffer */
  32. } SHA256_CTX, *PSHA256_CTX;
  33. typedef struct {
  34. ULONGLONG state[8]; /* state (ABCDEFGH) */
  35. ULONGLONG count[2]; /* number of bytes, msb first */
  36. unsigned char buffer[128]; /* input buffer */
  37. } SHA512_CTX, *PSHA512_CTX;
  38. #define SHA384_CTX SHA512_CTX
  39. void RSA32API SHA256Init(SHA256_CTX *);
  40. void RSA32API SHA256Update(SHA256_CTX *, unsigned char *, unsigned int);
  41. void RSA32API SHA256Final(SHA256_CTX *, unsigned char [SHA256_DIGEST_LEN]);
  42. void RSA32API SHA512Init(SHA512_CTX *);
  43. void RSA32API SHA512Update(SHA512_CTX *, unsigned char *, unsigned int);
  44. void RSA32API SHA512Final(SHA512_CTX *, unsigned char [SHA512_DIGEST_LEN]);
  45. void RSA32API SHA384Init(SHA384_CTX *);
  46. #define SHA384Update SHA512Update
  47. void RSA32API SHA384Final(SHA384_CTX *, unsigned char [SHA384_DIGEST_LEN]);
  48. #ifdef __cplusplus
  49. }
  50. #endif
  51. #endif