Skip to content

Commit 22aa4aa

Browse files
committed
add get_overhead
1 parent 2439532 commit 22aa4aa

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

src/obfs/auth.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ obfs * auth_aes128_sha1_new_obfs() {
8383
return self;
8484
}
8585

86+
int auth_aes128_sha1_get_overhead(obfs *self) {
87+
return 9;
88+
}
89+
8690
void auth_simple_dispose(obfs *self) {
8791
auth_simple_local_data *local = (auth_simple_local_data*)self->l_data;
8892
if (local->recv_buffer != NULL) {
@@ -789,7 +793,7 @@ int auth_aes128_sha1_pack_auth_data(auth_simple_global_data *global, server_info
789793
}
790794

791795
{
792-
rand_bytes(outdata, 1);
796+
rand_bytes((uint8_t*)outdata, 1);
793797
char hash[20];
794798
local->hmac(hash, (char *)outdata, 1, key, key_len);
795799
memcpy(outdata + 1, hash, 6);

src/obfs/auth.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ obfs * auth_aes128_md5_new_obfs();
1515
obfs * auth_aes128_sha1_new_obfs();
1616
void auth_simple_dispose(obfs *self);
1717

18-
int auth_simple_client_pre_encrypt(obfs *self, char **pplaindata, int datalength, size_t* capacity);
19-
int auth_simple_client_post_decrypt(obfs *self, char **pplaindata, int datalength, size_t* capacity);
20-
18+
//int auth_simple_client_pre_encrypt(obfs *self, char **pplaindata, int datalength, size_t* capacity);
19+
//int auth_simple_client_post_decrypt(obfs *self, char **pplaindata, int datalength, size_t* capacity);
2120

2221
int auth_sha1_client_pre_encrypt(obfs *self, char **pplaindata, int datalength, size_t* capacity);
2322
int auth_sha1_client_post_decrypt(obfs *self, char **pplaindata, int datalength, size_t* capacity);
@@ -33,4 +32,6 @@ int auth_aes128_sha1_client_post_decrypt(obfs *self, char **pplaindata, int data
3332

3433
int auth_aes128_sha1_client_udp_pre_encrypt(obfs *self, char **pplaindata, int datalength, size_t* capacity);
3534
int auth_aes128_sha1_client_udp_post_decrypt(obfs *self, char **pplaindata, int datalength, size_t* capacity);
35+
36+
int auth_aes128_sha1_get_overhead(obfs *self);
3637
#endif // _OBFS_AUTH_H

src/obfs/obfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ obfs_class * new_obfs_class(char *plugin_name)
8080
obfs_class * plugin = (obfs_class*)malloc(sizeof(obfs));
8181
plugin->init_data = tls12_ticket_auth_init_data;
8282
plugin->new_obfs = tls12_ticket_auth_new_obfs;
83-
plugin->get_overhead = get_overhead;
83+
plugin->get_overhead = tls12_ticket_auth_get_overhead;
8484
plugin->get_server_info = get_server_info;
8585
plugin->set_server_info = set_server_info;
8686
plugin->dispose = tls12_ticket_auth_dispose;
@@ -166,7 +166,7 @@ obfs_class * new_obfs_class(char *plugin_name)
166166
obfs_class * plugin = (obfs_class*)malloc(sizeof(obfs));
167167
plugin->init_data = auth_simple_init_data;
168168
plugin->new_obfs = strcmp(plugin_name, "auth_aes128_md5") == 0 ? auth_aes128_md5_new_obfs : auth_aes128_sha1_new_obfs;
169-
plugin->get_overhead = get_overhead;
169+
plugin->get_overhead = auth_aes128_sha1_get_overhead;
170170
plugin->get_server_info = get_server_info;
171171
plugin->set_server_info = set_server_info;
172172
plugin->dispose = auth_simple_dispose;

src/obfs/tls1.2_ticket.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ obfs * tls12_ticket_auth_new_obfs() {
4040
return self;
4141
}
4242

43+
int tls12_ticket_auth_get_overhead(obfs *self) {
44+
return 5;
45+
}
46+
4347
void tls12_ticket_auth_dispose(obfs *self) {
4448
tls12_ticket_auth_local_data *local = (tls12_ticket_auth_local_data*)self->l_data;
4549
if (local->send_buffer != NULL) {

src/obfs/tls1.2_ticket.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ void tls12_ticket_auth_dispose(obfs *self);
1616
int tls12_ticket_auth_client_encode(obfs *self, char **pencryptdata, int datalength, size_t* capacity);
1717
int tls12_ticket_auth_client_decode(obfs *self, char **pencryptdata, int datalength, size_t* capacity, int *needsendback);
1818

19+
int tls12_ticket_auth_get_overhead(obfs *self);
1920
#endif // _OBFS_TLS1_2_TICKET_H

0 commit comments

Comments
 (0)