diff options
author | Uros Majstorovic <majstor@majstor.org> | 2020-08-05 03:38:22 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2020-08-05 03:38:22 +0200 |
commit | 5cd610a07468137066ea4daa5176c3e7045113b0 (patch) | |
tree | a6a5b572572f8f37ec2cb87332fa46e9bcc53aa7 /code/test/init_vconn.c | |
parent | 2473a7d5c51806ab8651cd3c4e07a15b62084eb5 (diff) |
ecp moved to root; fixed utils and tests
Diffstat (limited to 'code/test/init_vconn.c')
-rw-r--r-- | code/test/init_vconn.c | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/code/test/init_vconn.c b/code/test/init_vconn.c deleted file mode 100644 index 7e3dd04..0000000 --- a/code/test/init_vconn.c +++ /dev/null @@ -1,42 +0,0 @@ -#include <stdlib.h> -#include <fcntl.h> -#include <unistd.h> - -#include "core.h" -#include "vconn/vconn.h" - -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); - if (nb != bufsize) return -1; - return 0; -} - -static ECPConnection *conn_alloc(unsigned char type) { - switch (type) { - case ECP_CTYPE_VCONN: - return malloc(sizeof(ECPVConnIn)); - default: - return malloc(sizeof(ECPConnection)); - } -} - -static void conn_free(ECPConnection *conn) { - free(conn); -} - -int ecp_init(ECPContext *ctx) { - int rv; - - rv = ecp_ctx_create_vconn(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 |