From: Niels Möller Date: Mon, 30 Nov 2020 19:23:01 +0000 (+0100) Subject: ppc: Add byte-swapping to chacha_4core, for big-endian builds. X-Git-Tag: nettle_3.7rc1~13^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efdd88ec59d2653bda53070448c8eb1889ca3544;p=thirdparty%2Fnettle.git ppc: Add byte-swapping to chacha_4core, for big-endian builds. --- diff --git a/powerpc64/p7/chacha-4core.asm b/powerpc64/p7/chacha-4core.asm index 49a801be..29d3f3c1 100644 --- a/powerpc64/p7/chacha-4core.asm +++ b/powerpc64/p7/chacha-4core.asm @@ -184,6 +184,19 @@ C Load state and splat vadduwm v10, v10, T2 vadduwm v11, v11, T2 +IF_BE(` + C Output always stored in little-endian byte order. + C Can reuse T0 and T1 to construct permutation mask. + li r9, 0 + lvsl T0, r9, r9 C 00 01 02 03 ... 0c 0d 0e 0f + vspltisb T1, 0x03 C 03 03 03 03 ... 03 03 03 03 + vxor T1, T1, T0 C 03 02 01 00 ... 0f 0e 0d 0c + + forloop(i, 0, 15, ` + vperm `v'i, `v'i, `v'i, T1 + ') +') + stxvw4x VSR(v0), 0, DST stxvw4x VSR(v4), r6, DST stxvw4x VSR(v8), r7, DST