mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-11-01 07:13:45 +00:00
Refine the alignment again
This commit is contained in:
+5
-8
@@ -67,7 +67,7 @@ tls_ext_server_name_template = {
|
||||
.ext_len = 0,
|
||||
.server_name_list_len = 0,
|
||||
.server_name_type = 0,
|
||||
.server_name_len = 0
|
||||
.server_name_len = 0,
|
||||
// char server_name[server_name_len];
|
||||
};
|
||||
|
||||
@@ -102,7 +102,7 @@ tls_ext_others_template = {
|
||||
.encrypt_then_mac_ext_len = 0,
|
||||
|
||||
.extended_master_secret_type = CT_HTONS(0x0017),
|
||||
.extended_master_secret_ext_len = 0
|
||||
.extended_master_secret_ext_len = 0,
|
||||
};
|
||||
|
||||
static const struct tls_server_hello
|
||||
@@ -136,7 +136,7 @@ tls_server_hello_template = {
|
||||
.ec_point_formats_ext_type = CT_HTONS(0x000B),
|
||||
.ec_point_formats_ext_len = CT_HTONS(2),
|
||||
.ec_point_formats_len = 1,
|
||||
.ec_point_formats = { 0 }
|
||||
.ec_point_formats = { 0 },
|
||||
};
|
||||
|
||||
static const struct tls_change_cipher_spec
|
||||
@@ -144,20 +144,19 @@ tls_change_cipher_spec_template = {
|
||||
.content_type = 0x14,
|
||||
.version = CT_HTONS(0x0303),
|
||||
.len = CT_HTONS(1),
|
||||
.msg = 0x01
|
||||
.msg = 0x01,
|
||||
};
|
||||
|
||||
static const struct tls_encrypted_handshake
|
||||
tls_encrypted_handshake_template = {
|
||||
.content_type = 0x16,
|
||||
.version = CT_HTONS(0x0303),
|
||||
.len = 0
|
||||
.len = 0,
|
||||
// char msg[len];
|
||||
};
|
||||
|
||||
const char tls_data_header[3] = {0x17, 0x03, 0x03};
|
||||
|
||||
|
||||
static int obfs_tls_request(buffer_t *, size_t, obfs_t *);
|
||||
static int obfs_tls_response(buffer_t *, size_t, obfs_t *);
|
||||
static int deobfs_tls_request(buffer_t *, size_t, obfs_t *);
|
||||
@@ -247,7 +246,6 @@ deobfs_app_data(buffer_t *buf, size_t idx, obfs_t *obfs)
|
||||
static int
|
||||
obfs_tls_request(buffer_t *buf, size_t cap, obfs_t *obfs)
|
||||
{
|
||||
|
||||
if (obfs == NULL || obfs->obfs_stage < 0) return 0;
|
||||
|
||||
static buffer_t tmp = { 0, 0, 0, NULL };
|
||||
@@ -489,7 +487,6 @@ deobfs_tls_response(buffer_t *buf, size_t cap, obfs_t *obfs)
|
||||
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -44,7 +44,7 @@ struct tls_client_hello {
|
||||
char comp_methods_len;
|
||||
char comp_methods[1];
|
||||
short ext_len;
|
||||
} __attribute__((packed));
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct tls_ext_server_name {
|
||||
short ext_type;
|
||||
@@ -53,13 +53,13 @@ struct tls_ext_server_name {
|
||||
char server_name_type;
|
||||
short server_name_len;
|
||||
// char server_name[server_name_len];
|
||||
} __attribute__((packed));
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct tls_ext_session_ticket {
|
||||
short session_ticket_type;
|
||||
short session_ticket_ext_len;
|
||||
// char session_ticket[session_ticket_ext_len];
|
||||
} __attribute__((packed));
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct tls_ext_others {
|
||||
short ec_point_formats_ext_type;
|
||||
@@ -82,7 +82,7 @@ struct tls_ext_others {
|
||||
|
||||
short extended_master_secret_type;
|
||||
short extended_master_secret_ext_len;
|
||||
} __attribute__((packed));
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct tls_server_hello {
|
||||
char content_type;
|
||||
@@ -113,21 +113,21 @@ struct tls_server_hello {
|
||||
short ec_point_formats_ext_len;
|
||||
char ec_point_formats_len;
|
||||
char ec_point_formats[1];
|
||||
} __attribute__((packed));
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct tls_change_cipher_spec {
|
||||
char content_type;
|
||||
short version;
|
||||
short len;
|
||||
char msg;
|
||||
} __attribute__((packed));
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct tls_encrypted_handshake {
|
||||
char content_type;
|
||||
short version;
|
||||
short len;
|
||||
// char msg[len];
|
||||
} __attribute__((packed));
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
typedef struct frame {
|
||||
short idx;
|
||||
|
||||
+4
-4
@@ -34,25 +34,25 @@ struct method_select_request {
|
||||
char ver;
|
||||
char nmethods;
|
||||
char methods[255];
|
||||
} __attribute__((packed));
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct method_select_response {
|
||||
char ver;
|
||||
char method;
|
||||
} __attribute__((packed));
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct socks5_request {
|
||||
char ver;
|
||||
char cmd;
|
||||
char rsv;
|
||||
char atyp;
|
||||
} __attribute__((packed));
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
struct socks5_response {
|
||||
char ver;
|
||||
char rep;
|
||||
char rsv;
|
||||
char atyp;
|
||||
} __attribute__((packed));
|
||||
} __attribute__((packed, aligned(1)));
|
||||
|
||||
#endif // _SOCKS5_H
|
||||
|
||||
+1
-1
@@ -229,7 +229,7 @@ void *ss_realloc(void *ptr, size_t new_size);
|
||||
ptr = NULL; \
|
||||
} while (0)
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#if _BYTE_ORDER == _BIG_ENDIAN
|
||||
|
||||
#define CT_HTONS(n) (n)
|
||||
#define CT_NTOHS(n) (n)
|
||||
|
||||
Reference in New Issue
Block a user