md_wrap.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /**
  2. * \file md_wrap.h
  3. *
  4. * \brief Message digest wrappers.
  5. *
  6. * \warning This in an internal header. Do not include directly.
  7. *
  8. * \author Adriaan de Jong <[email protected]>
  9. */
  10. /*
  11. * Copyright The Mbed TLS Contributors
  12. * SPDX-License-Identifier: Apache-2.0
  13. *
  14. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  15. * not use this file except in compliance with the License.
  16. * You may obtain a copy of the License at
  17. *
  18. * http://www.apache.org/licenses/LICENSE-2.0
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  22. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. */
  26. #ifndef MBEDTLS_MD_WRAP_H
  27. #define MBEDTLS_MD_WRAP_H
  28. #include "mbedtls/build_info.h"
  29. #include "mbedtls/md.h"
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /**
  34. * Message digest information.
  35. * Allows message digest functions to be called in a generic way.
  36. */
  37. struct mbedtls_md_info_t
  38. {
  39. /** Name of the message digest */
  40. const char * name;
  41. /** Digest identifier */
  42. mbedtls_md_type_t type;
  43. /** Output length of the digest function in bytes */
  44. unsigned char size;
  45. /** Block length of the digest function in bytes */
  46. unsigned char block_size;
  47. };
  48. #if defined(MBEDTLS_MD5_C)
  49. extern const mbedtls_md_info_t mbedtls_md5_info;
  50. #endif
  51. #if defined(MBEDTLS_RIPEMD160_C)
  52. extern const mbedtls_md_info_t mbedtls_ripemd160_info;
  53. #endif
  54. #if defined(MBEDTLS_SHA1_C)
  55. extern const mbedtls_md_info_t mbedtls_sha1_info;
  56. #endif
  57. #if defined(MBEDTLS_SHA224_C)
  58. extern const mbedtls_md_info_t mbedtls_sha224_info;
  59. #endif
  60. #if defined(MBEDTLS_SHA256_C)
  61. extern const mbedtls_md_info_t mbedtls_sha256_info;
  62. #endif
  63. #if defined(MBEDTLS_SHA384_C)
  64. extern const mbedtls_md_info_t mbedtls_sha384_info;
  65. #endif
  66. #if defined(MBEDTLS_SHA512_C)
  67. extern const mbedtls_md_info_t mbedtls_sha512_info;
  68. #endif
  69. #ifdef __cplusplus
  70. }
  71. #endif
  72. #endif /* MBEDTLS_MD_WRAP_H */