From fb1b8d37eb4d32cc76b4ad960f3cc43f76f802ef Mon Sep 17 00:00:00 2001 From: Konstantinos Margaritis Date: Fri, 17 Mar 2023 09:37:57 +0000 Subject: [PATCH] rewrite loop --- crypto/chacha20/src/xchacha20.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crypto/chacha20/src/xchacha20.c b/crypto/chacha20/src/xchacha20.c index a99d1f13..1144928e 100644 --- a/crypto/chacha20/src/xchacha20.c +++ b/crypto/chacha20/src/xchacha20.c @@ -120,7 +120,6 @@ void xchacha_keysetup(XChaCha_ctx *ctx, const uint8_t *k, uint8_t *iv){ */ xchacha_hchacha20_svp64(k2, iv, k); - ctx->input[0] = 0x61707865; ctx->input[1] = 0x3320646e; ctx->input[2] = 0x79622d32; @@ -228,8 +227,8 @@ void xchacha_encrypt_bytes(XChaCha_ctx *ctx, const uint8_t *m, uint8_t *c, uint3 x14 = j14; x15 = j15; - /* Do 20 rounds instead of 8 */ - for (i = 20; i > 0;i -= 2) { + /* Do 10 rounds instead of 8 */ + for (i = 0; i < 10; i++) { #ifdef DUMP dump_hex(&x0, 4); dump_hex(&x1, 4); -- 2.30.2