summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ecp/src/ecp/TODO4
-rw-r--r--ecp/src/ecp/core.c23
-rw-r--r--ecp/src/ecp/core.h1
-rw-r--r--ecp/src/ecp/crypto/include/chacha.h48
-rw-r--r--ecp/src/ecp/crypto/include/compat.h24
-rw-r--r--ecp/src/ecp/crypto/include/curve25519.h78
-rw-r--r--ecp/src/ecp/crypto/include/machine/endian.h40
-rw-r--r--ecp/src/ecp/crypto/include/md32_common.h344
-rw-r--r--ecp/src/ecp/crypto/include/poly1305.h43
-rw-r--r--ecp/src/ecp/crypto/include/sha.h186
-rw-r--r--ecp/src/ecp/dir/dir.c2
-rw-r--r--ecp/src/ecp/ext.h2
-rw-r--r--ecp/src/ecp/ext/msgq.c2
-rw-r--r--ecp/src/ecp/ext/rbuf_recv.c1
-rw-r--r--ecp/src/ecp/ext/rbuf_send.c2
-rw-r--r--ecp/src/ecp/vconn/vconn.c39
-rw-r--r--ecp/src/ecp/vconn/vconn.h4
-rw-r--r--ecp/test/Makefile38
18 files changed, 40 insertions, 841 deletions
diff --git a/ecp/src/ecp/TODO b/ecp/src/ecp/TODO
index 8f633ed..4665c92 100644
--- a/ecp/src/ecp/TODO
+++ b/ecp/src/ecp/TODO
@@ -1,5 +1 @@
- memzero keys after usage
-- implement socket message queue
-
-rbuf:
-- implement _wait variants of open / send
diff --git a/ecp/src/ecp/core.c b/ecp/src/ecp/core.c
index 536efff..d836ff4 100644
--- a/ecp/src/ecp/core.c
+++ b/ecp/src/ecp/core.c
@@ -251,27 +251,24 @@ static ECPConnection *conn_table_search(ECPSocket *sock, unsigned char c_idx, ec
return NULL;
}
#else
- ECPConnection *conn;
+ ECPConnection *conn = NULL;
int i;
if (c_public) {
- if (ecp_conn_is_outb(conn)) {
- if (c_idx >= ECP_MAX_CONN_KEY) return NULL;
+ for (i=0; i<sock->conn_table.size; i++) {
+ conn = sock->conn_table.arr[i];
+ if (ecp_conn_is_outb(conn)) {
+ if (c_idx >= ECP_MAX_CONN_KEY) continue;
- for (i=0; i<sock->conn_table.size; i++) {
- conn = sock->conn_table.arr[i];
if (conn->key[c_idx].valid && ecp_ecdh_pub_eq(c_public, &conn->key[c_idx].public)) {
return conn;
}
- }
- } else {
- unsigned char _c_idx;
+ } else {
+ unsigned char _c_idx;
- if (c_idx & ~ECP_ECDH_IDX_MASK) return NULL;
+ if (c_idx & ~ECP_ECDH_IDX_MASK) continue;
- _c_idx = c_idx % ECP_MAX_NODE_KEY;
- for (i=0; i<sock->conn_table.size; i++) {
- conn = sock->conn_table.arr[i];
+ _c_idx = c_idx % ECP_MAX_NODE_KEY;
if (conn->rkey[_c_idx].valid && ecp_ecdh_pub_eq(c_public, &conn->rkey[_c_idx].public)) {
return conn;
}
@@ -2080,7 +2077,7 @@ static ssize_t _pack(ECPBuffer *packet, ECPPktMeta *pkt_meta, ECPBuffer *payload
pkt_buf = packet->buffer;
pkt_size = packet->size;
- // ECP_SIZE_PROTO
+ /* PROTO */
pkt_buf[0] = 0;
pkt_buf[1] = 0;
pkt_buf[ECP_SIZE_PROTO] = (pkt_meta->s_idx << 4) | pkt_meta->c_idx;
diff --git a/ecp/src/ecp/core.h b/ecp/src/ecp/core.h
index 85fc453..8ac2931 100644
--- a/ecp/src/ecp/core.h
+++ b/ecp/src/ecp/core.h
@@ -24,6 +24,7 @@
#define ECP_ERR_NET_ADDR -13
#define ECP_ERR_MAX_PARENT -14
+#define ECP_ERR_NEXT -15
#define ECP_ERR_ECDH_KEY_DUP -21
#define ECP_ERR_ECDH_IDX -22
diff --git a/ecp/src/ecp/crypto/include/chacha.h b/ecp/src/ecp/crypto/include/chacha.h
deleted file mode 100644
index 25a3ef3..0000000
--- a/ecp/src/ecp/crypto/include/chacha.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: chacha.h,v 1.7 2015/12/09 14:07:55 bcook Exp $ */
-/*
- * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef HEADER_CHACHA_H
-#define HEADER_CHACHA_H
-
-#include <stddef.h>
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- unsigned int input[16];
- unsigned char ks[64];
- unsigned char unused;
-} ChaCha_ctx;
-
-void ChaCha_set_key(ChaCha_ctx *ctx, const unsigned char *key,
- uint32_t keybits);
-void ChaCha_set_iv(ChaCha_ctx *ctx, const unsigned char *iv,
- const unsigned char *counter);
-void ChaCha(ChaCha_ctx *ctx, unsigned char *out, const unsigned char *in,
- size_t len);
-
-void CRYPTO_chacha_20(unsigned char *out, const unsigned char *in, size_t len,
- const unsigned char key[32], const unsigned char iv[8], uint64_t counter);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* HEADER_CHACHA_H */
diff --git a/ecp/src/ecp/crypto/include/compat.h b/ecp/src/ecp/crypto/include/compat.h
deleted file mode 100644
index 12fb3f4..0000000
--- a/ecp/src/ecp/crypto/include/compat.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <sys/types.h>
-#include <stdint.h>
-
-#ifndef HAVE_GETENTROPY
-int getentropy(void *buf, size_t buflen);
-#endif
-
-#ifndef HAVE_EXPLICIT_BZERO
-void explicit_bzero(void *, size_t);
-#endif
-
-#ifndef HAVE_TIMINGSAFE_BCMP
-int timingsafe_bcmp(const void *b1, const void *b2, size_t n);
-#endif
-
-#ifndef HAVE_TIMINGSAFE_MEMCMP
-int timingsafe_memcmp(const void *b1, const void *b2, size_t len);
-#endif
-
-#ifndef HAVE_ARC4RANDOM_BUF
-uint32_t arc4random(void);
-void arc4random_buf(void *_buf, size_t n);
-uint32_t arc4random_uniform(uint32_t upper_bound);
-#endif
diff --git a/ecp/src/ecp/crypto/include/curve25519.h b/ecp/src/ecp/crypto/include/curve25519.h
deleted file mode 100644
index a7092cb..0000000
--- a/ecp/src/ecp/crypto/include/curve25519.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2015, Google Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef HEADER_CURVE25519_H
-#define HEADER_CURVE25519_H
-
-#include <stdint.h>
-#include <stddef.h>
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-/*
- * Curve25519.
- *
- * Curve25519 is an elliptic curve. See https://tools.ietf.org/html/rfc7748.
- */
-
-/*
- * X25519.
- *
- * X25519 is the Diffie-Hellman primitive built from curve25519. It is
- * sometimes referred to as curve25519, but X25519 is a more precise name.
- * See http://cr.yp.to/ecdh.html and https://tools.ietf.org/html/rfc7748.
- */
-
-#define X25519_KEY_LENGTH 32
-
-/*
- * X25519_keypair sets |out_public_value| and |out_private_key| to a freshly
- * generated, public/private key pair. It returns one on success and zero on
- * error.
- */
-int X25519_keypair(uint8_t out_public_value[X25519_KEY_LENGTH],
- uint8_t out_private_key[X25519_KEY_LENGTH],
- int (*random_buf)(void *, size_t));
-
-/*
- * X25519 writes a shared key to |out_shared_key| that is calculated from the
- * given private key and the peer's public value. It returns one on success and
- * zero on error.
- *
- * Don't use the shared key directly, rather use a KDF and also include the two
- * public values as inputs.
- */
-int X25519(uint8_t out_shared_key[X25519_KEY_LENGTH],
- const uint8_t private_key[X25519_KEY_LENGTH],
- const uint8_t peers_public_value[X25519_KEY_LENGTH]);
-
-/*
- * ED25519
- */
-int ED25519_keypair(uint8_t out_public_key[32], uint8_t out_private_key[64],
- int (*random_buf)(void *, size_t));
-int ED25519_sign(uint8_t *out_sig, const uint8_t *message, size_t message_len,
- const uint8_t private_key[64]);
-int ED25519_verify(const uint8_t *message, size_t message_len,
- const uint8_t signature[64], const uint8_t public_key[32]);
-
-#if defined(__cplusplus)
-} /* extern C */
-#endif
-
-#endif /* HEADER_CURVE25519_H */
diff --git a/ecp/src/ecp/crypto/include/machine/endian.h b/ecp/src/ecp/crypto/include/machine/endian.h
deleted file mode 100644
index 5ec39af..0000000
--- a/ecp/src/ecp/crypto/include/machine/endian.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Public domain
- * machine/endian.h compatibility shim
- */
-
-#ifndef LIBCRYPTOCOMPAT_BYTE_ORDER_H_
-#define LIBCRYPTOCOMPAT_BYTE_ORDER_H_
-
-#if defined(_WIN32)
-
-#define LITTLE_ENDIAN 1234
-#define BIG_ENDIAN 4321
-#define PDP_ENDIAN 3412
-
-/*
- * Use GCC and Visual Studio compiler defines to determine endian.
- */
-#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-#define BYTE_ORDER LITTLE_ENDIAN
-#else
-#define BYTE_ORDER BIG_ENDIAN
-#endif
-
-#elif defined(__linux__)
-#include <endian.h>
-
-#elif defined(__sun) || defined(_AIX) || defined(__hpux)
-#include <sys/types.h>
-#include <arpa/nameser_compat.h>
-
-#elif defined(__sgi)
-#include <standards.h>
-#include <sys/endian.h>
-
-#else
-#include_next <machine/endian.h>
-
-#endif
-
-#endif
diff --git a/ecp/src/ecp/crypto/include/md32_common.h b/ecp/src/ecp/crypto/include/md32_common.h
deleted file mode 100644
index 7a6e893..0000000
--- a/ecp/src/ecp/crypto/include/md32_common.h
+++ /dev/null
@@ -1,344 +0,0 @@
-/* $OpenBSD: md32_common.h,v 1.22 2016/11/04 13:56:04 miod Exp $ */
-/* ====================================================================
- * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * licensing@OpenSSL.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- */
-
-/*
- * This is a generic 32 bit "collector" for message digest algorithms.
- * Whenever needed it collects input character stream into chunks of
- * 32 bit values and invokes a block function that performs actual hash
- * calculations.
- *
- * Porting guide.
- *
- * Obligatory macros:
- *
- * DATA_ORDER_IS_BIG_ENDIAN or DATA_ORDER_IS_LITTLE_ENDIAN
- * this macro defines byte order of input stream.
- * HASH_CBLOCK
- * size of a unit chunk HASH_BLOCK operates on.
- * HASH_LONG
- * has to be at least 32 bit wide.
- * HASH_CTX
- * context structure that at least contains following
- * members:
- * typedef struct {
- * ...
- * HASH_LONG Nl,Nh;
- * either {
- * HASH_LONG data[HASH_LBLOCK];
- * unsigned char data[HASH_CBLOCK];
- * };
- * unsigned int num;
- * ...
- * } HASH_CTX;
- * data[] vector is expected to be zeroed upon first call to
- * HASH_UPDATE.
- * HASH_UPDATE
- * name of "Update" function, implemented here.
- * HASH_TRANSFORM
- * name of "Transform" function, implemented here.
- * HASH_FINAL
- * name of "Final" function, implemented here.
- * HASH_BLOCK_DATA_ORDER
- * name of "block" function capable of treating *unaligned* input
- * message in original (data) byte order, implemented externally.
- * HASH_MAKE_STRING
- * macro convering context variables to an ASCII hash string.
- *
- * MD5 example:
- *
- * #define DATA_ORDER_IS_LITTLE_ENDIAN
- *
- * #define HASH_LONG MD5_LONG
- * #define HASH_CTX MD5_CTX
- * #define HASH_CBLOCK MD5_CBLOCK
- * #define HASH_UPDATE MD5_Update
- * #define HASH_TRANSFORM MD5_Transform
- * #define HASH_FINAL MD5_Final
- * #define HASH_BLOCK_DATA_ORDER md5_block_data_order
- *
- * <appro@fy.chalmers.se>
- */
-
-#include <stdint.h>
-#include <string.h>
-
-#if !defined(DATA_ORDER_IS_BIG_ENDIAN) && !defined(DATA_ORDER_IS_LITTLE_ENDIAN)
-#error "DATA_ORDER must be defined!"
-#endif
-
-#ifndef HASH_CBLOCK
-#error "HASH_CBLOCK must be defined!"
-#endif
-#ifndef HASH_LONG
-#error "HASH_LONG must be defined!"
-#endif
-#ifndef HASH_CTX
-#error "HASH_CTX must be defined!"
-#endif
-
-#ifndef HASH_UPDATE
-#error "HASH_UPDATE must be defined!"
-#endif
-#ifndef HASH_TRANSFORM
-#error "HASH_TRANSFORM must be defined!"
-#endif
-#if !defined(HASH_FINAL) && !defined(HASH_NO_FINAL)
-#error "HASH_FINAL or HASH_NO_FINAL must be defined!"
-#endif
-
-#ifndef HASH_BLOCK_DATA_ORDER
-#error "HASH_BLOCK_DATA_ORDER must be defined!"
-#endif
-
-/*
- * This common idiom is recognized by the compiler and turned into a
- * CPU-specific intrinsic as appropriate.
- * e.g. GCC optimizes to roll on amd64 at -O0
- */
-static inline uint32_t ROTATE(uint32_t a, uint32_t n)
-{
- return (a<<n)|(a>>(32-n));
-}
-
-#if defined(DATA_ORDER_IS_BIG_ENDIAN)
-
-#if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
-# if (defined(__i386) || defined(__i386__) || \
- defined(__x86_64) || defined(__x86_64__))
- /*
- * This gives ~30-40% performance improvement in SHA-256 compiled
- * with gcc [on P4]. Well, first macro to be frank. We can pull
- * this trick on x86* platforms only, because these CPUs can fetch
- * unaligned data without raising an exception.
- */
-# define HOST_c2l(c,l) ({ unsigned int r=*((const unsigned int *)(c)); \
- asm ("bswapl %0":"=r"(r):"0"(r)); \
- (c)+=4; (l)=r; })
-# define HOST_l2c(l,c) ({ unsigned int r=(l); \
- asm ("bswapl %0":"=r"(r):"0"(r)); \
- *((unsigned int *)(c))=r; (c)+=4; })
-# endif
-#endif
-
-#ifndef HOST_c2l
-#define HOST_c2l(c,l) do {l =(((unsigned long)(*((c)++)))<<24); \
- l|=(((unsigned long)(*((c)++)))<<16); \
- l|=(((unsigned long)(*((c)++)))<< 8); \
- l|=(((unsigned long)(*((c)++))) ); \
- } while (0)
-#endif
-#ifndef HOST_l2c
-#define HOST_l2c(l,c) do {*((c)++)=(unsigned char)(((l)>>24)&0xff); \
- *((c)++)=(unsigned char)(((l)>>16)&0xff); \
- *((c)++)=(unsigned char)(((l)>> 8)&0xff); \
- *((c)++)=(unsigned char)(((l) )&0xff); \
- } while (0)
-#endif
-
-#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN)
-
-#if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)
-# define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4)
-# define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4)
-#endif
-
-#ifndef HOST_c2l
-#define HOST_c2l(c,l) do {l =(((unsigned long)(*((c)++))) ); \
- l|=(((unsigned long)(*((c)++)))<< 8); \
- l|=(((unsigned long)(*((c)++)))<<16); \
- l|=(((unsigned long)(*((c)++)))<<24); \
- } while (0)
-#endif
-#ifndef HOST_l2c
-#define HOST_l2c(l,c) do {*((c)++)=(unsigned char)(((l) )&0xff); \
- *((c)++)=(unsigned char)(((l)>> 8)&0xff); \
- *((c)++)=(unsigned char)(((l)>>16)&0xff); \
- *((c)++)=(unsigned char)(((l)>>24)&0xff); \
- } while (0)
-#endif
-
-#endif
-
-/*
- * Time for some action:-)
- */
-
-int
-HASH_UPDATE(HASH_CTX *c, const void *data_, size_t len)
-{
- const unsigned char *data = data_;
- unsigned char *p;
- HASH_LONG l;
- size_t n;
-
- if (len == 0)
- return 1;
-
- l = (c->Nl + (((HASH_LONG)len) << 3))&0xffffffffUL;
- /* 95-05-24 eay Fixed a bug with the overflow handling, thanks to
- * Wei Dai <weidai@eskimo.com> for pointing it out. */
- if (l < c->Nl) /* overflow */
- c->Nh++;
- c->Nh+=(HASH_LONG)(len>>29); /* might cause compiler warning on 16-bit */
- c->Nl = l;
-
- n = c->num;
- if (n != 0) {
- p = (unsigned char *)c->data;
-
- if (len >= HASH_CBLOCK || len + n >= HASH_CBLOCK) {
- memcpy (p + n, data, HASH_CBLOCK - n);
- HASH_BLOCK_DATA_ORDER (c, p, 1);
- n = HASH_CBLOCK - n;
- data += n;
- len -= n;
- c->num = 0;
- memset (p,0,HASH_CBLOCK); /* keep it zeroed */
- } else {
- memcpy (p + n, data, len);
- c->num += (unsigned int)len;
- return 1;
- }
- }
-
- n = len/HASH_CBLOCK;
- if (n > 0) {
- HASH_BLOCK_DATA_ORDER (c, data, n);
- n *= HASH_CBLOCK;
- data += n;
- len -= n;
- }
-
- if (len != 0) {
- p = (unsigned char *)c->data;
- c->num = (unsigned int)len;
- memcpy (p, data, len);
- }
- return 1;
-}
-
-
-void HASH_TRANSFORM (HASH_CTX *c, const unsigned char *data)
-{
- HASH_BLOCK_DATA_ORDER (c, data, 1);
-}
-
-
-#ifndef HASH_NO_FINAL
-int HASH_FINAL (unsigned char *md, HASH_CTX *c)
-{
- unsigned char *p = (unsigned char *)c->data;
- size_t n = c->num;
-
- p[n] = 0x80; /* there is always room for one */
- n++;
-
- if (n > (HASH_CBLOCK - 8)) {
- memset (p + n, 0, HASH_CBLOCK - n);
- n = 0;
- HASH_BLOCK_DATA_ORDER (c, p, 1);
- }
- memset (p + n, 0, HASH_CBLOCK - 8 - n);
-
- p += HASH_CBLOCK - 8;
-#if defined(DATA_ORDER_IS_BIG_ENDIAN)
- HOST_l2c(c->Nh, p);
- HOST_l2c(c->Nl, p);
-#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN)
- HOST_l2c(c->Nl, p);
- HOST_l2c(c->Nh, p);
-#endif
- p -= HASH_CBLOCK;
- HASH_BLOCK_DATA_ORDER (c, p, 1);
- c->num = 0;
- memset (p, 0, HASH_CBLOCK);
-
-#ifndef HASH_MAKE_STRING
-#error "HASH_MAKE_STRING must be defined!"
-#else
- HASH_MAKE_STRING(c, md);
-#endif
-
- return 1;
-}
-#endif
-
-#ifndef MD32_REG_T
-#if defined(__alpha) || defined(__sparcv9) || defined(__mips)
-#define MD32_REG_T long
-/*
- * This comment was originaly written for MD5, which is why it
- * discusses A-D. But it basically applies to all 32-bit digests,
- * which is why it was moved to common header file.
- *
- * In case you wonder why A-D are declared as long and not
- * as MD5_LONG. Doing so results in slight performance
- * boost on LP64 architectures. The catch is we don't
- * really care if 32 MSBs of a 64-bit register get polluted
- * with eventual overflows as we *save* only 32 LSBs in
- * *either* case. Now declaring 'em long excuses the compiler
- * from keeping 32 MSBs zeroed resulting in 13% performance
- * improvement under SPARC Solaris7/64 and 5% under AlphaLinux.
- * Well, to be honest it should say that this *prevents*
- * performance degradation.
- * <appro@fy.chalmers.se>
- */
-#else
-/*
- * Above is not absolute and there are LP64 compilers that
- * generate better code if MD32_REG_T is defined int. The above
- * pre-processor condition reflects the circumstances under which
- * the conclusion was made and is subject to further extension.
- * <appro@fy.chalmers.se>
- */
-#define MD32_REG_T int
-#endif
-#endif
diff --git a/ecp/src/ecp/crypto/include/poly1305.h b/ecp/src/ecp/crypto/include/poly1305.h
deleted file mode 100644
index d7af3df..0000000
--- a/ecp/src/ecp/crypto/include/poly1305.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* $OpenBSD: poly1305.h,v 1.3 2014/07/25 14:04:51 jsing Exp $ */
-/*
- * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef HEADER_POLY1305_H
-#define HEADER_POLY1305_H
-
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct poly1305_context {
- size_t aligner;
- unsigned char opaque[136];
-} poly1305_context;
-
-typedef struct poly1305_context poly1305_state;
-
-void CRYPTO_poly1305_init(poly1305_context *ctx, const unsigned char key[32]);
-void CRYPTO_poly1305_update(poly1305_context *ctx, const unsigned char *in,
- size_t len);
-void CRYPTO_poly1305_finish(poly1305_context *ctx, unsigned char mac[16]);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* HEADER_POLY1305_H */
diff --git a/ecp/src/ecp/crypto/include/sha.h b/ecp/src/ecp/crypto/include/sha.h
deleted file mode 100644
index 93af5d9..0000000
--- a/ecp/src/ecp/crypto/include/sha.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/* $OpenBSD: sha.h,v 1.21 2015/09/13 21:09:56 doug Exp $ */
-/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay@cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- *
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attribution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay@cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the library
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from
- * the apps directory (application code) you must include an acknowledgement:
- * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- *
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * The licence and distribution terms for any publically available version or
- * derivative of this code cannot be changed. i.e. this code cannot simply be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stddef.h>
-
-#ifndef HEADER_SHA_H
-#define HEADER_SHA_H
-#if !defined(HAVE_ATTRIBUTE__BOUNDED__) && !defined(__OpenBSD__)
-#define __bounded__(x, y, z)
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- * ! SHA_LONG has to be at least 32 bits wide. !
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- */
-
-#define SHA_LONG unsigned int
-
-#define SHA_LBLOCK 16
-#define SHA_CBLOCK (SHA_LBLOCK*4) /* SHA treats input data as a
- * contiguous array of 32 bit
- * wide big-endian values. */
-#define SHA_LAST_BLOCK (SHA_CBLOCK-8)
-#define SHA_DIGEST_LENGTH 20
-
-typedef struct SHAstate_st
- {
- SHA_LONG h0,h1,h2,h3,h4;
- SHA_LONG Nl,Nh;
- SHA_LONG data[SHA_LBLOCK];
- unsigned int num;
- } SHA_CTX;
-
-#ifndef OPENSSL_NO_SHA1
-int SHA1_Init(SHA_CTX *c);
-int SHA1_Update(SHA_CTX *c, const void *data, size_t len)
- __attribute__ ((__bounded__(__buffer__,2,3)));
-int SHA1_Final(unsigned char *md, SHA_CTX *c);
-unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md)
- __attribute__ ((__bounded__(__buffer__,1,2)));
-void SHA1_Transform(SHA_CTX *c, const unsigned char *data);
-#endif
-
-#define SHA256_CBLOCK (SHA_LBLOCK*4) /* SHA-256 treats input data as a
- * contiguous array of 32 bit
- * wide big-endian values. */
-#define SHA224_DIGEST_LENGTH 28
-#define SHA256_DIGEST_LENGTH 32
-
-typedef struct SHA256state_st
- {
- SHA_LONG h[8];
- SHA_LONG Nl,Nh;
- SHA_LONG data[SHA_LBLOCK];
- unsigned int num,md_len;
- } SHA256_CTX;
-
-#ifndef OPENSSL_NO_SHA256
-int SHA224_Init(SHA256_CTX *c);
-int SHA224_Update(SHA256_CTX *c, const void *data, size_t len)
- __attribute__ ((__bounded__(__buffer__,2,3)));
-int SHA224_Final(unsigned char *md, SHA256_CTX *c);
-unsigned char *SHA224(const unsigned char *d, size_t n,unsigned char *md)
- __attribute__ ((__bounded__(__buffer__,1,2)));
-int SHA256_Init(SHA256_CTX *c);
-int SHA256_Update(SHA256_CTX *c, const void *data, size_t len)
- __attribute__ ((__bounded__(__buffer__,2,3)));
-int SHA256_Final(unsigned char *md, SHA256_CTX *c);
-unsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md)
- __attribute__ ((__bounded__(__buffer__,1,2)));
-void SHA256_Transform(SHA256_CTX *c, const unsigned char *data);
-#endif
-
-#define SHA384_DIGEST_LENGTH 48
-#define SHA512_DIGEST_LENGTH 64
-
-#ifndef OPENSSL_NO_SHA512
-/*
- * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64
- * being exactly 64-bit wide. See Implementation Notes in sha512.c
- * for further details.
- */
-#define SHA512_CBLOCK (SHA_LBLOCK*8) /* SHA-512 treats input data as a
- * contiguous array of 64 bit
- * wide big-endian values. */
-#if defined(_LP64)
-#define SHA_LONG64 unsigned long
-#define U64(C) C##UL
-#else
-#define SHA_LONG64 unsigned long long
-#define U64(C) C##ULL
-#endif
-
-typedef struct SHA512state_st
- {
- SHA_LONG64 h[8];
- SHA_LONG64 Nl,Nh;
- union {
- SHA_LONG64 d[SHA_LBLOCK];
- unsigned char p[SHA512_CBLOCK];
- } u;
- unsigned int num,md_len;
- } SHA512_CTX;
-#endif
-
-#ifndef OPENSSL_NO_SHA512
-int SHA384_Init(SHA512_CTX *c);
-int SHA384_Update(SHA512_CTX *c, const void *data, size_t len)
- __attribute__ ((__bounded__(__buffer__,2,3)));
-int SHA384_Final(unsigned char *md, SHA512_CTX *c);
-unsigned char *SHA384(const unsigned char *d, size_t n,unsigned char *md)
- __attribute__ ((__bounded__(__buffer__,1,2)));
-int SHA512_Init(SHA512_CTX *c);
-int SHA512_Update(SHA512_CTX *c, const void *data, size_t len)
- __attribute__ ((__bounded__(__buffer__,2,3)));
-int SHA512_Final(unsigned char *md, SHA512_CTX *c);
-unsigned char *SHA512(const unsigned char *d, size_t n,unsigned char *md)
- __attribute__ ((__bounded__(__buffer__,1,2)));
-void SHA512_Transform(SHA512_CTX *c, const unsigned char *data);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/ecp/src/ecp/dir/dir.c b/ecp/src/ecp/dir/dir.c
index 7c4b0d6..72097c7 100644
--- a/ecp/src/ecp/dir/dir.c
+++ b/ecp/src/ecp/dir/dir.c
@@ -168,8 +168,6 @@ ssize_t ecp_dir_handle_msg(ECPConnection *conn, ecp_seq_t seq, unsigned char mty
}
}
-// iterator for client
-
static ssize_t _dir_send_req(ECPConnection *conn, ECPTimerItem *ti) {
ECPBuffer packet;
ECPBuffer payload;
diff --git a/ecp/src/ecp/ext.h b/ecp/src/ecp/ext.h
index 995cf15..4c91000 100644
--- a/ecp/src/ecp/ext.h
+++ b/ecp/src/ecp/ext.h
@@ -20,4 +20,4 @@ ssize_t ecp_ext_msg_send(ECPConnection *conn, unsigned char mtype, unsigned char
#define ecp_ext_pld_send(c,p1,sz1,p2,sz2,f,t,a) (0)
#define ecp_ext_msg_send(c,t,m,sz,p1,p2) (0)
-#endif \ No newline at end of file
+#endif
diff --git a/ecp/src/ecp/ext/msgq.c b/ecp/src/ecp/ext/msgq.c
index 63f5aa6..e383b03 100644
--- a/ecp/src/ecp/ext/msgq.c
+++ b/ecp/src/ecp/ext/msgq.c
@@ -117,8 +117,6 @@ ssize_t ecp_msgq_pop(ECPRBConn *conn, unsigned char mtype, unsigned char *msg, s
msg_size = pld_size - hdr_size;
rbuf->arr.pld[idx].flags &= ~ECP_RBUF_FLAG_IN_MSGQ;
- // if (rbuf->arr.pld[idx].flags == 0);
-
msgq->idx_r[mtype]++;
if (msgq->seq_start == seq) {
int i;
diff --git a/ecp/src/ecp/ext/rbuf_recv.c b/ecp/src/ecp/ext/rbuf_recv.c
index 4c95be6..81327d5 100644
--- a/ecp/src/ecp/ext/rbuf_recv.c
+++ b/ecp/src/ecp/ext/rbuf_recv.c
@@ -122,7 +122,6 @@ static void msg_flush(ECPRBConn *conn) {
rbuf->arr.pld[idx].flags &= ~ECP_RBUF_FLAG_SKIP;
}
rbuf->arr.pld[idx].flags &= ~ECP_RBUF_FLAG_IN_RBUF;
- // if (rbuf->arr.pld[idx].flags == 0);
} else {
if (buf->flags & ECP_RBUF_FLAG_RELIABLE) break;
if (!ECP_SEQ_LT(seq, rbuf->seq_max - buf->hole_max)) break;
diff --git a/ecp/src/ecp/ext/rbuf_send.c b/ecp/src/ecp/ext/rbuf_send.c
index 3dc777c..d3d2f04 100644
--- a/ecp/src/ecp/ext/rbuf_send.c
+++ b/ecp/src/ecp/ext/rbuf_send.c
@@ -43,7 +43,6 @@ static void cc_flush(ECPRBConn *conn, unsigned char flags) {
}
if (!(buf->flags & ECP_RBUF_FLAG_RELIABLE)) {
rbuf->arr.pkt[idx].flags = 0;
- // if (rbuf->arr.pkt[idx].flags == 0);
}
buf->seq_cc++;
idx = ECP_RBUF_IDX_MASK(idx + 1, rbuf->arr_size);
@@ -210,7 +209,6 @@ ssize_t ecp_rbuf_handle_ack(ECPRBConn *conn, unsigned char *msg, size_t msg_size
idx = rbuf->idx_start;
for (i=0; i<msg_cnt; i++) {
rbuf->arr.pkt[idx].flags = 0;
- // if (rbuf->arr.pkt[idx].flags == 0);
idx = ECP_RBUF_IDX_MASK(idx + 1, rbuf->arr_size);
}
rbuf->seq_start = seq_start;
diff --git a/ecp/src/ecp/vconn/vconn.c b/ecp/src/ecp/vconn/vconn.c
index 23e0466..3d4dd29 100644
--- a/ecp/src/ecp/vconn/vconn.c
+++ b/ecp/src/ecp/vconn/vconn.c
@@ -2,6 +2,7 @@
#include <string.h>
#include <core.h>
+#include <tr.h>
#ifdef ECP_WITH_HTABLE
#include <ht.h>
@@ -65,7 +66,7 @@ static int insert_key_next(ECPConnection *conn, unsigned char c_idx, ecp_ecdh_pu
return rv;
}
-static ssize_t handle_next(ECPConnection *conn, unsigned char *msg, size_t msg_size, ECP2Buffer *b) {
+static ssize_t handle_next(ECPConnection *conn, unsigned char *msg, size_t msg_size, ECP2Buffer *bufs) {
ECPSocket *sock = conn->sock;
if (msg_size < ECP_SIZE_ECDH_PUB) return ECP_ERR_SIZE;
@@ -82,17 +83,16 @@ static ssize_t handle_next(ECPConnection *conn, unsigned char *msg, size_t msg_s
pthread_mutex_unlock(&sock->conn_table.mutex);
#endif
- if (conn->next == NULL) return ECP_ERR;
+ if (conn->next == NULL) return ECP_ERR_NEXT;
return ECP_SIZE_ECDH_PUB;
}
-static ssize_t handle_relay(ECPConnection *conn, unsigned char *msg, size_t msg_size, ECP2Buffer *b) {
+static ssize_t handle_relay(ECPConnection *conn, unsigned char *msg, size_t msg_size, ECP2Buffer *bufs) {
ECPSocket *sock = conn->sock;
ECPConnection *conn_next;
ECPBuffer payload;
unsigned char idx, _idx;
- unsigned char s_idx, c_idx;
size_t _msg_size = msg_size;
ssize_t rv;
int _rv;
@@ -147,13 +147,13 @@ static ssize_t handle_relay(ECPConnection *conn, unsigned char *msg, size_t msg_
}
- if (conn_next == NULL) return ECP_ERR;
+ if (conn_next == NULL) return ECP_ERR_NEXT;
payload.buffer = msg - ECP_SIZE_MTYPE;
- payload.size = b->payload->size - (payload.buffer - b->payload->buffer);
+ payload.size = bufs->payload->size - (payload.buffer - bufs->payload->buffer);
ecp_pld_set_type(payload.buffer, payload.size, ECP_MTYPE_EXEC);
- rv = ecp_pld_send(conn_next, b->packet, &payload, ECP_SIZE_MTYPE + _msg_size, ECP_SEND_FLAG_REPLY);
+ rv = ecp_pld_send(conn_next, bufs->packet, &payload, ECP_SIZE_MTYPE + _msg_size, ECP_SEND_FLAG_REPLY);
if (conn->type == ECP_CTYPE_VLINK) {
ecp_conn_refcount_dec(conn_next);
@@ -165,16 +165,16 @@ static ssize_t handle_relay(ECPConnection *conn, unsigned char *msg, size_t msg_
#endif /* ECP_WITH_HTABLE */
-static ssize_t handle_exec(ECPConnection *conn, unsigned char *msg, size_t msg_size, ECP2Buffer *b) {
+static ssize_t handle_exec(ECPConnection *conn, unsigned char *msg, size_t msg_size, ECP2Buffer *bufs) {
ECPBuffer *packet;
- if (b == NULL) return ECP_ERR;
+ if (bufs == NULL) return ECP_ERR;
- packet = b->packet;
+ packet = bufs->packet;
if (packet->size < msg_size) return ECP_ERR_SIZE;
memcpy(packet->buffer, msg, msg_size);
- return ecp_pkt_handle(conn->sock, conn, NULL, b, msg_size);
+ return ecp_pkt_handle(conn->sock, conn, NULL, bufs, msg_size);
}
ssize_t ecp_vconn_pack_parent(ECPConnection *conn, ECPBuffer *payload, ECPBuffer *packet, size_t pkt_size, ecp_tr_addr_t *addr) {
@@ -305,10 +305,11 @@ int ecp_vconn_open(ECPConnection *conn, ECPNode *node) {
return rv;
}
-static int vconn_handle_open(ECPConnection *conn) {
+static int vconn_handle_open(ECPConnection *conn, ECP2Buffer *bufs) {
int rv = ECP_OK;
if (ecp_conn_is_outb(conn) && conn->next) {
+ ecp_tr_release(bufs->packet, 1);
rv = ecp_conn_open(conn->next, NULL);
if (rv) ecp_err_handle(conn->next, ECP_MTYPE_INIT_REQ, rv);
}
@@ -394,12 +395,12 @@ static int vlink_handle_open(ECPConnection *conn) {
#endif /* ECP_WITH_HTABLE */
-int ecp_vconn_handle_open(ECPConnection *conn, ECP2Buffer *b) {
+int ecp_vconn_handle_open(ECPConnection *conn, ECP2Buffer *bufs) {
int rv;
switch (conn->type) {
case ECP_CTYPE_VCONN:
- rv = vconn_handle_open(conn);
+ rv = vconn_handle_open(conn, bufs);
break;
case ECP_CTYPE_VLINK:
@@ -432,22 +433,22 @@ void ecp_vconn_handle_close(ECPConnection *conn) {
}
}
-ssize_t ecp_vconn_handle_msg(ECPConnection *conn, ecp_seq_t seq, unsigned char mtype, unsigned char *msg, size_t msg_size, ECP2Buffer *b) {
+ssize_t ecp_vconn_handle_msg(ECPConnection *conn, ecp_seq_t seq, unsigned char mtype, unsigned char *msg, size_t msg_size, ECP2Buffer *bufs) {
ssize_t rv;
switch (mtype) {
#ifdef ECP_WITH_HTABLE
case ECP_MTYPE_NEXT:
- rv = handle_next(conn, msg, msg_size, b);
+ rv = handle_next(conn, msg, msg_size, bufs);
break;
case ECP_MTYPE_RELAY:
- rv = handle_relay(conn, msg, msg_size, b);
+ rv = handle_relay(conn, msg, msg_size, bufs);
break;
#endif
case ECP_MTYPE_EXEC:
- rv = handle_exec(conn, msg, msg_size, b);
+ rv = handle_exec(conn, msg, msg_size, bufs);
break;
default:
@@ -471,7 +472,7 @@ ssize_t ecp_vconn_send_open_req(ECPConnection *conn, unsigned char *cookie) {
ssize_t rv;
int _rv;
- if (conn->next == NULL) return ECP_ERR;
+ if (conn->next == NULL) return ECP_ERR_NEXT;
_rv = ecp_conn_dhkey_get_remote(conn->next, ECP_ECDH_IDX_PERMA, &key_next);
if (_rv) return _rv;
diff --git a/ecp/src/ecp/vconn/vconn.h b/ecp/src/ecp/vconn/vconn.h
index 9e2749f..8871ded 100644
--- a/ecp/src/ecp/vconn/vconn.h
+++ b/ecp/src/ecp/vconn/vconn.h
@@ -27,7 +27,7 @@ int ecp_vlink_create_inb(ECPConnection *conn, ECPSocket *sock);
void ecp_vlink_destroy(ECPConnection *conn);
#endif
-int ecp_vconn_handle_open(ECPConnection *conn, ECP2Buffer *b);
+int ecp_vconn_handle_open(ECPConnection *conn, ECP2Buffer *bufs);
void ecp_vconn_handle_close(ECPConnection *conn);
-ssize_t ecp_vconn_handle_msg(ECPConnection *conn, ecp_seq_t seq, unsigned char mtype, unsigned char *msg, size_t msg_size, ECP2Buffer *b);
+ssize_t ecp_vconn_handle_msg(ECPConnection *conn, ecp_seq_t seq, unsigned char mtype, unsigned char *msg, size_t msg_size, ECP2Buffer *bufs);
ssize_t ecp_vconn_send_open_req(ECPConnection *conn, unsigned char *cookie);
diff --git a/ecp/test/Makefile b/ecp/test/Makefile
index abda4e2..50a4202 100644
--- a/ecp/test/Makefile
+++ b/ecp/test/Makefile
@@ -7,51 +7,25 @@ dep=../build-posix/*.a ../util/libecputil.a
%.o: %.c
$(CC) $(CFLAGS) -c $<
-all: basic client server vcs vc_server vc_client # dir echo frag stress vc_client_t
+all: basic client server vcs vc_server vc_client
basic: basic.o init.o $(dep)
$(CC) -o $@ $< init.o $(dep) $(LDFLAGS)
-vcs: vcs.o init_vconn.o $(dep)
- $(CC) -o $@ $< init_vconn.o $(dep) $(LDFLAGS)
-
-vc_server: vc_server.o init_vconn.o $(dep)
- $(CC) -o $@ $< init_vconn.o $(dep) $(LDFLAGS)
-
-vc_server2: vc_server2.o init_vconn.o $(dep)
- $(CC) -o $@ $< init_vconn.o $(dep) $(LDFLAGS)
-
-vc_client: vc_client.o init_vconn.o $(dep)
- $(CC) -o $@ $< init_vconn.o $(dep) $(LDFLAGS)
-
-dir: dir.o init.o $(dep)
- $(CC) -DWITH_DIR_SERVER -o $@ $< init.o $(dep) $(LDFLAGS)
-
client: client.o init.o $(dep)
$(CC) -o $@ $< init.o $(dep) $(LDFLAGS)
server: server.o init.o $(dep)
$(CC) -o $@ $< init.o $(dep) $(LDFLAGS)
-echo: echo.o init.o $(dep)
- $(CC) -o $@ $< init.o $(dep) $(LDFLAGS)
-
-frag: frag.o init.o $(dep)
- $(CC) -o $@ $< init.o $(dep) $(LDFLAGS)
-
-stress: stress.o init.o $(dep)
- $(CC) -o $@ $< init.o $(dep) $(LDFLAGS)
-
-vc_client_t: vc_client_t.o init_vconn.o $(dep)
+vcs: vcs.o init_vconn.o $(dep)
$(CC) -o $@ $< init_vconn.o $(dep) $(LDFLAGS)
+vc_server: vc_server.o init_vconn.o $(dep)
+ $(CC) -o $@ $< init_vconn.o $(dep) $(LDFLAGS)
-opus_root=/opt/my/opus-1.1.5
-voip.o: voip.c
- $(CC) $(CFLAGS) -I $(opus_root)/include -c $<
-
-voip: voip.o init.o $(dep)
- $(CC) -o $@ $< init.o $(dep) $(opus_root)/.libs/libopus.a -lm $(LDFLAGS) -l asound
+vc_client: vc_client.o init_vconn.o $(dep)
+ $(CC) -o $@ $< init_vconn.o $(dep) $(LDFLAGS)
clean:
rm -f *.o