From: Konstantinos Margaritis Date: Fri, 17 Mar 2023 09:37:57 +0000 (+0000) Subject: rewrite loop X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=02865900175891a530659f814393a00bd12a17f0;p=openpower-isa.git rewrite loop --- 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);