gramineproject / gramine

A library OS for Linux multi-process applications, with Intel SGX support
GNU Lesser General Public License v3.0
602 stars 201 forks source link

Error Input invalid in ra-tls-mbedtls example (EPID) #825

Closed gus6202 closed 2 years ago

gus6202 commented 2 years ago

Description of the problem

Hello, I want to run ra-tls-mbedtls example using EPID, however it doen't work, I dont know if it's gramine issue or my SPID key is not working... Screenshot from 2022-08-07 20-04-31

Steps to reproduce

Build:

~/Desktop/gramine/CI-Examples/ra-tls-mbedtls$ RA_CLIENT_SPID=B3E3DA794D949944CE533CF8D5A22130 RA_CLIENT_LINKABLE=1 make app epid
gramine-manifest \
    -Dlog_level=error \
    -Darch_libdir=/lib/x86_64-linux-gnu \
    -Dra_client_spid=B3E3DA794D949944CE533CF8D5A22130 \
    -Dra_client_linkable=1 \
    server.manifest.template > server.manifest
cc src/server.c -O2 -fPIE -I./mbedtls/include -I/usr/local/include  -pie -ldl -L/usr/local/lib/x86_64-linux-gnu -Wl,-rpath,/usr/local/lib/x86_64-linux-gnu -lmbedcrypto_gramine -lmbedtls_gramine -lmbedx509_gramine  -o server
gramine-sgx-sign \
    --manifest server.manifest \
    --output server.manifest.sgx
Attributes:
    size:        0x10000000
    thread_num:  4
    isv_prod_id: 0
    isv_svn:     0
    attr.flags:  0x6
    attr.xfrm:   0x3
    misc_select: 0x0
SGX remote attestation:
    EPID (spid = B3E3DA794D949944CE533CF8D5A22130, linkable = True)
Memory:
    000000001fe49000-0000000020000000 [REG:R--] (manifest) measured
    000000001fe29000-000000001fe49000 [REG:RW-] (ssa) measured
    000000001fe25000-000000001fe29000 [TCS:---] (tcs) measured
    000000001fe21000-000000001fe25000 [REG:RW-] (tls) measured
    000000001fde1000-000000001fe21000 [REG:RW-] (stack) measured
    000000001fda1000-000000001fde1000 [REG:RW-] (stack) measured
    000000001fd61000-000000001fda1000 [REG:RW-] (stack) measured
    000000001fd21000-000000001fd61000 [REG:RW-] (stack) measured
    000000001fd11000-000000001fd21000 [REG:RW-] (sig_stack) measured
    000000001fd01000-000000001fd11000 [REG:RW-] (sig_stack) measured
    000000001fcf1000-000000001fd01000 [REG:RW-] (sig_stack) measured
    000000001fce1000-000000001fcf1000 [REG:RW-] (sig_stack) measured
    000000001f8c4000-000000001f908000 [REG:R-X] (code) measured
    000000001f909000-000000001fce1000 [REG:RW-] (data) measured
    0000000010000000-000000001f8c4000 [REG:RWX] (free)
Measurement:
    aa98a7e764579d77a03244ee1a55883da07de7e9c1572dbc63df9b3a9c1f5c7d
gramine-sgx-get-token --output server.token --sig server.sig
Attributes:
    mr_enclave:  aa98a7e764579d77a03244ee1a55883da07de7e9c1572dbc63df9b3a9c1f5c7d
    mr_signer:   65bef116ca6a754bc2ef97ea599eac5ead64b54ebb3faacefdae930da409299b
    isv_prod_id: 0
    isv_svn:     0
    attr.flags:  0000000000000006
    attr.xfrm:   00000000000000e7
    mask.flags:  ffffffffffffffff
    mask.xfrm:   fffffffffff9ff1b
    misc_select: 00000000
    misc_mask:   ffffffff
    modulus:     3d76cacd4e8abc0f09f87f877d1671f3...
    exponent:    3
    signature:   186a1da1abfb38c9bee9b77a29ff40a0...
    date:        2022-08-07
cc src/client.c -O2 -fPIE -I./mbedtls/include -I/usr/local/include  -pie -ldl -L/usr/local/lib/x86_64-linux-gnu -Wl,-rpath,/usr/local/lib/x86_64-linux-gnu -lmbedcrypto_gramine -lmbedtls_gramine -lmbedx509_gramine  -o client
gramine-manifest \
    -Dlog_level=error \
    -Darch_libdir=/lib/x86_64-linux-gnu \
    client.manifest.template >client_epid.manifest
gramine-sgx-sign \
    --manifest client_epid.manifest \
    --output client_epid.manifest.sgx
Attributes:
    size:        0x10000000
    thread_num:  4
    isv_prod_id: 0
    isv_svn:     0
    attr.flags:  0x4
    attr.xfrm:   0x3
    misc_select: 0x0
SGX remote attestation:
    DCAP/ECDSA
Memory:
    000000001fe49000-0000000020000000 [REG:R--] (manifest) measured
    000000001fe29000-000000001fe49000 [REG:RW-] (ssa) measured
    000000001fe25000-000000001fe29000 [TCS:---] (tcs) measured
    000000001fe21000-000000001fe25000 [REG:RW-] (tls) measured
    000000001fde1000-000000001fe21000 [REG:RW-] (stack) measured
    000000001fda1000-000000001fde1000 [REG:RW-] (stack) measured
    000000001fd61000-000000001fda1000 [REG:RW-] (stack) measured
    000000001fd21000-000000001fd61000 [REG:RW-] (stack) measured
    000000001fd11000-000000001fd21000 [REG:RW-] (sig_stack) measured
    000000001fd01000-000000001fd11000 [REG:RW-] (sig_stack) measured
    000000001fcf1000-000000001fd01000 [REG:RW-] (sig_stack) measured
    000000001fce1000-000000001fcf1000 [REG:RW-] (sig_stack) measured
    000000001f8c4000-000000001f908000 [REG:R-X] (code) measured
    000000001f909000-000000001fce1000 [REG:RW-] (data) measured
    0000000010000000-000000001f8c4000 [REG:RWX] (free)
Measurement:
    5433ea64aafc3f79428354c41eceacfa05a975ff3418bc0515890586d69fd5ab
gramine-sgx-get-token --output client_epid.token --sig client_epid.sig
Attributes:
    mr_enclave:  5433ea64aafc3f79428354c41eceacfa05a975ff3418bc0515890586d69fd5ab
    mr_signer:   65bef116ca6a754bc2ef97ea599eac5ead64b54ebb3faacefdae930da409299b
    isv_prod_id: 0
    isv_svn:     0
    attr.flags:  0000000000000004
    attr.xfrm:   00000000000000e7
    mask.flags:  ffffffffffffffff
    mask.xfrm:   fffffffffff9ff1b
    misc_select: 00000000
    misc_mask:   ffffffff
    modulus:     3d76cacd4e8abc0f09f87f877d1671f3...
    exponent:    3
    signature:   a77c75d21eb4a0d69b0e18d8c32ff223...
    date:        2022-08-07

Run server:

~/Desktop/gramine/CI-Examples/ra-tls-mbedtls$ gramine-sgx ./server epid &
[1] 6349

~/Desktop/gramine/CI-Examples/ra-tls-mbedtls$ Gramine is starting. Parsing TOML manifest file, this may take some time...
-----------------------------------------------------------------------------------------------------------------------
Gramine detected the following insecure configurations:

  - sgx.debug = true                           (this is a debug enclave)
  - loader.insecure__use_cmdline_argv = true   (forwarding command-line args from untrusted host to the app)
  - sgx.allowed_files = [ ... ]                (some files are passed through from untrusted host without verification)

Gramine will continue application execution, but this configuration must not be used in production!
-----------------------------------------------------------------------------------------------------------------------

  . Creating the RA-TLS server cert and key... ok
  . Bind on https://localhost:4433/ ... ok
  . Seeding the random number generator... ok
  . Setting up the SSL data.... ok
  . Waiting for a remote connection ...

And client gives this error:

~/Desktop/gramine/CI-Examples/ra-tls-mbedtls$ ./client epid aa98a7e764579d77a03244ee1a55883da07de7e9c1572dbc63df9b3a9c1f5c7d 65bef116ca6a754bc2ef97ea599eac5ead64b54ebb3faacefdae930da409299b 0 0
[ using our own SGX-measurement verification callback (via command line options) ]
  - ignoring ISV_PROD_ID
  - ignoring ISV_SVN

  . Seeding the random number generator... ok
  . Connecting to tcp/localhost/4433... ok
  . Setting up the SSL/TLS structure... ok
  . Loading the CA root certificate ... ok
  . Installing RA-TLS callback ... ok
  . Performing the SSL/TLS handshake... failed
  ! mbedtls_ssl_handshake returned -0x2800

Last error was: -10240 - X509 - Input invalid

is-sgx-available output:

~/Desktop/gramine$ is-sgx-available 
SGX supported by CPU: true
SGX1 (ECREATE, EENTER, ...): true
SGX2 (EAUG, EACCEPT, EMODPR, ...): true
Flexible Launch Control (IA32_SGXPUBKEYHASH{0..3} MSRs): true
SGX extensions for virtualizers (EINCVIRTCHILD, EDECVIRTCHILD, ESETCONTEXT): true
Extensions for concurrent memory management (ETRACKC, ELDBC, ELDUC, ERDINFO): true
CET enclave attributes support (See Table 37-5 in the SDM): false
Key separation and sharing (KSS) support (CONFIGID, CONFIGSVN, ISVEXTPRODID, ISVFAMILYID report fields): true
Max enclave size (32-bit): 0x80000000
Max enclave size (64-bit): 0x800000000000
EPC size: 0xbc00000
SGX driver loaded: true
AESMD installed: true
SGX PSW/libsgx installed: true

Am I missing something?

mkow commented 2 years ago

@dimakuv: Could you take a look at this when you're back?

kailun-qin commented 2 years ago

I dont know if it's gramine issue or my SPID key is not working...

@gus6202 Would you pls give a quick try on the SGX SDK remote attestation sample first to sort this out: https://github.com/intel/linux-sgx/tree/master/SampleCode/RemoteAttestation? Thanks.

gus6202 commented 2 years ago

Thanks for replying. Ok, something is weird I think, in this path that you mention I couldn't build:

