Skip to content

Commit 68f44d6

Browse files
committed
Linux 2.3 Open Source Gold Release
Support for Ubuntu 18.04 LTS 64-bit Desktop and Server version Provided a new set of SGX common loader APIs in sgx_enclave_common.h Provided the sample code for Switchless Call Provided a new API in tcrypto: sgx_ecc256_calculate_pub_from_priv sgx_create_enclave API will ignore the parameter of launch token and will not update it after function successfully returns Change Intel SGX PSW installer for Ubuntu by - Using .deb installer. - Using name libsgx-enclave-common_{version string}-1_amd64.deb. - Installing Intel SGX Enclave Common loader library. Bug fixes Signed-off-by: Li, Xun <[email protected]>
1 parent d607c79 commit 68f44d6

File tree

182 files changed

+7021
-1832
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+7021
-1832
lines changed

Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/OSGI-INF/l10n/bundle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212

1313

1414
Bundle-Vendor = Intel Corporation
15-
Bundle-Name = SGX(R) Linux Eclipse Plugin
15+
Bundle-Name = Intel(R) SGX Linux Eclipse Plugin

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ sdk_install_pkg: sdk
4747
psw_install_pkg: psw
4848
./linux/installer/bin/build-installpkg.sh psw
4949

50+
deb_sgx_enclave_common_pkg: psw
51+
./linux/installer/deb/libsgx-enclave-common/build.sh
52+
5053
clean:
5154
@$(MAKE) -C sdk/ clean
5255
@$(MAKE) -C psw/ clean

README.md

Lines changed: 64 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,22 @@ Build the Intel(R) SGX SDK and Intel(R) SGX PSW Package
3434
-------------------------------------------------------
3535
### Prerequisites:
3636
- Ensure that you have one of the following required operating systems:
37-
* Ubuntu\* 16.04 LTS Desktop 64bits
38-
* Ubuntu\* 16.04 LTS Server 64bits
37+
* Ubuntu\* 18.04 LTS Desktop 64bits
38+
* Ubuntu\* 18.04 LTS Server 64bits
3939
* Red Hat Enterprise Linux Server release 7.4 64bits
40-
* CentOS 7.4.1708 64bits
40+
* CentOS 7.5 64bits
4141
* Fedora 27 Server 64bits
4242
* SUSE Linux Enterprise Server 12 64bits
4343

