mirror of
https://github.com/intel/linux-sgx
synced 2026-06-08 14:49:32 +00:00
83655bc3ce
Follows up on 590856d (removing the Linux LE).
Removes all of whitelist management and LE facilities from the AESM and SDK.
Leaves only skeleton API stubs behind (for partial ABI compatibility).
!BREAKING CHANGES!
- Launch-related stub(`libsgx_launch.so`) and simulation (`libsgx_launch_sim.so`) libraries
removed from the SGX SDK.
- Removed AESM support for the deprecated Linux SGX out-of-tree (OOT) driver
(will no longer attempt an enclave load if OOT driver is detected)
- AESM APIs for launch control and whitelist management will now
return SGX_ERROR_FEATURE_NOT_SUPPORTED:
Affected APIs:
* get_launch_token(...)
* sgx_get_whitelist_size(...)
* sgx_get_whitelist(...)
* sgx_register_wl_cert_chain(...)
- Deprecated `sgx_uae_launch.h` SDK header
- Marked init token inputs `reserved` in the relevant loader APIs (no longer in use)
---------
Co-authored-by: Krzysztof1 Wisniewski <krzysztof1.wisniewski@intel.com>
Signed-off-by: Mateusz Bronk <mateusz.bronk@intel.com>
97 lines
3.9 KiB
C++
97 lines
3.9 KiB
C++
/*
|
|
* Copyright (C) 2011-2021 Intel Corporation. All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
*
|
|
* * Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in
|
|
* the documentation and/or other materials provided with the
|
|
* distribution.
|
|
* * Neither the name of Intel Corporation nor the names of its
|
|
* contributors may be used to endorse or promote products derived
|
|
* from this software without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*
|
|
*/
|
|
|
|
|
|
#include <stdio.h>
|
|
#include <map>
|
|
|
|
#include "sgx_eid.h"
|
|
#include "sgx_urts.h"
|
|
|
|
#include "EnclaveInitiator_u.h"
|
|
#include "EnclaveResponder_u.h"
|
|
#include "sgx_utils.h"
|
|
|
|
#define ENCLAVE_INITIATOR_NAME "libenclave_initiator.signed.so"
|
|
#define ENCLAVE_RESPONDER_NAME "libenclave_responder.signed.so"
|
|
|
|
sgx_enclave_id_t initiator_enclave_id = 0, responder_enclave_id = 0;
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
int update = 0; // Note: Since v2.28 this value is ignored
|
|
uint32_t ret_status;
|
|
sgx_status_t status;
|
|
sgx_launch_token_t token = {0}; // Note: Since v2.28 this value is ignored
|
|
|
|
(void)argc;
|
|
(void)argv;
|
|
|
|
// load initiator and responder enclaves
|
|
if (SGX_SUCCESS != sgx_create_enclave(ENCLAVE_INITIATOR_NAME, SGX_DEBUG_FLAG, &token, &update, &initiator_enclave_id, NULL)
|
|
|| SGX_SUCCESS != sgx_create_enclave(ENCLAVE_RESPONDER_NAME, SGX_DEBUG_FLAG, &token, &update, &responder_enclave_id, NULL)) {
|
|
printf("failed to load enclave.\n");
|
|
goto destroy_enclave;
|
|
}
|
|
printf("succeed to load enclaves.\n");
|
|
|
|
// create ECDH session using initiator enclave, it would create session with responder enclave
|
|
status = test_create_session(initiator_enclave_id, &ret_status);
|
|
if (status != SGX_SUCCESS || ret_status != 0) {
|
|
printf("failed to establish secure channel: ECALL return 0x%x, error code is 0x%x.\n", status, ret_status);
|
|
goto destroy_enclave;
|
|
}
|
|
printf("succeed to establish secure channel.\n");
|
|
|
|
// test message exchanging between initiator enclave and responder enclave
|
|
status = test_message_exchange(initiator_enclave_id, &ret_status);
|
|
if (status != SGX_SUCCESS || ret_status != 0) {
|
|
printf("test_message_exchange Ecall failed: ECALL return 0x%x, error code is 0x%x.\n", status, ret_status);
|
|
goto destroy_enclave;
|
|
}
|
|
printf("Succeed to exchange secure message...\n");
|
|
|
|
// close ECDH session
|
|
status = test_close_session(initiator_enclave_id, &ret_status);
|
|
if (status != SGX_SUCCESS || ret_status != 0) {
|
|
printf("test_close_session Ecall failed: ECALL return 0x%x, error code is 0x%x.\n", status, ret_status);
|
|
goto destroy_enclave;
|
|
}
|
|
printf("Succeed to close Session...\n");
|
|
|
|
destroy_enclave:
|
|
sgx_destroy_enclave(initiator_enclave_id);
|
|
sgx_destroy_enclave(responder_enclave_id);
|
|
|
|
return 0;
|
|
}
|
|
|