lib_rats_wrapper.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (c) 2022 Intel Corporation
  3. * Copyright (c) 2020-2021 Alibaba Cloud
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. */
  7. #ifndef _RATS_WAMR_API_H
  8. #define _RATS_WAMR_API_H
  9. #include <stdint.h>
  10. #include <string.h>
  11. #include "lib_rats_common.h"
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. int
  16. librats_collect(char **evidence_json, const char *buffer, uint32_t buffer_size);
  17. int
  18. librats_verify(const char *evidence_json, uint32_t evidence_size,
  19. const uint8_t *hash, uint32_t hash_size);
  20. int
  21. librats_parse_evidence(const char *evidence_json, uint32_t json_size,
  22. rats_sgx_evidence_t *evidence, uint32_t evidence_size);
  23. #define librats_collect(evidence_json, buffer) \
  24. librats_collect(evidence_json, buffer, buffer ? strlen(buffer) + 1 : 0)
  25. #define librats_verify(evidence_json, hash) \
  26. librats_verify(evidence_json, \
  27. evidence_json ? strlen(evidence_json) + 1 : 0, hash, \
  28. hash ? strlen((const char *)hash) + 1 : 0)
  29. #define librats_parse_evidence(evidence_json, evidence) \
  30. librats_parse_evidence(evidence_json, \
  31. evidence_json ? strlen(evidence_json) + 1 : 0, \
  32. evidence, sizeof(rats_sgx_evidence_t))
  33. void
  34. librats_dispose_evidence_json(char *evidence_json);
  35. #ifdef __cplusplus
  36. }
  37. #endif
  38. #endif