Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
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.

52 lines
1.9 KiB

  1. /* $OpenBSD: md4.h,v 1.15 2004/06/22 01:57:30 jfb Exp $ */
  2. /*
  3. * This code implements the MD4 message-digest algorithm.
  4. * The algorithm is due to Ron Rivest. This code was
  5. * written by Colin Plumb in 1993, no copyright is claimed.
  6. * This code is in the public domain; do with it what you wish.
  7. * Todd C. Miller modified the MD5 code to do MD4 based on RFC 1186.
  8. *
  9. * Equivalent code is available from RSA Data Security, Inc.
  10. * This code has been tested against that, and is equivalent,
  11. * except that you don't need to include two pages of legalese
  12. * with every copy.
  13. */
  14. #ifndef _MD4_H_
  15. #define _MD4_H_
  16. #define MD4_BLOCK_LENGTH 64
  17. #define MD4_DIGEST_LENGTH 16
  18. #define MD4_DIGEST_STRING_LENGTH (MD4_DIGEST_LENGTH * 2 + 1)
  19. typedef struct MD4Context {
  20. u_int32_t state[4]; /* state */
  21. u_int64_t count; /* number of bits, mod 2^64 */
  22. u_int8_t buffer[MD4_BLOCK_LENGTH]; /* input buffer */
  23. } MD4_CTX;
  24. #include <sys/cdefs.h>
  25. __BEGIN_DECLS
  26. void MD4Init(MD4_CTX *);
  27. void MD4Update(MD4_CTX *, const u_int8_t *, size_t)
  28. __attribute__((__bounded__(__string__,2,3)));
  29. void MD4Pad(MD4_CTX *);
  30. void MD4Final(u_int8_t [MD4_DIGEST_LENGTH], MD4_CTX *)
  31. __attribute__((__bounded__(__minbytes__,1,MD4_DIGEST_LENGTH)));
  32. void MD4Transform(u_int32_t [4], const u_int8_t [MD4_BLOCK_LENGTH])
  33. __attribute__((__bounded__(__minbytes__,1,4)))
  34. __attribute__((__bounded__(__minbytes__,2,MD4_BLOCK_LENGTH)));
  35. char *MD4End(MD4_CTX *, char *)
  36. __attribute__((__bounded__(__minbytes__,2,MD4_DIGEST_STRING_LENGTH)));
  37. char *MD4File(const char *, char *)
  38. __attribute__((__bounded__(__minbytes__,2,MD4_DIGEST_STRING_LENGTH)));
  39. char *MD4FileChunk(const char *, char *, off_t, off_t)
  40. __attribute__((__bounded__(__minbytes__,2,MD4_DIGEST_STRING_LENGTH)));
  41. char *MD4Data(const u_int8_t *, size_t, char *)
  42. __attribute__((__bounded__(__string__,1,2)))
  43. __attribute__((__bounded__(__minbytes__,3,MD4_DIGEST_STRING_LENGTH)));
  44. __END_DECLS
  45. #endif /* _MD4_H_ */