From 39b164a5bf715d1a62689203b059144df76d98e2 Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Tue, 23 Oct 2018 21:06:47 +0200 Subject: [PATCH] No intermediate buffer for HChacha20 That buffer wasn't really needed, so I optimised it away --- src/monocypher.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/monocypher.c b/src/monocypher.c index fd402d3..40bb999 100644 --- a/src/monocypher.c +++ b/src/monocypher.c @@ -1964,11 +1964,8 @@ int crypto_key_exchange(u8 shared_key[32], const u8 your_secret_key [32], const u8 their_public_key[32]) { - u8 raw_shared_secret[32]; - int status = crypto_x25519(raw_shared_secret, - your_secret_key, their_public_key); - crypto_chacha20_H(shared_key, raw_shared_secret, zero); - WIPE_BUFFER(raw_shared_secret); + int status = crypto_x25519(shared_key, your_secret_key, their_public_key); + crypto_chacha20_H(shared_key, shared_key, zero); return status; } -- 2.47.3