You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by di...@apache.org on 2019/12/17 05:49:36 UTC

[incubator-teaclave-sgx-sdk] branch master updated: v1.1.0

This is an automated email from the ASF dual-hosted git repository.

dingyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-sgx-sdk.git


The following commit(s) were added to refs/heads/master by this push:
     new e08dff2  v1.1.0
e08dff2 is described below

commit e08dff20783232f4f872838cbac62f86946bef3c
Author: Yu Ding <di...@gmail.com>
AuthorDate: Mon Dec 16 21:48:53 2019 -0800

    v1.1.0
---
 LICENSE                                            |  846 +++-------
 Readme.md                                          |   32 +-
 buildenv.mk                                        |   40 +-
 common/inc/assert.h                                |    4 +-
 common/inc/complex.h                               |   14 +-
 common/inc/ctype.h                                 |    2 +-
 common/inc/dirent.h                                |   12 +-
 common/inc/endian.h                                |    2 +-
 common/inc/errno.h                                 |    6 +-
 common/inc/float.h                                 |    4 +-
 common/inc/iso646.h                                |    4 +-
 common/inc/limits.h                                |    6 +-
 common/inc/math.h                                  |    4 +-
 common/inc/mbusafecrt.h                            |    4 +-
 common/inc/netdb.h                                 |   37 +
 common/inc/poll.h                                  |    6 +-
 common/inc/pthread.h                               |   34 +
 common/inc/{sys/struct_timespec.h => pwd.h}        |   23 +-
 common/inc/setjmp.h                                |    4 +-
 common/inc/stdarg.h                                |    6 +-
 common/inc/stdbool.h                               |    2 +-
 common/inc/stddef.h                                |    6 +-
 common/inc/stdint.h                                |    4 +-
 common/inc/stdio.h                                 |    6 +-
 common/inc/stdlib.h                                |    6 +-
 common/inc/string.h                                |    6 +-
 common/inc/sys/_types.h                            |   40 +-
 common/inc/sys/cdefs.h                             |   14 +-
 common/inc/sys/endian.h                            |    2 +-
 common/inc/sys/epoll.h                             |   18 +-
 common/inc/sys/ieee.h                              |   20 +-
 common/inc/sys/sockaddr.h                          |    8 +-
 common/inc/sys/socket.h                            |   22 +-
 common/inc/sys/stat.h                              |  184 +--
 common/inc/sys/stdint.h                            |    2 +-
 common/inc/sys/struct_timespec.h                   |    4 +-
 common/inc/sys/types.h                             |    6 +-
 common/inc/sys/uio.h                               |    6 +-
 common/inc/time.h                                  |    6 +-
 common/inc/unistd.h                                |    6 +-
 common/inc/wchar.h                                 |    4 +-
 common/inc/wctype.h                                |    6 +-
 compiler-rt/Makefile                               |   40 +-
 dockerfile/Dockerfile.1604.nightly                 |   48 +-
 dockerfile/Dockerfile.1604.stable                  |   75 -
 dockerfile/Dockerfile.1804.nightly                 |   50 +-
 dockerfile/Dockerfile.1804.stable                  |   80 -
 dockerfile/Dockerfile.centos7.nightly              |   50 +-
 dockerfile/Dockerfile.fedora27.nightly             |   50 +-
 documents/sgx_in_mesalock_linux.md                 |    2 +-
 edl/inc/dirent.h                                   |   41 +-
 edl/inc/stat.h                                     |   43 +-
 edl/sgx_asyncio.edl                                |   48 +-
 edl/sgx_backtrace.edl                              |   50 +-
 edl/sgx_env.edl                                    |   56 +-
 edl/sgx_fd.edl                                     |   50 +-
 edl/sgx_file.edl                                   |   52 +-
 edl/sgx_fs.edl                                     |   48 +-
 edl/sgx_mem.edl                                    |   50 +-
 edl/sgx_net.edl                                    |   55 +-
 edl/sgx_net_switchless.edl                         |   48 +-
 edl/sgx_pipe.edl                                   |   50 +-
 edl/sgx_socket.edl                                 |   48 +-
 edl/sgx_stdio.edl                                  |   52 +-
 edl/sgx_sys.edl                                    |   51 +-
 edl/sgx_thread.edl                                 |   33 +
 edl/sgx_time.edl                                   |   50 +-
 edl/sgx_tstd.edl                                   |   54 +-
 licenses/LICENSE-common-inc.txt                    |  209 +++
 licenses/LICENSE-compiler_rt.txt                   |   92 ++
 licenses/LICENSE-samplecode-app.txt                |   28 +
 licenses/LICENSE-samplecode-remoteattestation.txt  |   21 +
 release_notes.md                                   |   16 +
 rust-toolchain                                     |    2 +-
 samplecode/backtrace/Makefile                      |   39 +-
 samplecode/backtrace/app/app.c                     |   94 +-
 samplecode/backtrace/app/app.h                     |   40 +-
 samplecode/backtrace/enclave/Cargo.toml            |   10 +-
 samplecode/backtrace/enclave/Enclave.edl           |   46 +-
 samplecode/backtrace/enclave/Makefile              |   40 +-
 samplecode/backtrace/enclave/Xargo.toml            |   38 +-
 samplecode/backtrace/enclave/src/lib.rs            |   39 +-
 samplecode/crypto/Makefile                         |   40 +-
 samplecode/crypto/app/app.c                        |   94 +-
 samplecode/crypto/app/app.h                        |   40 +-
 samplecode/crypto/enclave/Cargo.toml               |   12 +-
 samplecode/crypto/enclave/Enclave.edl              |   46 +-
 samplecode/crypto/enclave/Makefile                 |   39 +-
 samplecode/crypto/enclave/Xargo.toml               |   38 +-
 samplecode/crypto/enclave/src/lib.rs               |   39 +-
 samplecode/db-proxy/db-client/Cargo.toml           |    2 +-
 samplecode/db-proxy/db-proxy/Makefile              |   40 +-
 samplecode/db-proxy/db-proxy/app/Cargo.toml        |    9 +-
 samplecode/db-proxy/db-proxy/app/build.rs          |   39 +-
 samplecode/db-proxy/db-proxy/app/src/main.rs       |  144 +-
 samplecode/db-proxy/db-proxy/enclave/Cargo.toml    |    8 +-
 samplecode/db-proxy/db-proxy/enclave/Enclave.edl   |   46 +-
 samplecode/db-proxy/db-proxy/enclave/Makefile      |   40 +-
 samplecode/db-proxy/db-proxy/enclave/Xargo.toml    |   34 +-
 samplecode/db-proxy/db-proxy/enclave/src/lib.rs    |   39 +-
 samplecode/db-proxy/db-server/Cargo.toml           |    4 +-
 samplecode/file/Makefile                           |   39 +-
 samplecode/file/app/app.c                          |   96 +-
 samplecode/file/app/app.h                          |   40 +-
 samplecode/file/enclave/Cargo.toml                 |   14 +-
 samplecode/file/enclave/Enclave.edl                |   46 +-
 samplecode/file/enclave/Makefile                   |   39 +-
 samplecode/file/enclave/Xargo.toml                 |   38 +-
 samplecode/file/enclave/src/lib.rs                 |   39 +-
 samplecode/hello-regex/Makefile                    |   40 +-
 samplecode/hello-regex/app/app.c                   |   94 +-
 samplecode/hello-regex/app/app.h                   |   40 +-
 samplecode/hello-regex/enclave/Cargo.toml          |    8 +-
 samplecode/hello-regex/enclave/Enclave.edl         |   46 +-
 samplecode/hello-regex/enclave/Makefile            |   40 +-
 samplecode/hello-regex/enclave/Xargo.toml          |   38 +-
 samplecode/hello-regex/enclave/src/lib.rs          |   39 +-
 samplecode/hello-rust-vscode-debug/Cargo.toml      |    2 +-
 samplecode/hello-rust-vscode-debug/Makefile        |   40 +-
 samplecode/hello-rust-vscode-debug/app/Cargo.toml  |    9 +-
 samplecode/hello-rust-vscode-debug/app/build.rs    |   39 +-
 samplecode/hello-rust-vscode-debug/app/src/main.rs |  110 +-
 .../hello-rust-vscode-debug/enclave/Cargo.toml     |    8 +-
 .../hello-rust-vscode-debug/enclave/Enclave.edl    |   46 +-
 .../hello-rust-vscode-debug/enclave/Makefile       |   40 +-
 .../hello-rust-vscode-debug/enclave/Xargo.toml     |   38 +-
 .../hello-rust-vscode-debug/enclave/src/lib.rs     |   39 +-
 samplecode/hello-rust/Makefile                     |   40 +-
 samplecode/hello-rust/app/Cargo.toml               |    9 +-
 samplecode/hello-rust/app/build.rs                 |   39 +-
 samplecode/hello-rust/app/src/main.rs              |  116 +-
 samplecode/hello-rust/enclave/Cargo.toml           |    9 +-
 samplecode/hello-rust/enclave/Enclave.edl          |   46 +-
 samplecode/hello-rust/enclave/Makefile             |   40 +-
 samplecode/hello-rust/enclave/Xargo.toml           |   39 +-
 samplecode/hello-rust/enclave/src/lib.rs           |  105 +-
 samplecode/helloworld/Makefile                     |   40 +-
 samplecode/helloworld/app/app.c                    |   94 +-
 samplecode/helloworld/app/app.h                    |   40 +-
 samplecode/helloworld/enclave/Cargo.toml           |    8 +-
 samplecode/helloworld/enclave/Enclave.edl          |   46 +-
 samplecode/helloworld/enclave/Makefile             |   40 +-
 samplecode/helloworld/enclave/Xargo.toml           |   38 +-
 samplecode/helloworld/enclave/src/lib.rs           |   39 +-
 samplecode/http_req/README.md                      |    2 +-
 samplecode/http_req/app/Cargo.toml                 |    9 +-
 samplecode/http_req/app/build.rs                   |   39 +-
 samplecode/http_req/app/src/main.rs                |  118 +-
 samplecode/http_req/enclave/Cargo.toml             |    8 +-
 samplecode/http_req/enclave/Enclave.edl            |   46 +-
 samplecode/http_req/enclave/Makefile               |   40 +-
 samplecode/http_req/enclave/Xargo.toml             |   38 +-
 samplecode/http_req/enclave/src/lib.rs             |   39 +-
 samplecode/hugemem/Makefile                        |   40 +-
 samplecode/hugemem/app/app.c                       |   94 +-
 samplecode/hugemem/app/app.h                       |   40 +-
 samplecode/hugemem/enclave/Cargo.toml              |    8 +-
 samplecode/hugemem/enclave/Enclave.edl             |   46 +-
 samplecode/hugemem/enclave/Makefile                |   40 +-
 samplecode/hugemem/enclave/Xargo.toml              |   38 +-
 samplecode/hugemem/enclave/src/lib.rs              |   39 +-
 samplecode/kvdb-memdb/Makefile                     |   40 +-
 samplecode/kvdb-memdb/app/Cargo.toml               |    9 +-
 samplecode/kvdb-memdb/app/build.rs                 |   39 +-
 samplecode/kvdb-memdb/app/src/main.rs              |  111 +-
 samplecode/kvdb-memdb/enclave/Cargo.toml           |    8 +-
 samplecode/kvdb-memdb/enclave/Enclave.edl          |   46 +-
 samplecode/kvdb-memdb/enclave/Makefile             |   40 +-
 samplecode/kvdb-memdb/enclave/Xargo.toml           |   38 +-
 samplecode/kvdb-memdb/enclave/src/lib.rs           |   39 +-
 samplecode/localattestation/Makefile               |   39 +-
 samplecode/localattestation/app/App.cpp            |   39 +-
 .../app/UntrustedEnclaveMessageExchange.cpp        |   39 +-
 .../app/UntrustedEnclaveMessageExchange.h          |   39 +-
 samplecode/localattestation/app/error_codes.h      |   39 +-
 samplecode/localattestation/attestation/Cargo.toml |   12 +-
 samplecode/localattestation/attestation/Xargo.toml |   38 +-
 .../localattestation/attestation/attestation.edl   |   46 +-
 samplecode/localattestation/attestation/src/err.rs |   39 +-
 .../localattestation/attestation/src/func.rs       |   47 +-
 samplecode/localattestation/attestation/src/lib.rs |   39 +-
 .../localattestation/attestation/src/types.rs      |   41 +-
 samplecode/localattestation/enclave1/Cargo.toml    |    6 +-
 samplecode/localattestation/enclave1/Enclave1.edl  |   46 +-
 samplecode/localattestation/enclave1/Makefile      |   39 +-
 samplecode/localattestation/enclave1/Xargo.toml    |   38 +-
 samplecode/localattestation/enclave1/src/lib.rs    |   39 +-
 samplecode/localattestation/enclave2/Cargo.toml    |    6 +-
 samplecode/localattestation/enclave2/Enclave2.edl  |   46 +-
 samplecode/localattestation/enclave2/Makefile      |   39 +-
 samplecode/localattestation/enclave2/Xargo.toml    |   38 +-
 samplecode/localattestation/enclave2/src/lib.rs    |   39 +-
 samplecode/localattestation/enclave3/Cargo.toml    |    6 +-
 samplecode/localattestation/enclave3/Enclave3.edl  |   46 +-
 samplecode/localattestation/enclave3/Makefile      |   39 +-
 samplecode/localattestation/enclave3/Xargo.toml    |   38 +-
 samplecode/localattestation/enclave3/src/lib.rs    |   39 +-
 samplecode/logger/Makefile                         |   40 +-
 samplecode/logger/app/Cargo.toml                   |    9 +-
 samplecode/logger/app/build.rs                     |   39 +-
 samplecode/logger/app/src/main.rs                  |  111 +-
 samplecode/logger/enclave/Cargo.toml               |    8 +-
 samplecode/logger/enclave/Enclave.edl              |   46 +-
 samplecode/logger/enclave/Makefile                 |   40 +-
 samplecode/logger/enclave/Xargo.toml               |   38 +-
 samplecode/logger/enclave/src/lib.rs               |   39 +-
 samplecode/machine-learning/Makefile               |   40 +-
 samplecode/machine-learning/app/Cargo.toml         |    9 +-
 samplecode/machine-learning/app/build.rs           |   39 +-
 samplecode/machine-learning/app/src/main.rs        |  111 +-
 samplecode/machine-learning/enclave/Cargo.toml     |   10 +-
 samplecode/machine-learning/enclave/Enclave.edl    |   46 +-
 samplecode/machine-learning/enclave/Makefile       |   40 +-
 samplecode/machine-learning/enclave/Xargo.toml     |   38 +-
 samplecode/machine-learning/enclave/src/lib.rs     |   39 +-
 samplecode/mio/client/Makefile                     |   40 +-
 samplecode/mio/client/app/Cargo.toml               |    9 +-
 samplecode/mio/client/app/build.rs                 |   39 +-
 samplecode/mio/client/app/src/main.rs              |  111 +-
 samplecode/mio/client/enclave/Cargo.toml           |    8 +-
 samplecode/mio/client/enclave/Enclave.edl          |   46 +-
 samplecode/mio/client/enclave/Makefile             |   40 +-
 samplecode/mio/client/enclave/Xargo.toml           |   38 +-
 samplecode/mio/client/enclave/src/lib.rs           |   39 +-
 samplecode/mio/server/Makefile                     |   40 +-
 samplecode/mio/server/app/Cargo.toml               |    9 +-
 samplecode/mio/server/app/build.rs                 |   39 +-
 samplecode/mio/server/app/src/main.rs              |  110 +-
 samplecode/mio/server/enclave/Cargo.toml           |   10 +-
 samplecode/mio/server/enclave/Enclave.edl          |   46 +-
 samplecode/mio/server/enclave/Makefile             |   40 +-
 samplecode/mio/server/enclave/Xargo.toml           |   38 +-
 samplecode/mio/server/enclave/src/lib.rs           |   39 +-
 samplecode/mutual-ra/Makefile                      |   40 +-
 samplecode/mutual-ra/app/Cargo.toml                |    9 +-
 samplecode/mutual-ra/app/build.rs                  |   39 +-
 samplecode/mutual-ra/app/src/main.rs               |  109 +-
 samplecode/mutual-ra/enclave/Cargo.toml            |   16 +-
 samplecode/mutual-ra/enclave/Enclave.edl           |   46 +-
 samplecode/mutual-ra/enclave/Makefile              |   40 +-
 samplecode/mutual-ra/enclave/Xargo.toml            |   38 +-
 samplecode/mutual-ra/enclave/src/lib.rs            |   39 +-
 samplecode/net2/Makefile                           |   40 +-
 samplecode/net2/app/Cargo.toml                     |    9 +-
 samplecode/net2/app/build.rs                       |   39 +-
 samplecode/net2/app/src/main.rs                    |  111 +-
 samplecode/net2/enclave/Cargo.toml                 |    8 +-
 samplecode/net2/enclave/Enclave.edl                |   46 +-
 samplecode/net2/enclave/Makefile                   |   40 +-
 samplecode/net2/enclave/Xargo.toml                 |   38 +-
 samplecode/net2/enclave/src/lib.rs                 |   39 +-
 samplecode/pcl/encrypted-hello/Makefile            |   40 +-
 samplecode/pcl/encrypted-hello/enclave/Cargo.toml  |    8 +-
 samplecode/pcl/encrypted-hello/enclave/Enclave.edl |   46 +-
 samplecode/pcl/encrypted-hello/enclave/Makefile    |   40 +-
 samplecode/pcl/encrypted-hello/enclave/Xargo.toml  |   38 +-
 samplecode/pcl/encrypted-hello/enclave/src/lib.rs  |   39 +-
 samplecode/pcl/pcl-seal/Makefile                   |   44 +-
 samplecode/pcl/pcl-seal/app/Cargo.toml             |    9 +-
 samplecode/pcl/pcl-seal/app/build.rs               |   39 +-
 samplecode/pcl/pcl-seal/app/src/main.rs            |  180 +--
 samplecode/pcl/pcl-seal/enclave/Cargo.toml         |   16 +-
 samplecode/pcl/pcl-seal/enclave/Enclave.edl        |   46 +-
 samplecode/pcl/pcl-seal/enclave/Makefile           |   40 +-
 samplecode/pcl/pcl-seal/enclave/Xargo.toml         |   38 +-
 samplecode/pcl/pcl-seal/enclave/src/lib.rs         |   39 +-
 .../pcl/pcl-seal/enclave/ue_send_recv/Cargo.toml   |    6 +-
 samplecode/pcl/pcl-user/Cargo.toml                 |    6 +-
 samplecode/pcl/pcl-user/ue_send_recv/Cargo.toml    |    2 +-
 samplecode/prost-protobuf/Makefile                 |   40 +-
 samplecode/prost-protobuf/app/Cargo.toml           |   19 +-
 samplecode/prost-protobuf/app/build.rs             |   39 +-
 samplecode/prost-protobuf/app/src/main.rs          |  119 +-
 samplecode/prost-protobuf/enclave/Cargo.toml       |   33 +-
 samplecode/prost-protobuf/enclave/Enclave.edl      |   46 +-
 samplecode/prost-protobuf/enclave/Makefile         |   40 +-
 samplecode/prost-protobuf/enclave/Xargo.toml       |   39 +-
 samplecode/prost-protobuf/enclave/src/lib.rs       |   39 +-
 samplecode/protobuf/Makefile                       |   40 +-
 samplecode/protobuf/app/Cargo.toml                 |    3 +-
 samplecode/protobuf/app/build.rs                   |   39 +-
 samplecode/protobuf/app/src/main.rs                |  111 +-
 samplecode/protobuf/enclave/Cargo.toml             |    4 +-
 samplecode/protobuf/enclave/Enclave.edl            |   46 +-
 samplecode/protobuf/enclave/Makefile               |   40 +-
 samplecode/protobuf/enclave/Xargo.toml             |   38 +-
 samplecode/protobuf/enclave/src/lib.rs             |   39 +-
 samplecode/psi/Enclave/Enclave.cpp                 |   39 +-
 samplecode/psi/Enclave/Enclave.h                   |   39 +-
 samplecode/psi/GeneralSettings.h                   |   39 +-
 samplecode/psi/LICENSE                             |  225 ++-
 samplecode/psi/MessageHandler/MessageHandler.cpp   |   39 +-
 samplecode/psi/MessageHandler/MessageHandler.h     |   39 +-
 samplecode/psi/Networking/AbstractNetworkOps.cpp   |   39 +-
 samplecode/psi/Networking/AbstractNetworkOps.h     |   39 +-
 samplecode/psi/Networking/Client.cpp               |   39 +-
 samplecode/psi/Networking/Client.h                 |   39 +-
 samplecode/psi/Networking/NetworkManager.cpp       |   39 +-
 samplecode/psi/Networking/NetworkManager.h         |   39 +-
 samplecode/psi/Networking/NetworkManagerClient.cpp |   39 +-
 samplecode/psi/Networking/NetworkManagerClient.h   |   39 +-
 samplecode/psi/Networking/NetworkManagerServer.cpp |   39 +-
 samplecode/psi/Networking/NetworkManagerServer.h   |   39 +-
 samplecode/psi/Networking/Network_def.h            |   39 +-
 samplecode/psi/Networking/Server.cpp               |   39 +-
 samplecode/psi/Networking/Server.h                 |   39 +-
 samplecode/psi/Networking/Session.cpp              |   39 +-
 samplecode/psi/Networking/Session.h                |   39 +-
 .../psi/Networking/remote_attestation_result.h     |   39 +-
 samplecode/psi/SMCClient/Makefile                  |   40 +-
 .../psi/SMCClient/isv_app/MessageManager.cpp       |   39 +-
 samplecode/psi/SMCClient/isv_app/MessageManager.h  |   39 +-
 samplecode/psi/SMCClient/isv_app/isv_app.cpp       |   39 +-
 .../SMCClient/sample_libcrypto/sample_libcrypto.h  |   39 +-
 samplecode/psi/SMCClient/worker/Worker.cpp         |   39 +-
 samplecode/psi/SMCClient/worker/Worker.h           |   39 +-
 samplecode/psi/SMCClient/worker/ecp.cpp            |   39 +-
 samplecode/psi/SMCClient/worker/ecp.h              |   39 +-
 samplecode/psi/SMCClient/worker/ias_ra.cpp         |   39 +-
 samplecode/psi/SMCClient/worker/ias_ra.h           |   39 +-
 .../SMCClient/worker/remote_attestation_result.h   |   39 +-
 samplecode/psi/SMCServer/Makefile                  |   42 +-
 samplecode/psi/SMCServer/enclave/Cargo.toml        |   20 +-
 samplecode/psi/SMCServer/enclave/Makefile          |   40 +-
 samplecode/psi/SMCServer/enclave/Xargo.toml        |   38 +-
 samplecode/psi/SMCServer/enclave/enclave.edl       |   46 +-
 samplecode/psi/SMCServer/enclave/src/lib.rs        |   39 +-
 samplecode/psi/SMCServer/isv_app/isv_app.cpp       |   39 +-
 samplecode/psi/Util/Base64.cpp                     |   39 +-
 samplecode/psi/Util/Base64.h                       |   39 +-
 samplecode/psi/Util/LogBase.cpp                    |   39 +-
 samplecode/psi/Util/LogBase.h                      |   39 +-
 samplecode/psi/Util/UtilityFunctions.cpp           |   39 +-
 samplecode/psi/Util/UtilityFunctions.h             |   39 +-
 samplecode/psi/WebService/WebService.cpp           |   39 +-
 samplecode/psi/WebService/WebService.h             |   39 +-
 samplecode/remoteattestation/Application/Makefile  |   42 +-
 .../Application/enclave/Cargo.toml                 |   18 +-
 .../remoteattestation/Application/enclave/Makefile |   40 +-
 .../Application/enclave/Xargo.toml                 |   38 +-
 .../Application/enclave/enclave.edl                |   46 +-
 .../Application/enclave/src/lib.rs                 |   39 +-
 .../Application/isv_app/isv_app.cpp                |   39 +-
 samplecode/remoteattestation/Enclave/Enclave.cpp   |   39 +-
 samplecode/remoteattestation/Enclave/Enclave.h     |   39 +-
 samplecode/remoteattestation/GeneralSettings.h     |   39 +-
 samplecode/remoteattestation/LICENSE               |  226 ++-
 .../MessageHandler/MessageHandler.cpp              |   39 +-
 .../MessageHandler/MessageHandler.h                |   39 +-
 .../Networking/AbstractNetworkOps.cpp              |   39 +-
 .../Networking/AbstractNetworkOps.h                |   39 +-
 samplecode/remoteattestation/Networking/Client.cpp |   39 +-
 samplecode/remoteattestation/Networking/Client.h   |   39 +-
 .../Networking/NetworkManager.cpp                  |   39 +-
 .../remoteattestation/Networking/NetworkManager.h  |   39 +-
 .../Networking/NetworkManagerClient.cpp            |   39 +-
 .../Networking/NetworkManagerClient.h              |   39 +-
 .../Networking/NetworkManagerServer.cpp            |   39 +-
 .../Networking/NetworkManagerServer.h              |   39 +-
 .../remoteattestation/Networking/Network_def.h     |   39 +-
 samplecode/remoteattestation/Networking/Server.cpp |   39 +-
 samplecode/remoteattestation/Networking/Server.h   |   39 +-
 .../remoteattestation/Networking/Session.cpp       |   39 +-
 samplecode/remoteattestation/Networking/Session.h  |   39 +-
 .../Networking/remote_attestation_result.h         |   39 +-
 samplecode/remoteattestation/README.md             |    2 +-
 .../remoteattestation/ServiceProvider/Makefile     |   40 +-
 .../isv_app/VerificationManager.cpp                |   39 +-
 .../ServiceProvider/isv_app/VerificationManager.h  |   39 +-
 .../ServiceProvider/isv_app/isv_app.cpp            |   39 +-
 .../sample_libcrypto/sample_libcrypto.h            |   39 +-
 .../service_provider/ServiceProvider.cpp           |   39 +-
 .../service_provider/ServiceProvider.h             |   39 +-
 .../ServiceProvider/service_provider/ecp.cpp       |   39 +-
 .../ServiceProvider/service_provider/ecp.h         |   39 +-
 .../ServiceProvider/service_provider/ias_ra.cpp    |   39 +-
 .../ServiceProvider/service_provider/ias_ra.h      |   39 +-
 .../service_provider/remote_attestation_result.h   |   39 +-
 samplecode/remoteattestation/Util/Base64.cpp       |   39 +-
 samplecode/remoteattestation/Util/Base64.h         |   39 +-
 samplecode/remoteattestation/Util/LogBase.cpp      |   39 +-
 samplecode/remoteattestation/Util/LogBase.h        |   39 +-
 .../remoteattestation/Util/UtilityFunctions.cpp    |   39 +-
 .../remoteattestation/Util/UtilityFunctions.h      |   39 +-
 .../remoteattestation/WebService/WebService.cpp    |   39 +-
 .../remoteattestation/WebService/WebService.h      |   39 +-
 samplecode/sealeddata/Makefile                     |   39 +-
 samplecode/sealeddata/app/app.c                    |   96 +-
 samplecode/sealeddata/app/app.h                    |   40 +-
 samplecode/sealeddata/enclave/Cargo.toml           |   12 +-
 samplecode/sealeddata/enclave/Enclave.edl          |   46 +-
 samplecode/sealeddata/enclave/Makefile             |   39 +-
 samplecode/sealeddata/enclave/Xargo.toml           |   38 +-
 samplecode/sealeddata/enclave/src/lib.rs           |   39 +-
 samplecode/secretsharing/Makefile                  |   40 +-
 samplecode/secretsharing/app/app.c                 |   94 +-
 samplecode/secretsharing/app/app.h                 |   40 +-
 samplecode/secretsharing/enclave/Cargo.toml        |    4 +-
 samplecode/secretsharing/enclave/Enclave.edl       |   46 +-
 samplecode/secretsharing/enclave/Makefile          |   40 +-
 samplecode/secretsharing/enclave/Xargo.toml        |   38 +-
 samplecode/secretsharing/enclave/src/lib.rs        |   39 +-
 samplecode/serialize/Makefile                      |   39 +-
 samplecode/serialize/app/app.c                     |   94 +-
 samplecode/serialize/app/app.h                     |   40 +-
 samplecode/serialize/enclave/Cargo.toml            |   10 +-
 samplecode/serialize/enclave/Enclave.edl           |   46 +-
 samplecode/serialize/enclave/Makefile              |   39 +-
 samplecode/serialize/enclave/Xargo.toml            |   38 +-
 samplecode/serialize/enclave/src/lib.rs            |   39 +-
 samplecode/sgx-cov/Makefile                        |   40 +-
 samplecode/sgx-cov/app/Cargo.toml                  |    9 +-
 samplecode/sgx-cov/app/build.rs                    |   39 +-
 samplecode/sgx-cov/app/src/main.rs                 |  111 +-
 samplecode/sgx-cov/enclave/Cargo.toml              |   12 +-
 samplecode/sgx-cov/enclave/Enclave.edl             |   46 +-
 samplecode/sgx-cov/enclave/Makefile                |   40 +-
 samplecode/sgx-cov/enclave/Xargo.toml              |   40 +-
 samplecode/sgx-cov/enclave/src/lib.rs              |   39 +-
 samplecode/sgxcounter/Makefile                     |   40 +-
 samplecode/sgxcounter/Readme.md                    |    6 +
 samplecode/sgxcounter/app/Cargo.toml               |    9 +-
 samplecode/sgxcounter/app/build.rs                 |   39 +-
 samplecode/sgxcounter/app/src/main.rs              |  111 +-
 samplecode/sgxcounter/enclave/Cargo.toml           |   10 +-
 samplecode/sgxcounter/enclave/Enclave.edl          |   46 +-
 samplecode/sgxcounter/enclave/Makefile             |   40 +-
 samplecode/sgxcounter/enclave/Xargo.toml           |   38 +-
 samplecode/sgxcounter/enclave/src/lib.rs           |   39 +-
 samplecode/sgxtime/Makefile                        |   40 +-
 samplecode/sgxtime/Readme.md                       |    6 +
 samplecode/sgxtime/app/Cargo.toml                  |    9 +-
 samplecode/sgxtime/app/build.rs                    |   39 +-
 samplecode/sgxtime/app/src/main.rs                 |  111 +-
 samplecode/sgxtime/enclave/Cargo.toml              |   10 +-
 samplecode/sgxtime/enclave/Enclave.edl             |   46 +-
 samplecode/sgxtime/enclave/Makefile                |   40 +-
 samplecode/sgxtime/enclave/Xargo.toml              |   38 +-
 samplecode/sgxtime/enclave/src/lib.rs              |   39 +-
 samplecode/static-data-distribution/Makefile       |   42 +-
 samplecode/static-data-distribution/app/Cargo.toml |   11 +-
 samplecode/static-data-distribution/app/build.rs   |   39 +-
 .../static-data-distribution/app/src/main.rs       |  121 +-
 .../static-data-distribution/enclave/Cargo.toml    |   10 +-
 .../static-data-distribution/enclave/Enclave.edl   |   46 +-
 .../static-data-distribution/enclave/Makefile      |   40 +-
 .../static-data-distribution/enclave/Xargo.toml    |   39 +-
 .../static-data-distribution/enclave/src/lib.rs    |   39 +-
 samplecode/switchless/Makefile                     |   40 +-
 samplecode/switchless/app/Cargo.toml               |    9 +-
 samplecode/switchless/app/build.rs                 |   39 +-
 samplecode/switchless/app/src/main.rs              |  115 +-
 samplecode/switchless/enclave/Cargo.toml           |    8 +-
 samplecode/switchless/enclave/Enclave.edl          |   46 +-
 samplecode/switchless/enclave/Makefile             |   40 +-
 samplecode/switchless/enclave/Xargo.toml           |   38 +-
 samplecode/switchless/enclave/src/lib.rs           |   39 +-
 samplecode/tcmalloc/Makefile                       |   40 +-
 samplecode/tcmalloc/app/Cargo.toml                 |    9 +-
 samplecode/tcmalloc/app/build.rs                   |   39 +-
 samplecode/tcmalloc/app/src/main.rs                |  111 +-
 samplecode/tcmalloc/enclave/Cargo.toml             |    8 +-
 samplecode/tcmalloc/enclave/Enclave.edl            |   46 +-
 samplecode/tcmalloc/enclave/Makefile               |   40 +-
 samplecode/tcmalloc/enclave/Xargo.toml             |   38 +-
 samplecode/tcmalloc/enclave/src/lib.rs             |   39 +-
 samplecode/thread/Makefile                         |   39 +-
 samplecode/thread/app/App.cpp                      |   95 +-
 samplecode/thread/app/App.h                        |   40 +-
 samplecode/thread/app/Thread.cpp                   |   39 +-
 samplecode/thread/enclave/Cargo.toml               |    6 +-
 samplecode/thread/enclave/Enclave.edl              |   46 +-
 samplecode/thread/enclave/Makefile                 |   39 +-
 samplecode/thread/enclave/Xargo.toml               |   38 +-
 samplecode/thread/enclave/src/lib.rs               |   39 +-
 samplecode/tls/tlsclient/Makefile                  |   40 +-
 samplecode/tls/tlsclient/app/Cargo.toml            |    9 +-
 samplecode/tls/tlsclient/app/build.rs              |   39 +-
 samplecode/tls/tlsclient/app/src/main.rs           |  109 +-
 samplecode/tls/tlsclient/enclave/Cargo.toml        |   10 +-
 samplecode/tls/tlsclient/enclave/Enclave.edl       |   46 +-
 samplecode/tls/tlsclient/enclave/Makefile          |   40 +-
 samplecode/tls/tlsclient/enclave/Xargo.toml        |   38 +-
 samplecode/tls/tlsclient/enclave/src/lib.rs        |   39 +-
 samplecode/tls/tlsserver/Makefile                  |   40 +-
 samplecode/tls/tlsserver/app/Cargo.toml            |    9 +-
 samplecode/tls/tlsserver/app/build.rs              |   39 +-
 samplecode/tls/tlsserver/app/src/main.rs           |  112 +-
 samplecode/tls/tlsserver/enclave/Cargo.toml        |   10 +-
 samplecode/tls/tlsserver/enclave/Enclave.edl       |   46 +-
 samplecode/tls/tlsserver/enclave/Makefile          |   40 +-
 samplecode/tls/tlsserver/enclave/Xargo.toml        |   38 +-
 samplecode/tls/tlsserver/enclave/src/lib.rs        |   39 +-
 samplecode/tr-mpc/tr-mpc-client/Cargo.toml         |    6 +-
 samplecode/tr-mpc/tr-mpc-server/Makefile           |   40 +-
 samplecode/tr-mpc/tr-mpc-server/app/Cargo.toml     |    9 +-
 samplecode/tr-mpc/tr-mpc-server/app/build.rs       |   39 +-
 samplecode/tr-mpc/tr-mpc-server/app/src/main.rs    |  110 +-
 samplecode/tr-mpc/tr-mpc-server/enclave/Cargo.toml |   14 +-
 .../tr-mpc/tr-mpc-server/enclave/Enclave.edl       |   46 +-
 samplecode/tr-mpc/tr-mpc-server/enclave/Makefile   |   40 +-
 samplecode/tr-mpc/tr-mpc-server/enclave/Xargo.toml |   45 +-
 samplecode/tr-mpc/tr-mpc-server/enclave/src/lib.rs |   39 +-
 samplecode/ue-ra/ue-ra-client/Cargo.toml           |    6 +-
 samplecode/ue-ra/ue-ra-server/Makefile             |   40 +-
 samplecode/ue-ra/ue-ra-server/app/Cargo.toml       |    9 +-
 samplecode/ue-ra/ue-ra-server/app/build.rs         |   39 +-
 samplecode/ue-ra/ue-ra-server/app/src/main.rs      |  110 +-
 samplecode/ue-ra/ue-ra-server/enclave/Cargo.toml   |   14 +-
 samplecode/ue-ra/ue-ra-server/enclave/Enclave.edl  |   46 +-
 samplecode/ue-ra/ue-ra-server/enclave/Makefile     |   40 +-
 samplecode/ue-ra/ue-ra-server/enclave/Xargo.toml   |   38 +-
 samplecode/ue-ra/ue-ra-server/enclave/src/lib.rs   |   39 +-
 samplecode/unit-test/Makefile                      |   40 +-
 samplecode/unit-test/app/Cargo.toml                |    9 +-
 samplecode/unit-test/app/build.rs                  |   39 +-
 samplecode/unit-test/app/src/main.rs               |  111 +-
 samplecode/unit-test/enclave/Cargo.toml            |   24 +-
 samplecode/unit-test/enclave/Enclave.config.xml    |    4 +-
 samplecode/unit-test/enclave/Enclave.edl           |   49 +-
 samplecode/unit-test/enclave/Makefile              |   40 +-
 samplecode/unit-test/enclave/Xargo.toml            |   40 +-
 samplecode/unit-test/enclave/src/lib.rs            |  369 +++--
 samplecode/unit-test/enclave/src/test_alignbox.rs  |  302 ++++
 samplecode/unit-test/enclave/src/test_assert.rs    |   39 +-
 samplecode/unit-test/enclave/src/test_crypto.rs    |   39 +-
 samplecode/unit-test/enclave/src/test_env.rs       |   26 +-
 samplecode/unit-test/enclave/src/test_file.rs      |   44 +-
 samplecode/unit-test/enclave/src/test_mpsc.rs      | 1184 ++++++++++++++
 samplecode/unit-test/enclave/src/test_path.rs      |   32 +-
 samplecode/unit-test/enclave/src/test_rand.rs      |   39 +-
 samplecode/unit-test/enclave/src/test_rts.rs       |   39 +-
 samplecode/unit-test/enclave/src/test_seal.rs      |   39 +-
 samplecode/unit-test/enclave/src/test_thread.rs    |  229 +++
 samplecode/unit-test/enclave/src/utils.rs          |   39 +-
 samplecode/wasmi/Makefile                          |   42 +-
 samplecode/wasmi/app/Cargo.toml                    |    9 +-
 samplecode/wasmi/app/build.rs                      |   39 +-
 samplecode/wasmi/app/src/main.rs                   |  110 +-
 samplecode/wasmi/enclave/Cargo.toml                |    8 +-
 samplecode/wasmi/enclave/Enclave.edl               |   46 +-
 samplecode/wasmi/enclave/Makefile                  |   40 +-
 samplecode/wasmi/enclave/Xargo.toml                |   38 +-
 samplecode/wasmi/enclave/sgxwasm/Cargo.toml        |    8 +-
 samplecode/wasmi/enclave/sgxwasm/src/lib.rs        |   39 +-
 samplecode/wasmi/enclave/src/lib.rs                |   39 +-
 samplecode/zlib-lazy-static-sample/Makefile        |   40 +-
 samplecode/zlib-lazy-static-sample/app/Cargo.toml  |    9 +-
 samplecode/zlib-lazy-static-sample/app/build.rs    |   39 +-
 samplecode/zlib-lazy-static-sample/app/src/main.rs |  111 +-
 .../zlib-lazy-static-sample/enclave/Cargo.toml     |    4 +-
 .../zlib-lazy-static-sample/enclave/Enclave.edl    |   46 +-
 .../zlib-lazy-static-sample/enclave/Makefile       |   40 +-
 .../zlib-lazy-static-sample/enclave/Xargo.toml     |   38 +-
 .../zlib-lazy-static-sample/enclave/src/lib.rs     |   39 +-
 sgx_alloc/Cargo.toml                               |    9 +-
 sgx_alloc/LICENSE                                  |  813 +++-------
 sgx_alloc/Readme.md                                |    2 +-
 sgx_alloc/src/lib.rs                               |   63 +-
 sgx_backtrace/Cargo.toml                           |    6 +-
 sgx_backtrace/src/backtrace/libunwind.rs           |   39 +-
 sgx_backtrace/src/backtrace/mod.rs                 |   39 +-
 sgx_backtrace/src/capture.rs                       |   39 +-
 sgx_backtrace/src/lib.rs                           |   41 +-
 sgx_backtrace/src/symbolize/libbacktrace.rs        |   39 +-
 sgx_backtrace/src/symbolize/mod.rs                 |   39 +-
 sgx_backtrace/src/types.rs                         |   39 +-
 sgx_backtrace_sys/Cargo.toml                       |    6 +-
 sgx_backtrace_sys/LICENSE                          |  813 +++-------
 sgx_backtrace_sys/Readme.md                        |    2 +-
 sgx_backtrace_sys/build.rs                         |   39 +-
 sgx_backtrace_sys/src/lib.rs                       |   39 +-
 sgx_build_helper/Cargo.toml                        |    4 +-
 sgx_build_helper/LICENSE                           |  813 +++-------
 sgx_build_helper/Readme.md                         |    2 +-
 sgx_cov/Cargo.toml                                 |    6 +-
 sgx_cov/LICENSE                                    |  813 +++-------
 sgx_cov/Readme.md                                  |    2 +-
 sgx_cov/lib.rs                                     |   39 +-
 sgx_crypto_helper/Cargo.toml                       |    6 +-
 sgx_crypto_helper/LICENSE                          |  813 +++-------
 sgx_crypto_helper/Readme.md                        |    2 +-
 sgx_crypto_helper/build.rs                         |   39 +-
 sgx_crypto_helper/src/lib.rs                       |   39 +-
 sgx_demangle/Cargo.toml                            |    6 +-
 sgx_demangle/LICENSE                               |  813 +++-------
 sgx_demangle/Readme.md                             |    2 +-
 sgx_libc/Cargo.toml                                |    6 +-
 sgx_libc/LICENSE                                   |  813 +++-------
 sgx_libc/src/android/aarch64/mod.rs                |   39 +-
 sgx_libc/src/android/mod.rs                        |   39 +-
 sgx_libc/src/lib.rs                                |   40 +-
 sgx_libc/src/linux/mod.rs                          |   39 +-
 sgx_libc/src/linux/x86_64/mod.rs                   |   56 +-
 sgx_libc/src/linux/x86_64/ocall.rs                 |  414 ++++-
 sgx_libc/src/macros.rs                             |  171 +-
 {sgx_backtrace_sys => sgx_no_tstd}/Cargo.toml      |   14 +-
 sgx_no_tstd/LICENSE                                |  202 +++
 sgx_no_tstd/Readme.md                              |    3 +
 sgx_no_tstd/build.rs                               |   48 +
 sgx_no_tstd/src/lib.rs                             |   99 ++
 sgx_panic_abort/Cargo.toml                         |    4 +-
 sgx_panic_unwind/Cargo.toml                        |    4 +-
 sgx_rand/Cargo.toml                                |    6 +-
 sgx_rand/LICENSE                                   |  813 +++-------
 sgx_rand/Readme.md                                 |    2 +-
 sgx_rand/src/chacha.rs                             |   39 +-
 sgx_rand/src/distributions/exponential.rs          |   39 +-
 sgx_rand/src/distributions/gamma.rs                |   39 +-
 sgx_rand/src/distributions/mod.rs                  |   39 +-
 sgx_rand/src/distributions/normal.rs               |   39 +-
 sgx_rand/src/distributions/range.rs                |   39 +-
 sgx_rand/src/distributions/ziggurat_tables.rs      |   39 +-
 sgx_rand/src/isaac.rs                              |   39 +-
 sgx_rand/src/lib.rs                                |   39 +-
 sgx_rand/src/os.rs                                 |   39 +-
 sgx_rand/src/rand_impls.rs                         |   39 +-
 sgx_rand/src/read.rs                               |   39 +-
 sgx_rand/src/reseeding.rs                          |   39 +-
 sgx_rand_derive/Cargo.toml                         |    6 +-
 sgx_rand_derive/LICENSE                            |  813 +++-------
 sgx_rand_derive/Readme.md                          |    2 +-
 sgx_rand_derive/src/lib.rs                         |   39 +-
 sgx_serialize/Cargo.toml                           |    6 +-
 sgx_serialize/LICENSE                              |  813 +++-------
 sgx_serialize/Readme.md                            |    2 +-
 sgx_serialize/src/leb128.rs                        |   39 +-
 sgx_serialize/src/lib.rs                           |   39 +-
 sgx_serialize/src/opaque.rs                        |   39 +-
 sgx_serialize/src/serialize.rs                     |   39 +-
 sgx_serialize_derive/Cargo.toml                    |    6 +-
 sgx_serialize_derive/LICENSE                       |  813 +++-------
 sgx_serialize_derive/Readme.md                     |    2 +-
 sgx_serialize_derive/src/bound.rs                  |   39 +-
 sgx_serialize_derive/src/decode.rs                 |   39 +-
 sgx_serialize_derive/src/encode.rs                 |   39 +-
 sgx_serialize_derive/src/fragment.rs               |   39 +-
 sgx_serialize_derive/src/lib.rs                    |   39 +-
 sgx_serialize_derive/src/param.rs                  |   39 +-
 sgx_serialize_derive_internals/Cargo.toml          |    6 +-
 sgx_serialize_derive_internals/LICENSE             |  813 +++-------
 sgx_serialize_derive_internals/Readme.md           |    2 +-
 sgx_serialize_derive_internals/src/ast.rs          |   39 +-
 sgx_serialize_derive_internals/src/ctxt.rs         |   39 +-
 sgx_serialize_derive_internals/src/lib.rs          |   39 +-
 sgx_tcrypto/Cargo.toml                             |    6 +-
 sgx_tcrypto/LICENSE                                |  813 +++-------
 sgx_tcrypto/Readme.md                              |    2 +-
 sgx_tcrypto/src/crypto.rs                          |  408 +++--
 sgx_tcrypto/src/lib.rs                             |   39 +-
 sgx_tcrypto_helper/Cargo.toml                      |   14 +-
 sgx_tcrypto_helper/LICENSE                         |  813 +++-------
 sgx_tcrypto_helper/Readme.md                       |    4 +-
 sgx_tcrypto_helper/build.rs                        |   39 +-
 sgx_tdh/Cargo.toml                                 |    6 +-
 sgx_tdh/LICENSE                                    |  813 +++-------
 sgx_tdh/Readme.md                                  |    2 +-
 sgx_tdh/src/dh.rs                                  |   96 +-
 sgx_tdh/src/ecp.rs                                 |   50 +-
 sgx_tdh/src/lib.rs                                 |   39 +-
 sgx_tkey_exchange/Cargo.toml                       |    6 +-
 sgx_tkey_exchange/LICENSE                          |  813 +++-------
 sgx_tkey_exchange/Readme.md                        |    2 +-
 sgx_tkey_exchange/src/lib.rs                       |   39 +-
 sgx_tprotected_fs/Cargo.toml                       |    6 +-
 sgx_tprotected_fs/LICENSE                          |  813 +++-------
 sgx_tprotected_fs/Readme.md                        |    2 +-
 sgx_tprotected_fs/src/fs.rs                        |   61 +-
 sgx_tprotected_fs/src/lib.rs                       |   39 +-
 sgx_trts/Cargo.toml                                |    6 +-
 sgx_trts/LICENSE                                   |  813 +++-------
 sgx_trts/Readme.md                                 |    2 +-
 sgx_trts/src/ascii.rs                              |   39 +-
 sgx_trts/src/c_str.rs                              |   39 +-
 sgx_trts/src/cpu_feature.rs                        |  321 ++++
 sgx_trts/src/enclave.rs                            |  207 ++-
 sgx_trts/src/lib.rs                                |   40 +-
 sgx_trts/src/macros.rs                             |   39 +-
 sgx_trts/src/memchr.rs                             |   39 +-
 sgx_trts/src/memeq.rs                              |   39 +-
 sgx_trts/src/oom.rs                                |   39 +-
 sgx_trts/src/trts.rs                               |   39 +-
 sgx_trts/src/veh.rs                                |   39 +-
 sgx_tse/Cargo.toml                                 |    6 +-
 sgx_tse/LICENSE                                    |  813 +++-------
 sgx_tse/Readme.md                                  |    2 +-
 sgx_tse/src/alignalloc.rs                          |  352 ++++
 sgx_tse/src/alignbox.rs                            |  249 +++
 sgx_tse/src/alloc.rs                               |  339 ++++
 sgx_tse/src/lib.rs                                 |  233 +--
 sgx_tse/src/{lib.rs => se.rs}                      |   59 +-
 sgx_tseal/Cargo.toml                               |    6 +-
 sgx_tseal/LICENSE                                  |  813 +++-------
 sgx_tseal/Readme.md                                |    2 +-
 sgx_tseal/src/aad.rs                               |   39 +-
 sgx_tseal/src/internal.rs                          |   72 +-
 sgx_tseal/src/lib.rs                               |   39 +-
 sgx_tseal/src/seal.rs                              |   39 +-
 sgx_tservice/Cargo.toml                            |    6 +-
 sgx_tservice/LICENSE                               |  813 +++-------
 sgx_tservice/Readme.md                             |    2 +-
 sgx_tservice/src/lib.rs                            |   39 +-
 sgx_tservice/src/sgxcounter.rs                     |   39 +-
 sgx_tservice/src/sgxtime.rs                        |   39 +-
 sgx_tservice/src/tae.rs                            |   39 +-
 sgx_tstd/Cargo.toml                                |    8 +-
 sgx_tstd/LICENSE                                   |  813 +++-------
 sgx_tstd/Readme.md                                 |    2 +-
 sgx_tstd/build.rs                                  |   39 +-
 sgx_tstd/src/alloc.rs                              |   39 +-
 sgx_tstd/src/ascii.rs                              |   39 +-
 sgx_tstd/src/backtrace.rs                          |   39 +-
 sgx_tstd/src/collections/hash/map.rs               |   67 +-
 sgx_tstd/src/collections/hash/mod.rs               |   39 +-
 sgx_tstd/src/collections/hash/set.rs               |   39 +-
 sgx_tstd/src/collections/hash/table.rs             |   59 +-
 sgx_tstd/src/collections/mod.rs                    |   41 +-
 sgx_tstd/src/cpuid.rs                              |   39 +-
 sgx_tstd/src/debug.rs                              |   39 +-
 sgx_tstd/src/enclave.rs                            |   39 +-
 sgx_tstd/src/env.rs                                |   57 +-
 sgx_tstd/src/error.rs                              |   49 +-
 sgx_tstd/src/f32.rs                                |   39 +-
 sgx_tstd/src/f64.rs                                |   39 +-
 sgx_tstd/src/ffi/c_str.rs                          |   39 +-
 sgx_tstd/src/ffi/mod.rs                            |   39 +-
 sgx_tstd/src/ffi/os_str.rs                         |   39 +-
 sgx_tstd/src/fs.rs                                 |   39 +-
 sgx_tstd/src/future.rs                             |   39 +-
 sgx_tstd/src/io/buffered.rs                        |   39 +-
 sgx_tstd/src/io/cursor.rs                          |   39 +-
 sgx_tstd/src/io/error.rs                           |   39 +-
 sgx_tstd/src/io/impls.rs                           |   39 +-
 sgx_tstd/src/io/lazy.rs                            |   39 +-
 sgx_tstd/src/io/mod.rs                             |   39 +-
 sgx_tstd/src/io/prelude.rs                         |   39 +-
 sgx_tstd/src/io/stdio.rs                           |   39 +-
 sgx_tstd/src/io/util.rs                            |   39 +-
 sgx_tstd/src/lib.rs                                |   55 +-
 sgx_tstd/src/macros.rs                             |   39 +-
 sgx_tstd/src/memchr.rs                             |   39 +-
 sgx_tstd/src/net/addr.rs                           |   78 +-
 sgx_tstd/src/net/ip.rs                             |   39 +-
 sgx_tstd/src/net/mod.rs                            |   41 +-
 sgx_tstd/src/net/parser.rs                         |   39 +-
 sgx_tstd/src/net/tcp.rs                            |   39 +-
 sgx_tstd/src/net/udp.rs                            |   39 +-
 sgx_tstd/src/num.rs                                |   39 +-
 sgx_tstd/src/os/fs.rs                              |   39 +-
 sgx_tstd/src/os/mod.rs                             |   39 +-
 sgx_tstd/src/os/raw.rs                             |   39 +-
 sgx_tstd/src/panic.rs                              |   39 +-
 sgx_tstd/src/panicking.rs                          |   68 +-
 sgx_tstd/src/path.rs                               |   39 +-
 sgx_tstd/src/prelude/mod.rs                        |   39 +-
 sgx_tstd/src/prelude/v1.rs                         |   44 +-
 sgx_tstd/src/rand/reader.rs                        |   39 +-
 sgx_tstd/src/rt.rs                                 |   39 +-
 sgx_tstd/src/sgxfs.rs                              |   45 +-
 sgx_tstd/src/sync/barrier.rs                       |   39 +-
 sgx_tstd/src/sync/condvar.rs                       |   53 +-
 sgx_tstd/src/sync/mod.rs                           |   42 +-
 sgx_tstd/src/sync/mpsc/blocking.rs                 |  104 ++
 sgx_tstd/src/sync/mpsc/cache_aligned.rs            |   44 +
 sgx_tstd/src/sync/mpsc/mod.rs                      | 1697 ++++++++++++++++++++
 sgx_tstd/src/sync/mpsc/mpsc_queue.rs               |  136 ++
 sgx_tstd/src/sync/mpsc/oneshot.rs                  |  331 ++++
 sgx_tstd/src/sync/mpsc/shared.rs                   |  489 ++++++
 sgx_tstd/src/sync/mpsc/spsc_queue.rs               |  249 +++
 sgx_tstd/src/sync/mpsc/stream.rs                   |  458 ++++++
 sgx_tstd/src/sync/mpsc/sync.rs                     |  498 ++++++
 sgx_tstd/src/sync/mutex.rs                         |   83 +-
 sgx_tstd/src/sync/once.rs                          |   39 +-
 sgx_tstd/src/sync/remutex.rs                       |   39 +-
 sgx_tstd/src/sync/rwlock.rs                        |   39 +-
 sgx_tstd/src/sync/spinlock.rs                      |   39 +-
 sgx_tstd/src/sys/backtrace/mod.rs                  |   39 +-
 sgx_tstd/src/sys/backtrace/printing/mod.rs         |   39 +-
 sgx_tstd/src/sys/backtrace/tracing/gcc_s.rs        |   39 +-
 sgx_tstd/src/sys/backtrace/tracing/mod.rs          |   39 +-
 sgx_tstd/src/sys/cmath.rs                          |   39 +-
 sgx_tstd/src/sys/env.rs                            |   39 +-
 sgx_tstd/src/sys/ext/ffi.rs                        |   39 +-
 sgx_tstd/src/sys/ext/fs.rs                         |   39 +-
 sgx_tstd/src/sys/ext/io.rs                         |   39 +-
 sgx_tstd/src/sys/ext/mod.rs                        |   39 +-
 sgx_tstd/src/sys/ext/net.rs                        |   39 +-
 sgx_tstd/src/sys/fd.rs                             |   39 +-
 sgx_tstd/src/sys/fs.rs                             |   39 +-
 sgx_tstd/src/sys/io.rs                             |   39 +-
 sgx_tstd/src/sys/memchr.rs                         |   39 +-
 sgx_tstd/src/sys/mod.rs                            |   41 +-
 sgx_tstd/src/sys/net.rs                            |   72 +-
 sgx_tstd/src/sys/os.rs                             |  127 +-
 sgx_tstd/src/sys/path.rs                           |   39 +-
 sgx_tstd/src/sys/pipe.rs                           |   39 +-
 sgx_tstd/src/sys/rand.rs                           |   39 +-
 sgx_tstd/src/sys/sgxfs.rs                          |   61 +-
 sgx_tstd/src/sys/stdio.rs                          |   39 +-
 sgx_tstd/src/sys/thread.rs                         |  222 +++
 sgx_tstd/src/sys/time.rs                           |   39 +-
 sgx_tstd/src/sys_common/at_exit_imp.rs             |   39 +-
 sgx_tstd/src/sys_common/backtrace.rs               |   39 +-
 sgx_tstd/src/sys_common/bytestring.rs              |   39 +-
 sgx_tstd/src/sys_common/fs.rs                      |   39 +-
 sgx_tstd/src/sys_common/gnu/libbacktrace.rs        |   39 +-
 sgx_tstd/src/sys_common/gnu/mod.rs                 |   39 +-
 sgx_tstd/src/sys_common/io.rs                      |   39 +-
 sgx_tstd/src/sys_common/memchr.rs                  |   39 +-
 sgx_tstd/src/sys_common/mod.rs                     |   41 +-
 sgx_tstd/src/sys_common/net.rs                     |  131 +-
 sgx_tstd/src/sys_common/os_str_bytes.rs            |   39 +-
 sgx_tstd/src/sys_common/poison.rs                  |   39 +-
 sgx_tstd/src/sys_common/thread.rs                  |   50 +
 sgx_tstd/src/sys_common/thread_info.rs             |   43 +-
 sgx_tstd/src/sys_common/util.rs                    |   39 +-
 sgx_tstd/src/sys_common/wtf8.rs                    |   39 +-
 sgx_tstd/src/thread/local.rs                       |   39 +-
 sgx_tstd/src/thread/mod.rs                         |  485 +++++-
 sgx_tstd/src/time.rs                               |   39 +-
 sgx_tstd/src/untrusted/fs.rs                       |   39 +-
 sgx_tstd/src/untrusted/mod.rs                      |   39 +-
 sgx_tstd/src/untrusted/path.rs                     |   39 +-
 sgx_tstd/src/untrusted/time.rs                     |   39 +-
 sgx_tunittest/Cargo.toml                           |    6 +-
 sgx_tunittest/LICENSE                              |  813 +++-------
 sgx_tunittest/Readme.md                            |    2 +-
 sgx_tunittest/src/lib.rs                           |   39 +-
 sgx_types/Cargo.toml                               |    6 +-
 sgx_types/LICENSE                                  |  813 +++-------
 sgx_types/Readme.md                                |    2 +-
 sgx_types/src/cpu_feature.rs                       |  267 +++
 sgx_types/src/error.rs                             |  272 +++-
 sgx_types/src/function.rs                          |  177 +-
 sgx_types/src/lib.rs                               |   42 +-
 sgx_types/src/macros.rs                            |   41 +-
 sgx_types/src/marker.rs                            |   39 +-
 sgx_types/src/metadata.rs                          |   78 +-
 sgx_types/src/types.rs                             |  223 ++-
 sgx_ucrypto/Cargo.toml                             |    6 +-
 sgx_ucrypto/LICENSE                                |  813 +++-------
 sgx_ucrypto/Readme.md                              |    2 +-
 sgx_ucrypto/build.rs                               |   39 +-
 sgx_ucrypto/src/crypto.rs                          |  221 +--
 sgx_ucrypto/src/lib.rs                             |   39 +-
 sgx_ucrypto/src/util.rs                            |    2 +-
 sgx_unwind/Cargo.toml                              |    9 +-
 sgx_unwind/LICENSE                                 |  813 +++-------
 sgx_unwind/Readme.md                               |    2 +-
 sgx_unwind/lib.rs                                  |    1 -
 sgx_unwind/libunwind.rs                            |    4 +-
 sgx_urts/Cargo.toml                                |    6 +-
 sgx_urts/LICENSE                                   |  813 +++-------
 sgx_urts/Readme.md                                 |    2 +-
 sgx_urts/src/asyncio.rs                            |   39 +-
 sgx_urts/src/enclave.rs                            |   47 +-
 sgx_urts/src/env.rs                                |  116 +-
 sgx_urts/src/event.rs                              |  125 +-
 sgx_urts/src/fd.rs                                 |   39 +-
 sgx_urts/src/file.rs                               |   52 +-
 sgx_urts/src/lib.rs                                |   44 +-
 sgx_urts/src/mem.rs                                |   39 +-
 sgx_urts/src/net.rs                                |   42 +
 sgx_urts/src/pipe.rs                               |   39 +-
 sgx_urts/src/socket.rs                             |   57 +-
 sgx_urts/src/sys.rs                                |   59 +-
 sgx_urts/src/thread.rs                             |  108 ++
 sgx_urts/src/time.rs                               |   39 +-
 sgx_ustdc/Makefile                                 |   40 +-
 sgx_ustdc/asyncio.c                                |   39 +-
 sgx_ustdc/env.c                                    |   82 +-
 sgx_ustdc/event.c                                  |   20 +-
 sgx_ustdc/fd.c                                     |   39 +-
 sgx_ustdc/file.c                                   |   47 +-
 sgx_ustdc/mem.c                                    |   39 +-
 sgx_ustdc/net.c                                    |   40 +
 sgx_ustdc/pipe.c                                   |   39 +-
 sgx_ustdc/socket.c                                 |   39 +-
 sgx_ustdc/sys.c                                    |   54 +-
 sgx_ustdc/thread.c                                 |   81 +
 sgx_ustdc/time.c                                   |   39 +-
 xargo/sgx_tstd/Cargo.toml                          |    4 +-
 xargo/sgx_tstd/build.rs                            |   39 +-
 883 files changed, 27913 insertions(+), 37255 deletions(-)

