summaryrefslogtreecommitdiffstats
path: root/src/protocols/ec25519_fhmqvc/state.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-08-02 00:53:47 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-08-02 00:53:47 +0200
commit546ac7936340312cf272969ff83317ae4d50d2b4 (patch)
tree7ecadca11430c8624d9f80aae7c348fa4d65b969 /src/protocols/ec25519_fhmqvc/state.c
parentb22364f4af3564f0dd9a5f4e150bb09747bd5c4e (diff)
downloadfastd-546ac7936340312cf272969ff83317ae4d50d2b4.tar
fastd-546ac7936340312cf272969ff83317ae4d50d2b4.zip
Introduce and use alloc helpers
These new helpers will terminate fastd on allocation failures and add some additional convenience (allow strdup with NULL; typesafe new(type) macros).
Diffstat (limited to 'src/protocols/ec25519_fhmqvc/state.c')
-rw-r--r--src/protocols/ec25519_fhmqvc/state.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/protocols/ec25519_fhmqvc/state.c b/src/protocols/ec25519_fhmqvc/state.c
index 451e31d..d4a2a0e 100644
--- a/src/protocols/ec25519_fhmqvc/state.c
+++ b/src/protocols/ec25519_fhmqvc/state.c
@@ -37,7 +37,7 @@
/** Allocates the protocol-specific state */
static void init_protocol_state(void) {
if (!ctx.protocol_state) {
- ctx.protocol_state = calloc(1, sizeof(fastd_protocol_state_t));
+ ctx.protocol_state = fastd_new0(fastd_protocol_state_t);
ctx.protocol_state->prev_handshake_key.preferred_till = ctx.now;
ctx.protocol_state->handshake_key.preferred_till = ctx.now;
@@ -84,7 +84,7 @@ void fastd_protocol_ec25519_fhmqvc_init_peer_state(fastd_peer_t *peer) {
if (peer->protocol_state)
exit_bug("tried to reinit peer state");
- peer->protocol_state = calloc(1, sizeof(fastd_protocol_peer_state_t));
+ peer->protocol_state = fastd_new0(fastd_protocol_peer_state_t);
peer->protocol_state->last_serial = ctx.protocol_state->handshake_key.serial;
}