md5.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * MD5 hash implementation and interface functions
  3. * Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * Alternatively, this software may be distributed under the terms of BSD
  10. * license.
  11. *
  12. * See README and COPYING for more details.
  13. */
  14. #ifndef MD5_H
  15. #define MD5_H
  16. #include "wm_type_def.h"
  17. //typedef unsigned int size_t;
  18. #define MD5_MAC_LEN 16
  19. struct MD5Context {
  20. u32 buf[4];
  21. u32 bits[2];
  22. u8 in[64];
  23. };
  24. void MD5Init(struct MD5Context *context);
  25. void MD5Update(struct MD5Context *context, unsigned char const *buf,
  26. unsigned len);
  27. void MD5Final(unsigned char digest[16], struct MD5Context *context);
  28. int hmac_md5_vector(const u8 *key, size_t key_len, size_t num_elem,
  29. const u8 *addr[], const size_t *len, u8 *mac);
  30. int hmac_md5(const u8 *key, size_t key_len, const u8 *data, size_t data_len,
  31. u8 *mac);
  32. int md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac);
  33. int md5(const u8 *addr, int len, u8 *mac);
  34. #ifdef CONFIG_FIPS
  35. int hmac_md5_vector_non_fips_allow(const u8 *key, size_t key_len,
  36. size_t num_elem, const u8 *addr[],
  37. const size_t *len, u8 *mac);
  38. int hmac_md5_non_fips_allow(const u8 *key, size_t key_len, const u8 *data,
  39. size_t data_len, u8 *mac);
  40. #else /* CONFIG_FIPS */
  41. #define hmac_md5_vector_non_fips_allow hmac_md5_vector
  42. #define hmac_md5_non_fips_allow hmac_md5
  43. #endif /* CONFIG_FIPS */
  44. #endif /* MD5_H */