summaryrefslogtreecommitdiff
path: root/code/proxy/proxy.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2017-07-23 10:17:38 +0200
committerUros Majstorovic <majstor@majstor.org>2017-07-23 10:17:38 +0200
commit804f291bd719c868778e2c624245113c219b3a36 (patch)
treef46bde25e9db331d06189dd8ed55233a6bbfb01a /code/proxy/proxy.c
parentd580fc0e00bf4b7acd3f9ee3345fad32223b40db (diff)
pre postira
Diffstat (limited to 'code/proxy/proxy.c')
-rw-r--r--code/proxy/proxy.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/code/proxy/proxy.c b/code/proxy/proxy.c
index ba21ca1..81ce04c 100644
--- a/code/proxy/proxy.c
+++ b/code/proxy/proxy.c
@@ -349,28 +349,30 @@ static ssize_t proxy_set_msg(ECPConnection *conn, unsigned char *pld_out, size_t
return ECP_SIZE_MSG_HDR;
}
-static ssize_t proxy_pack(ECPConnection *conn, ECPNetAddr *addr, unsigned char *packet, size_t pkt_size, unsigned char s_idx, unsigned char c_idx, unsigned char *payload, size_t payload_size) {
+static ssize_t proxy_pack(ECPConnection *conn, ECPNetAddr *addr, ecp_seq_t *seq, unsigned char *packet, size_t pkt_size, unsigned char s_idx, unsigned char c_idx, unsigned char *payload, size_t payload_size) {
ECPContext *ctx = conn->sock->ctx;
unsigned char payload_[ECP_MAX_PLD];
+ ecp_seq_t _seq;
ssize_t rv, hdr_size = proxy_set_msg(conn->proxy, payload_, sizeof(payload_), payload, payload_size);
if (hdr_size < 0) return hdr_size;
- rv = ecp_conn_pack(conn, NULL, payload_+hdr_size, ECP_MAX_PLD-hdr_size, s_idx, c_idx, payload, payload_size);
+ rv = ecp_conn_pack(conn, NULL, &_seq, payload_+hdr_size, ECP_MAX_PLD-hdr_size, s_idx, c_idx, payload, payload_size);
if (rv < 0) return rv;
- return ecp_proxy_pack(conn->proxy, addr, packet, pkt_size, ECP_ECDH_IDX_INV, ECP_ECDH_IDX_INV, payload_, rv+hdr_size);
+ return ecp_proxy_pack(conn->proxy, addr, seq, packet, pkt_size, ECP_ECDH_IDX_INV, ECP_ECDH_IDX_INV, payload_, rv+hdr_size);
}
-static ssize_t proxy_pack_raw(ECPConnection *proxy, ECPNetAddr *addr, unsigned char *packet, size_t pkt_size, unsigned char s_idx, unsigned char c_idx, ecp_dh_public_t *public, ecp_aead_key_t *shsec, unsigned char *nonce, unsigned char *seq, unsigned char *payload, size_t payload_size) {
+static ssize_t proxy_pack_raw(ECPConnection *proxy, ECPNetAddr *addr, unsigned char *packet, size_t pkt_size, unsigned char s_idx, unsigned char c_idx, ecp_dh_public_t *public, ecp_aead_key_t *shsec, unsigned char *nonce, ecp_seq_t seq, unsigned char *payload, size_t payload_size) {
ECPContext *ctx = proxy->sock->ctx;
unsigned char payload_[ECP_MAX_PLD];
+ ecp_seq_t _seq;
ssize_t rv, hdr_size = proxy_set_msg(proxy, payload_, sizeof(payload_), payload, payload_size);
if (hdr_size < 0) return hdr_size;
rv = ecp_pack(ctx, payload_+hdr_size, ECP_MAX_PLD-hdr_size, s_idx, c_idx, public, shsec, nonce, seq, payload, payload_size);
if (rv < 0) return rv;
- return ecp_proxy_pack(proxy, addr, packet, pkt_size, ECP_ECDH_IDX_INV, ECP_ECDH_IDX_INV, payload_, rv+hdr_size);
+ return ecp_proxy_pack(proxy, addr, &_seq, packet, pkt_size, ECP_ECDH_IDX_INV, ECP_ECDH_IDX_INV, payload_, rv+hdr_size);
}
int ecp_proxy_init(ECPContext *ctx) {