Re: [PATCH] selftests: vDSO: Also test counter in vdso_test_chacha

2024-09-01 Thread Jason A. Donenfeld
On Sun, Sep 01, 2024 at 08:08:13PM +0200, Jason A. Donenfeld wrote: > While you're doing this, also add the remaining, `0, 0` elements. > > counter2 will always be counter2. You meant for the first argument to be > counter1. > > Also, same issue with counter2 used twice in that memcmp. Fixed these

Re: [PATCH] selftests: vDSO: Also test counter in vdso_test_chacha

2024-09-01 Thread Jason A. Donenfeld
On Sun, Sep 01, 2024 at 08:08:13PM +0200, Jason A. Donenfeld wrote: > > + reference_chacha20_blocks(output1, key, counter1, BLOCKS); > > + __arch_chacha20_blocks_nostack(output2, key, counter2, BLOCKS); > > + if (memcmp(output1, output2, sizeof(output1)) || > > + memcmp(counter2, counte

Re: [PATCH] selftests: vDSO: Also test counter in vdso_test_chacha

2024-09-01 Thread Jason A. Donenfeld
On Sun, Sep 01, 2024 at 07:40:33PM +0200, Christophe Leroy wrote: > -static void reference_chacha20_blocks(uint8_t *dst_bytes, const uint32_t > *key, size_t nblocks) > +static void reference_chacha20_blocks(uint8_t *dst_bytes, const uint32_t > *key, uint32_t *counter, size_t nblocks) > { >

[PATCH] selftests: vDSO: Also test counter in vdso_test_chacha

2024-09-01 Thread Christophe Leroy
The chacha vDSO selftest doesn't check the way the counter is handled by __arch_chacha20_blocks_nostack(). It indirectly checks that the counter is writen on exit and read back on new entry, but it doesn't check that the format is correct. It has led to an invisible erroneous implementation on powe