From 5292700bbc2c9ece195b6e9c90ee9924dc7cc424 Mon Sep 17 00:00:00 2001 From: Max Lv Date: Thu, 24 Sep 2015 12:08:12 +0800 Subject: [PATCH] update documents --- src/server.c | 28 ++++++++++++++-------------- src/udprelay.c | 14 +++++++++----- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/server.c b/src/server.c index c0909c85..deffe731 100644 --- a/src/server.c +++ b/src/server.c @@ -528,27 +528,27 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents) /* * Shadowsocks TCP Relay Header: * - * +------+----------+----------+---------------------+ - * | ATYP | DST.ADDR | DST.PORT | Poly1305 | - * +------+----------+----------+---------------------+ - * | 1 | Variable | 2 | 16 | - * +------+----------+----------+---------------------+ + * +------+----------+----------+----------------+ + * | ATYP | DST.ADDR | DST.PORT | HMAC-SHA1 | + * +------+----------+----------+----------------+ + * | 1 | Variable | 2 | 20 | + * +------+----------+----------+----------------+ * - * If ATYP & ONETIMEAUTH_FLAG(0x10) == 1, Authentication (Poly1305) and Hash (BLAKE2b) are enabled. + * If ATYP & ONETIMEAUTH_FLAG(0x10) == 1, Authentication (HMAC-SHA1) is enabled. * - * The key of Poly1305 is BLAKE2b(IV + KEY) and the input is the whole header. + * The key of HMAC-SHA1 is (IV + KEY) and the input is the whole header. */ /* - * Shadowsocks TCP Request Chunk (Optional, no hash check for response's payload): + * Shadowsocks TCP Request's Chunk Authentication (Optional, no hash check for response's payload): * - * +------+---------+-------------+------+ - * | LEN | BLAKE2b | DATA | ... - * +------+---------+-------------+------+ - * | 2 | 4 | Variable | ... - * +------+---------+-------------+------+ + * +------+-----------+-------------+------+ + * | LEN | HMAC-SHA1 | DATA | ... + * +------+-----------+-------------+------+ + * | 2 | 20 | Variable | ... + * +------+-----------+-------------+------+ * - * The key of BLAKE2b is (IV + CHUNK ID) + * The key of HMAC-SHA1 is (IV + CHUNK ID) */ int offset = 0; diff --git a/src/udprelay.c b/src/udprelay.c index 53a56f75..53fd7739 100644 --- a/src/udprelay.c +++ b/src/udprelay.c @@ -869,11 +869,15 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents) * +----+------+------+----------+----------+----------+ * * shadowsocks UDP Request (before encrypted) - * +------+----------+----------+----------+ - * | ATYP | DST.ADDR | DST.PORT | DATA | - * +------+----------+----------+----------+ - * | 1 | Variable | 2 | Variable | - * +------+----------+----------+----------+ + * +------+----------+----------+----------+-------------+ + * | ATYP | DST.ADDR | DST.PORT | DATA | HMAC-SHA1 | + * +------+----------+----------+----------+-------------+ + * | 1 | Variable | 2 | Variable | 20 | + * +------+----------+----------+----------+-------------+ + * + * If ATYP & ONETIMEAUTH_FLAG(0x10) == 1, Authentication (HMAC-SHA1) is enabled. + * + * The key of HMAC-SHA1 is (IV + KEY) and the input is the whole packet. * * shadowsocks UDP Response (before encrypted) * +------+----------+----------+----------+