From cdaa2560c0271585317450b57047a7f812d8366e Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sat, 28 Aug 2021 02:58:35 +0200 Subject: code cleanup --- ecp/test/init_vconn.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'ecp/test/init_vconn.c') 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 -- cgit v1.2.3