4444
- Use the following command(s) to install the required tools to build the Intel(R) SGX SDK:
45-
* On Ubuntu 16.04:
45+
* On Ubuntu 18.04:
4646
```
47-
$ sudo apt-get install build-essential ocaml automake autoconf libtool wget python
47+
$ sudo apt-get install build-essential ocaml ocamlbuild automake autoconf libtool wget python libssl-dev
4848
```
49-
* On Red Hat Enterprise Linux 7.4 and CentOS 7.4:
49+
* On Red Hat Enterprise Linux 7.4 and CentOS 7.5:
5050
```
5151
$ sudo yum groupinstall 'Development Tools'
52-
$ sudo yum install ocaml wget python
52+
$ sudo yum install ocaml ocaml-ocamlbuild wget python openssl-devel
5353
```
5454
* On Fedora 27:
5555
```
@@ -59,14 +59,14 @@ Build the Intel(R) SGX SDK and Intel(R) SGX PSW Package
5959
* On SUSE Linux Enterprise Server 12:
6060
```
6161
$ sudo zypper install --type pattern devel_basis
62-
$ sudo zypper install ocaml ocaml-ocamlbuild automake autoconf libtool wget python
62+
$ sudo zypper install ocaml ocaml-ocamlbuild automake autoconf libtool wget python libopenssl-devel
6363
```
6464
- Use the following command to install additional required tools to build the Intel(R) SGX PSW:
65-
* On Ubuntu 16.04:
65+
* On Ubuntu 18.04:
6666
```
67-
$ sudo apt-get install libssl-dev libcurl4-openssl-dev protobuf-compiler libprotobuf-dev
67+
$ sudo apt-get install libssl-dev libcurl4-openssl-dev protobuf-compiler libprotobuf-dev debhelper
6868
```
69-
* On Red Hat Enterprise Linux 7.4, CentOS 7.4 and Fedora 27:
69+
* On Red Hat Enterprise Linux 7.4, CentOS 7.5 and Fedora 27:
7070
```
7171
$ sudo yum install openssl-devel libcurl-devel protobuf-devel
7272
```
@@ -127,33 +127,45 @@ $ make sdk_install_pkg DEBUG=1
127127

128128
### Build the Intel(R) SGX PSW Installer
129129
To build the Intel(R) SGX PSW installer, enter the following command:
130-
```
131-
$ make psw_install_pkg
132-
```
133-
You can find the generated Intel(R) SGX PSW installer ``sgx_linux_x64_psw_${version}.bin`` located under `linux/installer/bin/`, where `${version}` refers to the version number.
130+
- On Ubuntu 18.04:
131+
```
132+
$ make deb_sgx_enclave_common_pkg
133+
```
134+
You can find the generated Intel(R) SGX PSW installer ``libsgx-enclave-common_${version}-${revision}_${arch}.deb`` located under `linux/installer/deb/libsgx-enclave-common`, where `${version}` refers to the version number and the `${arch}` refers to the platform.
134135

135-
**Note**: The above command builds the Intel(R) SGX SDK and PSW with default configuration firstly and then generates the target PSW Installer. To build the Intel(R) SGX PSW Installer with debug information kept in the tools and libraries, enter the following command:
136-
```
137-
$ make psw_install_pkg DEBUG=1
138-
```
136+
**Note**: The above command builds the Intel(R) SGX PSW with default configuration firstly and then generates the target PSW Installer. To build the Intel(R) SGX PSW Installer with debug information kept in the tools and libraries, enter the following command:
137+
```
138+
$ make deb_sgx_enclave_common_pkg DEBUG=1
139+
```
140+
- On Red Hat Enterprise Linux 7.4 and CentOS 7.5:
141+
- On Fedora 27:
142+
- On SUSE Linux Enterprise Server 12:
143+
```
144+
$ make psw_install_pkg
145+
```
146+
You can find the generated Intel(R) SGX PSW installer ``sgx_linux_x64_psw_${version}.bin`` located under `linux/installer/bin/`, where `${version}` refers to the version number.
139147

148+
**Note**: The above command builds the Intel(R) SGX PSW with default configuration firstly and then generates the target PSW Installer. To build the Intel(R) SGX PSW Installer with debug information kept in the tools and libraries, enter the following command:
149+
```
150+
$ make psw_install_pkg DEBUG=1
151+
```
140152

141153
Install the Intel(R) SGX SDK
142154
------------------------
143155
### Prerequisites
144156
- Ensure that you have one of the following operating systems:
145-
* Ubuntu\* 16.04 LTS Desktop 64bits
146-
* Ubuntu\* 16.04 LTS Server 64bits
157+
* Ubuntu\* 18.04 LTS Desktop 64bits
158+
* Ubuntu\* 18.04 LTS Server 64bits
147159
* Red Hat Enterprise Linux Server release 7.4 64bits
148-
* CentOS 7.4.1708 64bits
160+
* CentOS 7.5 64bits
149161
* Fedora 27 Server 64bits
150162
* SUSE Linux Enterprise Server 12 64bits
151163
- Use the following command to install the required tool to use Intel(R) SGX SDK:
152-
* On Ubuntu 16.04:
164+
* On Ubuntu 18.04:
153165
```
154166
$ sudo apt-get install build-essential python
155167
```
156-
* On Red Hat Enterprise Linux 7.4 and CentOS 7.4:
168+
* On Red Hat Enterprise Linux 7.4 and CentOS 7.5:
157169
```
158170
$ sudo yum groupinstall 'Development Tools'
159171
$ sudo yum install python
@@ -205,39 +217,39 @@ Install the Intel(R) SGX PSW
205217
----------------------------
206218
### Prerequisites
207219
- Ensure that you have one of the following operating systems:
208-
* Ubuntu\* 16.04 LTS Desktop 64bits
209-
* Ubuntu\* 16.04 LTS Server 64bits
220+
* Ubuntu\* 18.04 LTS Desktop 64bits
221+
* Ubuntu\* 18.04 LTS Server 64bits
210222
* Red Hat Enterprise Linux Server release 7.4 64bits
211-
* CentOS 7.4.1708 64bits
223+
* CentOS 7.5 64bits
212224
* Fedora 27 Server 64bits
213225
* SUSE Linux Enterprise Server 12 64bits
214226
- Ensure that you have a system with the following required hardware:
215227
* 6th Generation Intel(R) Core(TM) Processor or newer
216228
- Configure the system with the **Intel SGX hardware enabled** option and install Intel(R) SGX driver in advance.
217229
See the earlier topic, *Build and Install the Intel(R) SGX Driver*, for information on how to install the Intel(R) SGX driver.
218230
- Install the library using the following command:
219-
* On Ubuntu 16.04:
231+
* On Ubuntu 18.04:
220232
```
221233
$ sudo apt-get install libssl-dev libcurl4-openssl-dev libprotobuf-dev
222234
```
223-
* On Red Hat Enterprise Linux 7.4, CentOS 7.4 and Fedora 27:
235+
* On Red Hat Enterprise Linux 7.4, CentOS 7.5 and Fedora 27:
224236
```
225237
$ sudo yum install openssl-devel libcurl-devel protobuf-devel
226238
```
227239
* On SUSE Linux Enterprise Server 12:
228240
```
229241
$ sudo zypper install libopenssl-devel libcurl-devel protobuf-devel
230242
```
231-
- To use Trusted Platform Service functions:
243+
- `iclsClient` and `JHI` are optional prerequisite components and are needed if you need to use Intel(R) SGX Platform Service. To install these components:
232244
Ensure `mei_me` driver is enabled and `/dev/mei0` exists.
233245
Download [iclsClient](https://software.intel.com/en-us/sgx-sdk/download) and install it using the following commands:
234-
* On Ubuntu 16.04:
246+
* On Ubuntu 18.04:
235247
```
236248
$ sudo apt-get install alien
237249
$ sudo alien --scripts iclsClient-1.45.449.12-1.x86_64.rpm
238250
$ sudo dpkg -i iclsclient_1.45.449.12-2_amd64.deb
239251
```
240-
* On Red Hat Enterprise Linux 7.4, CentOS 7.4 and Fedora 27:
252+
* On Red Hat Enterprise Linux 7.4, CentOS 7.5 and Fedora 27:
241253
```
242254
$ sudo yum install iclsClient-1.45.449.12-1.x86_64.rpm
243255
```
@@ -246,12 +258,12 @@ Install the Intel(R) SGX PSW
246258
$ sudo zypper install iclsClient-1.45.449.12-1.x86_64.rpm
247259
```
248260
Download source code from [dynamic-application-loader-host-interface](https://github.com/01org/dynamic-application-loader-host-interface) project. In the source code folder, build and install the `JHI` service using the following commands:
249-
* On Ubuntu 16.04:
261+
* On Ubuntu 18.04:
250262
```
251263
$ sudo apt-get install uuid-dev libxml2-dev cmake pkg-config
252264
$ cmake .;make;sudo make install;sudo systemctl enable jhi
253265
```
254-
* On Red Hat Enterprise Linux 7.4, CentOS 7.4 and Fedora 27:
266+
* On Red Hat Enterprise Linux 7.4, CentOS 7.5 and Fedora 27:
255267
```
256268
$ sudo yum install libuuid-devel libxml2-devel cmake pkgconfig
257269
$ cmake .;make;sudo make install;sudo ldconfig;sudo systemctl enable jhi
@@ -263,12 +275,24 @@ Install the Intel(R) SGX PSW
263275
```
264276

265277
### Install the Intel(R) SGX PSW
266-
To install the Intel(R) SGX PSW, invoke the installer with root privilege:
267-
```
268-
$ cd linux/installer/bin
269-
$ sudo ./sgx_linux_x64_psw_${version}.bin
270-
```
271-
278+
To install the Intel(R) SGX PSW, invoke the installer with root privilege:
279+
- On Ubuntu 18.04:
280+
```
281+
$ cd linux/installer/deb/libsgx-enclave-common
282+
$ sudo dpkg -i ./libsgx-enclave-common_${version}-${revision}_${arch}.deb
283+
```
284+
To debug with sgx-gdb, enter the following command:
285+
```
286+
$ cd linux/installer/deb/libsgx-enclave-common
287+
$ sudo dpkg -i ./libsgx-enclave-common-dbgsym_${version}-${revision}_${arch}.ddeb
288+
```
289+
- On Red Hat Enterprise Linux 7.4 and CentOS 7.5:
290+
- On Fedora 27:
291+
- On SUSE Linux Enterprise Server 12:
292+
```
293+
$ cd linux/installer/bin
294+
$ sudo ./sgx_linux_x64_psw_${version}.bin
295+
```
272296
### Start or Stop aesmd Service
273297
The Intel(R) SGX PSW installer installs an aesmd service in your machine, which is running in a special linux account `aesmd`.
274298
To stop the service: `$ sudo service aesmd stop`

SampleCode/Cxx11SGXDemo/App/App.cpp

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -155,71 +155,22 @@ void print_error_message(sgx_status_t ret)
155155
}
156156

157157
/* Initialize the enclave:
158-
* Step 1: try to retrieve the launch token saved by last transaction
159-
* Step 2: call sgx_create_enclave to initialize an enclave instance
160-
* Step 3: save the launch token if it is updated
158+
* Call sgx_create_enclave to initialize an enclave instance
161159
*/
162160
int initialize_enclave(void)
163161
{
164-
char token_path[MAX_PATH] = {'\0'};
165162
sgx_launch_token_t token = {0};
166163
sgx_status_t ret = SGX_ERROR_UNEXPECTED;
167164
int updated = 0;
168165

169-
/* Step 1: try to retrieve the launch token saved by last transaction
170-
* if there is no token, then create a new one.
171-
*/
172-
/* try to get the token saved in $HOME */
173-
const char *home_dir = getpwuid(getuid())->pw_dir;
174-
175-
if (home_dir != NULL &&
176-
(strlen(home_dir)+strlen("/")+sizeof(TOKEN_FILENAME)+1) <= MAX_PATH) {
177-
/* compose the token path */
178-
strncpy(token_path, home_dir, strlen(home_dir));
179-
strncat(token_path, "/", strlen("/"));
180-
strncat(token_path, TOKEN_FILENAME, sizeof(TOKEN_FILENAME)+1);
181-
} else {
182-
/* if token path is too long or $HOME is NULL */
183-
strncpy(token_path, TOKEN_FILENAME, sizeof(TOKEN_FILENAME));
184-
}
185-
186-
FILE *fp = fopen(token_path, "rb");
187-
if (fp == NULL && (fp = fopen(token_path, "wb")) == NULL) {
188-
printf("Warning: Failed to create/open the launch token file \"%s\".\n", token_path);
189-
}
190-
191-
if (fp != NULL) {
192-
/* read the token from saved file */
193-
size_t read_num = fread(token, 1, sizeof(sgx_launch_token_t), fp);
194-
if (read_num != 0 && read_num != sizeof(sgx_launch_token_t)) {
195-
/* if token is invalid, clear the buffer */
196-
memset(&token, 0x0, sizeof(sgx_launch_token_t));
197-
printf("Warning: Invalid launch token read from \"%s\".\n", token_path);
198-
}
199-
}
200-
/* Step 2: call sgx_create_enclave to initialize an enclave instance */
166+
/* Call sgx_create_enclave to initialize an enclave instance */
201167
/* Debug Support: set 2nd parameter to 1 */
202168
ret = sgx_create_enclave(ENCLAVE_FILENAME, SGX_DEBUG_FLAG, &token, &updated, &global_eid, NULL);
203169
if (ret != SGX_SUCCESS) {
204170
print_error_message(ret);
205-
if (fp != NULL) fclose(fp);
206171
return -1;
207172
}
208173

209-
/* Step 3: save the launch token if it is updated */
210-
if (updated == FALSE || fp == NULL) {
211-
/* if the token is not updated, or file handler is invalid, do not perform saving */
212-
if (fp != NULL) fclose(fp);
213-
return 0;
214-
}
215-
216-
/* reopen the file with write capablity */
217-
fp = freopen(token_path, "wb", fp);
218-
if (fp == NULL) return 0;
219-
size_t write_num = fwrite(token, 1, sizeof(sgx_launch_token_t), fp);
220-
if (write_num != sizeof(sgx_launch_token_t))
221-
printf("Warning: Failed to save launch token to \"%s\".\n", token_path);
222-
fclose(fp);
223174
return 0;
224175
}
225176

SampleCode/Cxx11SGXDemo/Enclave/TrustedLibrary/Libcxx.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ class Base
228228
Base(const Base &) = delete;
229229
Base() = default;
230230
virtual void f_must_be_overrided() {};
231+
virtual ~Base() {};
231232
};
232233

233234
/* Helper class for ecall_virtual_function_control_demo.*/

0 commit comments

Comments
 (0)