~/Desktop/linux-sgx/SampleCode/RemoteAttestation$ source /home/Gusto/Desktop/linux-sgx/linux/installer/bin/sgxsdk/environment
~/Desktop/linux-sgx/SampleCode/RemoteAttestation$ make
make[1]: Entering directory '/home/Gusto/Desktop/linux-sgx/SampleCode/RemoteAttestation'
/usr/local/bin/ld: cannot find -lsample_libcrypto
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:262: libservice_provider.so] Error 1
make[1]: Leaving directory '/home/Gusto/Desktop/linux-sgx/SampleCode/RemoteAttestation'
make: *** [Makefile:198: all] Error 2

But in the path when I installed sdk, I could build and run RemoteAttestation:

~/Desktop/linux-sgx/linux/installer/bin/sgxsdk/SampleCode/RemoteAttestation$ source /home/Gusto/Desktop/linux-sgx/linux/installer/bin/sgxsdk/environment
~/Desktop/linux-sgx/linux/installer/bin/sgxsdk/SampleCode/RemoteAttestation$ make
make[1]: Entering directory '/home/Gusto/Desktop/linux-sgx/linux/installer/bin/sgxsdk/SampleCode/RemoteAttestation'
service_provider/ecp.cpp:159:60: note: #pragma message: Default key derivation function is used.
  159 | #pragma message ("Default key derivation function is used.")
      |                                                            ^
CXX  <=  service_provider/ecp.cpp
CXX  <=  service_provider/network_ra.cpp
CXX  <=  service_provider/service_provider.cpp
CXX  <=  service_provider/ias_ra.cpp
LINK =>  libservice_provider.so
GEN  =>  isv_app/isv_enclave_u.h
CC   <=  isv_app/isv_enclave_u.c
CXX  <=  isv_app/isv_app.cpp
LINK =>  app
GEN  =>  isv_enclave/isv_enclave_t.h
CC   <=  isv_enclave/isv_enclave_t.c
isv_enclave/isv_enclave.cpp:197:60: note: #pragma message: Default key derivation function is used.
  197 | #pragma message ("Default key derivation function is used.")
      |                                                            ^
CXX  <=  isv_enclave/isv_enclave.cpp
LINK =>  isv_enclave.so
<EnclaveConfiguration>
    <ProdID>0</ProdID>
    <ISVSVN>0</ISVSVN>
    <StackMaxSize>0x40000</StackMaxSize>
    <HeapMaxSize>0x100000</HeapMaxSize>
    <TCSNum>1</TCSNum>
    <TCSPolicy>1</TCSPolicy>
    <!-- Recommend changing 'DisableDebug' to 1 to make the enclave undebuggable for enclave release -->
    <DisableDebug>0</DisableDebug>
    <MiscSelect>0</MiscSelect>
    <MiscMask>0xFFFFFFFF</MiscMask>
