summaryrefslogtreecommitdiff
path: root/ct_server.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-06-15 20:13:59 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-06-15 20:13:59 +0200
commitbc41b879d5f8d2286f094d85222d0d40b90ace00 (patch)
tree14ffcfade84b5ec410449ff27708c76c45c6ab4f /ct_server.c
parentc5f3b0db5b9274ab32fb203260ab15eecae64291 (diff)
curve: curve25519_tfm_alloc/curve25519_tfm_free helpers
Facilitate allocation and destruction of crypto objects through common helper functions. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Diffstat (limited to 'ct_server.c')
-rw-r--r--ct_server.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/ct_server.c b/ct_server.c
index eb53bd3..9737ffd 100644
--- a/ct_server.c
+++ b/ct_server.c
@@ -448,21 +448,19 @@ static void *worker(void *self)
int fd, old_state;
ssize_t ret;
size_t blen = TUNBUFF_SIZ; //FIXME
- const struct worker_struct *ws = self;
+ struct worker_struct *ws = self;
struct pollfd fds;
char *buff;
fds.fd = ws->efd[0];
fds.events = POLLIN;
- curve25519_alloc_or_maybe_die(ws->c);
-
+ ws->c = curve25519_tfm_alloc();
buff = xmalloc_aligned(blen, 64);
syslog(LOG_INFO, "curvetun thread on CPU%u up!\n", ws->cpu);
- pthread_cleanup_push(xfree_func, ws->c);
- pthread_cleanup_push(curve25519_free, ws->c);
+ pthread_cleanup_push(curve25519_tfm_free_void, ws->c);
pthread_cleanup_push(xfree_func, buff);
while (likely(!sigint)) {
@@ -490,7 +488,6 @@ static void *worker(void *self)
pthread_cleanup_pop(1);
pthread_cleanup_pop(1);
- pthread_cleanup_pop(1);
pthread_exit((void *) ((long) ws->cpu));
}