C++ Arguments to SGX Enclave Edge Functions

后端 未结 1 1435
天命终不由人
天命终不由人 2020-12-22 04:46

I\'m trying to write a simple SGX enclave that takes in a vector of booleans, but apparently edger8r creates c code; so the edl code

enclave{

  from \"sgx_t         


        
相关标签:
1条回答
  • 2020-12-22 05:13

    #include is incorrect EDL syntax. No need for hash - include

    Arguments in ecalls and ocalls have to be C type - so, vector and bool are not supported.

    For vector you need to convert it into C type (maybe create a struct or void pointer), then pass a pointer with its length.

    For bool, I guess, better to pass an int to represent a Boolean value.

    You also have to specify special attribute for pointers:

    • [in] - if you want to copy it into enclave (you also need to specify its length) (aka pass by value)
    • [out] - if you want to copy back from enclave
    • [user_check] - the easiest option - you just pass a pointer and enclave will read from and write to untrusted memory. (aka pass by pointer)

    Do not forget to cast arguments back into C++ types!

    0 讨论(0)
提交回复
热议问题