</EnclaveConfiguration>
[traverser_parameter manage_metadata.cpp:117] ProdID = 0
[traverser_parameter manage_metadata.cpp:117] ISVSVN = 0
[traverser_parameter manage_metadata.cpp:117] StackMaxSize = 0x40000
[traverser_parameter manage_metadata.cpp:117] HeapMaxSize = 0x100000
[traverser_parameter manage_metadata.cpp:117] TCSNum = 1
[traverser_parameter manage_metadata.cpp:117] TCSPolicy = 1
[traverser_parameter manage_metadata.cpp:117] DisableDebug = 0
[traverser_parameter manage_metadata.cpp:117] MiscSelect = 0
[traverser_parameter manage_metadata.cpp:117] MiscMask = 0xFFFFFFFF
[parse_dyn elfparser.cpp:176] dynamic tag = 1a, ptr = 111988
[parse_dyn elfparser.cpp:176] dynamic tag = 1c, ptr = 58
[parse_dyn elfparser.cpp:176] dynamic tag = 6ffffef5, ptr = 2e8
[parse_dyn elfparser.cpp:176] dynamic tag = 5, ptr = 3c8
[parse_dyn elfparser.cpp:176] dynamic tag = 6, ptr = 320
[parse_dyn elfparser.cpp:176] dynamic tag = a, ptr = 68
[parse_dyn elfparser.cpp:176] dynamic tag = b, ptr = 18
[parse_dyn elfparser.cpp:176] dynamic tag = 15, ptr = 0
[parse_dyn elfparser.cpp:176] dynamic tag = 3, ptr = 111ed8
[parse_dyn elfparser.cpp:176] dynamic tag = 7, ptr = 478
[parse_dyn elfparser.cpp:176] dynamic tag = 8, ptr = d80
[parse_dyn elfparser.cpp:176] dynamic tag = 9, ptr = 18
[parse_dyn elfparser.cpp:176] dynamic tag = 6ffffffc, ptr = 440
[parse_dyn elfparser.cpp:176] dynamic tag = 6ffffffd, ptr = 2
[parse_dyn elfparser.cpp:176] dynamic tag = 18, ptr = 0
[parse_dyn elfparser.cpp:176] dynamic tag = 6ffffffb, ptr = 8000001
[parse_dyn elfparser.cpp:176] dynamic tag = 6ffffff0, ptr = 430
[parse_dyn elfparser.cpp:176] dynamic tag = 6ffffff9, ptr = 8f
[get_section elfparser.cpp:82] section [0] : sh_addr = 0, sh_size = 0, sh_offset = 0, sh_name = 0
[get_section elfparser.cpp:82] section [1] .interp: sh_addr = 2a8, sh_size = 1c, sh_offset = 2a8, sh_name = 1b
[get_section elfparser.cpp:82] section [2] .note.gnu.build-id: sh_addr = 2c4, sh_size = 24, sh_offset = 2c4, sh_name = 23
[get_section elfparser.cpp:82] section [3] .gnu.hash: sh_addr = 2e8, sh_size = 38, sh_offset = 2e8, sh_name = 36
[get_section elfparser.cpp:82] section [4] .dynsym: sh_addr = 320, sh_size = a8, sh_offset = 320, sh_name = 40
[get_section elfparser.cpp:82] section [0] : sh_addr = 0, sh_size = 0, sh_offset = 0, sh_name = 0
[get_section elfparser.cpp:82] section [1] .interp: sh_addr = 2a8, sh_size = 1c, sh_offset = 2a8, sh_name = 1b
[get_section elfparser.cpp:82] section [2] .note.gnu.build-id: sh_addr = 2c4, sh_size = 24, sh_offset = 2c4, sh_name = 23
[get_section elfparser.cpp:82] section [3] .gnu.hash: sh_addr = 2e8, sh_size = 38, sh_offset = 2e8, sh_name = 36
[get_section elfparser.cpp:82] section [4] .dynsym: sh_addr = 320, sh_size = a8, sh_offset = 320, sh_name = 40
[get_section elfparser.cpp:82] section [5] .dynstr: sh_addr = 3c8, sh_size = 68, sh_offset = 3c8, sh_name = 48
[get_section elfparser.cpp:82] section [0] : sh_addr = 0, sh_size = 0, sh_offset = 0, sh_name = 0
[get_section elfparser.cpp:82] section [1] .interp: sh_addr = 2a8, sh_size = 1c, sh_offset = 2a8, sh_name = 1b
[get_section elfparser.cpp:82] section [2] .note.gnu.build-id: sh_addr = 2c4, sh_size = 24, sh_offset = 2c4, sh_name = 23
[get_section elfparser.cpp:82] section [3] .gnu.hash: sh_addr = 2e8, sh_size = 38, sh_offset = 2e8, sh_name = 36
[get_section elfparser.cpp:82] section [4] .dynsym: sh_addr = 320, sh_size = a8, sh_offset = 320, sh_name = 40
[get_section elfparser.cpp:82] section [5] .dynstr: sh_addr = 3c8, sh_size = 68, sh_offset = 3c8, sh_name = 48
[get_section elfparser.cpp:82] section [6] .gnu.version: sh_addr = 430, sh_size = e, sh_offset = 430, sh_name = 50
[get_section elfparser.cpp:82] section [7] .gnu.version_d: sh_addr = 440, sh_size = 38, sh_offset = 440, sh_name = 5d
[get_section elfparser.cpp:82] section [8] .rela.dyn: sh_addr = 478, sh_size = d80, sh_offset = 478, sh_name = 6c
[get_section elfparser.cpp:82] section [0] : sh_addr = 0, sh_size = 0, sh_offset = 0, sh_name = 0
[get_section elfparser.cpp:82] section [0] : sh_addr = 0, sh_size = 0, sh_offset = 0, sh_name = 0
[get_section elfparser.cpp:82] section [1] .interp: sh_addr = 2a8, sh_size = 1c, sh_offset = 2a8, sh_name = 1b
[get_section elfparser.cpp:82] section [2] .note.gnu.build-id: sh_addr = 2c4, sh_size = 24, sh_offset = 2c4, sh_name = 23
[get_section elfparser.cpp:82] section [3] .gnu.hash: sh_addr = 2e8, sh_size = 38, sh_offset = 2e8, sh_name = 36
[get_section elfparser.cpp:82] section [4] .dynsym: sh_addr = 320, sh_size = a8, sh_offset = 320, sh_name = 40
[get_section elfparser.cpp:82] section [5] .dynstr: sh_addr = 3c8, sh_size = 68, sh_offset = 3c8, sh_name = 48
[get_section elfparser.cpp:82] section [6] .gnu.version: sh_addr = 430, sh_size = e, sh_offset = 430, sh_name = 50
[get_section elfparser.cpp:82] section [7] .gnu.version_d: sh_addr = 440, sh_size = 38, sh_offset = 440, sh_name = 5d
[get_section elfparser.cpp:82] section [8] .rela.dyn: sh_addr = 478, sh_size = d80, sh_offset = 478, sh_name = 6c
[get_section elfparser.cpp:82] section [9] .plt: sh_addr = 2000, sh_size = 10, sh_offset = 2000, sh_name = 76
[get_section elfparser.cpp:82] section [10] .plt.got: sh_addr = 2010, sh_size = 8, sh_offset = 2010, sh_name = 7b
[get_section elfparser.cpp:82] section [11] .text: sh_addr = 2040, sh_size = ff4ed, sh_offset = 2040, sh_name = 84
[get_section elfparser.cpp:82] section [12] .nipx: sh_addr = 10152d, sh_size = d7c, sh_offset = 10152d, sh_name = 8a
[get_section elfparser.cpp:82] section [13] .rodata: sh_addr = 103000, sh_size = 2870, sh_offset = 103000, sh_name = 90
[get_section elfparser.cpp:82] section [14] .niprod: sh_addr = 105880, sh_size = 900, sh_offset = 105880, sh_name = 98
[get_section elfparser.cpp:82] section [15] .eh_frame_hdr: sh_addr = 106180, sh_size = 18cc, sh_offset = 106180, sh_name = a0
[get_section elfparser.cpp:82] section [16] .eh_frame: sh_addr = 107a50, sh_size = 84e8, sh_offset = 107a50, sh_name = ae
[get_section elfparser.cpp:82] section [17] .gcc_except_table: sh_addr = 10ff38, sh_size = 99, sh_offset = 10ff38, sh_name = b8
[get_section elfparser.cpp:82] section [18] .fini_array: sh_addr = 111988, sh_size = 58, sh_offset = 110988, sh_name = ca
[get_section elfparser.cpp:82] section [19] .data.rel.ro: sh_addr = 1119e0, sh_size = 388, sh_offset = 1109e0, sh_name = d6
[get_section elfparser.cpp:82] section [20] .dynamic: sh_addr = 111d68, sh_size = 170, sh_offset = 110d68, sh_name = e3
[get_section elfparser.cpp:82] section [21] .got: sh_addr = 111ed8, sh_size = 110, sh_offset = 110ed8, sh_name = 7f
[get_section elfparser.cpp:82] section [22] .data: sh_addr = 112000, sh_size = 2b20, sh_offset = 111000, sh_name = ec
[get_section elfparser.cpp:82] section [23] .nipd: sh_addr = 114b20, sh_size = 8, sh_offset = 113b20, sh_name = f2
[get_section elfparser.cpp:82] section [24] .bss: sh_addr = 114b40, sh_size = ee00, sh_offset = 113b28, sh_name = f8
[get_section elfparser.cpp:82] section [25] .comment: sh_addr = 0, sh_size = 3c, sh_offset = 113b28, sh_name = fd
[get_section elfparser.cpp:82] section [26] .note.sgxmeta: sh_addr = 0, sh_size = 501c, sh_offset = 113b64, sh_name = 106
[get_section elfparser.cpp:82] section [27] .debug_aranges: sh_addr = 0, sh_size = 3930, sh_offset = 118b80, sh_name = 114
[get_section elfparser.cpp:82] section [28] .debug_info: sh_addr = 0, sh_size = 4b037, sh_offset = 11c4b0, sh_name = 123
[get_section elfparser.cpp:82] section [29] .debug_abbrev: sh_addr = 0, sh_size = db90, sh_offset = 1674e7, sh_name = 12f
[get_section elfparser.cpp:82] section [30] .debug_line: sh_addr = 0, sh_size = 19984, sh_offset = 175077, sh_name = 13d
[get_section elfparser.cpp:82] section [31] .debug_str: sh_addr = 0, sh_size = bedf, sh_offset = 18e9fb, sh_name = 149
[get_section elfparser.cpp:82] section [32] .debug_loc: sh_addr = 0, sh_size = 20a, sh_offset = 19a8da, sh_name = 154
[get_section elfparser.cpp:82] section [33] .debug_ranges: sh_addr = 0, sh_size = 31f0, sh_offset = 19aae4, sh_name = 15f
[get_section elfparser.cpp:82] section [34] .symtab: sh_addr = 0, sh_size = 230b8, sh_offset = 19dcd8, sh_name = 1
[get_section elfparser.cpp:82] section [35] .strtab: sh_addr = 0, sh_size = 16671, sh_offset = 1c0d90, sh_name = 9
[get_section elfparser.cpp:82] section [36] .shstrtab: sh_addr = 0, sh_size = 16d, sh_offset = 1d7401, sh_name = 11
[get_section elfparser.cpp:82] section [0] : sh_addr = 0, sh_size = 0, sh_offset = 0, sh_name = 0
[get_section elfparser.cpp:82] section [1] .interp: sh_addr = 2a8, sh_size = 1c, sh_offset = 2a8, sh_name = 1b
[get_section elfparser.cpp:82] section [2] .note.gnu.build-id: sh_addr = 2c4, sh_size = 24, sh_offset = 2c4, sh_name = 23
[get_section elfparser.cpp:82] section [3] .gnu.hash: sh_addr = 2e8, sh_size = 38, sh_offset = 2e8, sh_name = 36
[get_section elfparser.cpp:82] section [4] .dynsym: sh_addr = 320, sh_size = a8, sh_offset = 320, sh_name = 40
[get_section elfparser.cpp:82] section [5] .dynstr: sh_addr = 3c8, sh_size = 68, sh_offset = 3c8, sh_name = 48
[get_section elfparser.cpp:82] section [6] .gnu.version: sh_addr = 430, sh_size = e, sh_offset = 430, sh_name = 50
[get_section elfparser.cpp:82] section [7] .gnu.version_d: sh_addr = 440, sh_size = 38, sh_offset = 440, sh_name = 5d
[get_section elfparser.cpp:82] section [8] .rela.dyn: sh_addr = 478, sh_size = d80, sh_offset = 478, sh_name = 6c
[get_section elfparser.cpp:82] section [9] .plt: sh_addr = 2000, sh_size = 10, sh_offset = 2000, sh_name = 76
[get_section elfparser.cpp:82] section [10] .plt.got: sh_addr = 2010, sh_size = 8, sh_offset = 2010, sh_name = 7b
[get_section elfparser.cpp:82] section [11] .text: sh_addr = 2040, sh_size = ff4ed, sh_offset = 2040, sh_name = 84
[get_section elfparser.cpp:82] section [12] .nipx: sh_addr = 10152d, sh_size = d7c, sh_offset = 10152d, sh_name = 8a
[get_section elfparser.cpp:82] section [13] .rodata: sh_addr = 103000, sh_size = 2870, sh_offset = 103000, sh_name = 90
[get_section elfparser.cpp:82] section [14] .niprod: sh_addr = 105880, sh_size = 900, sh_offset = 105880, sh_name = 98
[get_section elfparser.cpp:82] section [15] .eh_frame_hdr: sh_addr = 106180, sh_size = 18cc, sh_offset = 106180, sh_name = a0
[get_section elfparser.cpp:82] section [16] .eh_frame: sh_addr = 107a50, sh_size = 84e8, sh_offset = 107a50, sh_name = ae
[get_section elfparser.cpp:82] section [17] .gcc_except_table: sh_addr = 10ff38, sh_size = 99, sh_offset = 10ff38, sh_name = b8
[get_section elfparser.cpp:82] section [18] .fini_array: sh_addr = 111988, sh_size = 58, sh_offset = 110988, sh_name = ca
[get_section elfparser.cpp:82] section [19] .data.rel.ro: sh_addr = 1119e0, sh_size = 388, sh_offset = 1109e0, sh_name = d6
[get_section elfparser.cpp:82] section [20] .dynamic: sh_addr = 111d68, sh_size = 170, sh_offset = 110d68, sh_name = e3
[get_section elfparser.cpp:82] section [21] .got: sh_addr = 111ed8, sh_size = 110, sh_offset = 110ed8, sh_name = 7f
[get_section elfparser.cpp:82] section [22] .data: sh_addr = 112000, sh_size = 2b20, sh_offset = 111000, sh_name = ec
[get_section elfparser.cpp:82] section [23] .nipd: sh_addr = 114b20, sh_size = 8, sh_offset = 113b20, sh_name = f2
[get_section elfparser.cpp:82] section [24] .bss: sh_addr = 114b40, sh_size = ee00, sh_offset = 113b28, sh_name = f8
[get_section elfparser.cpp:82] section [25] .comment: sh_addr = 0, sh_size = 3c, sh_offset = 113b28, sh_name = fd
[get_section elfparser.cpp:82] section [26] .note.sgxmeta: sh_addr = 0, sh_size = 501c, sh_offset = 113b64, sh_name = 106
LOAD Section: 1
Flags = 0x0000000000000004
VAddr = 0x0000000000000000
Size  = 0x00000000000011F8

LOAD Section: 2
Flags = 0x0000000000000005
VAddr = 0x0000000000002000
Size  = 0x00000000001002A9

LOAD Section: 3
Flags = 0x0000000000000004
VAddr = 0x0000000000103000
Size  = 0x000000000000CFD1

LOAD Section: 4
Flags = 0x0000000000000006
VAddr = 0x0000000000111988
Size  = 0x0000000000011FB8

