summaryrefslogtreecommitdiff
path: root/code/util
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2018-03-15 21:37:11 +0100
committerUros Majstorovic <majstor@majstor.org>2018-03-15 21:37:11 +0100
commit8755ad4c0b0652f16d3505ed72ed3d8310a35c6f (patch)
tree6d7c3b93563bf64b811bb198e13ebbe7d7907e67 /code/util
parentb00f381106c941ea03e5ea04dc08e6c4b9e582fa (diff)
removed *IFace from context
Diffstat (limited to 'code/util')
-rw-r--r--code/util/util.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/code/util/util.c b/code/util/util.c
index af47079..4f4adc2 100644
--- a/code/util/util.c
+++ b/code/util/util.c
@@ -3,6 +3,7 @@
#include <unistd.h>
#include "core.h"
+#include "cr.h"
#include "util.h"
int ecp_util_key_save(ECPContext *ctx, ECPDHKey *key, char *filename) {
@@ -10,7 +11,7 @@ int ecp_util_key_save(ECPContext *ctx, ECPDHKey *key, char *filename) {
ssize_t rv;
if ((fd = open(filename, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR)) < 0) return ECP_ERR;
- rv = write(fd, ctx->cr.dh_pub_get_buf(&key->public), ECP_ECDH_SIZE_KEY);
+ rv = write(fd, ecp_cr_dh_pub_get_buf(&key->public), ECP_ECDH_SIZE_KEY);
if (rv != ECP_ECDH_SIZE_KEY) {
close(fd);
return ECP_ERR;
@@ -42,7 +43,7 @@ int ecp_util_key_load(ECPContext *ctx, ECPDHKey *key, char *filename) {
}
close(fd);
- ctx->cr.dh_pub_from_buf(&key->public, buf);
+ ecp_cr_dh_pub_from_buf(&key->public, buf);
key->valid = 1;
return ECP_OK;
@@ -53,7 +54,7 @@ int ecp_util_node_save(ECPContext *ctx, ECPNode *node, char *filename) {
ssize_t rv;
if ((fd = open(filename, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR)) < 0) return ECP_ERR;
- rv = write(fd, ctx->cr.dh_pub_get_buf(&node->public), ECP_ECDH_SIZE_KEY);
+ rv = write(fd, ecp_cr_dh_pub_get_buf(&node->public), ECP_ECDH_SIZE_KEY);
if (rv != ECP_ECDH_SIZE_KEY) {
close(fd);
return ECP_ERR;
@@ -85,7 +86,7 @@ int ecp_util_node_load(ECPContext *ctx, ECPNode *node, char *filename) {
}
close(fd);
- ctx->cr.dh_pub_from_buf(&node->public, buf);
+ ecp_cr_dh_pub_from_buf(&node->public, buf);
return ECP_OK;
} \ No newline at end of file