Skip to content

Commit 7c2e2f9

Browse files
authored
Merge pull request #568 from GuilhemN/master
Fix some more typos
2 parents d1029a5 + 746e602 commit 7c2e2f9

File tree

25 files changed

+113
-124
lines changed

25 files changed

+113
-124
lines changed

SampleCode/LocalAttestation/App/UntrustedEnclaveMessageExchange.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545

4646
extern sgx_enclave_id_t responder_enclave_id;
4747

48-
/* Function Description: This is OCALL interface for initiator enclave to get ECDH message 1 and session id from responder enclave
48+
/* Function Description: This is OCALL interface for initiator enclave to get ECDH message 1 and session id from responder enclave
4949
* Parameter Description:
50-
* [input, output] dh_msg1: pointer to ecdh msg1 buffer, this buffer is alloated in initiator enclave and filled by reponser enclave
50+
* [input, output] dh_msg1: pointer to ecdh msg1 buffer, this buffer is allocated in initiator enclave and filled by responder enclave
5151
* [output] session_id: pointer to session id which is allocated by responder enclave
5252
* */
5353
extern "C" ATTESTATION_STATUS session_request_ocall(sgx_dh_msg1_t* dh_msg1, uint32_t* session_id)
@@ -65,7 +65,7 @@ extern "C" ATTESTATION_STATUS session_request_ocall(sgx_dh_msg1_t* dh_msg1, uint
6565
/* Function Description: This is OCALL interface for initiator enclave to send ECDH message 2 to responder enclave, and receive ECDH message 3 from responder enclave
6666
* Parameter Description:
6767
* [input] dh_msg2: this is pointer to ECDH message 2 generated by initiator enclave
68-
* [input, output]dh_msg3: this is pointer to ECDH message 3, this buffer is allocated in initiator enclave and filled by respoonder enclave
68+
* [input, output]dh_msg3: this is pointer to ECDH message 3, this buffer is allocated in initiator enclave and filled by responder enclave
6969
* [input] session_id: this is session id allocated by responder enclave
7070
* */
7171
ATTESTATION_STATUS exchange_report_ocall(sgx_dh_msg2_t *dh_msg2, sgx_dh_msg3_t *dh_msg3, uint32_t session_id)
@@ -85,7 +85,7 @@ ATTESTATION_STATUS exchange_report_ocall(sgx_dh_msg2_t *dh_msg2, sgx_dh_msg3_t *
8585
* [input] session_id: this is session id allocated by responder enclave
8686
* [input] req_message: this is pointer to request message
8787
* [input] req_message_size: this is request message size
88-
* [input] max_payload_size: this is maxium payload size in response message
88+
* [input] max_payload_size: this is maximum payload size in response message
8989
* [input, output] this is pointer to response message, the buffer is allocated by initiator enclave and filled by responder enclave
9090
* [input] response message size
9191
* */
@@ -97,11 +97,11 @@ ATTESTATION_STATUS send_request_ocall(uint32_t session_id, secure_message_t* req
9797
ret = generate_response(responder_enclave_id, &retcode, req_message, req_message_size, max_payload_size, resp_message, resp_message_size, session_id);
9898
if (ret != SGX_SUCCESS || retcode != SGX_SUCCESS)
9999
return INVALID_SESSION;
100-
100+
101101
return (ATTESTATION_STATUS)0;
102102
}
103103

104-
/* Function Description: this is OCALL interface for initiator enclave to close secure session
104+
/* Function Description: this is OCALL interface for initiator enclave to close secure session
105105
* Parameter Description:
106106
* [input] session_id: this is session id allocated by responder enclave
107107
* */

SampleCode/LocalAttestation/App/UntrustedEnclaveMessageExchange.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,17 @@
4646
extern "C" {
4747
#endif
4848

49-
/* Function Description: This is OCALL interface for initiator enclave to get ECDH message 1 and session id from responder enclave
49+
/* Function Description: This is OCALL interface for initiator enclave to get ECDH message 1 and session id from responder enclave
5050
* Parameter Description:
51-
* [input, output] dh_msg1: pointer to ecdh msg1 buffer, this buffer is alloated in initiator enclave and filled by reponser enclave
51+
* [input, output] dh_msg1: pointer to ecdh msg1 buffer, this buffer is allocated in initiator enclave and filled by reponsder enclave
5252
* [output] session_id: pointer to session id which is allocated by responder enclave
5353
* */
5454
uint32_t session_request_ocall(sgx_dh_msg1_t* dh_msg1, uint32_t* session_id);
5555

5656
/* Function Description: This is OCALL interface for initiator enclave to send ECDH message 2 to responder enclave, and receive ECDH message 3 from responder enclave
5757
* Parameter Description:
5858
* [input] dh_msg2: this is pointer to ECDH message 2 generated by initiator enclave
59-
* [input, output]dh_msg3: this is pointer to ECDH message 3, this buffer is allocated in initiator enclave and filled by respoonder enclave
59+
* [input, output]dh_msg3: this is pointer to ECDH message 3, this buffer is allocated in initiator enclave and filled by responder enclave
6060
* [input] session_id: this is session id allocated by responder enclave
6161
* */
6262
uint32_t exchange_report_ocall(sgx_dh_msg2_t* dh_msg2, sgx_dh_msg3_t* dh_msg3, uint32_t session_id);
@@ -66,14 +66,14 @@ uint32_t exchange_report_ocall(sgx_dh_msg2_t* dh_msg2, sgx_dh_msg3_t* dh_msg3, u
6666
* [input] session_id: this is session id allocated by responder enclave
6767
* [input] req_message: this is pointer to request message
6868
* [input] req_message_size: this is request message size
69-
* [input] max_payload_size: this is maxium payload size in response message
69+
* [input] max_payload_size: this is maximum payload size in response message
7070
* [input, output] this is pointer to response message, the buffer is allocated by initiator enclave and filled by responder enclave
7171
* [input] response message size
7272
* */
7373
uint32_t send_request_ocall(uint32_t session_id, secure_message_t* req_message, size_t req_message_size, size_t max_payload_size, secure_message_t* resp_message, size_t resp_message_size);
7474

7575

76-
/* Function Description: this is OCALL interface for initiator enclave to close secure session
76+
/* Function Description: this is OCALL interface for initiator enclave to close secure session
7777
* Parameter Description:
7878
* [input] session_id: this is session id allocated by responder enclave
7979
* */

SampleCode/LocalAttestation/AppInitiator/UntrustedEnclaveMessageExchange.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
/* Function Description: This is OCALL interface for initiator enclave to get ECDH message 1 and session id from responder enclave
4848
* Parameter Description:
49-
* [input, output] dh_msg1: pointer to ecdh msg1 buffer, this buffer is alloated in initiator enclave and filled by reponser enclave
49+
* [input, output] dh_msg1: pointer to ecdh msg1 buffer, this buffer is allocated in initiator enclave and filled by responder enclave
5050
* [output] session_id: pointer to session id which is allocated by responder enclave
5151
* */
5252
extern "C" ATTESTATION_STATUS session_request_ocall(sgx_dh_msg1_t* dh_msg1, uint32_t* session_id)
@@ -58,7 +58,7 @@ extern "C" ATTESTATION_STATUS session_request_ocall(sgx_dh_msg1_t* dh_msg1, uint
5858

5959
msg1_request.header.type = FIFO_DH_REQ_MSG1;
6060
msg1_request.header.size = 0;
61-
61+
6262
if ((client_send_receive(&msg1_request, sizeof(FIFO_MSG), &msg1_response, &msg1_resp_size) != 0)
6363
|| (msg1_response == NULL))
6464
{
@@ -78,7 +78,7 @@ extern "C" ATTESTATION_STATUS session_request_ocall(sgx_dh_msg1_t* dh_msg1, uint
7878
/* Function Description: This is OCALL interface for initiator enclave to send ECDH message 2 to responder enclave, and receive ECDH message 3 from responder enclave
7979
* Parameter Description:
8080
* [input] dh_msg2: this is pointer to ECDH message 2 generated by initiator enclave
81-
* [input, output]dh_msg3: this is pointer to ECDH message 3, this buffer is allocated in initiator enclave and filled by respoonder enclave
81+
* [input, output]dh_msg3: this is pointer to ECDH message 3, this buffer is allocated in initiator enclave and filled by responder enclave
8282
* [input] session_id: this is session id allocated by responder enclave
8383
* */
8484
ATTESTATION_STATUS exchange_report_ocall(sgx_dh_msg2_t *dh_msg2, sgx_dh_msg3_t *dh_msg3, uint32_t session_id)
@@ -95,13 +95,13 @@ ATTESTATION_STATUS exchange_report_ocall(sgx_dh_msg2_t *dh_msg2, sgx_dh_msg3_t *
9595
{
9696
return ERROR_OUT_OF_MEMORY;
9797
}
98-
memset(msg2, 0, msg2size);
98+
memset(msg2, 0, msg2size);
9999

100100
msg2_header = (FIFO_MSG_HEADER *)msg2;
101101
msg2_header->type = FIFO_DH_MSG2;
102102
msg2_header->size = sizeof(SESSION_MSG2);
103103

104-
msg2_body = (SESSION_MSG2 *)msg2->msgbuf;
104+
msg2_body = (SESSION_MSG2 *)msg2->msgbuf;
105105
memcpy(&msg2_body->dh_msg2, dh_msg2, sizeof(sgx_dh_msg2_t));
106106
msg2_body->sessionid = session_id;
107107

@@ -117,7 +117,7 @@ ATTESTATION_STATUS exchange_report_ocall(sgx_dh_msg2_t *dh_msg2, sgx_dh_msg3_t *
117117

118118
free(msg3);
119119
free(msg2);
120-
120+
121121
return (ATTESTATION_STATUS)0;
122122
}
123123

@@ -126,15 +126,15 @@ ATTESTATION_STATUS exchange_report_ocall(sgx_dh_msg2_t *dh_msg2, sgx_dh_msg3_t *
126126
* [input] session_id: this is session id allocated by responder enclave
127127
* [input] req_message: this is pointer to request message
128128
* [input] req_message_size: this is request message size
129-
* [input] max_payload_size: this is maxium payload size in response message
129+
* [input] max_payload_size: this is maximum payload size in response message
130130
* [input, output] this is pointer to response message, the buffer is allocated by initiator enclave and filled by responder enclave
131131
* [input] response message size
132132
* */
133133
ATTESTATION_STATUS send_request_ocall(uint32_t session_id, secure_message_t* req_message, size_t req_message_size, size_t max_payload_size, secure_message_t* resp_message, size_t resp_message_size)
134134
{
135135
FIFO_MSG *msgreq = NULL, * msgresp= NULL;
136136
FIFO_MSGBODY_REQ * msgbody;
137-
137+
138138
size_t reqsize, respsize;
139139

140140
reqsize = sizeof(FIFO_MSG_HEADER) + sizeof(FIFO_MSGBODY_REQ) + req_message_size;
@@ -189,7 +189,7 @@ ATTESTATION_STATUS end_session_ocall(uint32_t session_id)
189189
{
190190
return ERROR_OUT_OF_MEMORY;
191191
}
192-
memset(closemsg, 0,reqsize);
192+
memset(closemsg, 0,reqsize);
193193

194194
closemsg->header.type = FIFO_DH_CLOSE_REQ;
195195
closemsg->header.size = sizeof(SESSION_CLOSE_REQ);

SampleCode/LocalAttestation/AppInitiator/UntrustedEnclaveMessageExchange.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ extern "C" {
4848

4949
/* Function Description: This is OCALL interface for initiator enclave to get ECDH message 1 and session id from responder enclave
5050
* Parameter Description:
51-
* [input, output] dh_msg1: pointer to ecdh msg1 buffer, this buffer is alloated in initiator enclave and filled by reponser enclave
51+
* [input, output] dh_msg1: pointer to ecdh msg1 buffer, this buffer is allocated in initiator enclave and filled by responder enclave
5252
* [output] session_id: pointer to session id which is allocated by responder enclave
5353
* */
5454
uint32_t session_request_ocall(sgx_dh_msg1_t* dh_msg1, uint32_t* session_id);
5555

5656
/* Function Description: This is OCALL interface for initiator enclave to send ECDH message 2 to responder enclave, and receive ECDH message 3 from responder enclave
5757
* Parameter Description:
5858
* [input] dh_msg2: this is pointer to ECDH message 2 generated by initiator enclave
59-
* [input, output]dh_msg3: this is pointer to ECDH message 3, this buffer is allocated in initiator enclave and filled by respoonder enclave
59+
* [input, output]dh_msg3: this is pointer to ECDH message 3, this buffer is allocated in initiator enclave and filled by responder enclave
6060
* [input] session_id: this is session id allocated by responder enclave
6161
* */
6262
uint32_t exchange_report_ocall(sgx_dh_msg2_t* dh_msg2, sgx_dh_msg3_t* dh_msg3, uint32_t session_id);
@@ -66,7 +66,7 @@ uint32_t exchange_report_ocall(sgx_dh_msg2_t* dh_msg2, sgx_dh_msg3_t* dh_msg3, u
6666
* [input] session_id: this is session id allocated by responder enclave
6767
* [input] req_message: this is pointer to request message
6868
* [input] req_message_size: this is request message size
69-
* [input] max_payload_size: this is maxium payload size in response message
69+
* [input] max_payload_size: this is maximum payload size in response message
7070
* [input, output] this is pointer to response message, the buffer is allocated by initiator enclave and filled by responder enclave
7171
* [input] response message size
7272
* */

SampleCode/LocalAttestation/AppInitiator/datatypes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ typedef uint8_t cmac_128[MAC_SIZE];
7575
//Format of the AES-GCM message being exchanged between the source and the destination enclaves
7676
typedef struct _secure_message_t
7777
{
78-
uint32_t session_id; //Session ID identifyting the session to which the message belongs
79-
sgx_aes_gcm_data_t message_aes_gcm_data;
78+
uint32_t session_id; //Session ID identifying the session to which the message belongs
79+
sgx_aes_gcm_data_t message_aes_gcm_data;
8080
}secure_message_t;
8181

8282
//Format of the input function parameter structure

SampleCode/LocalAttestation/AppResponder/App.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void signal_handler(int sig)
7777
default:
7878
break;
7979
}
80-
80+
8181
exit(1);
8282
}
8383

@@ -93,7 +93,7 @@ int main(int argc, char* argv[])
9393
if (!g_cptask || !g_cpserver)
9494
return -1;
9595

96-
// registger signal handler so to respond to user interception
96+
// register signal handler so to respond to user interception
9797
signal(SIGINT, signal_handler);
9898
signal(SIGTERM, signal_handler);
9999

SampleCode/LocalAttestation/AppResponder/CPServer.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141

4242
#include "CPServer.h"
4343

44-
#define BACKLOG 5
45-
#define CONCURRENT_MAX 32
44+
#define BACKLOG 5
45+
#define CONCURRENT_MAX 32
4646
#define SERVER_PORT 8888
4747
#define BUFFER_SIZE 1024
4848

@@ -51,12 +51,12 @@
5151
/* Function Description:
5252
* This is server initialization routine, it creates TCP sockets and listen on a port.
5353
* In Linux, it would listen on domain socket named '/tmp/UNIX.domain'
54-
* In Windows, it would listen on port 8888, which is for demonstration purpose
54+
* In Windows, it would listen on port 8888, which is for demonstration purpose
5555
* */
5656
int CPServer::init()
5757
{
5858
struct sockaddr_un srv_addr;
59-
59+
6060
m_server_sock_fd = socket(AF_UNIX, SOCK_STREAM, 0);
6161
if (m_server_sock_fd == -1)
6262
{
@@ -75,7 +75,7 @@ int CPServer::init()
7575
close(m_server_sock_fd);
7676
return -1;
7777
}
78-
78+
7979
if (listen(m_server_sock_fd, BACKLOG) == -1)
8080
{
8181
printf("listen error\n");
@@ -97,26 +97,26 @@ void CPServer::doWork()
9797
int client_fds[CONCURRENT_MAX] = {0};
9898
fd_set server_fd_set;
9999
int max_fd = -1;
100-
struct timeval tv;
100+
struct timeval tv;
101101
char input_msg[BUFFER_SIZE];
102102
char recv_msg[BUFFER_SIZE];
103-
103+
104104
while (!m_shutdown)
105105
{
106-
// set 20s timeout for select()
106+
// set 20s timeout for select()
107107
tv.tv_sec = 20;
108108
tv.tv_usec = 0;
109109
FD_ZERO(&server_fd_set);
110110

111111
FD_SET(STDIN_FILENO, &server_fd_set);
112112
if (max_fd <STDIN_FILENO)
113113
max_fd = STDIN_FILENO;
114-
114+
115115
// listening on server socket
116116
FD_SET(m_server_sock_fd, &server_fd_set);
117117
if (max_fd < m_server_sock_fd)
118118
max_fd = m_server_sock_fd;
119-
119+
120120
// listening on all client connections
121121
for(int i =0; i < CONCURRENT_MAX; i++) {
122122
if(client_fds[i] != 0) {
@@ -125,24 +125,24 @@ void CPServer::doWork()
125125
max_fd = client_fds[i];
126126
}
127127
}
128-
128+
129129
int ret = select(max_fd + 1, &server_fd_set, NULL, NULL, &tv);
130130
if(ret < 0) {
131131
printf("Warning: server would shutdown\n");
132132
continue;
133133
} else if(ret == 0) {
134-
// timeout
134+
// timeout
135135
continue;
136-
}
137-
136+
}
137+
138138
if(FD_ISSET(m_server_sock_fd, &server_fd_set)) {
139139
// if there is new connection request
140140
struct sockaddr_un clt_addr;
141141
socklen_t len = sizeof(clt_addr);
142-
142+
143143
// accept this connection request
144144
int client_sock_fd = accept(m_server_sock_fd, (struct sockaddr *)&clt_addr, &len);
145-
145+
146146
if (client_sock_fd > 0) {
147147
// add new connection to connection pool if it's not full
148148
int index = -1;
@@ -153,7 +153,7 @@ void CPServer::doWork()
153153
break;
154154
}
155155
}
156-
156+
157157
if(index < 0) {
158158
printf("server reach maximum connection!\n");
159159
bzero(input_msg, BUFFER_SIZE);
@@ -166,20 +166,20 @@ void CPServer::doWork()
166166
break;
167167
}
168168
}
169-
169+
170170
for(int i =0; i < CONCURRENT_MAX; i++) {
171171
if ((client_fds[i] !=0)
172-
&& (FD_ISSET(client_fds[i], &server_fd_set)))
172+
&& (FD_ISSET(client_fds[i], &server_fd_set)))
173173
{
174-
// there is request messages from client connectsions
175-
FIFO_MSG * msg;
174+
// there is request messages from client connections
175+
FIFO_MSG * msg;
176176

177177
bzero(recv_msg, BUFFER_SIZE);
178178
long byte_num = recv(client_fds[i], recv_msg, BUFFER_SIZE, 0);
179179
if (byte_num > 0) {
180180
if(byte_num > BUFFER_SIZE)
181-
byte_num = BUFFER_SIZE;
182-
181+
byte_num = BUFFER_SIZE;
182+
183183
recv_msg[byte_num] = '\0';
184184

185185
msg = (FIFO_MSG *)malloc(byte_num);
@@ -188,11 +188,11 @@ void CPServer::doWork()
188188
continue;
189189
}
190190
memset(msg, 0, byte_num);
191-
191+
192192
memcpy(msg, recv_msg, byte_num);
193193

194194
msg->header.sockfd = client_fds[i];
195-
195+
196196
// put request message to event queue
197197
m_cptask->puttask(msg);
198198
}
@@ -217,6 +217,6 @@ void CPServer::shutDown()
217217
printf("Server would shutdown...\n");
218218
m_shutdown = 1;
219219
m_cptask->shutdown();
220-
220+
221221
close(m_server_sock_fd);
222222
}

0 commit comments

Comments
 (0)