├── SampleCode
├── debug_mock_key.bin
└── SampleEnclave
│ ├── Seal
│ ├── Seal.lds
│ ├── Seal.config.xml
│ ├── Seal.edl
│ ├── Seal_private.pem
│ └── Seal.cpp
│ ├── Enclave
│ ├── Enclave.lds
│ ├── Enclave.config.xml
│ ├── Enclave.h
│ ├── Enclave.cpp
│ ├── TrustedLibrary
│ │ ├── Libcxx.edl
│ │ ├── Thread.edl
│ │ ├── Libc.edl
│ │ ├── Libc.cpp
│ │ ├── Libcxx.cpp
│ │ └── Thread.cpp
│ ├── Enclave_private.pem
│ ├── Enclave.edl
│ └── Edger8rSyntax
│ │ ├── Functions.cpp
│ │ ├── Types.edl
│ │ ├── Functions.edl
│ │ ├── Arrays.cpp
│ │ ├── Arrays.edl
│ │ ├── Types.cpp
│ │ ├── Pointers.cpp
│ │ └── Pointers.edl
│ ├── Include
│ └── user_types.h
│ └── App
│ ├── TrustedLibrary
│ ├── Libcxx.cpp
│ ├── Libc.cpp
│ └── Thread.cpp
│ ├── App.h
│ └── Edger8rSyntax
│ ├── Functions.cpp
│ ├── Types.cpp
│ ├── Arrays.cpp
│ └── Pointers.cpp
├── lib64
└── README
├── bin
└── x64
│ └── README
├── Intel(R) SGX Protected Code Loader for Linux User Guide.pdf
├── Include
└── sgx_pcl_guid.h
├── Makefile
├── Sources
├── unseal
│ ├── pcl_unseal_internal.h
│ ├── sim
│ │ ├── pcl_deriv.cpp
│ │ └── pcl_t_instructions.cpp
│ ├── pcl_tSeal_util.cpp
│ ├── pcl_tSeal_internal.cpp
│ ├── pcl_tSeal.cpp
│ └── pcl_sgx_get_key.cpp
├── pcl_internal.h
├── crypto
│ ├── pcl_crypto_internal.h
│ ├── pcl_modes_lcl.h
│ ├── pcl_cmac.c
│ ├── pcl_crypto.cpp
│ └── pcl_md32_common.h
├── pcl_mem.cpp
├── Makefile
└── pcl_entry.cpp
├── Tools
└── Encryptip
│ ├── Makefile
│ └── encryptip.h
├── CONTRIBUTING.md
├── Common
└── pcl_common.h
└── License.txt
/SampleCode/debug_mock_key.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intel/linux-sgx-pcl/HEAD/SampleCode/debug_mock_key.bin
--------------------------------------------------------------------------------
/lib64/README:
--------------------------------------------------------------------------------
1 | This folder holds the libraries which are generated by the build process.
2 | This folders structure follows the Intel(R) SGX PSW and SDK.
--------------------------------------------------------------------------------
/bin/x64/README:
--------------------------------------------------------------------------------
1 | This folder holds the executable tool which is generated by the build process.
2 | This folders structure follows the Intel(R) SGX PSW and SDK.
--------------------------------------------------------------------------------
/Intel(R) SGX Protected Code Loader for Linux User Guide.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/intel/linux-sgx-pcl/HEAD/Intel(R) SGX Protected Code Loader for Linux User Guide.pdf
--------------------------------------------------------------------------------
/SampleCode/SampleEnclave/Seal/Seal.lds:
--------------------------------------------------------------------------------
1 | enclave.so
2 | {
3 | global:
4 | g_global_data_sim;
5 | g_global_data;
6 | enclave_entry;
7 | g_peak_heap_used;
8 | local:
9 | *;
10 | };
11 |
--------------------------------------------------------------------------------
/SampleCode/SampleEnclave/Enclave/Enclave.lds:
--------------------------------------------------------------------------------
1 | enclave.so
2 | {
3 | global:
4 | g_global_data_sim;
5 | g_global_data;
6 | enclave_entry;
7 | g_peak_heap_used;
8 | local:
9 | *;
10 | };
11 |
--------------------------------------------------------------------------------
/SampleCode/SampleEnclave/Seal/Seal.config.xml:
--------------------------------------------------------------------------------
1 |
2 | 0
3 | 0
4 | 0x40000
5 | 0x100000
6 | 10
7 | 1
8 |
9 | 0
10 | 0
11 | 0xFFFFFFFF
12 |
13 |
--------------------------------------------------------------------------------
/SampleCode/SampleEnclave/Enclave/Enclave.config.xml:
--------------------------------------------------------------------------------
1 |
2 | 0
3 | 0
4 | 0x40000
5 | 0x100000
6 | 10
7 | 1
8 |
9 | 0
10 | 0
11 | 0xFFFFFFFF
12 |
13 |
--------------------------------------------------------------------------------
/SampleCode/SampleEnclave/Include/user_types.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions
6 | * are met:
7 | *
8 | * * Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * * Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in
12 | * the documentation and/or other materials provided with the
13 | * distribution.
14 | * * Neither the name of Intel Corporation nor the names of its
15 | * contributors may be used to endorse or promote products derived
16 | * from this software without specific prior written permission.
17 | *
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 |
33 | /* User defined types */
34 |
35 |
36 | #define LOOPS_PER_THREAD 500
37 |
38 | typedef void *buffer_t;
39 | typedef int array_t[10];
40 |
41 |
--------------------------------------------------------------------------------
/SampleCode/SampleEnclave/Enclave/Enclave.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions
6 | * are met:
7 | *
8 | * * Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * * Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in
12 | * the documentation and/or other materials provided with the
13 | * distribution.
14 | * * Neither the name of Intel Corporation nor the names of its
15 | * contributors may be used to endorse or promote products derived
16 | * from this software without specific prior written permission.
17 | *
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 |
33 | #ifndef _ENCLAVE_H_
34 | #define _ENCLAVE_H_
35 |
36 | #include
37 | #include
38 |
39 | #if defined(__cplusplus)
40 | extern "C" {
41 | #endif
42 |
43 | void printf(const char *fmt, ...);
44 |
45 | #if defined(__cplusplus)
46 | }
47 | #endif
48 |
49 | #endif /* !_ENCLAVE_H_ */
50 |
--------------------------------------------------------------------------------
/SampleCode/SampleEnclave/App/TrustedLibrary/Libcxx.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions
6 | * are met:
7 | *
8 | * * Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * * Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in
12 | * the documentation and/or other materials provided with the
13 | * distribution.
14 | * * Neither the name of Intel Corporation nor the names of its
15 | * contributors may be used to endorse or promote products derived
16 | * from this software without specific prior written permission.
17 | *
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 | #include
33 |
34 | #include "../App.h"
35 | #include "Enclave_u.h"
36 |
37 | /* ecall_libcxx_functions:
38 | * Invokes standard C++ functions.
39 | */
40 | void ecall_libcxx_functions(void)
41 | {
42 | sgx_status_t ret = SGX_ERROR_UNEXPECTED;
43 |
44 | ret = ecall_exception(global_eid);
45 | if (ret != SGX_SUCCESS)
46 | abort();
47 |
48 | ret = ecall_map(global_eid);
49 | if (ret != SGX_SUCCESS)
50 | abort();
51 | }
52 |
--------------------------------------------------------------------------------
/SampleCode/SampleEnclave/Enclave/Enclave.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions
6 | * are met:
7 | *
8 | * * Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * * Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in
12 | * the documentation and/or other materials provided with the
13 | * distribution.
14 | * * Neither the name of Intel Corporation nor the names of its
15 | * contributors may be used to endorse or promote products derived
16 | * from this software without specific prior written permission.
17 | *
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 |
33 | #include
34 | #include /* vsnprintf */
35 |
36 | #include "Enclave.h"
37 | #include "Enclave_t.h" /* print_string */
38 |
39 | /*
40 | * printf:
41 | * Invokes OCALL to display the enclave buffer to the terminal.
42 | */
43 | void printf(const char *fmt, ...)
44 | {
45 | char buf[BUFSIZ] = {'\0'};
46 | va_list ap;
47 | va_start(ap, fmt);
48 | vsnprintf(buf, BUFSIZ, fmt, ap);
49 | va_end(ap);
50 | ocall_print_string(buf);
51 | }
52 |
--------------------------------------------------------------------------------
/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libcxx.edl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions
6 | * are met:
7 | *
8 | * * Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * * Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in
12 | * the documentation and/or other materials provided with the
13 | * distribution.
14 | * * Neither the name of Intel Corporation nor the names of its
15 | * contributors may be used to endorse or promote products derived
16 | * from this software without specific prior written permission.
17 | *
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | *
30 | */
31 |
32 |
33 | /* Libcxx.edl - EDL sample for trusted C++ library. */
34 |
35 | enclave {
36 |
37 | /*
38 | * A subset of the C++03 standard is supported.
39 | */
40 |
41 | trusted {
42 | /*
43 | * Throw/catch exception inside the enclave.
44 | */
45 | public void ecall_exception(void);
46 |
47 | /*
48 | * Utilize