diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-06-15 20:13:59 +0200 |
---|---|---|
committer | Daniel Borkmann <dborkman@redhat.com> | 2013-06-15 20:13:59 +0200 |
commit | bc41b879d5f8d2286f094d85222d0d40b90ace00 (patch) | |
tree | 14ffcfade84b5ec410449ff27708c76c45c6ab4f /ct_client.c | |
parent | c5f3b0db5b9274ab32fb203260ab15eecae64291 (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_client.c')
-rw-r--r-- | ct_client.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/ct_client.c b/ct_client.c index 1f4d10e..37b6090 100644 --- a/ct_client.c +++ b/ct_client.c @@ -315,10 +315,7 @@ retry: syslog(LOG_INFO, "curvetun client booting!\n"); } - c = xmalloc(sizeof(struct curve25519_struct)); - - curve25519_alloc_or_maybe_die(c); - + c = curve25519_tfm_alloc(); p = get_serv_store_entry_proto_inf(); if (!p) syslog_panic("Cannot proto!\n"); @@ -332,8 +329,7 @@ retry: ret = getaddrinfo(host, port, &hints, &ahead); if (ret < 0) { syslog(LOG_ERR, "Cannot get address info! Retry!\n"); - curve25519_free(c); - xfree(c); + curve25519_tfm_free(c); fd = -1; retry_server = 1; closed_by_server = 0; @@ -364,8 +360,7 @@ retry: if (fd < 0) { syslog(LOG_ERR, "Cannot create socket! Retry!\n"); - curve25519_free(c); - xfree(c); + curve25519_tfm_free(c); fd = -1; retry_server = 1; closed_by_server = 0; @@ -422,8 +417,7 @@ retry: xfree(buff); close(fd); - curve25519_free(c); - xfree(c); + curve25519_tfm_free(c); /* tundev still active */ if (closed_by_server && !sigint) { |