diff --git a/LICENSE b/LICENSE
index a329fc5..56a2b1a 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,613 +1,255 @@
-BSD License
 
-Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+-------------------------------------------------------------------------------
+This product bundles various third-party components under other open source
+licenses. This section summarizes those components and their licenses. See
+licenses/ for text of these licenses.
+
+Apache License, Version 2.0
+---------------------------
+
+samplecode/wasmi/enclave/sgxwasm/src/lib.rs
+samplecode/wasmi/enclave/src/lib.rs
+
+
+BSD 3-Clauses License
+---------------------
+
+samplecode/backtrace/app
+samplecode/crypto/app
+samplecode/file/app
+samplecode/hello-regex/app
+samplecode/hugemem/app
+samplecode/helloworld/app
+samplecode/localattestation/app
+samplecode/sealeddata/app
+samplecode/secretsharing/app
+samplecode/serialize/app
+samplecode/thread/app
+
+
+MIT License
+-----------
+
+samplecode/remoteattestation
+compiler_rt
 
-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 Baidu, Inc., 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.
-
-
-
-===========================================================================================================================================================
-
-Rust SGX SDK software for Linux also uses third-party projects that may be distributed under different licenses. Please see below for details.
-
-
-1. Intel(R) SGX
-
-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:
-
-  * 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.
-
-
-2. Rust Project
-
-                              Apache License
-                        Version 2.0, January 2004
-                     http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
-   "License" shall mean the terms and conditions for use, reproduction,
-   and distribution as defined by Sections 1 through 9 of this document.
-
-   "Licensor" shall mean the copyright owner or entity authorized by
-   the copyright owner that is granting the License.
-
-   "Legal Entity" shall mean the union of the acting entity and all
-   other entities that control, are controlled by, or are under common
-   control with that entity. For the purposes of this definition,
-   "control" means (i) the power, direct or indirect, to cause the
-   direction or management of such entity, whether by contract or
-   otherwise, or (ii) ownership of fifty percent (50%) or more of the
-   outstanding shares, or (iii) beneficial ownership of such entity.
-
-   "You" (or "Your") shall mean an individual or Legal Entity
-   exercising permissions granted by this License.
-
-   "Source" form shall mean the preferred form for making modifications,
-   including but not limited to software source code, documentation
-   source, and configuration files.
-
-   "Object" form shall mean any form resulting from mechanical
-   transformation or translation of a Source form, including but
-   not limited to compiled object code, generated documentation,
-   and conversions to other media types.
-
-   "Work" shall mean the work of authorship, whether in Source or
-   Object form, made available under the License, as indicated by a
-   copyright notice that is included in or attached to the work
-   (an example is provided in the Appendix below).
-
-   "Derivative Works" shall mean any work, whether in Source or Object
-   form, that is based on (or derived from) the Work and for which the
-   editorial revisions, annotations, elaborations, or other modifications
-   represent, as a whole, an original work of authorship. For the purposes
-   of this License, Derivative Works shall not include works that remain
-   separable from, or merely link (or bind by name) to the interfaces of,
-   the Work and Derivative Works thereof.
-
-   "Contribution" shall mean any work of authorship, including
-   the original version of the Work and any modifications or additions
-   to that Work or Derivative Works thereof, that is intentionally
-   submitted to Licensor for inclusion in the Work by the copyright owner
-   or by an individual or Legal Entity authorized to submit on behalf of
-   the copyright owner. For the purposes of this definition, "submitted"
-   means any form of electronic, verbal, or written communication sent
-   to the Licensor or its representatives, including but not limited to
-   communication on electronic mailing lists, source code control systems,
-   and issue tracking systems that are managed by, or on behalf of, the
-   Licensor for the purpose of discussing and improving the Work, but
-   excluding communication that is conspicuously marked or otherwise
-   designated in writing by the copyright owner as "Not a Contribution."
-
-   "Contributor" shall mean Licensor and any individual or Legal Entity
-   on behalf of whom a Contribution has been received by Licensor and
-   subsequently incorporated within the Work.
-
-2. Grant of Copyright License. Subject to the terms and conditions of
-   this License, each Contributor hereby grants to You a perpetual,
-   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-   copyright license to reproduce, prepare Derivative Works of,
-   publicly display, publicly perform, sublicense, and distribute the
-   Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License. Subject to the terms and conditions of
-   this License, each Contributor hereby grants to You a perpetual,
-   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-   (except as stated in this section) patent license to make, have made,
-   use, offer to sell, sell, import, and otherwise transfer the Work,
-   where such license applies only to those patent claims licensable
-   by such Contributor that are necessarily infringed by their
-   Contribution(s) alone or by combination of their Contribution(s)
-   with the Work to which such Contribution(s) was submitted. If You
-   institute patent litigation against any entity (including a
-   cross-claim or counterclaim in a lawsuit) alleging that the Work
-   or a Contribution incorporated within the Work constitutes direct
-   or contributory patent infringement, then any patent licenses
-   granted to You under this License for that Work shall terminate
-   as of the date such litigation is filed.
-
-4. Redistribution. You may reproduce and distribute copies of the
-   Work or Derivative Works thereof in any medium, with or without
-   modifications, and in Source or Object form, provided that You
-   meet the following conditions:
-
-   (a) You must give any other recipients of the Work or
-       Derivative Works a copy of this License; and
-
-   (b) You must cause any modified files to carry prominent notices
-       stating that You changed the files; and
-
-   (c) You must retain, in the Source form of any Derivative Works
-       that You distribute, all copyright, patent, trademark, and
-       attribution notices from the Source form of the Work,
-       excluding those notices that do not pertain to any part of
-       the Derivative Works; and
-
-   (d) If the Work includes a "NOTICE" text file as part of its
-       distribution, then any Derivative Works that You distribute must
-       include a readable copy of the attribution notices contained
-       within such NOTICE file, excluding those notices that do not
-       pertain to any part of the Derivative Works, in at least one
-       of the following places: within a NOTICE text file distributed
-       as part of the Derivative Works; within the Source form or
-       documentation, if provided along with the Derivative Works; or,
-       within a display generated by the Derivative Works, if and
-       wherever such third-party notices normally appear. The contents
-       of the NOTICE file are for informational purposes only and
-       do not modify the License. You may add Your own attribution
-       notices within Derivative Works that You distribute, alongside
-       or as an addendum to the NOTICE text from the Work, provided
-       that such additional attribution notices cannot be construed
-       as modifying the License.
-
-   You may add Your own copyright statement to Your modifications and
-   may provide additional or different license terms and conditions
-   for use, reproduction, or distribution of Your modifications, or
-   for any such Derivative Works as a whole, provided Your use,
-   reproduction, and distribution of the Work otherwise complies with
-   the conditions stated in this License.
-
-5. Submission of Contributions. Unless You explicitly state otherwise,
-   any Contribution intentionally submitted for inclusion in the Work
-   by You to the Licensor shall be under the terms and conditions of
-   this License, without any additional terms or conditions.
-   Notwithstanding the above, nothing herein shall supersede or modify
-   the terms of any separate license agreement you may have executed
-   with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade
-   names, trademarks, service marks, or product names of the Licensor,
-   except as required for reasonable and customary use in describing the
-   origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or
-   agreed to in writing, Licensor provides the Work (and each
-   Contributor provides its Contributions) on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-   implied, including, without limitation, any warranties or conditions
-   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-   PARTICULAR PURPOSE. You are solely responsible for determining the
-   appropriateness of using or redistributing the Work and assume any
-   risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory,
-   whether in tort (including negligence), contract, or otherwise,
-   unless required by applicable law (such as deliberate and grossly
-   negligent acts) or agreed to in writing, shall any Contributor be
-   liable to You for damages, including any direct, indirect, special,
-   incidental, or consequential damages of any character arising as a
-   result of this License or out of the use or inability to use the
-   Work (including but not limited to damages for loss of goodwill,
-   work stoppage, computer failure or malfunction, or any and all
-   other commercial damages or losses), even if such Contributor
-   has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing
-   the Work or Derivative Works thereof, You may choose to offer,
-   and charge a fee for, acceptance of support, warranty, indemnity,
-   or other liability obligations and/or rights consistent with this
-   License. However, in accepting such obligations, You may act only
-   on Your own behalf and on Your sole responsibility, not on behalf
-   of any other Contributor, and only if You agree to indemnify,
-   defend, and hold each Contributor harmless for any liability
-   incurred by, or claims asserted against, such Contributor by reason
-   of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work.
-
-   To apply the Apache License to your work, attach the following
-   boilerplate notice, with the fields enclosed by brackets "[]"
-   replaced with your own identifying information. (Don't include
-   the brackets!)  The text should be enclosed in the appropriate
-   comment syntax for the file format. We also recommend that a
-   file or class name and description of purpose be included on the
-   same "printed page" as the copyright notice for easier
-   identification within third-party archives.
-
-Copyright [yyyy] [name of copyright owner]
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-	http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-
-3. compiler_rt
-
-The compiler_rt library is dual licensed under both the University of Illinois
-"BSD-Like" license and the MIT license.  As a user of this code you may choose
-to use it under either license.  As a contributor, you agree to allow your code
-to be used under both.
-
-Full text of the relevant licenses is included below.
-
-=============================================================================
-
-University of Illinois/NCSA
-Open Source License
-
-Copyright (c) 2009-2013 by the contributors listed in CREDITS.TXT
-
-All rights reserved.
-
-Developed by:
-
-    LLVM Team
-
-    University of Illinois at Urbana-Champaign
-
-    http://llvm.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this
-software and associated documentation files (the "Software"), to deal with the
-Software without restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
-Software, and to permit persons to whom the Software is furnished to do so, subject
-to the following conditions:
-
--	Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimers.
-
--	Redistributions in binary form must reproduce the above copyright notice,
-this list of conditions and the following disclaimers in the documentation and/or
-other materials provided with the distribution.
-
--	Neither the names of the LLVM Team, University of Illinois at Urbana-Champaign,
-nor the names of its contributors may be used to endorse or romote products derived
-from this Software without specific prior written permission.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
-OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS WITH THE SOFTWARE.
-
-=============================================================================
 
