From: Loup Vaillant Date: Sun, 24 Nov 2019 21:39:22 +0000 (+0100) Subject: Fixed XChacha20 bug (wrong key) X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=1130e115006eb7a4ec71140e1a429bc845a4d9cc;p=Monocypher.git Fixed XChacha20 bug (wrong key) --- 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,