From 1130e115006eb7a4ec71140e1a429bc845a4d9cc Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Sun, 24 Nov 2019 22:39:22 +0100 Subject: [PATCH] Fixed XChacha20 bug (wrong key) --- src/monocypher.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/monocypher.c b/src/monocypher.c index 6b2f50a..a1fc4a0 100644 --- a/src/monocypher.c +++ b/src/monocypher.c @@ -255,7 +255,9 @@ void crypto_xchacha20_ctr(u8 *cipher_text, const u8 *plain_text, { u8 sub_key[32]; crypto_hchacha20(sub_key, key, nonce); - crypto_chacha20_ctr(cipher_text, plain_text, text_size, key, nonce+16, ctr); + crypto_chacha20_ctr(cipher_text, plain_text, text_size, + sub_key, nonce+16, ctr); + WIPE_BUFFER(sub_key); } void crypto_chacha20(u8 *cipher_text, const u8 *plain_text, size_t text_size, -- 2.47.3