[get_section elfparser.cpp:82] section [0] : sh_addr = 0, sh_size = 0, sh_offset = 0, sh_name = 0
[get_section elfparser.cpp:82] section [1] .interp: sh_addr = 2a8, sh_size = 1c, sh_offset = 2a8, sh_name = 1b
[get_section elfparser.cpp:82] section [2] .note.gnu.build-id: sh_addr = 2c4, sh_size = 24, sh_offset = 2c4, sh_name = 23
[get_section elfparser.cpp:82] section [3] .gnu.hash: sh_addr = 2e8, sh_size = 38, sh_offset = 2e8, sh_name = 36
[get_section elfparser.cpp:82] section [4] .dynsym: sh_addr = 320, sh_size = a8, sh_offset = 320, sh_name = 40
[get_section elfparser.cpp:82] section [5] .dynstr: sh_addr = 3c8, sh_size = 68, sh_offset = 3c8, sh_name = 48
[get_section elfparser.cpp:82] section [6] .gnu.version: sh_addr = 430, sh_size = e, sh_offset = 430, sh_name = 50
[get_section elfparser.cpp:82] section [7] .gnu.version_d: sh_addr = 440, sh_size = 38, sh_offset = 440, sh_name = 5d
[get_section elfparser.cpp:82] section [8] .rela.dyn: sh_addr = 478, sh_size = d80, sh_offset = 478, sh_name = 6c
[get_section elfparser.cpp:82] section [9] .plt: sh_addr = 2000, sh_size = 10, sh_offset = 2000, sh_name = 76
[get_section elfparser.cpp:82] section [10] .plt.got: sh_addr = 2010, sh_size = 8, sh_offset = 2010, sh_name = 7b
[get_section elfparser.cpp:82] section [11] .text: sh_addr = 2040, sh_size = ff4ed, sh_offset = 2040, sh_name = 84
[get_section elfparser.cpp:82] section [12] .nipx: sh_addr = 10152d, sh_size = d7c, sh_offset = 10152d, sh_name = 8a
[get_section elfparser.cpp:82] section [13] .rodata: sh_addr = 103000, sh_size = 2870, sh_offset = 103000, sh_name = 90
[get_section elfparser.cpp:82] section [14] .niprod: sh_addr = 105880, sh_size = 900, sh_offset = 105880, sh_name = 98
[get_section elfparser.cpp:82] section [15] .eh_frame_hdr: sh_addr = 106180, sh_size = 18cc, sh_offset = 106180, sh_name = a0
[get_section elfparser.cpp:82] section [16] .eh_frame: sh_addr = 107a50, sh_size = 84e8, sh_offset = 107a50, sh_name = ae
[get_section elfparser.cpp:82] section [17] .gcc_except_table: sh_addr = 10ff38, sh_size = 99, sh_offset = 10ff38, sh_name = b8
[get_section elfparser.cpp:82] section [18] .fini_array: sh_addr = 111988, sh_size = 58, sh_offset = 110988, sh_name = ca
[get_section elfparser.cpp:82] section [19] .data.rel.ro: sh_addr = 1119e0, sh_size = 388, sh_offset = 1109e0, sh_name = d6
[get_section elfparser.cpp:82] section [20] .dynamic: sh_addr = 111d68, sh_size = 170, sh_offset = 110d68, sh_name = e3
[get_section elfparser.cpp:82] section [21] .got: sh_addr = 111ed8, sh_size = 110, sh_offset = 110ed8, sh_name = 7f
[get_section elfparser.cpp:82] section [22] .data: sh_addr = 112000, sh_size = 2b20, sh_offset = 111000, sh_name = ec
[get_section elfparser.cpp:82] section [23] .nipd: sh_addr = 114b20, sh_size = 8, sh_offset = 113b20, sh_name = f2
[get_section elfparser.cpp:82] section [24] .bss: sh_addr = 114b40, sh_size = ee00, sh_offset = 113b28, sh_name = f8
[get_section elfparser.cpp:82] section [25] .comment: sh_addr = 0, sh_size = 3c, sh_offset = 113b28, sh_name = fd
[get_section elfparser.cpp:82] section [26] .note.sgxmeta: sh_addr = 0, sh_size = 501c, sh_offset = 113b64, sh_name = 106
[get_section elfparser.cpp:82] section [27] .debug_aranges: sh_addr = 0, sh_size = 3930, sh_offset = 118b80, sh_name = 114
[get_section elfparser.cpp:82] section [28] .debug_info: sh_addr = 0, sh_size = 4b037, sh_offset = 11c4b0, sh_name = 123
[get_section elfparser.cpp:82] section [29] .debug_abbrev: sh_addr = 0, sh_size = db90, sh_offset = 1674e7, sh_name = 12f
[get_section elfparser.cpp:82] section [30] .debug_line: sh_addr = 0, sh_size = 19984, sh_offset = 175077, sh_name = 13d
[get_section elfparser.cpp:82] section [31] .debug_str: sh_addr = 0, sh_size = bedf, sh_offset = 18e9fb, sh_name = 149
[get_section elfparser.cpp:82] section [32] .debug_loc: sh_addr = 0, sh_size = 20a, sh_offset = 19a8da, sh_name = 154
[get_section elfparser.cpp:82] section [33] .debug_ranges: sh_addr = 0, sh_size = 31f0, sh_offset = 19aae4, sh_name = 15f
[get_section elfparser.cpp:82] section [34] .symtab: sh_addr = 0, sh_size = 230b8, sh_offset = 19dcd8, sh_name = 1
[get_section elfparser.cpp:82] section [35] .strtab: sh_addr = 0, sh_size = 16671, sh_offset = 1c0d90, sh_name = 9
[get_section elfparser.cpp:82] section [36] .shstrtab: sh_addr = 0, sh_size = 16d, sh_offset = 1d7401, sh_name = 11
tcs_num 1, tcs_max_num 1, tcs_min_pool 1
[check_xml_parameter manage_metadata.cpp:558] RSRV_MIN_SIZE  = 0x0000000000000000
[check_xml_parameter manage_metadata.cpp:559] RSRV_INIT_SIZE = 0x0000000000000000
[check_xml_parameter manage_metadata.cpp:560] RSRV_MAX_SIZE  = 0x0000000000000000
[update_layout_entries manage_metadata.cpp:590] 
    Entry Id( 0) =    1, HEAP_MIN        ,  Page Count =     1,  Attributes = 0x01,  Flags = 0x0000000000000203,  RVA = 0x0000000000124000 --- 0x0000000000124FFF
    Entry Id( 1) =    2, HEAP_INIT       ,  Page Count =   255,  Attributes = 0x19,  Flags = 0x0000000000000203,  RVA = 0x0000000000125000 --- 0x0000000000223FFF
    Entry Id( 2) =   10, GUARD           ,  Page Count =    16,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000224000 --- 0x0000000000233FFF
    Entry Id( 3) =    7, STACK_MAX       ,  Page Count =    62,  Attributes = 0x5B,  Flags = 0x0000000000000203,  RVA = 0x0000000000234000 --- 0x0000000000271FFF
    Entry Id( 4) =    8, STACK_MIN       ,  Page Count =     2,  Attributes = 0x03,  Flags = 0x0000000000000203,  RVA = 0x0000000000272000 --- 0x0000000000273FFF
    Entry Id( 5) =   10, GUARD           ,  Page Count =    16,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000274000 --- 0x0000000000283FFF
    Entry Id( 6) =    4, TCS             ,  Page Count =     1,  Attributes = 0x03,  Flags = 0x0000000000000100,  RVA = 0x0000000000284000 --- 0x0000000000284FFF
    Entry Id( 7) =    6, SSA             ,  Page Count =     2,  Attributes = 0x03,  Flags = 0x0000000000000203,  RVA = 0x0000000000285000 --- 0x0000000000286FFF
    Entry Id( 8) =   10, GUARD           ,  Page Count =    16,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000287000 --- 0x0000000000296FFF
    Entry Id( 9) =    5, TD              ,  Page Count =     1,  Attributes = 0x03,  Flags = 0x0000000000000203,  RVA = 0x0000000000297000 --- 0x0000000000297FFF
[build_layout_entries manage_metadata.cpp:732] 
Enclave: Size = 0x0000000000298000, Rounded Size = 0x0000000000400000
    Entry Id( 0) =   10, GUARD           ,  Page Count =   360,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000298000 --- 0x00000000003FFFFF
[do_update_global_data update_global_data.hxx:119] 
Global Data:
    Enclave size     = 0x0000000000400000
    Heap Offset      = 0x0000000000124000
    Heap Size        = 0x0000000000100000
    Reserved Mem Offset      = 0x0000000000000000
    Reserved Mem Size        = 0x0000000000000000
    Thread Policy    = 0x0000000000000001
    Layout Table:
    Entry Id( 1) =    1, HEAP_MIN        ,  Page Count =     1,  Attributes = 0x01,  Flags = 0x0000000000000203,  RVA = 0x0000000000124000 --- 0x0000000000125000
    Entry Id( 2) =    2, HEAP_INIT       ,  Page Count =   255,  Attributes = 0x19,  Flags = 0x0000000000000203,  RVA = 0x0000000000125000 --- 0x0000000000224000
    Entry Id( 3) =   10, GUARD           ,  Page Count =    16,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000224000 --- 0x0000000000234000
    Entry Id( 4) =    7, STACK_MAX       ,  Page Count =    62,  Attributes = 0x5B,  Flags = 0x0000000000000203,  RVA = 0x0000000000234000 --- 0x0000000000272000
    Entry Id( 5) =    8, STACK_MIN       ,  Page Count =     2,  Attributes = 0x03,  Flags = 0x0000000000000203,  RVA = 0x0000000000272000 --- 0x0000000000274000
    Entry Id( 6) =   10, GUARD           ,  Page Count =    16,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000274000 --- 0x0000000000284000
    Entry Id( 7) =    4, TCS             ,  Page Count =     1,  Attributes = 0x03,  Flags = 0x0000000000000100,  RVA = 0x0000000000284000 --- 0x0000000000285000
    Entry Id( 8) =    6, SSA             ,  Page Count =     2,  Attributes = 0x03,  Flags = 0x0000000000000203,  RVA = 0x0000000000285000 --- 0x0000000000287000
    Entry Id( 9) =   10, GUARD           ,  Page Count =    16,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000287000 --- 0x0000000000297000
    Entry Id(10) =    5, TD              ,  Page Count =     1,  Attributes = 0x03,  Flags = 0x0000000000000203,  RVA = 0x0000000000297000 --- 0x0000000000298000
    Entry Id(11) =   10, GUARD           ,  Page Count =   360,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000298000 --- 0x0000000000400000
