sha256_alt.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2023 HPMicro
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #ifndef SHA256_ALT_H
  8. #define SHA256_ALT_H
  9. #if !defined(MBEDTLS_CONFIG_FILE)
  10. #include "mbedtls/config.h"
  11. #else
  12. #include MBEDTLS_CONFIG_FILE
  13. #endif
  14. #include "hpm_common.h"
  15. #include "hpm_sdp_drv.h"
  16. #include "hpm_romapi.h"
  17. #include "sha_common.h"
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #define MBEDTLS_ERROR_DEFAULT -1
  22. #define MBEDTLS_ERROR_HW_NOT_SUPPORTED -2
  23. #if defined(MBEDTLS_SHA256_ALT)
  24. /**
  25. * \brief The SHA-256 context structure.
  26. *
  27. * The structure is used both for SHA-256 and for SHA-224
  28. * checksum calculations. The choice between these two is
  29. * made in the call to mbedtls_sha256_starts_ret().
  30. */
  31. typedef struct mbedtls_sha256_context
  32. {
  33. uint32_t total[2]; /*!< The number of Bytes processed. */
  34. uint32_t state[8]; /*!< The intermediate digest state. */
  35. unsigned char buffer[64]; /*!< The data block being processed. */
  36. int is224; /*!< Determines which function to use:
  37. 0: Use SHA-256, or 1: Use SHA-224. */
  38. }
  39. mbedtls_sha256_context;
  40. #endif /* defined(MBEDTLS_SHA256_ALT) */
  41. #ifdef __cplusplus
  42. }
  43. #endif
  44. #endif /* SHA256_ALT_H */