sha2.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; version 2 of the License.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License
  10. along with this program; if not, write to the Free Software
  11. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
  12. #ifndef included_sha2_h
  13. #define included_sha2_h
  14. #include <my_config.h>
  15. #if defined(HAVE_YASSL) || defined(HAVE_OPENSSL)
  16. # ifdef HAVE_STDDEF_H
  17. # include <stddef.h>
  18. # endif
  19. # ifndef HAVE_YASSL
  20. # include <openssl/sha.h>
  21. # else
  22. #include "../extra/yassl/taocrypt/include/sha.hpp"
  23. # ifdef __cplusplus
  24. extern "C" {
  25. # endif
  26. #ifndef SHA512_DIGEST_LENGTH
  27. #define SHA512_DIGEST_LENGTH TaoCrypt::SHA512::DIGEST_SIZE
  28. #endif
  29. #ifndef SHA384_DIGEST_LENGTH
  30. #define SHA384_DIGEST_LENGTH TaoCrypt::SHA384::DIGEST_SIZE
  31. #endif
  32. #ifndef SHA256_DIGEST_LENGTH
  33. #define SHA256_DIGEST_LENGTH TaoCrypt::SHA256::DIGEST_SIZE
  34. #endif
  35. #ifndef SHA224_DIGEST_LENGTH
  36. #define SHA224_DIGEST_LENGTH TaoCrypt::SHA224::DIGEST_SIZE
  37. #endif
  38. #define GEN_YASSL_SHA2_BRIDGE(size) \
  39. unsigned char* SHA##size(const unsigned char *input_ptr, size_t input_length, \
  40. char unsigned *output_ptr);
  41. GEN_YASSL_SHA2_BRIDGE(512);
  42. GEN_YASSL_SHA2_BRIDGE(384);
  43. GEN_YASSL_SHA2_BRIDGE(256);
  44. GEN_YASSL_SHA2_BRIDGE(224);
  45. #undef GEN_YASSL_SHA2_BRIDGE
  46. # ifdef __cplusplus
  47. }
  48. # endif
  49. # endif /* HAVE_YASSL */
  50. #endif /* HAVE_OPENSSL || HAVE_YASSL */
  51. #endif /* included_sha2_h */