[get_section elfparser.cpp:82] section [0] : sh_addr = 0, sh_size = 0, sh_offset = 0, sh_name = 0
[get_section elfparser.cpp:82] section [1] .interp: sh_addr = 2a8, sh_size = 1c, sh_offset = 2a8, sh_name = 1b
[get_section elfparser.cpp:82] section [2] .note.gnu.build-id: sh_addr = 2c4, sh_size = 24, sh_offset = 2c4, sh_name = 23
[get_section elfparser.cpp:82] section [3] .gnu.hash: sh_addr = 2e8, sh_size = 38, sh_offset = 2e8, sh_name = 36
[get_section elfparser.cpp:82] section [4] .dynsym: sh_addr = 320, sh_size = a8, sh_offset = 320, sh_name = 40
[get_section elfparser.cpp:82] section [5] .dynstr: sh_addr = 3c8, sh_size = 68, sh_offset = 3c8, sh_name = 48
[get_section elfparser.cpp:82] section [6] .gnu.version: sh_addr = 430, sh_size = e, sh_offset = 430, sh_name = 50
[get_section elfparser.cpp:82] section [7] .gnu.version_d: sh_addr = 440, sh_size = 38, sh_offset = 440, sh_name = 5d
[get_section elfparser.cpp:82] section [8] .rela.dyn: sh_addr = 478, sh_size = d80, sh_offset = 478, sh_name = 6c
[get_section elfparser.cpp:82] section [9] .plt: sh_addr = 2000, sh_size = 10, sh_offset = 2000, sh_name = 76
[get_reloc_entry_offset elfparser.cpp:877] found section '.plt' - offset 0x2000, size 0x10
[get_section elfparser.cpp:82] section [0] : sh_addr = 0, sh_size = 0, sh_offset = 0, sh_name = 0
[get_section elfparser.cpp:82] section [1] .interp: sh_addr = 2a8, sh_size = 1c, sh_offset = 2a8, sh_name = 1b
[get_section elfparser.cpp:82] section [2] .note.gnu.build-id: sh_addr = 2c4, sh_size = 24, sh_offset = 2c4, sh_name = 23
[get_section elfparser.cpp:82] section [3] .gnu.hash: sh_addr = 2e8, sh_size = 38, sh_offset = 2e8, sh_name = 36
[get_section elfparser.cpp:82] section [4] .dynsym: sh_addr = 320, sh_size = a8, sh_offset = 320, sh_name = 40
[get_section elfparser.cpp:82] section [5] .dynstr: sh_addr = 3c8, sh_size = 68, sh_offset = 3c8, sh_name = 48
[get_section elfparser.cpp:82] section [6] .gnu.version: sh_addr = 430, sh_size = e, sh_offset = 430, sh_name = 50
[get_section elfparser.cpp:82] section [7] .gnu.version_d: sh_addr = 440, sh_size = 38, sh_offset = 440, sh_name = 5d
[get_section elfparser.cpp:82] section [8] .rela.dyn: sh_addr = 478, sh_size = d80, sh_offset = 478, sh_name = 6c
[get_section elfparser.cpp:82] section [9] .plt: sh_addr = 2000, sh_size = 10, sh_offset = 2000, sh_name = 76
[get_section elfparser.cpp:82] section [10] .plt.got: sh_addr = 2010, sh_size = 8, sh_offset = 2010, sh_name = 7b
[get_reloc_entry_offset elfparser.cpp:877] found section '.plt.got' - offset 0x2010, size 0x8
[get_section elfparser.cpp:82] section [0] : sh_addr = 0, sh_size = 0, sh_offset = 0, sh_name = 0
[get_section elfparser.cpp:82] section [1] .interp: sh_addr = 2a8, sh_size = 1c, sh_offset = 2a8, sh_name = 1b
[get_section elfparser.cpp:82] section [2] .note.gnu.build-id: sh_addr = 2c4, sh_size = 24, sh_offset = 2c4, sh_name = 23
[get_section elfparser.cpp:82] section [3] .gnu.hash: sh_addr = 2e8, sh_size = 38, sh_offset = 2e8, sh_name = 36
[get_section elfparser.cpp:82] section [4] .dynsym: sh_addr = 320, sh_size = a8, sh_offset = 320, sh_name = 40
[get_section elfparser.cpp:82] section [5] .dynstr: sh_addr = 3c8, sh_size = 68, sh_offset = 3c8, sh_name = 48
[get_section elfparser.cpp:82] section [6] .gnu.version: sh_addr = 430, sh_size = e, sh_offset = 430, sh_name = 50
[get_section elfparser.cpp:82] section [7] .gnu.version_d: sh_addr = 440, sh_size = 38, sh_offset = 440, sh_name = 5d
[get_section elfparser.cpp:82] section [8] .rela.dyn: sh_addr = 478, sh_size = d80, sh_offset = 478, sh_name = 6c
[get_section elfparser.cpp:82] section [9] .plt: sh_addr = 2000, sh_size = 10, sh_offset = 2000, sh_name = 76
[get_section elfparser.cpp:82] section [10] .plt.got: sh_addr = 2010, sh_size = 8, sh_offset = 2010, sh_name = 7b
[get_section elfparser.cpp:82] section [11] .text: sh_addr = 2040, sh_size = ff4ed, sh_offset = 2040, sh_name = 84
[get_reloc_entry_offset elfparser.cpp:877] found section '.text' - offset 0x2040, size 0xff4ed
[get_section elfparser.cpp:82] section [0] : sh_addr = 0, sh_size = 0, sh_offset = 0, sh_name = 0
[get_section elfparser.cpp:82] section [1] .interp: sh_addr = 2a8, sh_size = 1c, sh_offset = 2a8, sh_name = 1b
[get_section elfparser.cpp:82] section [2] .note.gnu.build-id: sh_addr = 2c4, sh_size = 24, sh_offset = 2c4, sh_name = 23
[get_section elfparser.cpp:82] section [3] .gnu.hash: sh_addr = 2e8, sh_size = 38, sh_offset = 2e8, sh_name = 36
[get_section elfparser.cpp:82] section [4] .dynsym: sh_addr = 320, sh_size = a8, sh_offset = 320, sh_name = 40
[get_section elfparser.cpp:82] section [5] .dynstr: sh_addr = 3c8, sh_size = 68, sh_offset = 3c8, sh_name = 48
[get_section elfparser.cpp:82] section [6] .gnu.version: sh_addr = 430, sh_size = e, sh_offset = 430, sh_name = 50
[get_section elfparser.cpp:82] section [7] .gnu.version_d: sh_addr = 440, sh_size = 38, sh_offset = 440, sh_name = 5d
[get_section elfparser.cpp:82] section [8] .rela.dyn: sh_addr = 478, sh_size = d80, sh_offset = 478, sh_name = 6c
[get_section elfparser.cpp:82] section [9] .plt: sh_addr = 2000, sh_size = 10, sh_offset = 2000, sh_name = 76
[get_section elfparser.cpp:82] section [10] .plt.got: sh_addr = 2010, sh_size = 8, sh_offset = 2010, sh_name = 7b
[get_section elfparser.cpp:82] section [11] .text: sh_addr = 2040, sh_size = ff4ed, sh_offset = 2040, sh_name = 84
[get_section elfparser.cpp:82] section [12] .nipx: sh_addr = 10152d, sh_size = d7c, sh_offset = 10152d, sh_name = 8a
[get_reloc_entry_offset elfparser.cpp:877] found section '.nipx' - offset 0x10152d, size 0xd7c
[build_secs /home/Gusto/Desktop/linux-sgx/psw/urts/loader.cpp:626] Enclave start addr. = (nil), Size = 0x400000, 4096 KB
[build_image /home/Gusto/Desktop/linux-sgx/psw/urts/loader.cpp:670] 
    Metadata Version = 0x0000000200000004
build_contexts, step = 0x0000000000000000
    build_context
    Entry Id     =    1, HEAP_MIN        , Page Count =     1, Attributes = 0x01, Flags = 0x0000000000000203, RVA = 0x0000000000124000 -> RVA = 0x0000000000124000
build_contexts, step = 0x0000000000000000
    build_context
    Entry Id     =    2, HEAP_INIT       , Page Count =   255, Attributes = 0x19, Flags = 0x0000000000000203, RVA = 0x0000000000125000 -> RVA = 0x0000000000125000
build_contexts, step = 0x0000000000000000
    build_context
    Entry Id     =   10, GUARD           , Page Count =    16, Attributes = 0x00, Flags = 0x0000000000000000, RVA = 0x0000000000224000 -> RVA = 0x0000000000224000
build_contexts, step = 0x0000000000000000
    build_context
    Entry Id     =    7, STACK_MAX       , Page Count =    62, Attributes = 0x5B, Flags = 0x0000000000000203, RVA = 0x0000000000234000 -> RVA = 0x0000000000234000
build_contexts, step = 0x0000000000000000
    build_context
    Entry Id     =    8, STACK_MIN       , Page Count =     2, Attributes = 0x03, Flags = 0x0000000000000203, RVA = 0x0000000000272000 -> RVA = 0x0000000000272000
build_contexts, step = 0x0000000000000000
    build_context
    Entry Id     =   10, GUARD           , Page Count =    16, Attributes = 0x00, Flags = 0x0000000000000000, RVA = 0x0000000000274000 -> RVA = 0x0000000000274000
build_contexts, step = 0x0000000000000000
    build_context
    Entry Id     =    4, TCS             , Page Count =     1, Attributes = 0x03, Flags = 0x0000000000000100, RVA = 0x0000000000284000 -> RVA = 0x0000000000284000
build_contexts, step = 0x0000000000000000
    build_context
    Entry Id     =    6, SSA             , Page Count =     2, Attributes = 0x03, Flags = 0x0000000000000203, RVA = 0x0000000000285000 -> RVA = 0x0000000000285000
build_contexts, step = 0x0000000000000000
    build_context
    Entry Id     =   10, GUARD           , Page Count =    16, Attributes = 0x00, Flags = 0x0000000000000000, RVA = 0x0000000000287000 -> RVA = 0x0000000000287000
build_contexts, step = 0x0000000000000000
    build_context
    Entry Id     =    5, TD              , Page Count =     1, Attributes = 0x03, Flags = 0x0000000000000203, RVA = 0x0000000000297000 -> RVA = 0x0000000000297000
build_contexts, step = 0x0000000000000000
    build_context
    Entry Id     =   10, GUARD           , Page Count =   360, Attributes = 0x00, Flags = 0x0000000000000000, RVA = 0x0000000000298000 -> RVA = 0x0000000000298000
