• Christophe Leroy's avatar
    selftests: vDSO: also test counter in vdso_test_chacha · bb10ffe0
    Christophe Leroy authored
    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. When implementing this function on powerpc, I
    missed a case where the counter was writen and read in wrong byte order.
    
    Also, the counter uses two words, but the tests with a zero counter and
    uses a small amount of blocks, so at the end the upper part of the
    counter is always 0, so it is not checked.
    
    Add a verification of counter's content in addition to the verification
    of the output.
    
    Also add two tests where the counter crosses the u32 upper limit. The
    first test verifies that the function properly writes back the upper
    word, the second test verifies that the function properly reads back the
    upper word.
    Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
    bb10ffe0
vdso_test_chacha.c 3.1 KB