Skip to content

Commit 73b8b57

Browse files
committed
Linux 2.13 Open Source Gold Release
Added more logs in PSW components for identifying issues. Upgraded OpenSSL and SgxSSL to latest version 1.1.1i in DCAP components. Added data base migration support in PCCS. Fixed bugs. Signed-off-by: Li, Xun <xun.li@intel.com>
1 parent cc7b457 commit 73b8b57

Some content is hidden

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

77 files changed

+1489
-553
lines changed

.gitignore

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,11 @@
2121
# files downloaded in preparation phase
2222
Intel redistributable binary.txt
2323
Master_EULA_for_Intel_Sw_Development_Products.pdf
24-
external/ippcp_internal/inc/ippcp.h
25-
external/ippcp_internal/inc/ippcpdefs.h
26-
external/ippcp_internal/inc/ippversion.h
27-
external/ippcp_internal/inc/sgx_ippcp.h
28-
external/ippcp_internal/license/
24+
external/ippcp_internal/
2925
external/toolset/
3026
psw/ae/data/prebuilt/README.md
3127
redist.txt
3228

3329
# directory created when running reproducibility scripts
3430
linux/reproducibility/code_dir/
31+

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
13
Intel(R) Software Guard Extensions for Linux\* OS
24
================================================
35

@@ -29,6 +31,7 @@ Intel(R) Software Guard Extensions for Linux\* OS
2931
* [Configure the Proxy for aesmd Service](#configure-the-proxy-for-aesmd-service)
3032
* [Reproducibility](#reproducibility)
3133

34+
3235
Introduction
3336
------------
3437
Intel(R) Software Guard Extensions (Intel(R) SGX) is an Intel technology for application developers seeking to protect select code and data from disclosure or modification.
@@ -159,12 +162,23 @@ You can find the three flavors of tools and libraries generated in the `build` d
159162
- This repository supports to build the Intel(R) SGX SDK with below three combinations:
160163
* `USE_OPT_LIBS=0` --- build SDK using SGXSSL and open sourced String/Math
161164
* `USE_OPT_LIBS=1` --- build SDK using optimized IPP crypto and open sourced String/Math
165+
* `USE_OPT_LIBS=2` --- build SDK with no mitigation using SGXSSL and optimized String/Math
166+
* `USE_OPT_LIBS=3` --- build SDK with no mitigation using IPP crypto and optimized String/Math
162167
The default build uses `USE_OPT_LIBS=1`, if you directly type `$ make sdk` as above.
163-
You can switch to the other build combination instead by entering the following command:
168+
You can switch to the other build combinations instead by entering the following command:
164169
```
165170
$ make sdk USE_OPT_LIBS=0
171+
```
172+
or
173+
```
174+
$ make sdk_no_mitigation USE_OPT_LIBS=2
175+
```
176+
or
177+
```
178+
$ make sdk_no_mitigation USE_OPT_LIBS=3
166179
```
167180
**Note**: Building the Intel(R) SGX PSW with open sourced SGXSSL/string/math libraries is not supported.
181+
**Note**: Building mitigation SDK with `USE_OPT_LIBS=2` or `USE_OPT_LIBS=3` is not allowed.
168182
169183
- To build Intel(R) SGX SDK with debug information, enter the following command:
170184
```
@@ -381,7 +395,7 @@ Install the Intel(R) SGX PSW
381395
```
382396
383397
### Install the Intel(R) SGX PSW
384-
- The SGX PSW provides 3 services: launch, EPID-based attestation, and algorithm agnostic attestation. Starting with the 2.8 release, the SGX PSW is split into smaller packages and the user can choose which features and services to install. There are 2 methods to install the required packages: Using individual packages or using the local repo generated by the build system. Using the local repo is recommended since the system will resolve the dependencies automatically. Currently, we support .deb and .rpm based repos.
398+
The SGX PSW provides 3 services: launch, EPID-based attestation, and algorithm agnostic attestation. Starting with the 2.8 release, the SGX PSW is split into smaller packages and the user can choose which features and services to install. There are 2 methods to install the required packages: Using individual packages or using the local repo generated by the build system. Using the local repo is recommended since the system will resolve the dependencies automatically. Currently, we support .deb and .rpm based repos.
385399
386400
#### Using the local repo(recommended)
387401
@@ -394,7 +408,7 @@ Install the Intel(R) SGX PSW
394408
395409
Optionally, you can install *-dbgsym or *-debuginfo packages to get the debug symbols, and install *-dev or *-devel packages to get the header files for development.
396410
397-
**NOTE**: To debug with sgx-gdb on Ubuntu 16.04, you need to ensure the Intel(R) SGX PSW is built under the condition that the environment variable ``DEB_BUILD_OPTIONS="nostrip"`` is set.
411+
**NOTE**: To debug with sgx-gdb on Ubuntu 16.04, you need to ensure the Intel(R) SGX PSW is built under the condition that the environment variable ``DEB_BUILD_OPTIONS="nostrip"`` is set.
398412
399413
#### Using the individual packages
400414
Please refer [Intel_SGX_Installation_Guide_Linux](https://download.01.org/intel-sgx/latest/linux-latest/docs/) for detail.
@@ -406,7 +420,6 @@ Sometimes we will split old package into smaller ones or move file between diffe
406420
```
407421
apt-get dist-upgrade -o Dpkg::Options::="--force-overwrite"
408422
```
409-
410423
#### Configure the installation
411424
Some packages are configured with recommended dependency on other packages that are not required for certain usage. For instance, the background daemon is not required for container usage. It will be installed by default, but you can drop it by using the additional option during the installation.
412425
* On Ubuntu 16.04, Ubuntu 18.04 and Ubuntu 20.04:

SampleCode/LocalAttestation/AppResponder/App.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
#define scanf_s scanf
6161
#define _tmain main
6262

63-
CPTask * g_cptask;
64-
CPServer * g_cpserver;
63+
CPTask * g_cptask = NULL;
64+
CPServer * g_cpserver = NULL;
6565

6666
void signal_handler(int sig)
6767
{
@@ -81,6 +81,14 @@ void signal_handler(int sig)
8181
exit(1);
8282
}
8383

84+
void cleanup()
85+
{
86+
if(g_cptask != NULL)
87+
delete g_cptask;
88+
if(g_cpserver != NULL)
89+
delete g_cpserver;
90+
}
91+
8492
int main(int argc, char* argv[])
8593
{
8694
(void)argc;
@@ -93,6 +101,8 @@ int main(int argc, char* argv[])
93101
if (!g_cptask || !g_cpserver)
94102
return -1;
95103

104+
atexit(cleanup);
105+
96106
// register signal handler so to respond to user interception
97107
signal(SIGINT, signal_handler);
98108
signal(SIGTERM, signal_handler);
@@ -108,6 +118,6 @@ int main(int argc, char* argv[])
108118
printf("Press Ctrl+C to exit...\n");
109119
g_cpserver->doWork();
110120
}
111-
121+
112122
return 0;
113123
}

SampleCode/LocalAttestation/AppResponder/Queue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ T* Queue<T>::blockingPop()
145145
{
146146
value = m_queue.front();
147147
m_queue.pop();
148-
delete value;
148+
free(value);
149149
}
150150
value = NULL;
151151
break;

SampleCode/LocalAttestation/AppResponder/Thread.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ bool Thread::isStopped()
6363
return m_shutDown;
6464
}
6565

66-
/*virtual*/
67-
void Thread::run()
68-
{
69-
}
70-
7166
void* Thread::doWork(void* param)
7267
{
7368
try

buildenv.mk

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,56 @@ ENCLAVE_LDFLAGS = -B$(BINUTILS_DIR) $(COMMON_LDFLAGS) -Wl,-Bstatic -Wl,-Bsymbol
249249
ENCLAVE_CFLAGS += $(MITIGATION_CFLAGS)
250250
ENCLAVE_ASFLAGS = $(MITIGATION_ASFLAGS)
251251

252-
# Two build combinations are supported to build SGX SDK:
253-
# 'USE_OPT_LIBS=0' --- build SDK using SGXSSL + open sourced String/Math
254-
# 'USE_OPT_LIBS=1' --- build SDK using optimized IPP crypto + open sourced String/Math
252+
# We have below choices as to crypto, math and string libs:
253+
# 1. crypto - SGXSSL (0), IPP crypto (1)
254+
# 2. math - optimized (0), open sourced (1)
255+
# 3. string - optimized (0), open sourced (1)
255256
#
256-
# By default, choose to build SDK using optimized IPP crypto and open sourced String/Math.
257-
# Users could build the SDK using SGXSSL + open sourced String/Math by explicitly
258-
# specifying 'USE_OPT_LIBS=0'
257+
# A macro 'USE_OPT_LIBS' is provided to allow users to build
258+
# SGX SDK with different library combination by setting different
259+
# value to 'USE_OPT_LIBS'.
260+
# By default, choose to build SDK using optimized IPP crypto +
261+
# open sourced string + open sourced math.
262+
#
263+
# IPP + open sourced string + open sourced math
259264
USE_OPT_LIBS ?= 1
265+
USE_CRYPTO_LIB ?= 1
266+
USE_STRING_LIB ?= 1
267+
USE_MATH_LIB ?= 1
268+
269+
ifeq ($(USE_OPT_LIBS), 0)
270+
# SGXSSL + open sourced string + open sourced math
271+
USE_CRYPTO_LIB := 0
272+
USE_MATH_LIB := 1
273+
USE_STRING_LIB := 1
274+
else ifeq ($(USE_OPT_LIBS), 2)
275+
# SGXSSL + optimized string + optimized math
276+
USE_CRYPTO_LIB := 0
277+
USE_MATH_LIB := 0
278+
USE_STRING_LIB := 0
279+
else ifeq ($(USE_OPT_LIBS), 3)
280+
# IPP + optimized string + optimized math
281+
USE_CRYPTO_LIB := 1
282+
USE_MATH_LIB := 0
283+
USE_STRING_LIB := 0
284+
endif
285+
286+
# macro check
287+
ifeq ($(USE_MATH_LIB), 0)
288+
ifneq ($(USE_STRING_LIB), 0)
289+
$(error ERROR: Optimized math library depends on Optimized string library)
290+
endif
291+
endif
292+
293+
ifneq ($(MITIGATION-CVE-2020-0551),)
294+
ifeq ($(USE_STRING_LIB), 0)
295+
$(error ERROR: Cannot build a mitigation SDK with Optimized string/math)
296+
endif
297+
ifeq ($(USE_MATH_LIB), 0)
298+
$(error ERROR: Cannot build a mitigation SDK with Optimized string/math)
299+
endif
300+
endif
301+
260302

261303
IPP_SUBDIR = no_mitigation
262304
ifeq ($(MITIGATION-CVE-2020-0551), LOAD)

common/inc/internal/se_trace.h

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141

4242
typedef enum
4343
{
44-
SE_TRACE_ERROR,
45-
SE_TRACE_WARNING,
46-
SE_TRACE_NOTICE,
47-
SE_TRACE_DEBUG
44+
SE_TRACE_ERROR,
45+
SE_TRACE_WARNING,
46+
SE_TRACE_NOTICE,
47+
SE_TRACE_DEBUG
4848
} se_trace_t;
4949

5050
#ifndef SE_DEBUG_LEVEL
@@ -55,35 +55,56 @@ typedef enum
5555
#ifdef __cplusplus
5656
extern "C" {
5757
#endif
58-
int se_trace_internal(int debug_level, const char *fmt, ...);
59-
58+
void se_trace_internal(int debug_level, const char *fmt, ...);
59+
void sgx_proc_log_report_default(int channel, int debug_level, const char* fmt, ...);
60+
void __attribute__((weak)) sgx_proc_log_report(int level, const char* format, ...);
6061
#ifdef __cplusplus
6162
}
6263
#endif
6364

65+
6466
/* For libraries, we usually define DISABLE_TRACE to disable any trace. */
6567
/* For apps, we usually enable trace. */
6668
#ifdef DISABLE_TRACE
6769
#define SE_TRACE(...)
6870
#define se_trace(...)
71+
#define se_trace_verbose(...)
6972
#else /* DISABLE_TRACE */
70-
#define se_trace(debug_level, fmt, ...) \
71-
do { \
72-
if(debug_level <= SE_DEBUG_LEVEL) \
73-
se_trace_internal(debug_level, fmt, ##__VA_ARGS__); \
73+
#define se_trace_verbose(debug_level, fmt, ...) \
74+
do { \
75+
se_trace_t trace_level = debug_level; \
76+
if(trace_level <= SE_DEBUG_LEVEL) \
77+
se_trace_internal(trace_level, "[%s %s:%d] " fmt, __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__); \
78+
}while(0)
79+
80+
#define se_trace(debug_level, fmt, ...) \
81+
do { \
82+
se_trace_t trace_level = debug_level; \
83+
if(trace_level <= SE_DEBUG_LEVEL) \
84+
se_trace_internal(trace_level, fmt, ##__VA_ARGS__); \
7485
}while(0)
7586

7687
/* For compatibility, SE_TRACE/se_trace is used in old code. */
7788
/* New code should use SE_TRACE_DEBUG, SE_TRACE_NOTICE, SE_TRACE_WARNING, SE_TRACE_ERROR */
7889
#define SE_TRACE(debug_level, fmt, ...) \
79-
se_trace(debug_level, "[%s %s:%d] " fmt, __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__)
90+
se_trace_verbose(debug_level, fmt, ##__VA_ARGS__)
8091
#endif/* DISABLE_TRACE */
8192

8293
/* SE_TRACE_DEBUG and SE_TRACE_NOTICE print the debug information plus message. */
83-
#define SE_TRACE_DEBUG(fmt, ...) se_trace(SE_TRACE_DEBUG, "[%s %s:%d] " fmt, __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__)
84-
#define SE_TRACE_NOTICE(fmt, ...) se_trace(SE_TRACE_NOTICE, "[%s %s:%d] " fmt, __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__)
85-
/* SE_TRACE_WARNING and SE_TRACE_ERROR only print message. */
94+
#define SE_TRACE_DEBUG(fmt, ...) se_trace_verbose(SE_TRACE_DEBUG, fmt, ##__VA_ARGS__)
95+
#define SE_TRACE_NOTICE(fmt, ...) se_trace_verbose(SE_TRACE_NOTICE, fmt, ##__VA_ARGS__)
96+
//SE_TRACE_WARNING and SE_TRACE_ERROR only print message.
8697
#define SE_TRACE_WARNING(fmt, ...) se_trace(SE_TRACE_WARNING, fmt, ##__VA_ARGS__)
8798
#define SE_TRACE_ERROR(fmt, ...) se_trace(SE_TRACE_ERROR, fmt, ##__VA_ARGS__)
8899

100+
/* SE_PROD_LOG will output message to stdout by default in production mode.
101+
When the executable is running as daemon, it will output to syslog. */
102+
#define SE_PROD_LOG(fmt, ...) \
103+
do { \
104+
if(sgx_proc_log_report) { \
105+
sgx_proc_log_report(1, "[%s %s:%d] " fmt, __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__); \
106+
} else { \
107+
se_trace_internal(SE_TRACE_ERROR, "[%s %s:%d] " fmt, __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__); \
108+
} \
109+
}while(0)
89110
#endif

common/inc/internal/se_version.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@
3131
#ifndef _SE_VERSION_H_
3232
#define _SE_VERSION_H_
3333

34-
#define STRFILEVER "2.12.100.3"
34+
#define STRFILEVER "2.13.100.4"
3535
#define SGX_MAJOR_VERSION 2
36-
#define SGX_MINOR_VERSION 12
36+
#define SGX_MINOR_VERSION 13
3737
#define SGX_REVISION_VERSION 100
3838
#define MAKE_VERSION_UINT(major,minor,rev) (((uint64_t)major)<<32 | ((uint64_t)minor) << 16 | rev)
3939
#define VERSION_UINT MAKE_VERSION_UINT(SGX_MAJOR_VERSION, SGX_MINOR_VERSION, SGX_REVISION_VERSION)
4040

41-
#define COPYRIGHT "Copyright (C) 2020 Intel Corporation"
41+
#define COPYRIGHT "Copyright (C) 2021 Intel Corporation"
4242

43-
#define UAE_SERVICE_VERSION "2.3.206.3"
44-
#define URTS_VERSION "1.1.110.3"
45-
#define ENCLAVE_COMMON_VERSION "1.0.113.3"
46-
#define LAUNCH_VERSION "1.0.108.3"
47-
#define EPID_VERSION "1.0.108.3"
48-
#define QUOTE_EX_VERSION "1.1.108.3"
43+
#define UAE_SERVICE_VERSION "2.3.207.4"
44+
#define URTS_VERSION "1.1.111.4"
45+
#define ENCLAVE_COMMON_VERSION "1.0.114.4"
46+
#define LAUNCH_VERSION "1.0.109.4"
47+
#define EPID_VERSION "1.0.109.4"
48+
#define QUOTE_EX_VERSION "1.1.109.4"
4949

5050
#endif

common/inc/sgx_error.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ typedef enum _status_t
7272
SGX_ERROR_INVALID_LAUNCH_TOKEN = SGX_MK_ERROR(0x2011), /* The launch token is not correct.*/
7373

7474
SGX_ERROR_MAC_MISMATCH = SGX_MK_ERROR(0x3001), /* Indicates verification error for reports, sealed datas, etc */
75-
SGX_ERROR_INVALID_ATTRIBUTE = SGX_MK_ERROR(0x3002), /* The enclave is not authorized */
75+
SGX_ERROR_INVALID_ATTRIBUTE = SGX_MK_ERROR(0x3002), /* The enclave is not authorized, e.g., requesting invalid attribute or launch key access on legacy SGX platform without FLC */
7676
SGX_ERROR_INVALID_CPUSVN = SGX_MK_ERROR(0x3003), /* The cpu svn is beyond platform's cpu svn value */
7777
SGX_ERROR_INVALID_ISVSVN = SGX_MK_ERROR(0x3004), /* The isv svn is greater than the enclave's isv svn */
7878
SGX_ERROR_INVALID_KEYNAME = SGX_MK_ERROR(0x3005), /* The key name is an unsupported value */
7979

8080
SGX_ERROR_SERVICE_UNAVAILABLE = SGX_MK_ERROR(0x4001), /* Indicates aesm didn't respond or the requested service is not supported */
8181
SGX_ERROR_SERVICE_TIMEOUT = SGX_MK_ERROR(0x4002), /* The request to aesm timed out */
8282
SGX_ERROR_AE_INVALID_EPIDBLOB = SGX_MK_ERROR(0x4003), /* Indicates epid blob verification error */
83-
SGX_ERROR_SERVICE_INVALID_PRIVILEGE = SGX_MK_ERROR(0x4004), /* Enclave has no privilege to get launch token */
83+
SGX_ERROR_SERVICE_INVALID_PRIVILEGE = SGX_MK_ERROR(0x4004), /* Enclave not authorized to run, .e.g. provisioning enclave hosted in an app without access rights to /dev/sgx_provision */
8484
SGX_ERROR_EPID_MEMBER_REVOKED = SGX_MK_ERROR(0x4005), /* The EPID group membership is revoked. */
8585
SGX_ERROR_UPDATE_NEEDED = SGX_MK_ERROR(0x4006), /* SGX needs to be updated */
8686
SGX_ERROR_NETWORK_FAILURE = SGX_MK_ERROR(0x4007), /* Network connecting or proxy setting issue is encountered */

common/src/se_trace.c

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,34 @@
2929
*
3030
*/
3131

32-
3332
#include "se_trace.h"
3433
#include <stdarg.h>
35-
int se_trace_internal(int debug_level, const char *fmt, ...)
34+
35+
void sgx_proc_log_report_default(int channel, int debug_level, const char *fmt, ...)
36+
{
37+
(void)channel;
38+
va_list args;
39+
40+
va_start(args, fmt);
41+
if (SE_TRACE_NOTICE == debug_level)
42+
vfprintf(stdout, fmt, args);
43+
else
44+
vfprintf(stderr, fmt, args);
45+
va_end(args);
46+
47+
return;
48+
}
49+
50+
void se_trace_internal(int debug_level, const char *fmt, ...)
3651
{
3752
va_list args;
38-
int ret = 0;
3953

4054
va_start(args, fmt);
41-
if(SE_TRACE_NOTICE == debug_level)
42-
ret = vfprintf(stdout, fmt, args);
55+
if (SE_TRACE_NOTICE == debug_level)
56+
vfprintf(stdout, fmt, args);
4357
else
44-
ret = vfprintf(stderr, fmt, args);
58+
vfprintf(stderr, fmt, args);
4559
va_end(args);
4660

47-
return ret;
61+
return;
4862
}

0 commit comments

Comments
 (0)