[measure_enclave sign_tool.cpp:239] 
The required memory is 2519040B.
The required memory is 0x267000, 2460 KB.
[generate_compatible_metadata sign_tool.cpp:1078] 
[dump_metadata_layout sign_tool.cpp:846] 
    Metadata Version = 0x0000000200000004
    Entry Id( 0) =    1, HEAP_MIN        ,  Page Count =     1,  Attributes = 0x01,  Flags = 0x0000000000000203,  RVA = 0x0000000000124000 --- 0x0000000000125000
    Entry Id( 1) =    2, HEAP_INIT       ,  Page Count =   255,  Attributes = 0x19,  Flags = 0x0000000000000203,  RVA = 0x0000000000125000 --- 0x0000000000224000
    Entry Id( 2) =   10, GUARD           ,  Page Count =    16,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000224000 --- 0x0000000000234000
    Entry Id( 3) =    7, STACK_MAX       ,  Page Count =    62,  Attributes = 0x5B,  Flags = 0x0000000000000203,  RVA = 0x0000000000234000 --- 0x0000000000272000
    Entry Id( 4) =    8, STACK_MIN       ,  Page Count =     2,  Attributes = 0x03,  Flags = 0x0000000000000203,  RVA = 0x0000000000272000 --- 0x0000000000274000
    Entry Id( 5) =   10, GUARD           ,  Page Count =    16,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000274000 --- 0x0000000000284000
    Entry Id( 6) =    4, TCS             ,  Page Count =     1,  Attributes = 0x03,  Flags = 0x0000000000000100,  RVA = 0x0000000000284000 --- 0x0000000000285000
    Entry Id( 7) =    6, SSA             ,  Page Count =     2,  Attributes = 0x03,  Flags = 0x0000000000000203,  RVA = 0x0000000000285000 --- 0x0000000000287000
    Entry Id( 8) =   10, GUARD           ,  Page Count =    16,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000287000 --- 0x0000000000297000
    Entry Id( 9) =    5, TD              ,  Page Count =     1,  Attributes = 0x03,  Flags = 0x0000000000000203,  RVA = 0x0000000000297000 --- 0x0000000000298000
    Entry Id(10) =   10, GUARD           ,  Page Count =   360,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000298000 --- 0x0000000000400000
[dump_metadata_layout sign_tool.cpp:846] 
    Metadata Version = 0x0000000200000001
    Entry Id( 0) =    1, HEAP_MIN        ,  Page Count =     1,  Attributes = 0x01,  Flags = 0x0000000000000203,  RVA = 0x0000000000124000 --- 0x0000000000125000
    Entry Id( 1) =    2, HEAP_INIT       ,  Page Count =   255,  Attributes = 0x19,  Flags = 0x0000000000000203,  RVA = 0x0000000000125000 --- 0x0000000000224000
    Entry Id( 2) =   10, GUARD           ,  Page Count =    16,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000224000 --- 0x0000000000234000
    Entry Id( 3) =    7, STACK_MAX       ,  Page Count =    62,  Attributes = 0x5B,  Flags = 0x0000000000000203,  RVA = 0x0000000000234000 --- 0x0000000000272000
    Entry Id( 4) =    8, STACK_MIN       ,  Page Count =     2,  Attributes = 0x03,  Flags = 0x0000000000000203,  RVA = 0x0000000000272000 --- 0x0000000000274000
    Entry Id( 5) =   10, GUARD           ,  Page Count =    16,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000274000 --- 0x0000000000284000
    Entry Id( 6) =    4, TCS             ,  Page Count =     1,  Attributes = 0x03,  Flags = 0x0000000000000100,  RVA = 0x0000000000284000 --- 0x0000000000285000
    Entry Id( 7) =    6, SSA             ,  Page Count =     2,  Attributes = 0x03,  Flags = 0x0000000000000203,  RVA = 0x0000000000285000 --- 0x0000000000287000
    Entry Id( 8) =   10, GUARD           ,  Page Count =    16,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000287000 --- 0x0000000000297000
    Entry Id( 9) =    5, TD              ,  Page Count =     1,  Attributes = 0x03,  Flags = 0x0000000000000203,  RVA = 0x0000000000297000 --- 0x0000000000298000
    Entry Id(10) =   10, GUARD           ,  Page Count =   360,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000298000 --- 0x0000000000400000
[dump_metadata_layout sign_tool.cpp:846] 
    Metadata Version = 0x0000000100000004
    Entry Id( 0) =    1, HEAP_MIN        ,  Page Count =     1,  Attributes = 0x01,  Flags = 0x0000000000000203,  RVA = 0x0000000000124000 --- 0x0000000000125000
    Entry Id( 1) =    2, HEAP_INIT       ,  Page Count =   255,  Attributes = 0x11,  Flags = 0x0000000000000203,  RVA = 0x0000000000125000 --- 0x0000000000224000
    Entry Id( 2) =   10, GUARD           ,  Page Count =    16,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000224000 --- 0x0000000000234000
    Entry Id( 3) =    7, STACK_MAX       ,  Page Count =    62,  Attributes = 0x53,  Flags = 0x0000000000000203,  RVA = 0x0000000000234000 --- 0x0000000000272000
    Entry Id( 4) =    8, STACK_MIN       ,  Page Count =     2,  Attributes = 0x03,  Flags = 0x0000000000000203,  RVA = 0x0000000000272000 --- 0x0000000000274000
    Entry Id( 5) =   10, GUARD           ,  Page Count =    16,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000274000 --- 0x0000000000284000
    Entry Id( 6) =    4, TCS             ,  Page Count =     1,  Attributes = 0x03,  Flags = 0x0000000000000100,  RVA = 0x0000000000284000 --- 0x0000000000285000
    Entry Id( 7) =    6, SSA             ,  Page Count =     2,  Attributes = 0x03,  Flags = 0x0000000000000203,  RVA = 0x0000000000285000 --- 0x0000000000287000
    Entry Id( 8) =   10, GUARD           ,  Page Count =    16,  Attributes = 0x00,  Flags = 0x0000000000000000,  RVA = 0x0000000000287000 --- 0x0000000000297000
    Entry Id( 9) =    5, TD              ,  Page Count =     1,  Attributes = 0x03,  Flags = 0x0000000000000203,  RVA = 0x0000000000297000 --- 0x0000000000298000
    Entry Id(10) = 4105, THREAD_GROUP    ,  Entry Count =    8,  Load Times = 0,     LStep = 0x0000000000074000
Succeed.
SIGN =>  isv_enclave.signed.so
The project has been built in debug hardware mode.
make[1]: Leaving directory '/home/Gusto/Desktop/linux-sgx/linux/installer/bin/sgxsdk/SampleCode/RemoteAttestation'

And then I could run app successfully:

~/Desktop/linux-sgx/linux/installer/bin/sgxsdk/SampleCode/RemoteAttestation$ ./app

First round, we will try ECDSA algorithm.

Call sgx_get_extended_epid_group_id success.
MSG0 body generated -
4 bytes:
{
0x0, 0x0, 0x0, 0x0 
}

Sending msg0 to remote attestation service provider.

Sent MSG0 to remote attestation service.

Call sgx_select_att_key_id success.
Call sgx_create_enclave success.
Call enclave_init_ra success.
Call sgx_ra_get_msg1_ex success.

MSG1 body generated -
68 bytes:
{
0xcf, 0x52, 0x2f, 0x2, 0x23, 0x9d, 0xaa, 0xd4, 
0xab, 0x30, 0x8e, 0x38, 0xf3, 0x62, 0xea, 0x9f, 
0x2e, 0xd9, 0x43, 0xf1, 0xbe, 0xb3, 0x52, 0x94, 
0xb1, 0xec, 0xd2, 0x12, 0xe3, 0x87, 0xd7, 0xa, 
0xcb, 0x93, 0xa7, 0x18, 0xb6, 0xe, 0x71, 0x72, 
0x80, 0xf8, 0x8e, 0x43, 0x43, 0x4d, 0xd1, 0x1b, 
0x31, 0x66, 0x9c, 0xfd, 0x29, 0x63, 0xde, 0x84, 
0xf5, 0xc1, 0xea, 0xf4, 0x43, 0x25, 0xb9, 0xc2, 
0x0, 0x0, 0x0, 0x0 
}

Sending msg1 to remote attestation service provider.Expecting msg2 back.

Sent MSG1 to remote attestation service provider. Received the following MSG2:
176 bytes:
{
0x2, 0x0, 0x0, 0xa8, 0x0, 0x0, 0x0, 0x0, 
0x6a, 0x83, 0xdc, 0x84, 0xd4, 0x4c, 0x8a, 0xbb, 
0x5e, 0x42, 0xaf, 0xee, 0x8d, 0xe9, 0xf4, 0x57, 
0x71, 0xfd, 0x73, 0x66, 0xd7, 0xfa, 0xad, 0xfa, 
0xf2, 0x17, 0x14, 0xdd, 0x5a, 0xb9, 0x9e, 0x97, 
0x79, 0xa7, 0x38, 0x72, 0xf2, 0xb8, 0xd6, 0xbe, 
0x18, 0x91, 0x7f, 0xf7, 0xb5, 0xd3, 0xe5, 0x64, 
0x9b, 0x12, 0x18, 0xaf, 0x39, 0x29, 0x6c, 0x24, 
0x19, 0x38, 0x29, 0xb, 0xc6, 0xac, 0xc, 0x62, 
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 
0x58, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x1, 0x0, 0x1, 0x0, 0x6a, 0x83, 0xdc, 0x84, 
0xd4, 0x4c, 0x8a, 0xbb, 0x5e, 0x42, 0xaf, 0xee, 
0x8d, 0xe9, 0xf4, 0x57, 0x71, 0xfd, 0x73, 0x66, 
0xd7, 0xfa, 0xad, 0xfa, 0xf2, 0x17, 0x14, 0xdd, 
0x5a, 0xb9, 0x9e, 0x97, 0xe4, 0x34, 0x3b, 0x33, 
0xe5, 0x7e, 0x9e, 0xfe, 0xdf, 0xe9, 0xb0, 0x47, 
0xc3, 0x1b, 0xed, 0x72, 0xc6, 0xa5, 0x68, 0x9f, 
0xbe, 0xf9, 0x2, 0xa5, 0xc8, 0x6d, 0x52, 0x40, 
0xcb, 0xa1, 0x2a, 0xd3, 0xcf, 0xec, 0xcb, 0xe0, 
0x6d, 0x99, 0x2, 0xd7, 0x36, 0x2c, 0x2f, 0x21, 
0x7d, 0xf, 0xa4, 0x8f, 0x0, 0x0, 0x0, 0x0 
}

