Re: [PATCH 5/5] crypto: arm/blake2b - add NEON-optimized BLAKE2b implementation

Eric Biggers
2020-12-16T20:59:06Z

On Tue, Dec 15, 2020 at 03:47:08PM -0800, Eric Biggers wrote:
> +// Execute one round of BLAKE2b by updating the state matrix v[0..15] in the
> +// NEON registers q0-q7. The message block is in q8..q15. The stack pointer
> +// points to a 32-byte aligned buffer containing a copy of q8 and q9, so that
> +// they can be reloaded if q8 and q9 are used as temporary registers. The macro
> +// arguments s0-s15 give the order in which the message words are used in this
> +// round. 'final' is "true" if this is the final round, i.e. round 12 of 12.
> +.macro _blake2b_round s0, s1, s2, s3, s4, s5, s6, s7, \
> + s8, s9, s10, s11, s12, s13, s14, s15, final="false"
[...]
> + // Reloading q8-q9 can be skipped on the final round.
> +.if \final != "true"
> + vld1.8 {q8-q9}, [sp, :256]
> +.endif
> +.endm
[...]
> + _blake2b_round 14, 10, 4, 8, 9, 15, 13, 6, \
> + 1, 12, 0, 2, 11, 7, 5, 3, "true"

Apparently using the strings "true" and "false" here sometimes causes a build
error where they get treated as symbols
(https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org/thread/2JPD4H3VFBSKWPUCPEPRAXBVMSR2UCQI/),
though somehow it worked fine for me. I'll change this to use 1 and 0 instead.

- Eric