summaryrefslogtreecommitdiff
path: root/code/core
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2017-05-23 17:28:12 +0200
committerUros Majstorovic <majstor@majstor.org>2017-05-23 17:28:12 +0200
commitab0325ae7906230f1ea82f08b27c72b075e9a13d (patch)
tree5a292826fdea4db2c86b2d82b80fa489c6c131c7 /code/core
parent3ef6719f47b734b12c0b11c725b7f12e3fb3c08a (diff)
build fixed; added lib util
Diffstat (limited to 'code/core')
-rw-r--r--code/core/Makefile4
-rw-r--r--code/core/core.c10
-rw-r--r--code/core/core.h2
-rw-r--r--code/core/crypto/Makefile2
-rw-r--r--code/core/crypto/chacha/Makefile2
-rw-r--r--code/core/crypto/compat/Makefile2
-rw-r--r--code/core/crypto/curve25519/Makefile2
-rw-r--r--code/core/crypto/poly1305/Makefile2
-rw-r--r--code/core/crypto/sha/Makefile2
-rw-r--r--code/core/crypto/test/Makefile4
-rw-r--r--code/core/htable/Makefile2
-rw-r--r--code/core/posix/Makefile2
12 files changed, 30 insertions, 6 deletions
diff --git a/code/core/Makefile b/code/core/Makefile
index d3610bf..2cae048 100644
--- a/code/core/Makefile
+++ b/code/core/Makefile
@@ -1,8 +1,10 @@
MAKE=make
-CFLAGS = -I. -pthread -O3 -DECP_DEBUG
+CFLAGS = -I. -pthread -O3 $(PIC) -DECP_DEBUG
+
obj = core.o timer.o msgq.o
subdirs = crypto posix htable
+
%.o: %.c %.h
$(CC) $(CFLAGS) -c $<
diff --git a/code/core/core.c b/code/core/core.c
index ed083a0..93495d0 100644
--- a/code/core/core.c
+++ b/code/core/core.c
@@ -14,11 +14,15 @@ int ecp_dhkey_generate(ECPContext *ctx, ECPDHKey *key) {
return ECP_OK;
}
-int ecp_node_init(ECPContext *ctx, ECPNode *node, void *addr, ecp_dh_public_t *public) {
- int rv = ctx->tr.addr_set(&node->addr, addr);
+int ecp_node_init(ECPContext *ctx, ECPNode *node, ecp_dh_public_t *public, void *addr) {
+ int rv = ECP_OK;
+
+ memset(node, 0, sizeof(ECPNode));
+ memcpy(&node->public, public, sizeof(node->public));
+
+ if (addr) rv = ctx->tr.addr_set(&node->addr, addr);
if (rv) return ECP_ERR_NET_ADDR;
- memcpy(&node->public, public, sizeof(node->public));
return ECP_OK;
}
diff --git a/code/core/core.h b/code/core/core.h
index 33dd6d2..4c2b74c 100644
--- a/code/core/core.h
+++ b/code/core/core.h
@@ -263,7 +263,7 @@ int ecp_transport_init(ECPTransportIface *t);
int ecp_time_init(ECPTimeIface *t);
int ecp_dhkey_generate(ECPContext *ctx, ECPDHKey *key);
-int ecp_node_init(ECPContext *ctx, ECPNode *node, void *addr, ecp_dh_public_t *public);
+int ecp_node_init(ECPContext *ctx, ECPNode *node, ecp_dh_public_t *public, void *addr);
int ecp_ctx_create(ECPContext *ctx);
int ecp_ctx_destroy(ECPContext *ctx);
diff --git a/code/core/crypto/Makefile b/code/core/crypto/Makefile
index cfd3bf8..2fabea2 100644
--- a/code/core/crypto/Makefile
+++ b/code/core/crypto/Makefile
@@ -1,11 +1,13 @@
MAKE=make
CFLAGS=-Iinclude -I.. -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= -O3 $(PIC)
+
obj = e_chacha20poly1305.o crypto.o
obj_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 \
sha/sha256.o sha/sha512.o
subdirs = compat curve25519 chacha poly1305 sha
+
%.o: %.c
$(CC) $(CFLAGS) -c $<
diff --git a/code/core/crypto/chacha/Makefile b/code/core/crypto/chacha/Makefile
index dae3373..071a1b1 100644
--- a/code/core/crypto/chacha/Makefile
+++ b/code/core/crypto/chacha/Makefile
@@ -1,6 +1,8 @@
CFLAGS=-I../include -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= -O3 $(PIC)
+
obj = chacha.o
+
all: libchacha.a
dep: all
diff --git a/code/core/crypto/compat/Makefile b/code/core/crypto/compat/Makefile
index 2c0fa5c..a0dec2d 100644
--- a/code/core/crypto/compat/Makefile
+++ b/code/core/crypto/compat/Makefile
@@ -1,7 +1,9 @@
CFLAGS=-I../include -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= -O3 $(PIC)
+
getentropy = getentropy_osx
obj = explicit_bzero.o timingsafe_memcmp.o timingsafe_bcmp.o # arc4random.o arc4random_uniform.o $(getentropy).o
+
all: libcompat.a
dep: all
diff --git a/code/core/crypto/curve25519/Makefile b/code/core/crypto/curve25519/Makefile
index 470d31e..1a96045 100644
--- a/code/core/crypto/curve25519/Makefile
+++ b/code/core/crypto/curve25519/Makefile
@@ -1,6 +1,8 @@
CFLAGS=-I../include -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= -DED25519 -O3 $(PIC)
+
obj = curve25519.o curve25519-generic.o
+
all: libcurve25519.a
dep: all
diff --git a/code/core/crypto/poly1305/Makefile b/code/core/crypto/poly1305/Makefile
index 6ddec33..e780491 100644
--- a/code/core/crypto/poly1305/Makefile
+++ b/code/core/crypto/poly1305/Makefile
@@ -1,6 +1,8 @@
CFLAGS=-I../include -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= -O3 $(PIC)
+
obj = poly1305.o
+
all: libpoly1305.a
dep: all
diff --git a/code/core/crypto/sha/Makefile b/code/core/crypto/sha/Makefile
index 8a50b28..f078644 100644
--- a/code/core/crypto/sha/Makefile
+++ b/code/core/crypto/sha/Makefile
@@ -1,6 +1,8 @@
CFLAGS=-I../include -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= -O3 $(PIC)
+
obj = sha1dgst.o sha1_one.o sha256.o sha512.o
+
all: libsha.a
dep: all
diff --git a/code/core/crypto/test/Makefile b/code/core/crypto/test/Makefile
index b6a92f2..f274209 100644
--- a/code/core/crypto/test/Makefile
+++ b/code/core/crypto/test/Makefile
@@ -1,9 +1,11 @@
-CFLAGS=-I.. -I../include -O3
+CFLAGS=-I.. -I../include -O3
+
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 \
../sha/sha512.o ../e_chacha20poly1305.o
dsa_dep=../*/*.a
+
%.o: %.c
$(CC) $(CFLAGS) -c $<
diff --git a/code/core/htable/Makefile b/code/core/htable/Makefile
index af329b4..af8d7c1 100644
--- a/code/core/htable/Makefile
+++ b/code/core/htable/Makefile
@@ -1,6 +1,8 @@
CFLAGS=-I.. -std=gnu89 $(PIC)
+
obj = htable.o hashtable.o hashtable_itr.o
+
%.o: %.c
$(CC) $(CFLAGS) -c $<
diff --git a/code/core/posix/Makefile b/code/core/posix/Makefile
index 64cf5f6..00c8048 100644
--- a/code/core/posix/Makefile
+++ b/code/core/posix/Makefile
@@ -1,7 +1,9 @@
CFLAGS=-I.. $(PIC)
+
obj_tr = transport.o
obj_tm = time.o
+
%.o: %.c
$(CC) $(CFLAGS) -c $<