A more descriptive representation of MSG2:
RESPONSE TYPE:   0x2
RESPONSE STATUS: 0x0 0x0
RESPONSE BODY SIZE: 168
MSG2 gb - 64 bytes:
{
0x6a, 0x83, 0xdc, 0x84, 0xd4, 0x4c, 0x8a, 0xbb, 
0x5e, 0x42, 0xaf, 0xee, 0x8d, 0xe9, 0xf4, 0x57, 
0x71, 0xfd, 0x73, 0x66, 0xd7, 0xfa, 0xad, 0xfa, 
0xf2, 0x17, 0x14, 0xdd, 0x5a, 0xb9, 0x9e, 0x97, 
0x79, 0xa7, 0x38, 0x72, 0xf2, 0xb8, 0xd6, 0xbe, 
0x18, 0x91, 0x7f, 0xf7, 0xb5, 0xd3, 0xe5, 0x64, 
0x9b, 0x12, 0x18, 0xaf, 0x39, 0x29, 0x6c, 0x24, 
0x19, 0x38, 0x29, 0xb, 0xc6, 0xac, 0xc, 0x62 
}
MSG2 spid - 16 bytes:
{
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 
0x58, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 
}
MSG2 quote_type : 1
MSG2 kdf_id : 1
MSG2 sign_gb_ga - 64 bytes:
{
0x6a, 0x83, 0xdc, 0x84, 0xd4, 0x4c, 0x8a, 0xbb, 
0x5e, 0x42, 0xaf, 0xee, 0x8d, 0xe9, 0xf4, 0x57, 
0x71, 0xfd, 0x73, 0x66, 0xd7, 0xfa, 0xad, 0xfa, 
0xf2, 0x17, 0x14, 0xdd, 0x5a, 0xb9, 0x9e, 0x97, 
0xe4, 0x34, 0x3b, 0x33, 0xe5, 0x7e, 0x9e, 0xfe, 
0xdf, 0xe9, 0xb0, 0x47, 0xc3, 0x1b, 0xed, 0x72, 
0xc6, 0xa5, 0x68, 0x9f, 0xbe, 0xf9, 0x2, 0xa5, 
0xc8, 0x6d, 0x52, 0x40, 0xcb, 0xa1, 0x2a, 0xd3 
}
MSG2 mac - 16 bytes:
{
0xcf, 0xec, 0xcb, 0xe0, 0x6d, 0x99, 0x2, 0xd7, 
0x36, 0x2c, 0x2f, 0x21, 0x7d, 0xf, 0xa4, 0x8f 
}
MSG2 sig_rl - 
( null )

Call sgx_ra_proc_msg2_ex success.

MSG3 - 
1792 bytes:
{
0x30, 0x95, 0x2c, 0x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2, 0xec, 0xb2, 
0x1e, 0xd5, 0xe9, 0x1d, 0xe0, 0x27, 0x32, 0xc7, 
0xc3, 0xb1, 0x34, 0x95, 0xdf, 0xef, 0xb8, 0xaf, 
0xa1, 0x3, 0x13, 0x86, 0x20, 0x25, 0x7f, 0xfa, 
0xbf, 0xbb, 0x28, 0xd9, 0x7f, 0x85, 0xf5, 0xaf, 
0x17, 0x64, 0x55, 0x61, 0xc6, 0x69, 0x10, 0xfd, 
0x46, 0x60, 0x3e, 0xeb, 0x8f, 0xe9, 0xa2, 0xcf, 
0xd0, 0x5e, 0x6f, 0xb0, 0xa, 0xd, 0xff, 0xff, 
0xff, 0x1, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0, 0x0, 0x0, 0x0, 0xd, 0x0, 0x0, 0x0 
}

    Attestation Report:
    id: 0x12345678.
    status: 0.
    revocation_reason: 0.
    pse_status: 0.

    Enclave Report:
    Signature Type: 0x2
    Signature Basename: ��L��
��:������P�bns9
    attributes.flags: 0x7
    attributes.xfrm: 0xe7
    mr_enclave: 461165feef4e985a048a7c9ad899020abfc38b9bc30bb51b4a4432a46e205d8f
    mr_signer: 60277ad2fdfc57e980e876e7f878ac1909880ea5380795a7e8ea98b157841f85
    isv_prod_id: 0x0
    isv_svn: 0x0

Sent MSG3 successfully. Received an attestation result message back
.
ATTESTATION RESULT RECEIVED - 145 bytes:
{
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0, 0x97, 0x9e, 0xb9, 0x5a, 0xdd, 0x14, 0x17, 
0xf2, 0xfa, 0xad, 0xfa, 0xd7, 0x66, 0x73, 0xfd, 
0x71, 0x57, 0xf4, 0xe9, 0x8d, 0xee, 0xaf, 0x42, 
0x5e, 0xbb, 0x8a, 0x4c, 0xd4, 0x84, 0xdc, 0x83, 
0x6a, 0x8, 0x70, 0xd, 0xf2, 0x42, 0x8b, 0x2b, 
0xee, 0x42, 0xb0, 0x85, 0xe5, 0xbf, 0x99, 0xc5, 
0x22, 0xf8, 0x37, 0xf7, 0xee, 0xb6, 0x2c, 0xd5, 
0x8c, 0x37, 0xa2, 0xd2, 0x51, 0xed, 0x45, 0xf9, 
0x65, 0xd8, 0x7, 0x3e, 0xe9, 0xd5, 0x32, 0xaa, 
0xc6, 0x1f, 0x71, 0x4f, 0x54, 0xc, 0xde, 0x1c, 
0x3a, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0, 0x74, 0x5b, 0xa4, 0xda, 0x97, 0x74, 0x5f, 
0x87, 0x5b, 0xb9, 0x51, 0xca, 0x44, 0x2, 0x9e, 
0x9c 
}

Secret successfully received from server.
Remote attestation success!
Call enclave_ra_close success.
Second round, we will try EPID algorithm.

Call sgx_get_extended_epid_group_id success.
MSG0 body generated -
4 bytes:
{
0x0, 0x0, 0x0, 0x0 
}

Sending msg0 to remote attestation service provider.

Sent MSG0 to remote attestation service.

Call sgx_select_att_key_id success.
Call sgx_create_enclave success.
Call enclave_init_ra success.
Call sgx_ra_get_msg1_ex success.

MSG1 body generated -
68 bytes:
{
0x1b, 0x86, 0xd, 0x7a, 0xba, 0xe3, 0xc8, 0xde, 
0xac, 0x56, 0xb2, 0x36, 0xc8, 0x29, 0xfa, 0x55, 
0xc7, 0x5, 0xc3, 0x10, 0x70, 0x3f, 0x1, 0x66, 
0x57, 0x16, 0x83, 0x77, 0x1e, 0xad, 0x12, 0xd7, 
0x4, 0xad, 0x1e, 0xc0, 0x3e, 0xf6, 0xaa, 0x5a, 
0x40, 0x91, 0x38, 0xec, 0x51, 0x47, 0x15, 0x1a, 
0x52, 0x27, 0x6f, 0xee, 0xb9, 0x5e, 0xf1, 0x75, 
0x69, 0x60, 0x45, 0x29, 0xa1, 0xb0, 0x63, 0x1f, 
0x0, 0x0, 0x0, 0x0 
}

Sending msg1 to remote attestation service provider.Expecting msg2 back.

Sent MSG1 to remote attestation service provider. Received the following MSG2:
176 bytes:
{
0x2, 0x0, 0x0, 0xa8, 0x0, 0x0, 0x0, 0x0, 
0x6a, 0x83, 0xdc, 0x84, 0xd4, 0x4c, 0x8a, 0xbb, 
0x5e, 0x42, 0xaf, 0xee, 0x8d, 0xe9, 0xf4, 0x57, 
0x71, 0xfd, 0x73, 0x66, 0xd7, 0xfa, 0xad, 0xfa, 
0xf2, 0x17, 0x14, 0xdd, 0x5a, 0xb9, 0x9e, 0x97, 
0x79, 0xa7, 0x38, 0x72, 0xf2, 0xb8, 0xd6, 0xbe, 
0x18, 0x91, 0x7f, 0xf7, 0xb5, 0xd3, 0xe5, 0x64, 
0x9b, 0x12, 0x18, 0xaf, 0x39, 0x29, 0x6c, 0x24, 
0x19, 0x38, 0x29, 0xb, 0xc6, 0xac, 0xc, 0x62, 
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 
0x58, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x1, 0x0, 0x1, 0x0, 0x6a, 0x83, 0xdc, 0x84, 
0xd4, 0x4c, 0x8a, 0xbb, 0x5e, 0x42, 0xaf, 0xee, 
0x8d, 0xe9, 0xf4, 0x57, 0x71, 0xfd, 0x73, 0x66, 
0xd7, 0xfa, 0xad, 0xfa, 0xf2, 0x17, 0x14, 0xdd, 
0x5a, 0xb9, 0x9e, 0x97, 0xe2, 0x4c, 0x82, 0xa8, 
0x1e, 0xc6, 0x7d, 0x31, 0xa3, 0x69, 0x22, 0x67, 
0x8d, 0xee, 0xcc, 0x99, 0x78, 0xcd, 0x3e, 0x64, 
0x9, 0x1a, 0x2a, 0xa8, 0xc0, 0x6c, 0x3e, 0x88, 
0x34, 0xce, 0x3, 0x88, 0x41, 0x17, 0x92, 0x5, 
0xd8, 0x33, 0xed, 0xfa, 0xbc, 0xeb, 0x15, 0x5f, 
0x72, 0x85, 0xae, 0xd8, 0x0, 0x0, 0x0, 0x0 
}

