md5.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* md5.h
  2. *
  3. * Copyright (C) 2006-2020 wolfSSL Inc.
  4. *
  5. * This file is part of wolfSSL.
  6. *
  7. * wolfSSL is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * wolfSSL is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  20. */
  21. /* md5.h for openssl */
  22. #ifndef WOLFSSL_MD5_H_
  23. #define WOLFSSL_MD5_H_
  24. #include <wolfssl/wolfcrypt/settings.h>
  25. #ifndef NO_MD5
  26. #include <wolfssl/wolfcrypt/hash.h>
  27. #ifdef WOLFSSL_PREFIX
  28. #include "prefix_md5.h"
  29. #endif
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. typedef struct WOLFSSL_MD5_CTX {
  34. /* big enough to hold wolfcrypt md5, but check on init */
  35. #ifdef STM32_HASH
  36. void* holder[(112 + WC_ASYNC_DEV_SIZE + sizeof(STM32_HASH_Context)) / sizeof(void*)];
  37. #else
  38. void* holder[(112 + WC_ASYNC_DEV_SIZE) / sizeof(void*)];
  39. #endif
  40. } WOLFSSL_MD5_CTX;
  41. WOLFSSL_API int wolfSSL_MD5_Init(WOLFSSL_MD5_CTX*);
  42. WOLFSSL_API int wolfSSL_MD5_Update(WOLFSSL_MD5_CTX*, const void*, unsigned long);
  43. WOLFSSL_API int wolfSSL_MD5_Final(unsigned char*, WOLFSSL_MD5_CTX*);
  44. typedef WOLFSSL_MD5_CTX MD5_CTX;
  45. #define MD5_Init wolfSSL_MD5_Init
  46. #define MD5_Update wolfSSL_MD5_Update
  47. #define MD5_Final wolfSSL_MD5_Final
  48. #ifdef OPENSSL_EXTRA_BSD
  49. #define MD5Init wolfSSL_MD5_Init
  50. #define MD5Update wolfSSL_MD5_Update
  51. #define MD5Final wolfSSL_MD5_Final
  52. #endif
  53. #ifndef MD5
  54. #define MD5(d, n, md) wc_Md5Hash((d), (n), (md))
  55. #endif
  56. #define MD5_DIGEST_LENGTH MD5_DIGEST_SIZE
  57. #ifdef __cplusplus
  58. } /* extern "C" */
  59. #endif
  60. #endif /* NO_MD5 */
  61. #endif /* WOLFSSL_MD5_H_ */