Portable build framework for OpenNTPD
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.

59 lines
1.9 KiB

  1. /*
  2. * Public domain
  3. * md5.h compatibility shim
  4. */
  5. #ifdef HAVE_MD5_H
  6. #include_next <md5.h>
  7. #else
  8. #include "md5_openbsd.h"
  9. #endif
  10. /* $OpenBSD: md5.h,v 1.16 2004/06/22 01:57:30 jfb Exp $ */
  11. /*
  12. * This code implements the MD5 message-digest algorithm.
  13. * The algorithm is due to Ron Rivest. This code was
  14. * written by Colin Plumb in 1993, no copyright is claimed.
  15. * This code is in the public domain; do with it what you wish.
  16. *
  17. * Equivalent code is available from RSA Data Security, Inc.
  18. * This code has been tested against that, and is equivalent,
  19. * except that you don't need to include two pages of legalese
  20. * with every copy.
  21. */
  22. #ifndef _MD5_H_
  23. #define _MD5_H_
  24. #define MD5_BLOCK_LENGTH 64
  25. #define MD5_DIGEST_LENGTH 16
  26. #define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_LENGTH * 2 + 1)
  27. typedef struct MD5Context {
  28. u_int32_t state[4]; /* state */
  29. u_int64_t count; /* number of bits, mod 2^64 */
  30. u_int8_t buffer[MD5_BLOCK_LENGTH]; /* input buffer */
  31. } MD5_CTX;
  32. __BEGIN_DECLS
  33. void MD5Init(MD5_CTX *);
  34. void MD5Update(MD5_CTX *, const u_int8_t *, size_t)
  35. __attribute__((__bounded__(__string__,2,3)));
  36. void MD5Pad(MD5_CTX *);
  37. void MD5Final(u_int8_t [MD5_DIGEST_LENGTH], MD5_CTX *)
  38. __attribute__((__bounded__(__minbytes__,1,MD5_DIGEST_LENGTH)));
  39. void MD5Transform(u_int32_t [4], const u_int8_t [MD5_BLOCK_LENGTH])
  40. __attribute__((__bounded__(__minbytes__,1,4)))
  41. __attribute__((__bounded__(__minbytes__,2,MD5_BLOCK_LENGTH)));
  42. char *MD5End(MD5_CTX *, char *)
  43. __attribute__((__bounded__(__minbytes__,2,MD5_DIGEST_STRING_LENGTH)));
  44. char *MD5File(const char *, char *)
  45. __attribute__((__bounded__(__minbytes__,2,MD5_DIGEST_STRING_LENGTH)));
  46. char *MD5FileChunk(const char *, char *, off_t, off_t)
  47. __attribute__((__bounded__(__minbytes__,2,MD5_DIGEST_STRING_LENGTH)));
  48. char *MD5Data(const u_int8_t *, size_t, char *)
  49. __attribute__((__bounded__(__string__,1,2)))
  50. __attribute__((__bounded__(__minbytes__,3,MD5_DIGEST_STRING_LENGTH)));
  51. __END_DECLS
  52. #endif /* _MD5_H_ */