wolfssl_adapter.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* Copyright (C) 2017 Fortanix, Inc.
  2. This file is part of Graphene Library OS.
  3. Graphene Library OS is free software: you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. Graphene Library OS is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  13. #include <stdint.h>
  14. #include "pal.h"
  15. #include "pal_crypto.h"
  16. #include "../sha256.h"
  17. int DkSHA256Init(PAL_SHA256_CONTEXT *context)
  18. {
  19. return SHA256Init(context);
  20. }
  21. int DkSHA256Update(PAL_SHA256_CONTEXT *context, const uint8_t *data,
  22. PAL_NUM len)
  23. {
  24. /* PAL_NUM is a 64-bit value, but SHA256Update takes a 32-bit len. */
  25. if (len > UINT32_MAX) {
  26. return -1;
  27. }
  28. return SHA256Update(context, data, len);
  29. }
  30. int DkSHA256Final(PAL_SHA256_CONTEXT *context, uint8_t *output)
  31. {
  32. return SHA256Final(context, output);
  33. }