X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fchacha-poly1305%2Fchacha-poly1305.c;h=77d531add2ab6a291a52557bb9e85720c88d01dc;hb=ce4d55b72fd4290d4710f10e755f6dd9ed039d88;hp=a74c50242f646a28b9df663e9574d41af241f374;hpb=1c475ecb575367a6b3f9328b0f643ad636155341;p=tinc diff --git a/src/chacha-poly1305/chacha-poly1305.c b/src/chacha-poly1305/chacha-poly1305.c index a74c5024..77d531ad 100644 --- a/src/chacha-poly1305/chacha-poly1305.c +++ b/src/chacha-poly1305/chacha-poly1305.c @@ -1,6 +1,4 @@ #include "../system.h" - -#include "../cipher.h" #include "../xalloc.h" #include "chacha.h" @@ -12,16 +10,14 @@ struct chacha_poly1305_ctx { }; chacha_poly1305_ctx_t *chacha_poly1305_init(void) { - chacha_poly1305_ctx_t *ctx = xzalloc(sizeof(*ctx)); - return ctx; + return xzalloc(sizeof(chacha_poly1305_ctx_t)); } void chacha_poly1305_exit(chacha_poly1305_ctx_t *ctx) { - free(ctx); + xzfree(ctx, sizeof(chacha_poly1305_ctx_t)); } -bool chacha_poly1305_set_key(chacha_poly1305_ctx_t *ctx, const void *vkey) { - const uint8_t *key = vkey; +bool chacha_poly1305_set_key(chacha_poly1305_ctx_t *ctx, const uint8_t *key) { chacha_keysetup(&ctx->main_ctx, key, 256); chacha_keysetup(&ctx->header_ctx, key + 32, 256); return true;