lib_rats_common.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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_COMMON_H
  8. #define _RATS_WAMR_COMMON_H
  9. #include <stdint.h>
  10. #include <stddef.h>
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. /* Enclave Flags Bit Masks */
  15. /* If set, then the enclave is initialized */
  16. #define SGX_FLAGS_INITTED 0x001ULL
  17. /* If set, then the enclave is debug */
  18. #define SGX_FLAGS_DEBUG 0x002ULL
  19. /* If set, then the enclave is 64 bit */
  20. #define SGX_FLAGS_MODE64BIT 0x004ULL
  21. /* If set, then the enclave has access to provision key */
  22. #define SGX_FLAGS_PROVISION_KEY 0x010ULL
  23. /* If set, then the enclave has access to EINITTOKEN key */
  24. #define SGX_FLAGS_EINITTOKEN_KEY 0x020ULL
  25. /* If set, then the enclave uses KSS */
  26. #define SGX_FLAGS_KSS 0x080ULL
  27. /* If set, then the enclave enables AEX Notify */
  28. #define SGX_FLAGS_AEX_NOTIFY 0x400ULL
  29. #define SGX_QUOTE_MAX_SIZE 8192
  30. #define SGX_USER_DATA_SIZE 64
  31. #define SGX_MEASUREMENT_SIZE 32
  32. /* clang-format off */
  33. typedef struct rats_sgx_evidence {
  34. uint8_t quote[SGX_QUOTE_MAX_SIZE]; /* The quote of the Enclave */
  35. uint32_t quote_size; /* The size of the quote */
  36. uint8_t user_data[SGX_USER_DATA_SIZE]; /* The custom data in the quote */
  37. uint32_t product_id; /* Product ID of the Enclave */
  38. uint8_t mr_enclave[SGX_MEASUREMENT_SIZE]; /* The MRENCLAVE of the Enclave */
  39. uint32_t security_version; /* Security Version of the Enclave */
  40. uint8_t mr_signer[SGX_MEASUREMENT_SIZE]; /* The MRSIGNER of the Enclave */
  41. uint64_t att_flags; /* Flags of the Enclave in attributes */
  42. uint64_t att_xfrm; /* XSAVE Feature Request Mask */
  43. } rats_sgx_evidence_t;
  44. /* clang-format on */
  45. #ifdef __cplusplus
  46. }
  47. #endif
  48. #endif