-Copyright (c) 2009-2013 by the contributors listed in CREDITS.TXT
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this
-software and associated documentation files (the "Software"), to deal in the Software
-without restriction, including without limitation the rights to use, copy, modify, merge,
-publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or
-substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
-FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-
-=============================================================================
-Copyrights and Licenses for Third Party Software Distributed with LLVM:
-=============================================================================
-The LLVM software contains code written by third parties.  Such software will have its
-own individual LICENSE.TXT file in the directory in which it appears.
-This file will describe the copyrights, license, and restrictions which apply to that code.
-
-The disclaimer of warranty in the University of Illinois Open Source License applies to all
-code in the LLVM Distribution, and nothing in any of the other licenses gives permission to
-use the names of the LLVM Team or the University of Illinois to endorse or promote products
-derived from this Software.
+OpenBSD* Copyright Policy
+-------------------------
 
-The following pieces of software have additional or alternate copyrights, licenses, and/or
-restrictions:
+common/inc
 
-Program             Directory
--------             ---------
-mach_override       lib/interception/mach_override
 
+BSD 2-Clauses License
+---------------------
 
+common/inc
 
-4. NetBSD
 
-===============================================================================================
+The University of Illinois "BSD-Like" license
+---------------------------------------------
 
-/*-
- * Copyright (c) 2008 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-________________________________________
-For complete copyright and licensing terms, see: http://www.netbsd.org/about/redistribution.html
-
-
-
-
-5. OpenBSD
-
-http://openbsd.org/
+compiler_rt
 
-OpenBSD* Copyright Policy
-________________________________________
--	Goal
-Copyright law is complex, OpenBSD* policy is simple - OpenBSD strives to maintain the spirit
-of the original Berkeley Unix copyrights.
-OpenBSD can exist as it does today because of the example set by the Computer Systems Research
-Group at Berkeley and the battles which they and others fought to create a relatively
-un-encumbered Unix source distribution.
-The ability of a freely redistributable "Berkeley" Unix to move forward on a competitive
-basis with other operating systems depends on the willingness of the various development
-groups to exchange code amongst themselves and with other projects. Understanding the legal
-issues surrounding copyright is fundamental to the ability to exchange and re-distribute code,
-while honoring the spirit of the copyright and concept of attribution is fundamental to
-promoting the cooperation of the people involved.
--	The Berkeley* Copyright
-The Berkeley* copyright poses no restrictions on private or commercial use of the software
-and imposes only simple and uniform requirements for maintaining copyright notices in
-redistributed versions and crediting the originator of the material only in advertising.
-For instance:
- * Copyright (c) 1982, 1986, 1990, 1991, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
- *
-Berkeley rescinded the 3rd term (the advertising term) on 22 July 1999. Verbatim copies
-of the Berkeley license in the OpenBSD tree have that term removed. In addition, many
-3rd-party BSD-style licenses consist solely of the first two terms.
-Because the OpenBSD copyright imposes no conditions beyond those imposed by the Berkeley
-copyright, OpenBSD can hope to share the same wide distribution and applicability as the
-Berkeley distributions. It follows however, that OpenBSD cannot include material which
-includes copyrights which are more restrictive than the Berkeley copyright, or must
-relegate this material to a secondary status, i.e. OpenBSD as a whole is freely
-redistributable, but some optional components may not be.
--	Copyright Law
-While the overall subject of copyright law is far beyond the scope of this document, some
-basics are in order. Under the current copyright law, copyrights are implicit in the
-creation of a new work and reside with the creator, unless otherwise assigned. In general
-the copyright applies only to the new work, not the material the work was derived from,
-nor those portions of the derivative material included in the new work.
-Copyright law admits to three general categories of works:
-Original Work
-A new work that is not derived from an existing work.
-Derivative Work
-Work that is derived from, includes or amends existing works.
-Compilations
-A work that is a compilation of existing new and derivative works.
-The fundamental concept is that there is primacy of the copyright, that is a copyright of a
-derivative work does not affect the rights held by the owner of the copyright of the original
-work, rather only the part added. Likewise the copyright of a compilation does not affect the
-rights of the owner of the included works, only the compilation as an entity.
-It is vitally important to understand that copyrights are broad protections as defined by
-national and international copyright law. The "copyright notices" usually included in source
-files are not copyrights, but rather notices that a party asserts that they hold copyright
-to the material or to part of the material. Typically these notices are associated with
-license terms which grant permissions subject to copyright law and with disclaimers that
-state the position of the copyright holder/distributor with respect to liability surrounding
-use of the material.
--	Permissions - the flip side
-Because copyrights arise from the creation of a work, rather than through a registration process,
-there needs to be a practical way to extend permission to use a work beyond what might be allowed
-by "fair use" provisions of the copyright laws.
-This permission typically takes the form of a "release" or "license" included in the work, which
-grants the additional uses beyond those granted by copyright law, usually subject to a variety of
-conditions. At one extreme sits "public domain" where the originator asserts that he imposes no
-restrictions on use of the material, at the other restrictive clauses that actually grant no
-additional rights or impose restrictive, discriminatory or impractical conditions on use of the
-work.
-Again, an important point to note is that the release and conditions can only apply to the
-portion of the work that was originated by the copyright holder - the holder of a copyright
-on a derivative work can neither grant additional permissions for use of the original work,
-nor impose more restrictive conditions for use of that work.
-Because copyright arises from the creation of a work and not the text or a registration process,
-removing or altering a copyright notice or associated release terms has no bearing on the
-existence of the copyright, rather all that is accomplished is to cast doubt upon whatever rights
-the person making the modifications had to use the material in the first place. Likewise, adding
-terms and conditions in conflict with the original terms and conditions does not supersede them,
-rather it casts doubts on the rights of the person making the amendments to use the material and
-creates confusion as to whether anyone can use the amended version or derivatives thereof.
-Finally, releases are generally binding on the material that they are distributed with. This means
-that if the originator of a work distributes that work with a release granting certain permissions,
-those permissions apply as stated, without discrimination, to all persons legitimately possessing
-a copy of the work. That means that having granted a permission, the copyright holder can not
-retroactively say that an individual or class of individuals are no longer granted those permissions.
-Likewise should the copyright holder decide to "go commercial" he can not revoke permissions already
-granted for the use of the work as distributed, though he may impose more restrictive permissions in
-his future distributions of that work.
--	Specific Cases
-This section attempts to summarize the position of OpenBSD relative to some commonly encountered
-copyrights.
-Berkeley*
-The Berkeley copyright is the model for the OpenBSD copyright. It retains the rights of the
-copyright holder, while imposing minimal conditions on the use of the copyrighted material.
-Material with Berkeley copyrights, or copyrights closely adhering to the Berkeley model can
-generally be included in OpenBSD.
-AT&amp;T*
-As part of its settlement with AT&amp;T*, Berkeley included an AT&amp;T copyright notice on some of the
-files in 4.4BSD lite and lite2. The terms of this license are identical to the standard Berkeley
-license.
-Additionally, OpenBSD includes some other AT&amp;T code with non-restrictive copyrights, such as the
-reference implementation of awk.
-Caldera*
-Caldera* (now known as the SCO group) is the current owner of the Unix code copyrights. On 23
-January 2002, the original Unix code (versions 1 through seven, including 32V) was freed by Caldera.
-This code is now available under a 4-term BSD-style license. As a result, it is now possible to
-incorporate real Unix code into OpenBSD (though this code is quite old and generally requires significant
-changes to bring it up to date).
-DEC*, Sun*, other manufacturers/software houses.
-In general OpenBSD does not include material copyrighted by manufacturers or software houses.
-Material may be included where the copyright owner has granted general permission for reuse
-without conditions, with terms similar to the Berkeley copyright, or where the material is the
-product of an employee and the employer's copyright notice effectively releases any rights they
-might have to the work.
-Carnegie-Mellon* (CMU, Mach)
-The Carnegie-Mellon copyright is similar to the Berkeley copyright, except that it requests that
-derivative works be made available to Carnegie-Mellon. Because this is only a request and not a
-condition, such material can still be included in OpenBSD. It should be noted that existing
-versions of Mach are still subject to AT&amp;T copyrights, which prevents the general distribution
-of Mach sources.
-Apache*
-The original Apache* copyright is similar to the Berkeley copyright, except that it stipulates
-that products derived from the code may not have "Apache" in their name. The purpose of this
-clause is to avoid a situation in which another party releases a modified version of the code
-named in such a way to make users think that it is the "official" version. This is not an issue
-with OpenBSD because OpenBSD is a Compilation, and not a Derived Work. Source code published under
-version 2 of the Apache license cannot be included into OpenBSD. As a consequence, OpenBSD now
-maintains its own version of Apache based on version 1.3.29. The OpenBSD version includes many
-enhancements and bugfixes.
-ISC*
-The ISC* copyright is functionally equivalent to a two-term BSD copyright with language removed
-that is made unnecessary by the Berne convention. This is the preferred license for new code
-incorporated into OpenBSD. A sample license is included in the source tree as
-/usr/src/share/misc/license.template.
-GNU* General Public License, GPL, LGPL, copyleft, etc.
-The GNU* Public License and licenses modeled on it impose the restriction that source code must
-be distributed or made available for all works that are derivatives of the GNU copyrighted code.
-While this may be a noble strategy in terms of software sharing, it is a condition that is
-typically unacceptable for commercial use of software. As a consequence, software bound by the
-GPL terms can not be included in the kernel or "runtime" of OpenBSD, though software subject to
- GPL terms may be included as development tools or as part of the system that are "optional" as
-long as such use does not result in OpenBSD as a whole becoming subject to the GPL terms.
-As an example, GCC and other GNU tools are included in the OpenBSD tool chain. However, it is
-quite possible to distribute a system for many applications without a tool chain, or the
-distributor can choose to include a tool chain as an optional bundle which conforms to the
-GPL terms.
-NetBSD*
-Much of OpenBSD is originally based on and evolved from NetBSD*, since some of the OpenBSD
-developers were involved in the NetBSD project. The general NetBSD license terms are compatible
-with the Berkeley license and permit such use. Material subject only to the general NetBSD license
-can generally be included in OpenBSD.
-In the past, NetBSD has included material copyrighted by individuals who have imposed license
-conditions beyond that of the general NetBSD license, but granted the NetBSD Foundation license
-to distribute the material. Such material can not be included in OpenBSD as long as the conditions
-imposed are at odds with the OpenBSD license terms or releases from those terms are offered on a
-discriminatory basis.
-FreeBSD*
-Most of FreeBSD* is also based on Berkeley licensed material or includes copyright notices based
-on the Berkeley model. Such material can be included in OpenBSD, while those parts that are subject
-to GPL or various individual copyright terms that are at odds with the OpenBSD license can not be
-included in OpenBSD.
-Linux*
-Most of Linux* is subject to GPL style licensing terms and therefore can not be included in
-OpenBSD. Individual components may be eligible, subject to the terms of the originator's copyright
-notices. Note that Linux "distributions" may also be subject to additional copyright claims of the
-distributing organization, either as a compilation or on material included that is not part of the
-Linux core.
-X*, XFree86*, X.Org*
-X*, X.Org* or XFree86* are not parts of OpenBSD, rather X.Org and parts of XFree86 3.3.6 are
-distributed with many OpenBSD ports as a convenience to the user, subject to applicable license
-terms.
-Shareware, Charityware, Freeware, etc.
-Most "shareware" copyright notices impose conditions for redistribution, use or visibility that
-are at conflict with the OpenBSD project goals. Review on a case-by-case basis is required as to
-whether the wording of the conditions is acceptable in terms of conditions being requested vs.
-demanded and whether the spirit of the conditions is compatible with goals of the OpenBSD project.
-Public Domain
-While material that is truly entered into the "Public Domain" can be included in OpenBSD, review
-is required on a case by case basis. Frequently the "public domain" assertion is made by someone
-who does not really hold all rights under Copyright law to grant that status or there are a variety
-of conditions imposed on use. For a work to be truly in the "Public Domain" all rights are abandoned
-and the material is offered without restrictions.
diff --git a/Readme.md b/Readme.md
index 358911a..9cc8958 100644
--- a/Readme.md
+++ b/Readme.md
@@ -3,29 +3,37 @@
 [![Gitter](https://badges.gitter.im/rust-sgx-sdk/community.svg)](https://gitter.im/rust-sgx-sdk/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
 
 # Rust SGX SDK
-Rust SGX SDK helps developers write Intel SGX applications in Rust programming language. [[Paper pdf]](documents/ccsp17.pdf)
+Rust SGX SDK helps developers write Intel SGX applications in Rust programming language. [[CCS'17 Paper pdf]](documents/ccsp17.pdf) [[CCS'19 Paper pdf]](https://dingelish.com/ccs19.pdf)
 
-Good news! Our paper "Towards Memory Safety for Enclave Programs with Rust-SGX" has been accepted in ACM CCS'19. See you guys in London!
+Good News! Our paper "Building and Maintaining a Third-Party Library Supply Chain for Productive and Secure SGX Enclave Development" has been accepted by ICSE'20 SEIP track. See you guys in Seoul!
 
 We open-sourced [gbdt-rs](https://github.com/mesalock-linux/gbdt-rs), a light-weight, amazingly fast, memory safe, and trustworthy gradient boosting decision tree implementation and the [paper](documents/gbdt.pdf) has been accepted by IEEE S&P'19! It is optimized for SGX!
 
-To achieve better security, we recommend developers to apply [Non-bypassable Security Paradigm (NbSP)](https://github.com/baidu/rust-sgx-sdk/blob/master/documents/nbsp.pdf) to the system design and implementation.
+To achieve better security, we recommend developers to apply [Non-bypassable Security Paradigm (NbSP)](https://github.com/apache/teaclave-sgx-sdk/blob/master/documents/nbsp.pdf) to the system design and implementation.
 
-To help understand this project and know how to use it, we are writing some [wiki](https://github.com/baidu/rust-sgx-sdk/wiki) articles. Please [send me an email](mailto:rustsgx@gmail.com?subject=Wiki%20page%20needed:) if you'd like to see other topics. We'll add it as soon as possible.
+To help understand this project and know how to use it, we are writing some [wiki](https://github.com/apache/teaclave-sgx-sdk/wiki) articles. Please [send me an email](mailto:rustsgx@gmail.com?subject=Wiki%20page%20needed:) if you'd like to see other topics. We'll add it as soon as possible.
 
 Current wiki pages:
 
-* [The World of Forked crates](https://github.com/baidu/rust-sgx-sdk/wiki/The-World-of-Forked-crates) introduces the forked crate ecosystem, and provides some guidelines and usage, and show how we secure them.
+* [Mitigation of Intel SA 00219 in Rust SGX](https://github.com/apache/incubator-mesatee-sgx/wiki/Mitigation-of-Intel-SA-00219-in-Rust-SGX)
 
-* [Setup gdb 7.11 on Ubuntu 18.04 for VSCode sgx-gdb remote debugging](https://github.com/baidu/rust-sgx-sdk/wiki/Setup-gdb-7.11-on-Ubuntu-18.04-for-VSCode---sgx-gdb-remote-debugging) If you encounter errors like `gdb.error: syntax error in expression, near )0x7ffff4127370 = 0.`, probably you need to follow this instruction to setup gdb 7. Thanks to @akoskinas for this great instruction!
+* [`is_x86_feature_detected` in Rust SGX SDK](https://github.com/apache/incubator-mesatee-sgx/wiki/%60is_x86_feature_detected%60-in-Rust-SGX-SDK)
 
-* [Performance Optimization Tips](https://github.com/baidu/rust-sgx-sdk/wiki/Performance-Optimization-Tips)
+* [The World of Forked crates](https://github.com/apache/teaclave-sgx-sdk/wiki/The-World-of-Forked-crates) introduces the forked crate ecosystem, and provides some guidelines and usage, and show how we secure them.
 
-* [Use VSCode rls+rust-analysis+sgx-gdb for graphic developing (not in docker)](https://github.com/baidu/rust-sgx-sdk/wiki/Use-VSCode---rls---rust-analysis---sgx-gdb-for-graphic-developing-(not-in-docker))
+* [Setup gdb 7.11 on Ubuntu 18.04 for VSCode sgx-gdb remote debugging](https://github.com/apache/teaclave-sgx-sdk/wiki/Setup-gdb-7.11-on-Ubuntu-18.04-for-VSCode---sgx-gdb-remote-debugging) If you encounter errors like `gdb.error: syntax error in expression, near )0x7ffff4127370 = 0.`, probably you need to follow this instruction to setup gdb 7. Thanks to @akoskinas for this great instruction!
 
-* [Debugging local enclave in docker](https://github.com/baidu/rust-sgx-sdk/wiki/Debugging-a-local-Rust-SGX-enclave-in-docker-with-sgx-gdb)
+* [Performance Optimization Tips](https://github.com/apache/teaclave-sgx-sdk/wiki/Performance-Optimization-Tips)
 
-* Everything about [environment setup](https://github.com/baidu/rust-sgx-sdk/wiki/Environment-Setup)
+* [Use VSCode rls+rust-analysis+sgx-gdb for graphic developing (not in docker)](https://github.com/apache/teaclave-sgx-sdk/wiki/Use-VSCode---rls---rust-analysis---sgx-gdb-for-graphic-developing-(not-in-docker))
+
+* [Debugging local enclave in docker](https://github.com/apache/teaclave-sgx-sdk/wiki/Debugging-a-local-Rust-SGX-enclave-in-docker-with-sgx-gdb)
+
+* Everything about [environment setup](https://github.com/apache/teaclave-sgx-sdk/wiki/Environment-Setup)
+
+## v1.1.0
+
+Supports Intel SGX SDK v2.7.1, and Rust nightly-2019-11-25. v1.1.0 brings up dynamic static supports by `thread::spawn`, and almost everything of `std::sync`. Also v1.1.0 benefits from Intel SGX SDK's aligned memory allocation primitives to mitigate [INTEL-SA-00219](https://github.com/apache/incubator-mesatee-sgx/wiki/Mitigation-of-Intel-SA-00219-in-Rust-SGX). Besides, we enabled [`is_x86_feature_detected!`](https://github.com/apache/incubator-mesatee-sgx/wiki/%60is_x86_feature_detected% [...]
 
 ## v1.0.9 Release
 
@@ -64,7 +72,7 @@ This version supports Rust nightly build (nightly-2018-10-01) in the master bran
 This version supports the Rust nightly build (nightly-2018-07-16) in master branch and the most recent Rust stable build (stable-2018-07-10). And it supports the latest Intel SGX SDK **v2.2**. New third party libraries include: bytes, http, iovec, rust-crypto, rust-fnv and rust-threshold-secret-sharing. New code sample 'secretsharing' and 'rust-threshold-secret-sharing' is provided by @davidp94. Please refer to [release_notes](release_notes.md) for further details.
 
 ## v1.0.0 Release
-We proudly announce v1.0.0 of rust-sgx-sdk! We port Parity's [Webassembly Interpreter](https://github.com/paritytech/wasmi) to Intel SGX and provide a full functional in-enclave [wasmi sample](samplecode/wasmi), and a [sample solution](samplecode/psi) of two-party private-set-intersection resisting side-channel attacks! From this version, we start to support most recent stable branch of Rust instead of nightly for better stability and future production use. Thus, the [stable branch](http [...]
+We proudly announce v1.0.0 of rust-sgx-sdk! We port Parity's [Webassembly Interpreter](https://github.com/paritytech/wasmi) to Intel SGX and provide a full functional in-enclave [wasmi sample](samplecode/wasmi), and a [sample solution](samplecode/psi) of two-party private-set-intersection resisting side-channel attacks! From this version, we start to support most recent stable branch of Rust instead of nightly for better stability and future production use. Thus, the [stable branch](http [...]
 
 ## v0.9.8 Release
 This version provides security updates regards to recent Spectre attacks in Intel SGX, and supports **Rust stable (2018-03-01)** (in branch named 'rust-stable'). It contains support of [Intel SGX SDK 2.1.2](https://download.01.org/intel-sgx/linux-2.1.2/) and a series of API functions to stop speculative execution on demand. In addition, we provide a ported version of [rust-protobuf](https://crates.io/crates/protobuf) v1.4.4. Please refer to [release_notes](release_notes.md) for further details.
@@ -238,8 +246,6 @@ Baidu Rust-SGX SDK is provided under the BSD license. Please refer to the [Licen
 
 Ran Duan, Long Li, Shi Jia, Yu Ding, Yulong Zhang, Yueqiang Cheng, Lenx Wei, Tanghui Chen
 
-![Baidu X-Lab Logo](https://raw.githubusercontent.com/baidu/rust-sgx-sdk/master/logo_25.png)
-
 # Acknowledgement
 
 Thanks to [Prof. Jingqiang Lin](http://people.ucas.ac.cn/~0010268) for his contribution to this project.
diff --git a/buildenv.mk b/buildenv.mk
index 3ff3c3f..6c9a7b6 100644
--- a/buildenv.mk
+++ b/buildenv.mk
@@ -1,31 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
-# 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 Baidu, Inc., 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.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License..
 #
 #
 
diff --git a/common/inc/assert.h b/common/inc/assert.h
index 82489e8..a153995 100644
--- a/common/inc/assert.h
+++ b/common/inc/assert.h
@@ -1,5 +1,5 @@
-/*	$OpenBSD: assert.h,v 1.12 2006/01/31 10:53:51 hshoexer Exp $	*/
-/*	$NetBSD: assert.h,v 1.6 1994/10/26 00:55:44 cgd Exp $	*/
+/*  $OpenBSD: assert.h,v 1.12 2006/01/31 10:53:51 hshoexer Exp $    */
+/*  $NetBSD: assert.h,v 1.6 1994/10/26 00:55:44 cgd Exp $           */
 
 /*-
  * Copyright (c) 1992, 1993
diff --git a/common/inc/complex.h b/common/inc/complex.h
index 93fe495..904cb31 100644
--- a/common/inc/complex.h
+++ b/common/inc/complex.h
@@ -1,4 +1,4 @@
-/*	$OpenBSD: complex.h,v 1.3 2010/07/24 22:17:03 guenther Exp $	*/
+/*  $OpenBSD: complex.h,v 1.3 2010/07/24 22:17:03 guenther Exp $    */
 /*
  * Copyright (c) 2008 Martynas Venckus <ma...@openbsd.org>
  *
@@ -16,7 +16,7 @@
  */
 
 #ifndef _COMPLEX_H_
-#define	_COMPLEX_H_
+#define _COMPLEX_H_
 
 #include <sys/cdefs.h>
 
@@ -25,18 +25,18 @@
  */
 #ifdef __GNUC__
 #if __STDC_VERSION__ < 199901
-#define _Complex	__complex__
+#define _Complex    __complex__
 #endif
-#define _Complex_I	1.0fi
+#define _Complex_I  1.0fi
 #elif defined(lint)
-#define _Complex_I	1.0fi
+#define _Complex_I  1.0fi
 #endif
 
-#define complex		_Complex
+#define complex     _Complex
 
 /* XXX switch to _Imaginary_I */
 #undef I
-#define I		_Complex_I
+#define I           _Complex_I
 
 __BEGIN_DECLS
 /*
diff --git a/common/inc/ctype.h b/common/inc/ctype.h
index 1408447..4449d74 100644
--- a/common/inc/ctype.h
+++ b/common/inc/ctype.h
@@ -34,7 +34,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)ctype.h	5.3 (Berkeley) 4/3/91
+ *  @(#)ctype.h 5.3 (Berkeley) 4/3/91
  */
 
 #ifndef _CTYPE_H_
diff --git a/common/inc/dirent.h b/common/inc/dirent.h
index b3b85e8..49d612a 100644
--- a/common/inc/dirent.h
+++ b/common/inc/dirent.h
@@ -29,7 +29,7 @@ struct dirent
 #endif
     unsigned short int d_reclen;
     unsigned char d_type;
-    char d_name[256];		/* We must not include limits.h! */
+    char d_name[256];       /* We must not include limits.h! */
 };
 
 //#ifdef __USE_LARGEFILE64
@@ -39,11 +39,11 @@ struct dirent64
     __off64_t d_off;
     unsigned short int d_reclen;
     unsigned char d_type;
-    char d_name[256];		/* We must not include limits.h! */
+    char d_name[256];       /* We must not include limits.h! */
 };
 //#endif
 
-#define d_fileno	d_ino	/* Backwards compatibility.  */
+#define d_fileno	d_ino   /* Backwards compatibility.  */
 
 #undef  _DIRENT_HAVE_D_NAMLEN
 #define _DIRENT_HAVE_D_RECLEN
@@ -52,8 +52,8 @@ struct dirent64
 
 #if defined __OFF_T_MATCHES_OFF64_T && defined __INO_T_MATCHES_INO64_T
 /* Inform libc code that these two types are effectively identical.  */
-# define _DIRENT_MATCHES_DIRENT64	1
+# define _DIRENT_MATCHES_DIRENT64   1
 #else
-# define _DIRENT_MATCHES_DIRENT64	0
+# define _DIRENT_MATCHES_DIRENT64   0
+#endif
 #endif
