diff --git a/Makefile.psw_dcap b/Makefile.psw_dcap index c180e2b7..8fc09aca 100644 --- a/Makefile.psw_dcap +++ b/Makefile.psw_dcap @@ -64,19 +64,11 @@ ippcp: $(MAKE) -C external/ippcp_internal/ sdk: ippcp - $(MAKE) -C sdk/ MITIGATION-CVE-2020-0551=LOAD - $(MAKE) -C sdk/ clean - $(MAKE) -C sdk/ MITIGATION-CVE-2020-0551=CF - $(MAKE) -C sdk/ clean $(MAKE) -C sdk/ - $(MAKE) -C external/dcap_source/QuoteVerification/dcap_tvl MITIGATION-CVE-2020-0551=LOAD - $(MAKE) -C external/dcap_source/QuoteVerification/dcap_tvl MITIGATION-CVE-2020-0551=CF clean - $(MAKE) -C external/dcap_source/QuoteVerification/dcap_tvl MITIGATION-CVE-2020-0551=CF - $(MAKE) -C external/dcap_source/QuoteVerification/dcap_tvl clean $(MAKE) -C external/dcap_source/QuoteVerification/dcap_tvl install_sdk: sdk - ./linux/installer/bin/build-installpkg.sh sdk cve-2020-0551 + ./linux/installer/bin/build-installpkg.sh sdk ifeq ($(call DIR_EXISTS,$(SGX_SDK)),) ./linux/installer/bin/sgx_linux_x64_sdk_*.bin --prefix=$(dir $(SGX_SDK)) endif diff --git a/Makefile.psw_tdx b/Makefile.psw_tdx index 1fc8c144..2b51d70d 100644 --- a/Makefile.psw_tdx +++ b/Makefile.psw_tdx @@ -63,19 +63,11 @@ endif ippcp: $(MAKE) -C external/ippcp_internal/ sdk: ippcp - $(MAKE) -C sdk/ MITIGATION-CVE-2020-0551=LOAD - $(MAKE) -C sdk/ clean - $(MAKE) -C sdk/ MITIGATION-CVE-2020-0551=CF - $(MAKE) -C sdk/ clean $(MAKE) -C sdk/ - $(MAKE) -C external/dcap_source/QuoteVerification/dcap_tvl MITIGATION-CVE-2020-0551=LOAD - $(MAKE) -C external/dcap_source/QuoteVerification/dcap_tvl MITIGATION-CVE-2020-0551=CF clean - $(MAKE) -C external/dcap_source/QuoteVerification/dcap_tvl MITIGATION-CVE-2020-0551=CF - $(MAKE) -C external/dcap_source/QuoteVerification/dcap_tvl clean $(MAKE) -C external/dcap_source/QuoteVerification/dcap_tvl install_sdk: sdk - ./linux/installer/bin/build-installpkg.sh sdk cve-2020-0551 + ./linux/installer/bin/build-installpkg.sh sdk ifeq ($(call DIR_EXISTS,$(SGX_SDK)),) ./linux/installer/bin/sgx_linux_x64_sdk_*.bin --prefix=$(dir $(SGX_SDK)) endif diff --git a/README.md b/README.md index ccc31921..9c661a09 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,8 @@ Build the Intel(R) SGX SDK and Intel(R) SGX PSW Package ------------------------------------------------------- ### Prerequisites: - Ensure that you have one of the following required operating systems: + * Ubuntu\* 18.04 LTS Desktop 64bits + * Ubuntu\* 18.04 LTS Server 64bits * Ubuntu\* 20.04 LTS Desktop 64bits * Ubuntu\* 20.04 LTS Server 64bits * Ubuntu\* 22.04 LTS Server 64bits @@ -98,7 +100,7 @@ Build the Intel(R) SGX SDK and Intel(R) SGX PSW Package * Debian 10 64bits - Use the following command(s) to install the required tools to build the Intel(R) SGX SDK: - * On Debian 10: + * On Ubuntu 18.04 and Debian 10: ``` $ sudo apt-get install build-essential ocaml ocamlbuild automake autoconf libtool wget python libssl-dev git cmake perl ``` @@ -134,27 +136,27 @@ Build the Intel(R) SGX SDK and Intel(R) SGX PSW Package 1) To install the additional required tools: * On Debian 10: ``` - $ sudo apt-get install libssl-dev libcurl4-openssl-dev protobuf-compiler libprotobuf-dev debhelper cmake reprepro unzip lsb-release + $ sudo apt-get install libssl-dev libcurl4-openssl-dev protobuf-compiler libprotobuf-dev debhelper cmake reprepro unzip lsb-release libsystemd0 ``` * On Ubuntu 20.04 and Ubuntu 22.04: ``` - $ sudo apt-get install libssl-dev libcurl4-openssl-dev protobuf-compiler libprotobuf-dev debhelper cmake reprepro unzip pkgconf libboost-dev libboost-system-dev libboost-thread-dev protobuf-c-compiler libprotobuf-c-dev lsb-release + $ sudo apt-get install libssl-dev libcurl4-openssl-dev protobuf-compiler libprotobuf-dev debhelper cmake reprepro unzip pkgconf libboost-dev libboost-system-dev libboost-thread-dev protobuf-c-compiler libprotobuf-c-dev lsb-release libsystemd0 ``` * On Red Hat Enterprise Linux 8.6: ``` - $ sudo yum install openssl-devel libcurl-devel protobuf-devel cmake rpm-build createrepo yum-utils pkgconf boost-devel protobuf-lite-devel protobuf-c-compiler protobuf-c-devel + $ sudo yum install openssl-devel libcurl-devel protobuf-devel cmake rpm-build createrepo yum-utils pkgconf boost-devel protobuf-lite-devel protobuf-c-compiler protobuf-c-devel systemd-libs ``` * On CentOS Stream 8 and CentOS 8.3: ``` - $ sudo dnf --enablerepo=powertools install openssl-devel libcurl-devel protobuf-devel cmake rpm-build createrepo yum-utils pkgconf boost-devel protobuf-lite-devel protobuf-c-compiler protobuf-c-devel + $ sudo dnf --enablerepo=powertools install openssl-devel libcurl-devel protobuf-devel cmake rpm-build createrepo yum-utils pkgconf boost-devel protobuf-lite-devel protobuf-c-compiler protobuf-c-devel systemd-libs ``` * On Anolis 8.6: ``` - $ sudo dnf --enablerepo=PowerTools install openssl-devel libcurl-devel protobuf-devel cmake rpm-build createrepo yum-utils pkgconf boost-devel protobuf-lite-devel protobuf-c-compiler protobuf-c-devel + $ sudo dnf --enablerepo=PowerTools install openssl-devel libcurl-devel protobuf-devel cmake rpm-build createrepo yum-utils pkgconf boost-devel protobuf-lite-devel protobuf-c-compiler protobuf-c-devel systemd-libs ``` * On SUSE Linux Enterprise Server 15.4: ``` - $ sudo zypper install libopenssl-devel libcurl-devel protobuf-devel cmake rpm-build createrepo + $ sudo zypper install libopenssl-devel libcurl-devel protobuf-devel cmake rpm-build createrepo libsystemd0 ``` 2) To install latest Intel(R) SGX SDK Installer Ensure that you have downloaded latest Intel(R) SGX SDK Installer from the [Intel(R) SGX SDK](https://software.intel.com/en-us/sgx-sdk/download) and followed the Installation Guide in the same page to install latest Intel(R) SGX SDK Installer. @@ -244,7 +246,7 @@ You can find the tools and libraries generated in the `build/linux` directory. $ make ``` - To build the Intel(R) SGX PSW installer, enter the following command: - * On Ubuntu 20.04, Ubuntu 22.04 and Debian 10: + * On Ubuntu 18.04, Ubuntu 20.04, Ubuntu 22.04 and Debian 10: ``` $ make deb_psw_pkg ``` @@ -277,7 +279,10 @@ You can find the tools and libraries generated in the `build/linux` directory. **Note**: The above command builds the local package repository. If you want to use it, you need to add it to the system repository configuration. The local package repository is not signed, you need to trust it for the purpose of development. - To add the local Debian package repository to the system repository configuration, append the following line to /etc/apt/sources.list. You need to replace PATH_TO_LOCAL_REPO with the proper path on your system: - + * On Ubuntu 18.04: + ``` + deb [trusted=yes arch=amd64] file:/PATH_TO_LOCAL_REPO bionic main + ``` * On Ubuntu 20.04: ``` deb [trusted=yes arch=amd64] file:/PATH_TO_LOCAL_REPO focal main @@ -326,6 +331,8 @@ Install the Intel(R) SGX SDK ------------------------ ### Prerequisites - Ensure that you have one of the following operating systems: + * Ubuntu\* 18.04 LTS Desktop 64bits + * Ubuntu\* 18.04 LTS Server 64bits * Ubuntu\* 20.04 LTS Desktop 64bits * Ubuntu\* 20.04 LTS Server 64bits * Ubuntu\* 22.04 LTS Server 64bits @@ -336,7 +343,7 @@ Install the Intel(R) SGX SDK * Anolis OS 8.6 64bits * Debian 10 64bits - Use the following command to install the required tool to use Intel(R) SGX SDK: - * On Debian 10 and Ubuntu 20.04: + * On Ubuntu 18.04, Ubuntu 20.04 and Debian 10: ``` $ sudo apt-get install build-essential python ``` @@ -396,12 +403,21 @@ See the later topic, *Install Intel(R) SGX PSW*, for information on how to insta $ ./app ``` Use similar commands for other code samples. + **Note:** On Ubuntu 22.04 or any distro with systemd v248 or later, /dev/sgx_enclave is only accessible by users in the group "sgx". The enclave app should be run with a uid in the sgx group. + ``` + # check systemd version: + $ systemctl --version + # add sgx group to user if it's 248 or above: + $ sudo usermod -a -G sgx + ``` Install the Intel(R) SGX PSW ---------------------------- ### Prerequisites - Ensure that you have one of the following operating systems: + * Ubuntu\* 18.04 LTS Desktop 64bits + * Ubuntu\* 18.04 LTS Server 64bits * Ubuntu\* 20.04 LTS Desktop 64bits * Ubuntu\* 20.04 LTS Server 64bits * Ubuntu\* 22.04 LTS Server 64bits @@ -416,7 +432,7 @@ Install the Intel(R) SGX PSW - Configure the system with the **Intel SGX hardware enabled** option and install Intel(R) SGX driver in advance. See the earlier topic, *Build and Install the Intel(R) SGX Driver*, for information on how to install the Intel(R) SGX driver. - Install the library using the following command: - * On Ubuntu 20.04, Ubuntu 22.04 and Debian 10: + * On Ubuntu 18.04, Ubuntu 20.04, Ubuntu 22.04 and Debian 10: ``` $ sudo apt-get install libssl-dev libcurl4-openssl-dev libprotobuf-dev ``` @@ -442,7 +458,7 @@ The SGX PSW provides 3 services: launch, EPID-based attestation, and algorithm a #### Using the local repo(recommended) -| |Ubuntu 20.04, Ubuntu 22.04 and Debian 10|Red Hat Enterprise Linux 8.6, CentOS Stream 8 and CentOS 8.3| SUSE Linux Enterprise Server 15| +| |Ubuntu 18.04, Ubuntu 20.04, Ubuntu 22.04 and Debian 10|Red Hat Enterprise Linux 8.6, CentOS Stream 8 and CentOS 8.3| SUSE Linux Enterprise Server 15| | ------------ | ------------ | ------------ | ------------ | |launch service |apt-get install libsgx-launch libsgx-urts|yum install libsgx-launch libsgx-urts|zypper install libsgx-launch libsgx-urts| |EPID-based attestation service|apt-get install libsgx-epid libsgx-urts|yum install libsgx-epid libsgx-urts|zypper install libsgx-epid libsgx-urts| @@ -463,7 +479,7 @@ apt-get dist-upgrade -o Dpkg::Options::="--force-overwrite" ``` #### Configure the installation 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. -* On Ubuntu 20.04, Ubuntu 22.04 and Debian 10: +* On Ubuntu 18.04, Ubuntu 20.04, Ubuntu 22.04 and Debian 10: ``` --no-install-recommends ``` diff --git a/SampleCode/Cxx11SGXDemo/App/App.h b/SampleCode/Cxx11SGXDemo/App/App.h index 9c0ac2e8..9d1cbe46 100644 --- a/SampleCode/Cxx11SGXDemo/App/App.h +++ b/SampleCode/Cxx11SGXDemo/App/App.h @@ -49,7 +49,6 @@ #endif #if defined(__GNUC__) -# define TOKEN_FILENAME "enclave.token" # define ENCLAVE_FILENAME "enclave.signed.so" #endif diff --git a/SampleCode/Cxx14SGXDemo/App/App.h b/SampleCode/Cxx14SGXDemo/App/App.h index 9c0ac2e8..9d1cbe46 100644 --- a/SampleCode/Cxx14SGXDemo/App/App.h +++ b/SampleCode/Cxx14SGXDemo/App/App.h @@ -49,7 +49,6 @@ #endif #if defined(__GNUC__) -# define TOKEN_FILENAME "enclave.token" # define ENCLAVE_FILENAME "enclave.signed.so" #endif diff --git a/SampleCode/Cxx17SGXDemo/App/App.h b/SampleCode/Cxx17SGXDemo/App/App.h index 9c0ac2e8..9d1cbe46 100644 --- a/SampleCode/Cxx17SGXDemo/App/App.h +++ b/SampleCode/Cxx17SGXDemo/App/App.h @@ -49,7 +49,6 @@ #endif #if defined(__GNUC__) -# define TOKEN_FILENAME "enclave.token" # define ENCLAVE_FILENAME "enclave.signed.so" #endif diff --git a/SampleCode/LocalAttestation/App/Makefile b/SampleCode/LocalAttestation/App/Makefile index 1f193869..b205778c 100644 --- a/SampleCode/LocalAttestation/App/Makefile +++ b/SampleCode/LocalAttestation/App/Makefile @@ -37,14 +37,12 @@ RM = rm -f ifneq ($(SGX_MODE), HW) URTS_LIB_NAME := sgx_urts_sim - UAE_SERVICE_LIB := sgx_uae_service_sim else URTS_LIB_NAME := sgx_urts - UAE_SERVICE_LIB := sgx_uae_service endif INC:=-I$(SGX_SDK)/include -I../Include -LIB := -l$(URTS_LIB_NAME) -l$(UAE_SERVICE_LIB) -L$(SGX_SDK)/lib64 -lpthread +LIB := -l$(URTS_LIB_NAME) -L$(SGX_SDK)/lib64 -lpthread CXXFLAGS += $(INC) $(LIB) CFLAGS += $(INC) $(LIB) diff --git a/SampleCode/LocalAttestation/AppInitiator/Makefile b/SampleCode/LocalAttestation/AppInitiator/Makefile index 364da247..47f2d27b 100644 --- a/SampleCode/LocalAttestation/AppInitiator/Makefile +++ b/SampleCode/LocalAttestation/AppInitiator/Makefile @@ -37,14 +37,12 @@ RM = rm -f ifneq ($(SGX_MODE), HW) URTS_LIB_NAME := sgx_urts_sim - UAE_SERVICE_LIB := sgx_uae_service_sim else URTS_LIB_NAME := sgx_urts - UAE_SERVICE_LIB := sgx_uae_service endif INC:=-I$(SGX_SDK)/include -I../Include -LIB := -l$(URTS_LIB_NAME) -l$(UAE_SERVICE_LIB) -L$(SGX_SDK)/lib64 -lpthread +LIB := -l$(URTS_LIB_NAME) -L$(SGX_SDK)/lib64 -lpthread CXXFLAGS += $(INC) $(LIB) CFLAGS += $(INC) $(LIB) diff --git a/SampleCode/LocalAttestation/AppResponder/Makefile b/SampleCode/LocalAttestation/AppResponder/Makefile index 6c3fd56c..78b98b60 100644 --- a/SampleCode/LocalAttestation/AppResponder/Makefile +++ b/SampleCode/LocalAttestation/AppResponder/Makefile @@ -37,14 +37,12 @@ RM = rm -f ifneq ($(SGX_MODE), HW) URTS_LIB_NAME := sgx_urts_sim - UAE_SERVICE_LIB := sgx_uae_service_sim else URTS_LIB_NAME := sgx_urts - UAE_SERVICE_LIB := sgx_uae_service endif INC:=-I$(SGX_SDK)/include -I../Include -LIB := -l$(URTS_LIB_NAME) -l$(UAE_SERVICE_LIB) -L$(SGX_SDK)/lib64 -lpthread +LIB := -l$(URTS_LIB_NAME) -L$(SGX_SDK)/lib64 -lpthread CXXFLAGS += $(INC) $(LIB) CFLAGS += $(INC) $(LIB) diff --git a/SampleCode/ProtobufSGXDemo/App/App.h b/SampleCode/ProtobufSGXDemo/App/App.h index 9c0ac2e8..9d1cbe46 100644 --- a/SampleCode/ProtobufSGXDemo/App/App.h +++ b/SampleCode/ProtobufSGXDemo/App/App.h @@ -49,7 +49,6 @@ #endif #if defined(__GNUC__) -# define TOKEN_FILENAME "enclave.token" # define ENCLAVE_FILENAME "enclave.signed.so" #endif diff --git a/SampleCode/ProtobufSGXDemo/Enclave/person.proto b/SampleCode/ProtobufSGXDemo/Enclave/person.proto index 17d53682..96d25fc9 100644 --- a/SampleCode/ProtobufSGXDemo/Enclave/person.proto +++ b/SampleCode/ProtobufSGXDemo/Enclave/person.proto @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + package lm; message Person { diff --git a/SampleCode/SampleAttestedTLS/sgx_socket/htonl.c b/SampleCode/SampleAttestedTLS/sgx_socket/htonl.c index 6622d16c..38770dda 100644 --- a/SampleCode/SampleAttestedTLS/sgx_socket/htonl.c +++ b/SampleCode/SampleAttestedTLS/sgx_socket/htonl.c @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #include #include diff --git a/SampleCode/SampleAttestedTLS/sgx_socket/htons.c b/SampleCode/SampleAttestedTLS/sgx_socket/htons.c index 03a3a1d5..534442cb 100644 --- a/SampleCode/SampleAttestedTLS/sgx_socket/htons.c +++ b/SampleCode/SampleAttestedTLS/sgx_socket/htons.c @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #include #include diff --git a/SampleCode/SampleDNNL/Makefile b/SampleCode/SampleDNNL/Makefile index df236369..dc46173a 100644 --- a/SampleCode/SampleDNNL/Makefile +++ b/SampleCode/SampleDNNL/Makefile @@ -93,12 +93,6 @@ endif App_Compile_CXXFlags := $(App_Compile_CFlags) App_Link_Flags := -L$(SGX_LIBRARY_PATH) -l$(Urts_Library_Name) -lpthread -ifneq ($(SGX_MODE), HW) - App_Link_Flags += -lsgx_uae_service_sim -else - App_Link_Flags += -lsgx_uae_service -endif - Gen_Untrusted_Source := App/Enclave_u.c Gen_Untrusted_Object := App/Enclave_u.o diff --git a/SampleCode/SampleEnclave/App/App.h b/SampleCode/SampleEnclave/App/App.h index ec2de43c..8b60023d 100644 --- a/SampleCode/SampleEnclave/App/App.h +++ b/SampleCode/SampleEnclave/App/App.h @@ -49,7 +49,6 @@ # define FALSE 0 #endif -# define TOKEN_FILENAME "enclave.token" # define ENCLAVE_FILENAME "enclave.signed.so" extern sgx_enclave_id_t global_eid; /* global enclave id */ diff --git a/SampleCode/SampleEnclaveGMIPP/App/App.h b/SampleCode/SampleEnclaveGMIPP/App/App.h index 7779642e..46afb20b 100644 --- a/SampleCode/SampleEnclaveGMIPP/App/App.h +++ b/SampleCode/SampleEnclaveGMIPP/App/App.h @@ -49,7 +49,6 @@ # define FALSE 0 #endif -# define TOKEN_FILENAME "enclave.token" # define ENCLAVE_FILENAME "enclave.signed.so" extern sgx_enclave_id_t global_eid; /* global enclave id */ diff --git a/SampleCode/SampleEnclavePCL/App/App.cpp b/SampleCode/SampleEnclavePCL/App/App.cpp index 42d3c64b..d0d9ad56 100644 --- a/SampleCode/SampleEnclavePCL/App/App.cpp +++ b/SampleCode/SampleEnclavePCL/App/App.cpp @@ -45,7 +45,6 @@ #define SEAL_FILENAME "Seal.signed.so" #define SEALED_KEY_FILE_NAME "sealed_key.bin" -#define TOKEN_FILENAME "enclave.token" /* Global EID shared by multiple threads */ sgx_enclave_id_t global_eid = 0; diff --git a/SampleCode/SampleEnclavePCL/App/App.h b/SampleCode/SampleEnclavePCL/App/App.h index 5261170c..02299ebf 100644 --- a/SampleCode/SampleEnclavePCL/App/App.h +++ b/SampleCode/SampleEnclavePCL/App/App.h @@ -49,7 +49,6 @@ # define FALSE 0 #endif -#define TOKEN_FILENAME "enclave.token" #define ENCLAVE_FILENAME "enclave.signed.so" #define SEAL_TOKEN_FILENAME "seal.token" #define SEAL_FILENAME "Seal.signed.so" diff --git a/SampleCode/Switchless/App/App.h b/SampleCode/Switchless/App/App.h index 9dfa8cb9..98157ab8 100644 --- a/SampleCode/Switchless/App/App.h +++ b/SampleCode/Switchless/App/App.h @@ -49,7 +49,6 @@ # define FALSE 0 #endif -# define TOKEN_FILENAME "enclave.token" # define ENCLAVE_FILENAME "enclave.signed.so" extern sgx_enclave_id_t global_eid; /* global enclave id */ diff --git a/SampleCode/Switchless/Makefile b/SampleCode/Switchless/Makefile index 99a3a34a..a08472ff 100644 --- a/SampleCode/Switchless/Makefile +++ b/SampleCode/Switchless/Makefile @@ -104,12 +104,6 @@ App_Link_Flags := -L$(SGX_LIBRARY_PATH) \ -Wl,--whole-archive -lsgx_uswitchless -Wl,--no-whole-archive \ -l$(Urts_Library_Name) -lpthread -ifneq ($(SGX_MODE), HW) - App_Link_Flags += -lsgx_uae_service_sim -else - App_Link_Flags += -lsgx_uae_service -endif - App_Cpp_Objects := $(App_Cpp_Files:.cpp=.o) App_Name := app diff --git a/common/inc/internal/global_data.h b/common/inc/internal/global_data.h index 6fdec938..21fc56e1 100644 --- a/common/inc/internal/global_data.h +++ b/common/inc/internal/global_data.h @@ -44,7 +44,7 @@ #include "metadata.h" #include "rts.h" -#define LAYOUT_ENTRY_NUM 42 +#define LAYOUT_ENTRY_NUM 43 typedef struct _global_data_t { sys_word_t sdk_version; @@ -78,7 +78,6 @@ typedef struct _global_data_t extern "C" { #endif extern SE_DECLSPEC_EXPORT global_data_t const volatile g_global_data; -extern uint32_t g_enclave_state; extern sdk_version_t g_sdk_version; extern int EDMM_supported; extern uint8_t __ImageBase; diff --git a/common/inc/internal/se_version.h b/common/inc/internal/se_version.h index 2bf4285a..89d805bb 100644 --- a/common/inc/internal/se_version.h +++ b/common/inc/internal/se_version.h @@ -31,25 +31,25 @@ #ifndef _SE_VERSION_H_ #define _SE_VERSION_H_ -#define STRFILEVER "2.18.100.1" +#define STRFILEVER "2.19.100.1" #define SGX_MAJOR_VERSION 2 -#define SGX_MINOR_VERSION 18 +#define SGX_MINOR_VERSION 19 #define SGX_REVISION_VERSION 100 #define MAKE_VERSION_UINT(major,minor,rev) (((uint64_t)major)<<32 | ((uint64_t)minor) << 16 | rev) #define VERSION_UINT MAKE_VERSION_UINT(SGX_MAJOR_VERSION, SGX_MINOR_VERSION, SGX_REVISION_VERSION) -#define COPYRIGHT "Copyright (C) 2022 Intel Corporation" +#define COPYRIGHT "Copyright (C) 2023 Intel Corporation" -#define UAE_SERVICE_VERSION "2.3.216.1" -#define URTS_VERSION "2.0.100.1" -#define ENCLAVE_COMMON_VERSION "2.0.100.1" -#define LAUNCH_VERSION "1.0.118.1" -#define EPID_VERSION "1.0.118.1" -#define QUOTE_EX_VERSION "1.1.118.1" +#define UAE_SERVICE_VERSION "2.3.218.1" +#define URTS_VERSION "2.0.102.1" +#define ENCLAVE_COMMON_VERSION "1.2.102.1" +#define LAUNCH_VERSION "1.0.120.1" +#define EPID_VERSION "1.0.120.1" +#define QUOTE_EX_VERSION "1.1.120.1" -#define PCE_VERSION "1.18.100.1" -#define LE_VERSION "1.18.100.1" -#define QE_VERSION "1.18.100.1" -#define PVE_VERSION "1.18.100.1" +#define PCE_VERSION "1.17.100.2" +#define LE_VERSION "1.17.100.2" +#define QE_VERSION "1.17.100.2" +#define PVE_VERSION "1.17.100.2" #endif diff --git a/docker/build/Dockerfile b/docker/build/Dockerfile index 0e363f46..92f842ce 100644 --- a/docker/build/Dockerfile +++ b/docker/build/Dockerfile @@ -59,6 +59,7 @@ RUN make sdk_install_pkg_no_mitigation WORKDIR /opt/intel RUN sh -c 'echo yes | /linux-sgx/linux/installer/bin/sgx_linux_x64_sdk_*.bin' +ENV SGX_SDK=/opt/intel/sgxsdk WORKDIR /linux-sgx RUN make psw_install_pkg diff --git a/docker/build/build_and_run_aesm_deb_docker.sh b/docker/build/build_and_run_aesm_deb_docker.sh new file mode 100755 index 00000000..eed08103 --- /dev/null +++ b/docker/build/build_and_run_aesm_deb_docker.sh @@ -0,0 +1,41 @@ +#!/bin/sh +# +# Copyright (C) 2022 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +set -e +docker build --target aesm_deb --build-arg https_proxy=$https_proxy \ + --build-arg http_proxy=$http_proxy -t sgx_aesm_deb -f ./Dockerfile ../../ + +docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=rw aesmd-socket + +# If you use the Legacy Launch Control driver, replace /dev/sgx_enclave with /dev/isgx, and remove +# --device=/dev/sgx_provision + +docker run --env http_proxy --env https_proxy --device=/dev/sgx_enclave --device=/dev/sgx_provision -v /dev/log:/dev/log -v aesmd-socket:/var/run/aesmd -it sgx_aesm_deb diff --git a/docker/build/build_and_run_aesm_docker.sh b/docker/build/build_and_run_aesm_docker.sh index 6b5b9324..d5c51671 100755 --- a/docker/build/build_and_run_aesm_docker.sh +++ b/docker/build/build_and_run_aesm_docker.sh @@ -35,7 +35,7 @@ docker build --target aesm --build-arg https_proxy=$https_proxy \ docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=rw aesmd-socket -# If you use the Legacy Launch Control driver, replace /dev/sgx/enclave with /dev/isgx, and remove -# --device=/dev/sgx/provision +# If you use the Legacy Launch Control driver, replace /dev/sgx_enclave with /dev/isgx, and remove +# --device=/dev/sgx_provision -docker run --env http_proxy --env https_proxy --device=/dev/sgx/enclave --device=/dev/sgx/provision -v /dev/log:/dev/log -v aesmd-socket:/var/run/aesmd -it sgx_aesm +docker run --env http_proxy --env https_proxy --device=/dev/sgx_enclave --device=/dev/sgx_provision -v /dev/log:/dev/log -v aesmd-socket:/var/run/aesmd -it sgx_aesm diff --git a/docker/build/build_and_run_qgs_docker.sh b/docker/build/build_and_run_qgs_docker.sh index 7acb3659..c9577999 100755 --- a/docker/build/build_and_run_qgs_docker.sh +++ b/docker/build/build_and_run_qgs_docker.sh @@ -35,7 +35,7 @@ docker build --target qgs --build-arg https_proxy=$https_proxy \ docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=rw qgs-socket -# If you use the Legacy Launch Control driver, replace /dev/sgx/enclave with /dev/isgx, and remove -# --device=/dev/sgx/provision +# If you use the Legacy Launch Control driver, replace /dev/sgx_enclave with /dev/isgx, and remove +# --device=/dev/sgx_provision -docker run --device=/dev/sgx/enclave --device=/dev/sgx/provision -v /dev/log:/dev/log -v qgs-socket:/var/run/tdx-qgs/ -it --add-host=host.docker.internal:host-gateway tdx_qgs /opt/intel/tdx-qgs/qgs --no-daemon +docker run --device=/dev/sgx_enclave --device=/dev/sgx_provision -v /dev/log:/dev/log -v qgs-socket:/var/run/tdx-qgs/ -it --add-host=host.docker.internal:host-gateway tdx_qgs /opt/intel/tdx-qgs/qgs --no-daemon diff --git a/docker/build/build_and_run_sample_deb_docker.sh b/docker/build/build_and_run_sample_deb_docker.sh new file mode 100755 index 00000000..1b9161d0 --- /dev/null +++ b/docker/build/build_and_run_sample_deb_docker.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# +# Copyright (C) 2022 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +set -e +docker build --target sample_deb --build-arg https_proxy=$https_proxy \ + --build-arg http_proxy=$http_proxy -t sgx_sample_deb -f ./Dockerfile ../../ + +# Another container should expose AESM and its socket in aesmd-socket volume. +# Replace /dev/sgx_enclave with /dev/isgx if you use the Legacy Launch Control driver +docker run --env http_proxy --env https_proxy --device=/dev/sgx_enclave -v aesmd-socket:/var/run/aesmd -it sgx_sample_deb diff --git a/docker/build/build_and_run_sample_docker.sh b/docker/build/build_and_run_sample_docker.sh index 42cd33bb..49e40a50 100755 --- a/docker/build/build_and_run_sample_docker.sh +++ b/docker/build/build_and_run_sample_docker.sh @@ -34,5 +34,5 @@ docker build --target sample --build-arg https_proxy=$https_proxy \ --build-arg http_proxy=$http_proxy -t sgx_sample -f ./Dockerfile ../../ # Another container should expose AESM and its socket in aesmd-socket volume. -# Replace /dev/sgx/enclave with /dev/isgx if you use the Legacy Launch Control driver -docker run --env http_proxy --env https_proxy --device=/dev/sgx/enclave -v aesmd-socket:/var/run/aesmd -it sgx_sample +# Replace /dev/sgx_enclave with /dev/isgx if you use the Legacy Launch Control driver +docker run --env http_proxy --env https_proxy --device=/dev/sgx_enclave -v aesmd-socket:/var/run/aesmd -it sgx_sample diff --git a/download_prebuilt.sh b/download_prebuilt.sh index a1b36b8b..76e52868 100755 --- a/download_prebuilt.sh +++ b/download_prebuilt.sh @@ -33,11 +33,11 @@ top_dir=`dirname $0` out_dir=$top_dir -optlib_name=optimized_libs_2.18.tar.gz -ae_file_name=prebuilt_ae_2.18.tar.gz +optlib_name=optimized_libs_2.19.tar.gz +ae_file_name=prebuilt_ae_2.19.tar.gz binutils_file_name=as.ld.objdump.r4.tar.gz -checksum_file=SHA256SUM_prebuilt_2.18.cfg -server_url_path=https://download.01.org/intel-sgx/sgx-linux/2.18 +checksum_file=SHA256SUM_prebuilt_2.19.cfg +server_url_path=https://download.01.org/intel-sgx/sgx-linux/2.19 server_optlib_url=$server_url_path/$optlib_name server_ae_url=$server_url_path/$ae_file_name server_binutils_url=$server_url_path/$binutils_file_name diff --git a/external/dcap_source b/external/dcap_source index 9814a595..41a64941 160000 --- a/external/dcap_source +++ b/external/dcap_source @@ -1 +1 @@ -Subproject commit 9814a595356893bc544a87cc6903ea14984af44c +Subproject commit 41a649413f568736bed7414bfdfeccfe2d01101c diff --git a/external/dnnl/Makefile b/external/dnnl/Makefile index 1b385b52..d8f5b96e 100644 --- a/external/dnnl/Makefile +++ b/external/dnnl/Makefile @@ -41,7 +41,6 @@ CXX_ENCLAVE_FLAGS += -nostdinc++ DNNL_DIR = dnnl LIBDNNL = $(DNNL_DIR)/build/src/libdnnl.a -SGX_DNNL_LOG = $(shell cd ./$(DNNL_DIR) && git log --oneline --grep='SGX mkl-dnn' | cut -d' ' -f 2) SGX_DNNL_DIR = sgx_dnnl SGX_DNNL_LIB = $(SGX_DNNL_DIR)/lib SGX_DNNL_INCLUDE = $(SGX_DNNL_DIR)/include @@ -53,11 +52,6 @@ endif DNNL_CONFIG += -DSGX_PROGRAM_SEARCH_PATH="$(EXT_BINUTILS_DIR)" -CHECK_SOURCE := -ifneq ($(SGX_DNNL_LOG), SGX) -CHECK_SOURCE := dnnl_src -endif - .PHONY: all all: $(LIBDNNL) $(SGX_DNNL_LIB) $(SGX_DNNL_INCLUDE) @$(CP) $(LIBDNNL) $(SGX_DNNL_LIB)/libsgx_dnnl.a @@ -76,20 +70,21 @@ $(SGX_DNNL_LIB): $(SGX_DNNL_INCLUDE): @$(MKDIR) $@ -.PHONY: dnnl_src -dnnl_src: +$(DNNL_DIR)/build: + @echo "Checkout dnnl and apply sgx_dnnl patch" ifeq ($(shell git rev-parse --is-inside-work-tree), true) @$(RM) -r $(DNNL_DIR)/* git submodule update -f --init dnnl - cd $(DNNL_DIR) && git am ../sgx_dnnl.patch + cd $(DNNL_DIR) && git apply ../sgx_dnnl.patch else @$(RM) -r $(DNNL_DIR) git clone https://github.com/intel/mkl-dnn.git -b v1.1.1 --depth 1 $(DNNL_DIR) - cd $(DNNL_DIR) && git am ../sgx_dnnl.patch + cd $(DNNL_DIR) && git apply ../sgx_dnnl.patch endif + mkdir -p $(DNNL_DIR)/build -$(LIBDNNL):$(CHECK_SOURCE) - mkdir -p $(DNNL_DIR)/build && cd $(DNNL_DIR)/build && cmake -DCMAKE_CXX_ENCLAVE_FLAGS="$(CXX_ENCLAVE_FLAGS)" -DCMAKE_C_ENCLAVE_FLAGS="$(C_ENCLAVE_FLAGS)" $(DNNL_CONFIG) .. && $(MAKE) +$(LIBDNNL): $(DNNL_DIR)/build + cd $(DNNL_DIR)/build && cmake -DCMAKE_CXX_ENCLAVE_FLAGS="$(CXX_ENCLAVE_FLAGS)" -DCMAKE_C_ENCLAVE_FLAGS="$(C_ENCLAVE_FLAGS)" $(DNNL_CONFIG) .. && $(MAKE) .PHONY: clean clean: diff --git a/external/ippcp_internal/Makefile b/external/ippcp_internal/Makefile index 74695903..08de9fc2 100644 --- a/external/ippcp_internal/Makefile +++ b/external/ippcp_internal/Makefile @@ -61,17 +61,12 @@ else ifeq ($(MITIGATION-CVE-2020-0551), CF) endif OUT_DIR = lib/linux/$(ARCH)/$(SUB_DIR)/ -PATCH_LOG = $(shell cd ./$(IPP_SOURCE) && git log --oneline --grep='IPP crypto for SGX.' | cut -d' ' -f 5) -CHECK_PATCHED := - CHECK_SOURCE := -# For reproducibility build in docker, the code should be +# For reproducibility build in docker, the code should be # prepared before build. So skip the code check to avoid -# triggering network request +# triggering network request ifneq ($(origin NIX_STORE), environment) -ifneq ($(PATCH_LOG), SGX.) -CHECK_SOURCE:= ipp_source -endif +CHECK_SOURCE:= $(IPP_SOURCE)/build endif .PHONY: all build_ipp @@ -87,16 +82,17 @@ all: build_ipp build_ipp: $(CHECK_SOURCE) cd $(IPP_SOURCE) && $(PRE_CONFIG) cmake CMakeLists.txt $(IPP_CONFIG) && cd build && make ippcp_s -.PHONY: ipp_source -ipp_source: -ifeq ($(shell git rev-parse --is-inside-work-tree), true) - git submodule update -f --init --recursive --remote -- $(IPP_SOURCE) -else +$(IPP_SOURCE)/build: +## Need to enable below code when release +#ifeq ($(shell git rev-parse --is-inside-work-tree), true) +# git submodule update -f --init --recursive --remote -- $(IPP_SOURCE) +#else $(RM) -rf $(IPP_SOURCE) git clone -b ippcp_2021.3 https://github.com/intel/ipp-crypto.git --depth 1 $(IPP_SOURCE) -endif - cd $(IPP_SOURCE) && git am ../0001-IPP-crypto-for-SGX.patch +#endif + cd $(IPP_SOURCE) && git apply ../0001-IPP-crypto-for-SGX.patch + mkdir -p $(IPP_SOURCE)/build .PHONY: clean clean: - $(RM) -rf ipp-crypto/build + $(RM) -rf ipp-crypto/build/* diff --git a/external/sgx-emm/Makefile b/external/sgx-emm/Makefile index 7ff92904..d7a6b7c9 100644 --- a/external/sgx-emm/Makefile +++ b/external/sgx-emm/Makefile @@ -35,6 +35,8 @@ CPPFLAGS += -I$(EMM_DIR)/include \ -Wno-missing-braces \ -Wno-unused-parameter +EMMFLAGS := -mno-sse + C_Files := $(EMM_DIR)/bit_array.c \ $(EMM_DIR)/ema.c \ $(EMM_DIR)/emalloc.c \ @@ -60,18 +62,18 @@ $(LIB_NAME): $(CHECK_SOURCE) $(OBJS) $(AR) rcs $@ $(OBJS) $(OBJS): %.o: %.c - $(CC) -c $(COMMON_FLAGS) $(ENCLAVE_CFLAGS) $(CPPFLAGS) $< -o $@ + $(CC) -c $(COMMON_FLAGS) $(ENCLAVE_CFLAGS) $(CPPFLAGS) $(EMMFLAGS) $< -o $@ $(BUILD_DIR): @$(MKDIR) $@ emm_code: -ifeq ($(shell git rev-parse --is-inside-work-tree 2> /dev/null), true) - git submodule update -f --init --recursive -- $(EMM_DIR) -else +#ifeq ($(shell git rev-parse --is-inside-work-tree 2> /dev/null), true) +# git submodule update -f --init --recursive -- $(EMM_DIR) +#else $(RM) -rf $(EMM_DIR) git clone -b sgx-emm-1.0.0 https://github.com/intel/sgx-emm.git --depth 1 $(EMM_DIR) -endif +#endif clean: @$(RM) $(LIB_NAME) $(OBJS) $(BUILD_DIR)/$(LIB_NAME) *.bak *~ diff --git a/external/sgx-emm/api_tests/App/App.cpp b/external/sgx-emm/api_tests/App/App.cpp index f6eae58c..8f615e2f 100644 --- a/external/sgx-emm/api_tests/App/App.cpp +++ b/external/sgx-emm/api_tests/App/App.cpp @@ -233,7 +233,7 @@ typedef struct ms_ecall_check_context_t { } ms_ecall_check_context_t; extern "C" { -#include "sgx.h" +#include "isgx_user.h" } vdso_sgx_enter_enclave_t vdso_sgx_enter_enclave; diff --git a/external/sgx-emm/api_tests/App/sgx.h b/external/sgx-emm/api_tests/App/sgx.h deleted file mode 100644 index b2fbcee9..00000000 --- a/external/sgx-emm/api_tests/App/sgx.h +++ /dev/null @@ -1,228 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -/* - * Copyright(c) 2016-20 Intel Corporation. - */ -#ifndef _UAPI_ASM_X86_SGX_H -#define _UAPI_ASM_X86_SGX_H - -#include -#include - -/** - * enum sgx_page_flags - page control flags - * %SGX_PAGE_MEASURE: Measure the page contents with a sequence of - * ENCLS[EEXTEND] operations. - */ -enum sgx_page_flags { - SGX_PAGE_MEASURE = 0x01, -}; - -#define SGX_MAGIC 0xA4 - -#define SGX_IOC_ENCLAVE_CREATE \ - _IOW(SGX_MAGIC, 0x00, struct sgx_enclave_create) -#define SGX_IOC_ENCLAVE_ADD_PAGES \ - _IOWR(SGX_MAGIC, 0x01, struct sgx_enclave_add_pages) -#define SGX_IOC_ENCLAVE_INIT \ - _IOW(SGX_MAGIC, 0x02, struct sgx_enclave_init) -#define SGX_IOC_ENCLAVE_PROVISION \ - _IOW(SGX_MAGIC, 0x03, struct sgx_enclave_provision) -#define SGX_IOC_PAGE_MODP \ - _IOWR(SGX_MAGIC, 0x04, struct sgx_page_modp) -#define SGX_IOC_PAGE_MODT \ - _IOWR(SGX_MAGIC, 0x05, struct sgx_page_modt) -#define SGX_IOC_PAGE_REMOVE \ - _IOWR(SGX_MAGIC, 0x06, struct sgx_page_remove) - -/** - * struct sgx_enclave_create - parameter structure for the - * %SGX_IOC_ENCLAVE_CREATE ioctl - * @src: address for the SECS page data - */ -struct sgx_enclave_create { - __u64 src; -}; - -/** - * struct sgx_enclave_add_pages - parameter structure for the - * %SGX_IOC_ENCLAVE_ADD_PAGE ioctl - * @src: start address for the page data - * @offset: starting page offset - * @length: length of the data (multiple of the page size) - * @secinfo: address for the SECINFO data - * @flags: page control flags - * @count: number of bytes added (multiple of the page size) - */ -struct sgx_enclave_add_pages { - __u64 src; - __u64 offset; - __u64 length; - __u64 secinfo; - __u64 flags; - __u64 count; -}; - -/** - * struct sgx_enclave_init - parameter structure for the - * %SGX_IOC_ENCLAVE_INIT ioctl - * @sigstruct: address for the SIGSTRUCT data - */ -struct sgx_enclave_init { - __u64 sigstruct; -}; - -/** - * struct sgx_enclave_provision - parameter structure for the - * %SGX_IOC_ENCLAVE_PROVISION ioctl - * @fd: file handle of /dev/sgx_provision - */ -struct sgx_enclave_provision { - __u64 fd; -}; - -/** - * struct sgx_page_modp - parameter structure for the %SGX_IOC_PAGE_MODP ioctl - * @offset: starting page offset (page aligned relative to enclave base - * address defined in SECS) - * @length: length of memory (multiple of the page size) - * @prot: new protection bits of pages in range described by @offset - * and @length - * @result: SGX result code of ENCLS[EMODPR] function - * @count: bytes successfully changed (multiple of page size) - */ -struct sgx_page_modp { - __u64 offset; - __u64 length; - __u64 prot; - __u64 result; - __u64 count; -}; - -/** - * struct sgx_page_modt - parameter structure for the %SGX_IOC_PAGE_MODT ioctl - * @offset: starting page offset (page aligned relative to enclave base - * address defined in SECS) - * @length: length of memory (multiple of the page size) - * @type: new type of pages in range described by @offset and @length - * @result: SGX result code of ENCLS[EMODT] function - * @count: bytes successfully changed (multiple of page size) - */ -struct sgx_page_modt { - __u64 offset; - __u64 length; - __u64 type; - __u64 result; - __u64 count; -}; - -/** - * struct sgx_page_remove - parameters for the %SGX_IOC_PAGE_REMOVE ioctl - * @offset: starting page offset (page aligned relative to enclave base - * address defined in SECS) - * @length: length of memory (multiple of the page size) - * @count: bytes successfully changed (multiple of page size) - * - * Regular (PT_REG) or TCS (PT_TCS) can be removed from an initialized - * enclave if the system supports SGX2. First, the %SGX_IOC_PAGE_MODT ioctl - * should be used to change the page type to PT_TRIM. After that succeeds - * ENCLU[EACCEPT] should be run from within the enclave and then can this - * ioctl be used to complete the page removal. - */ -struct sgx_page_remove { - __u64 offset; - __u64 length; - __u64 count; -}; - -struct sgx_enclave_run; - -/** - * typedef sgx_enclave_user_handler_t - Exit handler function accepted by - * __vdso_sgx_enter_enclave() - * @run: The run instance given by the caller - * - * The register parameters contain the snapshot of their values at enclave - * exit. An invalid ENCLU function number will cause -EINVAL to be returned - * to the caller. - * - * Return: - * - <= 0: The given value is returned back to the caller. - * - > 0: ENCLU function to invoke, either EENTER or ERESUME. - */ -typedef int (*sgx_enclave_user_handler_t)(long rdi, long rsi, long rdx, - long rsp, long r8, long r9, - struct sgx_enclave_run *run); - -/** - * struct sgx_enclave_run - the execution context of __vdso_sgx_enter_enclave() - * @tcs: TCS used to enter the enclave - * @function: The last seen ENCLU function (EENTER, ERESUME or EEXIT) - * @exception_vector: The interrupt vector of the exception - * @exception_error_code: The exception error code pulled out of the stack - * @exception_addr: The address that triggered the exception - * @user_handler: User provided callback run on exception - * @user_data: Data passed to the user handler - * @reserved Reserved for future extensions - * - * If @user_handler is provided, the handler will be invoked on all return paths - * of the normal flow. The user handler may transfer control, e.g. via a - * longjmp() call or a C++ exception, without returning to - * __vdso_sgx_enter_enclave(). - */ -struct sgx_enclave_run { - __u64 tcs; - __u32 function; - __u16 exception_vector; - __u16 exception_error_code; - __u64 exception_addr; - __u64 user_handler; - __u64 user_data; - __u8 reserved[216]; -}; - -/** - * typedef vdso_sgx_enter_enclave_t - Prototype for __vdso_sgx_enter_enclave(), - * a vDSO function to enter an SGX enclave. - * @rdi: Pass-through value for RDI - * @rsi: Pass-through value for RSI - * @rdx: Pass-through value for RDX - * @function: ENCLU function, must be EENTER or ERESUME - * @r8: Pass-through value for R8 - * @r9: Pass-through value for R9 - * @run: struct sgx_enclave_run, must be non-NULL - * - * NOTE: __vdso_sgx_enter_enclave() does not ensure full compliance with the - * x86-64 ABI, e.g. doesn't handle XSAVE state. Except for non-volatile - * general purpose registers, EFLAGS.DF, and RSP alignment, preserving/setting - * state in accordance with the x86-64 ABI is the responsibility of the enclave - * and its runtime, i.e. __vdso_sgx_enter_enclave() cannot be called from C - * code without careful consideration by both the enclave and its runtime. - * - * All general purpose registers except RAX, RBX and RCX are passed as-is to the - * enclave. RAX, RBX and RCX are consumed by EENTER and ERESUME and are loaded - * with @function, asynchronous exit pointer, and @run.tcs respectively. - * - * RBP and the stack are used to anchor __vdso_sgx_enter_enclave() to the - * pre-enclave state, e.g. to retrieve @run.exception and @run.user_handler - * after an enclave exit. All other registers are available for use by the - * enclave and its runtime, e.g. an enclave can push additional data onto the - * stack (and modify RSP) to pass information to the optional user handler (see - * below). - * - * Most exceptions reported on ENCLU, including those that occur within the - * enclave, are fixed up and reported synchronously instead of being delivered - * via a standard signal. Debug Exceptions (#DB) and Breakpoints (#BP) are - * never fixed up and are always delivered via standard signals. On synchronously - * reported exceptions, -EFAULT is returned and details about the exception are - * recorded in @run.exception, the optional sgx_enclave_exception struct. - * - * Return: - * - 0: ENCLU function was successfully executed. - * - -EINVAL: Invalid ENCL number (neither EENTER nor ERESUME). - */ -typedef int (*vdso_sgx_enter_enclave_t)(unsigned long rdi, unsigned long rsi, - unsigned long rdx, unsigned int function, - unsigned long r8, unsigned long r9, - struct sgx_enclave_run *run); - -#endif /* _UAPI_ASM_X86_SGX_H */ diff --git a/external/sgx-emm/api_tests/Enclave/Enclave.cpp b/external/sgx-emm/api_tests/Enclave/Enclave.cpp index f13bc665..44c82dc7 100644 --- a/external/sgx-emm/api_tests/Enclave/Enclave.cpp +++ b/external/sgx-emm/api_tests/Enclave/Enclave.cpp @@ -781,9 +781,13 @@ int test_sgx_mm_alloc_random() // int ecall_test_sgx_mm(int sid) { - int failures = test_sgx_mm_alloc_dealloc(); - failures += test_sgx_mm_alloc_commit_uncommit(); - + int failures = 0; + failures += test_sgx_mm_alloc_dealloc(); + // do a few iterations without running deallocation + // this catches effect when emalloc add_reserve + // caused by sgx_mm_alloc + for (int i=0; i<10; i++) + failures += test_sgx_mm_alloc_commit_uncommit(); failures += test_sgx_mm_types(); failures += test_sgx_mm_permissions(); failures += test_sgx_mm_permissions_dealloc(); diff --git a/external/sgx-emm/api_tests/Makefile b/external/sgx-emm/api_tests/Makefile index 0c7b1c13..1d192745 100644 --- a/external/sgx-emm/api_tests/Makefile +++ b/external/sgx-emm/api_tests/Makefile @@ -84,7 +84,7 @@ else endif App_Cpp_Files := App/App.cpp -App_Include_Paths := -IApp -I$(SGX_SDK)/include +App_Include_Paths := -IApp -I$(SGX_SDK)/include -I../../../psw/urts/linux App_C_Flags := -fPIC -Wno-attributes $(App_Include_Paths) diff --git a/external/sgx-emm/api_tests/test_loop.sh b/external/sgx-emm/api_tests/test_loop.sh index ea5d95d4..06904217 100755 --- a/external/sgx-emm/api_tests/test_loop.sh +++ b/external/sgx-emm/api_tests/test_loop.sh @@ -1,6 +1,6 @@ let fail=0 for ((i=1;i<=$1;i++));do - ./test_mm_api + time ./test_mm_api if [ $? -eq 0 ] then echo "pass for iteration $i" diff --git a/external/sgx-emm/emm_src b/external/sgx-emm/emm_src index e8c6da39..41a3ead0 160000 --- a/external/sgx-emm/emm_src +++ b/external/sgx-emm/emm_src @@ -1 +1 @@ -Subproject commit e8c6da39e103dbdf72ae73264f66b9826c0140c2 +Subproject commit 41a3ead0e350f255d82eb0f79a9f356816ea19ed diff --git a/external/sgx-emm/ut/stub.c b/external/sgx-emm/ut/stub.c index d2839623..8fe080d5 100644 --- a/external/sgx-emm/ut/stub.c +++ b/external/sgx-emm/ut/stub.c @@ -1,23 +1,31 @@ -/** +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. * - * INTEL CONFIDENTIAL - * Copyright(c) 2011-2017 Intel Corporation All Rights Reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: * - * The source code contained or described herein and all documents related to - * the source code ("Material") are owned by Intel Corporation or its suppliers - * or licensors. Title to the Material remains with Intel Corporation or its - * suppliers and licensors. The Material contains trade secrets and proprietary - * and confidential information of Intel or its suppliers and licensors. The - * Material is protected by worldwide copyright and trade secret laws and treaty - * provisions. No part of the Material may be used, copied, reproduced, modified, - * published, uploaded, posted, transmitted, distributed, or disclosed in any - * way without Intel's prior express written permission. + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. * - * No license under any patent, copyright, trade secret or other intellectual - * property right is granted to or conferred upon you by disclosure or delivery - * of the Materials, either expressly, by implication, inducement, estoppel or - * otherwise. Any license under such intellectual property rights must be - * express and approved by Intel(R) in writing. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ diff --git a/external/sgxssl/prepare_sgxssl.sh b/external/sgxssl/prepare_sgxssl.sh index 7c9872ec..4e2d9c91 100755 --- a/external/sgxssl/prepare_sgxssl.sh +++ b/external/sgxssl/prepare_sgxssl.sh @@ -32,16 +32,16 @@ top_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" openssl_out_dir=$top_dir/openssl_source -openssl_ver=1.1.1q +openssl_ver=1.1.1t openssl_ver_name=openssl-$openssl_ver sgxssl_github_archive=https://github.com/intel/intel-sgx-ssl/archive -sgxssl_file_name=lin_2.18_1.1.1q +sgxssl_file_name=lin_2.19_1.1.1t build_script=$top_dir/Linux/build_openssl.sh server_url_path=https://www.openssl.org/source full_openssl_url=$server_url_path/old/1.1.1/$openssl_ver_name.tar.gz -sgxssl_chksum=6c33d2178b6b01bdbb1f97804ae14aec13544b0cb45902a0906c20ef7b4032bc -openssl_chksum=d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca +sgxssl_chksum=bff5a9059911846e27447acb402c4690346abf46da8e1c26b66d406e8abb1588 +openssl_chksum=8dee9b24bdb1dcbf0c3d1e9b02fb8f6bf22165e807f45adeb7c9677536859d3b rm -f check_sum_sgxssl.txt check_sum_openssl.txt if [ ! -f $build_script ]; then wget $sgxssl_github_archive/$sgxssl_file_name.zip -P $top_dir || exit 1 diff --git a/linux/installer/bin/install-sgx-sdk.bin.tmpl b/linux/installer/bin/install-sgx-sdk.bin.tmpl index f286c255..63256555 100755 --- a/linux/installer/bin/install-sgx-sdk.bin.tmpl +++ b/linux/installer/bin/install-sgx-sdk.bin.tmpl @@ -180,7 +180,13 @@ export_the_simulation() ln -s ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/${LIB_DIR}/libsgx_quote_ex_sim.so ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/sdk_libs/ ln -s ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/${LIB_DIR}/libsgx_launch_sim.so ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/sdk_libs/ ln -s ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/${LIB_DIR}/libsgx_epid_sim.so ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/sdk_libs/ -} +} + +create_urts_soname_link() +{ + URTS_SONAME=`objdump -p ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/${LIB_DIR}/libsgx_urts.so | grep SONAME | awk '{print $2}'` + ln -fs ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/${LIB_DIR}/libsgx_urts.so ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/${LIB_DIR}/${URTS_SONAME} +} generate_environment_script() { @@ -198,6 +204,7 @@ EOF } export_the_simulation +create_urts_soname_link generate_environment_script echo """ diff --git a/linux/installer/common/libsgx-headers/BOMs/libsgx-headers.txt b/linux/installer/common/libsgx-headers/BOMs/libsgx-headers.txt index a77cbcc3..aede29d2 100644 --- a/linux/installer/common/libsgx-headers/BOMs/libsgx-headers.txt +++ b/linux/installer/common/libsgx-headers/BOMs/libsgx-headers.txt @@ -4,10 +4,12 @@ DeliveryName InstallName FileCheckSum FileFeature FileOwner /common/inc/sgx_eid.h /include/sgx_eid.h 0 main STP /common/inc/sgx_error.h /include/sgx_error.h 0 main STP /common/inc/sgx_report.h /include/sgx_report.h main STP +/common/inc/sgx_report2.h /include/sgx_report2.h main STP /common/inc/sgx_key.h /include/sgx_key.h 0 main STP /common/inc/sgx_quote.h /include/sgx_quote.h 0 main STP /common/inc/sgx_urts.h /include/sgx_urts.h 0 main STP /external/dcap_source/QuoteGeneration/quote_wrapper/common/inc/sgx_ql_lib_common.h /include/sgx_ql_lib_common.h 0 main STP /external/dcap_source/QuoteGeneration/quote_wrapper/common/inc/sgx_quote_3.h /include/sgx_quote_3.h 0 main STP +/external/dcap_source/QuoteGeneration/quote_wrapper/common/inc/sgx_quote_4.h /include/sgx_quote_4.h 0 main STP /external/dcap_source/QuoteGeneration/quote_wrapper/common/inc/sgx_ql_quote.h /include/sgx_ql_quote.h 0 main STP /external/dcap_source/QuoteGeneration/pce_wrapper/inc/sgx_pce.h /include/sgx_pce.h 0 main STP diff --git a/linux/installer/common/psw-dcap/Makefile b/linux/installer/common/psw-dcap/Makefile index 4f05c94d..a85c8b82 100644 --- a/linux/installer/common/psw-dcap/Makefile +++ b/linux/installer/common/psw-dcap/Makefile @@ -53,6 +53,8 @@ QE3_FULL_VER:= $(call ACQUIRE_DCAP_VERSION,QE3_VERSION) QE3_MAJOR_VER:=$(word 1,$(subst ., ,$(QE3_FULL_VER))) QVE_FULL_VER:= $(call ACQUIRE_DCAP_VERSION,QVE_VERSION) QVE_MAJOR_VER:=$(word 1,$(subst ., ,$(QVE_FULL_VER))) +PCE_LOGIC_FULL_VER:= $(call ACQUIRE_DCAP_VERSION,PCE_WRAPPER_VERSION) +PCE_LOGIC_MAJOR_VER:=$(word 1,$(subst ., ,$(PCE_LOGIC_FULL_VER))) ECL_FULL_VER:= $(call ACQUIRE_PSW_VERSION,ENCLAVE_COMMON_VERSION) ECL_MAJOR_VER:=$(word 1,$(subst ., ,$(ECL_FULL_VER))) URTS_FULL_VER:= $(call ACQUIRE_PSW_VERSION,URTS_VERSION) @@ -216,7 +218,7 @@ install_$(AESM_SERVICE_PACKAGE): $(foreach PKG,$(AESM_SERVICE_PKGS),post_$(PKG)) cd $(shell readlink -m $(DESTDIR)/$(AESM_PCE_PACKAGE)/$(SGX_INSTALL_PATH)/$(AESM_SERVICE_PACKAGE)/aesm) && \ ln -fs $(shell readlink -m $(USR_LIB_PATH)/libsgx_pce.signed.so.$(PCE_MAJOR_VER)) && \ ln -fs $(shell readlink -m $(USR_LIB_PATH)/libsgx_pce.signed.so) && \ - ln -fs liburts_internal.so libsgx_urts.so + ln -fs liburts_internal.so libsgx_urts.so.$(URTS_MAJOR_VER) PHONY+=install_$(DCAP_PCCS_PACKAGE) install_$(DCAP_PCCS_PACKAGE): pre_$(DCAP_PCCS_PACKAGE) | $(PACKAGE_ROOT_PATH) @@ -281,6 +283,10 @@ install_ae: $(foreach PKG,$(AE_PKGS),post_$(PKG)) cd $(shell readlink -m $(DESTDIR)/$(AE_IDE_PACKAGE)/$(USR_LIB_PATH)) && \ mv libsgx_id_enclave.signed.so libsgx_id_enclave.signed.so.$(IDE_FULL_VER) && \ ln -fs libsgx_id_enclave.signed.so.$(IDE_FULL_VER) libsgx_id_enclave.signed.so.$(IDE_MAJOR_VER) + cd $(shell readlink -m $(DESTDIR)/$(PCE_LOGIC_PACKAGE)/$(USR_LIB_PATH)) && \ + mv libsgx_pce_logic.so libsgx_pce_logic.so.$(PCE_LOGIC_FULL_VER) && \ + ln -fs libsgx_pce_logic.so.$(PCE_LOGIC_FULL_VER) libsgx_pce_logic.so.$(PCE_LOGIC_MAJOR_VER) && \ + ln -fs libsgx_pce_logic.so.$(PCE_LOGIC_MAJOR_VER) libsgx_pce_logic.so PHONY+=install_dev_lib install_dev_lib: $(foreach PKG,$(DEV_LIB_PKGS),post_$(PKG)) diff --git a/linux/installer/common/psw-tdx/BOM_install/libsgx-tdx-logic-devel.txt b/linux/installer/common/psw-tdx/BOM_install/libsgx-tdx-logic-devel.txt index d2966f42..f5b4de2a 100644 --- a/linux/installer/common/psw-tdx/BOM_install/libsgx-tdx-logic-devel.txt +++ b/linux/installer/common/psw-tdx/BOM_install/libsgx-tdx-logic-devel.txt @@ -1,2 +1,2 @@ DeliveryName InstallName FileCheckSum FileFeature FileOwner -/quote_wrapper/tdx_quote/td_ql_logic.h /include/td_ql_logic.h 0 main STP +/external/dcap_source/QuoteGeneration/quote_wrapper/tdx_quote/inc/td_ql_wrapper.h /include/td_ql_wrapper.h 0 main STP diff --git a/linux/installer/common/psw-tdx/Makefile b/linux/installer/common/psw-tdx/Makefile index 07de50cc..4f50ee49 100644 --- a/linux/installer/common/psw-tdx/Makefile +++ b/linux/installer/common/psw-tdx/Makefile @@ -143,6 +143,7 @@ DEV_LIB_PKGS:= $(ENCLAVE_COMMON_PACKAGE) \ $(URTS_PACKAGE) \ $(SGX_HEADERS_PACKAGE) \ $(TDX_LOGIC_PACKAGE) \ + $(TDX_LOGIC_DEV_PACKAGE) \ $(PCE_LOGIC_PACKAGE) \ $(DCAP_QPL_PACKAGE) \ $(DCAP_QPL_DEV_PACKAGE) \ @@ -275,7 +276,7 @@ install_dev_lib: $(foreach PKG,$(DEV_LIB_PKGS),post_$(PKG)) cd $(shell readlink -m $(DESTDIR)/$(TDX_LOGIC_PACKAGE)/$(USR_LIB_PATH)) && \ mv libsgx_tdx_logic.so libsgx_tdx_logic.so.$(TDX_LOGIC_FULL_VER) && \ ln -fs libsgx_tdx_logic.so.$(TDX_LOGIC_FULL_VER) libsgx_tdx_logic.so.$(TDX_LOGIC_MAJOR_VER) - cd $(shell readlink -m $(DESTDIR)/$(TDX_LOGIC_PACKAGE)/$(USR_LIB_PATH)) && \ + cd $(shell readlink -m $(DESTDIR)/$(TDX_LOGIC_DEV_PACKAGE)/$(USR_LIB_PATH)) && \ ln -fs libsgx_tdx_logic.so.$(TDX_LOGIC_MAJOR_VER) libsgx_tdx_logic.so cd $(shell readlink -m $(DESTDIR)/$(PCE_LOGIC_PACKAGE)/$(USR_LIB_PATH)) && \ mv libsgx_pce_logic.so libsgx_pce_logic.so.$(PCE_LOGIC_FULL_VER) && \ diff --git a/linux/installer/common/psw-tdx/installConfig b/linux/installer/common/psw-tdx/installConfig index b8af9fbc..7129b71d 100644 --- a/linux/installer/common/psw-tdx/installConfig +++ b/linux/installer/common/psw-tdx/installConfig @@ -8,6 +8,7 @@ AE_IDE_PACKAGE=libsgx-ae-id-enclave AE_TDQE_PACKAGE=libsgx-ae-tdqe AE_QVE_PACKAGE=libsgx-ae-qve TDX_LOGIC_PACKAGE=libsgx-tdx-logic +TDX_LOGIC_DEV_PACKAGE=libsgx-tdx-logic-devel PCE_LOGIC_PACKAGE=libsgx-pce-logic DCAP_QPL_PACKAGE=libsgx-dcap-default-qpl DCAP_QPL_DEV_PACKAGE=libsgx-dcap-default-qpl-devel diff --git a/linux/installer/common/psw/Makefile b/linux/installer/common/psw/Makefile index 022ca16d..e574b674 100644 --- a/linux/installer/common/psw/Makefile +++ b/linux/installer/common/psw/Makefile @@ -46,6 +46,8 @@ ECL_VER=1.0.0 LCH_VER=1.0.0 EPID_VER=1.0.0 QEX_VER=1.0.0 +URTS_VER:=2.0.0.0 +QE3L_VER:=1.0.0 default: @@ -63,6 +65,9 @@ install: mv $(PSW_LIB_PATH)/libsgx_enclave_common.so $(USR_LIB_PATH) rmdir $(PSW_LIB_PATH) cd $(USR_LIB_PATH) && \ + mv libsgx_urts.so libsgx_urts.so.$(URTS_VER) && \ + ln -fs libsgx_urts.so.$(URTS_VER) libsgx_urts.so.$(call SPLIT_VERSION,$(URTS_VER),1) && \ + ln -fs libsgx_urts.so.$(call SPLIT_VERSION,$(URTS_VER),1) libsgx_urts.so &&\ mv libsgx_enclave_common.so libsgx_enclave_common.so.$(ECL_VER) && \ ln -fs libsgx_enclave_common.so.$(ECL_VER) libsgx_enclave_common.so.$(call SPLIT_VERSION,$(ECL_VER),1) && \ ln -fs libsgx_enclave_common.so.$(call SPLIT_VERSION,$(ECL_VER),1) libsgx_enclave_common.so && \ @@ -76,4 +81,5 @@ install: ln -fs libsgx_quote_ex.so.$(QEX_VER) libsgx_quote_ex.so.$(call SPLIT_VERSION,$(QEX_VER),1) && \ ln -fs libsgx_quote_ex.so.$(call SPLIT_VERSION,$(QEX_VER),1) libsgx_quote_ex.so cd $(INSTALL_PATH)/aesm && \ - ln -fs liburts_internal.so libsgx_urts.so + ln -fs liburts_internal.so libsgx_urts.so.$(call SPLIT_VERSION,$(URTS_VER),1) && \ + ln -fs libsgx_qe3_logic.so.$(call SPLIT_VERSION,$(QE3L_VER),1) libsgx_qe3_logic.so diff --git a/linux/installer/common/psw/createTarball.sh b/linux/installer/common/psw/createTarball.sh index 934390f3..d43cde5f 100755 --- a/linux/installer/common/psw/createTarball.sh +++ b/linux/installer/common/psw/createTarball.sh @@ -69,10 +69,12 @@ ECL_VER=$(awk '/ENCLAVE_COMMON_VERSION/ {print $3}' ${ROOT_DIR}/common/inc/inter LCH_VER=$(awk '/LAUNCH_VERSION/ {print $3}' ${ROOT_DIR}/common/inc/internal/se_version.h|sed 's/^\"\(.*\)\"$/\1/') EPID_VER=$(awk '/EPID_VERSION/ {print $3}' ${ROOT_DIR}/common/inc/internal/se_version.h|sed 's/^\"\(.*\)\"$/\1/') QEX_VER=$(awk '/QUOTE_EX_VERSION/ {print $3}' ${ROOT_DIR}/common/inc/internal/se_version.h|sed 's/^\"\(.*\)\"$/\1/') +URTS_VERSION=$(awk '/URTS_VERSION/ {print $3}' ${ROOT_DIR}/common/inc/internal/se_version.h|sed 's/^\"\(.*\)\"$/\1/') pushd ${INSTALL_PATH} &> /dev/null sed -i "s/ECL_VER=.*/ECL_VER=${ECL_VER}/" Makefile sed -i "s/LCH_VER=.*/LCH_VER=${LCH_VER}/" Makefile sed -i "s/EPID_VER=.*/EPID_VER=${EPID_VER}/" Makefile sed -i "s/QEX_VER=.*/QEX_VER=${QEX_VER}/" Makefile +sed -i "s/URTS_VER=.*/URTS_VER=${URTS_VERSION}/" Makefile tar -zcvf ${TARBALL_NAME} * popd &> /dev/null diff --git a/linux/installer/common/sgx-aesm-service/Makefile b/linux/installer/common/sgx-aesm-service/Makefile index 71face18..384ec9f5 100644 --- a/linux/installer/common/sgx-aesm-service/Makefile +++ b/linux/installer/common/sgx-aesm-service/Makefile @@ -57,6 +57,7 @@ PVE_VER=1.0.0 LE_VER=1.0.0 PCE_VER=1.0.0 QE3_VER=1.0.0 +URTS_VER:=2.0.0 SPLIT_VERSION=$(word $2,$(subst ., ,$1)) default: @@ -99,7 +100,7 @@ install: $(PACKAGES) cd $(shell readlink -m $(DESTDIR)/$(AESM_PCE_PACKAGE_NAME)/$(AESM_SERVICE_PACKAGE_PATH)/$(AESM_SERVICE_PACKAGE_NAME)/aesm) && \ ln -fs $(USR_LIB_PATH)/libsgx_pce.signed.so.$(call SPLIT_VERSION,$(PCE_VER),1) && \ ln -fs $(USR_LIB_PATH)/libsgx_pce.signed.so && \ - ln -fs liburts_internal.so libsgx_urts.so + ln -fs liburts_internal.so libsgx_urts.so.$(call SPLIT_VERSION,$(URTS_VER),1) $(PACKAGES): install -d $(shell readlink -m $(DESTDIR)/$@) diff --git a/linux/installer/common/sgx-aesm-service/createTarball.sh b/linux/installer/common/sgx-aesm-service/createTarball.sh index 55d05809..c4a0512c 100755 --- a/linux/installer/common/sgx-aesm-service/createTarball.sh +++ b/linux/installer/common/sgx-aesm-service/createTarball.sh @@ -67,12 +67,14 @@ QE_VERSION=$(awk '/QE_VERSION/ {print $3}' ${ROOT_DIR}/common/inc/internal/se_ve PVE_VERSION=$(awk '/PVE_VERSION/ {print $3}' ${ROOT_DIR}/common/inc/internal/se_version.h|sed 's/^\"\(.*\)\"$/\1/') LE_VERSION=$(awk '/LE_VERSION/ {print $3}' ${ROOT_DIR}/common/inc/internal/se_version.h|sed 's/^\"\(.*\)\"$/\1/') PCE_VERSION=$(awk '/PCE_VERSION/ {print $3}' ${ROOT_DIR}/common/inc/internal/se_version.h|sed 's/^\"\(.*\)\"$/\1/') +URTS_VERSION=$(awk '/URTS_VERSION/ {print $3}' ${ROOT_DIR}/common/inc/internal/se_version.h|sed 's/^\"\(.*\)\"$/\1/') QE3_VERSION=$(awk '/QE3_VERSION/ {print $3}' ${ROOT_DIR}/external/dcap_source/QuoteGeneration/common/inc/internal/se_version.h|sed 's/^\"\(.*\)\"$/\1/') pushd ${INSTALL_PATH} &> /dev/null sed -i "s/QE_VER=.*/QE_VER=${QE_VERSION}/" Makefile sed -i "s/PVE_VER=.*/PVE_VER=${PVE_VERSION}/" Makefile sed -i "s/LE_VER=.*/LE_VER=${LE_VERSION}/" Makefile sed -i "s/PCE_VER=.*/PCE_VER=${PCE_VERSION}/" Makefile +sed -i "s/URTS_VER=.*/URTS_VER=${URTS_VERSION}/" Makefile sed -i "s/QE3_VER=.*/QE3_VER=${QE3_VERSION}/" Makefile tar -zcvf ${TARBALL_NAME} * popd &> /dev/null diff --git a/linux/installer/deb/sgx-aesm-service/sgx-aesm-service-1.0/debian/control b/linux/installer/deb/sgx-aesm-service/sgx-aesm-service-1.0/debian/control index 49948db4..3d4d8313 100644 --- a/linux/installer/deb/sgx-aesm-service/sgx-aesm-service-1.0/debian/control +++ b/linux/installer/deb/sgx-aesm-service/sgx-aesm-service-1.0/debian/control @@ -37,12 +37,12 @@ Description: Unified Quote Plugin for Intel(R) Software Guard Extensions AESM Se Package: libsgx-aesm-ecdsa-plugin Architecture: amd64 -Depends: ${shlibs:Depends}, ${misc:Depends}, sgx-aesm-service(>= @dep_version@), libsgx-qe3-logic(>= 1.15), libsgx-aesm-pce-plugin(>= @dep_version@) +Depends: ${shlibs:Depends}, ${misc:Depends}, sgx-aesm-service(>= @dep_version@), libsgx-qe3-logic(>= 1.16), libsgx-aesm-pce-plugin(>= @dep_version@) Description: ECDSA Quote Plugin for Intel(R) Software Guard Extensions AESM Service Package: libsgx-aesm-pce-plugin Architecture: amd64 -Depends: ${shlibs:Depends}, ${misc:Depends}, sgx-aesm-service(>= @dep_version@), libsgx-pce-logic(>= 1.15), libsgx-ae-pce(>= @dep_version@) +Depends: ${shlibs:Depends}, ${misc:Depends}, sgx-aesm-service(>= @dep_version@), libsgx-pce-logic(>= 1.16), libsgx-ae-pce(>= @dep_version@) Description: PCE Plugin for Intel(R) Software Guard Extensions AESM Service Package: libsgx-ae-pce diff --git a/linux/installer/rpm/psw-dcap/sanitize.sh b/linux/installer/rpm/psw-dcap/sanitize.sh index 41734bc0..7ab53df3 100755 --- a/linux/installer/rpm/psw-dcap/sanitize.sh +++ b/linux/installer/rpm/psw-dcap/sanitize.sh @@ -47,7 +47,7 @@ make -C ${root_dir} preparation # Prepare ipp-crypto source pushd ${root_dir}/external/ippcp_internal/ - cd ipp-crypto && git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch >/dev/null 2>&1 || git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch --check -R +cd ipp-crypto && git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch >/dev/null 2>&1 || git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch --check -R popd diff --git a/linux/installer/rpm/psw-tdx/psw-tdx.spec.tmpl b/linux/installer/rpm/psw-tdx/psw-tdx.spec.tmpl index d644db61..0dd5fd8c 100644 --- a/linux/installer/rpm/psw-tdx/psw-tdx.spec.tmpl +++ b/linux/installer/rpm/psw-tdx/psw-tdx.spec.tmpl @@ -130,11 +130,19 @@ Intel(R) Software Guard Extensions QVE %package -n libsgx-tdx-logic Version: %{_dcap_version} -Summary: Intel(R) Software Guard Extensions TDX logic -Requires: libsgx-urts >= %{_psw_version}-%{release} libsgx-ae-tdqe >= %{version}-%{release} libsgx-ae-id-enclave >= %{version}-%{release} +Summary: Intel(R) Trust Domain Extensions QE logic library +Requires: libsgx-urts >= %{_psw_version}-%{release} libsgx-ae-tdqe >= %{version}-%{release} libsgx-ae-id-enclave >= %{version}-%{release} libsgx-pce-logic >= %{version}-%{release} %description -n libsgx-tdx-logic -Intel(R) Software Guard Extensions TDX logic +Intel(R) Trust Domain Extensions QE logic library + +%package -n libsgx-tdx-logic-devel +Version: %{_dcap_version} +Summary: Intel(R) Trust Domain Extensions QE logic library For Developers +Requires: libsgx-tdx-logic = %{version}-%{release} libsgx-headers >= %{_psw_version}-%{release} + +%description -n libsgx-tdx-logic-devel +Intel(R) Trust Domain Extensions QE logic library For Developers %package -n libsgx-pce-logic Version: %{_dcap_version} @@ -299,6 +307,7 @@ make clean %files -n libsgx-ae-tdqe -f %{_specdir}/list-libsgx-ae-tdqe %files -n libsgx-ae-qve -f %{_specdir}/list-libsgx-ae-qve %files -n libsgx-tdx-logic -f %{_specdir}/list-libsgx-tdx-logic +%files -n libsgx-tdx-logic-devel -f %{_specdir}/list-libsgx-tdx-logic-devel %files -n libsgx-pce-logic -f %{_specdir}/list-libsgx-pce-logic %files -n libsgx-dcap-default-qpl -f %{_specdir}/list-libsgx-dcap-default-qpl %files -n libsgx-dcap-default-qpl-devel -f %{_specdir}/list-libsgx-dcap-default-qpl-devel diff --git a/linux/installer/rpm/psw-tdx/sanitize.sh b/linux/installer/rpm/psw-tdx/sanitize.sh index bd54d253..d78c64d3 100755 --- a/linux/installer/rpm/psw-tdx/sanitize.sh +++ b/linux/installer/rpm/psw-tdx/sanitize.sh @@ -46,7 +46,7 @@ make -C ${root_dir} preparation # Prepare ipp-crypto source pushd ${root_dir}/external/ippcp_internal/ - cd ipp-crypto && git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch >/dev/null 2>&1 || git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch --check -R +cd ipp-crypto && git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch >/dev/null 2>&1 || git apply ../0001-IPP-crypto-for-SGX_psw_dcap.patch --check -R popd python ${common_dir}/gen_source/copy_source.py \ diff --git a/linux/installer/rpm/sgx-aesm-service/libsgx-aesm-ecdsa-plugin.spec b/linux/installer/rpm/sgx-aesm-service/libsgx-aesm-ecdsa-plugin.spec index 51bd9a2c..202f73e8 100644 --- a/linux/installer/rpm/sgx-aesm-service/libsgx-aesm-ecdsa-plugin.spec +++ b/linux/installer/rpm/sgx-aesm-service/libsgx-aesm-ecdsa-plugin.spec @@ -38,7 +38,7 @@ Version: @version@ Release: 1%{?dist} Summary: ECDSA Quote Plugin for Intel(R) Software Guard Extensions AESM Service Group: Development/System -Requires: sgx-aesm-service >= %{version}-%{release} libsgx-qe3-logic >= 1.15 libsgx-aesm-pce-plugin >= %{version}-%{release} +Requires: sgx-aesm-service >= %{version}-%{release} libsgx-qe3-logic >= 1.16 libsgx-aesm-pce-plugin >= %{version}-%{release} License: BSD License URL: https://github.com/intel/linux-sgx diff --git a/linux/installer/rpm/sgx-aesm-service/libsgx-aesm-pce-plugin.spec b/linux/installer/rpm/sgx-aesm-service/libsgx-aesm-pce-plugin.spec index b2233f6c..22490064 100644 --- a/linux/installer/rpm/sgx-aesm-service/libsgx-aesm-pce-plugin.spec +++ b/linux/installer/rpm/sgx-aesm-service/libsgx-aesm-pce-plugin.spec @@ -38,7 +38,7 @@ Version: @version@ Release: 1%{?dist} Summary: PCE Plugin for Intel(R) Software Guard Extensions AESM Service Group: Development/System -Requires: sgx-aesm-service >= %{version}-%{release} libsgx-pce-logic >= 1.15 +Requires: sgx-aesm-service >= %{version}-%{release} libsgx-pce-logic >= 1.16 License: BSD License URL: https://github.com/intel/linux-sgx diff --git a/linux/reproducibility/build_and_launch_docker.sh b/linux/reproducibility/build_and_launch_docker.sh index 8b3a5f5a..2b65f0fe 100755 --- a/linux/reproducibility/build_and_launch_docker.sh +++ b/linux/reproducibility/build_and_launch_docker.sh @@ -75,8 +75,8 @@ mount_dir="/linux-sgx" sdk_installer="" sgx_src="" -default_sdk_installer=sgx_linux_x64_sdk_reproducible_2.18.100.1.bin -default_sdk_installer_url=https://download.01.org/intel-sgx/sgx-linux/2.18/distro/nix_reproducibility/$default_sdk_installer +default_sdk_installer=sgx_linux_x64_sdk_reproducible_2.19.100.1.bin +default_sdk_installer_url=https://download.01.org/intel-sgx/sgx-linux/2.19/distro/nix_reproducibility/$default_sdk_installer usage() @@ -177,7 +177,7 @@ prepare_sgx_src() if [ "$sgx_src" != "" ]; then mkdir -p "$sgx_repo" && cp -a "$sgx_src/." "$sgx_repo" else - git clone -b sgx_2.18_reproducible https://github.com/intel/linux-sgx.git $sgx_repo + git clone -b sgx_2.19_reproducible https://github.com/intel/linux-sgx.git $sgx_repo fi cd "$sgx_repo" && make preparation diff --git a/psw/ae/aesm_service/config/network/aesmd.conf b/psw/ae/aesm_service/config/network/aesmd.conf index 6f8a3823..e96acb58 100644 --- a/psw/ae/aesm_service/config/network/aesmd.conf +++ b/psw/ae/aesm_service/config/network/aesmd.conf @@ -9,3 +9,5 @@ #default quoting type = ecdsa_256 #default quoting type = epid_linkable #default quoting type = epid_unlinkable +#qpl log level = error +#qpl log level = info \ No newline at end of file diff --git a/psw/ae/aesm_service/source/CMakeLists.txt b/psw/ae/aesm_service/source/CMakeLists.txt index 07577d60..a77d53fb 100644 --- a/psw/ae/aesm_service/source/CMakeLists.txt +++ b/psw/ae/aesm_service/source/CMakeLists.txt @@ -1,3 +1,34 @@ +# +# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + # [proj-begin] cmake_minimum_required(VERSION 3.0.0) project(ModularAESM VERSION 0.1.0) diff --git a/psw/ae/aesm_service/source/bundles/CMakeLists.txt b/psw/ae/aesm_service/source/bundles/CMakeLists.txt index 18e188c8..e6ef3e8e 100644 --- a/psw/ae/aesm_service/source/bundles/CMakeLists.txt +++ b/psw/ae/aesm_service/source/bundles/CMakeLists.txt @@ -1,3 +1,34 @@ +# +# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + BUNDLELIST(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}) FOREACH(subdir ${SUBDIRS}) diff --git a/psw/ae/aesm_service/source/bundles/ecdsa_quote_service_bundle/CMakeLists.txt b/psw/ae/aesm_service/source/bundles/ecdsa_quote_service_bundle/CMakeLists.txt index 72064c8b..2ac14e27 100644 --- a/psw/ae/aesm_service/source/bundles/ecdsa_quote_service_bundle/CMakeLists.txt +++ b/psw/ae/aesm_service/source/bundles/ecdsa_quote_service_bundle/CMakeLists.txt @@ -1,3 +1,34 @@ +# +# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + set(qe3_logic "${CMAKE_SOURCE_DIR}/../../../../external/dcap_source/QuoteGeneration/build/linux/libsgx_qe3_logic.so") get_filename_component(bundle ${CMAKE_CURRENT_SOURCE_DIR} NAME) aux_source_directory(. _src) diff --git a/psw/ae/aesm_service/source/bundles/ecdsa_quote_service_bundle/ecdsa_quote_service_bundle.cpp b/psw/ae/aesm_service/source/bundles/ecdsa_quote_service_bundle/ecdsa_quote_service_bundle.cpp index afc3b363..e005fa5c 100644 --- a/psw/ae/aesm_service/source/bundles/ecdsa_quote_service_bundle/ecdsa_quote_service_bundle.cpp +++ b/psw/ae/aesm_service/source/bundles/ecdsa_quote_service_bundle/ecdsa_quote_service_bundle.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #include #include @@ -8,6 +39,7 @@ #include #include #include "aesm_logic.h" +#include "aesm_config.h" #include "sgx_quote_3.h" #include "sgx_ql_quote.h" #include "sgx_ql_core_wrapper.h" @@ -21,7 +53,7 @@ static AESMLogicMutex ecdsa_quote_mutex; extern const sgx_ql_att_key_id_t g_default_ecdsa_p256_att_key_id; extern "C" void* get_qpl_handle(); -typedef quote3_error_t(*sgx_ql_set_logging_callback_t)(sgx_ql_logging_callback_t logger); +typedef quote3_error_t(*sgx_ql_set_logging_callback_t)(sgx_ql_logging_callback_t logger, sgx_ql_log_level_t loglevel); void sgx_ql_logging_callback(sgx_ql_log_level_t level, const char* message) { @@ -277,11 +309,12 @@ public: // Set logging callback for default quote provider library void* handle = get_qpl_handle(); if (handle != NULL) { + aesm_config_infos_t info = {0}; char *error; sgx_ql_set_logging_callback_t ql_set_logging_callback = (sgx_ql_set_logging_callback_t)dlsym(handle, "sgx_ql_set_logging_callback"); - if ((error = dlerror()) == NULL && ql_set_logging_callback != NULL) { + if ((error = dlerror()) == NULL && ql_set_logging_callback != NULL && read_aesm_config(info)) { // Set logging function detected - ql_set_logging_callback(sgx_ql_logging_callback); + ql_set_logging_callback(sgx_ql_logging_callback, (sgx_ql_log_level_t)info.qpl_log_level); } else { AESM_LOG_ERROR("Failed to set logging callback for the quote provider library."); diff --git a/psw/ae/aesm_service/source/bundles/epid_quote_service_bundle/CMakeLists.txt b/psw/ae/aesm_service/source/bundles/epid_quote_service_bundle/CMakeLists.txt index 1dd92283..5479249d 100644 --- a/psw/ae/aesm_service/source/bundles/epid_quote_service_bundle/CMakeLists.txt +++ b/psw/ae/aesm_service/source/bundles/epid_quote_service_bundle/CMakeLists.txt @@ -1,3 +1,34 @@ +# +# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + set(Edger8rOutputPVE "${CMAKE_CURRENT_BINARY_DIR}/provision_enclave_u.c") set(Edger8rOutputQE "${CMAKE_CURRENT_BINARY_DIR}/quoting_enclave_u.c") get_filename_component(bundle ${CMAKE_CURRENT_SOURCE_DIR} NAME) diff --git a/psw/ae/aesm_service/source/bundles/epid_quote_service_bundle/epid_quote_service_bundle.cpp b/psw/ae/aesm_service/source/bundles/epid_quote_service_bundle/epid_quote_service_bundle.cpp index 0f5b9cdc..c7db8d38 100644 --- a/psw/ae/aesm_service/source/bundles/epid_quote_service_bundle/epid_quote_service_bundle.cpp +++ b/psw/ae/aesm_service/source/bundles/epid_quote_service_bundle/epid_quote_service_bundle.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #include #include #include diff --git a/psw/ae/aesm_service/source/bundles/le_launch_service_bundle/CMakeLists.txt b/psw/ae/aesm_service/source/bundles/le_launch_service_bundle/CMakeLists.txt index 9f3aba89..3267c1b8 100644 --- a/psw/ae/aesm_service/source/bundles/le_launch_service_bundle/CMakeLists.txt +++ b/psw/ae/aesm_service/source/bundles/le_launch_service_bundle/CMakeLists.txt @@ -1,3 +1,34 @@ +# +# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + if(REF_LE) set(Edger8rOutputLE "${CMAKE_CURRENT_BINARY_DIR}/ref_le_u.c") set(Edger8rEDLLE "${PROJECT_SOURCE_DIR}/../../ref_le/ref_le.edl") diff --git a/psw/ae/aesm_service/source/bundles/le_launch_service_bundle/le_launch_service_bundle.cpp b/psw/ae/aesm_service/source/bundles/le_launch_service_bundle/le_launch_service_bundle.cpp index a6da7e92..8faa23c4 100644 --- a/psw/ae/aesm_service/source/bundles/le_launch_service_bundle/le_launch_service_bundle.cpp +++ b/psw/ae/aesm_service/source/bundles/le_launch_service_bundle/le_launch_service_bundle.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #include #include "uae_service_internal.h" diff --git a/psw/ae/aesm_service/source/bundles/linux_network_service_bundle/CMakeLists.txt b/psw/ae/aesm_service/source/bundles/linux_network_service_bundle/CMakeLists.txt index e16422aa..63fc1f1a 100644 --- a/psw/ae/aesm_service/source/bundles/linux_network_service_bundle/CMakeLists.txt +++ b/psw/ae/aesm_service/source/bundles/linux_network_service_bundle/CMakeLists.txt @@ -1,3 +1,34 @@ +# +# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + find_package(CURL REQUIRED) if(CURL_FOUND) message ("CURL found") diff --git a/psw/ae/aesm_service/source/bundles/linux_network_service_bundle/linux_network_service_bundle.cpp b/psw/ae/aesm_service/source/bundles/linux_network_service_bundle/linux_network_service_bundle.cpp index 8d2d9ef0..d28a759c 100644 --- a/psw/ae/aesm_service/source/bundles/linux_network_service_bundle/linux_network_service_bundle.cpp +++ b/psw/ae/aesm_service/source/bundles/linux_network_service_bundle/linux_network_service_bundle.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #include #include diff --git a/psw/ae/aesm_service/source/bundles/pce_service_bundle/CMakeLists.txt b/psw/ae/aesm_service/source/bundles/pce_service_bundle/CMakeLists.txt index d447a667..f899d5fd 100644 --- a/psw/ae/aesm_service/source/bundles/pce_service_bundle/CMakeLists.txt +++ b/psw/ae/aesm_service/source/bundles/pce_service_bundle/CMakeLists.txt @@ -1,3 +1,34 @@ +# +# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + set(pce_logic "${CMAKE_SOURCE_DIR}/../../../../external/dcap_source/QuoteGeneration/build/linux/libsgx_pce_logic.so") get_filename_component(bundle ${CMAKE_CURRENT_SOURCE_DIR} NAME) aux_source_directory(. _srcs) diff --git a/psw/ae/aesm_service/source/bundles/pce_service_bundle/pce_service_bundle.cpp b/psw/ae/aesm_service/source/bundles/pce_service_bundle/pce_service_bundle.cpp index 493421f5..6978272b 100644 --- a/psw/ae/aesm_service/source/bundles/pce_service_bundle/pce_service_bundle.cpp +++ b/psw/ae/aesm_service/source/bundles/pce_service_bundle/pce_service_bundle.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #include #include diff --git a/psw/ae/aesm_service/source/bundles/quote_ex_service_bundle/CMakeLists.txt b/psw/ae/aesm_service/source/bundles/quote_ex_service_bundle/CMakeLists.txt index fba4102a..98cb4e28 100644 --- a/psw/ae/aesm_service/source/bundles/quote_ex_service_bundle/CMakeLists.txt +++ b/psw/ae/aesm_service/source/bundles/quote_ex_service_bundle/CMakeLists.txt @@ -1,3 +1,34 @@ +# +# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + get_filename_component(bundle ${CMAKE_CURRENT_SOURCE_DIR} NAME) aux_source_directory(. _srcs) CreateBundle(${bundle} ${_srcs}) diff --git a/psw/ae/aesm_service/source/bundles/quote_ex_service_bundle/quote_ex_service_bundle.cpp b/psw/ae/aesm_service/source/bundles/quote_ex_service_bundle/quote_ex_service_bundle.cpp index f642046c..e5bc3ded 100644 --- a/psw/ae/aesm_service/source/bundles/quote_ex_service_bundle/quote_ex_service_bundle.cpp +++ b/psw/ae/aesm_service/source/bundles/quote_ex_service_bundle/quote_ex_service_bundle.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #include #include #include diff --git a/psw/ae/aesm_service/source/common/aesm_config.h b/psw/ae/aesm_service/source/common/aesm_config.h index 6684edc9..25d7266f 100644 --- a/psw/ae/aesm_service/source/common/aesm_config.h +++ b/psw/ae/aesm_service/source/common/aesm_config.h @@ -38,6 +38,7 @@ typedef struct _aesm_config_infos_t{ uint32_t quoting_type; char white_list_url[MAX_PATH]; char aesm_proxy[MAX_PATH]; + uint32_t qpl_log_level; }aesm_config_infos_t; #endif diff --git a/psw/ae/aesm_service/source/core/CMakeLists.txt b/psw/ae/aesm_service/source/core/CMakeLists.txt index 878ba1db..c782215e 100644 --- a/psw/ae/aesm_service/source/core/CMakeLists.txt +++ b/psw/ae/aesm_service/source/core/CMakeLists.txt @@ -1,3 +1,34 @@ +# +# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + aux_source_directory(. _srcs) #Disable CET diff --git a/psw/ae/aesm_service/source/core/ipc/CMakeLists.txt b/psw/ae/aesm_service/source/core/ipc/CMakeLists.txt index f233595d..47c0efaf 100644 --- a/psw/ae/aesm_service/source/core/ipc/CMakeLists.txt +++ b/psw/ae/aesm_service/source/core/ipc/CMakeLists.txt @@ -1,3 +1,34 @@ +# +# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + aux_source_directory(. IPC_LIB_SRCS) PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS messages.proto) # Print path to generated files diff --git a/psw/ae/aesm_service/source/interfaces/epid_quote_service.h b/psw/ae/aesm_service/source/interfaces/epid_quote_service.h index 4bf48840..a1b69b08 100644 --- a/psw/ae/aesm_service/source/interfaces/epid_quote_service.h +++ b/psw/ae/aesm_service/source/interfaces/epid_quote_service.h @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #ifndef EPID_QUOTE_SERVICE_EXPORT_H #define EPID_QUOTE_SERVICE_EXPORT_H #include "quote_service.h" diff --git a/psw/ae/aesm_service/source/interfaces/get_att_key_id.h b/psw/ae/aesm_service/source/interfaces/get_att_key_id.h index 48796b9b..9ce3dc06 100644 --- a/psw/ae/aesm_service/source/interfaces/get_att_key_id.h +++ b/psw/ae/aesm_service/source/interfaces/get_att_key_id.h @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #ifndef GET_ATT_KEY_ID_H #define GET_ATT_KEY_ID_H #include "aesm_error.h" diff --git a/psw/ae/aesm_service/source/interfaces/launch_service.h b/psw/ae/aesm_service/source/interfaces/launch_service.h index af8118ca..0695d6b5 100644 --- a/psw/ae/aesm_service/source/interfaces/launch_service.h +++ b/psw/ae/aesm_service/source/interfaces/launch_service.h @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #ifndef LAUNCH_SERVICE_EXPORT_H #define LAUNCH_SERVICE_EXPORT_H #include "service.h" diff --git a/psw/ae/aesm_service/source/interfaces/network_service.h b/psw/ae/aesm_service/source/interfaces/network_service.h index c4cea044..a6ba6568 100644 --- a/psw/ae/aesm_service/source/interfaces/network_service.h +++ b/psw/ae/aesm_service/source/interfaces/network_service.h @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #ifndef NETWORK_SERVICE_EXPORT_H #define NETWORK_SERVICE_EXPORT_H #include "service.h" diff --git a/psw/ae/aesm_service/source/interfaces/pce_service.h b/psw/ae/aesm_service/source/interfaces/pce_service.h index f0acd921..329f23fe 100644 --- a/psw/ae/aesm_service/source/interfaces/pce_service.h +++ b/psw/ae/aesm_service/source/interfaces/pce_service.h @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #ifndef PCE_SERVICE_EXPORT_H #define PCE_SERVICE_EXPORT_H #include "service.h" diff --git a/psw/ae/aesm_service/source/interfaces/quote_ex_service.h b/psw/ae/aesm_service/source/interfaces/quote_ex_service.h index 1c30cdff..06b36a15 100644 --- a/psw/ae/aesm_service/source/interfaces/quote_ex_service.h +++ b/psw/ae/aesm_service/source/interfaces/quote_ex_service.h @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #ifndef QUOTE_EX_SERVICE_EXPORT_H #define QUOTE_EX_SERVICE_EXPORT_H #include "service.h" diff --git a/psw/ae/aesm_service/source/interfaces/quote_provider_service.h b/psw/ae/aesm_service/source/interfaces/quote_provider_service.h index cfb20edb..f6972f6e 100644 --- a/psw/ae/aesm_service/source/interfaces/quote_provider_service.h +++ b/psw/ae/aesm_service/source/interfaces/quote_provider_service.h @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #ifndef QUOTE_PROVIDER_SERVICE_EXPORT_H #define QUOTE_PROVIDER_SERVICE_EXPORT_H #include "quote_ex_service.h" diff --git a/psw/ae/aesm_service/source/interfaces/quote_proxy_service.h b/psw/ae/aesm_service/source/interfaces/quote_proxy_service.h index 1d01f68c..43c26826 100644 --- a/psw/ae/aesm_service/source/interfaces/quote_proxy_service.h +++ b/psw/ae/aesm_service/source/interfaces/quote_proxy_service.h @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #ifndef QUOTE_PROXY_SERVICE_EXPORT_H #define QUOTE_PROXY_SERVICE_EXPORT_H #include "quote_ex_service.h" diff --git a/psw/ae/aesm_service/source/interfaces/quote_service.h b/psw/ae/aesm_service/source/interfaces/quote_service.h index ccc90a8e..ec11adca 100644 --- a/psw/ae/aesm_service/source/interfaces/quote_service.h +++ b/psw/ae/aesm_service/source/interfaces/quote_service.h @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #ifndef QUOTE_SERVICE_EXPORT_H #define QUOTE_SERVICE_EXPORT_H #include "service.h" diff --git a/psw/ae/aesm_service/source/interfaces/select_att_key_id.h b/psw/ae/aesm_service/source/interfaces/select_att_key_id.h index 0383ec64..fab251a9 100644 --- a/psw/ae/aesm_service/source/interfaces/select_att_key_id.h +++ b/psw/ae/aesm_service/source/interfaces/select_att_key_id.h @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #ifndef SELECT_ATT_KEY_ID_H #define SELECT_ATT_KEY_ID_H #include diff --git a/psw/ae/aesm_service/source/interfaces/service.h b/psw/ae/aesm_service/source/interfaces/service.h index 371da4dc..2c5a90a8 100644 --- a/psw/ae/aesm_service/source/interfaces/service.h +++ b/psw/ae/aesm_service/source/interfaces/service.h @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #ifndef SERVICE_EXPORT_H #define SERVICE_EXPORT_H #include "aeerror.h" diff --git a/psw/ae/aesm_service/source/oal/CMakeLists.txt b/psw/ae/aesm_service/source/oal/CMakeLists.txt index 959435cb..077d3a4a 100644 --- a/psw/ae/aesm_service/source/oal/CMakeLists.txt +++ b/psw/ae/aesm_service/source/oal/CMakeLists.txt @@ -1,3 +1,34 @@ +# +# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + if(WIN32) aux_source_directory(windows OAL_LIB_SRCS) else() diff --git a/psw/ae/aesm_service/source/qcnl/CMakeLists.txt b/psw/ae/aesm_service/source/qcnl/CMakeLists.txt index 6ed7ad16..f4c59a2a 100644 --- a/psw/ae/aesm_service/source/qcnl/CMakeLists.txt +++ b/psw/ae/aesm_service/source/qcnl/CMakeLists.txt @@ -1,3 +1,34 @@ +# +# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + find_package(CURL REQUIRED) if(CURL_FOUND) message ("CURL found") diff --git a/psw/ae/aesm_service/source/qpl/CMakeLists.txt b/psw/ae/aesm_service/source/qpl/CMakeLists.txt index 0eb24038..d57c58f6 100644 --- a/psw/ae/aesm_service/source/qpl/CMakeLists.txt +++ b/psw/ae/aesm_service/source/qpl/CMakeLists.txt @@ -1,3 +1,34 @@ +# +# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + aux_source_directory(${PROJECT_SOURCE_DIR}/../../../../external/dcap_source/QuoteGeneration/qpl _srcs) aux_source_directory(${PROJECT_SOURCE_DIR}/../../../../external/dcap_source/QuoteGeneration/qpl/linux _srcs) diff --git a/psw/ae/aesm_service/source/utils/CMakeLists.txt b/psw/ae/aesm_service/source/utils/CMakeLists.txt index 77aac373..2f83b414 100644 --- a/psw/ae/aesm_service/source/utils/CMakeLists.txt +++ b/psw/ae/aesm_service/source/utils/CMakeLists.txt @@ -1,3 +1,34 @@ +# +# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + find_package(OpenSSL REQUIRED) if(OPENSSL_FOUND) message ("OpenSSL found") diff --git a/psw/ae/aesm_service/source/utils/aesm_config.cpp b/psw/ae/aesm_service/source/utils/aesm_config.cpp index 2f1f6103..60ba5833 100644 --- a/psw/ae/aesm_service/source/utils/aesm_config.cpp +++ b/psw/ae/aesm_service/source/utils/aesm_config.cpp @@ -51,6 +51,7 @@ enum _config_value_t{ config_aesm_proxy_url, config_aesm_proxy_type, config_aesm_quoting_type, + config_qpl_log_level, config_value_nums }; @@ -63,7 +64,8 @@ struct _config_patterns_t{ {config_white_list_url, "^[[:blank:]]*whitelist[[:blank:]]*url[[:blank:]]*=" URL_PATTERN OPTION_COMMENT "$"}, //matching line in format: whilelist url = .... {config_aesm_proxy_url,"^[[:blank:]]*aesm[[:blank:]]*proxy[[:blank:]]*=" URL_PATTERN OPTION_COMMENT "$"}, //matching line in format: aesm proxy = ... {config_aesm_proxy_type, "^[[:blank:]]*proxy[[:blank:]]*type[[:blank:]]*=[[:blank:]]([^[:blank:]]+)[[:blank:]]*" OPTION_COMMENT "$"},//matching line in format: proxy type = [direct|default|manual] - {config_aesm_quoting_type, "^[[:blank:]]*default[[:blank:]]*quoting[[:blank:]]*type[[:blank:]]*=[[:blank:]]([^[:blank:]]+)[[:blank:]]*" OPTION_COMMENT "$"}//matching line in format: default quoting type = [ecdsa_256|epid_unlinkable|epid_linkable] + {config_aesm_quoting_type, "^[[:blank:]]*default[[:blank:]]*quoting[[:blank:]]*type[[:blank:]]*=[[:blank:]]([^[:blank:]]+)[[:blank:]]*" OPTION_COMMENT "$"},//matching line in format: default quoting type = [ecdsa_256|epid_unlinkable|epid_linkable] + {config_qpl_log_level, "^[[:blank:]]*qpl[[:blank:]]*log[[:blank:]]*level[[:blank:]]*=[[:blank:]]([^[:blank:]]+)[[:blank:]]*" OPTION_COMMENT "$"},//matching line in format: qpl log level = [error|info] }; #define NUM_CONFIG_PATTERNS (sizeof(config_patterns)/sizeof(config_patterns[0])) @@ -120,6 +122,12 @@ static const char *quoting_type_name[]={ }; #define NUM_QUOTING_TYPE (sizeof(quoting_type_name)/sizeof(quoting_type_name[0])) +static const char *qpl_log_level_name[]={ + "error", + "info", +}; +#define NUM_QPL_LOG_LEVEL (sizeof(qpl_log_level_name)/sizeof(qpl_log_level_name[0])) + //function to decode proxy type from string to integer value static uint32_t read_aesm_proxy_type(const char *string, uint32_t len) { @@ -146,6 +154,19 @@ static uint32_t read_aesm_quoting_type(const char *string, uint32_t len) return (uint32_t)NUM_QUOTING_TYPE; } +//function to decode qpl log level from string to integer value +static uint32_t read_qpl_log_level(const char *string, uint32_t len) +{ + uint32_t i; + for(i=0;i1 0 0x1 - 0xD + 0xE 1 0 1 diff --git a/psw/ae/pve/config.xml b/psw/ae/pve/config.xml index 1f53a3a5..a0e0abfe 100644 --- a/psw/ae/pve/config.xml +++ b/psw/ae/pve/config.xml @@ -3,7 +3,7 @@ 1 0 0x1 - 0xD + 0xE 1 0 1 diff --git a/psw/ae/qe/config.xml b/psw/ae/qe/config.xml index 9224e394..04c1e087 100644 --- a/psw/ae/qe/config.xml +++ b/psw/ae/qe/config.xml @@ -3,7 +3,7 @@ 0 0 0x1 - 0xD + 0xE 1 0 1 diff --git a/psw/urts/linux/Makefile b/psw/urts/linux/Makefile index 3c029c01..ef125ef6 100644 --- a/psw/urts/linux/Makefile +++ b/psw/urts/linux/Makefile @@ -31,6 +31,8 @@ include ../../../buildenv.mk +URTS_VER:= $(shell awk '$$2 ~ /URTS_VERSION/ { print substr($$3, 2, length($$3) - 2); }' $(COMMON_DIR)/inc/internal/se_version.h) + ifndef DEBUG CXXFLAGS += -DDISABLE_TRACE CFLAGS += -DDISABLE_TRACE @@ -139,7 +141,7 @@ $(LIBURTS_INTERNAL): $(INTERNAL_OBJ) $(LIBWRAPPER) $(LIBSGX_ENCLAVE_COMMON) ittn @$(RM) -rf $(BUILD_DIR)/.sgx_enclave_common $(LIBURTS): $(URTS_OBJ) $(LIBWRAPPER) $(LIBSGX_ENCLAVE_COMMON) ittnotify - $(CXX) $(CXXFLAGS) -shared -Wl,-soname=$@ $(LIB) -o $@ $(URTS_OBJ) $(LDFLAGS) + $(CXX) $(CXXFLAGS) -shared -Wl,-soname=$@.$(call SPLIT_VERSION,$(URTS_VER),1) $(LIB) -o $@ $(URTS_OBJ) $(LDFLAGS) $(LIBURTS_DEBUG): $(LIBURTS) ifndef DEBUG diff --git a/psw/urts/linux/edmm_utility.cpp b/psw/urts/linux/edmm_utility.cpp index 1f6f9e42..a7e9f73c 100644 --- a/psw/urts/linux/edmm_utility.cpp +++ b/psw/urts/linux/edmm_utility.cpp @@ -101,6 +101,11 @@ bool get_driver_type(int *driver_type) int hdev = open("/dev/sgx/enclave", O_RDWR); //attempt to open the in-kernel driver if (-1 == hdev) + { + //if /dev/sgx/enclave is not present, try to open /dev/sgx_enclave + hdev = open("/dev/sgx_enclave", O_RDWR); + } + if (-1 == hdev) { hdev = open("/dev/isgx", O_RDWR); //attempt to open the out-of-tree driver if (-1 == hdev) @@ -150,6 +155,11 @@ extern "C" bool open_se_device(int driver_type, int *hdevice) if (driver_type == SGX_DRIVER_IN_KERNEL) { *hdevice = open("/dev/sgx/enclave", O_RDWR); //attempt to open the in-kernel driver + //if /dev/sgx/enclave is not present, try to open /dev/sgx_enclave + if(-1 == *hdevice) + { + *hdevice = open("/dev/sgx_enclave", O_RDWR); + } } else if (driver_type == SGX_DRIVER_DCAP) { diff --git a/psw/urts/loader.cpp b/psw/urts/loader.cpp index 84d18257..b0d8c623 100644 --- a/psw/urts/loader.cpp +++ b/psw/urts/loader.cpp @@ -77,7 +77,8 @@ const char * layout_id_str[] = { "THREAD_GROUP_DYN", "RSRV_MIN", "RSRV_INIT", - "RSRV_MAX" + "RSRV_MAX", + "USER_REGION" }; // enclave creator instance diff --git a/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py b/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py old mode 100755 new mode 100644 index be120d16..672edfdc --- a/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py +++ b/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # # Copyright (C) 2011-2021 Intel Corporation. All rights reserved. # @@ -38,6 +37,7 @@ from ctypes import create_string_buffer import load_symbol_cmd import sgx_emmt import ctypes +import re # Calculate the bit mode of current debuggee project SIZE = gdb.parse_and_eval("sizeof(long)") @@ -523,7 +523,7 @@ def is_bp_in_urts(): try: ip = gdb.parse_and_eval("$pc") solib_name = gdb.solib_name(int(str(ip).split()[0], 16)) - if(solib_name.find("libsgx_urts.so") == -1 and solib_name.find("libsgx_urts_sim.so") == -1 and solib_name.find("libsgx_aesm_service.so") == -1): + if(re.match('libsgx_urts.so[.0-9]*', os.path.basename(solib_name)) == None and solib_name.find("libsgx_urts_sim.so") == -1 and solib_name.find("libsgx_aesm_service.so") == -1): return False else: return True @@ -716,7 +716,7 @@ def exit_handler(event): def newobj_handler(event): solib_name = os.path.basename(event.new_objfile.filename) - if solib_name == 'libsgx_urts.so' or solib_name == 'libsgx_urts_sim.so' or solib_name == 'libsgx_aesm_service.so': + if re.match('libsgx_urts.so[.0-9]*', solib_name) or solib_name == 'libsgx_urts_sim.so' or solib_name == 'libsgx_aesm_service.so': sgx_debugger_init() return diff --git a/sdk/debugger_interface/linux/gdb-sgx-plugin/load_symbol_cmd.py b/sdk/debugger_interface/linux/gdb-sgx-plugin/load_symbol_cmd.py old mode 100755 new mode 100644 index 7b4fe7b8..5d4d9b0a --- a/sdk/debugger_interface/linux/gdb-sgx-plugin/load_symbol_cmd.py +++ b/sdk/debugger_interface/linux/gdb-sgx-plugin/load_symbol_cmd.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # # Copyright (C) 2011-2021 Intel Corporation. All rights reserved. # diff --git a/sdk/debugger_interface/linux/gdb-sgx-plugin/printers.py b/sdk/debugger_interface/linux/gdb-sgx-plugin/printers.py index b4436de8..98356d35 100644 --- a/sdk/debugger_interface/linux/gdb-sgx-plugin/printers.py +++ b/sdk/debugger_interface/linux/gdb-sgx-plugin/printers.py @@ -1,35 +1,3 @@ -#!/usr/bin/env python -# -# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Intel Corporation nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# - #===----------------------------------------------------------------------===## # # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. diff --git a/sdk/debugger_interface/linux/gdb-sgx-plugin/readelf.py b/sdk/debugger_interface/linux/gdb-sgx-plugin/readelf.py old mode 100755 new mode 100644 index c43bf2aa..39c83e36 --- a/sdk/debugger_interface/linux/gdb-sgx-plugin/readelf.py +++ b/sdk/debugger_interface/linux/gdb-sgx-plugin/readelf.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # # Copyright (C) 2011-2021 Intel Corporation. All rights reserved. # diff --git a/sdk/debugger_interface/linux/gdb-sgx-plugin/sgx-gdb b/sdk/debugger_interface/linux/gdb-sgx-plugin/sgx-gdb index 643cdccc..382dbcb6 100755 --- a/sdk/debugger_interface/linux/gdb-sgx-plugin/sgx-gdb +++ b/sdk/debugger_interface/linux/gdb-sgx-plugin/sgx-gdb @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Copyright (C) 2011-2019 Intel Corporation. All rights reserved. +# Copyright (C) 2011-2021 Intel Corporation. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/sdk/debugger_interface/linux/gdb-sgx-plugin/sgx_emmt.py b/sdk/debugger_interface/linux/gdb-sgx-plugin/sgx_emmt.py old mode 100755 new mode 100644 index 7e70d60a..3ed22140 --- a/sdk/debugger_interface/linux/gdb-sgx-plugin/sgx_emmt.py +++ b/sdk/debugger_interface/linux/gdb-sgx-plugin/sgx_emmt.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # # Copyright (C) 2011-2021 Intel Corporation. All rights reserved. # diff --git a/sdk/sign_tool/SignTool/manage_metadata.cpp b/sdk/sign_tool/SignTool/manage_metadata.cpp index 5d2023a0..db209f4d 100644 --- a/sdk/sign_tool/SignTool/manage_metadata.cpp +++ b/sdk/sign_tool/SignTool/manage_metadata.cpp @@ -601,40 +601,46 @@ bool CMetadata::check_xml_parameter(const xml_parameter_t *parameter) uint64_t CMetadata::calculate_rts_bk_overhead() { - uint64_t ema_overhead = sizeof(struct ema_t_); - uint64_t bit_array_overhead = sizeof(struct bit_array_); + se_trace(SE_TRACE_DEBUG, "ema_overhead: %lld, bit_array_overhead: %lld\n", sizeof(struct ema_t_), sizeof(struct bit_array_)); + + // alignment value according to sgx-emm emalloc.c + const uint32_t ema_align = 0x10; + const uint32_t page_count_align = 0x80; + + uint64_t ema_overhead = ROUND_TO(sizeof(struct ema_t_), ema_align); + uint64_t bit_array_overhead = ROUND_TO(sizeof(struct bit_array_), ema_align); // MIN heap uint32_t page_count = (uint32_t)(m_create_param.heap_min_size >> SE_PAGE_SHIFT); - uint64_t heap_node_overhead = ema_overhead + bit_array_overhead + (ROUND_TO(page_count, 8) >> 3); + uint64_t heap_node_overhead = ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); if(m_create_param.heap_init_size > m_create_param.heap_min_size) { // INIT heap page_count = (uint32_t)((m_create_param.heap_init_size - m_create_param.heap_min_size) >> SE_PAGE_SHIFT); - heap_node_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, 8) >> 3); + heap_node_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); } if(m_create_param.heap_max_size > m_create_param.heap_init_size) { page_count = (uint32_t)((m_create_param.heap_max_size - m_create_param.heap_init_size) >> SE_PAGE_SHIFT); - heap_node_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, 8) >> 3); + heap_node_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); } page_count = (uint32_t)(m_create_param.rsrv_min_size >> SE_PAGE_SHIFT); - uint64_t rsrv_node_overhead = ema_overhead + bit_array_overhead + (ROUND_TO(page_count, 8) >> 3); + uint64_t rsrv_node_overhead = ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); if(m_create_param.rsrv_init_size > m_create_param.rsrv_min_size) { // INIT RSRV page_count = (uint32_t)((m_create_param.rsrv_init_size - m_create_param.rsrv_min_size) >> SE_PAGE_SHIFT); - rsrv_node_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, 8) >> 3); + rsrv_node_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); } if(m_create_param.rsrv_max_size > m_create_param.rsrv_init_size) { page_count = (uint32_t)((m_create_param.rsrv_max_size - m_create_param.rsrv_init_size) >> SE_PAGE_SHIFT); - rsrv_node_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, 8) >> 3); + rsrv_node_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); } // guard page | stack | guard page | TCS | SSA | guard page | TLS @@ -644,13 +650,13 @@ uint64_t CMetadata::calculate_rts_bk_overhead() // stack page_count = (uint32_t)(m_create_param.stack_min_size >> SE_PAGE_SHIFT); - non_removed_ctx_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, 8) >> 3); + non_removed_ctx_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); removed_ctx_overhead += ema_overhead; if(m_create_param.stack_max_size > m_create_param.stack_min_size) { page_count = (uint32_t)((m_create_param.stack_max_size - m_create_param.stack_min_size) >> SE_PAGE_SHIFT); - non_removed_ctx_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, 8) >> 3); + non_removed_ctx_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); removed_ctx_overhead += ema_overhead; } @@ -660,12 +666,12 @@ uint64_t CMetadata::calculate_rts_bk_overhead() // tcs page_count = TCS_SIZE >> SE_PAGE_SHIFT; - non_removed_ctx_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, 8) >> 3); + non_removed_ctx_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); removed_ctx_overhead += ema_overhead; // ssa page_count = m_metadata->ssa_frame_size * SSA_NUM; - non_removed_ctx_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, 8) >> 3); + non_removed_ctx_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); removed_ctx_overhead += ema_overhead; // guard page @@ -679,7 +685,7 @@ uint64_t CMetadata::calculate_rts_bk_overhead() { page_count += (uint32_t)(ROUND_TO_PAGE(section->virtual_size()) >> SE_PAGE_SHIFT); } - non_removed_ctx_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, 8) >> 3); + non_removed_ctx_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(page_count, page_count_align) >> 3); removed_ctx_overhead += ema_overhead; uint32_t tcs_min_pool = 0; /* Number of static threads (EADD) */ @@ -730,7 +736,7 @@ uint64_t CMetadata::calculate_rts_bk_overhead() std::vector sections = m_parser->get_sections(); for (auto s : sections) { uint32_t p_count = (uint32_t)(ROUND_TO_PAGE(s->virtual_size()) >> SE_PAGE_SHIFT); - total_sections_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(p_count, 8) >> 3); + total_sections_overhead += ema_overhead + bit_array_overhead + (ROUND_TO(p_count, page_count_align) >> 3); } return heap_node_overhead + @@ -1181,10 +1187,41 @@ bool CMetadata::build_layout_table() // SGX2 metadata required if ((meta_versions & 2u) == 2u) { - // 0x20000 comes from initial emalloc reserve size (0x10000 bytes), - // plus two guard pages (0x8000 bytes each) - uint64_t rts_bk_overhead = calculate_rts_bk_overhead() + 0x20000; - uint64_t user_region_size = ROUND_TO_PAGE(rts_bk_overhead); + // 0x10000 due to the requirement from sgx-emm's min_block_size + uint64_t aligned_overhead = ROUND_TO(calculate_rts_bk_overhead(), 0x10000); + se_trace(SE_TRACE_DEBUG, "raw overhead: 0x%016llX\n", aligned_overhead); + + uint64_t units_of_block_size = aligned_overhead >> 16; + uint8_t reserve_cnt = 0; + while (units_of_block_size > 0) + { + ++reserve_cnt; + units_of_block_size >>= 1; + } + + if (reserve_cnt >= 30) + { + // There's a limit in emalloc.c that max_emalloc_size is 2^28 bytes. So when + // reservation count reaches 30, we reach that limit. + se_trace(SE_TRACE_ERROR, "Exceed RTS bookkeeping limit\n"); + return false; + } + + se_trace(SE_TRACE_DEBUG, "ema reservation time: %d\n", reserve_cnt); + + // The memory reservation implementation in sgx-emm emalloc.c works like this: + // The initial reserve size is 16 pages (0x10000 bytes) and will double the size + // each time a new reservation is needed. That is, we will have these reservation + // sizes: 0x100000B for the 1st reserve, 0x200000B for the 2nd, 0x40000B for the 3rd. + // Therefore, if our rts ema overhead needs one reservation, we need 0x10000B, if it + // needs two reservation, we need 0x10000+0x20000=0x30000B, if it needs three, we + // need 0x10000+0x20000+0x40000=0x70000. + // Therefore, if we scale down 0x10000, we will have this pattern: 1, 3, 7, 15, ... + // which can be described as 2 ^ (number of reservation time) - 1. + // The memory reservation in emalloc.c also reserve two guard pages around the target + // memory region in each reservation, so we need an extra 0x10000B each time. + // Therefore, the total overhead should be (2^reserve_cnt - 1 + reserve_cnt) * 0x10000B. + uint64_t user_region_size = ((1 << reserve_cnt) - 1 + reserve_cnt) << 16; se_trace(SE_TRACE_ERROR, "RTS bookkeeping overhead: 0x%016llX\n", user_region_size); if (m_create_param.user_region_size > 0) @@ -1195,6 +1232,8 @@ bool CMetadata::build_layout_table() uint64_t extra_overhead = (m_create_param.user_region_size >> 15); user_region_size += ROUND_TO_PAGE(extra_overhead); } + se_trace(SE_TRACE_ERROR, "Total user region size: 0x%016llX\n", user_region_size); + memset(&layout, 0, sizeof(layout)); layout.entry.id = LAYOUT_ID_USER_REGION; layout.entry.page_count = (uint32_t)(user_region_size >> SE_PAGE_SHIFT); diff --git a/sdk/simulation/tinst/deriv.h b/sdk/simulation/tinst/deriv.h index d38eeb69..21d0c2e9 100644 --- a/sdk/simulation/tinst/deriv.h +++ b/sdk/simulation/tinst/deriv.h @@ -47,36 +47,48 @@ typedef uint8_t se_owner_epoch_t[OWNEREPOCH_SIZE]; /* Derive data for seal key */ typedef struct { - uint16_t key_name; /* should always be 'SGX_KEYSELECT_SEAL' */ - sgx_attributes_t tmp_attr; - sgx_attributes_t attribute_mask; /* attribute mask from KEYREQUEST */ - se_owner_epoch_t csr_owner_epoch; - sgx_cpu_svn_t cpu_svn; /* CPUSVN from KEYREQUEST */ - sgx_isv_svn_t isv_svn; /* ISVSVN from KEYREQUEST */ - sgx_prod_id_t isv_prod_id; /* ISV PRODID from SECS */ - sgx_measurement_t mrenclave; - sgx_measurement_t mrsigner; - sgx_key_id_t key_id; /* KEYID from KEYREQUEST */ + uint16_t key_name; /* should always be 'SGX_KEYSELECT_SEAL' */ + uint16_t key_policy; /* Key policy from KEYREQUEST */ + sgx_attributes_t tmp_attr; + sgx_attributes_t attribute_mask; /* attribute mask from KEYREQUEST */ + sgx_misc_select_t tmp_misc; + sgx_misc_select_t misc_mask; /* MiscSelect mask form KEYREQUEST */ + se_owner_epoch_t csr_owner_epoch; + sgx_cpu_svn_t cpu_svn; /* CPUSVN from KEYREQUEST */ + sgx_isv_svn_t isv_svn; /* ISVSVN from KEYREQUEST */ + sgx_prod_id_t isv_prod_id; /* ISV PRODID from SECS */ + sgx_config_svn_t config_svn; /* CONFIGSVN from KEYREQUEST */ + sgx_config_id_t config_id; /* CONFIGID from SECS */ + sgx_isvfamily_id_t isv_family_id; /* ISV FAMILYID from SECS */ + sgx_isvext_prod_id_t isv_ext_prod_id; /* ISV EXTPRODID from SECS */ + sgx_measurement_t mrenclave; + sgx_measurement_t mrsigner; + sgx_key_id_t key_id; /* KEYID from KEYREQUEST */ } dd_seal_key_t; /* Derive data for report key */ typedef struct { uint16_t key_name; /* should always be 'SGX_KEYSELECT_REPORT' */ sgx_attributes_t attributes; /* attributes from SECS */ + sgx_misc_select_t misc_select; /* MiscSelect from SECS */ se_owner_epoch_t csr_owner_epoch; sgx_measurement_t mrenclave; sgx_cpu_svn_t cpu_svn; /* CPUSVN from CPUSVN register */ + sgx_config_svn_t config_svn; /* CONFIGSVN from SECS */ + sgx_config_id_t config_id; /* CONFIGID from SECS */ sgx_key_id_t key_id; /* KEYID from KEYREQUEST */ } dd_report_key_t; /* Derive data for license key */ typedef struct { uint16_t key_name; /* should always be 'SGX_KEYSELECT_EINITTOKEN' */ - sgx_attributes_t attributes; /* attributes from SECS */ + sgx_attributes_t tmp_attr; + sgx_misc_select_t tmp_misc; se_owner_epoch_t csr_owner_epoch; sgx_cpu_svn_t cpu_svn; /* CPUSVN from KEYREQUEST */ sgx_isv_svn_t isv_svn; /* ISVSVN from KEYREQUEST */ sgx_prod_id_t isv_prod_id; /* ISV PRODID from SECS */ + sgx_measurement_t mrsigner; sgx_key_id_t key_id; /* KEYID from KEYREQUEST */ } dd_license_key_t; @@ -85,25 +97,46 @@ typedef struct { uint16_t key_name; /* should always be 'SGX_KEYSELECT_PROVISION' */ sgx_attributes_t tmp_attr; sgx_attributes_t attribute_mask; /* attribute mask from KEYREQUEST */ + sgx_misc_select_t tmp_misc; + sgx_misc_select_t misc_mask; /* MiscSelect mask form KEYREQUEST */ sgx_cpu_svn_t cpu_svn; /* CPUSVN from KEYREQUEST */ sgx_isv_svn_t isv_svn; /* ISVSVN from KEYREQUEST */ sgx_prod_id_t isv_prod_id; /* ISV PRODID from SECS */ sgx_measurement_t mrsigner; } dd_provision_key_t; +/* Derive data for provision seal key */ +typedef struct { + uint16_t key_name; /* should always be 'SGX_KEYSELECT_SEAL' */ + uint16_t key_policy; /* Key policy from KEYREQUEST */ + sgx_attributes_t tmp_attr; + sgx_attributes_t attribute_mask; /* attribute mask from KEYREQUEST */ + sgx_misc_select_t tmp_misc; + sgx_misc_select_t misc_mask; /* MiscSelect mask form KEYREQUEST */ + sgx_cpu_svn_t cpu_svn; /* CPUSVN from KEYREQUEST */ + sgx_isv_svn_t isv_svn; /* ISVSVN from KEYREQUEST */ + sgx_prod_id_t isv_prod_id; /* ISV PRODID from SECS */ + sgx_config_svn_t config_svn; /* CONFIGSVN from KEYREQUEST */ + sgx_config_id_t config_id; /* CONFIGID from SECS */ + sgx_isvfamily_id_t isv_family_id; /* ISV FAMILYID from SECS */ + sgx_isvext_prod_id_t isv_ext_prod_id; /* ISV EXTPRODID from SECS */ + sgx_measurement_t mrsigner; +} dd_provision_seal_key_t; + /* The derivation data. */ typedef struct { int size; /* the size of derivation data */ union { /* key_name is the first field of all the following derivation data */ - uint16_t key_name; - uint8_t ddbuf[1]; + uint16_t key_name; + uint8_t ddbuf[1]; - dd_seal_key_t ddsk; - dd_report_key_t ddrk; - dd_license_key_t ddlk; - dd_provision_key_t ddpk; + dd_seal_key_t ddsk; + dd_report_key_t ddrk; + dd_license_key_t ddlk; + dd_provision_key_t ddpk; + dd_provision_seal_key_t ddpsk; }; } derivation_data_t; diff --git a/sdk/simulation/tinst/rts_sim.h b/sdk/simulation/tinst/rts_sim.h index 55c79b82..56d54ea7 100644 --- a/sdk/simulation/tinst/rts_sim.h +++ b/sdk/simulation/tinst/rts_sim.h @@ -59,6 +59,12 @@ const sgx_cpu_svn_t DOWNGRADED_CPUSVN = { } }; +// use secs->reserved4 field to save isv_family_id and isv_ext_prod_id. +typedef struct _isv_ext_id_t +{ + sgx_isvfamily_id_t isv_family_id; /* ISV assigned Family ID */ + sgx_isvext_prod_id_t isv_ext_prod_id; /* ISV assigned Extended Product ID */ +} isv_ext_id_t; typedef struct _global_data_sim_t { diff --git a/sdk/simulation/tinst/t_instructions.cpp b/sdk/simulation/tinst/t_instructions.cpp index 85846a12..71771c2c 100644 --- a/sdk/simulation/tinst/t_instructions.cpp +++ b/sdk/simulation/tinst/t_instructions.cpp @@ -87,6 +87,13 @@ static const se_owner_epoch_t SIMU_OWNER_EPOCH_MSR = { } \ } while(0) +#define check_config_svn(kr, secs) do { \ + if (kr->config_svn > secs->config_svn) { \ + return EGETKEY_INVALID_ISVSVN; \ + } \ +} while(0) + +#define KEY_POLICY_KSS (SGX_KEYPOLICY_CONFIGID | SGX_KEYPOLICY_ISVFAMILYID | SGX_KEYPOLICY_ISVEXTPRODID) // The hardware EGETKEY instruction will set ZF on failure. // @@ -112,7 +119,7 @@ static int _EGETKEY(sgx_key_request_t* kr, sgx_key_128bit_t okey) GP_ON(!sgx_is_within_enclave(okey, sizeof(sgx_key_128bit_t))); // check reserved bits are not set - GP_ON((kr->key_policy & ~(SGX_KEYPOLICY_MRENCLAVE | SGX_KEYPOLICY_MRSIGNER)) != 0); + GP_ON((kr->key_policy & ~(SGX_KEYPOLICY_MRENCLAVE | SGX_KEYPOLICY_MRSIGNER | KEY_POLICY_KSS | SGX_KEYPOLICY_NOISVPRODID)) != 0); // check to see if reserved space in KEYREQUEST are valid const uint8_t* u8ptr = (uint8_t *)(&(kr->reserved1)); @@ -124,7 +131,13 @@ static int _EGETKEY(sgx_key_request_t* kr, sgx_key_128bit_t okey) GP_ON(u8ptr[i] != (uint8_t)0); secs_t* cur_secs = g_global_data_sim.secs_ptr; + isv_ext_id_t* isv_ext_id = reinterpret_cast(cur_secs->reserved4); + + GP_ON(!(cur_secs->attributes.flags & SGX_FLAGS_KSS) && + ((kr->key_policy & (KEY_POLICY_KSS | SGX_KEYPOLICY_NOISVPRODID)) ||kr->config_svn > 0)); + sgx_attributes_t tmp_attr; + sgx_misc_select_t tmp_misc; derivation_data_t dd; memset(&dd, 0, sizeof(dd)); @@ -136,6 +149,8 @@ static int _EGETKEY(sgx_key_request_t* kr, sgx_key_128bit_t okey) tmp_attr.flags = kr->attribute_mask.flags | SGX_FLAGS_INITTED | SGX_FLAGS_DEBUG; tmp_attr.flags &= cur_secs->attributes.flags; tmp_attr.xfrm = kr->attribute_mask.xfrm & cur_secs->attributes.xfrm; + // Compute MISCSELECT fields to be included in the key. + tmp_misc = kr->misc_mask & cur_secs->misc_select; // HW supports CPUSVN to be set as 0. // To be consistent with HW behaviour, we replace the cpusvn as DEFAULT_CPUSVN if the input cpusvn is 0. if(!memcmp(&kr->cpu_svn, &dd.ddpk.cpu_svn, sizeof(sgx_cpu_svn_t))) @@ -146,10 +161,12 @@ static int _EGETKEY(sgx_key_request_t* kr, sgx_key_128bit_t okey) switch (kr->key_name) { case SGX_KEYSELECT_SEAL: check_isv_svn(kr, cur_secs); + check_config_svn(kr, cur_secs); check_cpu_svn(kr); // assemble derivation data dd.size = sizeof(dd_seal_key_t); + dd.ddsk.key_policy = kr->key_policy; if (kr->key_policy & SGX_KEYPOLICY_MRENCLAVE) { memcpy(&dd.ddsk.mrenclave, &cur_secs->mr_enclave, sizeof(sgx_measurement_t)); } @@ -158,12 +175,29 @@ static int _EGETKEY(sgx_key_request_t* kr, sgx_key_128bit_t okey) memcpy(&dd.ddsk.mrsigner, &cur_secs->mr_signer, sizeof(sgx_measurement_t)); } + if (kr->key_policy & SGX_KEYPOLICY_ISVFAMILYID) { + memcpy(&dd.ddsk.isv_family_id, &isv_ext_id->isv_family_id, sizeof(sgx_isvfamily_id_t)); + } + + if (kr->key_policy & SGX_KEYPOLICY_ISVEXTPRODID) { + memcpy(&dd.ddsk.isv_ext_prod_id, &isv_ext_id->isv_ext_prod_id, sizeof(sgx_isvext_prod_id_t)); + } + + if (kr->key_policy & SGX_KEYPOLICY_CONFIGID) { + dd.ddsk.config_svn = kr->config_svn; + memcpy(&dd.ddsk.config_id, &cur_secs->config_id, sizeof(sgx_config_id_t)); + } + memcpy(&dd.ddsk.tmp_attr, &tmp_attr, sizeof(sgx_attributes_t)); memcpy(&dd.ddsk.attribute_mask, &kr->attribute_mask, sizeof(sgx_attributes_t)); + dd.ddsk.tmp_misc = tmp_misc; + dd.ddsk.misc_mask = ~kr->misc_mask; memcpy(dd.ddsk.csr_owner_epoch, SIMU_OWNER_EPOCH_MSR, sizeof(se_owner_epoch_t)); memcpy(&dd.ddsk.cpu_svn,&kr->cpu_svn,sizeof(sgx_cpu_svn_t)); dd.ddsk.isv_svn = kr->isv_svn; - dd.ddsk.isv_prod_id = cur_secs->isv_prod_id; + if (!(kr->key_policy & SGX_KEYPOLICY_NOISVPRODID)) { + dd.ddsk.isv_prod_id = cur_secs->isv_prod_id; + } memcpy(&dd.ddsk.key_id, &kr->key_id, sizeof(sgx_key_id_t)); break; @@ -171,9 +205,12 @@ static int _EGETKEY(sgx_key_request_t* kr, sgx_key_128bit_t okey) // assemble derivation data dd.size = sizeof(dd_report_key_t); memcpy(&dd.ddrk.attributes, &cur_secs->attributes, sizeof(sgx_attributes_t)); + dd.ddrk.misc_select = cur_secs->misc_select; memcpy(dd.ddrk.csr_owner_epoch, SIMU_OWNER_EPOCH_MSR, sizeof(se_owner_epoch_t)); memcpy(&dd.ddrk.cpu_svn,&(g_global_data_sim.cpusvn_sim),sizeof(sgx_cpu_svn_t)); memcpy(&dd.ddrk.mrenclave, &cur_secs->mr_enclave, sizeof(sgx_measurement_t)); + dd.ddrk.config_svn = cur_secs->config_svn; + memcpy(&dd.ddrk.config_id, &cur_secs->config_id, sizeof(sgx_config_id_t)); memcpy(&dd.ddrk.key_id, &kr->key_id, sizeof(sgx_key_id_t)); break; @@ -184,16 +221,17 @@ static int _EGETKEY(sgx_key_request_t* kr, sgx_key_128bit_t okey) // assemble derivation data dd.size = sizeof(dd_license_key_t); - memcpy(&dd.ddlk.attributes, &cur_secs->attributes, sizeof(sgx_attributes_t)); + memcpy(&dd.ddlk.tmp_attr, &tmp_attr, sizeof(sgx_attributes_t)); + dd.ddlk.tmp_misc = tmp_misc; memcpy(dd.ddlk.csr_owner_epoch, SIMU_OWNER_EPOCH_MSR, sizeof(se_owner_epoch_t)); memcpy(&dd.ddlk.cpu_svn,&kr->cpu_svn,sizeof(sgx_cpu_svn_t)); dd.ddlk.isv_svn = kr->isv_svn; dd.ddlk.isv_prod_id = cur_secs->isv_prod_id; + memcpy(&dd.ddlk.mrsigner, &cur_secs->mr_signer, sizeof(sgx_measurement_t)); memcpy(&dd.ddlk.key_id, &kr->key_id, sizeof(sgx_key_id_t)); break; - case SGX_KEYSELECT_PROVISION: // Pass through. Only key_name differs. - case SGX_KEYSELECT_PROVISION_SEAL: + case SGX_KEYSELECT_PROVISION: check_attr_flag(cur_secs, SGX_FLAGS_PROVISION_KEY); check_isv_svn(kr, cur_secs); check_cpu_svn(kr); @@ -202,11 +240,46 @@ static int _EGETKEY(sgx_key_request_t* kr, sgx_key_128bit_t okey) dd.size = sizeof(dd_provision_key_t); memcpy(&dd.ddpk.tmp_attr, &tmp_attr, sizeof(sgx_attributes_t)); memcpy(&dd.ddpk.attribute_mask, &kr->attribute_mask, sizeof(sgx_attributes_t)); + dd.ddpk.tmp_misc = tmp_misc; + dd.ddpk.misc_mask = ~kr->misc_mask; memcpy(&dd.ddpk.cpu_svn,&kr->cpu_svn,sizeof(sgx_cpu_svn_t)); dd.ddpk.isv_svn = kr->isv_svn; dd.ddpk.isv_prod_id = cur_secs->isv_prod_id; memcpy(&dd.ddpk.mrsigner, &cur_secs->mr_signer, sizeof(sgx_measurement_t)); break; + case SGX_KEYSELECT_PROVISION_SEAL: + check_attr_flag(cur_secs, SGX_FLAGS_PROVISION_KEY); + check_isv_svn(kr, cur_secs); + check_config_svn(kr, cur_secs); + check_cpu_svn(kr); + + // assemble derivation data + dd.size = sizeof(dd_provision_seal_key_t); + dd.ddpsk.key_policy = kr->key_policy; + if (kr->key_policy & SGX_KEYPOLICY_ISVFAMILYID) { + memcpy(&dd.ddpsk.isv_family_id, &isv_ext_id->isv_family_id, sizeof(sgx_isvfamily_id_t)); + } + + if (kr->key_policy & SGX_KEYPOLICY_ISVEXTPRODID) { + memcpy(&dd.ddpsk.isv_ext_prod_id, &isv_ext_id->isv_ext_prod_id, sizeof(sgx_isvext_prod_id_t)); + } + + if (kr->key_policy & SGX_KEYPOLICY_CONFIGID) { + dd.ddpsk.config_svn = kr->config_svn; + memcpy(&dd.ddpsk.config_id, &cur_secs->config_id, sizeof(sgx_config_id_t)); + } + + memcpy(&dd.ddpsk.tmp_attr, &tmp_attr, sizeof(sgx_attributes_t)); + memcpy(&dd.ddpsk.attribute_mask, &kr->attribute_mask, sizeof(sgx_attributes_t)); + dd.ddpsk.tmp_misc = tmp_misc; + dd.ddpsk.misc_mask = ~kr->misc_mask; + memcpy(&dd.ddpsk.cpu_svn,&kr->cpu_svn,sizeof(sgx_cpu_svn_t)); + dd.ddpsk.isv_svn = kr->isv_svn; + if (!(kr->key_policy & SGX_KEYPOLICY_NOISVPRODID)) { + dd.ddpsk.isv_prod_id = cur_secs->isv_prod_id; + } + memcpy(&dd.ddpsk.mrsigner, &cur_secs->mr_signer, sizeof(sgx_measurement_t)); + break; default: return EGETKEY_INVALID_KEYNAME; @@ -241,13 +314,19 @@ static void _EREPORT(const sgx_target_info_t* ti, const sgx_report_data_t* rd, s GP_ON(!sgx_is_within_enclave(report, sizeof(sgx_report_t))); secs_t* cur_secs = g_global_data_sim.secs_ptr; + isv_ext_id_t* isv_ext_id = reinterpret_cast(cur_secs->reserved4); SE_DECLSPEC_ALIGN(REPORT_ALIGN_SIZE) sgx_report_t tmp_report; // assemble REPORT Data memset(&tmp_report, 0, sizeof(tmp_report)); memcpy(&tmp_report.body.cpu_svn,&(g_global_data_sim.cpusvn_sim),sizeof(sgx_cpu_svn_t)); + tmp_report.body.misc_select = cur_secs->misc_select; tmp_report.body.isv_prod_id = cur_secs->isv_prod_id; tmp_report.body.isv_svn = cur_secs->isv_svn; + tmp_report.body.config_svn = cur_secs->config_svn; + memcpy(&tmp_report.body.isv_family_id, &isv_ext_id->isv_family_id, sizeof(sgx_isvfamily_id_t)); + memcpy(&tmp_report.body.isv_ext_prod_id, &isv_ext_id->isv_ext_prod_id, sizeof(sgx_isvext_prod_id_t)); + memcpy(&tmp_report.body.config_id, &cur_secs->config_id, sizeof(sgx_config_id_t)); memcpy(&tmp_report.body.attributes, &cur_secs->attributes, sizeof(sgx_attributes_t)); memcpy(&tmp_report.body.report_data, rd, sizeof(sgx_report_data_t)); memcpy(&tmp_report.body.mr_enclave, &cur_secs->mr_enclave, sizeof(sgx_measurement_t)); @@ -265,6 +344,9 @@ static void _EREPORT(const sgx_target_info_t* ti, const sgx_report_data_t* rd, s memcpy(dd.ddrk.csr_owner_epoch, SIMU_OWNER_EPOCH_MSR, sizeof(se_owner_epoch_t)); memcpy(&dd.ddrk.cpu_svn,&(g_global_data_sim.cpusvn_sim),sizeof(sgx_cpu_svn_t)); memcpy(&dd.ddrk.key_id, &tmp_report.key_id, sizeof(sgx_key_id_t)); + memcpy(&dd.ddrk.config_id, &ti->config_id, sizeof(sgx_config_id_t)); + dd.ddrk.config_svn = ti->config_svn; + dd.ddrk.misc_select = ti->misc_select; // calculate the derived key sgx_key_128bit_t tmp_report_key; diff --git a/sdk/simulation/uinst/Makefile b/sdk/simulation/uinst/Makefile index 5895bcbd..45bb3fec 100644 --- a/sdk/simulation/uinst/Makefile +++ b/sdk/simulation/uinst/Makefile @@ -43,6 +43,7 @@ CPPFLAGS += -I$(COMMON_DIR)/inc/ \ -I$(COMMON_DIR)/inc/internal \ -I$(SIM_DIR)/assembly/ \ -I$(SIM_DIR)/assembly/linux \ + -I$(SIM_DIR)/tinst/ \ -I$(LINUX_PSW_DIR)/urts \ -I$(LINUX_PSW_DIR)/urts/linux diff --git a/sdk/simulation/uinst/u_instructions.cpp b/sdk/simulation/uinst/u_instructions.cpp index 72e7add7..26e5fa43 100644 --- a/sdk/simulation/uinst/u_instructions.cpp +++ b/sdk/simulation/uinst/u_instructions.cpp @@ -52,6 +52,7 @@ #include "sgxsim.h" #include "enclave_mngr.h" #include "u_instructions.h" +#include "rts_sim.h" #include "crypto_wrapper.h" @@ -277,10 +278,24 @@ uintptr_t _EINIT(secs_t* secs, enclave_css_t *css, token_t *launch) return SGX_ERROR_INVALID_ATTRIBUTE; } + // From SDM, ISVFAMILYID and ISVEXTPRODID are both included in the secs->reserved4 + isv_ext_id_t* isv_ext_id = reinterpret_cast(this_secs->reserved4); + if (!(this_secs->attributes.flags & SGX_FLAGS_KSS)) + { + const uint8_t* u8ptr = (uint8_t *)(&(css->body.isv_family_id)); + for (unsigned i = 0; i < sizeof(css->body.isv_family_id); ++i) + if (u8ptr[i] != (uint8_t)0) return SGX_ERROR_INVALID_SIGNATURE; + + u8ptr = (uint8_t *)(&(css->body.isvext_prod_id)); + for (unsigned i = 0; i < sizeof(css->body.isvext_prod_id); ++i) + if (u8ptr[i] != (uint8_t)0) return SGX_ERROR_INVALID_SIGNATURE; + } + mcp_same_size(&this_secs->mr_enclave, &css->body.enclave_hash, sizeof(sgx_measurement_t)); this_secs->isv_prod_id = css->body.isv_prod_id; this_secs->isv_svn = css->body.isv_svn; - + mcp_same_size(&isv_ext_id->isv_family_id, &css->body.isv_family_id, sizeof(sgx_isvfamily_id_t)); + mcp_same_size(&isv_ext_id->isv_ext_prod_id, &css->body.isvext_prod_id, sizeof(sgx_isvext_prod_id_t)); uint8_t signer[SGX_HASH_SIZE] = {0}; unsigned int signer_len = SGX_HASH_SIZE; sgx_status_t ret = sgx_EVP_Digest(EVP_sha256(), css->key.modulus, SE_KEY_SIZE, signer, &signer_len); @@ -324,6 +339,13 @@ uintptr_t _ECREATE(page_info_t* pi) // Enclave size must be at least 2 pages and a power of 2. GP_ON(!is_power_of_two((size_t)secs->size)); GP_ON(secs->size < (SE_PAGE_SIZE << 1)); + if(!(secs->attributes.flags & SGX_FLAGS_KSS)) + { + GP_ON(secs->config_svn != 0); + const uint8_t* u8ptr = (uint8_t *)(&(secs->config_id)); + for (unsigned i = 0; i < sizeof(secs->config_id); ++i) + GP_ON(u8ptr[i] != (uint8_t)0); + } CEnclaveSim* ce = new CEnclaveSim(secs); void* addr; diff --git a/sdk/simulation/urtssim/linux/Makefile b/sdk/simulation/urtssim/linux/Makefile index 51101f49..d9a43450 100644 --- a/sdk/simulation/urtssim/linux/Makefile +++ b/sdk/simulation/urtssim/linux/Makefile @@ -31,6 +31,8 @@ include ../../../../buildenv.mk +URTS_VER:= $(shell awk '$$2 ~ /URTS_VERSION/ { print substr($$3, 2, length($$3) - 2); }' $(COMMON_DIR)/inc/internal/se_version.h) + SIM_DIR := $(LINUX_SDK_DIR)/simulation VTUNE_DIR = $(LINUX_EXTERNAL_DIR)/vtune/linux @@ -180,7 +182,7 @@ ittnotify: CFLAGS= CXXFLAGS= $(MAKE) -C $(VTUNE_DIR)/sdk/src/ittnotify/ $(LIBURTS_DEPLOY):../urts_deploy.c - $(CC) -I$(COMMON_DIR)/inc $(CET_FLAGS) -shared -fPIC -Wl,-soname=libsgx_urts.so $< -o $@ + $(CC) -I$(COMMON_DIR)/inc $(CET_FLAGS) -shared -fPIC -Wl,-soname=libsgx_urts.so.$(call SPLIT_VERSION,$(URTS_VER),1) $< -o $@ .PHONY: clean clean:: diff --git a/sdk/switchless/sgx_uswitchless/sl_urts_loader_untrusted.cpp b/sdk/switchless/sgx_uswitchless/sl_urts_loader_untrusted.cpp index 01110428..7739078e 100644 --- a/sdk/switchless/sgx_uswitchless/sl_urts_loader_untrusted.cpp +++ b/sdk/switchless/sgx_uswitchless/sl_urts_loader_untrusted.cpp @@ -1,3 +1,34 @@ +/* + * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + #include "sl_urts_loader.h" #include "uswitchless.h" #include "sgx_switchless_itf.h" diff --git a/sdk/tlibc/gen/spinlock.c b/sdk/tlibc/gen/spinlock.c index b0bc4084..a856bca9 100644 --- a/sdk/tlibc/gen/spinlock.c +++ b/sdk/tlibc/gen/spinlock.c @@ -58,15 +58,23 @@ static inline int _InterlockedExchange(int volatile * dst, int val) } +#define MIN_BACKOFF 2 +#define MAX_BACKOFF 1024 uint32_t sgx_spin_lock(sgx_spinlock_t *lock) { while(_InterlockedExchange((volatile int *)lock, 1) != 0) { - while (*lock) { - /* tell cpu we are spinning */ - _mm_pause(); - } + int b = MIN_BACKOFF; + do + { /* tell cpu we are spinning */ + for (int i=0; i < b; i++) { + _mm_pause(); + } + b <<= 1; + if (b > MAX_BACKOFF) { + b = MAX_BACKOFF; + } + } while (*lock); } - return (0); } diff --git a/sdk/tlibc/string/memcpy.c b/sdk/tlibc/string/memcpy.c index f7d8bbc5..af8fc02b 100644 --- a/sdk/tlibc/string/memcpy.c +++ b/sdk/tlibc/string/memcpy.c @@ -110,12 +110,13 @@ void* memcpy_verw(void *dst0, const void *src0, size_t len) } while (len >= 8) { - if((unsigned long long)dst%8 == 0) { + if(((unsigned long long)dst%8 == 0) && ((unsigned long long)src%8 == 0)) { // 8-byte-aligned - don't need bracketing - __memcpy_8a(dst, src); - src += 8; - dst += 8; - len -= 8; + size_t len0 = len - len%8; + memcpy_nochecks(dst, src, len0); + src += len0; + dst += len0; + len -= len0; } else{ // not 8-byte-aligned - need bracketing @@ -127,9 +128,9 @@ void* memcpy_verw(void *dst0, const void *src0, size_t len) } // less than 8 bytes left - need bracketing for (unsigned i = 0; i < len; i++) { - __memcpy_verw(dst, src); - src++; - dst++; + __memcpy_verw(dst, src); + src++; + dst++; } return dst0; } @@ -149,27 +150,35 @@ memcpy_nochecks(void *dst0, const void *src0, size_t length) static void copy_external_memory(void* dst, const void* src, size_t count, bool is_dst_external) { - unsigned char tmp_buf[16]={0}; + char tmp_buf[16]={0}; unsigned int off_src = (unsigned long long)src%8; + char* src_buf = NULL; if(count == 0) { return; } - - //if src is 8-byte-aligned, copy 8 bytes from outside the enclave to the buffer - //if src is not 8-byte-aligned and off_src + count > 8, copy 16 bytes from outside the enclave to the buffer - __memcpy_8a(tmp_buf, src - off_src); - if(off_src != 0 && off_src + count > 8) + //if external src is not 8-byte-aligned or count != 8 + if(off_src != 0 || count != 8) { - __memcpy_8a(tmp_buf + 8, src - off_src + 8); - } - if(is_dst_external) - { - memcpy_verw(dst, tmp_buf + off_src, count); + //if external src is not 8-byte-aligned, need to copy from src-off_src to a tmp_buf inside the enclave + __memcpy_8a(tmp_buf, src - off_src); + if(off_src != 0 && off_src + count > 8) + { + __memcpy_8a(tmp_buf + 8, src - off_src + 8); + } + src_buf = tmp_buf + off_src; } else { - memcpy_nochecks(dst, tmp_buf + off_src, count); + src_buf = (char*)src; + } + if(is_dst_external) + { + memcpy_verw(dst, src_buf, count); + } + else + { + memcpy_nochecks(dst, src_buf, count); } return; } @@ -199,16 +208,28 @@ memcpy(void *dst0, const void *src0, size_t length) } //src is outside the enclave - unsigned int len = 0; + size_t len = 0; char* dst = dst0; const char *src = (const char *)src0; while(length >= 8) { - len = 8 - (unsigned long long)dst%8; - copy_external_memory(dst, src, len, is_dst_external); - src += len; - dst += len; - length -= len; + //if dst and src are both 8-byte-aligned, direct call memcpy_nochecks + if(((unsigned long long)dst%8 == 0) && ((unsigned long long)src%8 == 0)) + { + len = length - length%8; + memcpy_nochecks(dst, src, len); + src += len; + dst += len; + length -= len; + } + else + { + len = 8 - (unsigned long long)dst%8; + copy_external_memory(dst, src, len, is_dst_external); + src += len; + dst += len; + length -= len; + } } //less than 8 bytes left copy_external_memory(dst, src, length, is_dst_external); diff --git a/sdk/tlibthread/sethread_spinlock.cpp b/sdk/tlibthread/sethread_spinlock.cpp index 37358f8b..8edab9e6 100644 --- a/sdk/tlibthread/sethread_spinlock.cpp +++ b/sdk/tlibthread/sethread_spinlock.cpp @@ -37,6 +37,7 @@ #include "util.h" #include "sethread_internal.h" #include "sethread_spinlock.h" + int sgx_thread_spin_init(sgx_thread_spinlock_t *mutex) { CHECK_PARAMETER(mutex); diff --git a/sdk/trts/init_enclave.cpp b/sdk/trts/init_enclave.cpp index c6bea9b4..4297e858 100644 --- a/sdk/trts/init_enclave.cpp +++ b/sdk/trts/init_enclave.cpp @@ -62,7 +62,9 @@ uint64_t g_enclave_size __attribute__((section(RELRO_SECTION_NAME))) = 0; const volatile global_data_t g_global_data __attribute__((section(".niprod"))) = {VERSION_UINT, 1, 2, 3, 4, 5, 6, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0}, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, {{{0, 0, 0, 0, 0, 0, 0}}}, 0, 0, 0}; +// Make sure to access this with atomics or the {get,set}_enclave_state assembly wrappers. uint32_t g_enclave_state __attribute__((section(".nipd"))) = ENCLAVE_INIT_NOT_STARTED; + uint32_t g_cpu_core_num __attribute__((section(RELRO_SECTION_NAME))) = 0; extern "C" { @@ -267,7 +269,7 @@ sgx_status_t do_init_enclave(void *ms, void *tcs) } #endif - g_enclave_state = ENCLAVE_INIT_DONE; + set_enclave_state(ENCLAVE_INIT_DONE); #ifndef SE_SIM // EDMM initialization makes ocalls which requires ENCLAVE_INIT_DONE being set diff --git a/sdk/trts/init_optimized_lib.cpp b/sdk/trts/init_optimized_lib.cpp index 1c878b5c..18a54ec2 100644 --- a/sdk/trts/init_optimized_lib.cpp +++ b/sdk/trts/init_optimized_lib.cpp @@ -36,6 +36,7 @@ #include "sgx_trts.h" #include "sgx_attributes.h" #include "global_data.h" +#include "trts_internal.h" extern "C" int sgx_init_string_lib(uint64_t cpu_feature_indicator); extern "C" sgx_status_t sgx_init_crypto_lib(uint64_t cpu_feature_indicator, uint32_t *cpuinfo_table); @@ -94,7 +95,7 @@ static int set_global_feature_indicator(uint64_t feature_bit_array, uint64_t xfr extern "C" int init_optimized_libs(const uint64_t feature_bit_array, uint32_t *cpuinfo_table, uint64_t xfrm) { - if (g_enclave_state != ENCLAVE_INIT_IN_PROGRESS) + if (get_enclave_state() != ENCLAVE_INIT_IN_PROGRESS) { return -1; } diff --git a/sdk/trts/trts_emm_sim.cpp b/sdk/trts/trts_emm_sim.cpp index 92cb49b7..d47e7fc8 100644 --- a/sdk/trts/trts_emm_sim.cpp +++ b/sdk/trts/trts_emm_sim.cpp @@ -45,3 +45,11 @@ int mm_uncommit(void* addr, size_t size) UNUSED(size); return 0; } + +int mm_modify_permissions(void* addr, size_t size, int prot) +{ + UNUSED(addr); + UNUSED(size); + UNUSED(prot); + return 0; +} diff --git a/sdk/trts/trts_veh.cpp b/sdk/trts/trts_veh.cpp index f26e3884..2d860caa 100644 --- a/sdk/trts/trts_veh.cpp +++ b/sdk/trts/trts_veh.cpp @@ -351,7 +351,7 @@ extern "C" sgx_status_t trts_handle_exception(void *tcs) sp_u = ssa_gpr->REG(sp_u); if (!sgx_is_outside_enclave((void *)sp_u, sizeof(sp_u))) { - g_enclave_state = ENCLAVE_CRASHED; + set_enclave_state(ENCLAVE_CRASHED); return SGX_ERROR_STACK_OVERRUN; } @@ -360,13 +360,13 @@ extern "C" sgx_status_t trts_handle_exception(void *tcs) sp = ssa_gpr->REG(sp); if (sp_u == sp) { - g_enclave_state = ENCLAVE_CRASHED; + set_enclave_state(ENCLAVE_CRASHED); return SGX_ERROR_STACK_OVERRUN; } if(!is_stack_addr((void*)sp, 0)) // check stack overrun only, alignment will be checked after exception handled { - g_enclave_state = ENCLAVE_CRASHED; + set_enclave_state(ENCLAVE_CRASHED); return SGX_ERROR_STACK_OVERRUN; } @@ -383,7 +383,7 @@ extern "C" sgx_status_t trts_handle_exception(void *tcs) // check the decreased sp to make sure it is in the trusted stack range if(!is_stack_addr((void *)sp, size)) { - g_enclave_state = ENCLAVE_CRASHED; + set_enclave_state(ENCLAVE_CRASHED); return SGX_ERROR_STACK_OVERRUN; } @@ -393,7 +393,7 @@ extern "C" sgx_status_t trts_handle_exception(void *tcs) sp -= size; if(!is_stack_addr((void *)sp, size)) { - g_enclave_state = ENCLAVE_CRASHED; + set_enclave_state(ENCLAVE_CRASHED); return SGX_ERROR_STACK_OVERRUN; } @@ -416,7 +416,7 @@ extern "C" sgx_status_t trts_handle_exception(void *tcs) } else { - g_enclave_state = ENCLAVE_CRASHED; + set_enclave_state(ENCLAVE_CRASHED); return SGX_ERROR_STACK_OVERRUN; } } @@ -486,6 +486,6 @@ extern "C" sgx_status_t trts_handle_exception(void *tcs) return SGX_SUCCESS; default_handler: - g_enclave_state = ENCLAVE_CRASHED; + set_enclave_state(ENCLAVE_CRASHED); return SGX_ERROR_ENCLAVE_CRASHED; }