-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRA_SGXserver.hpp
103 lines (86 loc) · 1.92 KB
/
RA_SGXserver.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*!
*
* RA_SGXserver.hpp
*
* Copyright (c) 2020 IWATA Daiki
*
* This software is released under the MIT License.
* see http://opensource.org/licenses/mit-license
*
* Some function are released from Intel Corporation.
* LIENSE: https://github.com/intel/sgx-ra-sample/blob/master/LICENSE
*/
#ifndef _RA_SGXserver_hpp
#define RA_SGXserver_hpp
#include <iostream>
using namespace std;
#ifdef _WIN32
#pragma comment(lib, "crypt32.lib")
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#else
#include "config.h"
#endif
#ifdef _WIN32
// *sigh*
# include "vs/client/Enclave_u.h"
#else
# include "Enclave_u.h"
#endif
#if !defined(SGX_HW_SIM)&&!defined(_WIN32)
#include "sgx_stub.h"
#endif
#include <stdlib.h>
#include <limits.h>
#include <stdio.h>
#include <time.h>
#include <sgx_urts.h>
#include <sys/stat.h>
#ifdef _WIN32
#include <intrin.h>
#include <wincrypt.h>
#include "win32/getopt.h"
#else
#include <openssl/evp.h>
#include <getopt.h>
#include <unistd.h>
#endif
#include <sgx_uae_service.h>
#include <sgx_ukey_exchange.h>
#include <string>
#include "common.h"
#include "protocol.h"
#include "sgx_detect.h"
#include "hexutil.h"
#include "fileio.h"
#include "base64.h"
#include "crypto.h"
#include "msgio.h"
#include "logfile.h"
#include "quote_size.h"
#include <sqlite3.h>
typedef struct config_struct {
char mode;
uint32_t flags;
sgx_spid_t spid;
sgx_ec256_public_t pubkey;
sgx_quote_nonce_t nonce;
char *server;
char *port;
} config_t;
sgx_status_t sgx_create_enclave_search (
const char *filename,
const int edebug,
sgx_launch_token_t *token,
int *updated,
sgx_enclave_id_t *eid,
sgx_misc_attribute_t *attr
);
int init_RA(int argc, char **argv, sgx_enclave_id_t& eid, config_t& config);
MsgIO* prepare_MsgIO(config_t *config);
MsgIO* handshake_RA(sgx_enclave_id_t eid, config_t *config, sgx_ra_context_t& ra_ctx, MsgIO *msgio);
// Create By KS.
extern int cbflg;
int chkdb(string& userID, string& pwhash);
#endif