Files
intel-linux-sgx/SampleCode/SampleAttestedTLS/server_tdx/server.cpp
T
Li, Xun 8a22317709 Linux 2.22 Open Source Gold Release
Upgraded to OpenSSL 3.0.10.
Added interoperable RA-TLS support which follows CCC design.
Enhanced Protect File System performance and added additional dependency
  `libsgx_pthread.a`.
Added the Constant Time instruction Decoder (CTD) into the default AEX-Notify
  mitigation handler in order to prevent the introduction of any additional
  subtle sidechannel leakages within the default handler.
Added Mistletoe 3 mitigations to the IPP Cryptography Library to the AES-ECB,
  AESGCM, and AES-CMAC algorithms. These have been incorporated transparently
  into the `sgx_tcrypto` library.
Resigned all Intel® SGX Architecture Enclaves.
Upgraded Intel SGX Quote Verification Enclave to integrate OpenSSL/SgxSSL 3.0.10.
Added Attestation Library support for Intel(R) TDX Migration TD.
Added Rust wrapper for low-level Quote Generation APIs.
Enabled `SE_TRACE` log in release binary.
Updated Rust QVL wrapper to use native Rust structure for quote verification
  collateral.
Added a limitation in the DCAP QVL to only allow the user to set the QvE load
  policy once.
Fixed bugs.

Signed-off-by: Li, Xun <xun.li@intel.com>
2023-10-24 11:05:23 +08:00

96 lines
2.7 KiB
C++

/**
*
* MIT License
*
* Copyright (c) Open Enclave SDK contributors.
*
* 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
*
*/
#include <stdio.h>
#include <string.h>
#define LOOP_OPTION "-server-in-loop"
int set_up_tls_server(char* server_port, bool keep_server_up);
int main(int argc, const char* argv[])
{
int ret = 1;
char* server_port = NULL;
int keep_server_up = 0; // should be bool type, 0 false, 1 true
/* Check argument count */
if (argc == 3)
{
if (strcmp(argv[2], LOOP_OPTION) != 0)
{
printf(
"Usage: %s -port:<port> [%s]\n",
argv[0],
LOOP_OPTION);
return 1;
}
else
{
keep_server_up = 1;
}
}
else if (argc != 2)
{
printf(
"Usage: %s -port:<port> [%s]\n",
argv[0],
LOOP_OPTION);
return 1;
}
// read port parameter
char* option = (char*)"-port:";
size_t param_len = 0;
param_len = strlen(option);
if (strncmp(argv[1], option, param_len) == 0)
{
server_port = (char*)(argv[1] + param_len);
}
else
{
fprintf(stderr, "Unknown option %s\n", argv[1]);
printf(
"Usage: %s -port:<port> [%s]\n",
argv[0],
LOOP_OPTION);
return 1;
}
printf("server port = %s\n", server_port);
printf("Host: calling setup_tls_server\n");
ret = set_up_tls_server(server_port, keep_server_up);
if (ret != 0)
{
printf("Host: setup_tls_server failed\n");
goto exit;
}
exit:
printf("Host: %s \n", (ret == 0) ? "succeeded" : "failed");
return ret;
}