-#endif
\ No newline at end of file
diff --git a/common/inc/endian.h b/common/inc/endian.h
index fcd74c9..2620c58 100644
--- a/common/inc/endian.h
+++ b/common/inc/endian.h
@@ -1,4 +1,4 @@
-/*	$OpenBSD: endian.h,v 1.18 2006/03/27 07:09:24 otto Exp $	*/
+/*  $OpenBSD: endian.h,v 1.18 2006/03/27 07:09:24 otto Exp $    */
 
 /*-
  * Copyright (c) 1997 Niklas Hallqvist.  All rights reserved.
diff --git a/common/inc/errno.h b/common/inc/errno.h
index 0924d5a..dbe293c 100644
--- a/common/inc/errno.h
+++ b/common/inc/errno.h
@@ -1,4 +1,4 @@
-/*	$OpenBSD: errno.h,v 1.1 2005/12/28 16:33:56 millert Exp $	*/
+/*  $OpenBSD: errno.h,v 1.1 2005/12/28 16:33:56 millert Exp $   */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -33,7 +33,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)errno.h	8.5 (Berkeley) 1/21/94
+ *  @(#)errno.h 8.5 (Berkeley) 1/21/94
  */
 
 #ifndef	_ERRNO_H_
@@ -180,7 +180,7 @@ __BEGIN_DECLS
 
 #ifndef errno
 int * _TLIBC_CDECL_ __errno(void);
-#define	errno (*__errno())
+#define errno   (*__errno())
 #endif /* errno */
 __END_DECLS
 
diff --git a/common/inc/float.h b/common/inc/float.h
index 5ca839a..e38a7c6 100644
--- a/common/inc/float.h
+++ b/common/inc/float.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: float.h,v 1.3 2008/07/21 20:50:54 martynas Exp $ */
-/* $NetBSD: float.h,v 1.8 1995/06/20 20:45:37 jtc Exp $ */
+/*  $OpenBSD: float.h,v 1.3 2008/07/21 20:50:54 martynas Exp $  */
+/*  $NetBSD: float.h,v 1.8 1995/06/20 20:45:37 jtc Exp $    */
 
 /*
  * Copyright (c) 1989 Regents of the University of California.
diff --git a/common/inc/iso646.h b/common/inc/iso646.h
index 83feb52..a0c341b 100644
--- a/common/inc/iso646.h
+++ b/common/inc/iso646.h
@@ -1,5 +1,5 @@
-/*	$OpenBSD: iso646.h,v 1.3 2001/10/11 00:05:21 espie Exp $	*/
-/*	$NetBSD: iso646.h,v 1.1 1995/02/17 09:08:10 jtc Exp $	*/
+/*  $OpenBSD: iso646.h,v 1.3 2001/10/11 00:05:21 espie Exp $  */
+/*  $NetBSD: iso646.h,v 1.1 1995/02/17 09:08:10 jtc Exp $     */
 
 /*
  * Written by J.T. Conklin <jt...@wimsey.com> 02/16/95.
diff --git a/common/inc/limits.h b/common/inc/limits.h
index fab59c9..9d42cb5 100644
--- a/common/inc/limits.h
+++ b/common/inc/limits.h
@@ -1,5 +1,5 @@
-/*	$OpenBSD: limits.h,v 1.15 2008/02/10 09:59:54 kettenis Exp $	*/
-/*	$NetBSD: limits.h,v 1.7 1994/10/26 00:56:00 cgd Exp $	*/
+/*  $OpenBSD: limits.h,v 1.15 2008/02/10 09:59:54 kettenis Exp $    */
+/*  $NetBSD: limits.h,v 1.7 1994/10/26 00:56:00 cgd Exp $           */
 
 /*
  * Copyright (c) 1988 The Regents of the University of California.
@@ -29,7 +29,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)limits.h	5.9 (Berkeley) 4/3/91
+ *  @(#)limits.h    5.9 (Berkeley) 4/3/91
  */
 
 
diff --git a/common/inc/math.h b/common/inc/math.h
index 749f935..6ea425b 100644
--- a/common/inc/math.h
+++ b/common/inc/math.h
@@ -1,4 +1,4 @@
-/*	$OpenBSD: math.h,v 1.27 2010/12/14 11:16:15 martynas Exp $	*/
+/*  $OpenBSD: math.h,v 1.27 2010/12/14 11:16:15 martynas Exp $  */
 /*
  * ====================================================
  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
@@ -145,7 +145,7 @@ double _TLIBC_CDECL_ tgamma(double);
 
 double _TLIBC_CDECL_ nearbyint(double);
 double _TLIBC_CDECL_ rint(double);
-long int _TLIBC_CDECL_ lrint(double); 
+long int _TLIBC_CDECL_ lrint(double);
 long long int _TLIBC_CDECL_ llrint(double);
 double _TLIBC_CDECL_ round(double);
 long int _TLIBC_CDECL_ lround(double);
diff --git a/common/inc/mbusafecrt.h b/common/inc/mbusafecrt.h
index 466c550..3bdfe7a 100644
--- a/common/inc/mbusafecrt.h
+++ b/common/inc/mbusafecrt.h
@@ -1,6 +1,6 @@
 //
 // Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information. 
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
 //
 
 /***
@@ -80,4 +80,4 @@ extern errno_t memmove_s( void * dst, size_t sizeInBytes, const void * src, size
     }
 #endif
 
-#endif	/* MBUSAFECRT_H */
+#endif  /* MBUSAFECRT_H */
diff --git a/common/inc/netdb.h b/common/inc/netdb.h
new file mode 100644
index 0000000..5b39fce
--- /dev/null
+++ b/common/inc/netdb.h
@@ -0,0 +1,37 @@
+  /* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* All data returned by the network data base library are supplied in
+   host order and returned in network order (suitable for use in
+   system calls).  */
+
+#ifndef _NETDB_H
+#define _NETDB_H
+
+struct addrinfo
+{
+    int ai_flags;               /* Input flags.  */
+    int ai_family;              /* Protocol family for socket.  */
+    int ai_socktype;            /* Socket type.  */
+    int ai_protocol;            /* Protocol for socket.  */
+    socklen_t ai_addrlen;       /* Length of socket address.  */
+    struct sockaddr *ai_addr;   /* Socket address for socket.  */
+    char *ai_canonname;         /* Canonical name for service location.  */
+    struct addrinfo *ai_next;   /* Pointer to next in list.  */
+};
+
+#endif
diff --git a/common/inc/poll.h b/common/inc/poll.h
index 35815a9..1a070e0 100644
--- a/common/inc/poll.h
+++ b/common/inc/poll.h
@@ -7,9 +7,9 @@ typedef unsigned long int nfds_t;
 /* Data structure describing a polling request.  */
 struct pollfd
 {
-    int fd;			/* File descriptor to poll.  */
-    short int events;		/* Types of events poller cares about.  */
-    short int revents;		/* Types of events that actually occurred.  */
+    int fd;             /* File descriptor to poll.  */
+    short int events;   /* Types of events poller cares about.  */
+    short int revents;  /* Types of events that actually occurred.  */
 };
 
 #endif
diff --git a/common/inc/pthread.h b/common/inc/pthread.h
new file mode 100644
index 0000000..e79668f
--- /dev/null
+++ b/common/inc/pthread.h
@@ -0,0 +1,34 @@
+#ifndef _SYS_THREAD_H_
+#define _SYS_THREAD_H_
+
+/* Thread identifiers.  The structure of the attribute type is not
+   exposed on purpose.  */
+typedef unsigned long int pthread_t;
+
+#if defined __x86_64__ && !defined __ILP32__
+# define __WORDSIZE 64
+#else
+# define __WORDSIZE 32
+#define __WORDSIZE32_SIZE_ULONG     0
+#define __WORDSIZE32_PTRDIFF_LONG   0
+#endif
+
+#ifdef __x86_64__
+# if __WORDSIZE == 64
+#  define __SIZEOF_PTHREAD_ATTR_T   56
+# else
+#  define __SIZEOF_PTHREAD_ATTR_T   32
+#endif
+
+union pthread_attr_t
+{
+    char __size[__SIZEOF_PTHREAD_ATTR_T];
+    long int __align;
+};
+#ifndef __have_pthread_attr_t
+typedef union pthread_attr_t pthread_attr_t;
+# define __have_pthread_attr_t 1
+#endif
+
+#endif
+#endif
diff --git a/common/inc/sys/struct_timespec.h b/common/inc/pwd.h
similarity index 61%
copy from common/inc/sys/struct_timespec.h
copy to common/inc/pwd.h
index f2ac6d7..fc947d8 100644
--- a/common/inc/sys/struct_timespec.h
+++ b/common/inc/pwd.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -15,17 +15,22 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SYS_TIMESPEC_H_
-#define _SYS_TIMESPEC_H_
+/*
+ *	POSIX Standard: 9.2.2 User Database Access	<pwd.h>
+ */
 
-#include <sys/_types.h>
+#ifndef _PWD_H
+#define _PWD_H
 
-/* POSIX.1b structure for a time value.  This is like a `struct timeval' but
-   has nanoseconds instead of microseconds.  */
-struct timespec
+struct passwd
 {
-	__time_t 	tv_sec;		/* Seconds.  */
-	long 	   	tv_nsec;	/* Nanoseconds.  */
+    char *pw_name;      /* Username.  */
+    char *pw_passwd;    /* Password.  */
+    __uid_t pw_uid;     /* User ID.  */
+    __gid_t pw_gid;     /* Group ID.  */
+    char *pw_gecos;     /* Real name.  */
+    char *pw_dir;       /* Home directory.  */
+    char *pw_shell;     /* Shell program.  */
 };
 
 #endif
diff --git a/common/inc/setjmp.h b/common/inc/setjmp.h
index 6954e2b..752f0cf 100644
--- a/common/inc/setjmp.h
+++ b/common/inc/setjmp.h
@@ -1,4 +1,4 @@
-/*	$NetBSD: setjmp.h,v 1.26 2011/11/05 09:27:06 joerg Exp $	*/
+/*  $NetBSD: setjmp.h,v 1.26 2011/11/05 09:27:06 joerg Exp $    */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -33,7 +33,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)setjmp.h	8.2 (Berkeley) 1/21/94
+ *  @(#)setjmp.h    8.2 (Berkeley) 1/21/94
  */
 
 #ifndef _SETJMP_H_
diff --git a/common/inc/stdarg.h b/common/inc/stdarg.h
index ed73e24..b2a5d36 100644
--- a/common/inc/stdarg.h
+++ b/common/inc/stdarg.h
@@ -1,5 +1,5 @@
-/*	$OpenBSD: stdarg.h,v 1.14 2010/12/30 05:01:36 tedu Exp $	*/
-/*	$NetBSD: stdarg.h,v 1.12 1995/12/25 23:15:31 mycroft Exp $	*/
+/*  $OpenBSD: stdarg.h,v 1.14 2010/12/30 05:01:36 tedu Exp $    */
+/*  $NetBSD: stdarg.h,v 1.12 1995/12/25 23:15:31 mycroft Exp $  */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -29,7 +29,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)stdarg.h	8.1 (Berkeley) 6/10/93
+ *  @(#)stdarg.h    8.1 (Berkeley) 6/10/93
  */
 
 #ifndef _STDARG_H_
diff --git a/common/inc/stdbool.h b/common/inc/stdbool.h
index bd1837e..86b866d 100644
--- a/common/inc/stdbool.h
+++ b/common/inc/stdbool.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: stdbool.h,v 1.5 2010/07/24 22:17:03 guenther Exp $ */
+/*  $OpenBSD: stdbool.h,v 1.5 2010/07/24 22:17:03 guenther Exp $    */
 
 /*
  * Written by Marc Espie, September 25, 1999
diff --git a/common/inc/stddef.h b/common/inc/stddef.h
index 84509c5..c132882 100644
--- a/common/inc/stddef.h
+++ b/common/inc/stddef.h
@@ -1,5 +1,5 @@
-/*	$OpenBSD: stddef.h,v 1.10 2009/09/22 21:40:02 jsg Exp $	*/
-/*	$NetBSD: stddef.h,v 1.4 1994/10/26 00:56:26 cgd Exp $	*/
+/*  $OpenBSD: stddef.h,v 1.10 2009/09/22 21:40:02 jsg Exp $ */
+/*  $NetBSD: stddef.h,v 1.4 1994/10/26 00:56:26 cgd Exp $   */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -29,7 +29,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)stddef.h	5.5 (Berkeley) 4/3/91
+ *  @(#)stddef.h    5.5 (Berkeley) 4/3/91
  */
 
 #ifndef _STDDEF_H_
diff --git a/common/inc/stdint.h b/common/inc/stdint.h
index d283ae9..e574484 100644
--- a/common/inc/stdint.h
+++ b/common/inc/stdint.h
@@ -1,4 +1,4 @@
-/*	$OpenBSD: stdint.h,v 1.4 2006/12/10 22:17:55 deraadt Exp $	*/
+/*  $OpenBSD: stdint.h,v 1.4 2006/12/10 22:17:55 deraadt Exp $  */
 
 /*
  * Copyright (c) 1997, 2005 Todd C. Miller <To...@courtesan.com>
@@ -16,7 +16,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#ifndef	_STDINT_H_
+#ifndef _STDINT_H_
 #define _STDINT_H_
 
 #include <sys/stdint.h>
diff --git a/common/inc/stdio.h b/common/inc/stdio.h
index 0175a3a..92d01a0 100644
--- a/common/inc/stdio.h
+++ b/common/inc/stdio.h
@@ -1,5 +1,5 @@
-/*	$OpenBSD: stdio.h,v 1.38 2009/11/09 00:18:27 kurt Exp $	*/
-/*	$NetBSD: stdio.h,v 1.18 1996/04/25 18:29:21 jtc Exp $	*/
+/*  $OpenBSD: stdio.h,v 1.38 2009/11/09 00:18:27 kurt Exp $ */
+/*  $NetBSD: stdio.h,v 1.18 1996/04/25 18:29:21 jtc Exp $   */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -32,7 +32,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)stdio.h	5.17 (Berkeley) 6/3/91
+ *  @(#)stdio.h 5.17 (Berkeley) 6/3/91
  */
 
 #ifndef _STDIO_H_
diff --git a/common/inc/stdlib.h b/common/inc/stdlib.h
index f321738..e5b6365 100644
--- a/common/inc/stdlib.h
+++ b/common/inc/stdlib.h
@@ -1,5 +1,5 @@
-/*	$OpenBSD: stdlib.h,v 1.47 2010/05/18 22:24:55 tedu Exp $	*/
-/*	$NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $	*/
+/*      $OpenBSD: stdlib.h,v 1.47 2010/05/18 22:24:55 tedu Exp $ */
+/*      $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $   */
 
 /*-
 * Copyright (c) 1990 The Regents of the University of California.
@@ -29,7 +29,7 @@
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
-*	@(#)stdlib.h	5.13 (Berkeley) 6/4/91
+*       @(#)stdlib.h    5.13 (Berkeley) 6/4/91
 */
 
 #ifndef _STDLIB_H_
diff --git a/common/inc/string.h b/common/inc/string.h
index 86d3cd2..0cc7206 100644
--- a/common/inc/string.h
+++ b/common/inc/string.h
@@ -1,5 +1,5 @@
-/*	$OpenBSD: string.h,v 1.20 2010/09/24 13:33:00 matthew Exp $	*/
-/*	$NetBSD: string.h,v 1.6 1994/10/26 00:56:30 cgd Exp $	*/
+/*  $OpenBSD: string.h,v 1.20 2010/09/24 13:33:00 matthew Exp $ */
+/*  $NetBSD: string.h,v 1.6 1994/10/26 00:56:30 cgd Exp $       */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -29,7 +29,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)string.h	5.10 (Berkeley) 3/9/91
+ *  @(#)string.h    5.10 (Berkeley) 3/9/91
  */
 
 #ifndef _STRING_H_
diff --git a/common/inc/sys/_types.h b/common/inc/sys/_types.h
index fc9f153..7768f18 100644
--- a/common/inc/sys/_types.h
+++ b/common/inc/sys/_types.h
@@ -1,4 +1,4 @@
-/*	$OpenBSD: _types.h,v 1.2 2008/03/16 19:42:57 otto Exp $	*/
+/*  $OpenBSD: _types.h,v 1.2 2008/03/16 19:42:57 otto Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -28,7 +28,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)types.h	8.3 (Berkeley) 1/5/94
+ *  @(#)types.h 8.3 (Berkeley) 1/5/94
  */
 
 #ifndef _SYS__TYPES_H_
@@ -83,9 +83,9 @@ typedef __uint64_t          __uint_fast64_t;
 
 typedef long                __off_t;
 #ifdef __x86_64__
-typedef long int 			__off64_t;
+typedef long int            __off64_t;
 #else
-typedef long long int 		__off64_t;
+typedef long long int       __off64_t;
 #endif
 
 /* 7.18.1.4 Integer types capable of holding object pointers */
@@ -138,25 +138,25 @@ typedef __int64_t           __intmax_t;
 typedef __uint64_t          __uintmax_t;
 
 
-typedef unsigned long int 		__ino_t;
-typedef unsigned int 			__mode_t;
-typedef unsigned int 			__uid_t;
-typedef unsigned int 			__gid_t;
-typedef long int 				__blksize_t;
-typedef long int 				__blkcnt_t;
+typedef unsigned long int       __ino_t;
+typedef unsigned int            __mode_t;
+typedef unsigned int            __uid_t;
+typedef unsigned int            __gid_t;
+typedef long int                __blksize_t;
+typedef long int                __blkcnt_t;
 
 #ifdef __x86_64__
-typedef unsigned long int 		__dev_t;
-typedef long int 				__off64_t;
-typedef unsigned long int		__nlink_t;
-typedef long int 				__blkcnt64_t;
-typedef unsigned long int 		__ino64_t;
+typedef unsigned long int       __dev_t;
+typedef long int                __off64_t;
+typedef unsigned long int       __nlink_t;
+typedef long int                __blkcnt64_t;
+typedef unsigned long int       __ino64_t;
 #else
-typedef unsigned long long int 	__dev_t;
-typedef long long int 			__off64_t;
-typedef unsigned int 			__nlink_t;
-typedef long long int 			__blkcnt64_t;
-typedef unsigned long long int 	__ino64_t;
+typedef unsigned long long int  __dev_t;
+typedef long long int           __off64_t;
+typedef unsigned int            __nlink_t;
+typedef long long int           __blkcnt64_t;
+typedef unsigned long long int  __ino64_t;
 #endif
 
 typedef unsigned int            __socklen_t;
diff --git a/common/inc/sys/cdefs.h b/common/inc/sys/cdefs.h
index a6fdb58..71c3c1c 100644
--- a/common/inc/sys/cdefs.h
+++ b/common/inc/sys/cdefs.h
@@ -1,5 +1,5 @@
-/*	$OpenBSD: cdefs.h,v 1.34 2012/08/14 20:11:37 matthew Exp $	*/
-/*	$NetBSD: cdefs.h,v 1.16 1996/04/03 20:46:39 christos Exp $	*/
+/*  $OpenBSD: cdefs.h,v 1.34 2012/08/14 20:11:37 matthew Exp $  */
+/*  $NetBSD: cdefs.h,v 1.16 1996/04/03 20:46:39 christos Exp $  */
 
 /*
  * Copyright (c) 1991, 1993
@@ -32,7 +32,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)cdefs.h	8.7 (Berkeley) 1/21/94
+ *  @(#)cdefs.h 8.7 (Berkeley) 1/21/94
  */
 
 #ifndef _SYS_CDEFS_H_
@@ -122,11 +122,11 @@
  *	  larger code.
  */
 #if defined(__GNUC__) && __GNUC_PREREQ__(2, 96)
-#define __predict_true(exp)	__builtin_expect(((exp) != 0), 1)
-#define __predict_false(exp)	__builtin_expect(((exp) != 0), 0)
+#define __predict_true(exp)     __builtin_expect(((exp) != 0), 1)
+#define __predict_false(exp)    __builtin_expect(((exp) != 0), 0)
 #else
-#define __predict_true(exp)	((exp) != 0)
-#define __predict_false(exp)	((exp) != 0)
+#define __predict_true(exp)     ((exp) != 0)
+#define __predict_false(exp)    ((exp) != 0)
 #endif
 
 #endif /* !_SYS_CDEFS_H_ */
diff --git a/common/inc/sys/endian.h b/common/inc/sys/endian.h
index 29edd81..1cd7b81 100644
--- a/common/inc/sys/endian.h
+++ b/common/inc/sys/endian.h
@@ -1,4 +1,4 @@
-/*	$OpenBSD: endian.h,v 1.18 2006/03/27 07:09:24 otto Exp $	*/
+/*  $OpenBSD: endian.h,v 1.18 2006/03/27 07:09:24 otto Exp $    */
 
 /*-
  * Copyright (c) 1997 Niklas Hallqvist.  All rights reserved.
diff --git a/common/inc/sys/epoll.h b/common/inc/sys/epoll.h
index f464db4..c07830d 100644
--- a/common/inc/sys/epoll.h
+++ b/common/inc/sys/epoll.h
@@ -15,23 +15,23 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef	_SYS_EPOLL_H
-#define	_SYS_EPOLL_H
+#ifndef _SYS_EPOLL_H
+#define _SYS_EPOLL_H
 
 #define __EPOLL_PACKED __attribute__ ((__packed__))
 
 typedef union epoll_data
 {
-  void *ptr;
-  int fd;
-  uint32_t u32;
-  uint64_t u64;
+    void *ptr;
+    int fd;
+    uint32_t u32;
+    uint64_t u64;
 } epoll_data_t;
 
 struct epoll_event
 {
-  uint32_t events;	/* Epoll events */
-  epoll_data_t data;	/* User data variable */
+    uint32_t events;    /* Epoll events */
+    epoll_data_t data;  /* User data variable */
 } __EPOLL_PACKED;
 
-#endif
\ No newline at end of file
+#endif
diff --git a/common/inc/sys/ieee.h b/common/inc/sys/ieee.h
index 8370cd8..eab3b97 100644
--- a/common/inc/sys/ieee.h
+++ b/common/inc/sys/ieee.h
@@ -1,5 +1,5 @@
-/*	$OpenBSD: ieee.h,v 1.2 2008/09/07 20:36:06 martynas Exp $ */
-/*	$NetBSD: ieee.h,v 1.1 1996/09/30 16:34:25 ws Exp $ */
+/*  $OpenBSD: ieee.h,v 1.2 2008/09/07 20:36:06 martynas Exp $   */
+/*  $NetBSD: ieee.h,v 1.1 1996/09/30 16:34:25 ws Exp $  */
 
 /*
  * Copyright (c) 1992, 1993
@@ -38,7 +38,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)ieee.h	8.1 (Berkeley) 6/11/93
+ *  @(#)ieee.h  8.1 (Berkeley) 6/11/93
  */
 
 /*
@@ -50,27 +50,27 @@
 /*
  * Define the number of bits in each fraction and exponent.
  *
- *		     k	         k+1
+ *              k           k+1
  * Note that  1.0 x 2  == 0.1 x 2      and that denorms are represented
  *
- *					  (-exp_bias+1)
+ *                          (-exp_bias+1)
  * as fractions that look like 0.fffff x 2             .  This means that
  *
- *			 -126
+ *              -126
  * the number 0.10000 x 2    , for instance, is the same as the normalized
  *
- *		-127			   -128
+ *              -127        -128
  * float 1.0 x 2    .  Thus, to represent 2    , we need one leading zero
  *
- *				  -129
+ *              -129
  * in the fraction; to represent 2    , we need two, and so on.  This
  *
- *						     (-exp_bias-fracbits+1)
+ *                          (-exp_bias-fracbits+1)
  * implies that the smallest denormalized number is 2
  *
  * for whichever format we are talking about: for single precision, for
  *
- *						-126		-149
+ *              -126        -149
  * instance, we get .00000000000000000000001 x 2    , or 1.0 x 2    , and
  *
  * -149 == -127 - 23 + 1.
diff --git a/common/inc/sys/sockaddr.h b/common/inc/sys/sockaddr.h
index 3a1a958..94dc548 100644
--- a/common/inc/sys/sockaddr.h
+++ b/common/inc/sys/sockaddr.h
@@ -25,12 +25,12 @@ typedef unsigned short int sa_family_t;
    of the data types used for socket addresses, `struct sockaddr',
    `struct sockaddr_in', `struct sockaddr_un', etc.  */
 
-#define	__SOCKADDR_COMMON(sa_prefix) \
-  sa_family_t sa_prefix##family
+#define __SOCKADDR_COMMON(sa_prefix) \
+    sa_family_t sa_prefix##family
 
-#define __SOCKADDR_COMMON_SIZE	(sizeof (unsigned short int))
+#define __SOCKADDR_COMMON_SIZE  (sizeof (unsigned short int))
 
 /* Size of struct sockaddr_storage.  */
 #define _SS_SIZE 128
 
