summaryrefslogtreecommitdiff
path: root/ecp/test
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2021-08-28 02:58:35 +0200
committerUros Majstorovic <majstor@majstor.org>2021-08-28 02:58:35 +0200
commitcdaa2560c0271585317450b57047a7f812d8366e (patch)
tree325f726cb1ab1fd81a20faa6b52d2679591946c4 /ecp/test
parent76ec318118106cb25d762de83857f6579c13e273 (diff)
code cleanup
Diffstat (limited to 'ecp/test')
-rw-r--r--ecp/test/init.c10
-rw-r--r--ecp/test/init_vconn.c13
2 files changed, 13 insertions, 10 deletions
diff --git a/ecp/test/init.c b/ecp/test/init.c
index 7e39f87..4dff693 100644
--- a/ecp/test/init.c
+++ b/ecp/test/init.c
@@ -6,7 +6,7 @@
static int v_rng(void *buf, size_t bufsize) {
int fd;
-
+
if((fd = open("/dev/urandom", O_RDONLY)) < 0) return -1;
size_t nb = read(fd, buf, bufsize);
close(fd);
@@ -24,13 +24,13 @@ static void conn_free(ECPConnection *conn) {
int ecp_init(ECPContext *ctx) {
int rv;
-
- rv = ecp_ctx_create(ctx);
+
+ rv = ecp_ctx_init(ctx);
if (rv) return rv;
-
+
ctx->rng = v_rng;
ctx->conn_alloc = conn_alloc;
ctx->conn_free = conn_free;
-
+
return ECP_OK;
} \ No newline at end of file
diff --git a/ecp/test/init_vconn.c b/ecp/test/init_vconn.c
index 7e3dd04..b79aa3d 100644
--- a/ecp/test/init_vconn.c
+++ b/ecp/test/init_vconn.c
@@ -7,7 +7,7 @@
static int v_rng(void *buf, size_t bufsize) {
int fd;
-
+
if((fd = open("/dev/urandom", O_RDONLY)) < 0) return -1;
size_t nb = read(fd, buf, bufsize);
close(fd);
@@ -30,13 +30,16 @@ static void conn_free(ECPConnection *conn) {
int ecp_init(ECPContext *ctx) {
int rv;
-
- rv = ecp_ctx_create_vconn(ctx);
+
+ rv = ecp_ctx_init(ctx);
+ if (rv) return rv;
+
+ rv = ecp_vconn_ctx_init(ctx);
if (rv) return rv;
-
+
ctx->rng = v_rng;
ctx->conn_alloc = conn_alloc;
ctx->conn_free = conn_free;
-
+
return ECP_OK;
} \ No newline at end of file