Skip to content

Commit 01f60bb

Browse files
committed
Update Tor non-enclave part
1 parent 6b0390d commit 01f60bb

File tree

298 files changed

+362989
-29
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

298 files changed

+362989
-29
lines changed

Tor/README

+15-29
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,24 @@
1-
1. compile & install Tor
2-
3-
cd tor-0.2.5.10
4-
./configure
5-
make
6-
make install
7-
8-
2. compile and execute enclave_process
1+
0.Prerequisite
2+
$ apt-get install libevent-dev
93

10-
cd enclave_Tor
11-
gcc -Wall enclave_process.c -o enclave_process -lcrypto -lssl -lpthread -L./ libor-crypto.a libor.a -lm
12-
./enclave_process
4+
1. compile & install Tor
135

14-
3. Configurating Chutney
6+
$ cd tor-0.2.5.10
7+
$ ./configure --disable-asciidoc
8+
$ make
9+
$ make install
1510

16-
cd chutney
17-
./chutney configure networks/basic
11+
2. Configurating Chutney
1812

13+
$ cd chutney
14+
$ ./chutney configure networks/basic
15+
$ ./chutney start network/basic
1916

2017
===========================================
2118

2219
[Remaining works]
2320

24-
1. Modifying chutney
25-
- Currently, it uses identity_key, signing_key, certificate by reading a file written by tor-gencert
26-
- Through our modification, we save them as a data structure, not file.
27-
- communicate with enclave_process
28-
29-
2. Find and modify tor code
30-
- After configuration is done, we will start tor using chutney
31-
-> ./chutney start networks/basic
32-
- While executing, if several functions requires such data structures, we have to change them communcating with
33-
enclave_process.
34-
35-
3. Exit nodes
36-
- Summarize the attack scenario
37-
- Saving keys while relay creation (while configuration)
38-
- Find operations which requires secret onion key, secret_id_key or so on..
21+
1. Enclave_Tor with argc, argv
22+
2. Get warnings
23+
3. Manual and script for executing enclave_process
24+
4. Manual and script for executing chutney (Tor-non-enclave)

Tor/modesgx.h

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* modesgx.h
3+
*/
4+
5+
#ifndef TOR_MODESGX_H_
6+
#define TOR_MODESGX_H_
7+
8+
#ifndef IPC_MODE
9+
#define IPC_MODE
10+
#endif
11+
12+
#include <unistd.h>
13+
14+
#endif /* TOR_MODESGX_H_ */

Tor/protocol.h

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* protocol.h
3+
*/
4+
5+
#ifndef TOR_PROTOCOL_H_
6+
#define TOR_PROTOCOL_H_
7+
8+
#include <arpa/inet.h>
9+
#define TMP_DIRECTORY_CONF "/tmp/tor_ipc_conf"
10+
#define TMP_DIRECTORY_RUN "/tmp/tor_ipc_run"
11+
#define TMP_FILE_NUMBER_FMT "%s/tor_pipe_%d"
12+
#define NAME_BUF_SIZE (256)
13+
14+
#include <sys/types.h>
15+
#include <sys/stat.h>
16+
#include <fcntl.h>
17+
#include <unistd.h>
18+
#include <stdint.h>
19+
#include <stddef.h>
20+
#include <stdio.h>
21+
#include <stdlib.h>
22+
#include <errno.h>
23+
#include <error.h>
24+
25+
#define RB_MODE_RD 0
26+
#define RB_MODE_WR 1
27+
28+
#ifndef IPC_MODE
29+
#define IPC_MODE
30+
#endif
31+
32+
static int pipe_init(int flag_dir)
33+
{
34+
int ret;
35+
36+
if (flag_dir == 0)
37+
ret = mkdir(TMP_DIRECTORY_CONF, 0770);
38+
else if (flag_dir == 1)
39+
ret = mkdir(TMP_DIRECTORY_RUN, 0770);
40+
41+
if (ret == -1) {
42+
if(errno != EEXIST) {
43+
perror("mkdir");
44+
return -1;
45+
}
46+
}
47+
48+
return 0;
49+
}
50+
51+
static int pipe_open(int unique_id, int is_write, int flag_dir)
52+
{
53+
char name_buf[NAME_BUF_SIZE];
54+
55+
if (flag_dir == 0)
56+
snprintf(name_buf, sizeof(name_buf), TMP_FILE_NUMBER_FMT,
57+
TMP_DIRECTORY_CONF, unique_id);
58+
else if (flag_dir == 1)
59+
snprintf(name_buf, sizeof(name_buf), TMP_FILE_NUMBER_FMT,
60+
TMP_DIRECTORY_RUN, unique_id);
61+
62+
int ret = mknod(name_buf, S_IFIFO | 0770, 0);
63+
if (ret == -1) {
64+
if (errno != EEXIST) {
65+
perror("mknod");
66+
exit(1);
67+
}
68+
}
69+
70+
int flag = O_ASYNC;
71+
if (is_write)
72+
flag |= O_WRONLY;
73+
else
74+
flag |= O_RDONLY;
75+
76+
int fd = open(name_buf, flag);
77+
if (fd == -1) {
78+
perror("open");
79+
return -1;
80+
}
81+
82+
return fd;
83+
}
84+
85+
#endif /* TOR_PROTOCOL_H_ */

0 commit comments

Comments
 (0)