-#endif
\ No newline at end of file
+#endif
diff --git a/common/inc/sys/socket.h b/common/inc/sys/socket.h
index 2f0bd0e..fe19269 100644
--- a/common/inc/sys/socket.h
+++ b/common/inc/sys/socket.h
@@ -31,24 +31,24 @@ typedef __socklen_t socklen_t;
 /* Structure describing a generic socket address.  */
 struct sockaddr
 {
-    __SOCKADDR_COMMON (sa_);	/* Common data: address family and length.  */
-    char sa_data[14];		    /* Address data.  */
+    __SOCKADDR_COMMON (sa_);    /* Common data: address family and length.  */
+    char sa_data[14];           /* Address data.  */
 };
 
 struct msghdr
 {
-    void *msg_name;		    /* Address to send to/receive from.  */
-    socklen_t msg_namelen;	/* Length of address data.  */
+    void *msg_name;         /* Address to send to/receive from.  */
+    socklen_t msg_namelen;  /* Length of address data.  */
 
-    struct iovec *msg_iov;	/* Vector of data to send/receive into.  */
-    size_t msg_iovlen;		/* Number of elements in the vector.  */
+    struct iovec *msg_iov;  /* Vector of data to send/receive into.  */
+    size_t msg_iovlen;      /* Number of elements in the vector.  */
 
-    void *msg_control;		/* Ancillary data (eg BSD filedesc passing). */
-    size_t msg_controllen;	/* Ancillary data buffer length.
-				            !! The type should be socklen_t but the
+    void *msg_control;      /* Ancillary data (eg BSD filedesc passing). */
+    size_t msg_controllen;  /* Ancillary data buffer length.
+                            !! The type should be socklen_t but the
                             definition of the kernel is incompatible
                             with this.  */
-    int msg_flags;		/* Flags on received message.  */
+    int msg_flags;          /* Flags on received message.  */
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/common/inc/sys/stat.h b/common/inc/sys/stat.h
index 7ba561f..43b4776 100644
--- a/common/inc/sys/stat.h
+++ b/common/inc/sys/stat.h
@@ -25,39 +25,39 @@
 
 /* Versions of the `struct stat' data structure.  */
 #ifndef __x86_64__
-# define _STAT_VER_LINUX_OLD	1
-# define _STAT_VER_KERNEL		1
-# define _STAT_VER_SVR4			2
-# define _STAT_VER_LINUX		3
+# define _STAT_VER_LINUX_OLD    1
+# define _STAT_VER_KERNEL       1
+# define _STAT_VER_SVR4         2
+# define _STAT_VER_LINUX        3
 
 /* i386 versions of the `xmknod' interface.  */
-# define _MKNOD_VER_LINUX		1
-# define _MKNOD_VER_SVR4		2
-# define _MKNOD_VER		_MKNOD_VER_LINUX /* The bits defined below.  */
+# define _MKNOD_VER_LINUX       1
+# define _MKNOD_VER_SVR4        2
+# define _MKNOD_VER     _MKNOD_VER_LINUX /* The bits defined below.  */
 #else
-# define _STAT_VER_KERNEL		0
-# define _STAT_VER_LINUX		1
+# define _STAT_VER_KERNEL       0
+# define _STAT_VER_LINUX        1
 
 /* x86-64 versions of the `xmknod' interface.  */
-# define _MKNOD_VER_LINUX	0
+# define _MKNOD_VER_LINUX   0
 #endif
 
-#define _STAT_VER		_STAT_VER_LINUX
+#define _STAT_VER       _STAT_VER_LINUX
 
 #ifndef _DEV_T_DEFINED_
 #define _DEV_T_DEFINED_
-typedef __dev_t   dev_t;
+typedef __dev_t     dev_t;
 #endif
 
 #ifndef _INO_T_DEFINED_
 #define _INO_T_DEFINED_
-typedef __ino_t   	ino_t;
+typedef __ino_t     ino_t;
 typedef __ino64_t   ino64_t;
 #endif
 
 #ifndef _MODE_T_DEFINED_
 #define _MODE_T_DEFINED_
-typedef __mode_t   mode_t;
+typedef __mode_t    mode_t;
 #endif
 
 #ifndef _NLINK_T_DEFINED_
@@ -67,71 +67,71 @@ typedef __nlink_t   nlink_t;
 
 #ifndef _UID_T_DEFINED_
 #define _UID_T_DEFINED_
-typedef __uid_t   uid_t;
+typedef __uid_t     uid_t;
 #endif
 
 #ifndef _GID_T_DEFINED_
 #define _GID_T_DEFINED_
-typedef __gid_t   gid_t;
+typedef __gid_t     gid_t;
 #endif
 
 #ifndef _BLKSIZE_T_DEFINED_
 #define _BLKSIZE_T_DEFINED_
-typedef __blksize_t   blksize_t;
+typedef __blksize_t blksize_t;
 #endif
 
 #ifndef _BLKCNT_T_DEFINED_
 #define _BLKCNT_T_DEFINED_
-typedef __blkcnt_t   	blkcnt_t;
-typedef __blkcnt64_t   	blkcnt64_t;
+typedef __blkcnt_t      blkcnt_t;
+typedef __blkcnt64_t    blkcnt64_t;
 #endif
 
 
 struct stat
 {
-    dev_t st_dev;		/* Device.  */
+    dev_t st_dev;       /* Device.  */
 #ifndef __x86_64__
     unsigned short int __pad1;
 #endif
 #if defined __x86_64__ || !defined __USE_FILE_OFFSET64
-    ino_t st_ino;			/* File serial number.	*/
+    ino_t st_ino;           /* File serial number.	*/
 #else
-    ino_t __st_ino;			/* 32bit file serial number.	*/
+    ino_t __st_ino;         /* 32bit file serial number.	*/
 #endif
 #ifndef __x86_64__
-    mode_t st_mode;			/* File mode.  */
-    nlink_t st_nlink;		/* Link count.  */
+    mode_t st_mode;         /* File mode.  */
+    nlink_t st_nlink;       /* Link count.  */
 #else
-    nlink_t st_nlink;		/* Link count.  */
-    mode_t st_mode;			/* File mode.  */
+    nlink_t st_nlink;       /* Link count.  */
+    mode_t st_mode;         /* File mode.  */
 #endif
-    uid_t st_uid;			/* User ID of the file's owner.	*/
-    gid_t st_gid;			/* Group ID of the file's group.*/
+    uid_t st_uid;           /* User ID of the file's owner.	*/
+    gid_t st_gid;           /* Group ID of the file's group.*/
 #ifdef __x86_64__
     int __pad0;
 #endif
-    dev_t st_rdev;			/* Device number, if device.  */
+    dev_t st_rdev;          /* Device number, if device.  */
 #ifndef __x86_64__
     unsigned short int __pad2;
 #endif
 #if defined __x86_64__ || !defined __USE_FILE_OFFSET64
-    off_t st_size;			/* Size of file, in bytes.  */
+    off_t st_size;          /* Size of file, in bytes.  */
 #else
-    off64_t st_size;		/* Size of file, in bytes.  */
+    off64_t st_size;        /* Size of file, in bytes.  */
 #endif
-    blksize_t st_blksize;	/* Optimal block size for I/O.  */
+    blksize_t st_blksize;   /* Optimal block size for I/O.  */
 #if defined __x86_64__  || !defined __USE_FILE_OFFSET64
-    blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
+    blkcnt_t st_blocks;     /* Number 512-byte blocks allocated. */
 #else
-    blkcnt64_t st_blocks;	/* Number 512-byte blocks allocated. */
+    blkcnt64_t st_blocks;   /* Number 512-byte blocks allocated. */
 #endif
 
-    time_t st_atime;			/* Time of last access.  */
-    unsigned long int  st_atimensec;	/* Nscecs of last access.  */
+    time_t st_atime;            /* Time of last access.  */
+    unsigned long int  st_atimensec;    /* Nscecs of last access.  */
     time_t st_mtime;			/* Time of last modification.  */
-    unsigned long int  st_mtimensec;	/* Nsecs of last modification.  */
-    time_t st_ctime;			/* Time of last status change.  */
-    unsigned long int  st_ctimensec;	/* Nsecs of last status change.  */
+    unsigned long int  st_mtimensec;    /* Nsecs of last modification.  */
+    time_t st_ctime;            /* Time of last status change.  */
+    unsigned long int  st_ctimensec;    /* Nsecs of last status change.  */
 #ifdef __x86_64__
     long int  __glibc_reserved[3];
 #else
@@ -139,37 +139,37 @@ struct stat
     unsigned long int __glibc_reserved4;
     unsigned long int __glibc_reserved5;
 # else
-    ino64_t st_ino;			/* File serial number.	*/
+    ino64_t st_ino;         /* File serial number.	*/
 # endif
 #endif
 };
 
 struct stat64
 {
-    dev_t st_dev;			/* Device.  */
+    dev_t st_dev;           /* Device.  */
 # ifdef __x86_64__
-    ino64_t st_ino;			/* File serial number.  */
-    nlink_t st_nlink;		/* Link count.  */
-    mode_t st_mode;			/* File mode.  */
+    ino64_t st_ino;         /* File serial number.  */
+    nlink_t st_nlink;       /* Link count.  */
+    mode_t st_mode;         /* File mode.  */
 # else
     unsigned int __pad1;
-    ino_t __st_ino;			/* 32bit file serial number.	*/
-    mode_t st_mode;			/* File mode.  */
-    nlink_t st_nlink;		/* Link count.  */
+    ino_t __st_ino;         /* 32bit file serial number.	*/
+    mode_t st_mode;         /* File mode.  */
+    nlink_t st_nlink;       /* Link count.  */
 # endif
-    uid_t st_uid;			/* User ID of the file's owner.	*/
-    gid_t st_gid;			/* Group ID of the file's group.*/
+    uid_t st_uid;           /* User ID of the file's owner.	*/
+    gid_t st_gid;           /* Group ID of the file's group.*/
 # ifdef __x86_64__
     int __pad0;
-    dev_t st_rdev;			/* Device number, if device.  */
-    off_t st_size;			/* Size of file, in bytes.  */
+    dev_t st_rdev;          /* Device number, if device.  */
+    off_t st_size;          /* Size of file, in bytes.  */
 # else
-    dev_t st_rdev;			/* Device number, if device.  */
+    dev_t st_rdev;          /* Device number, if device.  */
     unsigned int __pad2;
-    off64_t st_size;		/* Size of file, in bytes.  */
+    off64_t st_size;        /* Size of file, in bytes.  */
 # endif
-    blksize_t st_blksize;	/* Optimal block size for I/O.  */
-    blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
+    blksize_t st_blksize;   /* Optimal block size for I/O.  */
+    blkcnt64_t st_blocks;   /* Nr. 512-byte blocks allocated.  */
 # ifdef __USE_XOPEN2K8
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
@@ -177,70 +177,70 @@ struct stat64
        identifier 'timespec' to appear in the <sys/stat.h> header.
        Therefore we have to handle the use of this header in strictly
        standard-compliant sources special.  */
-    struct timespec st_atim;		/* Time of last access.  */
-    struct timespec st_mtim;		/* Time of last modification.  */
-    struct timespec st_ctim;		/* Time of last status change.  */
+    struct timespec st_atim;        /* Time of last access.  */
+    struct timespec st_mtim;        /* Time of last modification.  */
+    struct timespec st_ctim;        /* Time of last status change.  */
 # else
-    time_t st_atime;			/* Time of last access.  */
-    unsigned long int st_atimensec;	/* Nscecs of last access.  */
-    time_t st_mtime;			/* Time of last modification.  */
-    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
-    time_t st_ctime;			/* Time of last status change.  */
+    time_t st_atime;            /* Time of last access.  */
+    unsigned long int st_atimensec; /* Nscecs of last access.  */
+    time_t st_mtime;            /* Time of last modification.  */
+    unsigned long int st_mtimensec; /* Nsecs of last modification.  */
+    time_t st_ctime;            /* Time of last status change.  */
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
 # endif
 # ifdef __x86_64__
     long int __glibc_reserved[3];
 # else
-    ino64_t st_ino;			/* File serial number.		*/
+    ino64_t st_ino;             /* File serial number.		*/
 # endif
  };
 
 /* Tell code we have these members.  */
-#define	_STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_BLKSIZE
 #define _STATBUF_ST_RDEV
 /* Nanosecond resolution time values are supported.  */
 #define _STATBUF_ST_NSEC
 
 /* Encoding of the file mode.  */
 
-#define	S_IFMT	0170000	/* These bits determine file type.  */
+#define S_IFMT  0170000	/* These bits determine file type.  */
 
 /* File types.  */
-#define	S_IFDIR	0040000	/* Directory.  */
-#define	S_IFCHR	0020000	/* Character device.  */
-#define	S_IFBLK	0060000	/* Block device.  */
-#define	S_IFREG	0100000	/* Regular file.  */
-#define	S_IFIFO	0010000	/* FIFO.  */
-#define	S_IFLNK	0120000	/* Symbolic link.  */
-#define	S_IFSOCK	0140000	/* Socket.  */
+#define S_IFDIR 0040000 /* Directory.  */
+#define S_IFCHR 0020000 /* Character device.  */
+#define S_IFBLK 0060000 /* Block device.  */
+#define S_IFREG 0100000 /* Regular file.  */
+#define S_IFIFO 0010000 /* FIFO.  */
+#define S_IFLNK 0120000 /* Symbolic link.  */
+#define S_IFSOCK    0140000 /* Socket.  */
 
 /* POSIX.1b objects.  Note that these macros always evaluate to zero.  But
    they do it by enforcing the correct use of the macros.  */
-#define S_TYPEISMQ(buf)  ((buf)->st_mode - (buf)->st_mode)
-#define S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
-#define S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
+#define S_TYPEISMQ(buf)     ((buf)->st_mode - (buf)->st_mode)
+#define S_TYPEISSEM(buf)    ((buf)->st_mode - (buf)->st_mode)
+#define S_TYPEISSHM(buf)    ((buf)->st_mode - (buf)->st_mode)
 
 /* Protection bits.  */
 
-#define	S_ISUID	04000	/* Set user ID on execution.  */
-#define	S_ISGID	02000	/* Set group ID on execution.  */
-#define	S_ISVTX	01000	/* Save swapped text after use (sticky).  */
-#define	S_IREAD	0400	/* Read by owner.  */
-#define	S_IWRITE	0200	/* Write by owner.  */
-#define	S_IEXEC	0100	/* Execute by owner.  */
+#define S_ISUID 04000   /* Set user ID on execution.  */
+#define S_ISGID 02000   /* Set group ID on execution.  */
+#define S_ISVTX 01000   /* Save swapped text after use (sticky).  */
+#define S_IREAD 0400    /* Read by owner.  */
+#define S_IWRITE    0200    /* Write by owner.  */
+#define S_IEXEC 0100    /* Execute by owner.  */
 
 #ifdef __USE_ATFILE
-# define UTIME_NOW	((1l << 30) - 1l)
-# define UTIME_OMIT	((1l << 30) - 2l)
+# define UTIME_NOW  ((1l << 30) - 1l)
+# define UTIME_OMIT ((1l << 30) - 2l)
 #endif
 
-#define	S_ISTYPE(mode, mask)	(((mode) & __S_IFMT) == (mask))
+#define S_ISTYPE(mode, mask)    (((mode) & __S_IFMT) == (mask))
 
-#define	S_ISDIR(mode)	 S_ISTYPE((mode), S_IFDIR)
-#define	S_ISCHR(mode)	 S_ISTYPE((mode), S_IFCHR)
-#define	S_ISBLK(mode)	 S_ISTYPE((mode), S_IFBLK)
-#define	S_ISREG(mode)	 S_ISTYPE((mode), S_IFREG)
-#define S_ISFIFO(mode)	 S_ISTYPE((mode), S_IFIFO)
-#define S_ISLNK(mode)	 S_ISTYPE((mode), S_IFLNK)
+#define S_ISDIR(mode)   S_ISTYPE((mode), S_IFDIR)
+#define S_ISCHR(mode)   S_ISTYPE((mode), S_IFCHR)
+#define S_ISBLK(mode)   S_ISTYPE((mode), S_IFBLK)
+#define S_ISREG(mode)   S_ISTYPE((mode), S_IFREG)
+#define S_ISFIFO(mode)  S_ISTYPE((mode), S_IFIFO)
+#define S_ISLNK(mode)   S_ISTYPE((mode), S_IFLNK)
 
-#endif	/* bits/stat.h */
+#endif  /* bits/stat.h */
diff --git a/common/inc/sys/stdint.h b/common/inc/sys/stdint.h
index 97407ce..5159945 100644
--- a/common/inc/sys/stdint.h
+++ b/common/inc/sys/stdint.h
@@ -1,4 +1,4 @@
-/*	$OpenBSD: stdint.h,v 1.4 2006/12/10 22:17:55 deraadt Exp $	*/
+/*  $OpenBSD: stdint.h,v 1.4 2006/12/10 22:17:55 deraadt Exp $  */
 
 /*
  * Copyright (c) 1997, 2005 Todd C. Miller <To...@courtesan.com>
diff --git a/common/inc/sys/struct_timespec.h b/common/inc/sys/struct_timespec.h
index f2ac6d7..3e3f356 100644
--- a/common/inc/sys/struct_timespec.h
+++ b/common/inc/sys/struct_timespec.h
@@ -24,8 +24,8 @@
    has nanoseconds instead of microseconds.  */
 struct timespec
 {
-	__time_t 	tv_sec;		/* Seconds.  */
-	long 	   	tv_nsec;	/* Nanoseconds.  */
+    __time_t  tv_sec;   /* Seconds.  */
+    long      tv_nsec;  /* Nanoseconds.  */
 };
 
 #endif
diff --git a/common/inc/sys/types.h b/common/inc/sys/types.h
index cc4e753..b64f89d 100644
--- a/common/inc/sys/types.h
+++ b/common/inc/sys/types.h
@@ -1,5 +1,5 @@
-/*	$OpenBSD: types.h,v 1.31 2008/03/16 19:42:57 otto Exp $	*/
-/*	$NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $	*/
+/*  $OpenBSD: types.h,v 1.31 2008/03/16 19:42:57 otto Exp $ */
+/*  $NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $   */
 
 /*-
  * Copyright (c) 1982, 1986, 1991, 1993
@@ -34,7 +34,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)types.h	8.4 (Berkeley) 1/21/94
+ *  @(#)types.h 8.4 (Berkeley) 1/21/94
  */
 
 #ifndef _SYS_TYPES_H_
diff --git a/common/inc/sys/uio.h b/common/inc/sys/uio.h
index e3f33d1..00cd177 100644
--- a/common/inc/sys/uio.h
+++ b/common/inc/sys/uio.h
@@ -21,8 +21,8 @@
 /* Structure for scatter/gather I/O.  */
 struct iovec
 {
-    void *iov_base;	/* Pointer to data.  */
-    size_t iov_len;	/* Length of data.  */
+    void *iov_base; /* Pointer to data.  */
+    size_t iov_len; /* Length of data.  */
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/common/inc/time.h b/common/inc/time.h
index 29852c5..01cfd6e 100644
--- a/common/inc/time.h
+++ b/common/inc/time.h
@@ -1,5 +1,5 @@
-/*	$OpenBSD: time.h,v 1.18 2006/01/06 18:53:04 millert Exp $	*/
-/*	$NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $	*/
+/*  $OpenBSD: time.h,v 1.18 2006/01/06 18:53:04 millert Exp $   */
+/*  $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $ */
 
 /*
  * Copyright (c) 1989 The Regents of the University of California.
@@ -35,7 +35,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)time.h	5.12 (Berkeley) 3/9/91
+ *  @(#)time.h  5.12 (Berkeley) 3/9/91
  */
 
 #ifndef _TIME_H_
diff --git a/common/inc/unistd.h b/common/inc/unistd.h
index 4da748a..2ab3a9a 100644
--- a/common/inc/unistd.h
+++ b/common/inc/unistd.h
@@ -1,5 +1,5 @@
-/*	$OpenBSD: unistd.h,v 1.62 2008/06/25 14:58:54 millert Exp $ */
-/*	$NetBSD: unistd.h,v 1.26.4.1 1996/05/28 02:31:51 mrg Exp $	*/
+/*  $OpenBSD: unistd.h,v 1.62 2008/06/25 14:58:54 millert Exp $ */
+/*  $NetBSD: unistd.h,v 1.26.4.1 1996/05/28 02:31:51 mrg Exp $  */
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -29,7 +29,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)unistd.h	5.13 (Berkeley) 6/17/91
+ *  @(#)unistd.h    5.13 (Berkeley) 6/17/91
  */
 
 #ifndef _UNISTD_H_
diff --git a/common/inc/wchar.h b/common/inc/wchar.h
index 4ca0b39..5982aef 100644
--- a/common/inc/wchar.h
+++ b/common/inc/wchar.h
@@ -1,5 +1,5 @@
-/*	$OpenBSD: wchar.h,v 1.11 2010/07/24 09:58:39 guenther Exp $	*/
-/*	$NetBSD: wchar.h,v 1.16 2003/03/07 07:11:35 tshiozak Exp $	*/
+/*  $OpenBSD: wchar.h,v 1.11 2010/07/24 09:58:39 guenther Exp $ */
+/*  $NetBSD: wchar.h,v 1.16 2003/03/07 07:11:35 tshiozak Exp $  */
 
 /*-
  * Copyright (c)1999 Citrus Project,
diff --git a/common/inc/wctype.h b/common/inc/wctype.h
index 25466f1..fb421af 100644
--- a/common/inc/wctype.h
+++ b/common/inc/wctype.h
@@ -1,5 +1,5 @@
-/*	$OpenBSD: wctype.h,v 1.5 2006/01/06 18:53:04 millert Exp $	*/
-/*	$NetBSD: wctype.h,v 1.5 2003/03/02 22:18:11 tshiozak Exp $	*/
+/*  $OpenBSD: wctype.h,v 1.5 2006/01/06 18:53:04 millert Exp $  */
+/*  $NetBSD: wctype.h,v 1.5 2003/03/02 22:18:11 tshiozak Exp $  */
 
 /*-
  * Copyright (c)1999 Citrus Project,
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	citrus Id: wctype.h,v 1.4 2000/12/21 01:50:21 itojun Exp
+ *  citrus Id: wctype.h,v 1.4 2000/12/21 01:50:21 itojun Exp
  */
 
 #ifndef _WCTYPE_H_
diff --git a/compiler-rt/Makefile b/compiler-rt/Makefile
index 3724326..8a55b5c 100644
--- a/compiler-rt/Makefile
+++ b/compiler-rt/Makefile
@@ -1,31 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# 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 Baidu, Inc., 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.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 
 include ../buildenv.mk
 COMMON_DIR := ../common
diff --git a/dockerfile/Dockerfile.1604.nightly b/dockerfile/Dockerfile.1604.nightly
index db05cb3..f4ed361 100644
--- a/dockerfile/Dockerfile.1604.nightly
+++ b/dockerfile/Dockerfile.1604.nightly
@@ -1,41 +1,29 @@
 # BSD License
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
-# 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 Baidu, Inc., 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.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License..
 
 
 FROM ubuntu:16.04
 MAINTAINER Yu Ding
 
-ENV sdk_bin https://download.01.org/intel-sgx/linux-2.6/ubuntu16.04-server/sgx_linux_x64_sdk_2.6.100.51363.bin
-ENV psw_deb https://download.01.org/intel-sgx/linux-2.6/ubuntu16.04-server/libsgx-enclave-common_2.6.100.51363-xenial1_amd64.deb
-ENV psw_dev_deb https://download.01.org/intel-sgx/linux-2.6/ubuntu16.04-server/libsgx-enclave-common-dev_2.6.100.51363-xenial1_amd64.deb
-ENV rust_toolchain nightly-2019-08-01
+ENV sdk_bin https://download.01.org/intel-sgx/sgx-linux/2.7.1/distro/ubuntu16.04-server/sgx_linux_x64_sdk_2.7.101.3.bin
+ENV psw_deb https://download.01.org/intel-sgx/sgx-linux/2.7.1/distro/ubuntu16.04-server/libsgx-enclave-common_2.7.101.3-xenial1_amd64.deb
+ENV psw_dev_deb https://download.01.org/intel-sgx/sgx-linux/2.7.1/distro/ubuntu16.04-server/libsgx-enclave-common-dev_2.7.101.3-xenial1_amd64.deb
+ENV rust_toolchain nightly-2019-11-25
 
 RUN apt-get update && \
     apt-get install -y build-essential ocaml automake autoconf libtool wget python libssl-dev libcurl4-openssl-dev protobuf-compiler libprotobuf-dev sudo kmod vim curl git-core libprotobuf-c0-dev libboost-thread-dev libboost-system-dev liblog4cpp5-dev libjsoncpp-dev alien uuid-dev libxml2-dev cmake pkg-config expect gdb && \
diff --git a/dockerfile/Dockerfile.1604.stable b/dockerfile/Dockerfile.1604.stable
deleted file mode 100644
index 2f5ddad..0000000
--- a/dockerfile/Dockerfile.1604.stable
+++ /dev/null
@@ -1,75 +0,0 @@
-# BSD License
-#
-# Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
-
-
-FROM ubuntu:16.04
-MAINTAINER Yu Ding
-
-ENV sdk_bin https://download.01.org/intel-sgx/linux-2.6/ubuntu16.04-server/sgx_linux_x64_sdk_2.6.100.51363.bin
-ENV psw_deb https://download.01.org/intel-sgx/linux-2.6/ubuntu16.04-server/libsgx-enclave-common_2.6.100.51363-xenial1_amd64.deb
-ENV psw_dev_deb https://download.01.org/intel-sgx/linux-2.6/ubuntu16.04-server/libsgx-enclave-common-dev_2.6.100.51363-xenial1_amd64.deb
-ENV rust_toolchain stable-2019-05-14
-
-RUN apt-get update && \
-    apt-get install -y build-essential ocaml automake autoconf libtool wget python libssl-dev libcurl4-openssl-dev protobuf-compiler libprotobuf-dev sudo kmod vim curl git-core libprotobuf-c0-dev libboost-thread-dev libboost-system-dev liblog4cpp5-dev libjsoncpp-dev alien uuid-dev libxml2-dev cmake pkg-config expect gdb && \
-    rm -rf /var/lib/apt/lists/* && \
-    rm -rf /var/cache/apt/archives/*
-
-
-# Uncomment the following lines for setup iCls
-# Make sure you have put the installer file in this directory with filename iclsClient-1.45.449.12-1.x86_64.rpm
-#RUN mkdir /root/icls
-#ADD iclsClient-1.45.449.12-1.x86_64.rpm /root/icls/
-#RUN cd /root/icls && alien --scripts iclsClient-1.45.449.12-1.x86_64.rpm && dpkg -i iclsclient_1.45.449.12-2_amd64.deb && ldconfig && \
-#    cd /tmp && \
-#    git clone https://github.com/01org/dynamic-application-loader-host-interface.git jhi && \
-#    cd jhi && mkdir build && cd build && cmake .. && make && make install && \
-#    systemctl enable jhi
-
-RUN mkdir /root/sgx && \
-    wget -O /root/sgx/psw.deb ${psw_deb} && \
-    wget -O /root/sgx/psw_dev.deb ${psw_dev_deb} && \
-    wget -O /root/sgx/sdk.bin ${sdk_bin} && \
-    cd /root/sgx && \
-    dpkg -i /root/sgx/psw.deb && \
-    dpkg -i /root/sgx/psw_dev.deb && \
-    chmod +x /root/sgx/sdk.bin && \
-    echo -e 'no\n/opt' | /root/sgx/sdk.bin && \
-    echo 'source /opt/sgxsdk/environment' >> /root/.bashrc && \
-    rm -rf /root/sgx/*
-
-RUN wget 'https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init' -O /root/rustup-init && \
-    chmod +x /root/rustup-init && \
-    echo '1' | /root/rustup-init --default-toolchain ${rust_toolchain} && \
-    echo 'source /root/.cargo/env' >> /root/.bashrc && \
-    /root/.cargo/bin/rustup component add rust-src rls rust-analysis clippy rustfmt && \
-    /root/.cargo/bin/cargo install xargo && \
-    rm -rf /root/.cargo/registry && rm -rf /root/.cargo/git
-WORKDIR /root
diff --git a/dockerfile/Dockerfile.1804.nightly b/dockerfile/Dockerfile.1804.nightly
index f7f6cd9..ee4e243 100644
--- a/dockerfile/Dockerfile.1804.nightly
+++ b/dockerfile/Dockerfile.1804.nightly
@@ -1,42 +1,30 @@
 # BSD License
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
-# 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 Baidu, Inc., 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.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License..
 
 
 FROM ubuntu:18.04
 MAINTAINER Yu Ding
 
-ENV sdk_bin https://download.01.org/intel-sgx/linux-2.6/ubuntu18.04-server/sgx_linux_x64_sdk_2.6.100.51363.bin
-ENV psw_deb https://download.01.org/intel-sgx/linux-2.6/ubuntu18.04-server/libsgx-enclave-common_2.6.100.51363-bionic1_amd64.deb
-ENV psw_dev_deb https://download.01.org/intel-sgx/linux-2.6/ubuntu18.04-server/libsgx-enclave-common-dev_2.6.100.51363-bionic1_amd64.deb
-ENV psw_dbgsym_deb https://download.01.org/intel-sgx/linux-2.6/ubuntu18.04-server/libsgx-enclave-common-dbgsym_2.6.100.51363-bionic1_amd64.ddeb
-ENV rust_toolchain nightly-2019-08-01
+ENV sdk_bin https://download.01.org/intel-sgx/sgx-linux/2.7.1/distro/ubuntu18.04-server/sgx_linux_x64_sdk_2.7.101.3.bin
+ENV psw_deb https://download.01.org/intel-sgx/sgx-linux/2.7.1/distro/ubuntu18.04-server/libsgx-enclave-common_2.7.101.3-bionic1_amd64.deb
+ENV psw_dev_deb https://download.01.org/intel-sgx/sgx-linux/2.7.1/distro/ubuntu18.04-server/libsgx-enclave-common-dev_2.7.101.3-bionic1_amd64.deb
+ENV psw_dbgsym_deb https://download.01.org/intel-sgx/sgx-linux/2.7.1/distro/ubuntu18.04-server/libsgx-enclave-common-dbgsym_2.7.101.3-bionic1_amd64.ddeb
+ENV rust_toolchain nightly-2019-11-25
 ENV DEBIAN_FRONTEND=noninteractive
 
 RUN apt-get update && \
diff --git a/dockerfile/Dockerfile.1804.stable b/dockerfile/Dockerfile.1804.stable
deleted file mode 100644
index 4502bba..0000000
--- a/dockerfile/Dockerfile.1804.stable
+++ /dev/null
@@ -1,80 +0,0 @@
-# BSD License
-#
-# Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
-
-
-FROM ubuntu:18.04
-MAINTAINER Yu Ding
-
-ENV sdk_bin https://download.01.org/intel-sgx/linux-2.6/ubuntu18.04-server/sgx_linux_x64_sdk_2.6.100.51363.bin
-ENV psw_deb https://download.01.org/intel-sgx/linux-2.6/ubuntu18.04-server/libsgx-enclave-common_2.6.100.51363-bionic1_amd64.deb
-ENV psw_dev_deb https://download.01.org/intel-sgx/linux-2.6/ubuntu18.04-server/libsgx-enclave-common-dev_2.6.100.51363-bionic1_amd64.deb
-ENV psw_dbgsym_deb https://download.01.org/intel-sgx/linux-2.6/ubuntu18.04-server/libsgx-enclave-common-dbgsym_2.6.100.51363-bionic1_amd64.ddeb
-ENV rust_toolchain stable-2019-05-14
-ENV DEBIAN_FRONTEND=noninteractive
-
-RUN apt-get update && \
-    apt-get install -y build-essential ocaml ocamlbuild automake autoconf libtool wget python libssl-dev libcurl4-openssl-dev protobuf-compiler libprotobuf-dev sudo kmod vim curl git-core libprotobuf-c0-dev libboost-thread-dev libboost-system-dev liblog4cpp5-dev libjsoncpp-dev alien uuid-dev libxml2-dev cmake pkg-config expect systemd-sysv gdb && \
-    rm -rf /var/lib/apt/lists/* && \
-    rm -rf /var/cache/apt/archives/*
-
-
-# Uncomment the following lines for setup iCls
-# Make sure you have put the installer file in this directory with filename iclsClient-1.45.449.12-1.x86_64.rpm
-#RUN mkdir /root/icls
-#ADD iclsClient-1.45.449.12-1.x86_64.rpm /root/icls/
-#RUN cd /root/icls && alien --scripts iclsClient-1.45.449.12-1.x86_64.rpm && dpkg -i iclsclient_1.45.449.12-2_amd64.deb && ldconfig && \
-#    cd /tmp && \
-#    git clone https://github.com/01org/dynamic-application-loader-host-interface.git jhi && \
-#    cd jhi && mkdir build && cd build && cmake .. && make && make install && \
-#    systemctl enable jhi
-
-RUN mkdir /root/sgx && \
-    mkdir /etc/init && \
-    wget -O /root/sgx/psw.deb ${psw_deb} && \
-    wget -O /root/sgx/psw_dev.deb ${psw_dev_deb} && \
-    wget -O /root/sgx/psw_dbgsym.deb ${psw_dbgsym_deb} && \
-    wget -O /root/sgx/sdk.bin ${sdk_bin} && \
-    cd /root/sgx && \
-    dpkg -i /root/sgx/psw.deb && \
-    dpkg -i /root/sgx/psw_dev.deb && \
-    dpkg -i /root/sgx/psw_dbgsym.deb && \
-    chmod +x /root/sgx/sdk.bin && \
-    echo -e 'no\n/opt' | /root/sgx/sdk.bin && \
-    echo 'source /opt/sgxsdk/environment' >> /root/.bashrc && \
-    rm -rf /root/sgx/*
-
-RUN wget 'https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init' -O /root/rustup-init && \
-    chmod +x /root/rustup-init && \
-    echo '1' | /root/rustup-init --default-toolchain ${rust_toolchain} && \
-    echo 'source /root/.cargo/env' >> /root/.bashrc && \
-    /root/.cargo/bin/rustup component add rust-src rustfmt && \
-    /root/.cargo/bin/cargo install xargo && \
-    rm -rf /root/.cargo/registry && rm -rf /root/.cargo/git
-WORKDIR /root
diff --git a/dockerfile/Dockerfile.centos7.nightly b/dockerfile/Dockerfile.centos7.nightly
index 63eb386..045c9c1 100644
--- a/dockerfile/Dockerfile.centos7.nightly
+++ b/dockerfile/Dockerfile.centos7.nightly
@@ -1,47 +1,35 @@
 # BSD License
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
-# 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 Baidu, Inc., 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.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License..
 
 
 FROM centos:7
 MAINTAINER Yu Ding
 
-ENV sdk_bin https://download.01.org/intel-sgx/linux-2.6/centos7.5-server/sgx_linux_x64_sdk_2.6.100.51363.bin
-ENV psw_deb https://download.01.org/intel-sgx/linux-2.6/centos7.5-server/sgx_linux_x64_psw_2.6.100.51363.bin
-ENV rust_toolchain nightly-2019-08-01
+ENV sdk_bin https://download.01.org/intel-sgx/sgx-linux/2.7.1/distro/centos7.5-server/sgx_linux_x64_sdk_2.7.101.3.bin
+ENV psw_bin https://download.01.org/intel-sgx/sgx-linux/2.7.1/distro/centos7.5-server/sgx_linux_x64_psw_2.7.101.3.bin
+ENV rust_toolchain nightly-2019-11-25
 ENV DEBIAN_FRONTEND=noninteractive
 
-RUN yum groupinstall -y 'Development Tools' && yum install -y ocaml ocaml-ocamlbuild wget python openssl-devel protobuf which
+RUN yum groupinstall -y 'Development Tools' && yum install -y ocaml ocaml-ocamlbuild wget python openssl-devel protobuf which git cmake expect
 
 RUN mkdir /root/sgx && \
     mkdir /etc/init && \
-    wget -O /root/sgx/psw.bin ${psw_deb} && \
+    wget -O /root/sgx/psw.bin ${psw_bin} && \
     wget -O /root/sgx/sdk.bin ${sdk_bin} && \
     cd /root/sgx && \
     chmod +x /root/sgx/psw.bin && \
diff --git a/dockerfile/Dockerfile.fedora27.nightly b/dockerfile/Dockerfile.fedora27.nightly
index b5e1b8a..e05bb0d 100644
--- a/dockerfile/Dockerfile.fedora27.nightly
+++ b/dockerfile/Dockerfile.fedora27.nightly
@@ -1,47 +1,35 @@
 # BSD License
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
-# 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 Baidu, Inc., 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.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License..
 
 
 FROM fedora:27
 MAINTAINER Yu Ding
 
-ENV sdk_bin https://download.01.org/intel-sgx/latest/linux-latest/distro/fedora27-server/sgx_linux_x64_sdk_2.7.100.4.bin
-ENV psw_deb https://download.01.org/intel-sgx/latest/linux-latest/distro/fedora27-server/sgx_linux_x64_psw_2.7.100.4.bin
-ENV rust_toolchain nightly-2019-08-01
+ENV sdk_bin https://download.01.org/intel-sgx/sgx-linux/2.7.1/distro/fedora27-server/sgx_linux_x64_sdk_2.7.101.3.bin
+ENV psw_bin https://download.01.org/intel-sgx/sgx-linux/2.7.1/distro/fedora27-server/sgx_linux_x64_psw_2.7.101.3.bin
+ENV rust_toolchain nightly-2019-11-25
 ENV DEBIAN_FRONTEND=noninteractive
 
-RUN yum groupinstall -y 'C Development Tools and Libraries' && yum install -y yum openssl-devel libcurl-devel protobuf-devel cmake ocaml ocaml-ocamlbuild redhat-rpm-config openssl-devel wget python
+RUN yum groupinstall -y 'C Development Tools and Libraries' && yum install -y yum openssl-devel libcurl-devel protobuf-devel cmake ocaml ocaml-ocamlbuild redhat-rpm-config openssl-devel wget python git cmake expect
 
 RUN mkdir /root/sgx && \
     mkdir /etc/init && \
-    wget -O /root/sgx/psw.bin ${psw_deb} && \
+    wget -O /root/sgx/psw.bin ${psw_bin} && \
     wget -O /root/sgx/sdk.bin ${sdk_bin} && \
     cd /root/sgx && \
     chmod +x /root/sgx/psw.bin && \
diff --git a/documents/sgx_in_mesalock_linux.md b/documents/sgx_in_mesalock_linux.md
index 76eb17b..5a5c835 100644
--- a/documents/sgx_in_mesalock_linux.md
+++ b/documents/sgx_in_mesalock_linux.md
@@ -57,7 +57,7 @@ Rust SGX SDK and docker
 Step 1 : build SGX application in Rust SGX dev docker container.
 
 ```bash
-$ git pull git@github.com:baidu/rust-sgx-sdk.git
+$ git pull git@github.com:apache/teaclave-sgx-sdk.git
 $ docker run -v /path/to/rust-sgx-sdk:/root/sgx -ti --device /dev/isgx baiduxlab/sgx-rust
 ```
 
diff --git a/edl/inc/dirent.h b/edl/inc/dirent.h
index ba3c2c3..be63f83 100644
--- a/edl/inc/dirent.h
+++ b/edl/inc/dirent.h
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #ifndef _EDL_DIRENT_H
 #define _EDL_DIRENT_H
@@ -47,4 +36,4 @@ struct dirent64_t
     char d_name[256];
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/edl/inc/stat.h b/edl/inc/stat.h
index ac43761..7f04c3c 100644
--- a/edl/inc/stat.h
+++ b/edl/inc/stat.h
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #ifndef	_EDL_STAT_H
 #define	_EDL_STAT_H
@@ -51,7 +40,7 @@ struct stat_t
     int64_t __reserved[3];
 };
 
-struct stat64_t 
+struct stat64_t
 {
     uint64_t st_dev;
     uint64_t st_ino;
@@ -73,4 +62,4 @@ struct stat64_t
     int64_t __reserved[3];
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/edl/sgx_asyncio.edl b/edl/sgx_asyncio.edl
index f0a483e..72376ed 100644
--- a/edl/sgx_asyncio.edl
+++ b/edl/sgx_asyncio.edl
@@ -1,33 +1,19 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 
 enclave {
 
@@ -44,4 +30,4 @@ enclave {
         int u_epoll_ctl_ocall([out] int *error, int epfd, int op, int fd, [in] struct epoll_event *event);
         int u_epoll_wait_ocall([out] int *error, int epfd, [out, count=maxevents] struct epoll_event * events, int maxevents, int timeout);
     };
-};
\ No newline at end of file
+};
diff --git a/edl/sgx_backtrace.edl b/edl/sgx_backtrace.edl
index 7f333d6..4a9e7ef 100644
--- a/edl/sgx_backtrace.edl
+++ b/edl/sgx_backtrace.edl
@@ -1,34 +1,20 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
- 
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
 enclave {
 
     from "sgx_fd.edl" import *;
@@ -42,4 +28,4 @@ enclave {
     untrusted {
         /* define OCALLs here. */
     };
-};
\ No newline at end of file
+};
diff --git a/edl/sgx_env.edl b/edl/sgx_env.edl
index 6093cf2..edefb13 100644
--- a/edl/sgx_env.edl
+++ b/edl/sgx_env.edl
@@ -1,36 +1,24 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
- 
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
 enclave {
 
+    include "pwd.h"
+
 	trusted {
         /* define ECALLs here. */
     };
@@ -40,5 +28,9 @@ enclave {
         char * u_getenv_ocall([in, string] const char *name);
         int u_setenv_ocall([out] int *error, [in, string] const char *name, [in, string] const char *value, int overwrite);
         int u_unsetenv_ocall([out] int *error, [in, string] const char *name);
+        int u_chdir_ocall([out] int *error, [in, string] const char *dir);
+        char *u_getcwd_ocall([out] int *error, [out, size=buflen] char *buf, size_t buflen);
+        int u_getpwuid_r_ocall(unsigned int uid, [out] struct passwd *pwd, [out, size=buflen] char *buf, size_t buflen, [out] struct passwd **passwd_result);
+        unsigned int u_getuid_ocall();
     };
-};
\ No newline at end of file
+};
diff --git a/edl/sgx_fd.edl b/edl/sgx_fd.edl
index fefe0b1..6596e03 100644
--- a/edl/sgx_fd.edl
+++ b/edl/sgx_fd.edl
@@ -1,33 +1,19 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 
 enclave {
 
@@ -56,6 +42,6 @@ enclave {
         int u_ioctl_arg0_ocall([out] int *error, int fd, int request);
         int u_ioctl_arg1_ocall([out] int *error, int fd, int request, [in, out] int *arg);
 
-        int u_close_ocall([out] int *error, int fd);                   
+        int u_close_ocall([out] int *error, int fd);
     };
-};
\ No newline at end of file
+};
diff --git a/edl/sgx_file.edl b/edl/sgx_file.edl
index 54c48be..e751e79 100644
--- a/edl/sgx_file.edl
+++ b/edl/sgx_file.edl
@@ -1,33 +1,19 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 
 enclave {
 
@@ -64,13 +50,13 @@ enclave {
         int u_chmod_ocall([out] int *error, [in, string] const char *path, uint32_t mode);
         size_t u_readlink_ocall([out] int *error, [in, string] const char *path, [out, size=bufsz] char *buf, size_t bufsz);
         int u_symlink_ocall([out] int *error, [in, string] const char *path1, [in, string] const char *path2);
-        char * u_realpath_ocall([out] int *error, [in, string] const char *pathname);                             
+        char * u_realpath_ocall([out] int *error, [in, string] const char *pathname);
         int u_mkdir_ocall([out] int *error, [in, string] const char *pathname, uint32_t mode);
         int u_rmdir_ocall([out] int *error, [in, string] const char *pathname);
         void * u_opendir_ocall([out] int *error, [in, string] const char *pathname);
-        int u_readdir64_r_ocall([out] int *error, [user_check] void *dirp, [in, out] struct dirent64_t *entry, [out] struct dirent64_t **result);
+        int u_readdir64_r_ocall([user_check] void *dirp, [in, out] struct dirent64_t *entry, [out] struct dirent64_t **result);
         int u_closedir_ocall([out] int *error, [user_check] void *dirp);
         int u_dirfd_ocall([out] int *error, [user_check] void *dirp);
         int u_fstatat64_ocall([out] int *error, int dirfd, [in, string] const char *pathname, [out] struct stat64_t *buf, int flags);
     };
-};
\ No newline at end of file
+};
diff --git a/edl/sgx_fs.edl b/edl/sgx_fs.edl
index 0e52961..2618be9 100644
--- a/edl/sgx_fs.edl
+++ b/edl/sgx_fs.edl
@@ -1,33 +1,19 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 
 enclave {
 
@@ -42,4 +28,4 @@ enclave {
     untrusted {
         /* define OCALLs here. */
     };
-};
\ No newline at end of file
+};
diff --git a/edl/sgx_mem.edl b/edl/sgx_mem.edl
index a46f0fa..139a83f 100644
--- a/edl/sgx_mem.edl
+++ b/edl/sgx_mem.edl
@@ -1,34 +1,20 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
- 
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
 enclave {
 
 	trusted {
@@ -45,4 +31,4 @@ enclave {
         int u_msync_ocall([out] int *error, [user_check] void *addr, size_t length, int flags);
         int u_mprotect_ocall([out] int *error, [user_check] void *addr, size_t length, int prot);
     };
-};
\ No newline at end of file
+};
diff --git a/edl/sgx_net.edl b/edl/sgx_net.edl
index 6d6c33e..7cc01dc 100644
--- a/edl/sgx_net.edl
+++ b/edl/sgx_net.edl
@@ -1,36 +1,25 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 
 enclave {
 
+    include "sys/socket.h"
+    include "netdb.h"
+
     from "sgx_socket.edl" import *;
     from "sgx_asyncio.edl" import *;
     from "sgx_fd.edl" import *;
@@ -41,6 +30,8 @@ enclave {
     };
 
     untrusted {
-        /* define OCALLs here. */
+        int u_getaddrinfo_ocall([out]int * error,  [in, string] const char * node,  [in, string] const char * service, [in] const struct addrinfo * hints, [out] struct addrinfo ** res);
+        void u_freeaddrinfo_ocall([user_check] struct addrinfo *res);
+        char *u_gai_strerror_ocall(int errcode);
     };
-};
\ No newline at end of file
+};
diff --git a/edl/sgx_net_switchless.edl b/edl/sgx_net_switchless.edl
index a149b40..2af2b5c 100644
--- a/edl/sgx_net_switchless.edl
+++ b/edl/sgx_net_switchless.edl
@@ -1,33 +1,19 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 
 enclave {
 
@@ -36,7 +22,7 @@ enclave {
     from "sgx_fs.edl" import *;
     from "sgx_time.edl" import *;
     from "sgx_mem.edl" import *;
-    
+
     trusted {
         /* define ECALLs here. */
     };
diff --git a/edl/sgx_pipe.edl b/edl/sgx_pipe.edl
index fcca6c1..00c12f5 100644
--- a/edl/sgx_pipe.edl
+++ b/edl/sgx_pipe.edl
@@ -1,33 +1,19 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 
 enclave {
 
@@ -40,6 +26,6 @@ enclave {
 
     untrusted {
         int u_pipe_ocall([out] int *error, [out, count=2] int *pipefd);
-        int u_pipe2_ocall([out] int *error, [out, count=2] int *pipefd, int flags);   
+        int u_pipe2_ocall([out] int *error, [out, count=2] int *pipefd, int flags);
     };
-};
\ No newline at end of file
+};
diff --git a/edl/sgx_socket.edl b/edl/sgx_socket.edl
index 2e6ab0b..b082c71 100644
--- a/edl/sgx_socket.edl
+++ b/edl/sgx_socket.edl
@@ -1,33 +1,19 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 
 enclave {
 
@@ -103,4 +89,4 @@ enclave {
                                 [out] socklen_t *addrlen_out);
         int u_shutdown_ocall([out] int *error, int sockfd, int how);
     };
-};
\ No newline at end of file
+};
diff --git a/edl/sgx_stdio.edl b/edl/sgx_stdio.edl
index 84a70f0..5367d9a 100644
--- a/edl/sgx_stdio.edl
+++ b/edl/sgx_stdio.edl
@@ -1,38 +1,24 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
- 
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
 enclave {
 
     from "sgx_fd.edl" import *;
-    
+
 	trusted {
         /* define ECALLs here. */
     };
@@ -40,4 +26,4 @@ enclave {
     untrusted {
         /* define OCALLs here. */
     };
-};
\ No newline at end of file
+};
diff --git a/edl/sgx_sys.edl b/edl/sgx_sys.edl
index 54a9aad..ce1a538 100644
--- a/edl/sgx_sys.edl
+++ b/edl/sgx_sys.edl
@@ -1,34 +1,20 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
- 
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
 enclave {
 
 	trusted {
@@ -37,5 +23,6 @@ enclave {
 
     untrusted {
         long u_sysconf_ocall([out] int *error, int name);
+        int u_prctl_ocall([out] int *error, int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5);
     };
-};
\ No newline at end of file
+};
diff --git a/edl/sgx_thread.edl b/edl/sgx_thread.edl
new file mode 100644
index 0000000..f210f69
--- /dev/null
+++ b/edl/sgx_thread.edl
@@ -0,0 +1,33 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+enclave {
+
+    include "time.h"
+    include "pthread.h"
+
+    trusted {
+        public void *t_thread_main([in, size=len]void *arg, int len);
+    };
+
+    untrusted {
+        int u_pthread_create_ocall([out]pthread_t *thread, [in]const pthread_attr_t *attr, [user_check]void *start_routine, [in, size=len]void *arg, int len);
+        int u_pthread_join_ocall(pthread_t thread, [out]void **result);
+        int u_pthread_detach_ocall(pthread_t thread);
+        int u_sched_yield_ocall([out]int *error);
+        int u_nanosleep_ocall([out]int *error, [in]const struct timespec *req, [out]struct timespec *rem);
+    };
+};
diff --git a/edl/sgx_time.edl b/edl/sgx_time.edl
index 8f3c191..adeeecc 100644
--- a/edl/sgx_time.edl
+++ b/edl/sgx_time.edl
@@ -1,34 +1,20 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
- 
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
 enclave {
 
     include "time.h"
@@ -40,4 +26,4 @@ enclave {
     untrusted {
         int u_clock_gettime_ocall([out] int *error, int clk_id, [out] struct timespec *tp);
     };
-};
\ No newline at end of file
+};
diff --git a/edl/sgx_tstd.edl b/edl/sgx_tstd.edl
index 70e83b9..62fb049 100644
--- a/edl/sgx_tstd.edl
+++ b/edl/sgx_tstd.edl
@@ -1,34 +1,20 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
- 
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
 enclave {
 
     from "sgx_time.edl" import *;
@@ -42,8 +28,8 @@ enclave {
     untrusted {
         /* define OCALLs here. */
         int u_thread_set_event_ocall([out] int *error, [user_check] const void *tcs);
-        int u_thread_wait_event_ocall([out] int *error, [user_check] const void *tcs, int timeout);
+        int u_thread_wait_event_ocall([out] int *error, [user_check] const void *tcs, [in]const struct timespec *timeout);
         int u_thread_set_multiple_events_ocall([out]int *error, [in, count=total]const void ** tcss, int total);
-        int u_thread_setwait_events_ocall([out]int *error, [user_check]const void * waiter_tcs, [user_check]const void * self_tcs, int timeout);
+        int u_thread_setwait_events_ocall([out]int *error, [user_check]const void * waiter_tcs, [user_check]const void * self_tcs, [in]const struct timespec *timeout);
     };
-};
\ No newline at end of file
+};
diff --git a/licenses/LICENSE-common-inc.txt b/licenses/LICENSE-common-inc.txt
new file mode 100644
index 0000000..77bd65f
--- /dev/null
+++ b/licenses/LICENSE-common-inc.txt
@@ -0,0 +1,209 @@
+http://openbsd.org/
+
+OpenBSD* Copyright Policy
+________________________________________
+-	Goal
+Copyright law is complex, OpenBSD* policy is simple - OpenBSD strives to maintain the spirit 
+of the original Berkeley Unix copyrights.
+OpenBSD can exist as it does today because of the example set by the Computer Systems Research 
+Group at Berkeley and the battles which they and others fought to create a relatively 
+un-encumbered Unix source distribution.
+The ability of a freely redistributable "Berkeley" Unix to move forward on a competitive 
+basis with other operating systems depends on the willingness of the various development 
+groups to exchange code amongst themselves and with other projects. Understanding the legal 
+issues surrounding copyright is fundamental to the ability to exchange and re-distribute code, 
+while honoring the spirit of the copyright and concept of attribution is fundamental to 
+promoting the cooperation of the people involved.
+-	The Berkeley* Copyright
+The Berkeley* copyright poses no restrictions on private or commercial use of the software 
+and imposes only simple and uniform requirements for maintaining copyright notices in 
+redistributed versions and crediting the originator of the material only in advertising.
+For instance:
+ * Copyright (c) 1982, 1986, 1990, 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
+ *
+Berkeley rescinded the 3rd term (the advertising term) on 22 July 1999. Verbatim copies 
+of the Berkeley license in the OpenBSD tree have that term removed. In addition, many 
+3rd-party BSD-style licenses consist solely of the first two terms.
+Because the OpenBSD copyright imposes no conditions beyond those imposed by the Berkeley 
+copyright, OpenBSD can hope to share the same wide distribution and applicability as the 
+Berkeley distributions. It follows however, that OpenBSD cannot include material which 
+includes copyrights which are more restrictive than the Berkeley copyright, or must 
+relegate this material to a secondary status, i.e. OpenBSD as a whole is freely 
+redistributable, but some optional components may not be.
+-	Copyright Law
+While the overall subject of copyright law is far beyond the scope of this document, some 
+basics are in order. Under the current copyright law, copyrights are implicit in the 
+creation of a new work and reside with the creator, unless otherwise assigned. In general 
+the copyright applies only to the new work, not the material the work was derived from, 
+nor those portions of the derivative material included in the new work.
+Copyright law admits to three general categories of works:
+Original Work
+A new work that is not derived from an existing work.
+Derivative Work
+Work that is derived from, includes or amends existing works.
+Compilations
+A work that is a compilation of existing new and derivative works.
+The fundamental concept is that there is primacy of the copyright, that is a copyright of a 
+derivative work does not affect the rights held by the owner of the copyright of the original 
+work, rather only the part added. Likewise the copyright of a compilation does not affect the 
+rights of the owner of the included works, only the compilation as an entity.
+It is vitally important to understand that copyrights are broad protections as defined by 
+national and international copyright law. The "copyright notices" usually included in source 
+files are not copyrights, but rather notices that a party asserts that they hold copyright 
+to the material or to part of the material. Typically these notices are associated with 
+license terms which grant permissions subject to copyright law and with disclaimers that 
+state the position of the copyright holder/distributor with respect to liability surrounding 
+use of the material.
+-	Permissions - the flip side
+Because copyrights arise from the creation of a work, rather than through a registration process, 
+there needs to be a practical way to extend permission to use a work beyond what might be allowed 
+by "fair use" provisions of the copyright laws.
+This permission typically takes the form of a "release" or "license" included in the work, which 
+grants the additional uses beyond those granted by copyright law, usually subject to a variety of 
+conditions. At one extreme sits "public domain" where the originator asserts that he imposes no 
+restrictions on use of the material, at the other restrictive clauses that actually grant no 
+additional rights or impose restrictive, discriminatory or impractical conditions on use of the 
+work.
+Again, an important point to note is that the release and conditions can only apply to the 
+portion of the work that was originated by the copyright holder - the holder of a copyright 
+on a derivative work can neither grant additional permissions for use of the original work, 
+nor impose more restrictive conditions for use of that work.
+Because copyright arises from the creation of a work and not the text or a registration process, 
+removing or altering a copyright notice or associated release terms has no bearing on the 
+existence of the copyright, rather all that is accomplished is to cast doubt upon whatever rights 
+the person making the modifications had to use the material in the first place. Likewise, adding 
+terms and conditions in conflict with the original terms and conditions does not supersede them, 
+rather it casts doubts on the rights of the person making the amendments to use the material and 
+creates confusion as to whether anyone can use the amended version or derivatives thereof.
+Finally, releases are generally binding on the material that they are distributed with. This means 
+that if the originator of a work distributes that work with a release granting certain permissions, 
+those permissions apply as stated, without discrimination, to all persons legitimately possessing 
+a copy of the work. That means that having granted a permission, the copyright holder can not 
+retroactively say that an individual or class of individuals are no longer granted those permissions. 
+Likewise should the copyright holder decide to "go commercial" he can not revoke permissions already 
+granted for the use of the work as distributed, though he may impose more restrictive permissions in 
+his future distributions of that work.
+-	Specific Cases
+This section attempts to summarize the position of OpenBSD relative to some commonly encountered 
+copyrights.
+Berkeley*
+The Berkeley copyright is the model for the OpenBSD copyright. It retains the rights of the 
+copyright holder, while imposing minimal conditions on the use of the copyrighted material. 
+Material with Berkeley copyrights, or copyrights closely adhering to the Berkeley model can 
+generally be included in OpenBSD.
+AT&amp;T*
+As part of its settlement with AT&amp;T*, Berkeley included an AT&amp;T copyright notice on some of the 
+files in 4.4BSD lite and lite2. The terms of this license are identical to the standard Berkeley 
+license.
+Additionally, OpenBSD includes some other AT&amp;T code with non-restrictive copyrights, such as the 
+reference implementation of awk.
+Caldera*
+Caldera* (now known as the SCO group) is the current owner of the Unix code copyrights. On 23 
+January 2002, the original Unix code (versions 1 through seven, including 32V) was freed by Caldera. 
+This code is now available under a 4-term BSD-style license. As a result, it is now possible to 
+incorporate real Unix code into OpenBSD (though this code is quite old and generally requires significant 
+changes to bring it up to date).
+DEC*, Sun*, other manufacturers/software houses.
+In general OpenBSD does not include material copyrighted by manufacturers or software houses. 
+Material may be included where the copyright owner has granted general permission for reuse 
+without conditions, with terms similar to the Berkeley copyright, or where the material is the 
+product of an employee and the employer's copyright notice effectively releases any rights they 
+might have to the work.
+Carnegie-Mellon* (CMU, Mach)
+The Carnegie-Mellon copyright is similar to the Berkeley copyright, except that it requests that 
+derivative works be made available to Carnegie-Mellon. Because this is only a request and not a 
+condition, such material can still be included in OpenBSD. It should be noted that existing 
+versions of Mach are still subject to AT&amp;T copyrights, which prevents the general distribution 
+of Mach sources.
+Apache*
+The original Apache* copyright is similar to the Berkeley copyright, except that it stipulates 
+that products derived from the code may not have "Apache" in their name. The purpose of this 
+clause is to avoid a situation in which another party releases a modified version of the code 
+named in such a way to make users think that it is the "official" version. This is not an issue 
+with OpenBSD because OpenBSD is a Compilation, and not a Derived Work. Source code published under 
+version 2 of the Apache license cannot be included into OpenBSD. As a consequence, OpenBSD now 
+maintains its own version of Apache based on version 1.3.29. The OpenBSD version includes many 
+enhancements and bugfixes.
+ISC*
+The ISC* copyright is functionally equivalent to a two-term BSD copyright with language removed 
+that is made unnecessary by the Berne convention. This is the preferred license for new code 
+incorporated into OpenBSD. A sample license is included in the source tree as 
+/usr/src/share/misc/license.template.
+GNU* General Public License, GPL, LGPL, copyleft, etc.
+The GNU* Public License and licenses modeled on it impose the restriction that source code must 
+be distributed or made available for all works that are derivatives of the GNU copyrighted code.
+While this may be a noble strategy in terms of software sharing, it is a condition that is 
+typically unacceptable for commercial use of software. As a consequence, software bound by the 
+GPL terms can not be included in the kernel or "runtime" of OpenBSD, though software subject to
+ GPL terms may be included as development tools or as part of the system that are "optional" as 
+long as such use does not result in OpenBSD as a whole becoming subject to the GPL terms.
+As an example, GCC and other GNU tools are included in the OpenBSD tool chain. However, it is 
+quite possible to distribute a system for many applications without a tool chain, or the 
+distributor can choose to include a tool chain as an optional bundle which conforms to the 
+GPL terms.
+NetBSD*
+Much of OpenBSD is originally based on and evolved from NetBSD*, since some of the OpenBSD 
+developers were involved in the NetBSD project. The general NetBSD license terms are compatible 
+with the Berkeley license and permit such use. Material subject only to the general NetBSD license 
+can generally be included in OpenBSD.
+In the past, NetBSD has included material copyrighted by individuals who have imposed license 
+conditions beyond that of the general NetBSD license, but granted the NetBSD Foundation license 
+to distribute the material. Such material can not be included in OpenBSD as long as the conditions 
+imposed are at odds with the OpenBSD license terms or releases from those terms are offered on a 
+discriminatory basis.
+FreeBSD*
+Most of FreeBSD* is also based on Berkeley licensed material or includes copyright notices based 
+on the Berkeley model. Such material can be included in OpenBSD, while those parts that are subject 
+to GPL or various individual copyright terms that are at odds with the OpenBSD license can not be 
+included in OpenBSD.
+Linux*
+Most of Linux* is subject to GPL style licensing terms and therefore can not be included in 
+OpenBSD. Individual components may be eligible, subject to the terms of the originator's copyright 
+notices. Note that Linux "distributions" may also be subject to additional copyright claims of the 
+distributing organization, either as a compilation or on material included that is not part of the 
+Linux core.
+X*, XFree86*, X.Org*
+X*, X.Org* or XFree86* are not parts of OpenBSD, rather X.Org and parts of XFree86 3.3.6 are 
+distributed with many OpenBSD ports as a convenience to the user, subject to applicable license 
+terms.
+Shareware, Charityware, Freeware, etc.
+Most "shareware" copyright notices impose conditions for redistribution, use or visibility that 
+are at conflict with the OpenBSD project goals. Review on a case-by-case basis is required as to 
+whether the wording of the conditions is acceptable in terms of conditions being requested vs. 
+demanded and whether the spirit of the conditions is compatible with goals of the OpenBSD project.
+Public Domain
+While material that is truly entered into the "Public Domain" can be included in OpenBSD, review 
+is required on a case by case basis. Frequently the "public domain" assertion is made by someone 
+who does not really hold all rights under Copyright law to grant that status or there are a variety
+of conditions imposed on use. For a work to be truly in the "Public Domain" all rights are abandoned 
+and the material is offered without restrictions.
+
diff --git a/licenses/LICENSE-compiler_rt.txt b/licenses/LICENSE-compiler_rt.txt
new file mode 100644
index 0000000..c3cd411
--- /dev/null
+++ b/licenses/LICENSE-compiler_rt.txt
@@ -0,0 +1,92 @@
+The compiler_rt library is dual licensed under both the University of Illinois 
+"BSD-Like" license and the MIT license.  As a user of this code you may choose 
+to use it under either license.  As a contributor, you agree to allow your code 
+to be used under both.
+
+The libc++ library is dual licensed under both the University of Illinois
+"BSD-Like" license and the MIT license.  As a user of this code you may choose
+to use it under either license.  As a contributor, you agree to allow your code
+to be used under both.
+
+Full text of the relevant licenses is included below.
+
+==============================================================================
+
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2009-2016 by the contributors listed in CREDITS.TXT
+
+All rights reserved.
+
+Developed by:
+
+    LLVM Team
+
+    University of Illinois at Urbana-Champaign
+
+    http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimers.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimers in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the names of the LLVM Team, University of Illinois at
+      Urbana-Champaign, nor the names of its contributors may be used to
+      endorse or promote products derived from this Software without specific
+      prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+
+==============================================================================
+
+Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+=============================================================================
+Copyrights and Licenses for Third Party Software Distributed with LLVM:
+=============================================================================
+The LLVM software contains code written by third parties.  Such software will
+have its own individual LICENSE.TXT file in the directory in which it appears.
+This file will describe the copyrights, license, and restrictions which apply
+to that code.
+
+The disclaimer of warranty in the University of Illinois Open Source License
+applies to all code in the LLVM Distribution, and nothing in any of the
+other licenses gives permission to use the names of the LLVM Team or the
+University of Illinois to endorse or promote products derived from this
+Software.
+
diff --git a/licenses/LICENSE-samplecode-app.txt b/licenses/LICENSE-samplecode-app.txt
new file mode 100644
index 0000000..7920ff6
--- /dev/null
+++ b/licenses/LICENSE-samplecode-app.txt
@@ -0,0 +1,28 @@
+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:
+
+  * 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.
+
diff --git a/licenses/LICENSE-samplecode-remoteattestation.txt b/licenses/LICENSE-samplecode-remoteattestation.txt
new file mode 100644
index 0000000..18fdec3
--- /dev/null
+++ b/licenses/LICENSE-samplecode-remoteattestation.txt
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2017 Blackrabbit
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/release_notes.md b/release_notes.md
index 82a8815..d114f9c 100644
--- a/release_notes.md
+++ b/release_notes.md
@@ -1,3 +1,19 @@
+# Rust SGX SDK v1.1.0
+
+**Supports Intel SGX SDK v2.7.1**
+
+**Supports Rust nightly-2019-11-25**
+
+**Fedora 27 supported** Added dockerfile for Fedora 27.
+
+**Threading and synchronization** We implemented `thread::spawn` and ported `std::sync::mpsc`. Please look into unittest for usage.
+
+**`is_x86_feature_detected`** We found a global feature indicator [`g_cpu_feature_indicator`](https://github.com/apache/teaclave-sgx-sdk/wiki/%60is_x86_feature_detected%60-in-Rust-SGX-SDK) and enabled `is_x86_feature_detected` without triggering `cpuid` instruction.
+
+**New aligned allocator primitives and data structures** To mitigate [Intel-SA-00219](https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00219.html), we provided `AlignBox<T>` for dynamic allocation, and aligned key types such as `sgx_align_key_256bit_t`, `sgx_align_key_128bit_t` for static allocation. To help understand this vulnerability, please look into the wiki article [Mitigation of Intel SA 00219 in Rust SGX](https://github.com/apache/teaclave-sgx-sdk/wiki/M [...]
+
+**Link flag change** In this version, `-lsgx_tcxx` must be placed before `-lsgx_tstdc`. We've changed all `Makefile`s.
+
 # Rust SGX SDK v1.0.9 Release Notes
 
 **Supports Rust nightly-2019-08-01** in master branch (rustc 1.38.0). Stable branch would be pushed later.
diff --git a/rust-toolchain b/rust-toolchain
index 4390c8a..7ff88f6 100644
--- a/rust-toolchain
+++ b/rust-toolchain
@@ -1 +1 @@
-nightly-2019-08-01
+nightly-2019-11-25
diff --git a/samplecode/backtrace/Makefile b/samplecode/backtrace/Makefile
index 6bec025..21c34a6 100644
--- a/samplecode/backtrace/Makefile
+++ b/samplecode/backtrace/Makefile
@@ -1,30 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
-#  * 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 Baidu, Inc., 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.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 
 ######## SGX SDK Settings ########
 
diff --git a/samplecode/backtrace/app/app.c b/samplecode/backtrace/app/app.c
index c57f176..a2af74b 100644
--- a/samplecode/backtrace/app/app.c
+++ b/samplecode/backtrace/app/app.c
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #include <stdio.h>
 #include <string.h>
@@ -145,73 +134,20 @@ void print_error_message(sgx_status_t ret)
         printf("Error: Unexpected error occurred.\n");
 }
 
-/* Initialize the enclave:
- *   Step 1: try to retrieve the launch token saved by last transaction
- *   Step 2: call sgx_create_enclave to initialize an enclave instance
- *   Step 3: save the launch token if it is updated
- */
 int initialize_enclave(void)
 {
-    char token_path[MAX_PATH] = {'\0'};
     sgx_launch_token_t token = {0};
     sgx_status_t ret = SGX_ERROR_UNEXPECTED;
     int updated = 0;
 
-    /* Step 1: try to retrieve the launch token saved by last transaction
-     *         if there is no token, then create a new one.
-     */
-    /* try to get the token saved in $HOME */
-    const char *home_dir = getpwuid(getuid())->pw_dir;
-
-    if (home_dir != NULL &&
-        (strlen(home_dir)+strlen("/")+sizeof(TOKEN_FILENAME)+1) <= MAX_PATH) {
-        /* compose the token path */
-        strncpy(token_path, home_dir, strlen(home_dir));
-        strncat(token_path, "/", strlen("/"));
-        strncat(token_path, TOKEN_FILENAME, sizeof(TOKEN_FILENAME)+1);
-    } else {
-        /* if token path is too long or $HOME is NULL */
-        strncpy(token_path, TOKEN_FILENAME, sizeof(TOKEN_FILENAME));
-    }
-
-    FILE *fp = fopen(token_path, "rb");
-    if (fp == NULL && (fp = fopen(token_path, "wb")) == NULL) {
-        printf("Warning: Failed to create/open the launch token file \"%s\".\n", token_path);
-    }
-
-    if (fp != NULL) {
-        /* read the token from saved file */
-        size_t read_num = fread(token, 1, sizeof(sgx_launch_token_t), fp);
-        if (read_num != 0 && read_num != sizeof(sgx_launch_token_t)) {
-            /* if token is invalid, clear the buffer */
-            memset(&token, 0x0, sizeof(sgx_launch_token_t));
-            printf("Warning: Invalid launch token read from \"%s\".\n", token_path);
-        }
-    }
-    /* Step 2: call sgx_create_enclave to initialize an enclave instance */
+    /* call sgx_create_enclave to initialize an enclave instance */
     /* Debug Support: set 2nd parameter to 1 */
     ret = sgx_create_enclave(ENCLAVE_FILENAME, SGX_DEBUG_FLAG, &token, &updated, &global_eid, NULL);
     if (ret != SGX_SUCCESS) {
         print_error_message(ret);
-        if (fp != NULL) fclose(fp);
         return -1;
     }
     printf("[+] global_eid: %ld\n", global_eid);
-
-    /* Step 3: save the launch token if it is updated */
-    if (updated == FALSE || fp == NULL) {
-        /* if the token is not updated, or file handler is invalid, do not perform saving */
-        if (fp != NULL) fclose(fp);
-        return 0;
-    }
-
-    /* reopen the file with write capablity */
-    fp = freopen(token_path, "wb", fp);
-    if (fp == NULL) return 0;
-    size_t write_num = fwrite(token, 1, sizeof(sgx_launch_token_t), fp);
-    if (write_num != sizeof(sgx_launch_token_t))
-        printf("Warning: Failed to save launch token to \"%s\".\n", token_path);
-    fclose(fp);
     return 0;
 }
 
diff --git a/samplecode/backtrace/app/app.h b/samplecode/backtrace/app/app.h
index aecb4c2..c3c2c7d 100644
--- a/samplecode/backtrace/app/app.h
+++ b/samplecode/backtrace/app/app.h
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #ifndef _APP_H_
 #define _APP_H_
@@ -45,7 +34,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/backtrace/enclave/Cargo.toml b/samplecode/backtrace/enclave/Cargo.toml
index 576f97c..ffd5857 100644
--- a/samplecode/backtrace/enclave/Cargo.toml
+++ b/samplecode/backtrace/enclave/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "Backtracesampleenclave"
 version = "1.0.0"
-authors = ["Baidu"]
+authors = ["The Teaclave Authors"]
 
 [lib]
 name = "backtracesampleenclave"
@@ -11,11 +11,11 @@ crate-type = ["staticlib"]
 default = []
 
 [target.'cfg(not(target_env = "sgx"))'.dependencies]
-sgx_types = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-sgx_tstd = { git = "https://github.com/baidu/rust-sgx-sdk.git", features = ["backtrace"] }
-sgx_backtrace = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
+sgx_types = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+sgx_tstd = { git = "https://github.com/apache/teaclave-sgx-sdk.git", features = ["backtrace"] }
+sgx_backtrace = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
 
-[patch.'https://github.com/baidu/rust-sgx-sdk.git']
+[patch.'https://github.com/apache/teaclave-sgx-sdk.git']
 sgx_alloc = { path = "../../../sgx_alloc" }
 sgx_backtrace = { path = "../../../sgx_backtrace" }
 sgx_backtrace_sys = { path = "../../../sgx_backtrace_sys" }
diff --git a/samplecode/backtrace/enclave/Enclave.edl b/samplecode/backtrace/enclave/Enclave.edl
index c755059..c58dd9c 100644
--- a/samplecode/backtrace/enclave/Enclave.edl
+++ b/samplecode/backtrace/enclave/Enclave.edl
@@ -1,33 +1,19 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 
 enclave {
     from "sgx_tstd.edl" import *;
diff --git a/samplecode/backtrace/enclave/Makefile b/samplecode/backtrace/enclave/Makefile
index c310b40..15751b2 100644
--- a/samplecode/backtrace/enclave/Makefile
+++ b/samplecode/backtrace/enclave/Makefile
@@ -1,31 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# 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 Baidu, Inc., 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.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 Rust_Enclave_Name := libenclave.a
 Rust_Enclave_Files := $(wildcard src/*.rs)
 Rust_Target_Path := $(CURDIR)/../../../xargo
diff --git a/samplecode/backtrace/enclave/Xargo.toml b/samplecode/backtrace/enclave/Xargo.toml
index e974105..558d1d0 100644
--- a/samplecode/backtrace/enclave/Xargo.toml
+++ b/samplecode/backtrace/enclave/Xargo.toml
@@ -5,6 +5,14 @@ alloc = {}
 path = "../../../sgx_types"
 stage = 1
 
+[dependencies.sgx_alloc]
+path = "../../../sgx_alloc"
+stage = 1
+
+[dependencies.sgx_unwind]
+path = "../../../sgx_unwind"
+stage = 1
+
 [dependencies.sgx_demangle]
 path = "../../../sgx_demangle"
 stage = 1
@@ -41,9 +49,9 @@ stage = 3
 path = "../../../sgx_backtrace_sys"
 stage = 3
 
-[dependencies.sgx_unwind]
-path = "../../../sgx_unwind"
-stage = 4
+[dependencies.panic_unwind]
+path = "../../../sgx_panic_unwind"
+stage = 3
 
 [dependencies.sgx_tdh]
 path = "../../../sgx_tdh"
@@ -57,35 +65,31 @@ stage = 4
 path = "../../../sgx_tprotected_fs"
 stage = 4
 
-[dependencies.sgx_alloc]
-path = "../../../sgx_alloc"
-stage = 4
-
-[dependencies.panic_unwind]
-path = "../../../sgx_panic_unwind"
-stage = 5
-
 [dependencies.std]
 path = "../../../xargo/sgx_tstd"
 features = ["backtrace"]
-stage = 6
+stage = 5
+
+[dependencies.sgx_no_tstd]
+path = "../../../sgx_no_tstd"
+stage = 5
 
 [dependencies.sgx_rand]
 path = "../../../sgx_rand"
-stage = 7
+stage = 6
 
 [dependencies.sgx_serialize]
 path = "../../../sgx_serialize"
-stage = 7
+stage = 6
 
 [dependencies.sgx_tunittest]
 path = "../../../sgx_tunittest"
-stage = 7
+stage = 6
 
 [dependencies.sgx_backtrace]
 path = "../../../sgx_backtrace"
-stage = 8
+stage = 7
 
 [dependencies.sgx_cov]
 path = "../../../sgx_cov"
-stage = 8
\ No newline at end of file
+stage = 7
\ No newline at end of file
diff --git a/samplecode/backtrace/enclave/src/lib.rs b/samplecode/backtrace/enclave/src/lib.rs
index 85b3ca9..1fce2c0 100644
--- a/samplecode/backtrace/enclave/src/lib.rs
+++ b/samplecode/backtrace/enclave/src/lib.rs
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #![crate_name = "backtracesampleenclave"]
 #![crate_type = "staticlib"]
diff --git a/samplecode/crypto/Makefile b/samplecode/crypto/Makefile
index 165a712..f3ab5db 100644
--- a/samplecode/crypto/Makefile
+++ b/samplecode/crypto/Makefile
@@ -1,31 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# 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 Baidu, Inc., 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.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 
 ######## SGX SDK Settings ########
 
diff --git a/samplecode/crypto/app/app.c b/samplecode/crypto/app/app.c
index b2bf42d..0ed2c25 100644
--- a/samplecode/crypto/app/app.c
+++ b/samplecode/crypto/app/app.c
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #include <stdio.h>
 #include <string.h>
@@ -145,73 +134,20 @@ void print_error_message(sgx_status_t ret)
         printf("Error: Unexpected error occurred.\n");
 }
 
-/* Initialize the enclave:
- *   Step 1: try to retrieve the launch token saved by last transaction
- *   Step 2: call sgx_create_enclave to initialize an enclave instance
- *   Step 3: save the launch token if it is updated
- */
 int initialize_enclave(void)
 {
-    char token_path[MAX_PATH] = {'\0'};
     sgx_launch_token_t token = {0};
     sgx_status_t ret = SGX_ERROR_UNEXPECTED;
     int updated = 0;
 
-    /* Step 1: try to retrieve the launch token saved by last transaction
-     *         if there is no token, then create a new one.
-     */
-    /* try to get the token saved in $HOME */
-    const char *home_dir = getpwuid(getuid())->pw_dir;
-
-    if (home_dir != NULL &&
-        (strlen(home_dir)+strlen("/")+sizeof(TOKEN_FILENAME)+1) <= MAX_PATH) {
-        /* compose the token path */
-        strncpy(token_path, home_dir, strlen(home_dir));
-        strncat(token_path, "/", strlen("/"));
-        strncat(token_path, TOKEN_FILENAME, sizeof(TOKEN_FILENAME)+1);
-    } else {
-        /* if token path is too long or $HOME is NULL */
-        strncpy(token_path, TOKEN_FILENAME, sizeof(TOKEN_FILENAME));
-    }
-
-    FILE *fp = fopen(token_path, "rb");
-    if (fp == NULL && (fp = fopen(token_path, "wb")) == NULL) {
-        printf("Warning: Failed to create/open the launch token file \"%s\".\n", token_path);
-    }
-
-    if (fp != NULL) {
-        /* read the token from saved file */
-        size_t read_num = fread(token, 1, sizeof(sgx_launch_token_t), fp);
-        if (read_num != 0 && read_num != sizeof(sgx_launch_token_t)) {
-            /* if token is invalid, clear the buffer */
-            memset(&token, 0x0, sizeof(sgx_launch_token_t));
-            printf("Warning: Invalid launch token read from \"%s\".\n", token_path);
-        }
-    }
-    /* Step 2: call sgx_create_enclave to initialize an enclave instance */
+    /* call sgx_create_enclave to initialize an enclave instance */
     /* Debug Support: set 2nd parameter to 1 */
     ret = sgx_create_enclave(ENCLAVE_FILENAME, SGX_DEBUG_FLAG, &token, &updated, &global_eid, NULL);
     if (ret != SGX_SUCCESS) {
         print_error_message(ret);
-        if (fp != NULL) fclose(fp);
         return -1;
     }
     printf("[+] global_eid: %ld\n", global_eid);
-
-    /* Step 3: save the launch token if it is updated */
-    if (updated == FALSE || fp == NULL) {
-        /* if the token is not updated, or file handler is invalid, do not perform saving */
-        if (fp != NULL) fclose(fp);
-        return 0;
-    }
-
-    /* reopen the file with write capablity */
-    fp = freopen(token_path, "wb", fp);
-    if (fp == NULL) return 0;
-    size_t write_num = fwrite(token, 1, sizeof(sgx_launch_token_t), fp);
-    if (write_num != sizeof(sgx_launch_token_t))
-        printf("Warning: Failed to save launch token to \"%s\".\n", token_path);
-    fclose(fp);
     return 0;
 }
 
diff --git a/samplecode/crypto/app/app.h b/samplecode/crypto/app/app.h
index 88ead52..c963455 100644
--- a/samplecode/crypto/app/app.h
+++ b/samplecode/crypto/app/app.h
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #ifndef _APP_H_
 #define _APP_H_
@@ -45,7 +34,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/crypto/enclave/Cargo.toml b/samplecode/crypto/enclave/Cargo.toml
index 3dbf046..b84f74c 100644
--- a/samplecode/crypto/enclave/Cargo.toml
+++ b/samplecode/crypto/enclave/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "Cryptosampleenclave"
 version = "1.0.0"
-authors = ["Baidu"]
+authors = ["The Teaclave Authors"]
 
 [lib]
 name = "cryptosampleenclave"
@@ -11,12 +11,12 @@ crate-type = ["staticlib"]
 default = []
 
 [target.'cfg(not(target_env = "sgx"))'.dependencies]
-sgx_types = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-sgx_trts = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-sgx_tstd = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-sgx_tcrypto = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
+sgx_types = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+sgx_trts = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+sgx_tstd = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+sgx_tcrypto = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
 
-[patch.'https://github.com/baidu/rust-sgx-sdk.git']
+[patch.'https://github.com/apache/teaclave-sgx-sdk.git']
 sgx_alloc = { path = "../../../sgx_alloc" }
 sgx_backtrace = { path = "../../../sgx_backtrace" }
 sgx_backtrace_sys = { path = "../../../sgx_backtrace_sys" }
diff --git a/samplecode/crypto/enclave/Enclave.edl b/samplecode/crypto/enclave/Enclave.edl
index b479339..b605a32 100644
--- a/samplecode/crypto/enclave/Enclave.edl
+++ b/samplecode/crypto/enclave/Enclave.edl
@@ -1,33 +1,19 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 
 enclave {
     from "sgx_tstd.edl" import *;
diff --git a/samplecode/crypto/enclave/Makefile b/samplecode/crypto/enclave/Makefile
index 072bef1..0369869 100644
--- a/samplecode/crypto/enclave/Makefile
+++ b/samplecode/crypto/enclave/Makefile
@@ -1,30 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
-#  * 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 Baidu, Inc., 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.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 Rust_Enclave_Name := libenclave.a
 Rust_Enclave_Files := $(wildcard src/*.rs)
 Rust_Target_Path := $(CURDIR)/../../../xargo
diff --git a/samplecode/crypto/enclave/Xargo.toml b/samplecode/crypto/enclave/Xargo.toml
index c088ebb..cb43640 100644
--- a/samplecode/crypto/enclave/Xargo.toml
+++ b/samplecode/crypto/enclave/Xargo.toml
@@ -5,6 +5,14 @@ alloc = {}
 path = "../../../sgx_types"
 stage = 1
 
+[dependencies.sgx_alloc]
+path = "../../../sgx_alloc"
+stage = 1
+
+[dependencies.sgx_unwind]
+path = "../../../sgx_unwind"
+stage = 1
+
 [dependencies.sgx_demangle]
 path = "../../../sgx_demangle"
 stage = 1
@@ -41,9 +49,9 @@ stage = 3
 path = "../../../sgx_backtrace_sys"
 stage = 3
 
-[dependencies.sgx_unwind]
-path = "../../../sgx_unwind"
-stage = 4
+[dependencies.panic_unwind]
+path = "../../../sgx_panic_unwind"
+stage = 3
 
 [dependencies.sgx_tdh]
 path = "../../../sgx_tdh"
@@ -57,34 +65,30 @@ stage = 4
 path = "../../../sgx_tprotected_fs"
 stage = 4
 
-[dependencies.sgx_alloc]
-path = "../../../sgx_alloc"
-stage = 4
-
-[dependencies.panic_unwind]
-path = "../../../sgx_panic_unwind"
-stage = 5
-
 [dependencies.std]
 path = "../../../xargo/sgx_tstd"
-stage = 6
+stage = 5
+
+[dependencies.sgx_no_tstd]
+path = "../../../sgx_no_tstd"
+stage = 5
 
 [dependencies.sgx_rand]
 path = "../../../sgx_rand"
-stage = 7
+stage = 6
 
 [dependencies.sgx_serialize]
 path = "../../../sgx_serialize"
-stage = 7
+stage = 6
 
 [dependencies.sgx_tunittest]
 path = "../../../sgx_tunittest"
-stage = 7
+stage = 6
 
 [dependencies.sgx_backtrace]
 path = "../../../sgx_backtrace"
-stage = 8
+stage = 7
 
 [dependencies.sgx_cov]
 path = "../../../sgx_cov"
-stage = 8
+stage = 7
diff --git a/samplecode/crypto/enclave/src/lib.rs b/samplecode/crypto/enclave/src/lib.rs
index 8e9881c..27c97f1 100644
--- a/samplecode/crypto/enclave/src/lib.rs
+++ b/samplecode/crypto/enclave/src/lib.rs
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #![crate_name = "cryptosampleenclave"]
 #![crate_type = "staticlib"]
diff --git a/samplecode/db-proxy/db-client/Cargo.toml b/samplecode/db-proxy/db-client/Cargo.toml
index 0e47eba..1084caa 100644
--- a/samplecode/db-proxy/db-client/Cargo.toml
+++ b/samplecode/db-proxy/db-client/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "db-client"
 version = "0.1.0"
-authors = ["webb.shi <br...@gmail.com>"]
+authors = ["The Teaclave Authors"]
 edition = "2018"
 
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
diff --git a/samplecode/db-proxy/db-proxy/Makefile b/samplecode/db-proxy/db-proxy/Makefile
index 7cab60d..d7abebc 100644
--- a/samplecode/db-proxy/db-proxy/Makefile
+++ b/samplecode/db-proxy/db-proxy/Makefile
@@ -1,31 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# 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 Baidu, Inc., 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.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 
 ######## SGX SDK Settings ########
 
diff --git a/samplecode/db-proxy/db-proxy/app/Cargo.toml b/samplecode/db-proxy/db-proxy/app/Cargo.toml
index b1bdf34..ff5b48d 100644
--- a/samplecode/db-proxy/db-proxy/app/Cargo.toml
+++ b/samplecode/db-proxy/db-proxy/app/Cargo.toml
@@ -1,14 +1,13 @@
 [package]
 name = "app"
 version = "1.0.0"
-authors = ["Baidu"]
+authors = ["The Teaclave Authors"]
 build = "build.rs"
 
 [dependencies]
-sgx_types = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-sgx_urts = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-dirs = "1.0.2"
+sgx_types = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+sgx_urts = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
 
-[patch.'https://github.com/baidu/rust-sgx-sdk.git']
+[patch.'https://github.com/apache/teaclave-sgx-sdk.git']
 sgx_types = { path = "../../../../sgx_types" }
 sgx_urts = { path = "../../../../sgx_urts" }
diff --git a/samplecode/db-proxy/db-proxy/app/build.rs b/samplecode/db-proxy/db-proxy/app/build.rs
index 11c8aff..b20947c 100644
--- a/samplecode/db-proxy/db-proxy/app/build.rs
+++ b/samplecode/db-proxy/db-proxy/app/build.rs
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 use std::env;
 
diff --git a/samplecode/db-proxy/db-proxy/app/src/main.rs b/samplecode/db-proxy/db-proxy/app/src/main.rs
index 0a08d02..1767459 100644
--- a/samplecode/db-proxy/db-proxy/app/src/main.rs
+++ b/samplecode/db-proxy/db-proxy/app/src/main.rs
@@ -1,134 +1,58 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
-extern crate dirs;
 extern crate sgx_types;
 extern crate sgx_urts;
 use sgx_types::*;
 use sgx_urts::SgxEnclave;
-use std::{fs, path};
-use std::io::{Read, Write};
 
 static ENCLAVE_FILE: &'static str = "enclave.signed.so";
-static ENCLAVE_TOKEN: &'static str = "enclave.token";
 
-extern "C" {
-    fn say_something(
-        eid: sgx_enclave_id_t,
-        retval: *mut sgx_status_t,
-        some_string: *const u8,
-        len: usize,
-    ) -> sgx_status_t;
+extern {
+    fn say_something(eid: sgx_enclave_id_t, retval: *mut sgx_status_t,
+                     some_string: *const u8, len: usize) -> sgx_status_t;
 }
 
 fn init_enclave() -> SgxResult<SgxEnclave> {
+
     let mut launch_token: sgx_launch_token_t = [0; 1024];
     let mut launch_token_updated: i32 = 0;
-    // Step 1: try to retrieve the launch token saved by last transaction
-    //         if there is no token, then create a new one.
-    //
-    // try to get the token saved in $HOME */
-    let mut home_dir = path::PathBuf::new();
-    let use_token = match dirs::home_dir() {
-        Some(path) => {
-            println!("[+] Home dir is {}", path.display());
-            home_dir = path;
-            true
-        }
-        None => {
-            println!("[-] Cannot get home dir");
-            false
-        }
-    };
-
-    let token_file: path::PathBuf = home_dir.join(ENCLAVE_TOKEN);;
-    if use_token == true {
-        match fs::File::open(&token_file) {
-            Err(_) => {
-                println!(
-                    "[-] Open token file {} error! Will create one.",
-                    token_file.as_path().to_str().unwrap()
-                );
-            }
-            Ok(mut f) => {
-                println!("[+] Open token file success! ");
-                match f.read(&mut launch_token) {
-                    Ok(1024) => {
-                        println!("[+] Token file valid!");
-                    }
-                    _ => println!("[+] Token file invalid, will create new token file"),
-                }
-            }
-        }
-    }
-
-    // Step 2: call sgx_create_enclave to initialize an enclave instance
+    // call sgx_create_enclave to initialize an enclave instance
     // Debug Support: set 2nd parameter to 1
     let debug = 1;
-    let mut misc_attr = sgx_misc_attribute_t {
-        secs_attr: sgx_attributes_t { flags: 0, xfrm: 0 },
-        misc_select: 0,
-    };
-    let enclave = try!(SgxEnclave::create(
-        ENCLAVE_FILE,
-        debug,
-        &mut launch_token,
-        &mut launch_token_updated,
-        &mut misc_attr
-    ));
-
-    // Step 3: save the launch token if it is updated
-    if use_token == true && launch_token_updated != 0 {
-        // reopen the file with write capablity
-        match fs::File::create(&token_file) {
-            Ok(mut f) => match f.write_all(&launch_token) {
-                Ok(()) => println!("[+] Saved updated launch token!"),
-                Err(_) => println!("[-] Failed to save updated launch token!"),
-            },
-            Err(_) => {
-                println!("[-] Failed to save updated enclave token, but doesn't matter");
-            }
-        }
-    }
-
-    Ok(enclave)
+    let mut misc_attr = sgx_misc_attribute_t {secs_attr: sgx_attributes_t { flags:0, xfrm:0}, misc_select:0};
+    SgxEnclave::create(ENCLAVE_FILE,
+                       debug,
+                       &mut launch_token,
+                       &mut launch_token_updated,
+                       &mut misc_attr)
 }
 
 fn main() {
+
     let enclave = match init_enclave() {
         Ok(r) => {
             println!("[+] Init Enclave Successful {}!", r.geteid());
             r
-        }
+        },
         Err(x) => {
             println!("[-] Init Enclave Failed {}!", x.as_str());
             return;
-        }
+        },
     };
 
     let input_string = String::from("This is a normal world string passed into Enclave!\n");
@@ -136,16 +60,14 @@ fn main() {
     let mut retval = sgx_status_t::SGX_SUCCESS;
 
     let result = unsafe {
-        say_something(
-            enclave.geteid(),
-            &mut retval,
-            input_string.as_ptr() as *const u8,
-            input_string.len(),
-        )
+        say_something(enclave.geteid(),
+                      &mut retval,
+                      input_string.as_ptr() as * const u8,
+                      input_string.len())
     };
 
     match result {
-        sgx_status_t::SGX_SUCCESS => {}
+        sgx_status_t::SGX_SUCCESS => {},
         _ => {
             println!("[-] ECALL Enclave Failed {}!", result.as_str());
             return;
diff --git a/samplecode/db-proxy/db-proxy/enclave/Cargo.toml b/samplecode/db-proxy/db-proxy/enclave/Cargo.toml
index 9e08d1a..85d4f43 100644
--- a/samplecode/db-proxy/db-proxy/enclave/Cargo.toml
+++ b/samplecode/db-proxy/db-proxy/enclave/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "dbproxysampleenclave"
 version = "1.0.0"
-authors = ["Baidu"]
+authors = ["The Teaclave Authors"]
 
 [lib]
 name = "dbproxysampleenclave"
@@ -11,10 +11,10 @@ crate-type = ["staticlib"]
 default = []
 
 [target.'cfg(not(target_env = "sgx"))'.dependencies]
-sgx_types = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-sgx_tstd = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
+sgx_types = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+sgx_tstd = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
 
-[patch.'https://github.com/baidu/rust-sgx-sdk.git']
+[patch.'https://github.com/apache/teaclave-sgx-sdk.git']
 sgx_alloc = { path = "../../../../sgx_alloc" }
 sgx_backtrace = { path = "../../../../sgx_backtrace" }
 sgx_backtrace_sys = { path = "../../../../sgx_backtrace_sys" }
diff --git a/samplecode/db-proxy/db-proxy/enclave/Enclave.edl b/samplecode/db-proxy/db-proxy/enclave/Enclave.edl
index f087054..0263761 100644
--- a/samplecode/db-proxy/db-proxy/enclave/Enclave.edl
+++ b/samplecode/db-proxy/db-proxy/enclave/Enclave.edl
@@ -1,33 +1,19 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 
 enclave {
     from "sgx_tstd.edl" import *;
diff --git a/samplecode/db-proxy/db-proxy/enclave/Makefile b/samplecode/db-proxy/db-proxy/enclave/Makefile
index 3d73f73..cf074bd 100644
--- a/samplecode/db-proxy/db-proxy/enclave/Makefile
+++ b/samplecode/db-proxy/db-proxy/enclave/Makefile
@@ -1,31 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# 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 Baidu, Inc., 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.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 Rust_Enclave_Name := libenclave.a
 Rust_Enclave_Files := $(wildcard src/*.rs)
 Rust_Target_Path := $(CURDIR)/../../../../xargo
diff --git a/samplecode/db-proxy/db-proxy/enclave/Xargo.toml b/samplecode/db-proxy/db-proxy/enclave/Xargo.toml
index cc955cd..6d4db74 100644
--- a/samplecode/db-proxy/db-proxy/enclave/Xargo.toml
+++ b/samplecode/db-proxy/db-proxy/enclave/Xargo.toml
@@ -5,6 +5,10 @@ alloc = {}
 path = "../../../../sgx_types"
 stage = 1
 
+[dependencies.sgx_alloc]
+path = "../../../../sgx_alloc"
+stage = 1
+
 [dependencies.sgx_demangle]
 path = "../../../../sgx_demangle"
 stage = 1
@@ -41,9 +45,9 @@ stage = 3
 path = "../../../../sgx_backtrace_sys"
 stage = 3
 
-[dependencies.sgx_unwind]
-path = "../../../../sgx_unwind"
-stage = 4
+[dependencies.panic_unwind]
+path = "../../../../sgx_panic_unwind"
+stage = 3
 
 [dependencies.sgx_tdh]
 path = "../../../../sgx_tdh"
@@ -57,34 +61,30 @@ stage = 4
 path = "../../../../sgx_tprotected_fs"
 stage = 4
 
-[dependencies.sgx_alloc]
-path = "../../../../sgx_alloc"
-stage = 4
-
-[dependencies.panic_unwind]
-path = "../../../../sgx_panic_unwind"
-stage = 5
-
 [dependencies.std]
 path = "../../../../xargo/sgx_tstd"
-stage = 6
+stage = 5
+
+[dependencies.sgx_no_tstd]
+path = "../../../../sgx_no_tstd"
+stage = 5
 
 [dependencies.sgx_rand]
 path = "../../../../sgx_rand"
-stage = 7
+stage = 6
 
 [dependencies.sgx_serialize]
 path = "../../../../sgx_serialize"
-stage = 7
+stage = 6
 
 [dependencies.sgx_tunittest]
 path = "../../../../sgx_tunittest"
-stage = 7
+stage = 6
 
 [dependencies.sgx_backtrace]
 path = "../../../../sgx_backtrace"
-stage = 8
+stage = 7
 
 [dependencies.sgx_cov]
 path = "../../../../sgx_cov"
-stage = 8
+stage = 7
diff --git a/samplecode/db-proxy/db-proxy/enclave/src/lib.rs b/samplecode/db-proxy/db-proxy/enclave/src/lib.rs
index ac2d4dc..047e3ad 100644
--- a/samplecode/db-proxy/db-proxy/enclave/src/lib.rs
+++ b/samplecode/db-proxy/db-proxy/enclave/src/lib.rs
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #![crate_name = "dbproxysampleenclave"]
 #![crate_type = "staticlib"]
diff --git a/samplecode/db-proxy/db-server/Cargo.toml b/samplecode/db-proxy/db-server/Cargo.toml
index 2009302..b42c85f 100644
--- a/samplecode/db-proxy/db-server/Cargo.toml
+++ b/samplecode/db-proxy/db-server/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "db-server"
 version = "0.1.0"
-authors = ["webb.shi <br...@gmail.com>"]
+authors = ["The Teaclave Authors"]
 edition = "2018"
 
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -13,4 +13,4 @@ hex = "0.4.0"
 serde = { version = "1.0.60", features = ["derive"] }
 serde_json = "1.0.41"
 parking_lot = "0.6.3"
-rocksdb = "0.12.4"
\ No newline at end of file
+rocksdb = "0.12.4"
diff --git a/samplecode/file/Makefile b/samplecode/file/Makefile
index be8d6cb..32dac96 100644
--- a/samplecode/file/Makefile
+++ b/samplecode/file/Makefile
@@ -1,30 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
-#  * 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 Baidu, Inc., 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.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 
 ######## SGX SDK Settings ########
 
diff --git a/samplecode/file/app/app.c b/samplecode/file/app/app.c
index 0533630..5abf3bb 100644
--- a/samplecode/file/app/app.c
+++ b/samplecode/file/app/app.c
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #include <stdio.h>
 #include <string.h>
@@ -145,73 +134,20 @@ void print_error_message(sgx_status_t ret)
         printf("Error: Unexpected error occurred.\n");
 }
 
-/* Initialize the enclave:
- *   Step 1: try to retrieve the launch token saved by last transaction
- *   Step 2: call sgx_create_enclave to initialize an enclave instance
- *   Step 3: save the launch token if it is updated
- */
 int initialize_enclave(void)
 {
-    char token_path[MAX_PATH] = {'\0'};
     sgx_launch_token_t token = {0};
     sgx_status_t ret = SGX_ERROR_UNEXPECTED;
     int updated = 0;
 
-    /* Step 1: try to retrieve the launch token saved by last transaction
-     *         if there is no token, then create a new one.
-     */
-    /* try to get the token saved in $HOME */
-    const char *home_dir = getpwuid(getuid())->pw_dir;
-
-    if (home_dir != NULL &&
-        (strlen(home_dir)+strlen("/")+sizeof(TOKEN_FILENAME)+1) <= MAX_PATH) {
-        /* compose the token path */
-        strncpy(token_path, home_dir, strlen(home_dir));
-        strncat(token_path, "/", strlen("/"));
-        strncat(token_path, TOKEN_FILENAME, sizeof(TOKEN_FILENAME)+1);
-    } else {
-        /* if token path is too long or $HOME is NULL */
-        strncpy(token_path, TOKEN_FILENAME, sizeof(TOKEN_FILENAME));
-    }
-
-    FILE *fp = fopen(token_path, "rb");
-    if (fp == NULL && (fp = fopen(token_path, "wb")) == NULL) {
-        printf("Warning: Failed to create/open the launch token file \"%s\".\n", token_path);
-    }
-
-    if (fp != NULL) {
-        /* read the token from saved file */
-        size_t read_num = fread(token, 1, sizeof(sgx_launch_token_t), fp);
-        if (read_num != 0 && read_num != sizeof(sgx_launch_token_t)) {
-            /* if token is invalid, clear the buffer */
-            memset(&token, 0x0, sizeof(sgx_launch_token_t));
-            printf("Warning: Invalid launch token read from \"%s\".\n", token_path);
-        }
-    }
-    /* Step 2: call sgx_create_enclave to initialize an enclave instance */
+    /* call sgx_create_enclave to initialize an enclave instance */
     /* Debug Support: set 2nd parameter to 1 */
     ret = sgx_create_enclave(ENCLAVE_FILENAME, SGX_DEBUG_FLAG, &token, &updated, &global_eid, NULL);
     if (ret != SGX_SUCCESS) {
         print_error_message(ret);
-        if (fp != NULL) fclose(fp);
         return -1;
     }
-    printf("global_eid: %ld\n", global_eid);
-
-    /* Step 3: save the launch token if it is updated */
-    if (updated == FALSE || fp == NULL) {
-        /* if the token is not updated, or file handler is invalid, do not perform saving */
-        if (fp != NULL) fclose(fp);
-        return 0;
-    }
-
-    /* reopen the file with write capablity */
-    fp = freopen(token_path, "wb", fp);
-    if (fp == NULL) return 0;
-    size_t write_num = fwrite(token, 1, sizeof(sgx_launch_token_t), fp);
-    if (write_num != sizeof(sgx_launch_token_t))
-        printf("Warning: Failed to save launch token to \"%s\".\n", token_path);
-    fclose(fp);
+    printf("[+] global_eid: %ld\n", global_eid);
     return 0;
 }
 
diff --git a/samplecode/file/app/app.h b/samplecode/file/app/app.h
index aecb4c2..c3c2c7d 100644
--- a/samplecode/file/app/app.h
+++ b/samplecode/file/app/app.h
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #ifndef _APP_H_
 #define _APP_H_
@@ -45,7 +34,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/file/enclave/Cargo.toml b/samplecode/file/enclave/Cargo.toml
index 988687b..1245cd7 100644
--- a/samplecode/file/enclave/Cargo.toml
+++ b/samplecode/file/enclave/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "Filesampleenclave"
 version = "1.0.0"
-authors = ["Baidu"]
+authors = ["The Teaclave Authors"]
 
 [lib]
 name = "filesampleenclave"
@@ -11,15 +11,15 @@ crate-type = ["staticlib"]
 default = []
 
 [target.'cfg(not(target_env = "sgx"))'.dependencies]
-sgx_tstd = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-sgx_rand = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-sgx_serialize = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
+sgx_tstd = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+sgx_rand = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+sgx_serialize = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
 
 [dependencies]
-sgx_rand_derive = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-sgx_serialize_derive = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
+sgx_rand_derive = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+sgx_serialize_derive = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
 
-[patch.'https://github.com/baidu/rust-sgx-sdk.git']
+[patch.'https://github.com/apache/teaclave-sgx-sdk.git']
 sgx_alloc = { path = "../../../sgx_alloc" }
 sgx_backtrace = { path = "../../../sgx_backtrace" }
 sgx_backtrace_sys = { path = "../../../sgx_backtrace_sys" }
diff --git a/samplecode/file/enclave/Enclave.edl b/samplecode/file/enclave/Enclave.edl
index 95ea607..aa41374 100644
--- a/samplecode/file/enclave/Enclave.edl
+++ b/samplecode/file/enclave/Enclave.edl
@@ -1,33 +1,19 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 
 enclave {
     from "sgx_tstd.edl" import *;
diff --git a/samplecode/file/enclave/Makefile b/samplecode/file/enclave/Makefile
index 8d12feb..2457e35 100644
--- a/samplecode/file/enclave/Makefile
+++ b/samplecode/file/enclave/Makefile
@@ -1,30 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
-#  * 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 Baidu, Inc., 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.
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 
 Rust_Enclave_Name := libenclave.a
 Rust_Enclave_Files := $(wildcard src/*.rs)
diff --git a/samplecode/file/enclave/Xargo.toml b/samplecode/file/enclave/Xargo.toml
index c088ebb..cb43640 100644
--- a/samplecode/file/enclave/Xargo.toml
+++ b/samplecode/file/enclave/Xargo.toml
@@ -5,6 +5,14 @@ alloc = {}
 path = "../../../sgx_types"
 stage = 1
 
+[dependencies.sgx_alloc]
+path = "../../../sgx_alloc"
+stage = 1
+
+[dependencies.sgx_unwind]
+path = "../../../sgx_unwind"
+stage = 1
+
 [dependencies.sgx_demangle]
 path = "../../../sgx_demangle"
 stage = 1
@@ -41,9 +49,9 @@ stage = 3
 path = "../../../sgx_backtrace_sys"
 stage = 3
 
-[dependencies.sgx_unwind]
-path = "../../../sgx_unwind"
-stage = 4
+[dependencies.panic_unwind]
+path = "../../../sgx_panic_unwind"
+stage = 3
 
 [dependencies.sgx_tdh]
 path = "../../../sgx_tdh"
@@ -57,34 +65,30 @@ stage = 4
 path = "../../../sgx_tprotected_fs"
 stage = 4
 
-[dependencies.sgx_alloc]
-path = "../../../sgx_alloc"
-stage = 4
-
-[dependencies.panic_unwind]
-path = "../../../sgx_panic_unwind"
-stage = 5
-
 [dependencies.std]
 path = "../../../xargo/sgx_tstd"
-stage = 6
+stage = 5
+
+[dependencies.sgx_no_tstd]
+path = "../../../sgx_no_tstd"
+stage = 5
 
 [dependencies.sgx_rand]
 path = "../../../sgx_rand"
-stage = 7
+stage = 6
 
 [dependencies.sgx_serialize]
 path = "../../../sgx_serialize"
-stage = 7
+stage = 6
 
 [dependencies.sgx_tunittest]
 path = "../../../sgx_tunittest"
-stage = 7
+stage = 6
 
 [dependencies.sgx_backtrace]
 path = "../../../sgx_backtrace"
-stage = 8
+stage = 7
 
 [dependencies.sgx_cov]
 path = "../../../sgx_cov"
-stage = 8
+stage = 7
diff --git a/samplecode/file/enclave/src/lib.rs b/samplecode/file/enclave/src/lib.rs
index f9ab735..4ecc75c 100644
--- a/samplecode/file/enclave/src/lib.rs
+++ b/samplecode/file/enclave/src/lib.rs
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #![crate_name = "filesampleenclave"]
 #![crate_type = "staticlib"]
diff --git a/samplecode/hello-regex/Makefile b/samplecode/hello-regex/Makefile
index e58a5f3..fb0b649 100644
--- a/samplecode/hello-regex/Makefile
+++ b/samplecode/hello-regex/Makefile
@@ -1,31 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# 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 Baidu, Inc., 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.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 
 ######## SGX SDK Settings ########
 
diff --git a/samplecode/hello-regex/app/app.c b/samplecode/hello-regex/app/app.c
index 3e4c348..bbc5710 100644
--- a/samplecode/hello-regex/app/app.c
+++ b/samplecode/hello-regex/app/app.c
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #include <stdio.h>
 #include <string.h>
@@ -145,73 +134,20 @@ void print_error_message(sgx_status_t ret)
         printf("Error: Unexpected error occurred.\n");
 }
 
-/* Initialize the enclave:
- *   Step 1: try to retrieve the launch token saved by last transaction
- *   Step 2: call sgx_create_enclave to initialize an enclave instance
- *   Step 3: save the launch token if it is updated
- */
 int initialize_enclave(void)
 {
-    char token_path[MAX_PATH] = {'\0'};
     sgx_launch_token_t token = {0};
     sgx_status_t ret = SGX_ERROR_UNEXPECTED;
     int updated = 0;
 
-    /* Step 1: try to retrieve the launch token saved by last transaction
-     *         if there is no token, then create a new one.
-     */
-    /* try to get the token saved in $HOME */
-    const char *home_dir = getpwuid(getuid())->pw_dir;
-
-    if (home_dir != NULL &&
-        (strlen(home_dir)+strlen("/")+sizeof(TOKEN_FILENAME)+1) <= MAX_PATH) {
-        /* compose the token path */
-        strncpy(token_path, home_dir, strlen(home_dir));
-        strncat(token_path, "/", strlen("/"));
-        strncat(token_path, TOKEN_FILENAME, sizeof(TOKEN_FILENAME)+1);
-    } else {
-        /* if token path is too long or $HOME is NULL */
-        strncpy(token_path, TOKEN_FILENAME, sizeof(TOKEN_FILENAME));
-    }
-
-    FILE *fp = fopen(token_path, "rb");
-    if (fp == NULL && (fp = fopen(token_path, "wb")) == NULL) {
-        printf("Warning: Failed to create/open the launch token file \"%s\".\n", token_path);
-    }
-
-    if (fp != NULL) {
-        /* read the token from saved file */
-        size_t read_num = fread(token, 1, sizeof(sgx_launch_token_t), fp);
-        if (read_num != 0 && read_num != sizeof(sgx_launch_token_t)) {
-            /* if token is invalid, clear the buffer */
-            memset(&token, 0x0, sizeof(sgx_launch_token_t));
-            printf("Warning: Invalid launch token read from \"%s\".\n", token_path);
-        }
-    }
-    /* Step 2: call sgx_create_enclave to initialize an enclave instance */
+    /* call sgx_create_enclave to initialize an enclave instance */
     /* Debug Support: set 2nd parameter to 1 */
     ret = sgx_create_enclave(ENCLAVE_FILENAME, SGX_DEBUG_FLAG, &token, &updated, &global_eid, NULL);
     if (ret != SGX_SUCCESS) {
         print_error_message(ret);
-        if (fp != NULL) fclose(fp);
         return -1;
     }
     printf("[+] global_eid: %ld\n", global_eid);
-
-    /* Step 3: save the launch token if it is updated */
-    if (updated == FALSE || fp == NULL) {
-        /* if the token is not updated, or file handler is invalid, do not perform saving */
-        if (fp != NULL) fclose(fp);
-        return 0;
-    }
-
-    /* reopen the file with write capablity */
-    fp = freopen(token_path, "wb", fp);
-    if (fp == NULL) return 0;
-    size_t write_num = fwrite(token, 1, sizeof(sgx_launch_token_t), fp);
-    if (write_num != sizeof(sgx_launch_token_t))
-        printf("Warning: Failed to save launch token to \"%s\".\n", token_path);
-    fclose(fp);
     return 0;
 }
 
diff --git a/samplecode/hello-regex/app/app.h b/samplecode/hello-regex/app/app.h
index aecb4c2..c3c2c7d 100644
--- a/samplecode/hello-regex/app/app.h
+++ b/samplecode/hello-regex/app/app.h
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #ifndef _APP_H_
 #define _APP_H_
@@ -45,7 +34,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/hello-regex/enclave/Cargo.toml b/samplecode/hello-regex/enclave/Cargo.toml
index 1f78b14..eccccba 100644
--- a/samplecode/hello-regex/enclave/Cargo.toml
+++ b/samplecode/hello-regex/enclave/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "Helloregexsampleenclave"
 version = "1.0.0"
-authors = ["Baidu"]
+authors = ["The Teaclave Authors"]
 
 [lib]
 name = "helloregexsampleenclave"
@@ -14,10 +14,10 @@ default = []
 regex = { git = "https://github.com/mesalock-linux/regex-sgx" }
 
 [target.'cfg(not(target_env = "sgx"))'.dependencies]
-sgx_types = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-sgx_tstd = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
+sgx_types = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+sgx_tstd = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
 
-[patch.'https://github.com/baidu/rust-sgx-sdk.git']
+[patch.'https://github.com/apache/teaclave-sgx-sdk.git']
 sgx_alloc = { path = "../../../sgx_alloc" }
 sgx_backtrace = { path = "../../../sgx_backtrace" }
 sgx_backtrace_sys = { path = "../../../sgx_backtrace_sys" }
diff --git a/samplecode/hello-regex/enclave/Enclave.edl b/samplecode/hello-regex/enclave/Enclave.edl
index 6126c0a..54710ff 100644
--- a/samplecode/hello-regex/enclave/Enclave.edl
+++ b/samplecode/hello-regex/enclave/Enclave.edl
@@ -1,33 +1,19 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 
 enclave {
     from "sgx_tstd.edl" import *;
diff --git a/samplecode/hello-regex/enclave/Makefile b/samplecode/hello-regex/enclave/Makefile
index b0ccf62..fbf28c1 100644
--- a/samplecode/hello-regex/enclave/Makefile
+++ b/samplecode/hello-regex/enclave/Makefile
@@ -1,31 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# 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 Baidu, Inc., 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.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 Rust_Enclave_Name := libenclave.a
 Rust_Enclave_Files := $(wildcard src/*.rs)
 Rust_Target_Path := $(CURDIR)/../../../xargo
diff --git a/samplecode/hello-regex/enclave/Xargo.toml b/samplecode/hello-regex/enclave/Xargo.toml
index c088ebb..cb43640 100644
--- a/samplecode/hello-regex/enclave/Xargo.toml
+++ b/samplecode/hello-regex/enclave/Xargo.toml
@@ -5,6 +5,14 @@ alloc = {}
 path = "../../../sgx_types"
 stage = 1
 
+[dependencies.sgx_alloc]
+path = "../../../sgx_alloc"
+stage = 1
+
+[dependencies.sgx_unwind]
+path = "../../../sgx_unwind"
+stage = 1
+
 [dependencies.sgx_demangle]
 path = "../../../sgx_demangle"
 stage = 1
@@ -41,9 +49,9 @@ stage = 3
 path = "../../../sgx_backtrace_sys"
 stage = 3
 
-[dependencies.sgx_unwind]
-path = "../../../sgx_unwind"
-stage = 4
+[dependencies.panic_unwind]
+path = "../../../sgx_panic_unwind"
+stage = 3
 
 [dependencies.sgx_tdh]
 path = "../../../sgx_tdh"
@@ -57,34 +65,30 @@ stage = 4
 path = "../../../sgx_tprotected_fs"
 stage = 4
 
-[dependencies.sgx_alloc]
-path = "../../../sgx_alloc"
-stage = 4
-
-[dependencies.panic_unwind]
-path = "../../../sgx_panic_unwind"
-stage = 5
-
 [dependencies.std]
 path = "../../../xargo/sgx_tstd"
-stage = 6
+stage = 5
+
+[dependencies.sgx_no_tstd]
+path = "../../../sgx_no_tstd"
+stage = 5
 
 [dependencies.sgx_rand]
 path = "../../../sgx_rand"
-stage = 7
+stage = 6
 
 [dependencies.sgx_serialize]
 path = "../../../sgx_serialize"
-stage = 7
+stage = 6
 
 [dependencies.sgx_tunittest]
 path = "../../../sgx_tunittest"
-stage = 7
+stage = 6
 
 [dependencies.sgx_backtrace]
 path = "../../../sgx_backtrace"
-stage = 8
+stage = 7
 
 [dependencies.sgx_cov]
 path = "../../../sgx_cov"
-stage = 8
+stage = 7
diff --git a/samplecode/hello-regex/enclave/src/lib.rs b/samplecode/hello-regex/enclave/src/lib.rs
index ede1667..0d82c11 100644
--- a/samplecode/hello-regex/enclave/src/lib.rs
+++ b/samplecode/hello-regex/enclave/src/lib.rs
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #![crate_name = "helloregexsampleenclave"]
 #![crate_type = "staticlib"]
diff --git a/samplecode/hello-rust-vscode-debug/Cargo.toml b/samplecode/hello-rust-vscode-debug/Cargo.toml
index ebc603c..b05a940 100644
--- a/samplecode/hello-rust-vscode-debug/Cargo.toml
+++ b/samplecode/hello-rust-vscode-debug/Cargo.toml
@@ -5,7 +5,7 @@ members = [
     "enclave",
 ]
 
-[patch.'https://github.com/baidu/rust-sgx-sdk.git']
+[patch.'https://github.com/apache/teaclave-sgx-sdk.git']
 sgx_alloc = { path = "../../sgx_alloc" }
 sgx_build_helper = { path = "../../sgx_build_helper" }
 sgx_cov = { path = "../../sgx_cov" }
diff --git a/samplecode/hello-rust-vscode-debug/Makefile b/samplecode/hello-rust-vscode-debug/Makefile
index 004eab7..46b1e73 100644
--- a/samplecode/hello-rust-vscode-debug/Makefile
+++ b/samplecode/hello-rust-vscode-debug/Makefile
@@ -1,31 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# 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 Baidu, Inc., 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.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 
 ######## SGX SDK Settings ########
 
diff --git a/samplecode/hello-rust-vscode-debug/app/Cargo.toml b/samplecode/hello-rust-vscode-debug/app/Cargo.toml
index ecbc98e..25c3ae4 100644
--- a/samplecode/hello-rust-vscode-debug/app/Cargo.toml
+++ b/samplecode/hello-rust-vscode-debug/app/Cargo.toml
@@ -1,14 +1,13 @@
 [package]
 name = "app"
 version = "1.0.0"
-authors = ["Baidu"]
+authors = ["The Teaclave Authors"]
 build = "build.rs"
 
 [dependencies]
-sgx_types =  { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-sgx_urts =  { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-dirs = "1.0.2"
+sgx_types =  { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+sgx_urts =  { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
 
-[patch.'https://github.com/baidu/rust-sgx-sdk.git']
+[patch.'https://github.com/apache/teaclave-sgx-sdk.git']
 sgx_types = { path = "../../../sgx_types" }
 sgx_urts = { path = "../../../sgx_urts" }
diff --git a/samplecode/hello-rust-vscode-debug/app/build.rs b/samplecode/hello-rust-vscode-debug/app/build.rs
index 4ce774e..d5efb4d 100644
--- a/samplecode/hello-rust-vscode-debug/app/build.rs
+++ b/samplecode/hello-rust-vscode-debug/app/build.rs
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 use std::env;
 
diff --git a/samplecode/hello-rust-vscode-debug/app/src/main.rs b/samplecode/hello-rust-vscode-debug/app/src/main.rs
index 9d122be..1767459 100644
--- a/samplecode/hello-rust-vscode-debug/app/src/main.rs
+++ b/samplecode/hello-rust-vscode-debug/app/src/main.rs
@@ -1,43 +1,26 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 extern crate sgx_types;
 extern crate sgx_urts;
-extern crate dirs;
 use sgx_types::*;
 use sgx_urts::SgxEnclave;
 
-use std::io::{Read, Write};
-use std::fs;
-use std::path;
-
 static ENCLAVE_FILE: &'static str = "enclave.signed.so";
-static ENCLAVE_TOKEN: &'static str = "enclave.token";
 
 extern {
     fn say_something(eid: sgx_enclave_id_t, retval: *mut sgx_status_t,
@@ -48,68 +31,15 @@ fn init_enclave() -> SgxResult<SgxEnclave> {
 
     let mut launch_token: sgx_launch_token_t = [0; 1024];
     let mut launch_token_updated: i32 = 0;
-    // Step 1: try to retrieve the launch token saved by last transaction
-    //         if there is no token, then create a new one.
-    //
-    // try to get the token saved in $HOME */
-    let mut home_dir = path::PathBuf::new();
-    let use_token = match dirs::home_dir() {
-        Some(path) => {
-            println!("[+] Home dir is {}", path.display());
-            home_dir = path;
-            true
-        },
-        None => {
-            println!("[-] Cannot get home dir");
-            false
-        }
-    };
-
-    let token_file: path::PathBuf = home_dir.join(ENCLAVE_TOKEN);;
-    if use_token == true {
-        match fs::File::open(&token_file) {
-            Err(_) => {
-                println!("[-] Open token file {} error! Will create one.", token_file.as_path().to_str().unwrap());
-            },
-            Ok(mut f) => {
-                println!("[+] Open token file success! ");
-                match f.read(&mut launch_token) {
-                    Ok(1024) => {
-                        println!("[+] Token file valid!");
-                    },
-                    _ => println!("[+] Token file invalid, will create new token file"),
-                }
-            }
-        }
-    }
-
-    // Step 2: call sgx_create_enclave to initialize an enclave instance
+    // call sgx_create_enclave to initialize an enclave instance
     // Debug Support: set 2nd parameter to 1
     let debug = 1;
     let mut misc_attr = sgx_misc_attribute_t {secs_attr: sgx_attributes_t { flags:0, xfrm:0}, misc_select:0};
-    let enclave = try!(SgxEnclave::create(ENCLAVE_FILE,
-                                          debug,
-                                          &mut launch_token,
-                                          &mut launch_token_updated,
-                                          &mut misc_attr));
-
-    // Step 3: save the launch token if it is updated
-    if use_token == true && launch_token_updated != 0 {
-        // reopen the file with write capablity
-        match fs::File::create(&token_file) {
-            Ok(mut f) => {
-                match f.write_all(&launch_token) {
-                    Ok(()) => println!("[+] Saved updated launch token!"),
-                    Err(_) => println!("[-] Failed to save updated launch token!"),
-                }
-            },
-            Err(_) => {
-                println!("[-] Failed to save updated enclave token, but doesn't matter");
-            },
-        }
-    }
-
-    Ok(enclave)
+    SgxEnclave::create(ENCLAVE_FILE,
+                       debug,
+                       &mut launch_token,
+                       &mut launch_token_updated,
+                       &mut misc_attr)
 }
 
 fn main() {
diff --git a/samplecode/hello-rust-vscode-debug/enclave/Cargo.toml b/samplecode/hello-rust-vscode-debug/enclave/Cargo.toml
index 8cdbdb3..d508cd4 100644
--- a/samplecode/hello-rust-vscode-debug/enclave/Cargo.toml
+++ b/samplecode/hello-rust-vscode-debug/enclave/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "Helloworldsampleenclave"
 version = "1.0.0"
-authors = ["Baidu"]
+authors = ["The Teaclave Authors"]
 
 [lib]
 name = "helloworldsampleenclave"
@@ -11,10 +11,10 @@ crate-type = ["staticlib"]
 default = []
 
 [target.'cfg(not(target_env = "sgx"))'.dependencies]
-sgx_types = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-sgx_tstd = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
+sgx_types = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+sgx_tstd = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
 
-[patch.'https://github.com/baidu/rust-sgx-sdk.git']
+[patch.'https://github.com/apache/teaclave-sgx-sdk.git']
 sgx_alloc = { path = "../../../sgx_alloc" }
 sgx_backtrace = { path = "../../../sgx_backtrace" }
 sgx_backtrace_sys = { path = "../../../sgx_backtrace_sys" }
diff --git a/samplecode/hello-rust-vscode-debug/enclave/Enclave.edl b/samplecode/hello-rust-vscode-debug/enclave/Enclave.edl
index f087054..0263761 100644
--- a/samplecode/hello-rust-vscode-debug/enclave/Enclave.edl
+++ b/samplecode/hello-rust-vscode-debug/enclave/Enclave.edl
@@ -1,33 +1,19 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 
 enclave {
     from "sgx_tstd.edl" import *;
diff --git a/samplecode/hello-rust-vscode-debug/enclave/Makefile b/samplecode/hello-rust-vscode-debug/enclave/Makefile
index d4dafce..2ed45a0 100644
--- a/samplecode/hello-rust-vscode-debug/enclave/Makefile
+++ b/samplecode/hello-rust-vscode-debug/enclave/Makefile
@@ -1,31 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# 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 Baidu, Inc., 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.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 Rust_Enclave_Name := libenclave.a
 Rust_Enclave_Files := $(wildcard src/*.rs)
 Rust_Target_Path := $(CURDIR)/../../../xargo
diff --git a/samplecode/hello-rust-vscode-debug/enclave/Xargo.toml b/samplecode/hello-rust-vscode-debug/enclave/Xargo.toml
index c088ebb..cb43640 100644
--- a/samplecode/hello-rust-vscode-debug/enclave/Xargo.toml
+++ b/samplecode/hello-rust-vscode-debug/enclave/Xargo.toml
@@ -5,6 +5,14 @@ alloc = {}
 path = "../../../sgx_types"
 stage = 1
 
+[dependencies.sgx_alloc]
+path = "../../../sgx_alloc"
+stage = 1
+
+[dependencies.sgx_unwind]
+path = "../../../sgx_unwind"
+stage = 1
+
 [dependencies.sgx_demangle]
 path = "../../../sgx_demangle"
 stage = 1
@@ -41,9 +49,9 @@ stage = 3
 path = "../../../sgx_backtrace_sys"
 stage = 3
 
-[dependencies.sgx_unwind]
-path = "../../../sgx_unwind"
-stage = 4
+[dependencies.panic_unwind]
+path = "../../../sgx_panic_unwind"
+stage = 3
 
 [dependencies.sgx_tdh]
 path = "../../../sgx_tdh"
@@ -57,34 +65,30 @@ stage = 4
 path = "../../../sgx_tprotected_fs"
 stage = 4
 
-[dependencies.sgx_alloc]
-path = "../../../sgx_alloc"
-stage = 4
-
-[dependencies.panic_unwind]
-path = "../../../sgx_panic_unwind"
-stage = 5
-
 [dependencies.std]
 path = "../../../xargo/sgx_tstd"
-stage = 6
+stage = 5
+
+[dependencies.sgx_no_tstd]
+path = "../../../sgx_no_tstd"
+stage = 5
 
 [dependencies.sgx_rand]
 path = "../../../sgx_rand"
-stage = 7
+stage = 6
 
 [dependencies.sgx_serialize]
 path = "../../../sgx_serialize"
-stage = 7
+stage = 6
 
 [dependencies.sgx_tunittest]
 path = "../../../sgx_tunittest"
-stage = 7
+stage = 6
 
 [dependencies.sgx_backtrace]
 path = "../../../sgx_backtrace"
-stage = 8
+stage = 7
 
 [dependencies.sgx_cov]
 path = "../../../sgx_cov"
-stage = 8
+stage = 7
diff --git a/samplecode/hello-rust-vscode-debug/enclave/src/lib.rs b/samplecode/hello-rust-vscode-debug/enclave/src/lib.rs
index fccc83e..b0dea9a 100644
--- a/samplecode/hello-rust-vscode-debug/enclave/src/lib.rs
+++ b/samplecode/hello-rust-vscode-debug/enclave/src/lib.rs
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #![crate_name = "helloworldsampleenclave"]
 #![crate_type = "staticlib"]
diff --git a/samplecode/hello-rust/Makefile b/samplecode/hello-rust/Makefile
index 819c6a2..54997be 100644
--- a/samplecode/hello-rust/Makefile
+++ b/samplecode/hello-rust/Makefile
@@ -1,31 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# 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 Baidu, Inc., 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.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 
 ######## SGX SDK Settings ########
 
diff --git a/samplecode/hello-rust/app/Cargo.toml b/samplecode/hello-rust/app/Cargo.toml
index 3a42cfc..b3d39f6 100644
--- a/samplecode/hello-rust/app/Cargo.toml
+++ b/samplecode/hello-rust/app/Cargo.toml
@@ -1,15 +1,14 @@
 [package]
 name = "app"
 version = "1.0.0"
-authors = ["Baidu"]
+authors = ["The Teaclave Authors"]
 build = "build.rs"
 
 [dependencies]
-sgx_types = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-sgx_urts = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-dirs = "1.0.2"
+sgx_types = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+sgx_urts = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
 
-[patch.'https://github.com/baidu/rust-sgx-sdk.git']
+[patch.'https://github.com/apache/teaclave-sgx-sdk.git']
 sgx_types = { path = "../../../sgx_types" }
 sgx_urts = { path = "../../../sgx_urts" }
 
diff --git a/samplecode/hello-rust/app/build.rs b/samplecode/hello-rust/app/build.rs
index de29f98..8ec16f1 100644
--- a/samplecode/hello-rust/app/build.rs
+++ b/samplecode/hello-rust/app/build.rs
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 use std::env;
 
diff --git a/samplecode/hello-rust/app/src/main.rs b/samplecode/hello-rust/app/src/main.rs
index 9d122be..cdb6d39 100644
--- a/samplecode/hello-rust/app/src/main.rs
+++ b/samplecode/hello-rust/app/src/main.rs
@@ -1,43 +1,26 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 extern crate sgx_types;
 extern crate sgx_urts;
-extern crate dirs;
 use sgx_types::*;
 use sgx_urts::SgxEnclave;
 
-use std::io::{Read, Write};
-use std::fs;
-use std::path;
-
 static ENCLAVE_FILE: &'static str = "enclave.signed.so";
-static ENCLAVE_TOKEN: &'static str = "enclave.token";
 
 extern {
     fn say_something(eid: sgx_enclave_id_t, retval: *mut sgx_status_t,
@@ -45,75 +28,20 @@ extern {
 }
 
 fn init_enclave() -> SgxResult<SgxEnclave> {
-
     let mut launch_token: sgx_launch_token_t = [0; 1024];
     let mut launch_token_updated: i32 = 0;
-    // Step 1: try to retrieve the launch token saved by last transaction
-    //         if there is no token, then create a new one.
-    //
-    // try to get the token saved in $HOME */
-    let mut home_dir = path::PathBuf::new();
-    let use_token = match dirs::home_dir() {
-        Some(path) => {
-            println!("[+] Home dir is {}", path.display());
-            home_dir = path;
-            true
-        },
-        None => {
-            println!("[-] Cannot get home dir");
-            false
-        }
-    };
-
-    let token_file: path::PathBuf = home_dir.join(ENCLAVE_TOKEN);;
-    if use_token == true {
-        match fs::File::open(&token_file) {
-            Err(_) => {
-                println!("[-] Open token file {} error! Will create one.", token_file.as_path().to_str().unwrap());
-            },
-            Ok(mut f) => {
-                println!("[+] Open token file success! ");
-                match f.read(&mut launch_token) {
-                    Ok(1024) => {
-                        println!("[+] Token file valid!");
-                    },
-                    _ => println!("[+] Token file invalid, will create new token file"),
-                }
-            }
-        }
-    }
-
-    // Step 2: call sgx_create_enclave to initialize an enclave instance
+    // call sgx_create_enclave to initialize an enclave instance
     // Debug Support: set 2nd parameter to 1
     let debug = 1;
     let mut misc_attr = sgx_misc_attribute_t {secs_attr: sgx_attributes_t { flags:0, xfrm:0}, misc_select:0};
-    let enclave = try!(SgxEnclave::create(ENCLAVE_FILE,
-                                          debug,
-                                          &mut launch_token,
-                                          &mut launch_token_updated,
-                                          &mut misc_attr));
-
-    // Step 3: save the launch token if it is updated
-    if use_token == true && launch_token_updated != 0 {
-        // reopen the file with write capablity
-        match fs::File::create(&token_file) {
-            Ok(mut f) => {
-                match f.write_all(&launch_token) {
-                    Ok(()) => println!("[+] Saved updated launch token!"),
-                    Err(_) => println!("[-] Failed to save updated launch token!"),
-                }
-            },
-            Err(_) => {
-                println!("[-] Failed to save updated enclave token, but doesn't matter");
-            },
-        }
-    }
-
-    Ok(enclave)
+    SgxEnclave::create(ENCLAVE_FILE,
+                       debug,
+                       &mut launch_token,
+                       &mut launch_token_updated,
+                       &mut misc_attr)
 }
 
 fn main() {
-
     let enclave = match init_enclave() {
         Ok(r) => {
             println!("[+] Init Enclave Successful {}!", r.geteid());
@@ -126,7 +54,6 @@ fn main() {
     };
 
     let input_string = String::from("This is a normal world string passed into Enclave!\n");
-
     let mut retval = sgx_status_t::SGX_SUCCESS;
 
     let result = unsafe {
@@ -135,7 +62,6 @@ fn main() {
                       input_string.as_ptr() as * const u8,
                       input_string.len())
     };
-
     match result {
         sgx_status_t::SGX_SUCCESS => {},
         _ => {
@@ -143,8 +69,6 @@ fn main() {
             return;
         }
     }
-
     println!("[+] say_something success...");
-
     enclave.destroy();
 }
diff --git a/samplecode/hello-rust/enclave/Cargo.toml b/samplecode/hello-rust/enclave/Cargo.toml
index abd6c59..eb622f9 100644
--- a/samplecode/hello-rust/enclave/Cargo.toml
+++ b/samplecode/hello-rust/enclave/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "Helloworldsampleenclave"
 version = "1.0.0"
-authors = ["Baidu"]
+authors = ["The Teaclave Authors"]
 
 [lib]
 name = "helloworldsampleenclave"
@@ -11,9 +11,10 @@ crate-type = ["staticlib"]
 default = []
 
 [target.'cfg(not(target_env = "sgx"))'.dependencies]
-sgx_types = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-sgx_tstd = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-[patch.'https://github.com/baidu/rust-sgx-sdk.git']
+sgx_types = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+sgx_tstd = { git = "https://github.com/apache/teaclave-sgx-sdk.git", features = ["backtrace"] }
+sgx_trts = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+[patch.'https://github.com/apache/teaclave-sgx-sdk.git']
 sgx_alloc = { path = "../../../sgx_alloc" }
 sgx_build_helper = { path = "../../../sgx_build_helper" }
 sgx_cov = { path = "../../../sgx_cov" }
diff --git a/samplecode/hello-rust/enclave/Enclave.edl b/samplecode/hello-rust/enclave/Enclave.edl
index f087054..0263761 100644
--- a/samplecode/hello-rust/enclave/Enclave.edl
+++ b/samplecode/hello-rust/enclave/Enclave.edl
@@ -1,33 +1,19 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 
 enclave {
     from "sgx_tstd.edl" import *;
diff --git a/samplecode/hello-rust/enclave/Makefile b/samplecode/hello-rust/enclave/Makefile
index ebbbfbb..85ccbf8 100644
--- a/samplecode/hello-rust/enclave/Makefile
+++ b/samplecode/hello-rust/enclave/Makefile
@@ -1,31 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# 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 Baidu, Inc., 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.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 Rust_Enclave_Name := libenclave.a
 Rust_Enclave_Files := $(wildcard src/*.rs)
 Rust_Target_Path := $(CURDIR)/../../../xargo
diff --git a/samplecode/hello-rust/enclave/Xargo.toml b/samplecode/hello-rust/enclave/Xargo.toml
index c088ebb..866117d 100644
--- a/samplecode/hello-rust/enclave/Xargo.toml
+++ b/samplecode/hello-rust/enclave/Xargo.toml
@@ -5,6 +5,14 @@ alloc = {}
 path = "../../../sgx_types"
 stage = 1
 
+[dependencies.sgx_alloc]
+path = "../../../sgx_alloc"
+stage = 1
+
+[dependencies.sgx_unwind]
+path = "../../../sgx_unwind"
+stage = 1
+
 [dependencies.sgx_demangle]
 path = "../../../sgx_demangle"
 stage = 1
@@ -41,9 +49,9 @@ stage = 3
 path = "../../../sgx_backtrace_sys"
 stage = 3
 
-[dependencies.sgx_unwind]
-path = "../../../sgx_unwind"
-stage = 4
+[dependencies.panic_unwind]
+path = "../../../sgx_panic_unwind"
+stage = 3
 
 [dependencies.sgx_tdh]
 path = "../../../sgx_tdh"
@@ -57,34 +65,31 @@ stage = 4
 path = "../../../sgx_tprotected_fs"
 stage = 4
 
-[dependencies.sgx_alloc]
-path = "../../../sgx_alloc"
-stage = 4
-
-[dependencies.panic_unwind]
-path = "../../../sgx_panic_unwind"
-stage = 5
-
 [dependencies.std]
 path = "../../../xargo/sgx_tstd"
-stage = 6
+stage = 5
+features = ["backtrace"]
+
+[dependencies.sgx_no_tstd]
+path = "../../../sgx_no_tstd"
+stage = 5
 
 [dependencies.sgx_rand]
 path = "../../../sgx_rand"
-stage = 7
+stage = 6
 
 [dependencies.sgx_serialize]
 path = "../../../sgx_serialize"
-stage = 7
+stage = 6
 
 [dependencies.sgx_tunittest]
 path = "../../../sgx_tunittest"
-stage = 7
+stage = 6
 
 [dependencies.sgx_backtrace]
 path = "../../../sgx_backtrace"
-stage = 8
+stage = 7
 
 [dependencies.sgx_cov]
 path = "../../../sgx_cov"
-stage = 8
+stage = 7
diff --git a/samplecode/hello-rust/enclave/src/lib.rs b/samplecode/hello-rust/enclave/src/lib.rs
index 91870dc..f661955 100644
--- a/samplecode/hello-rust/enclave/src/lib.rs
+++ b/samplecode/hello-rust/enclave/src/lib.rs
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #![crate_name = "helloworldsampleenclave"]
 #![crate_type = "staticlib"]
@@ -33,15 +22,20 @@
 #![cfg_attr(target_env = "sgx", feature(rustc_private))]
 
 extern crate sgx_types;
+extern crate sgx_trts;
 #[cfg(not(target_env = "sgx"))]
 #[macro_use]
 extern crate sgx_tstd as std;
 
 use sgx_types::*;
+use sgx_types::metadata::*;
+use sgx_trts::enclave;
+//use sgx_trts::{is_x86_feature_detected, is_cpu_feature_supported};
 use std::string::String;
 use std::vec::Vec;
 use std::io::{self, Write};
 use std::slice;
+use std::backtrace::{self, PrintFormat};
 
 #[no_mangle]
 pub extern "C" fn say_something(some_string: *const u8, some_len: usize) -> sgx_status_t {
@@ -71,5 +65,66 @@ pub extern "C" fn say_something(some_string: *const u8, some_len: usize) -> sgx_
     // Ocall to normal world for output
     println!("{}", &hello_string);
 
+    let _ = backtrace::enable_backtrace("enclave.signed.so", PrintFormat::Full);
+
+    let gd = enclave::SgxGlobalData::new();
+    println!("gd: {} {} {} {} ", gd.get_static_tcs_num(), gd.get_eremove_tcs_num(), gd.get_dyn_tcs_num(), gd.get_tcs_max_num());
+    let (static_num, eremove_num, dyn_num) = get_thread_num();
+    println!("static: {} eremove: {} dyn: {}", static_num, eremove_num, dyn_num);
+
+    unsafe {
+        println!("EDMM: {}, feature: {}", EDMM_supported, g_cpu_feature_indicator);
+    }
+    if is_x86_feature_detected!("sgx") {
+        println!("supported sgx");
+    }
+
     sgx_status_t::SGX_SUCCESS
+}
+
+#[link(name = "sgx_trts")]
+extern {
+    static g_cpu_feature_indicator: uint64_t;
+    static EDMM_supported: c_int;
+}
+
+
+fn get_thread_num() -> (u32, u32, u32) {
+    let gd = unsafe {
+        let p = enclave::rsgx_get_global_data();
+        &*p
+    };
+
+    let mut static_thread_num: u32 = 0;
+    let mut eremove_thread_num: u32 = 0;
+    let mut dyn_thread_num: u32 = 0;
+    let layout_table = &gd.layout_table[0..gd.layout_entry_num as usize];
+    unsafe { traversal_layout(&mut static_thread_num, &mut dyn_thread_num, &mut eremove_thread_num, layout_table); }
+
+    unsafe fn traversal_layout(static_num: &mut u32, dyn_num: &mut u32, eremove_num: &mut u32, layout_table: &[layout_t])
+    {
+        for (i, layout) in layout_table.iter().enumerate() {
+            if !is_group_id!(layout.group.id as u32) {
+                if (layout.entry.attributes & PAGE_ATTR_EADD) != 0 {
+                    if (layout.entry.content_offset != 0) && (layout.entry.si_flags == SI_FLAGS_TCS) {
+                        if (layout.entry.attributes & PAGE_ATTR_EREMOVE) == 0 {
+                            *static_num += 1;
+                        } else {
+                            *eremove_num += 1;
+                        }
+                    }
+                }
+                if (layout.entry.attributes & PAGE_ATTR_POST_ADD) != 0 {
+                    if layout.entry.id == LAYOUT_ID_TCS_DYN as u16 {
+                        *dyn_num += 1;
+                    }
+                }
+            } else {
+                for _ in 0..layout.group.load_times {
+                    traversal_layout(static_num, dyn_num, eremove_num, &layout_table[i - layout.group.entry_count as usize..i])
+                }
+            }
+        }
+    }
+    (static_thread_num, eremove_thread_num, dyn_thread_num)
 }
\ No newline at end of file
diff --git a/samplecode/helloworld/Makefile b/samplecode/helloworld/Makefile
index e58a5f3..fb0b649 100644
--- a/samplecode/helloworld/Makefile
+++ b/samplecode/helloworld/Makefile
@@ -1,31 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# 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 Baidu, Inc., 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.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 
 ######## SGX SDK Settings ########
 
diff --git a/samplecode/helloworld/app/app.c b/samplecode/helloworld/app/app.c
index c57f176..a2af74b 100644
--- a/samplecode/helloworld/app/app.c
+++ b/samplecode/helloworld/app/app.c
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #include <stdio.h>
 #include <string.h>
@@ -145,73 +134,20 @@ void print_error_message(sgx_status_t ret)
         printf("Error: Unexpected error occurred.\n");
 }
 
-/* Initialize the enclave:
- *   Step 1: try to retrieve the launch token saved by last transaction
- *   Step 2: call sgx_create_enclave to initialize an enclave instance
- *   Step 3: save the launch token if it is updated
- */
 int initialize_enclave(void)
 {
-    char token_path[MAX_PATH] = {'\0'};
     sgx_launch_token_t token = {0};
     sgx_status_t ret = SGX_ERROR_UNEXPECTED;
     int updated = 0;
 
-    /* Step 1: try to retrieve the launch token saved by last transaction
-     *         if there is no token, then create a new one.
-     */
-    /* try to get the token saved in $HOME */
-    const char *home_dir = getpwuid(getuid())->pw_dir;
-
-    if (home_dir != NULL &&
-        (strlen(home_dir)+strlen("/")+sizeof(TOKEN_FILENAME)+1) <= MAX_PATH) {
-        /* compose the token path */
-        strncpy(token_path, home_dir, strlen(home_dir));
-        strncat(token_path, "/", strlen("/"));
-        strncat(token_path, TOKEN_FILENAME, sizeof(TOKEN_FILENAME)+1);
-    } else {
-        /* if token path is too long or $HOME is NULL */
-        strncpy(token_path, TOKEN_FILENAME, sizeof(TOKEN_FILENAME));
-    }
-
-    FILE *fp = fopen(token_path, "rb");
-    if (fp == NULL && (fp = fopen(token_path, "wb")) == NULL) {
-        printf("Warning: Failed to create/open the launch token file \"%s\".\n", token_path);
-    }
-
-    if (fp != NULL) {
-        /* read the token from saved file */
-        size_t read_num = fread(token, 1, sizeof(sgx_launch_token_t), fp);
-        if (read_num != 0 && read_num != sizeof(sgx_launch_token_t)) {
-            /* if token is invalid, clear the buffer */
-            memset(&token, 0x0, sizeof(sgx_launch_token_t));
-            printf("Warning: Invalid launch token read from \"%s\".\n", token_path);
-        }
-    }
-    /* Step 2: call sgx_create_enclave to initialize an enclave instance */
+    /* call sgx_create_enclave to initialize an enclave instance */
     /* Debug Support: set 2nd parameter to 1 */
     ret = sgx_create_enclave(ENCLAVE_FILENAME, SGX_DEBUG_FLAG, &token, &updated, &global_eid, NULL);
     if (ret != SGX_SUCCESS) {
         print_error_message(ret);
-        if (fp != NULL) fclose(fp);
         return -1;
     }
     printf("[+] global_eid: %ld\n", global_eid);
-
-    /* Step 3: save the launch token if it is updated */
-    if (updated == FALSE || fp == NULL) {
-        /* if the token is not updated, or file handler is invalid, do not perform saving */
-        if (fp != NULL) fclose(fp);
-        return 0;
-    }
-
-    /* reopen the file with write capablity */
-    fp = freopen(token_path, "wb", fp);
-    if (fp == NULL) return 0;
-    size_t write_num = fwrite(token, 1, sizeof(sgx_launch_token_t), fp);
-    if (write_num != sizeof(sgx_launch_token_t))
-        printf("Warning: Failed to save launch token to \"%s\".\n", token_path);
-    fclose(fp);
     return 0;
 }
 
diff --git a/samplecode/helloworld/app/app.h b/samplecode/helloworld/app/app.h
index aecb4c2..c3c2c7d 100644
--- a/samplecode/helloworld/app/app.h
+++ b/samplecode/helloworld/app/app.h
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #ifndef _APP_H_
 #define _APP_H_
@@ -45,7 +34,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/helloworld/enclave/Cargo.toml b/samplecode/helloworld/enclave/Cargo.toml
index 8cdbdb3..d508cd4 100644
--- a/samplecode/helloworld/enclave/Cargo.toml
+++ b/samplecode/helloworld/enclave/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "Helloworldsampleenclave"
 version = "1.0.0"
-authors = ["Baidu"]
+authors = ["The Teaclave Authors"]
 
 [lib]
 name = "helloworldsampleenclave"
@@ -11,10 +11,10 @@ crate-type = ["staticlib"]
 default = []
 
 [target.'cfg(not(target_env = "sgx"))'.dependencies]
-sgx_types = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-sgx_tstd = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
+sgx_types = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+sgx_tstd = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
 
-[patch.'https://github.com/baidu/rust-sgx-sdk.git']
+[patch.'https://github.com/apache/teaclave-sgx-sdk.git']
 sgx_alloc = { path = "../../../sgx_alloc" }
 sgx_backtrace = { path = "../../../sgx_backtrace" }
 sgx_backtrace_sys = { path = "../../../sgx_backtrace_sys" }
diff --git a/samplecode/helloworld/enclave/Enclave.edl b/samplecode/helloworld/enclave/Enclave.edl
index 4a05013..c4cefcf 100644
--- a/samplecode/helloworld/enclave/Enclave.edl
+++ b/samplecode/helloworld/enclave/Enclave.edl
@@ -1,33 +1,19 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 
 enclave {
     from "sgx_tstd.edl" import *;
diff --git a/samplecode/helloworld/enclave/Makefile b/samplecode/helloworld/enclave/Makefile
index ebbbfbb..85ccbf8 100644
--- a/samplecode/helloworld/enclave/Makefile
+++ b/samplecode/helloworld/enclave/Makefile
@@ -1,31 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# 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 Baidu, Inc., 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.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 Rust_Enclave_Name := libenclave.a
 Rust_Enclave_Files := $(wildcard src/*.rs)
 Rust_Target_Path := $(CURDIR)/../../../xargo
diff --git a/samplecode/helloworld/enclave/Xargo.toml b/samplecode/helloworld/enclave/Xargo.toml
index c088ebb..cb43640 100644
--- a/samplecode/helloworld/enclave/Xargo.toml
+++ b/samplecode/helloworld/enclave/Xargo.toml
@@ -5,6 +5,14 @@ alloc = {}
 path = "../../../sgx_types"
 stage = 1
 
+[dependencies.sgx_alloc]
+path = "../../../sgx_alloc"
+stage = 1
+
+[dependencies.sgx_unwind]
+path = "../../../sgx_unwind"
+stage = 1
+
 [dependencies.sgx_demangle]
 path = "../../../sgx_demangle"
 stage = 1
@@ -41,9 +49,9 @@ stage = 3
 path = "../../../sgx_backtrace_sys"
 stage = 3
 
-[dependencies.sgx_unwind]
-path = "../../../sgx_unwind"
-stage = 4
+[dependencies.panic_unwind]
+path = "../../../sgx_panic_unwind"
+stage = 3
 
 [dependencies.sgx_tdh]
 path = "../../../sgx_tdh"
@@ -57,34 +65,30 @@ stage = 4
 path = "../../../sgx_tprotected_fs"
 stage = 4
 
-[dependencies.sgx_alloc]
-path = "../../../sgx_alloc"
-stage = 4
-
-[dependencies.panic_unwind]
-path = "../../../sgx_panic_unwind"
-stage = 5
-
 [dependencies.std]
 path = "../../../xargo/sgx_tstd"
-stage = 6
+stage = 5
+
+[dependencies.sgx_no_tstd]
+path = "../../../sgx_no_tstd"
+stage = 5
 
 [dependencies.sgx_rand]
 path = "../../../sgx_rand"
-stage = 7
+stage = 6
 
 [dependencies.sgx_serialize]
 path = "../../../sgx_serialize"
-stage = 7
+stage = 6
 
 [dependencies.sgx_tunittest]
 path = "../../../sgx_tunittest"
-stage = 7
+stage = 6
 
 [dependencies.sgx_backtrace]
 path = "../../../sgx_backtrace"
-stage = 8
+stage = 7
 
 [dependencies.sgx_cov]
 path = "../../../sgx_cov"
-stage = 8
+stage = 7
diff --git a/samplecode/helloworld/enclave/src/lib.rs b/samplecode/helloworld/enclave/src/lib.rs
index fc17277..7c6dc49 100644
--- a/samplecode/helloworld/enclave/src/lib.rs
+++ b/samplecode/helloworld/enclave/src/lib.rs
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #![crate_name = "helloworldsampleenclave"]
 #![crate_type = "staticlib"]
diff --git a/samplecode/http_req/README.md b/samplecode/http_req/README.md
index d2ba90e..2677638 100644
--- a/samplecode/http_req/README.md
+++ b/samplecode/http_req/README.md
@@ -4,7 +4,7 @@ Showcases [http_req-sgx](https://github.com/piotr-roslaniec/http_req-sgx-example
 
 ## Instruction
 
-Follow instructions in [baidu/rust-sgx-sdk](https://github.com/baidu/rust-sgx-sdk) to setup development environment. Alternatively, use [rust-sdk-helper](https://github.com/piotr-roslaniec/rust-sdk-helper).
+Follow instructions in [apache/teaclave-sgx-sdk](https://github.com/apache/teaclave-sgx-sdk) to setup development environment. Alternatively, use [rust-sdk-helper](https://github.com/piotr-roslaniec/rust-sdk-helper).
 
 Please make sure that you have environment variable `SGX_SDK_RUST` points to the root of this sdk.
 
diff --git a/samplecode/http_req/app/Cargo.toml b/samplecode/http_req/app/Cargo.toml
index 780f406..956ffa6 100644
--- a/samplecode/http_req/app/Cargo.toml
+++ b/samplecode/http_req/app/Cargo.toml
@@ -1,14 +1,13 @@
 [package]
 name = "app"
 version = "1.0.0"
-authors = ["Piotr Roslaniec <p....@gmail.com>"]
+authors = ["The Teaclave Authors"]
 edition = '2018'
 
 [dependencies]
-sgx_types = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-sgx_urts = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-dirs = "1.0.2"
+sgx_types = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+sgx_urts = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
 
-[patch.'https://github.com/baidu/rust-sgx-sdk.git']
+[patch.'https://github.com/apache/teaclave-sgx-sdk.git']
 sgx_types = { path = "../../../sgx_types" }
 sgx_urts = { path = "../../../sgx_urts" }
diff --git a/samplecode/http_req/app/build.rs b/samplecode/http_req/app/build.rs
index 11c8aff..b20947c 100644
--- a/samplecode/http_req/app/build.rs
+++ b/samplecode/http_req/app/build.rs
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 use std::env;
 
diff --git a/samplecode/http_req/app/src/main.rs b/samplecode/http_req/app/src/main.rs
index b409234..9bad456 100644
--- a/samplecode/http_req/app/src/main.rs
+++ b/samplecode/http_req/app/src/main.rs
@@ -1,46 +1,30 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
-extern crate dirs;
 extern crate sgx_types;
 extern crate sgx_urts;
 use sgx_types::*;
 use sgx_urts::SgxEnclave;
 
 use std::ffi::CString;
-use std::fs;
-use std::io::{Read, Write};
 use std::net::{SocketAddr, TcpStream, ToSocketAddrs};
 use std::os::unix::io::AsRawFd;
-use std::path;
 
 static ENCLAVE_FILE: &'static str = "enclave.signed.so";
-static ENCLAVE_TOKEN: &'static str = "enclave.token";
 
 extern "C" {
     fn send_http_request(
@@ -54,75 +38,15 @@ extern "C" {
 fn init_enclave() -> SgxResult<SgxEnclave> {
     let mut launch_token: sgx_launch_token_t = [0; 1024];
     let mut launch_token_updated: i32 = 0;
-    // Step 1: try to retrieve the launch token saved by last transaction
-    //         if there is no token, then create a new one.
-    //
-    // try to get the token saved in $HOME */
-    let mut home_dir = path::PathBuf::new();
-    let use_token = match dirs::home_dir() {
-        Some(path) => {
-            println!("[+] Home dir is {}", path.display());
-            home_dir = path;
-            true
-        }
-        None => {
-            println!("[-] Cannot get home dir");
-            false
-        }
-    };
-
-    let token_file: path::PathBuf = home_dir.join(ENCLAVE_TOKEN);;
-    if use_token {
-        match fs::File::open(&token_file) {
-            Err(_) => {
-                println!(
-                    "[-] Open token file {} error! Will create one.",
-                    token_file.as_path().to_str().unwrap()
-                );
-            }
-            Ok(mut f) => {
-                println!("[+] Open token file success! ");
-                match f.read(&mut launch_token) {
-                    Ok(1024) => {
-                        println!("[+] Token file valid!");
-                    }
-                    _ => println!("[+] Token file invalid, will create new token file"),
-                }
-            }
-        }
-    }
-
-    // Step 2: call sgx_create_enclave to initialize an enclave instance
+    // call sgx_create_enclave to initialize an enclave instance
     // Debug Support: set 2nd parameter to 1
     let debug = 1;
-    let mut misc_attr = sgx_misc_attribute_t {
-        secs_attr: sgx_attributes_t { flags: 0, xfrm: 0 },
-        misc_select: 0,
-    };
-    let enclave = SgxEnclave::create(
-        ENCLAVE_FILE,
-        debug,
-        &mut launch_token,
-        &mut launch_token_updated,
-        &mut misc_attr,
-    )
-    .unwrap();
-
-    // Step 3: save the launch token if it is updated
-    if use_token && launch_token_updated != 0 {
-        // reopen the file with write capablity
-        match fs::File::create(&token_file) {
-            Ok(mut f) => match f.write_all(&launch_token) {
-                Ok(()) => println!("[+] Saved updated launch token!"),
-                Err(_) => println!("[-] Failed to save updated launch token!"),
-            },
-            Err(_) => {
-                println!("[-] Failed to save updated enclave token, but doesn't matter");
-            }
-        }
-    }
-
-    Ok(enclave)
+    let mut misc_attr = sgx_misc_attribute_t {secs_attr: sgx_attributes_t { flags:0, xfrm:0}, misc_select:0};
+    SgxEnclave::create(ENCLAVE_FILE,
+                       debug,
+                       &mut launch_token,
+                       &mut launch_token_updated,
+                       &mut misc_attr)
 }
 
 fn lookup_ipv4(host: &str, port: u16) -> SocketAddr {
diff --git a/samplecode/http_req/enclave/Cargo.toml b/samplecode/http_req/enclave/Cargo.toml
index 55e456a..a4ca4bf 100644
--- a/samplecode/http_req/enclave/Cargo.toml
+++ b/samplecode/http_req/enclave/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "Httpreqenclave"
 version = "1.0.0"
-authors = ["Piotr Roslaniec <p....@gmail.com>"]
+authors = ["The Teaclave Authors"]
 edition = "2018"
 
 [lib]
@@ -12,10 +12,10 @@ crate-type = ["staticlib"]
 http_req = { git = "https://github.com/mesalock-linux/http_req-sgx" }
 
 [target.'cfg(not(target_env = "sgx"))'.dependencies]
-sgx_types = { git = "https://github.com/baidu/rust-sgx-sdk.git" }
-sgx_tstd = { git = "https://github.com/baidu/rust-sgx-sdk.git",  features = ["net"] }
+sgx_types = { git = "https://github.com/apache/teaclave-sgx-sdk.git" }
+sgx_tstd = { git = "https://github.com/apache/teaclave-sgx-sdk.git",  features = ["net"] }
 
-[patch.'https://github.com/baidu/rust-sgx-sdk.git']
+[patch.'https://github.com/apache/teaclave-sgx-sdk.git']
 sgx_alloc = { path = "../../../sgx_alloc" }
 sgx_backtrace = { path = "../../../sgx_backtrace" }
 sgx_backtrace_sys = { path = "../../../sgx_backtrace_sys" }
diff --git a/samplecode/http_req/enclave/Enclave.edl b/samplecode/http_req/enclave/Enclave.edl
index a71a093..3862e84 100644
--- a/samplecode/http_req/enclave/Enclave.edl
+++ b/samplecode/http_req/enclave/Enclave.edl
@@ -1,33 +1,19 @@
-/*
- * Copyright (C) 2017-2019 Baidu, Inc. 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 Baidu, Inc., 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.
- *
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
 
 enclave {
     from "sgx_tstd.edl" import *;
diff --git a/samplecode/http_req/enclave/Makefile b/samplecode/http_req/enclave/Makefile
index b664385..7fdcf96 100644
--- a/samplecode/http_req/enclave/Makefile
+++ b/samplecode/http_req/enclave/Makefile
@@ -1,31 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# 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 Baidu, Inc., 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.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 Rust_Enclave_Name := libenclave.a
 Rust_Enclave_Files := $(wildcard src/*.rs)
 Rust_Target_Path := $(CURDIR)/../../../xargo
diff --git a/samplecode/http_req/enclave/Xargo.toml b/samplecode/http_req/enclave/Xargo.toml
index 001c383..c3fc4df 100644
--- a/samplecode/http_req/enclave/Xargo.toml
+++ b/samplecode/http_req/enclave/Xargo.toml
@@ -5,6 +5,14 @@ alloc = {}
 path = "../../../sgx_types"
 stage = 1
 
+[dependencies.sgx_alloc]
+path = "../../../sgx_alloc"
+stage = 1
+
+[dependencies.sgx_unwind]
+path = "../../../sgx_unwind"
+stage = 1
+
 [dependencies.sgx_demangle]
 path = "../../../sgx_demangle"
 stage = 1
@@ -41,9 +49,9 @@ stage = 3
 path = "../../../sgx_backtrace_sys"
 stage = 3
 
-[dependencies.sgx_unwind]
-path = "../../../sgx_unwind"
-stage = 4
+[dependencies.panic_unwind]
+path = "../../../sgx_panic_unwind"
+stage = 3
 
 [dependencies.sgx_tdh]
 path = "../../../sgx_tdh"
@@ -57,35 +65,31 @@ stage = 4
 path = "../../../sgx_tprotected_fs"
 stage = 4
 
-[dependencies.sgx_alloc]
-path = "../../../sgx_alloc"
-stage = 4
-
-[dependencies.panic_unwind]
-path = "../../../sgx_panic_unwind"
-stage = 5
-
 [dependencies.std]
 path = "../../../xargo/sgx_tstd"
 features = ["net"]
-stage = 6
+stage = 5
+
+[dependencies.sgx_no_tstd]
+path = "../../../sgx_no_tstd"
+stage = 5
 
 [dependencies.sgx_rand]
 path = "../../../sgx_rand"
-stage = 7
+stage = 6
 
 [dependencies.sgx_serialize]
 path = "../../../sgx_serialize"
-stage = 7
+stage = 6
 
 [dependencies.sgx_tunittest]
 path = "../../../sgx_tunittest"
-stage = 7
+stage = 6
 
 [dependencies.sgx_backtrace]
 path = "../../../sgx_backtrace"
-stage = 8
+stage = 7
 
 [dependencies.sgx_cov]
 path = "../../../sgx_cov"
-stage = 8
+stage = 7
diff --git a/samplecode/http_req/enclave/src/lib.rs b/samplecode/http_req/enclave/src/lib.rs
index 74a9e7d..de6cdd9 100644
--- a/samplecode/http_req/enclave/src/lib.rs
+++ b/samplecode/http_req/enclave/src/lib.rs
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #![crate_name = "httpreqenclave"]
 #![crate_type = "staticlib"]
diff --git a/samplecode/hugemem/Makefile b/samplecode/hugemem/Makefile
index 2fa7622..8471bbc 100644
--- a/samplecode/hugemem/Makefile
+++ b/samplecode/hugemem/Makefile
@@ -1,31 +1,19 @@
-# Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
 #
-# 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 Baidu, Inc., 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.
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
 
 ######## SGX SDK Settings ########
 
diff --git a/samplecode/hugemem/app/app.c b/samplecode/hugemem/app/app.c
index 449b9b3..82aa7cc 100644
--- a/samplecode/hugemem/app/app.c
+++ b/samplecode/hugemem/app/app.c
@@ -1,30 +1,19 @@
-// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
+//   http://www.apache.org/licenses/LICENSE-2.0
 //
-//  * 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 Baidu, Inc., 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.
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License..
 
 #include <stdio.h>
 #include <string.h>
@@ -145,73 +134,20 @@ void print_error_message(sgx_status_t ret)
         printf("Error: Unexpected error occurred.\n");
 }
 
-/* Initialize the enclave:
- *   Step 1: try to retrieve the launch token saved by last transaction
- *   Step 2: call sgx_create_enclave to initialize an enclave instance
- *   Step 3: save the launch token if it is updated
- */
... 71078 lines suppressed ...


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org