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.

54 lines
1.2 KiB

  1. #ifndef __HMAC_H__
  2. #define __HMAC_H__
  3. #ifndef RSA32API
  4. #define RSA32API __stdcall
  5. #endif
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. // include "md5.h" before this
  10. typedef struct {
  11. MD5_CTX context_ipad;
  12. MD5_CTX context_opad;
  13. } HMACMD5_CTX;
  14. // Initialize an HMAC context with a session key
  15. // Afterword, context can be used to sign messages with the session key
  16. //
  17. void
  18. RSA32API
  19. HMACMD5Init(
  20. HMACMD5_CTX * pCtx, // IN, OUT -- the context to initialize
  21. unsigned char *pKey, // IN -- the session key
  22. unsigned int cKey // IN -- session key length
  23. );
  24. // Update the signature of a message
  25. // takes a fragment of a message, updates signature for that fragment
  26. void
  27. RSA32API
  28. HMACMD5Update(
  29. HMACMD5_CTX * pCtx, // IN, OUT -- context of signature to update
  30. unsigned char *pMsg, // IN -- message fragment
  31. unsigned int cMsg // IN -- message length
  32. );
  33. // Get the signature out of the context, reset for next message
  34. //
  35. void
  36. RSA32API
  37. HMACMD5Final(
  38. HMACMD5_CTX * pCtx, // IN, OUT -- the context
  39. unsigned char Hash[MD5DIGESTLEN] // OUT -- the signature
  40. );
  41. #ifdef __cplusplus
  42. }
  43. #endif
  44. #endif // __HMAC_H__