All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Shuah Khan <shuah@kernel.org>,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH] selftests: vDSO: Also test counter in vdso_test_chacha
Date: Sun, 1 Sep 2024 20:08:13 +0200	[thread overview]
Message-ID: <ZtStjU_3K9yIJsmp@zx2c4.com> (raw)
In-Reply-To: <f9f64c5ded3925ae408f01c1c61e2fdf6f645a71.1725212364.git.christophe.leroy@csgroup.eu>

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)
>  {
>  	uint32_t s[16] = {
>  		0x61707865U, 0x3320646eU, 0x79622d32U, 0x6b206574U,
> -		key[0], key[1], key[2], key[3], key[4], key[5], key[6], key[7]
> +		key[0], key[1], key[2], key[3], key[4], key[5], key[6], key[7],
> +		counter[0], counter[1],

While you're doing this, also add the remaining, `0, 0` elements.

> +			if (memcmp(output1, output2, sizeof(output1)) ||
> +			    memcmp(counter2, counter2, sizeof(counter1)))

counter2 will always be counter2. You meant for the first argument to be
counter1.

> +	reference_chacha20_blocks(output1, key, counter1, BLOCKS);
> +	__arch_chacha20_blocks_nostack(output2, key, counter2, BLOCKS);
> +	if (memcmp(output1, output2, sizeof(output1)) ||
> +	    memcmp(counter2, counter2, sizeof(counter1)))
> +		return KSFT_FAIL;
> +
> +	reference_chacha20_blocks(output1, key, counter1, BLOCKS);
> +	__arch_chacha20_blocks_nostack(output2, key, counter2, BLOCKS);
> +	if (memcmp(output1, output2, sizeof(output1)) ||
> +	    memcmp(counter2, counter2, sizeof(counter1)))
> +		return KSFT_FAIL;
> +

Why repeat these two stanzas? Also, same issue with counter2 used twice
in that memcmp.

  reply	other threads:[~2024-09-01 18:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-01 17:40 [PATCH] selftests: vDSO: Also test counter in vdso_test_chacha Christophe Leroy
2024-09-01 18:08 ` Jason A. Donenfeld [this message]
2024-09-02  1:25   ` Jason A. Donenfeld
2024-09-02  1:31   ` Jason A. Donenfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZtStjU_3K9yIJsmp@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.