diff options
author | Uros Majstorovic <majstor@majstor.org> | 2018-01-11 18:03:01 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2018-01-11 18:03:01 +0100 |
commit | dea99b85dc52341265ae2e8463afee8a9709127a (patch) | |
tree | 4d4c52d046e76374314d5c88137e406a3d238ec2 | |
parent | eb8c9fe176721d5e8dd24febec88e1665ca70c26 (diff) |
fe310 platform introdiced
-rwxr-xr-x | code/build.sh | 2 | ||||
-rw-r--r-- | code/config_posix.h (renamed from code/core/config.h) | 0 | ||||
-rw-r--r-- | code/core/Makefile | 9 | ||||
-rw-r--r-- | code/core/core.c | 3 | ||||
-rw-r--r-- | code/core/core.h | 4 | ||||
-rw-r--r-- | code/core/crypto/Makefile | 4 | ||||
-rw-r--r-- | code/core/crypto/chacha/Makefile | 3 | ||||
-rw-r--r-- | code/core/crypto/compat/Makefile | 3 | ||||
-rw-r--r-- | code/core/crypto/curve25519/Makefile | 3 | ||||
-rw-r--r-- | code/core/crypto/include/chacha.h | 2 | ||||
-rw-r--r-- | code/core/crypto/poly1305/Makefile | 3 | ||||
-rw-r--r-- | code/core/crypto/sha/Makefile | 3 | ||||
-rw-r--r-- | code/core/crypto/test/Makefile | 4 | ||||
-rw-r--r-- | code/core/htable/Makefile | 3 | ||||
-rw-r--r-- | code/core/posix/Makefile | 3 | ||||
-rw-r--r-- | code/core/vconn/Makefile (renamed from code/vconn/Makefile) | 3 | ||||
-rw-r--r-- | code/core/vconn/vconn.c (renamed from code/vconn/vconn.c) | 0 | ||||
-rw-r--r-- | code/core/vconn/vconn.h (renamed from code/vconn/vconn.h) | 0 | ||||
-rw-r--r-- | code/test/Makefile | 7 | ||||
-rw-r--r-- | code/test/init_vconn.c | 2 | ||||
-rw-r--r-- | code/test/vc_client.c | 2 | ||||
-rw-r--r-- | code/test/vc_server.c | 2 | ||||
-rw-r--r-- | code/test/vcs.c | 2 | ||||
-rw-r--r-- | code/util/Makefile | 5 |
24 files changed, 43 insertions, 29 deletions
diff --git a/code/build.sh b/code/build.sh index ce29ff5..a71b792 100755 --- a/code/build.sh +++ b/code/build.sh @@ -1,6 +1,6 @@ #!/bin/sh -subdirs="core vconn util test" +subdirs="core util test" for i in $subdirs; do (cd $i && make $1 && cd ..) || exit; diff --git a/code/core/config.h b/code/config_posix.h index ad67d8a..ad67d8a 100644 --- a/code/core/config.h +++ b/code/config_posix.h diff --git a/code/core/Makefile b/code/core/Makefile index ed0f760..88d8c84 100644 --- a/code/core/Makefile +++ b/code/core/Makefile @@ -1,9 +1,8 @@ -MAKE=make -CFLAGS = -I. -pthread -O3 $(PIC) - -obj = core.o timer.o rbuf.o rbuf_send.o rbuf_recv.o msgq.o -subdirs = crypto posix htable +include ../Makefile.platform +CFLAGS=$(CFLAGS_PL) $(PIC) -I. +obj = core.o timer.o $(obj_rbuf) +subdirs = crypto $(vconn) $(htable) $(platform) %.o: %.c $(CC) $(CFLAGS) -c $< diff --git a/code/core/core.c b/code/core/core.c index 6eecce2..f81bbc6 100644 --- a/code/core/core.c +++ b/code/core/core.c @@ -590,7 +590,7 @@ int ecp_conn_close(ECPConnection *conn, ecp_cts_t timeout) { refcount = conn->refcount; pthread_mutex_unlock(&conn->mutex); - if (timeout && refcount) { + if (timeout && refcount && sock->ctx->tm.sleep_ms) { sock->ctx->tm.sleep_ms(timeout); pthread_mutex_lock(&conn->mutex); refcount = conn->refcount; @@ -1695,6 +1695,7 @@ int ecp_receiver(ECPSocket *sock) { ecp_cts_t next = 0; if (sock->ctx->tr.recv == NULL) return ECP_ERR; + sock->running = 1; while(sock->running) { ssize_t rv = sock->ctx->tr.recv(&sock->sock, pkt_buf, ECP_MAX_PKT, &addr, next ? next : sock->poll_timeout); diff --git a/code/core/core.h b/code/core/core.h index 7029bd7..3f8fd38 100644 --- a/code/core/core.h +++ b/code/core/core.h @@ -94,7 +94,7 @@ struct ECPConnection; struct ECPSeqItem; struct ECPFragIter; -typedef long ssize_t; +// typedef long ssize_t; typedef uint32_t ecp_ack_t; #define ECP_SIZE_ACKB (sizeof(ecp_ack_t)*8) @@ -130,6 +130,8 @@ typedef uint32_t ecp_seq_t; #define ECP_SIZE_PLD_RAW_BUF(X,T,P) (ECP_SIZE_PLD(X,T)+((P) ? ((P)->pcount+1)*(ECP_SIZE_PKT_HDR+ECP_SIZE_MSG_BUF(T,P)+ECP_AEAD_SIZE_TAG) : 0)) #define ECP_SIZE_PKT_RAW_BUF(X,T,P) (ECP_SIZE_PLD_RAW_BUF(X,T,P)+ECP_SIZE_PKT_HDR+ECP_AEAD_SIZE_TAG) +#include <sys/types.h> + #ifdef ECP_WITH_PTHREAD #include <pthread.h> #endif diff --git a/code/core/crypto/Makefile b/code/core/crypto/Makefile index 2fabea2..a7145c7 100644 --- a/code/core/crypto/Makefile +++ b/code/core/crypto/Makefile @@ -1,5 +1,5 @@ -MAKE=make -CFLAGS=-Iinclude -I.. -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= -O3 $(PIC) +include ../../Makefile.platform +CFLAGS=$(CFLAGS_PL) $(PIC) -Iinclude -I.. -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= obj = e_chacha20poly1305.o crypto.o obj_dep = compat/explicit_bzero.o compat/timingsafe_memcmp.o compat/timingsafe_bcmp.o \ diff --git a/code/core/crypto/chacha/Makefile b/code/core/crypto/chacha/Makefile index 071a1b1..8a977ae 100644 --- a/code/core/crypto/chacha/Makefile +++ b/code/core/crypto/chacha/Makefile @@ -1,4 +1,5 @@ -CFLAGS=-I../include -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= -O3 $(PIC) +include ../../../Makefile.platform +CFLAGS=$(CFLAGS_PL) $(PIC) -I../include -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= obj = chacha.o diff --git a/code/core/crypto/compat/Makefile b/code/core/crypto/compat/Makefile index a0dec2d..1afe391 100644 --- a/code/core/crypto/compat/Makefile +++ b/code/core/crypto/compat/Makefile @@ -1,4 +1,5 @@ -CFLAGS=-I../include -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= -O3 $(PIC) +include ../../../Makefile.platform +CFLAGS=$(CFLAGS_PL) $(PIC) -I../include -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= getentropy = getentropy_osx obj = explicit_bzero.o timingsafe_memcmp.o timingsafe_bcmp.o # arc4random.o arc4random_uniform.o $(getentropy).o diff --git a/code/core/crypto/curve25519/Makefile b/code/core/crypto/curve25519/Makefile index 1a96045..c3f94f0 100644 --- a/code/core/crypto/curve25519/Makefile +++ b/code/core/crypto/curve25519/Makefile @@ -1,4 +1,5 @@ -CFLAGS=-I../include -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= -DED25519 -O3 $(PIC) +include ../../../Makefile.platform +CFLAGS=$(CFLAGS_PL) $(PIC) -I../include -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= -DED25519 obj = curve25519.o curve25519-generic.o diff --git a/code/core/crypto/include/chacha.h b/code/core/crypto/include/chacha.h index 11885b7..25a3ef3 100644 --- a/code/core/crypto/include/chacha.h +++ b/code/core/crypto/include/chacha.h @@ -32,7 +32,7 @@ typedef struct { } ChaCha_ctx; void ChaCha_set_key(ChaCha_ctx *ctx, const unsigned char *key, - unsigned int keybits); + 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, diff --git a/code/core/crypto/poly1305/Makefile b/code/core/crypto/poly1305/Makefile index e780491..6bc384f 100644 --- a/code/core/crypto/poly1305/Makefile +++ b/code/core/crypto/poly1305/Makefile @@ -1,4 +1,5 @@ -CFLAGS=-I../include -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= -O3 $(PIC) +include ../../../Makefile.platform +CFLAGS=$(CFLAGS_PL) $(PIC) -I../include -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= obj = poly1305.o diff --git a/code/core/crypto/sha/Makefile b/code/core/crypto/sha/Makefile index f078644..1eb727f 100644 --- a/code/core/crypto/sha/Makefile +++ b/code/core/crypto/sha/Makefile @@ -1,4 +1,5 @@ -CFLAGS=-I../include -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= -O3 $(PIC) +include ../../../Makefile.platform +CFLAGS=$(CFLAGS_PL) $(PIC) -I../include -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= obj = sha1dgst.o sha1_one.o sha256.o sha512.o diff --git a/code/core/crypto/test/Makefile b/code/core/crypto/test/Makefile index f274209..2a5fa3e 100644 --- a/code/core/crypto/test/Makefile +++ b/code/core/crypto/test/Makefile @@ -1,4 +1,6 @@ -CFLAGS=-I.. -I../include -O3 +include ../../../Makefile.platform +CFLAGS=$(CFLAGS_PL) -I.. -I../include +LDFLAGS=$(LDFLAGS_PL) aead_dep=../compat/explicit_bzero.o ../compat/timingsafe_memcmp.o ../compat/timingsafe_bcmp.o \ ../chacha/chacha.o ../poly1305/poly1305.o ../curve25519/curve25519.o ../curve25519/curve25519-generic.o \ diff --git a/code/core/htable/Makefile b/code/core/htable/Makefile index af8d7c1..eb73403 100644 --- a/code/core/htable/Makefile +++ b/code/core/htable/Makefile @@ -1,4 +1,5 @@ -CFLAGS=-I.. -std=gnu89 $(PIC) +include ../../Makefile.platform +CFLAGS=$(CFLAGS_PL) $(PIC) -I.. -std=gnu89 obj = htable.o hashtable.o hashtable_itr.o diff --git a/code/core/posix/Makefile b/code/core/posix/Makefile index 00c8048..6dd42e2 100644 --- a/code/core/posix/Makefile +++ b/code/core/posix/Makefile @@ -1,4 +1,5 @@ -CFLAGS=-I.. $(PIC) +include ../../Makefile.platform +CFLAGS=$(CFLAGS_PL) $(PIC) -I.. obj_tr = transport.o obj_tm = time.o diff --git a/code/vconn/Makefile b/code/core/vconn/Makefile index 0292b0d..613601c 100644 --- a/code/vconn/Makefile +++ b/code/core/vconn/Makefile @@ -1,4 +1,5 @@ -CFLAGS = -I../core -pthread -O3 $(PIC) +include ../../Makefile.platform +CFLAGS=$(CFLAGS_PL) $(PIC) -I.. obj = vconn.o diff --git a/code/vconn/vconn.c b/code/core/vconn/vconn.c index dadff0f..dadff0f 100644 --- a/code/vconn/vconn.c +++ b/code/core/vconn/vconn.c diff --git a/code/vconn/vconn.h b/code/core/vconn/vconn.h index 07832c7..07832c7 100644 --- a/code/vconn/vconn.h +++ b/code/core/vconn/vconn.h diff --git a/code/test/Makefile b/code/test/Makefile index ec9730f..26b89f6 100644 --- a/code/test/Makefile +++ b/code/test/Makefile @@ -1,7 +1,8 @@ -CFLAGS=-I../core -I../vconn -I../util -O3 -Wno-int-to-void-pointer-cast -LDFLAGS=-lm -pthread +include ../Makefile.platform +CFLAGS=$(CFLAGS_PL) -I../core -I../util -Wno-int-to-void-pointer-cast +LDFLAGS=$(LDFLAGS_PL) -dep=../core/libecpcore.a ../core/crypto/libecpcr.a ../core/htable/libecpht.a ../core/posix/libecptr.a ../core/posix/libecptm.a ../vconn/libecpvconn.a ../util/libecputil.a +dep=../core/libecpcore.a ../core/crypto/libecpcr.a ../core/htable/libecpht.a ../core/posix/libecptr.a ../core/posix/libecptm.a ../core/vconn/libecpvconn.a ../util/libecputil.a %.o: %.c $(CC) $(CFLAGS) -c $< diff --git a/code/test/init_vconn.c b/code/test/init_vconn.c index 2e82598..29c8db5 100644 --- a/code/test/init_vconn.c +++ b/code/test/init_vconn.c @@ -3,7 +3,7 @@ #include <unistd.h> #include "core.h" -#include "vconn.h" +#include "vconn/vconn.h" static int v_rng(void *buf, size_t bufsize) { int fd; diff --git a/code/test/vc_client.c b/code/test/vc_client.c index 9ea3d1b..e654e76 100644 --- a/code/test/vc_client.c +++ b/code/test/vc_client.c @@ -4,7 +4,7 @@ #include <stdlib.h> #include "core.h" -#include "vconn.h" +#include "vconn/vconn.h" #include "util.h" ECPContext ctx; diff --git a/code/test/vc_server.c b/code/test/vc_server.c index 8525ad4..04b8104 100644 --- a/code/test/vc_server.c +++ b/code/test/vc_server.c @@ -4,7 +4,7 @@ #include <stdlib.h> #include "core.h" -#include "vconn.h" +#include "vconn/vconn.h" #include "util.h" ECPContext ctx; diff --git a/code/test/vcs.c b/code/test/vcs.c index 1dbf67d..23e2557 100644 --- a/code/test/vcs.c +++ b/code/test/vcs.c @@ -5,7 +5,7 @@ #include "core.h" #include "util.h" -#include "vconn.h" +#include "vconn/vconn.h" ECPContext ctx; ECPSocket sock; diff --git a/code/util/Makefile b/code/util/Makefile index 0e76307..caa8226 100644 --- a/code/util/Makefile +++ b/code/util/Makefile @@ -1,5 +1,6 @@ -CFLAGS = -I../core -pthread -O3 $(PIC) -LDFLAGS=-lm -pthread +include ../Makefile.platform +CFLAGS=$(CFLAGS_PL) -I../core +LDFLAGS=$(LDFLAGS_PL) obj=util.o dep=../core/libecpcore.a ../core/crypto/libecpcr.a ../core/htable/libecpht.a ../core/posix/libecptr.a ../core/posix/libecptm.a ./libecputil.a |