A more descriptive representation of MSG2:
RESPONSE TYPE:   0x2
RESPONSE STATUS: 0x0 0x0
RESPONSE BODY SIZE: 168
MSG2 gb - 64 bytes:
{
0x6a, 0x83, 0xdc, 0x84, 0xd4, 0x4c, 0x8a, 0xbb, 
0x5e, 0x42, 0xaf, 0xee, 0x8d, 0xe9, 0xf4, 0x57, 
0x71, 0xfd, 0x73, 0x66, 0xd7, 0xfa, 0xad, 0xfa, 
0xf2, 0x17, 0x14, 0xdd, 0x5a, 0xb9, 0x9e, 0x97, 
0x79, 0xa7, 0x38, 0x72, 0xf2, 0xb8, 0xd6, 0xbe, 
0x18, 0x91, 0x7f, 0xf7, 0xb5, 0xd3, 0xe5, 0x64, 
0x9b, 0x12, 0x18, 0xaf, 0x39, 0x29, 0x6c, 0x24, 
0x19, 0x38, 0x29, 0xb, 0xc6, 0xac, 0xc, 0x62 
}
MSG2 spid - 16 bytes:
{
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 
0x58, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 
}
MSG2 quote_type : 1
MSG2 kdf_id : 1
MSG2 sign_gb_ga - 64 bytes:
{
0x6a, 0x83, 0xdc, 0x84, 0xd4, 0x4c, 0x8a, 0xbb, 
0x5e, 0x42, 0xaf, 0xee, 0x8d, 0xe9, 0xf4, 0x57, 
0x71, 0xfd, 0x73, 0x66, 0xd7, 0xfa, 0xad, 0xfa, 
0xf2, 0x17, 0x14, 0xdd, 0x5a, 0xb9, 0x9e, 0x97, 
0xe2, 0x4c, 0x82, 0xa8, 0x1e, 0xc6, 0x7d, 0x31, 
0xa3, 0x69, 0x22, 0x67, 0x8d, 0xee, 0xcc, 0x99, 
0x78, 0xcd, 0x3e, 0x64, 0x9, 0x1a, 0x2a, 0xa8, 
0xc0, 0x6c,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, 0xee, 0x85, 0xfc, 
0x16, 0x1f, 0xf0, 0x79, 0x7c, 0x78, 0xf2, 0x12, 
0x6f, 0x35, 0x3f, 0xca, 0xf2, 0x8d, 0xe7, 0x60, 
0x5e, 0x7e, 0xc7, 0x78, 0x9a, 0xa4, 0xa2, 0x1b, 
0x53, 0xaa, 0x69, 0xc0, 0x9c, 0x67, 0xe3, 0x9f, 
0xd0, 0xe9, 0x19, 0x47, 0x9b, 0x56, 0x11, 0x6f, 
0x5c, 0x8c, 0xd0, 0x30, 0x55, 0x86, 0x8e, 0x4a, 
0x5e, 0x7b, 0x56, 0xef, 0xe3, 0x53, 0x43, 0x6d, 
0xd5, 0x17, 0x15, 0xaa, 0x14, 0x6c, 0x49, 0x23, 
0xee, 0xa1, 0x1c, 0xd7, 0xd7, 0xa9, 0x56, 0xe2, 
0x14, 0xde, 0x4a, 0xab, 0xe6, 0xf3, 0xf3, 0x76, 
0x1d, 0x76, 0xcd, 0xa9, 0x66, 0xc6, 0x9d, 0x2a, 
0x66, 0xae, 0xed, 0x31, 0x1d, 0xe8, 0xac, 0xa7, 
0xf2, 0x2f, 0xa8, 0x43, 0x39, 0xef, 0x1b, 0x6a, 
0xc1, 0x21, 0xad, 0x61, 0x5a, 0x6d, 0x76, 0x15, 
0x71, 0x86, 0xc6, 0xc5, 0x4, 0x50, 0x41, 0x9e, 
0x83, 0xe7, 0x2f, 0xfd, 0xa1, 0x25, 0xf5, 0x76, 
0x8e, 0xe2, 0xbc, 0xa6, 0xf, 0xe2, 0x84, 0x4a, 
0x4e, 0x23, 0xa, 0xc3, 0x4a, 0x4f, 0xe, 0xe6, 
0x2d, 0xc3, 0x4, 0x90, 0xe2, 0x3a, 0x5, 0x98, 
0x5c, 0xb6, 0xda, 0x32, 0xb1, 0x58, 0x84, 0xd9, 
0x22, 0x83, 0x29, 0xf5 
}

    Attestation Report:
    id: 0x12345678.
    status: 0.
    revocation_reason: 0.
    pse_status: 0.

    Enclave Report:
    Signature Type: 0x0
    Signature Basename: 
    attributes.flags: 0x7
    attributes.xfrm: 0xe7
    mr_enclave: 461165feef4e985a048a7c9ad899020abfc38b9bc30bb51b4a4432a46e205d8f
    mr_signer: 60277ad2fdfc57e980e876e7f878ac1909880ea5380795a7e8ea98b157841f85
    isv_prod_id: 0x0
    isv_svn: 0x0

Sent MSG3 successfully. Received an attestation result message back
.
ATTESTATION RESULT RECEIVED - 145 bytes:
{
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0, 0x97, 0x9e, 0xb9, 0x5a, 0xdd, 0x14, 0x17, 
0xf2, 0xfa, 0xad, 0xfa, 0xd7, 0x66, 0x73, 0xfd, 
0x71, 0x57, 0xf4, 0xe9, 0x8d, 0xee, 0xaf, 0x42, 
0x5e, 0xbb, 0x8a, 0x4c, 0xd4, 0x84, 0xdc, 0x83, 
0x6a, 0x8, 0x70, 0xd, 0xf2, 0x42, 0x8b, 0x2b, 
0xee, 0x42, 0xb0, 0x85, 0xe5, 0xbf, 0x99, 0xc5, 
0x22, 0xf8, 0x37, 0xf7, 0xee, 0xb6, 0x2c, 0xd5, 
0x8c, 0x37, 0xa2, 0xd2, 0x51, 0xed, 0x45, 0xf9, 
0x65, 0xb, 0x53, 0x13, 0x6f, 0x50, 0x37, 0x48, 
0x3f, 0xee, 0x21, 0x70, 0x15, 0x8d, 0x6b, 0xe, 
0xd7, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x0, 0x6a, 0x82, 0x98, 0x6d, 0x18, 0xb7, 0xac, 
0x4d, 0xc1, 0xe, 0x50, 0xb1, 0xcd, 0x4c, 0xf4, 
0x5e 
}

Secret successfully received from server.
Remote attestation success!
Call enclave_ra_close success.
Enter a character before exit ...

Is there a problem in my sdk installation environment?

kailun-qin commented 2 years ago

Ok, something is weird I think, in this path that you mention I couldn't build: /usr/local/bin/ld: cannot find -lsample_libcrypto

It's not an issue, pls kindly try LD_LIBRARY_PATH=<path to where your libsample_libcrypto.so locates> ./app - it should be fine then.

Is there a problem in my sdk installation environment?

No, it looks good to me.

Well, taking another closer look at your previous log, you were trying to run w/

./client epid aa98a7e764579d77a03244ee1a55883da07de7e9c1572dbc63df9b3a9c1f5c7d 65bef116ca6a754bc2ef97ea599eac5ead64b54ebb3faacefdae930da409299b 0 0

but it looks like RA_TLS_EPID_API_KEY=xxx (client API key for EPID) is missing? Please kindly have a look at https://github.com/gramineproject/gramine/blob/90f8b9d7eacfa1c9bc07089d9d00ea774888435f/CI-Examples/ra-tls-mbedtls/README.md and follow the steps specified there. Thanks!

gus6202 commented 2 years ago

Oh I'm so sorry, I used to run with DCAP and I forgot that. Now I got a new error:

~/Desktop/gramine/CI-Examples/ra-tls-mbedtls$ RA_TLS_EPID_API_KEY=5c9ff8a24d50404aad8ff3cb2e0cb6a2 \
> RA_TLS_MRENCLAVE=6982f0553d8f4938db66dba911abf0137337886c2e011b2011dddae8ea350a11 \
> RA_TLS_MRSIGNER=65bef116ca6a754bc2ef97ea599eac5ead64b54ebb3faacefdae930da409299b \
> RA_TLS_ISV_PROD_ID=0 \
> RA_TLS_ISV_SVN=0 \
> ./client epid
[ using default SGX-measurement verification callback (via RA_TLS_* environment variables) ]

  . Seeding the random number generator... ok
  . Connecting to tcp/localhost/4433... ok
  . Setting up the SSL/TLS structure... ok
  . Loading the CA root certificate ... ok
  . Installing RA-TLS callback ... ok
  . Performing the SSL/TLS handshake...IAS report: signature verified correctly
IAS report: quote status OK
verify_quote_body_enclave_attributes: Quote: DEBUG bit in enclave attributes is set
 failed
  ! mbedtls_ssl_handshake returned -0x3000

Last error was: -12288 - X509 - A fatal error occurred, eg the chain is too long or the vrfy callback failed

image

At least I know my spid and key are working, the thing is gramine. Is it because LD_LIBRARY_PATH is not on the right path?

kailun-qin commented 2 years ago

Please kindly try to add “RA_TLS_ALLOW_DEBUG_ENCLAVE_INSECURE=1” as mentioned in the Readme (it looks like you’re building and attesting a debug version enclave). Additionally, note that there is another option (not related to this error, but potentially needed depending on your config) - “RA_TLS_ALLOW_OUTDATED_TCB_INSECURE”, pls kindly set if needed.

gus6202 commented 2 years ago

Finally, now it's working!

~/Desktop/gramine/CI-Examples/ra-tls-mbedtls$ RA_TLS_ALLOW_DEBUG_ENCLAVE_INSECURE=1 RA_TLS_ALLOW_OUTDATED_TCB_INSECURE=1 RA_TLS_EPID_API_KEY=5c9ff8a24d50404aad8ff3cb2e0cb6a2 RA_TLS_MRENCLAVE=6982f0553d8f4938db66dba911abf0137337886c2e011b2011dddae8ea350a11 RA_TLS_MRSIGNER=65bef116ca6a754bc2ef97ea599eac5ead64b54ebb3faacefdae930da409299b RA_TLS_ISV_PROD_ID=0 RA_TLS_ISV_SVN=0 ./client epid
[ using default SGX-measurement verification callback (via RA_TLS_* environment variables) ]

  . Seeding the random number generator... ok
  . Connecting to tcp/localhost/4433... ok
  . Setting up the SSL/TLS structure... ok
  . Loading the CA root certificate ... ok
  . Installing RA-TLS callback ... ok
  . Performing the SSL/TLS handshake...IAS report: signature verified correctly
IAS report: quote status OK
 ok
  . Verifying peer X.509 certificate... ok
  > Write to server: 18 bytes written

GET / HTTP/1.0

  < Read from server: 156 bytes read

HTTP/1.0 200 OK
Content-Type: text/html

<h2>mbed TLS Test Server</h2>
<p>Successful connection using: TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256</p>

I did change the manifests (instead of debug= true I changed to debug=false) like someone did and fix this kind of error (#571). Now I reverted to debug=true and run with RA_TLS_ALLOW_DEBUG_ENCLAVE_INSECURE=1. Sorry for disturbing and I'm really thankful for your help,

Best regards